mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: return total_peti, weight_per_convertion, and price_per_convertion in DeliveryProductToFieldValues function
This commit is contained in:
@@ -151,6 +151,25 @@ export const DeliveryProductToFieldValues = (
|
||||
value: item.product_warehouse.warehouse.id,
|
||||
label: item.product_warehouse.warehouse.name,
|
||||
};
|
||||
|
||||
const initialSisaBerat =
|
||||
item?.total_weight &&
|
||||
salesOrder?.weight_per_convertion &&
|
||||
salesOrder?.total_peti
|
||||
? Number(item.total_weight) -
|
||||
Number(salesOrder.weight_per_convertion) *
|
||||
Number(salesOrder.total_peti)
|
||||
: 0;
|
||||
|
||||
const initialPricePerConvertion =
|
||||
item?.total_price &&
|
||||
salesOrder?.total_peti &&
|
||||
Number(salesOrder.total_peti) !== 0
|
||||
? (Number(item.total_price) -
|
||||
initialSisaBerat * Number(item.unit_price || 0)) /
|
||||
Number(salesOrder.total_peti)
|
||||
: Number(item?.unit_price || 0);
|
||||
|
||||
return {
|
||||
id: salesOrder?.id,
|
||||
unit_price: item.unit_price,
|
||||
@@ -193,6 +212,9 @@ export const DeliveryProductToFieldValues = (
|
||||
avg_weight: item.avg_weight,
|
||||
total_price: item.total_price,
|
||||
},
|
||||
total_peti: salesOrder?.total_peti,
|
||||
weight_per_convertion: salesOrder?.weight_per_convertion,
|
||||
price_per_convertion: initialPricePerConvertion,
|
||||
} as DeliveryOrderProductFormValues;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user