Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the unit from grams to kg in inventory form. #6750

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Components/Facility/AddInventoryForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const AddInventoryForm = (props: any) => {
if (unitName === "Dozen") {
return Number(unitData.quantity) * 12;
}
if (unitName === "Gram") {
if (unitName === "gram") {
return Number(unitData.quantity) / 1000;
}
return Number(unitData.quantity);
Expand Down Expand Up @@ -238,6 +238,11 @@ export const AddInventoryForm = (props: any) => {
};
// if user has selected "Add stock" or "stockValidation" function is true
if (data.is_incoming || stockValidation(data)) {
// if user has selected grams as unit then convert it to kg
if (data.unit === 5) {
data.quantity = data.quantity / 1000;
data.unit = 6;
}
const res = await dispatchAction(postInventory(data, { facilityId }));
setIsLoading(false);

Expand Down
Loading