lazywait-calcs 1.0.3 → 1.0.5

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/cjs/index.js CHANGED
@@ -1,23 +1,29 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicesDiffrence = exports.calcItemAddons = exports.calcItemDiscounts = exports.calcClosingCashBalance = exports.calPaymentTotal = exports.calcPaymentBalanceDue = exports.Total = exports.printedOrderTaxes = exports.OtherCharges = exports.Deliveries = exports.NonTaxableAmount = exports.TaxableAmount = exports.Vat = exports.ItemVat = exports.DiscountsWithVat = exports.Discounts = exports.calcItem = exports.Subtotal = exports.ItemTotal = void 0;
4
- const Calcs_1 = require("./Calcs");
5
- Object.defineProperty(exports, "ItemTotal", { enumerable: true, get: function () { return Calcs_1.ItemTotal; } });
6
- Object.defineProperty(exports, "Subtotal", { enumerable: true, get: function () { return Calcs_1.Subtotal; } });
7
- Object.defineProperty(exports, "calcItem", { enumerable: true, get: function () { return Calcs_1.calcItem; } });
8
- Object.defineProperty(exports, "Discounts", { enumerable: true, get: function () { return Calcs_1.Discounts; } });
9
- Object.defineProperty(exports, "DiscountsWithVat", { enumerable: true, get: function () { return Calcs_1.DiscountsWithVat; } });
10
- Object.defineProperty(exports, "ItemVat", { enumerable: true, get: function () { return Calcs_1.ItemVat; } });
11
- Object.defineProperty(exports, "Vat", { enumerable: true, get: function () { return Calcs_1.Vat; } });
12
- Object.defineProperty(exports, "TaxableAmount", { enumerable: true, get: function () { return Calcs_1.TaxableAmount; } });
13
- Object.defineProperty(exports, "NonTaxableAmount", { enumerable: true, get: function () { return Calcs_1.NonTaxableAmount; } });
14
- Object.defineProperty(exports, "Deliveries", { enumerable: true, get: function () { return Calcs_1.Deliveries; } });
15
- Object.defineProperty(exports, "OtherCharges", { enumerable: true, get: function () { return Calcs_1.OtherCharges; } });
16
- Object.defineProperty(exports, "printedOrderTaxes", { enumerable: true, get: function () { return Calcs_1.printedOrderTaxes; } });
17
- Object.defineProperty(exports, "Total", { enumerable: true, get: function () { return Calcs_1.Total; } });
18
- Object.defineProperty(exports, "calcPaymentBalanceDue", { enumerable: true, get: function () { return Calcs_1.calcPaymentBalanceDue; } });
19
- Object.defineProperty(exports, "calPaymentTotal", { enumerable: true, get: function () { return Calcs_1.calPaymentTotal; } });
20
- Object.defineProperty(exports, "calcClosingCashBalance", { enumerable: true, get: function () { return Calcs_1.calcClosingCashBalance; } });
21
- Object.defineProperty(exports, "calcItemDiscounts", { enumerable: true, get: function () { return Calcs_1.calcItemDiscounts; } });
22
- Object.defineProperty(exports, "calcItemAddons", { enumerable: true, get: function () { return Calcs_1.calcItemAddons; } });
23
- Object.defineProperty(exports, "getInvoicesDiffrence", { enumerable: true, get: function () { return Calcs_1.getInvoicesDiffrence; } });
26
+ exports.Types = exports.Setters = exports.Calcs = void 0;
27
+ exports.Calcs = __importStar(require("./Calcs"));
28
+ exports.Setters = __importStar(require("./setters"));
29
+ exports.Types = __importStar(require("./types"));
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setOrderPayments = exports.setOrderAddonFromCategory = exports.setOrderAddonFromItem = exports.setOrderTax = exports.setOrderDiscount = exports.setOrderItemPrice = exports.setOrderItem = exports.setNewOrder = void 0;
4
+ const utils_1 = require("./utils");
5
+ /**
6
+ * This sets a new order with all default values
7
+ * @param client_id branch's client_id
8
+ * @param branch_id branch's branch_id
9
+ * @param vat branch's vat percentage amount
10
+ * @param vatNumber branch's vat registeration number
11
+ * @param info other order values
12
+ * @returns new order
13
+ */
14
+ function setNewOrder(client_id, branch_id, vat, vatNumber, info) {
15
+ const order = Object.assign({ branch_id: branch_id, client_id: client_id, vat_number: vatNumber, tax_percentage: vat, isVoid: false, isPaid: false, closing_id: null, order_items: [], order_discounts: [], order_taxes: [], order_deliveries: [], source: 'POSLITE', order_type: 'pickup', people_count: 1, loyalty_amount: 0, discount: 0, tax: 0, taxes_charges: 0, subtotal: 0, auto_bill_printed: false }, info);
16
+ return order;
17
+ }
18
+ exports.setNewOrder = setNewOrder;
19
+ function setOrderItem(branch_id, item, price, quantity, addons, printer_id, discounts, taxes, not_taxable, details, employees) {
20
+ const id = `${(0, utils_1.getID)()}.${item.menu_item_id}`;
21
+ const order_item_price = setOrderItemPrice(price, branch_id);
22
+ const order_item = {
23
+ branch_id: branch_id,
24
+ client_id: item === null || item === void 0 ? void 0 : item.client_id,
25
+ menu_item_id: item === null || item === void 0 ? void 0 : item.menu_item_id,
26
+ menu_category_id: item === null || item === void 0 ? void 0 : item.menu_category_id,
27
+ name_lan_s: (item === null || item === void 0 ? void 0 : item.name_lan_s) || '',
28
+ name_lan_p: item === null || item === void 0 ? void 0 : item.name_lan_p,
29
+ cat_name_lan_s: (item === null || item === void 0 ? void 0 : item.cat_name_lan_s) || '',
30
+ cat_name_lan_p: item === null || item === void 0 ? void 0 : item.cat_name_lan_p,
31
+ quantity,
32
+ split_qty: quantity,
33
+ details: details || '',
34
+ price: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.price) || 0,
35
+ total_calories: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.calories) || 0,
36
+ price_id: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.price_id) || '',
37
+ cost: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.cost) || 0,
38
+ order_item_price: order_item_price,
39
+ // sources: item?.sources || [],
40
+ // sources_ids: item?.sources_ids || [],
41
+ order_item_id: id,
42
+ stock_enabled: price === null || price === void 0 ? void 0 : price.stock_enabled,
43
+ addons,
44
+ discounts,
45
+ taxes,
46
+ not_taxable,
47
+ taxable: !not_taxable,
48
+ printer_id: printer_id || '',
49
+ employees,
50
+ not_printed: true,
51
+ };
52
+ return order_item;
53
+ }
54
+ exports.setOrderItem = setOrderItem;
55
+ function setOrderItemPrice(order_item_price, branch_id) {
56
+ return {
57
+ client_id: order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.client_id,
58
+ branch_id: branch_id,
59
+ item_name_lan_p: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.item_name_lan_p) || '',
60
+ item_name_lan_s: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.item_name_lan_s) || '',
61
+ name_lan_p: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.name_lan_p) || '',
62
+ name_lan_s: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.name_lan_s) || '',
63
+ price: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.price) || 0,
64
+ price_id: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.price_id) || '',
65
+ cost: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.cost) || 0,
66
+ barcode: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.barcode) || '',
67
+ calories: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.calories) || 0,
68
+ loyalty_points: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.loyalty_points) || 0,
69
+ menu_category_id: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.menu_category_id) || '',
70
+ menu_item_id: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.menu_item_id) || '',
71
+ custom_addons_limit: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.custom_addons_limit) || 0,
72
+ included_custom_addons_ids: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.included_custom_addons_ids) || [],
73
+ stock_enabled: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.stock_enabled) || false,
74
+ consumption: order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.consumption,
75
+ zoho_books_id: order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.zoho_books_id,
76
+ multi_max: (order_item_price === null || order_item_price === void 0 ? void 0 : order_item_price.multi_max) || 0,
77
+ };
78
+ }
79
+ exports.setOrderItemPrice = setOrderItemPrice;
80
+ function setOrderDiscount(discount, branch_id) {
81
+ return {
82
+ branch_id: branch_id,
83
+ client_id: discount === null || discount === void 0 ? void 0 : discount.client_id,
84
+ discount_id: discount === null || discount === void 0 ? void 0 : discount.discount_id,
85
+ is_percentage: (discount === null || discount === void 0 ? void 0 : discount.is_percentage) || false,
86
+ amount: discount === null || discount === void 0 ? void 0 : discount.amount,
87
+ spends_at_least: (discount === null || discount === void 0 ? void 0 : discount.spends_at_least) || false,
88
+ valid_from: (discount === null || discount === void 0 ? void 0 : discount.valid_from) || null,
89
+ valid_to: (discount === null || discount === void 0 ? void 0 : discount.valid_to) || null,
90
+ isTimeBound: (discount === null || discount === void 0 ? void 0 : discount.isTimeBound) || false,
91
+ spends_at_least_amount: (discount === null || discount === void 0 ? void 0 : discount.spends_at_least_amount) || 0,
92
+ is_multi_time_range: (discount === null || discount === void 0 ? void 0 : discount.is_multi_time_range) || false,
93
+ time_range: (discount === null || discount === void 0 ? void 0 : discount.time_range) || null,
94
+ note: (discount === null || discount === void 0 ? void 0 : discount.note) || '',
95
+ auto_apply: (discount === null || discount === void 0 ? void 0 : discount.auto_apply) || false,
96
+ discount_name: discount === null || discount === void 0 ? void 0 : discount.discount_name,
97
+ };
98
+ }
99
+ exports.setOrderDiscount = setOrderDiscount;
100
+ function setOrderTax(tax, branch_id) {
101
+ return {
102
+ branch_id: branch_id,
103
+ client_id: tax === null || tax === void 0 ? void 0 : tax.client_id,
104
+ tax_id: tax === null || tax === void 0 ? void 0 : tax.tax_id,
105
+ name_lan_p: tax === null || tax === void 0 ? void 0 : tax.name_lan_p,
106
+ name_lan_s: (tax === null || tax === void 0 ? void 0 : tax.name_lan_s) || '',
107
+ amount: tax === null || tax === void 0 ? void 0 : tax.amount,
108
+ auto_apply: tax === null || tax === void 0 ? void 0 : tax.auto_apply,
109
+ isPercent: tax === null || tax === void 0 ? void 0 : tax.isPercent,
110
+ active: tax === null || tax === void 0 ? void 0 : tax.active,
111
+ is_selective_tax: tax === null || tax === void 0 ? void 0 : tax.is_selective_tax,
112
+ spends_at_least: (tax === null || tax === void 0 ? void 0 : tax.spends_at_least) || false,
113
+ spends_at_least_amount: (tax === null || tax === void 0 ? void 0 : tax.spends_at_least_amount) || 0,
114
+ };
115
+ }
116
+ exports.setOrderTax = setOrderTax;
117
+ function setOrderAddonFromItem(addon, is_without, branch_id, is_included_in_custom_addons) {
118
+ const id = `${(0, utils_1.getID)()}.${addon.addon_id}`;
119
+ return {
120
+ type: 'ITEM_ADDON',
121
+ client_id: addon === null || addon === void 0 ? void 0 : addon.client_id,
122
+ branch_id: branch_id,
123
+ order_addon_id: id,
124
+ addon_id: addon === null || addon === void 0 ? void 0 : addon.addon_id,
125
+ name_lan_p: addon === null || addon === void 0 ? void 0 : addon.name_lan_p,
126
+ name_lan_s: (addon === null || addon === void 0 ? void 0 : addon.name_lan_s) || '',
127
+ price: typeof (addon === null || addon === void 0 ? void 0 : addon.price) === 'string' ? parseFloat(addon === null || addon === void 0 ? void 0 : addon.price) : (addon === null || addon === void 0 ? void 0 : addon.price) || 0,
128
+ is_without,
129
+ calories: addon === null || addon === void 0 ? void 0 : addon.calories,
130
+ menu_category_id: addon === null || addon === void 0 ? void 0 : addon.menu_category_id,
131
+ menu_item_id: addon === null || addon === void 0 ? void 0 : addon.menu_item_id,
132
+ stock_enabled: addon === null || addon === void 0 ? void 0 : addon.stock_enabled,
133
+ quantity: is_without ? 0 : 1,
134
+ cost: (addon === null || addon === void 0 ? void 0 : addon.cost) || 0,
135
+ // sources: addon?.sources,
136
+ // sources_ids: addon?.sources_ids,
137
+ consumption: addon === null || addon === void 0 ? void 0 : addon.consumption,
138
+ is_included_in_custom_addons,
139
+ original_price: typeof (addon === null || addon === void 0 ? void 0 : addon.price) === 'string' ? parseFloat(addon === null || addon === void 0 ? void 0 : addon.price) : addon === null || addon === void 0 ? void 0 : addon.price,
140
+ };
141
+ }
142
+ exports.setOrderAddonFromItem = setOrderAddonFromItem;
143
+ function setOrderAddonFromCategory(addon, is_without, branch_id, is_included_in_custom_addons) {
144
+ const id = `${(0, utils_1.getID)()}.${addon.addon_id}`;
145
+ return {
146
+ type: 'CATEGORY_ADDON',
147
+ client_id: addon === null || addon === void 0 ? void 0 : addon.client_id,
148
+ branch_id: branch_id,
149
+ order_addon_id: id,
150
+ addon_id: addon === null || addon === void 0 ? void 0 : addon.addon_id,
151
+ name_lan_p: addon === null || addon === void 0 ? void 0 : addon.name_lan_p,
152
+ name_lan_s: (addon === null || addon === void 0 ? void 0 : addon.name_lan_s) || '',
153
+ price: typeof (addon === null || addon === void 0 ? void 0 : addon.price) === 'string' ? parseFloat(addon === null || addon === void 0 ? void 0 : addon.price) : (addon === null || addon === void 0 ? void 0 : addon.price) || 0,
154
+ is_without,
155
+ calories: addon === null || addon === void 0 ? void 0 : addon.calories,
156
+ stock_enabled: addon === null || addon === void 0 ? void 0 : addon.stock_enabled,
157
+ menu_category_id: addon === null || addon === void 0 ? void 0 : addon.menu_category_id,
158
+ quantity: is_without ? 0 : 1,
159
+ cost: (addon === null || addon === void 0 ? void 0 : addon.cost) || 0,
160
+ // sources: addon?.sources,
161
+ sources_ids: addon === null || addon === void 0 ? void 0 : addon.sources_ids,
162
+ consumption: addon === null || addon === void 0 ? void 0 : addon.consumption,
163
+ is_included_in_custom_addons,
164
+ original_price: typeof (addon === null || addon === void 0 ? void 0 : addon.price) === 'string' ? parseFloat(addon === null || addon === void 0 ? void 0 : addon.price) : addon === null || addon === void 0 ? void 0 : addon.price,
165
+ };
166
+ }
167
+ exports.setOrderAddonFromCategory = setOrderAddonFromCategory;
168
+ function setOrderPayments(methods, order, branch, terminal) {
169
+ if ((order === null || order === void 0 ? void 0 : order.change) && (order === null || order === void 0 ? void 0 : order.isPaid)) {
170
+ methods.push({
171
+ name_lan_p: 'CASH',
172
+ name_lan_s: 'CASH',
173
+ amount: `${order === null || order === void 0 ? void 0 : order.change}`,
174
+ is_cash: true,
175
+ });
176
+ }
177
+ return methods
178
+ .filter((m) => (m === null || m === void 0 ? void 0 : m.amount) && !(0, utils_1.isEmpty)(m === null || m === void 0 ? void 0 : m.amount) && parseFloat((m === null || m === void 0 ? void 0 : m.amount) || '0') !== 0)
179
+ .map((m) => {
180
+ const id = `${(0, utils_1.getID)()}`;
181
+ return {
182
+ terminal_id: terminal === null || terminal === void 0 ? void 0 : terminal.terminal_id,
183
+ client_id: branch === null || branch === void 0 ? void 0 : branch.client_id,
184
+ branch_id: branch === null || branch === void 0 ? void 0 : branch.branch_id,
185
+ order_ref: order === null || order === void 0 ? void 0 : order.order_ref,
186
+ order_paymnet_id: id,
187
+ is_cash: m === null || m === void 0 ? void 0 : m.is_cash,
188
+ name_lan_p: m === null || m === void 0 ? void 0 : m.name_lan_p,
189
+ name_lan_s: (m === null || m === void 0 ? void 0 : m.name_lan_s) || '',
190
+ payment_date: new Date(),
191
+ payment_amount: parseFloat((m === null || m === void 0 ? void 0 : m.amount) || '0'),
192
+ pos_payment: m === null || m === void 0 ? void 0 : m.pos_payment,
193
+ split_id: m === null || m === void 0 ? void 0 : m.split_id,
194
+ };
195
+ });
196
+ }
197
+ exports.setOrderPayments = setOrderPayments;
@@ -1,22 +1,21 @@
1
1
  import { Branch, CashierClosing, Order, OrderDiscount, OrderItem, OrderTax, PrintedTax, CashierOpening, OrderDelivery } from './types';
2
- declare function ItemTotal(order_item: OrderItem, branch_vat: number | null, order_taxes?: OrderTax[], order_discounts?: OrderDiscount[], order_items_count?: number): number;
3
- declare function Subtotal(order_items: OrderItem[] | null): number;
4
- declare function calcItem(order_item: OrderItem): number;
5
- declare function Discounts(order_discounts: OrderDiscount[] | null, order_items: OrderItem[] | null, loyalty_amount: number | null, branch_vat: number | null): number;
6
- declare function DiscountsWithVat(order_discounts: OrderDiscount[] | null, order_items: OrderItem[] | null, loyalty_amount: number | null, branch_vat: number | null): number;
7
- declare function ItemVat(order_item: OrderItem, branch_vat: number | null): number;
8
- declare function Vat(order: Order | null, order_items: OrderItem[], loyalty_amount: number | null, branch_vat: number | null): number;
9
- declare function TaxableAmount(order_items: OrderItem[] | null): number;
10
- declare function NonTaxableAmount(order_items: OrderItem[] | null): number;
11
- declare function Deliveries(order_deliveries: OrderDelivery[] | null): number;
12
- declare function OtherCharges(order_items: OrderItem[], order: Order | null, loyalty_amount: number | null, branch_vat: number | null): number;
13
- declare function printedOrderTaxes(order: Order | null, loyalty_amount: number | null, branch_vat: number | null): PrintedTax[];
14
- declare function Total(order: Order | null, order_items: OrderItem[], loyalty_amount: number | null, branch_vat: number | null): number;
15
- declare function calcPaymentBalanceDue(invoice: Order, branch: Branch): number;
16
- declare function calPaymentTotal(info: any): any;
17
- declare function calcClosingCashBalance(closing: Partial<CashierClosing>, opening_start_cash: number | undefined): number;
18
- declare function calcItemDiscounts(item: OrderItem, order_discounts: OrderDiscount[] | undefined, order_items_count: number): number;
19
- declare function calcItemAddons(item: OrderItem): number;
20
- declare function getInvoicesDiffrence(openning: CashierOpening, invoices: Order[]): (Order | undefined)[];
21
- export { ItemTotal, Subtotal, calcItem, Discounts, DiscountsWithVat, ItemVat, Vat, TaxableAmount, NonTaxableAmount, Deliveries, OtherCharges, printedOrderTaxes, Total, calcPaymentBalanceDue, calPaymentTotal, calcClosingCashBalance, calcItemDiscounts, calcItemAddons, getInvoicesDiffrence, };
2
+ export declare function ItemTotal(order_item: OrderItem, branch_vat: number | null, order_taxes?: OrderTax[], order_discounts?: OrderDiscount[], order_items_count?: number): number;
3
+ export declare function Subtotal(order_items: OrderItem[] | null): number;
4
+ export declare function calcItem(order_item: OrderItem): number;
5
+ export declare function Discounts(order_discounts: OrderDiscount[] | null, order_items: OrderItem[] | null, loyalty_amount: number | null, branch_vat: number | null): number;
6
+ export declare function DiscountsWithVat(order_discounts: OrderDiscount[] | null, order_items: OrderItem[] | null, loyalty_amount: number | null, branch_vat: number | null): number;
7
+ export declare function ItemVat(order_item: OrderItem, branch_vat: number | null): number;
8
+ export declare function Vat(order_items: OrderItem[], order_discounts: OrderDiscount[], order_taxes: OrderTax[], order_deliveries: OrderDelivery[], loyalty_amount: number | null, branch_vat: number | null): number;
9
+ export declare function TaxableAmount(order_items: OrderItem[] | null): number;
10
+ export declare function NonTaxableAmount(order_items: OrderItem[] | null): number;
11
+ export declare function Deliveries(order_deliveries: OrderDelivery[] | null): number;
12
+ export declare function OtherCharges(order_items: OrderItem[], order_discounts: OrderDiscount[], order_taxes: OrderTax[], loyalty_amount: number | null, branch_vat: number | null): number;
13
+ export declare function printedOrderTaxes(order_items: OrderItem[], order_discounts: OrderDiscount[], order_taxes: OrderTax[], loyalty_amount: number | null, branch_vat: number | null): PrintedTax[];
14
+ export declare function Total(order_items: OrderItem[], order_discounts: OrderDiscount[], order_taxes: OrderTax[], order_deliveries: OrderDelivery[], loyalty_amount: number | null, branch_vat: number | null): number;
15
+ export declare function calcPaymentBalanceDue(invoice: Order, branch: Branch): number;
16
+ export declare function calPaymentTotal(info: any): any;
17
+ export declare function calcClosingCashBalance(closing: Partial<CashierClosing>, opening_start_cash: number | undefined): number;
18
+ export declare function calcItemDiscounts(item: OrderItem, order_discounts: OrderDiscount[] | undefined, order_items_count: number): number;
19
+ export declare function calcItemAddons(item: OrderItem): number;
20
+ export declare function getInvoicesDiffrence(openning: CashierOpening, invoices: Order[]): Order[];
22
21
  //# sourceMappingURL=Calcs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Calcs.d.ts","sourceRoot":"","sources":["../../../src/Calcs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAiB,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGtJ,iBAAS,SAAS,CACjB,UAAU,EAAE,SAAS,EACrB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,WAAW,CAAC,EAAE,QAAQ,EAAE,EACxB,eAAe,CAAC,EAAE,aAAa,EAAE,EACjC,iBAAiB,SAAI,UAqCrB;AAED,iBAAS,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,UAKhD;AAED,iBAAS,QAAQ,CAAC,UAAU,EAAE,SAAS,UActC;AAED,iBAAS,SAAS,CACjB,eAAe,EAAE,aAAa,EAAE,GAAG,IAAI,EACvC,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,EAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,UA8CzB;AAED,iBAAS,gBAAgB,CACxB,eAAe,EAAE,aAAa,EAAE,GAAG,IAAI,EACvC,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,EAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,UAgDzB;AAED,iBAAS,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,UAqBhE;AAED,iBAAS,GAAG,CAAC,KAAK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C,IAAI,EAAE,GAAG,OAsBxC;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,kBAAkB,EAAE,MAAM,GAAG,SAAS,UAM9G;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,iBAAiB,EAAE,MAAM,UA2BzH;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,UAS7C;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,WAQ/E"}
@@ -1,3 +1,4 @@
1
- import { ItemTotal, Subtotal, calcItem, Discounts, DiscountsWithVat, ItemVat, Vat, TaxableAmount, NonTaxableAmount, Deliveries, OtherCharges, printedOrderTaxes, Total, calcPaymentBalanceDue, calPaymentTotal, calcClosingCashBalance, calcItemDiscounts, calcItemAddons, getInvoicesDiffrence } from './Calcs';
2
- export { ItemTotal, Subtotal, calcItem, Discounts, DiscountsWithVat, ItemVat, Vat, TaxableAmount, NonTaxableAmount, Deliveries, OtherCharges, printedOrderTaxes, Total, calcPaymentBalanceDue, calPaymentTotal, calcClosingCashBalance, calcItemDiscounts, calcItemAddons, getInvoicesDiffrence, };
1
+ export * as Calcs from './Calcs';
2
+ export * as Setters from './setters';
3
+ export * as Types from './types';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,KAAK,EACL,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,KAAK,EACL,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,GACpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Branch, CategoryAddon, Discount, Item, ItemAddon, ItemPrice, Order, OrderDiscount, OrderItem, OrderItemAddon, OrderItemDiscount, OrderPayment, OrderTax, PaymentMethod, POSUser, Tax } from './types';
2
+ /**
3
+ * This sets a new order with all default values
4
+ * @param client_id branch's client_id
5
+ * @param branch_id branch's branch_id
6
+ * @param vat branch's vat percentage amount
7
+ * @param vatNumber branch's vat registeration number
8
+ * @param info other order values
9
+ * @returns new order
10
+ */
11
+ export declare function setNewOrder(client_id: string, branch_id: string, vat: number, vatNumber: string, info?: Partial<Order>): Order;
12
+ export declare function setOrderItem(branch_id: string, item: Item, price: ItemPrice, quantity: number, addons: OrderItemAddon[], printer_id: string | undefined, discounts: OrderItemDiscount[], taxes: OrderTax[], not_taxable: boolean, details?: string, employees?: POSUser[]): OrderItem;
13
+ export declare function setOrderItemPrice(order_item_price: ItemPrice, branch_id: string): ItemPrice;
14
+ export declare function setOrderDiscount(discount: Discount, branch_id: string): OrderDiscount;
15
+ export declare function setOrderTax(tax: Tax, branch_id: string): OrderTax;
16
+ export declare function setOrderAddonFromItem(addon: ItemAddon, is_without: boolean, branch_id: string, is_included_in_custom_addons: boolean): OrderItemAddon;
17
+ export declare function setOrderAddonFromCategory(addon: CategoryAddon, is_without: boolean, branch_id: string, is_included_in_custom_addons: boolean): OrderItemAddon;
18
+ export declare function setOrderPayments(methods: PaymentMethod[], order: Order, branch: Branch | null, terminal: any | null): OrderPayment[];
19
+ //# sourceMappingURL=setters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setters.d.ts","sourceRoot":"","sources":["../../../src/setters.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,SAAS,EACT,KAAK,EACL,aAAa,EACb,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,GAAG,EACH,MAAM,SAAS,CAAC;AAGjB;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,SAyBtH;AAED,wBAAgB,YAAY,CAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,cAAc,EAAE,EACxB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,EAAE,iBAAiB,EAAE,EAC9B,KAAK,EAAE,QAAQ,EAAE,EACjB,WAAW,EAAE,OAAO,EACpB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,OAAO,EAAE,aAmCrB;AAED,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAuB/E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAkBrE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAA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