@managesome/eposmatic-toolkit 0.2.386 → 0.2.389

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.
@@ -285,3 +285,50 @@ export interface IInvoiceXReport {
285
285
  client_id: string;
286
286
  }[];
287
287
  }
288
+ export declare enum SALE_ORDER_X_REPORT_TYPE_ENUM {
289
+ TOTAL_SALES = "TOTAL_SALES",
290
+ GST = "GST",
291
+ TOTAL_PAYMENT_SALES = "TOTAL_PAYMENT_SALES",
292
+ STAFF = "STAFF",
293
+ ORDER_STATUS = "ORDER_STATUS"
294
+ }
295
+ export declare const ALL_SALE_ORDER_X_REPORT_TYPES: SALE_ORDER_X_REPORT_TYPE_ENUM[];
296
+ export interface ISaleOrderXReport {
297
+ [SALE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_SALES]: {
298
+ _id: string;
299
+ count: number;
300
+ grossAmount: number;
301
+ client_id: string;
302
+ client_name: string;
303
+ totalItemSales: number;
304
+ }[];
305
+ [SALE_ORDER_X_REPORT_TYPE_ENUM.GST]: {
306
+ _id: string;
307
+ count: number;
308
+ grossAmount: number;
309
+ gst: number;
310
+ client_id: string;
311
+ }[];
312
+ [SALE_ORDER_X_REPORT_TYPE_ENUM.TOTAL_PAYMENT_SALES]: {
313
+ _id: string;
314
+ count: number;
315
+ grossAmount: number;
316
+ payment_type: string;
317
+ client_id: string;
318
+ }[];
319
+ [SALE_ORDER_X_REPORT_TYPE_ENUM.STAFF]: {
320
+ _id: string;
321
+ count: number;
322
+ grossAmount: number;
323
+ staff_id: string;
324
+ staff_name: string;
325
+ client_id: string;
326
+ }[];
327
+ [SALE_ORDER_X_REPORT_TYPE_ENUM.ORDER_STATUS]: {
328
+ _id: string;
329
+ count: number;
330
+ grossAmount: number;
331
+ status: SALES_ORDER_STATUS_ENUM;
332
+ client_id: string;
333
+ }[];
334
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_INVOICE_X_REPORT_TYPES = exports.INVOICE_X_REPORT_TYPE_ENUM = exports.ALL_PURCHASE_ORDER_X_REPORT_TYPES = exports.PURCHASE_ORDER_X_REPORT_TYPE_ENUM = exports.ALL_WAREHOUSE_DASHBOARD_ANALYTICS = exports.WAREHOUSE_DASHBOARD_ANALYTICS_ENUM = void 0;
3
+ exports.ALL_SALE_ORDER_X_REPORT_TYPES = exports.SALE_ORDER_X_REPORT_TYPE_ENUM = exports.ALL_INVOICE_X_REPORT_TYPES = exports.INVOICE_X_REPORT_TYPE_ENUM = exports.ALL_PURCHASE_ORDER_X_REPORT_TYPES = exports.PURCHASE_ORDER_X_REPORT_TYPE_ENUM = exports.ALL_WAREHOUSE_DASHBOARD_ANALYTICS = exports.WAREHOUSE_DASHBOARD_ANALYTICS_ENUM = void 0;
4
4
  const ANALYTICS_1 = require("./ANALYTICS");
5
5
  /* ================><================= */
6
6
  var WAREHOUSE_DASHBOARD_ANALYTICS_ENUM;
@@ -29,3 +29,13 @@ var INVOICE_X_REPORT_TYPE_ENUM;
29
29
  INVOICE_X_REPORT_TYPE_ENUM["ORDER_STATUS"] = "ORDER_STATUS";
30
30
  })(INVOICE_X_REPORT_TYPE_ENUM || (exports.INVOICE_X_REPORT_TYPE_ENUM = INVOICE_X_REPORT_TYPE_ENUM = {}));
31
31
  exports.ALL_INVOICE_X_REPORT_TYPES = Object.values(INVOICE_X_REPORT_TYPE_ENUM);
32
+ // ================><================= */
33
+ var SALE_ORDER_X_REPORT_TYPE_ENUM;
34
+ (function (SALE_ORDER_X_REPORT_TYPE_ENUM) {
35
+ SALE_ORDER_X_REPORT_TYPE_ENUM["TOTAL_SALES"] = "TOTAL_SALES";
36
+ SALE_ORDER_X_REPORT_TYPE_ENUM["GST"] = "GST";
37
+ SALE_ORDER_X_REPORT_TYPE_ENUM["TOTAL_PAYMENT_SALES"] = "TOTAL_PAYMENT_SALES";
38
+ SALE_ORDER_X_REPORT_TYPE_ENUM["STAFF"] = "STAFF";
39
+ SALE_ORDER_X_REPORT_TYPE_ENUM["ORDER_STATUS"] = "ORDER_STATUS";
40
+ })(SALE_ORDER_X_REPORT_TYPE_ENUM || (exports.SALE_ORDER_X_REPORT_TYPE_ENUM = SALE_ORDER_X_REPORT_TYPE_ENUM = {}));
41
+ exports.ALL_SALE_ORDER_X_REPORT_TYPES = Object.values(SALE_ORDER_X_REPORT_TYPE_ENUM);
@@ -19,7 +19,7 @@ interface IProps {
19
19
  * Transaction type: "Test" for testing or "Live" for production.
20
20
  * Defaults to `SRB_TRANSACTION_TYPE_ENUM.TEST`.
21
21
  */
22
- transType?: SRB_TRANSACTION_TYPE_ENUM;
22
+ transType: SRB_TRANSACTION_TYPE_ENUM;
23
23
  }
24
24
  export declare function convertOrderToSrbInvoice({ posId, ntn, order, gmtOffset, pos_user, pos_pass, store_name, card_gst, transType, }: IProps): ISrbInvoice | null;
25
25
  export {};
@@ -4,7 +4,7 @@ exports.convertOrderToSrbInvoice = convertOrderToSrbInvoice;
4
4
  const constants_1 = require("../../constants");
5
5
  const SRB_ENUMS_1 = require("../../constants/SRB_ENUMS");
6
6
  const utils_1 = require("../utils");
7
- function convertOrderToSrbInvoice({ posId, ntn, order, gmtOffset, pos_user, pos_pass, store_name, card_gst, transType = SRB_ENUMS_1.SRB_TRANSACTION_TYPE_ENUM.TEST, }) {
7
+ function convertOrderToSrbInvoice({ posId, ntn, order, gmtOffset, pos_user, pos_pass, store_name, card_gst, transType, }) {
8
8
  // Invoice type: 1 = Normal Invoice, 2 = Sales Return (per SRB spec).
9
9
  let invoiceType = SRB_ENUMS_1.SRB_INVOICE_TYPE_ENUM.NEW;
10
10
  if (order.order_status === constants_1.ORDER_STATUS_ENUM.CANCELLED) {
@@ -29,6 +29,7 @@ export interface ISrbInvoiceResponse {
29
29
  QRCodeLink: string;
30
30
  }
31
31
  export interface ISrbInvoiceErr {
32
- status: string;
33
- msg: string;
32
+ err: string;
33
+ resCode: string;
34
+ debugId?: string;
34
35
  }
@@ -51,6 +51,7 @@ export * from './receipt-engine';
51
51
  export * from './review-helpers';
52
52
  export * from './rider-tracking';
53
53
  export * from './riders-report-helpers';
54
+ export * from './sale-order-x-report-helpers';
54
55
  export * from './sales-comparison-report-helpers';
55
56
  export * from './sales-comparitive-report-helpers';
56
57
  export * from './sales-overview-report-helpers';
@@ -67,6 +67,7 @@ __exportStar(require("./receipt-engine"), exports);
67
67
  __exportStar(require("./review-helpers"), exports);
68
68
  __exportStar(require("./rider-tracking"), exports);
69
69
  __exportStar(require("./riders-report-helpers"), exports);
70
+ __exportStar(require("./sale-order-x-report-helpers"), exports);
70
71
  __exportStar(require("./sales-comparison-report-helpers"), exports);
71
72
  __exportStar(require("./sales-comparitive-report-helpers"), exports);
72
73
  __exportStar(require("./sales-overview-report-helpers"), exports);
@@ -0,0 +1,45 @@
1
+ import { COUNTRY_ALPHA_2_ENUM, CURRENCY_SYMBOL_ENUM, ISaleOrderXReport } from '../../constants';
2
+ import { IUsableInvoiceXReportChannel, IUsableInvoiceXReportSubChannel } from './invoice-x-report-helpers';
3
+ export type IUsableSaleOrderXReportSubChannel = IUsableInvoiceXReportSubChannel;
4
+ export type IUsableSaleOrderXReportChannel = IUsableInvoiceXReportChannel;
5
+ export interface IUsableSaleOrderXReportData {
6
+ _id: string;
7
+ title: string;
8
+ netSale: number;
9
+ netWithoutGst: number;
10
+ netWithoutGstSubtitle: string;
11
+ totalOrders: number;
12
+ unpaidOrders: number;
13
+ unpaidAmount: number;
14
+ amountCollected: number;
15
+ itemSales: number;
16
+ channels: IUsableSaleOrderXReportChannel[];
17
+ }
18
+ export interface ISaleOrderXReportProps {
19
+ from: Date;
20
+ to: Date;
21
+ clientWiseData: IUsableSaleOrderXReportData[];
22
+ combinedData?: IUsableSaleOrderXReportData;
23
+ currency_symbol: CURRENCY_SYMBOL_ENUM | undefined;
24
+ warehouseName: string | undefined;
25
+ isFilterApplied: boolean;
26
+ }
27
+ export interface IUsableSaleOrderXReportResult {
28
+ clientWiseData: IUsableSaleOrderXReportData[];
29
+ combinedData: IUsableSaleOrderXReportData;
30
+ }
31
+ /**
32
+ * Transforms raw sale-order x-report aggregation output into
33
+ * UI-usable data. Delegates to the shared invoice-x-report
34
+ * data pipeline (ISaleOrderXReport is structurally compatible
35
+ * with IInvoiceXReport).
36
+ */
37
+ export declare const getSaleOrderXReportData: (data: ISaleOrderXReport, currencySymbol: CURRENCY_SYMBOL_ENUM | undefined, countryAlpha2: COUNTRY_ALPHA_2_ENUM | undefined) => IUsableSaleOrderXReportResult;
38
+ /**
39
+ * Generates an HTML x-report for a sale order.
40
+ * Delegates to the shared invoice-x-report HTML generator.
41
+ */
42
+ export declare const getSaleOrderXReportHtml: (props: ISaleOrderXReportProps & {
43
+ width?: number;
44
+ monochrome?: boolean;
45
+ }) => string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSaleOrderXReportHtml = exports.getSaleOrderXReportData = void 0;
4
+ const invoice_x_report_helpers_1 = require("./invoice-x-report-helpers");
5
+ // --- Functions ---
6
+ /**
7
+ * Transforms raw sale-order x-report aggregation output into
8
+ * UI-usable data. Delegates to the shared invoice-x-report
9
+ * data pipeline (ISaleOrderXReport is structurally compatible
10
+ * with IInvoiceXReport).
11
+ */
12
+ const getSaleOrderXReportData = (data, currencySymbol, countryAlpha2) => {
13
+ return (0, invoice_x_report_helpers_1.getInvoiceXReportData)(data, currencySymbol, countryAlpha2);
14
+ };
15
+ exports.getSaleOrderXReportData = getSaleOrderXReportData;
16
+ /**
17
+ * Generates an HTML x-report for a sale order.
18
+ * Delegates to the shared invoice-x-report HTML generator.
19
+ */
20
+ const getSaleOrderXReportHtml = (props) => {
21
+ return (0, invoice_x_report_helpers_1.getInvoiceXReportHtml)(props);
22
+ };
23
+ exports.getSaleOrderXReportHtml = getSaleOrderXReportHtml;
@@ -51,6 +51,9 @@ export declare const SaleOrderInvoicesSchema: Schema<any, import("mongoose").Mod
51
51
  _id: string;
52
52
  name: string;
53
53
  } | null | undefined;
54
+ gst?: number | null | undefined;
55
+ gst_amount?: number | null | undefined;
56
+ is_gst_inclusive?: boolean | null | undefined;
54
57
  applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
55
58
  down_payment_value?: number | null | undefined;
56
59
  posted_by?: {
@@ -120,6 +123,9 @@ export declare const SaleOrderInvoicesSchema: Schema<any, import("mongoose").Mod
120
123
  _id: string;
121
124
  name: string;
122
125
  } | null | undefined;
126
+ gst?: number | null | undefined;
127
+ gst_amount?: number | null | undefined;
128
+ is_gst_inclusive?: boolean | null | undefined;
123
129
  applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
124
130
  down_payment_value?: number | null | undefined;
125
131
  posted_by?: {
@@ -189,6 +195,9 @@ export declare const SaleOrderInvoicesSchema: Schema<any, import("mongoose").Mod
189
195
  _id: string;
190
196
  name: string;
191
197
  } | null | undefined;
198
+ gst?: number | null | undefined;
199
+ gst_amount?: number | null | undefined;
200
+ is_gst_inclusive?: boolean | null | undefined;
192
201
  applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
193
202
  down_payment_value?: number | null | undefined;
194
203
  posted_by?: {
@@ -117,6 +117,20 @@ exports.SaleOrderInvoicesSchema = new mongoose_1.Schema({
117
117
  type: [mongoose_1.Schema.Types.Mixed],
118
118
  default: [],
119
119
  },
120
+ gst: {
121
+ type: Number,
122
+ min: 0,
123
+ required: false,
124
+ },
125
+ gst_amount: {
126
+ type: Number,
127
+ min: 0,
128
+ required: false,
129
+ },
130
+ is_gst_inclusive: {
131
+ type: Boolean,
132
+ required: false,
133
+ },
120
134
  created_by: {
121
135
  type: SaleOrderInvoiceActorSchema,
122
136
  required: false,
@@ -28,6 +28,9 @@ export interface ISaleOrderInvoice {
28
28
  amount_paid?: number;
29
29
  down_payment_value?: number;
30
30
  payments?: ISaleOrderInvoicePaymentRecord[];
31
+ gst?: number | null;
32
+ gst_amount?: number | null;
33
+ is_gst_inclusive?: boolean | null;
31
34
  created_by?: ISaleOrderFinancialDocActor | null;
32
35
  posted_by?: ISaleOrderFinancialDocActor | null;
33
36
  confirmed_by?: ISaleOrderFinancialDocActor | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.386",
3
+ "version": "0.2.389",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",