@managesome/eposmatic-toolkit 0.2.376 → 0.2.377
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SALES_SUMMARY_ENUM } from './ANALYTICS';
|
|
2
|
-
import { PURCHASE_ORDER_STATUS_ENUM, WAREHOUSE_INVOICE_STATUS_ENUM } from './ENUMS';
|
|
2
|
+
import { PURCHASE_ORDER_STATUS_ENUM, SALE_ORDER_INVOICE_TYPE_ENUM, SALES_ORDER_STATUS_ENUM, WAREHOUSE_INVOICE_STATUS_ENUM } from './ENUMS';
|
|
3
3
|
export declare enum WAREHOUSE_DASHBOARD_ANALYTICS_ENUM {
|
|
4
4
|
PURCHASE_ORDERS = "PURCHASE_ORDERS",
|
|
5
5
|
INVOICES = "INVOICES"
|
|
@@ -59,6 +59,22 @@ export interface IClientInvoicesOverview {
|
|
|
59
59
|
totalAmount: number;
|
|
60
60
|
totalQuantity: number;
|
|
61
61
|
}
|
|
62
|
+
export interface ISaleOrderInvoiceEntry {
|
|
63
|
+
invoiceType: SALE_ORDER_INVOICE_TYPE_ENUM;
|
|
64
|
+
paymentType: string;
|
|
65
|
+
amount: number;
|
|
66
|
+
}
|
|
67
|
+
export interface ISaleOrdersOverview {
|
|
68
|
+
_id: string;
|
|
69
|
+
warehouse_id: string;
|
|
70
|
+
client_id: string;
|
|
71
|
+
order_status: SALES_ORDER_STATUS_ENUM;
|
|
72
|
+
client_name: string;
|
|
73
|
+
saleOrderId: string;
|
|
74
|
+
totalAmount: number;
|
|
75
|
+
totalQuantity: number;
|
|
76
|
+
invoices: ISaleOrderInvoiceEntry[];
|
|
77
|
+
}
|
|
62
78
|
export interface IWarehousePurchaseOrdersSummary {
|
|
63
79
|
[SALES_SUMMARY_ENUM.TOTAL_SALES]: {
|
|
64
80
|
_id: string;
|
|
@@ -2052,6 +2052,21 @@ function applyCustomDiscountCapsPostSync(synced, appliedCustomDiscounts, platfor
|
|
|
2052
2052
|
};
|
|
2053
2053
|
needsResync = true;
|
|
2054
2054
|
}
|
|
2055
|
+
// Re-cap: percentage still exceeds cap, but the current flat amount
|
|
2056
|
+
// is below cap (e.g. scaled down by a quantity change). Push it
|
|
2057
|
+
// back to maxCap.
|
|
2058
|
+
else if (computedDiscount > maxCap && orderDetails.special_discount < maxCap) {
|
|
2059
|
+
result = {
|
|
2060
|
+
...result,
|
|
2061
|
+
order_discount_details: {
|
|
2062
|
+
...orderDetails,
|
|
2063
|
+
special_discount: maxCap,
|
|
2064
|
+
is_special_discount_percentage: false,
|
|
2065
|
+
total_discount: 0,
|
|
2066
|
+
},
|
|
2067
|
+
};
|
|
2068
|
+
needsResync = true;
|
|
2069
|
+
}
|
|
2055
2070
|
}
|
|
2056
2071
|
}
|
|
2057
2072
|
}
|
|
@@ -2115,6 +2130,24 @@ function applyCustomDiscountCapsPostSync(synced, appliedCustomDiscounts, platfor
|
|
|
2115
2130
|
categoryChanged = true;
|
|
2116
2131
|
continue;
|
|
2117
2132
|
}
|
|
2133
|
+
// Re-cap: percentage still exceeds cap, but the current flat amount
|
|
2134
|
+
// is below cap (e.g. scaled down proportionally by a quantity
|
|
2135
|
+
// decrease). Push it back to maxCap so the discount stays at the
|
|
2136
|
+
// configured limit instead of an incorrect scaled-down value.
|
|
2137
|
+
if (computedDiscount > maxCap && itemDetails.special_discount < maxCap) {
|
|
2138
|
+
newItems.push({
|
|
2139
|
+
...item,
|
|
2140
|
+
item_discount_details: {
|
|
2141
|
+
...itemDetails,
|
|
2142
|
+
special_discount: maxCap,
|
|
2143
|
+
is_special_discount_percentage: false,
|
|
2144
|
+
total_discount: 0,
|
|
2145
|
+
},
|
|
2146
|
+
});
|
|
2147
|
+
needsResync = true;
|
|
2148
|
+
categoryChanged = true;
|
|
2149
|
+
continue;
|
|
2150
|
+
}
|
|
2118
2151
|
}
|
|
2119
2152
|
}
|
|
2120
2153
|
newItems.push(item);
|