@managesome/eposmatic-toolkit 0.2.377 → 0.2.379
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.
- package/lib/constants/WAREHOUSE_ANALYTICS.d.ts +30 -0
- package/lib/helpers/store/common-sale-order-actions.d.ts +5 -0
- package/lib/helpers/store/common-sale-order-actions.js +65 -0
- package/lib/helpers/store/index.d.ts +1 -0
- package/lib/helpers/store/index.js +1 -0
- package/lib/schemas/models/tenant.d.ts +3 -3
- package/lib/schemas/types/multi_tenants.d.ts +1 -0
- package/package.json +1 -1
|
@@ -105,6 +105,36 @@ export interface IWarehousePurchaseOrdersSummary {
|
|
|
105
105
|
totalQuantity: number;
|
|
106
106
|
}[];
|
|
107
107
|
}
|
|
108
|
+
export interface IWarehouseSaleOrdersSummary {
|
|
109
|
+
[SALES_SUMMARY_ENUM.TOTAL_SALES]: {
|
|
110
|
+
_id: string;
|
|
111
|
+
warehouse_id: string;
|
|
112
|
+
client_id: string;
|
|
113
|
+
staff_id: string;
|
|
114
|
+
staff_name: string;
|
|
115
|
+
client_name: string;
|
|
116
|
+
totalAmount: number;
|
|
117
|
+
totalQuantity: number;
|
|
118
|
+
amount_collected: number;
|
|
119
|
+
unpaidAmount: number;
|
|
120
|
+
unpaidQuantity: number;
|
|
121
|
+
cancelledAmount: number;
|
|
122
|
+
cancelledQuantity: number;
|
|
123
|
+
gstAmount: number;
|
|
124
|
+
gstQuantity: number;
|
|
125
|
+
}[];
|
|
126
|
+
[SALES_SUMMARY_ENUM.TOTAL_PAYMENT_SALES]: {
|
|
127
|
+
_id: string;
|
|
128
|
+
warehouse_id: string;
|
|
129
|
+
client_id: string;
|
|
130
|
+
staff_id: string;
|
|
131
|
+
payment_type: string;
|
|
132
|
+
client_name: string;
|
|
133
|
+
staff_name: string;
|
|
134
|
+
totalAmount: number;
|
|
135
|
+
totalQuantity: number;
|
|
136
|
+
}[];
|
|
137
|
+
}
|
|
108
138
|
export interface IWarehouseInvoicesSummary {
|
|
109
139
|
[SALES_SUMMARY_ENUM.TOTAL_SALES]: {
|
|
110
140
|
_id: string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ISaleOrder, ISaleOrderCategory, ISaleOrderItem, ISaleOrderIteration } from '../../schemas';
|
|
2
|
+
export declare function getSaleOrderIterationsWithPrice(iterations?: ISaleOrderIteration[] | undefined, writeable?: boolean): ISaleOrderIteration[];
|
|
3
|
+
export declare function getSaleOrderItemsWithPrice(items: ISaleOrderItem[] | undefined, convertToPrice: (price: number) => number): ISaleOrderItem[];
|
|
4
|
+
export declare function getSaleOrderCategoriesWithPrice(categories: ISaleOrderCategory[] | undefined, convertToPrice: (price: number) => number): ISaleOrderCategory[];
|
|
5
|
+
export declare function getSaleOrderWithPrice<T extends Partial<ISaleOrder> | ISaleOrder | ISaleOrderIteration>(order: T, writeable?: boolean): T;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSaleOrderIterationsWithPrice = getSaleOrderIterationsWithPrice;
|
|
4
|
+
exports.getSaleOrderItemsWithPrice = getSaleOrderItemsWithPrice;
|
|
5
|
+
exports.getSaleOrderCategoriesWithPrice = getSaleOrderCategoriesWithPrice;
|
|
6
|
+
exports.getSaleOrderWithPrice = getSaleOrderWithPrice;
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
// ── Iterations ──────────────────────────────────────────────────
|
|
9
|
+
function getSaleOrderIterationsWithPrice(iterations, writeable) {
|
|
10
|
+
if (!iterations)
|
|
11
|
+
return [];
|
|
12
|
+
return iterations.map((iteration) => getSaleOrderWithPrice(iteration, writeable));
|
|
13
|
+
}
|
|
14
|
+
// ── Items ───────────────────────────────────────────────────────
|
|
15
|
+
function getSaleOrderItemsWithPrice(items, convertToPrice) {
|
|
16
|
+
if (!items)
|
|
17
|
+
return [];
|
|
18
|
+
return items.map((item) => ({
|
|
19
|
+
...item,
|
|
20
|
+
quantity: (0, utils_1.parseNum)(item.quantity || 1, true),
|
|
21
|
+
price: convertToPrice(item.price ?? 0),
|
|
22
|
+
subtotal: convertToPrice(item.subtotal ?? 0),
|
|
23
|
+
_gst_amount: convertToPrice(item._gst_amount ?? 0),
|
|
24
|
+
_net_amount: convertToPrice(item._net_amount ?? 0),
|
|
25
|
+
_gross_amount: convertToPrice(item._gross_amount ?? 0),
|
|
26
|
+
_discount_amount: convertToPrice(item._discount_amount ?? 0),
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
// ── Categories ──────────────────────────────────────────────────
|
|
30
|
+
function getSaleOrderCategoriesWithPrice(categories, convertToPrice) {
|
|
31
|
+
if (!categories)
|
|
32
|
+
return [];
|
|
33
|
+
return categories.map((category) => ({
|
|
34
|
+
...category,
|
|
35
|
+
items: getSaleOrderItemsWithPrice(category.items, convertToPrice),
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
// ── Main helper ─────────────────────────────────────────────────
|
|
39
|
+
function getSaleOrderWithPrice(order, writeable) {
|
|
40
|
+
const convertToPrice = writeable ? utils_1.convertDecimalToInt : utils_1.convertIntToDecimal;
|
|
41
|
+
const payload = {
|
|
42
|
+
...order,
|
|
43
|
+
...(order.iterations != null
|
|
44
|
+
? {
|
|
45
|
+
iterations: getSaleOrderIterationsWithPrice(order.iterations, writeable),
|
|
46
|
+
}
|
|
47
|
+
: {}),
|
|
48
|
+
...(order.categories != null
|
|
49
|
+
? {
|
|
50
|
+
categories: getSaleOrderCategoriesWithPrice(order.categories, convertToPrice),
|
|
51
|
+
}
|
|
52
|
+
: {}),
|
|
53
|
+
...(order.gst != null ? { gst: convertToPrice(order.gst) } : {}),
|
|
54
|
+
...(order.gst_amount != null ? { gst_amount: convertToPrice(order.gst_amount) } : {}),
|
|
55
|
+
...(order.amount_collected != null
|
|
56
|
+
? {
|
|
57
|
+
amount_collected: convertToPrice(order.amount_collected),
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
60
|
+
...(order.amount_earned != null ? { amount_earned: convertToPrice(order.amount_earned) } : {}),
|
|
61
|
+
...(order.grand_total != null ? { grand_total: convertToPrice(order.grand_total) } : {}),
|
|
62
|
+
...(order.price != null ? { price: convertToPrice(order.price) } : {}),
|
|
63
|
+
};
|
|
64
|
+
return payload;
|
|
65
|
+
}
|
|
@@ -5,6 +5,7 @@ export * from './cart-actions';
|
|
|
5
5
|
export * from './catalog-actions';
|
|
6
6
|
export * from './common-order-actions';
|
|
7
7
|
export * from './common-purchase-order-actions';
|
|
8
|
+
export * from './common-sale-order-actions';
|
|
8
9
|
export * from './common-warehouse-invoice-actions';
|
|
9
10
|
export * from './offline-ordering';
|
|
10
11
|
export * from './purchase-orders-cart-actions';
|
|
@@ -21,6 +21,7 @@ __exportStar(require("./cart-actions"), exports);
|
|
|
21
21
|
__exportStar(require("./catalog-actions"), exports);
|
|
22
22
|
__exportStar(require("./common-order-actions"), exports);
|
|
23
23
|
__exportStar(require("./common-purchase-order-actions"), exports);
|
|
24
|
+
__exportStar(require("./common-sale-order-actions"), exports);
|
|
24
25
|
__exportStar(require("./common-warehouse-invoice-actions"), exports);
|
|
25
26
|
__exportStar(require("./offline-ordering"), exports);
|
|
26
27
|
__exportStar(require("./purchase-orders-cart-actions"), exports);
|
|
@@ -128,6 +128,7 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
128
128
|
twitter_link?: string | null | undefined;
|
|
129
129
|
tiktok_link?: string | null | undefined;
|
|
130
130
|
dark_mode?: boolean | null | undefined;
|
|
131
|
+
delivery_areas_search_type?: import("../../constants").DELIVERY_AREAS_SEARCH_TYPE_ENUM | null | undefined;
|
|
131
132
|
is_surcharge_percentage?: boolean | null | undefined;
|
|
132
133
|
is_surcharge_taxable?: boolean | null | undefined;
|
|
133
134
|
is_service_fee_percentage?: boolean | null | undefined;
|
|
@@ -162,7 +163,6 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
162
163
|
web_hide_order_total_for_staff?: boolean | null | undefined;
|
|
163
164
|
apply_tax_on_complimentary_payment?: boolean | null | undefined;
|
|
164
165
|
web_auth_type?: import("../../constants").WEB_AUTH_TYPE_ENUM | null | undefined;
|
|
165
|
-
delivery_areas_search_type?: import("../../constants").DELIVERY_AREAS_SEARCH_TYPE_ENUM | null | undefined;
|
|
166
166
|
edit_settled_order?: boolean | null | undefined;
|
|
167
167
|
omit_offers_for_anonymous?: boolean | null | undefined;
|
|
168
168
|
playstore_url?: string | null | undefined;
|
|
@@ -299,6 +299,7 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
299
299
|
twitter_link?: string | null | undefined;
|
|
300
300
|
tiktok_link?: string | null | undefined;
|
|
301
301
|
dark_mode?: boolean | null | undefined;
|
|
302
|
+
delivery_areas_search_type?: import("../../constants").DELIVERY_AREAS_SEARCH_TYPE_ENUM | null | undefined;
|
|
302
303
|
is_surcharge_percentage?: boolean | null | undefined;
|
|
303
304
|
is_surcharge_taxable?: boolean | null | undefined;
|
|
304
305
|
is_service_fee_percentage?: boolean | null | undefined;
|
|
@@ -333,7 +334,6 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
333
334
|
web_hide_order_total_for_staff?: boolean | null | undefined;
|
|
334
335
|
apply_tax_on_complimentary_payment?: boolean | null | undefined;
|
|
335
336
|
web_auth_type?: import("../../constants").WEB_AUTH_TYPE_ENUM | null | undefined;
|
|
336
|
-
delivery_areas_search_type?: import("../../constants").DELIVERY_AREAS_SEARCH_TYPE_ENUM | null | undefined;
|
|
337
337
|
edit_settled_order?: boolean | null | undefined;
|
|
338
338
|
omit_offers_for_anonymous?: boolean | null | undefined;
|
|
339
339
|
playstore_url?: string | null | undefined;
|
|
@@ -470,6 +470,7 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
470
470
|
twitter_link?: string | null | undefined;
|
|
471
471
|
tiktok_link?: string | null | undefined;
|
|
472
472
|
dark_mode?: boolean | null | undefined;
|
|
473
|
+
delivery_areas_search_type?: import("../../constants").DELIVERY_AREAS_SEARCH_TYPE_ENUM | null | undefined;
|
|
473
474
|
is_surcharge_percentage?: boolean | null | undefined;
|
|
474
475
|
is_surcharge_taxable?: boolean | null | undefined;
|
|
475
476
|
is_service_fee_percentage?: boolean | null | undefined;
|
|
@@ -504,7 +505,6 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
504
505
|
web_hide_order_total_for_staff?: boolean | null | undefined;
|
|
505
506
|
apply_tax_on_complimentary_payment?: boolean | null | undefined;
|
|
506
507
|
web_auth_type?: import("../../constants").WEB_AUTH_TYPE_ENUM | null | undefined;
|
|
507
|
-
delivery_areas_search_type?: import("../../constants").DELIVERY_AREAS_SEARCH_TYPE_ENUM | null | undefined;
|
|
508
508
|
edit_settled_order?: boolean | null | undefined;
|
|
509
509
|
omit_offers_for_anonymous?: boolean | null | undefined;
|
|
510
510
|
playstore_url?: string | null | undefined;
|
|
@@ -14,6 +14,7 @@ export interface IBrandTenantInfo {
|
|
|
14
14
|
country_name: ITenant['country_name'];
|
|
15
15
|
coordinates: ITenant['coordinates'];
|
|
16
16
|
dark_mode: ITenant['dark_mode'];
|
|
17
|
+
delivery_areas_search_type: ITenant['delivery_areas_search_type'];
|
|
17
18
|
}
|
|
18
19
|
export interface IBrandMultiTenantsInfo {
|
|
19
20
|
_id: IBrand['_id'];
|