Bugfix
This commit is contained in:
@@ -18,9 +18,7 @@ export const useCategoriesStore = defineStore('categories', () => {
|
||||
product.BasePrice = product.Twr_Cena;
|
||||
product.BasePriceZ = product.Twr_CenaZ;
|
||||
product.SummedQuantity = 0;
|
||||
product.SummedQuantityZ = 0;
|
||||
product.SummedPrice = 0;
|
||||
product.SummedPriceZ = 0;
|
||||
if (product.Twr_JMZ != null) {
|
||||
product.Options.push(product.Twr_JMZ);
|
||||
}
|
||||
@@ -46,22 +44,18 @@ export const useCategoriesStore = defineStore('categories', () => {
|
||||
for (const order of orders) {
|
||||
for (const product of order.MZamElem) {
|
||||
const mapProduct = productsMap.get(String(product.MZE_TwrId));
|
||||
if(product.MZE_TwrJm == mapProduct?.Twr_JM) {
|
||||
if (product.MZE_TwrJm == mapProduct?.Twr_JM) {
|
||||
mapProduct.SummedQuantity += Number(product.MZE_TwrIlosc);
|
||||
mapProduct.SummedPrice += (Number(product.MZE_TwrCena) * Number(product.MZE_TwrIlosc));
|
||||
}
|
||||
if (product.MZE_TwrJm == mapProduct?.Twr_JMZ) {
|
||||
mapProduct.SummedQuantityZ += Number(product.MZE_TwrIlosc);
|
||||
mapProduct.SummedPriceZ += (Number(product.MZE_TwrCena) * Number(product.MZE_TwrIlosc));
|
||||
// mapProduct.SummedQuantity += Number(product.MZE_TwrIlosc) * Number(product.mnoznik);
|
||||
// mapProduct.SummedPrice += (Number(product.MZE_TwrCena) * Number(product.MZE_TwrIlosc));
|
||||
else if (product.MZE_TwrJm == mapProduct?.Twr_JMZ) {
|
||||
mapProduct.SummedQuantity += (Number(product.MZE_TwrIlosc) * Number(mapProduct.Twr_JMPrzelicznikM))/Number(mapProduct.Twr_JMPrzelicznikL);
|
||||
mapProduct.SummedPrice += (Number(product.MZE_TwrCena) * Number(product.MZE_TwrIlosc));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(categories.value);
|
||||
return productsMap;
|
||||
}
|
||||
|
||||
return {categories, fetchCategories, sumProductsFromOrders}
|
||||
|
||||
Reference in New Issue
Block a user