kcommons 18.25.6 → 18.26.0

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.
@@ -20,6 +20,7 @@ export declare enum UPLOAD_PATH_IDS {
20
20
  VENDOR_EXCEL_UPLOAD = "VENDOR_EXCEL_UPLOAD",
21
21
  ITEM_EXCEL_UPLOAD = "ITEM_EXCEL_UPLOAD",
22
22
  SUPPLIER_INVOICE_ATTACHMENT = "SUPPLIER_INVOICE_ATTACHMENT",
23
- SUPPLIER_INVOICE_ITEMS_ATTACHMENT = "SUPPLIER_INVOICE_ITEMS_ATTACHMENT"
23
+ SUPPLIER_INVOICE_ITEMS_ATTACHMENT = "SUPPLIER_INVOICE_ITEMS_ATTACHMENT",
24
+ REPORTS_SCHEDULED = "REPORTS_SCHEDULED"
24
25
  }
25
26
  export declare const UPLOAD_PATHS_CONFIG: Record<UPLOAD_PATH_IDS, (fileExtension: string) => string>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UPLOAD_PATHS_CONFIG = exports.UPLOAD_PATH_IDS = void 0;
4
+ const uuid_1 = require("uuid");
4
5
  const uploadMedia_typings_1 = require("../typings/common/uploadMedia.typings");
5
6
  var UPLOAD_PATH_IDS;
6
7
  (function (UPLOAD_PATH_IDS) {
@@ -26,6 +27,7 @@ var UPLOAD_PATH_IDS;
26
27
  UPLOAD_PATH_IDS["ITEM_EXCEL_UPLOAD"] = "ITEM_EXCEL_UPLOAD";
27
28
  UPLOAD_PATH_IDS["SUPPLIER_INVOICE_ATTACHMENT"] = "SUPPLIER_INVOICE_ATTACHMENT";
28
29
  UPLOAD_PATH_IDS["SUPPLIER_INVOICE_ITEMS_ATTACHMENT"] = "SUPPLIER_INVOICE_ITEMS_ATTACHMENT";
30
+ UPLOAD_PATH_IDS["REPORTS_SCHEDULED"] = "REPORTS_SCHEDULED";
29
31
  })(UPLOAD_PATH_IDS || (exports.UPLOAD_PATH_IDS = UPLOAD_PATH_IDS = {}));
30
32
  exports.UPLOAD_PATHS_CONFIG = {
31
33
  INDENT_ATTACHMENT: (extension) => `v2/company/indents/attachments/indent_attachment_${Date.now()}.${extension}?mediaAccessType=${uploadMedia_typings_1.MEDIA_ACCEESS_TYPE.PRIVATE}`,
@@ -50,4 +52,5 @@ exports.UPLOAD_PATHS_CONFIG = {
50
52
  GRN_EXCEL_UPLOAD: (extension) => `v2/company/excel-uploads/grn/grn_excel_${Date.now()}.${extension}?mediaAccessType=${uploadMedia_typings_1.MEDIA_ACCEESS_TYPE.PRIVATE}`,
51
53
  VENDOR_EXCEL_UPLOAD: (extension) => `v2/company/excel-uploads/vendor/vendor_excel_${Date.now()}.${extension}?mediaAccessType=${uploadMedia_typings_1.MEDIA_ACCEESS_TYPE.PRIVATE}`,
52
54
  ITEM_EXCEL_UPLOAD: (extension) => `v2/company/excel-uploads/item/item_excel_${Date.now()}.${extension}?mediaAccessType=${uploadMedia_typings_1.MEDIA_ACCEESS_TYPE.PRIVATE}`,
55
+ REPORTS_SCHEDULED: (extension) => `reports/${(0, uuid_1.v4)()}.${extension}?mediaAccessType=${uploadMedia_typings_1.MEDIA_ACCEESS_TYPE.PRIVATE}`,
53
56
  };
package/build/index.d.ts CHANGED
@@ -109,6 +109,8 @@ export * from "./typings/freightOrder.typings";
109
109
  export * from "./typings/system/queueJob.typings";
110
110
  export * from "./typings/system/erpPluginConfigCompany.typings";
111
111
  export * from "./typings/system/erpPluginsMetadata.typings";
112
+ export * from "./typings/system/reportsPluginConfigCompany.typings";
113
+ export * from "./typings/system/reportScheduleRecipient.typings";
112
114
  export * from "./typings/common/address.typings";
113
115
  export * from "./typings/common/paginationFilters.typings";
114
116
  export * from "./typings/common/uploadMedia.typings";
@@ -153,6 +155,7 @@ export * from "./utils/removeQueryParamsFromReqStr.util";
153
155
  export * from "./utils/toFixedDecimal.util";
154
156
  export * from "./utils/convertToINS.util";
155
157
  export * from "./utils/convertDurationToreadableFormat.util";
158
+ export * from "./utils/calculateNextRunAt.util";
156
159
  export * from "./utils/businessTime.util";
157
160
  export * from "./utils/extra-form/formatValidationSchema.util";
158
161
  export * from "./utils/extra-form/getFormProps.util";
@@ -211,11 +214,14 @@ export * from "./typings/vendor/vendorPermission.typings";
211
214
  export * from "./typings/vendor/vendorRole.typings";
212
215
  export * from "./typings/vendor/vendorUser.typings";
213
216
  export * from "./helpers/padNumber.helper";
217
+ export * from "./typings/plugins/reports.plugins";
214
218
  export * from "./typings/companyConfig.typings";
219
+ export * from "./typings/reports/hsfpl/hsfpl_haltingVehicles.typings";
215
220
  export * from "./utils/validators/gst.validator";
216
221
  export * from "./utils/validators/pan.validator";
217
222
  export * from "./utils/validators/cin.validator";
218
223
  export * from "./utils/validators/udyam.validator";
224
+ export * from "./typings/reports/hsfpl/hsfpl_haltingVehicles.typings";
219
225
  export interface ITesting {
220
226
  message: string;
221
227
  age: number;
package/build/index.js CHANGED
@@ -130,6 +130,8 @@ __exportStar(require("./typings/freightOrder.typings"), exports);
130
130
  __exportStar(require("./typings/system/queueJob.typings"), exports);
131
131
  __exportStar(require("./typings/system/erpPluginConfigCompany.typings"), exports);
132
132
  __exportStar(require("./typings/system/erpPluginsMetadata.typings"), exports);
133
+ __exportStar(require("./typings/system/reportsPluginConfigCompany.typings"), exports);
134
+ __exportStar(require("./typings/system/reportScheduleRecipient.typings"), exports);
133
135
  // Commons
134
136
  __exportStar(require("./typings/common/address.typings"), exports);
135
137
  __exportStar(require("./typings/common/paginationFilters.typings"), exports);
@@ -179,6 +181,7 @@ __exportStar(require("./utils/removeQueryParamsFromReqStr.util"), exports);
179
181
  __exportStar(require("./utils/toFixedDecimal.util"), exports);
180
182
  __exportStar(require("./utils/convertToINS.util"), exports);
181
183
  __exportStar(require("./utils/convertDurationToreadableFormat.util"), exports);
184
+ __exportStar(require("./utils/calculateNextRunAt.util"), exports);
182
185
  __exportStar(require("./utils/businessTime.util"), exports);
183
186
  __exportStar(require("./utils/extra-form/formatValidationSchema.util"), exports);
184
187
  __exportStar(require("./utils/extra-form/getFormProps.util"), exports);
@@ -254,9 +257,13 @@ __exportStar(require("./typings/vendor/vendorUser.typings"), exports);
254
257
  // Helpers
255
258
  __exportStar(require("./helpers/padNumber.helper"), exports);
256
259
  // Plugins
260
+ __exportStar(require("./typings/plugins/reports.plugins"), exports);
257
261
  __exportStar(require("./typings/companyConfig.typings"), exports);
262
+ __exportStar(require("./typings/reports/hsfpl/hsfpl_haltingVehicles.typings"), exports);
258
263
  // Validators
259
264
  __exportStar(require("./utils/validators/gst.validator"), exports);
260
265
  __exportStar(require("./utils/validators/pan.validator"), exports);
261
266
  __exportStar(require("./utils/validators/cin.validator"), exports);
262
267
  __exportStar(require("./utils/validators/udyam.validator"), exports);
268
+ // For Reports
269
+ __exportStar(require("./typings/reports/hsfpl/hsfpl_haltingVehicles.typings"), exports);
@@ -77,6 +77,7 @@ import { INestedTransporterDocumentManualVerificationByCompany } from "./common/
77
77
  import { INestedTransporterGroups } from "./transporterGroup.typings";
78
78
  import { INestedVehicle } from "./vehicle.typings";
79
79
  import { INestedTransporterLogs } from "./transporterLogs.typings";
80
+ import { INestedReportsPluginConfigCompany } from "./system/reportsPluginConfigCompany.typings";
80
81
  export declare enum PRICING_PLANS {
81
82
  BASIC = "BASIC",
82
83
  GROWTH = "GROWTH",
@@ -144,6 +145,7 @@ export declare enum COMPANY_INCLUDE {
144
145
  company_terms_and_conditions = "company_terms_and_conditions",
145
146
  company_config = "company_config",
146
147
  erp_plugins = "erp_plugins",
148
+ report_plugins = "report_plugins",
147
149
  company_temporary_worker_form = "company_temporary_worker_form",
148
150
  company_amended_po_items = "company_amended_po_items",
149
151
  sub_pos = "sub_pos",
@@ -259,6 +261,7 @@ export interface ICompany extends IAddress {
259
261
  company_terms_and_conditions: INestedTermsAndConditions[] | null;
260
262
  payment_terms: INestedPaymentTerms[] | null;
261
263
  erp_plugins: INestedERPPluginConfigCompany[] | null;
264
+ report_plugins: INestedReportsPluginConfigCompany[] | null;
262
265
  company_temporary_worker_form: INestedTemporaryWorkerForm[] | null;
263
266
  sub_pos: INestedSubPO[] | null;
264
267
  sub_po_items: INestedSubPOItem[] | null;
@@ -288,7 +291,7 @@ export interface ICompany extends IAddress {
288
291
  company_fo_vehicles: INestedFOVehicle[] | null;
289
292
  transporter_logs: INestedTransporterLogs[] | null;
290
293
  }
291
- export interface INestedCompany extends Omit<ICompany, "associated_purchase_locations" | "associated_vendors" | "associated_permissions" | "associated_roles" | "approval_configs" | "subdepartments" | "subcategories" | "categories" | "items" | "offices" | "stores" | "employees" | "departments" | "vendor_groups" | "company_indents" | "indent_items" | "company_mis" | "mi_items" | "company_prs" | "pr_items" | "company_rfqs" | "company_quotes" | "entity_approval_chain_entries" | "company_negotiations" | "company_pos" | "company_grns" | "company_grns_items" | "company_mrns" | "company_mrns_items" | "company_boms" | "company_bom_items" | "company_comparatives" | "company_comparative_items" | "company_notifications" | "extra_question_ans" | "extra_core_related_questions" | "company_specific_vendor_items" | "po_asn_items_junction" | "company_contact_people" | "company_item_vendor_versions" | "istds" | "istd_items" | "inventory_logs" | "invoices" | "logs" | "vendor_onboarding_requests" | "vendor_management_bodies" | "item_management_bodies" | "rollback_forms_sent_by_company" | "company_checkpoints" | "company_ves" | "queue_jobs" | "company_terms_and_conditions" | "company_config" | "erp_plugins" | "company_temporary_worker_form" | "extra_questions" | "is_deleted" | "payment_terms" | "po_grn_items_junction" | "vendor_onboarding_request_categories" | "company_amended_po_items" | "sub_pos" | "sub_po_items" | "item_questionnaire" | "rfq_questionnaire" | "rfq_questionnaire_answers" | "company_customer_categories" | "associated_customer" | "customer_management_bodies" | "qa_locations" | "accounts_locations" | "vendor_documents_manual_verification_by_company" | "erp_plugings_metadata" | "invoice" | "quality_clearance_documents" | "audits" | "approval_comments" | "vendor_logs" | "imr_fine_masters" | "transporter_documents_manual_verification_by_company" | "created_transporter_groups" | "vehicles" | "company_freight_quotes" | "company_freight_comparatives" | "company_freight_comparative_vehicles" | "company_fos" | "company_fo_vehicles"> {
294
+ export interface INestedCompany extends Omit<ICompany, "associated_purchase_locations" | "associated_vendors" | "associated_permissions" | "associated_roles" | "approval_configs" | "subdepartments" | "subcategories" | "categories" | "items" | "offices" | "stores" | "employees" | "departments" | "vendor_groups" | "company_indents" | "indent_items" | "company_mis" | "mi_items" | "company_prs" | "pr_items" | "company_rfqs" | "company_quotes" | "entity_approval_chain_entries" | "company_negotiations" | "company_pos" | "company_grns" | "company_grns_items" | "company_mrns" | "company_mrns_items" | "company_boms" | "company_bom_items" | "company_comparatives" | "company_comparative_items" | "company_notifications" | "extra_question_ans" | "extra_core_related_questions" | "company_specific_vendor_items" | "po_asn_items_junction" | "company_contact_people" | "company_item_vendor_versions" | "istds" | "istd_items" | "inventory_logs" | "invoices" | "logs" | "vendor_onboarding_requests" | "vendor_management_bodies" | "item_management_bodies" | "rollback_forms_sent_by_company" | "company_checkpoints" | "company_ves" | "queue_jobs" | "company_terms_and_conditions" | "company_config" | "erp_plugins" | "company_temporary_worker_form" | "extra_questions" | "is_deleted" | "payment_terms" | "po_grn_items_junction" | "vendor_onboarding_request_categories" | "company_amended_po_items" | "sub_pos" | "sub_po_items" | "item_questionnaire" | "rfq_questionnaire" | "rfq_questionnaire_answers" | "company_customer_categories" | "associated_customer" | "customer_management_bodies" | "qa_locations" | "accounts_locations" | "vendor_documents_manual_verification_by_company" | "erp_plugings_metadata" | "invoice" | "quality_clearance_documents" | "audits" | "approval_comments" | "vendor_logs" | "report_plugins" | "imr_fine_masters" | "transporter_documents_manual_verification_by_company" | "created_transporter_groups" | "vehicles" | "company_freight_quotes" | "company_freight_comparatives" | "company_freight_comparative_vehicles" | "company_fos" | "company_fo_vehicles" | "transporter_logs" | "report_plugins"> {
292
295
  }
293
296
  export interface ICompanyVendorAdditionalInfoMappingConfig {
294
297
  additional_info_form_que_id: string;
@@ -68,6 +68,7 @@ var COMPANY_INCLUDE;
68
68
  COMPANY_INCLUDE["company_terms_and_conditions"] = "company_terms_and_conditions";
69
69
  COMPANY_INCLUDE["company_config"] = "company_config";
70
70
  COMPANY_INCLUDE["erp_plugins"] = "erp_plugins";
71
+ COMPANY_INCLUDE["report_plugins"] = "report_plugins";
71
72
  COMPANY_INCLUDE["company_temporary_worker_form"] = "company_temporary_worker_form";
72
73
  COMPANY_INCLUDE["company_amended_po_items"] = "company_amended_po_items";
73
74
  COMPANY_INCLUDE["sub_pos"] = "sub_pos";
@@ -0,0 +1,150 @@
1
+ export declare enum HSFPL_HALTING_VEHICLE_APPROVAL {
2
+ AWAITING = "AWAITING",
3
+ APPROVED = "APPROVED",
4
+ }
5
+ export declare enum HSFPL_HALTING_VEHICLE_INVOICE_STATUS {
6
+ VERIFIED = "VERIFIED",
7
+ RAISED = "RAISED",
8
+ INVALID = "INVALID",
9
+ }
10
+ export declare enum HSFPL_HALTING_VEHICLE_ACTION_TYPE {
11
+ WAITING_FOR_APPROVAL = "WAITING_FOR_APPROVAL",
12
+ APPROVED_NOT_SENT = "APPROVED_NOT_SENT",
13
+ NO_PO_ON_INVOICE = "NO_PO_ON_INVOICE",
14
+ }
15
+ export interface IHSFPL_HaltingVehiclesReportOptions {
16
+ halt_alert_after_days: number;
17
+ }
18
+ export interface IHSFPL_HaltingVehiclesReportMeta {
19
+ company_name: string;
20
+ company_code: string;
21
+ company_logo_url: string | null;
22
+ location_city: string | null;
23
+ location_name: string;
24
+ location_code: string;
25
+ generated_at: Date;
26
+ halt_alert_after_days: number;
27
+ }
28
+ export interface IHSFPL_HaltingVehiclesKpis {
29
+ standing: number;
30
+ standing_longest_wait_time: string | null;
31
+ standing_longest_wait_minutes: number | null;
32
+ waiting_for_approval: number;
33
+ waiting_for_approval_longest_wait_time: string | null;
34
+ waiting_for_approval_longest_wait_minutes: number | null;
35
+ approved_not_sent: number;
36
+ approved_not_sent_longest_wait_time: string | null;
37
+ approved_not_sent_longest_wait_minutes: number | null;
38
+ no_po_on_invoice: number;
39
+ }
40
+ export interface IHSFPL_HaltingVehiclesTodaySummary {
41
+ window_start: Date;
42
+ window_end: Date;
43
+ standing_now: number;
44
+ standing_yesterday: number;
45
+ came_in: number;
46
+ sent: number;
47
+ sent_after_plant_approval: number;
48
+ sent_directly: number;
49
+ }
50
+ export interface IHSFPL_HaltingVehiclesNeedsActionPlant {
51
+ store_name: string;
52
+ vehicle_count: number;
53
+ ves_nos: string[];
54
+ }
55
+ export interface IHSFPL_HaltingVehiclesNeedsActionGroup {
56
+ vehicle_count: number;
57
+ plants: IHSFPL_HaltingVehiclesNeedsActionPlant[];
58
+ }
59
+ export interface IHaltingVehiclesNeedsAction {
60
+ awaiting_plant_approval: IHSFPL_HaltingVehiclesNeedsActionGroup | null;
61
+ approved_not_sent: IHSFPL_HaltingVehiclesNeedsActionGroup | null;
62
+ gi_blocked_no_po: IHSFPL_HaltingVehiclesNeedsActionGroup | null;
63
+ }
64
+ export interface IHSFPL_HaltingVehiclesPlantRow {
65
+ plant_name: string;
66
+ standing: number;
67
+ waiting_for_approval: number;
68
+ approved_not_sent: number;
69
+ no_po: number;
70
+ longest_wait_time: string | null;
71
+ longest_wait_minutes: number | null;
72
+ }
73
+ export interface IHSFPL_HaltingVehiclesAgeBucket {
74
+ min_days: number;
75
+ max_days: number | null;
76
+ }
77
+ export interface IHSFPL_HaltingVehiclesAgeRow {
78
+ plant_name: string;
79
+ counts: number[];
80
+ total: number;
81
+ }
82
+ export interface IHSFPL_HaltingVehiclesAgewise {
83
+ buckets: IHSFPL_HaltingVehiclesAgeBucket[];
84
+ rows: IHSFPL_HaltingVehiclesAgeRow[];
85
+ totals: IHSFPL_HaltingVehiclesAgeRow;
86
+ }
87
+ export interface IHSFPL_HaltingVehiclesMaterialRow {
88
+ material: string;
89
+ vehicles: number;
90
+ is_others: boolean;
91
+ others_materials: string[];
92
+ }
93
+ export interface IHSFPL_HaltingVehiclesInvalidInvoiceRow {
94
+ ves_no: string;
95
+ plant_name: string;
96
+ vendor_name: string;
97
+ invoice_no: string;
98
+ invoice_status: HSFPL_HALTING_VEHICLE_INVOICE_STATUS;
99
+ issue: string;
100
+ in_at_nly: Date;
101
+ waiting_time: string;
102
+ }
103
+ export interface IHSFPL_HaltingVehiclesInvoiceSection {
104
+ verified: number;
105
+ raised: number;
106
+ invalid: number;
107
+ invalid_invoices: IHSFPL_HaltingVehiclesInvalidInvoiceRow[];
108
+ }
109
+ export interface IHSFPL_HaltingVehicleRow {
110
+ ves_no: string;
111
+ vehicle_no: string;
112
+ vendor_name: string;
113
+ plant_name: string;
114
+ material: string | null;
115
+ extra_materials_count: number;
116
+ po_no: string | null;
117
+ extra_po_count: number;
118
+ approval: HSFPL_HALTING_VEHICLE_APPROVAL;
119
+ invoice_no: string;
120
+ invoice_status: HSFPL_HALTING_VEHICLE_INVOICE_STATUS;
121
+ in_at_nly: Date;
122
+ waiting_time: string;
123
+ waiting_minutes: number;
124
+ }
125
+ export interface IHSFPL_HaltingVehiclesPlantGroup {
126
+ plant_name: string;
127
+ vehicle_count: number;
128
+ oldest_waiting_time: string;
129
+ oldest_waiting_minutes: number;
130
+ vehicles: IHSFPL_HaltingVehicleRow[];
131
+ }
132
+ export interface IHSFPL_HaltingVehiclesConsistency {
133
+ standing_equals_waiting_plus_approved: boolean;
134
+ invoice_split_equals_standing: boolean;
135
+ today_equation_holds: boolean;
136
+ }
137
+ export interface IHSFPL_HaltingVehiclesReport {
138
+ meta: IHSFPL_HaltingVehiclesReportMeta;
139
+ kpis: IHSFPL_HaltingVehiclesKpis;
140
+ today: IHSFPL_HaltingVehiclesTodaySummary;
141
+ needs_action: IHaltingVehiclesNeedsAction;
142
+ plantwise: IHSFPL_HaltingVehiclesPlantRow[];
143
+ plantwise_totals: IHSFPL_HaltingVehiclesPlantRow;
144
+ plants_without_vehicles: string[];
145
+ agewise: IHSFPL_HaltingVehiclesAgewise;
146
+ materialwise: IHSFPL_HaltingVehiclesMaterialRow[];
147
+ invoice_status: IHSFPL_HaltingVehiclesInvoiceSection;
148
+ vehicles_by_plant: IHSFPL_HaltingVehiclesPlantGroup[];
149
+ consistency: IHSFPL_HaltingVehiclesConsistency;
150
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HSFPL_HALTING_VEHICLE_ACTION_TYPE =
4
+ exports.HSFPL_HALTING_VEHICLE_INVOICE_STATUS =
5
+ exports.HSFPL_HALTING_VEHICLE_APPROVAL =
6
+ void 0;
7
+ var HSFPL_HALTING_VEHICLE_APPROVAL;
8
+ (function (HSFPL_HALTING_VEHICLE_APPROVAL) {
9
+ HSFPL_HALTING_VEHICLE_APPROVAL["AWAITING"] = "AWAITING";
10
+ HSFPL_HALTING_VEHICLE_APPROVAL["APPROVED"] = "APPROVED";
11
+ })(
12
+ HSFPL_HALTING_VEHICLE_APPROVAL ||
13
+ (exports.HSFPL_HALTING_VEHICLE_APPROVAL = HSFPL_HALTING_VEHICLE_APPROVAL =
14
+ {}),
15
+ );
16
+ var HSFPL_HALTING_VEHICLE_INVOICE_STATUS;
17
+ (function (HSFPL_HALTING_VEHICLE_INVOICE_STATUS) {
18
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS["VERIFIED"] = "VERIFIED";
19
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS["RAISED"] = "RAISED";
20
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS["INVALID"] = "INVALID";
21
+ })(
22
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS ||
23
+ (exports.HSFPL_HALTING_VEHICLE_INVOICE_STATUS =
24
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS =
25
+ {}),
26
+ );
27
+ var HSFPL_HALTING_VEHICLE_ACTION_TYPE;
28
+ (function (HSFPL_HALTING_VEHICLE_ACTION_TYPE) {
29
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE["WAITING_FOR_APPROVAL"] =
30
+ "WAITING_FOR_APPROVAL";
31
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE["APPROVED_NOT_SENT"] = "APPROVED_NOT_SENT";
32
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE["NO_PO_ON_INVOICE"] = "NO_PO_ON_INVOICE";
33
+ })(
34
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE ||
35
+ (exports.HSFPL_HALTING_VEHICLE_ACTION_TYPE =
36
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE =
37
+ {}),
38
+ );
@@ -0,0 +1,9 @@
1
+ export declare enum REPORTS_PLUGIN {
2
+ VENDOR_STATUS_REPORTS = "VENDOR_STATUS_REPORTS",
3
+ HALTING_VEHICLES_REPORTS = "HALTING_VEHICLES_REPORTS"
4
+ }
5
+ export declare enum REPORT_FREQUENCY {
6
+ DAILY = "DAILY",
7
+ WEEKLY = "WEEKLY",
8
+ MONTHLY = "MONTHLY"
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REPORT_FREQUENCY = exports.REPORTS_PLUGIN = void 0;
4
+ var REPORTS_PLUGIN;
5
+ (function (REPORTS_PLUGIN) {
6
+ REPORTS_PLUGIN["VENDOR_STATUS_REPORTS"] = "VENDOR_STATUS_REPORTS";
7
+ REPORTS_PLUGIN["HALTING_VEHICLES_REPORTS"] = "HALTING_VEHICLES_REPORTS";
8
+ })(REPORTS_PLUGIN || (exports.REPORTS_PLUGIN = REPORTS_PLUGIN = {}));
9
+ var REPORT_FREQUENCY;
10
+ (function (REPORT_FREQUENCY) {
11
+ REPORT_FREQUENCY["DAILY"] = "DAILY";
12
+ REPORT_FREQUENCY["WEEKLY"] = "WEEKLY";
13
+ REPORT_FREQUENCY["MONTHLY"] = "MONTHLY";
14
+ })(REPORT_FREQUENCY || (exports.REPORT_FREQUENCY = REPORT_FREQUENCY = {}));
@@ -0,0 +1,150 @@
1
+ export declare enum HSFPL_HALTING_VEHICLE_APPROVAL {
2
+ AWAITING = "AWAITING",
3
+ APPROVED = "APPROVED"
4
+ }
5
+ export declare enum HSFPL_HALTING_VEHICLE_INVOICE_STATUS {
6
+ VERIFIED = "VERIFIED",
7
+ RAISED = "RAISED",
8
+ INVALID = "INVALID"
9
+ }
10
+ export declare enum HSFPL_HALTING_VEHICLE_ACTION_TYPE {
11
+ WAITING_FOR_APPROVAL = "WAITING_FOR_APPROVAL",
12
+ APPROVED_NOT_SENT = "APPROVED_NOT_SENT",
13
+ NO_PO_ON_INVOICE = "NO_PO_ON_INVOICE"
14
+ }
15
+ export interface IHSFPL_HaltingVehiclesReportOptions {
16
+ halt_alert_after_days: number;
17
+ }
18
+ export interface IHSFPL_HaltingVehiclesReportMeta {
19
+ company_name: string;
20
+ company_code: string;
21
+ company_logo_url: string | null;
22
+ location_city: string | null;
23
+ location_name: string;
24
+ location_code: string;
25
+ generated_at: Date;
26
+ halt_alert_after_days: number;
27
+ }
28
+ export interface IHSFPL_HaltingVehiclesKpis {
29
+ standing: number;
30
+ standing_longest_wait_time: string | null;
31
+ standing_longest_wait_minutes: number | null;
32
+ waiting_for_approval: number;
33
+ waiting_for_approval_longest_wait_time: string | null;
34
+ waiting_for_approval_longest_wait_minutes: number | null;
35
+ approved_not_sent: number;
36
+ approved_not_sent_longest_wait_time: string | null;
37
+ approved_not_sent_longest_wait_minutes: number | null;
38
+ no_po_on_invoice: number;
39
+ }
40
+ export interface IHSFPL_HaltingVehiclesTodaySummary {
41
+ window_start: Date;
42
+ window_end: Date;
43
+ standing_now: number;
44
+ standing_yesterday: number;
45
+ came_in: number;
46
+ sent: number;
47
+ sent_after_plant_approval: number;
48
+ sent_directly: number;
49
+ }
50
+ export interface IHSFPL_HaltingVehiclesNeedsActionPlant {
51
+ store_name: string;
52
+ vehicle_count: number;
53
+ ves_nos: string[];
54
+ }
55
+ export interface IHSFPL_HaltingVehiclesNeedsActionGroup {
56
+ vehicle_count: number;
57
+ plants: IHSFPL_HaltingVehiclesNeedsActionPlant[];
58
+ }
59
+ export interface IHaltingVehiclesNeedsAction {
60
+ awaiting_plant_approval: IHSFPL_HaltingVehiclesNeedsActionGroup | null;
61
+ approved_not_sent: IHSFPL_HaltingVehiclesNeedsActionGroup | null;
62
+ gi_blocked_no_po: IHSFPL_HaltingVehiclesNeedsActionGroup | null;
63
+ }
64
+ export interface IHSFPL_HaltingVehiclesPlantRow {
65
+ plant_name: string;
66
+ standing: number;
67
+ waiting_for_approval: number;
68
+ approved_not_sent: number;
69
+ no_po: number;
70
+ longest_wait_time: string | null;
71
+ longest_wait_minutes: number | null;
72
+ }
73
+ export interface IHSFPL_HaltingVehiclesAgeBucket {
74
+ min_days: number;
75
+ max_days: number | null;
76
+ }
77
+ export interface IHSFPL_HaltingVehiclesAgeRow {
78
+ plant_name: string;
79
+ counts: number[];
80
+ total: number;
81
+ }
82
+ export interface IHSFPL_HaltingVehiclesAgewise {
83
+ buckets: IHSFPL_HaltingVehiclesAgeBucket[];
84
+ rows: IHSFPL_HaltingVehiclesAgeRow[];
85
+ totals: IHSFPL_HaltingVehiclesAgeRow;
86
+ }
87
+ export interface IHSFPL_HaltingVehiclesMaterialRow {
88
+ material: string;
89
+ vehicles: number;
90
+ is_others: boolean;
91
+ others_materials: string[];
92
+ }
93
+ export interface IHSFPL_HaltingVehiclesInvalidInvoiceRow {
94
+ ves_no: string;
95
+ plant_name: string;
96
+ vendor_name: string;
97
+ invoice_no: string;
98
+ invoice_status: HSFPL_HALTING_VEHICLE_INVOICE_STATUS;
99
+ issue: string;
100
+ in_at_nly: Date;
101
+ waiting_time: string;
102
+ }
103
+ export interface IHSFPL_HaltingVehiclesInvoiceSection {
104
+ verified: number;
105
+ raised: number;
106
+ invalid: number;
107
+ invalid_invoices: IHSFPL_HaltingVehiclesInvalidInvoiceRow[];
108
+ }
109
+ export interface IHSFPL_HaltingVehicleRow {
110
+ ves_no: string;
111
+ vehicle_no: string;
112
+ vendor_name: string;
113
+ plant_name: string;
114
+ material: string | null;
115
+ extra_materials_count: number;
116
+ po_no: string | null;
117
+ extra_po_count: number;
118
+ approval: HSFPL_HALTING_VEHICLE_APPROVAL;
119
+ invoice_no: string;
120
+ invoice_status: HSFPL_HALTING_VEHICLE_INVOICE_STATUS;
121
+ in_at_nly: Date;
122
+ waiting_time: string;
123
+ waiting_minutes: number;
124
+ }
125
+ export interface IHSFPL_HaltingVehiclesPlantGroup {
126
+ plant_name: string;
127
+ vehicle_count: number;
128
+ oldest_waiting_time: string;
129
+ oldest_waiting_minutes: number;
130
+ vehicles: IHSFPL_HaltingVehicleRow[];
131
+ }
132
+ export interface IHSFPL_HaltingVehiclesConsistency {
133
+ standing_equals_waiting_plus_approved: boolean;
134
+ invoice_split_equals_standing: boolean;
135
+ today_equation_holds: boolean;
136
+ }
137
+ export interface IHSFPL_HaltingVehiclesReport {
138
+ meta: IHSFPL_HaltingVehiclesReportMeta;
139
+ kpis: IHSFPL_HaltingVehiclesKpis;
140
+ today: IHSFPL_HaltingVehiclesTodaySummary;
141
+ needs_action: IHaltingVehiclesNeedsAction;
142
+ plantwise: IHSFPL_HaltingVehiclesPlantRow[];
143
+ plantwise_totals: IHSFPL_HaltingVehiclesPlantRow;
144
+ plants_without_vehicles: string[];
145
+ agewise: IHSFPL_HaltingVehiclesAgewise;
146
+ materialwise: IHSFPL_HaltingVehiclesMaterialRow[];
147
+ invoice_status: IHSFPL_HaltingVehiclesInvoiceSection;
148
+ vehicles_by_plant: IHSFPL_HaltingVehiclesPlantGroup[];
149
+ consistency: IHSFPL_HaltingVehiclesConsistency;
150
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HSFPL_HALTING_VEHICLE_ACTION_TYPE = exports.HSFPL_HALTING_VEHICLE_INVOICE_STATUS = exports.HSFPL_HALTING_VEHICLE_APPROVAL = void 0;
4
+ var HSFPL_HALTING_VEHICLE_APPROVAL;
5
+ (function (HSFPL_HALTING_VEHICLE_APPROVAL) {
6
+ HSFPL_HALTING_VEHICLE_APPROVAL["AWAITING"] = "AWAITING";
7
+ HSFPL_HALTING_VEHICLE_APPROVAL["APPROVED"] = "APPROVED";
8
+ })(HSFPL_HALTING_VEHICLE_APPROVAL || (exports.HSFPL_HALTING_VEHICLE_APPROVAL = HSFPL_HALTING_VEHICLE_APPROVAL = {}));
9
+ var HSFPL_HALTING_VEHICLE_INVOICE_STATUS;
10
+ (function (HSFPL_HALTING_VEHICLE_INVOICE_STATUS) {
11
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS["VERIFIED"] = "VERIFIED";
12
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS["RAISED"] = "RAISED";
13
+ HSFPL_HALTING_VEHICLE_INVOICE_STATUS["INVALID"] = "INVALID";
14
+ })(HSFPL_HALTING_VEHICLE_INVOICE_STATUS || (exports.HSFPL_HALTING_VEHICLE_INVOICE_STATUS = HSFPL_HALTING_VEHICLE_INVOICE_STATUS = {}));
15
+ var HSFPL_HALTING_VEHICLE_ACTION_TYPE;
16
+ (function (HSFPL_HALTING_VEHICLE_ACTION_TYPE) {
17
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE["WAITING_FOR_APPROVAL"] = "WAITING_FOR_APPROVAL";
18
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE["APPROVED_NOT_SENT"] = "APPROVED_NOT_SENT";
19
+ HSFPL_HALTING_VEHICLE_ACTION_TYPE["NO_PO_ON_INVOICE"] = "NO_PO_ON_INVOICE";
20
+ })(HSFPL_HALTING_VEHICLE_ACTION_TYPE || (exports.HSFPL_HALTING_VEHICLE_ACTION_TYPE = HSFPL_HALTING_VEHICLE_ACTION_TYPE = {}));
@@ -0,0 +1,20 @@
1
+ import { INestedReportsPluginConfigCompany } from "./reportsPluginConfigCompany.typings";
2
+ export declare enum REPORT_SCHEDULE_RECIPIENT_INCLUDE {
3
+ schedule = "schedule"
4
+ }
5
+ export interface IReportScheduleRecipient {
6
+ id: string;
7
+ schedule_id: string;
8
+ to_emails: string[];
9
+ cc_emails: string[];
10
+ bcc_emails: string[];
11
+ accepted_emails: string[];
12
+ rejected_emails: string[];
13
+ error: Record<string, unknown> | null;
14
+ report_path: string | null;
15
+ created_at: string;
16
+ updated_at: string;
17
+ schedule: INestedReportsPluginConfigCompany;
18
+ }
19
+ export interface INestedReportScheduleRecipient extends Omit<IReportScheduleRecipient, "schedule"> {
20
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REPORT_SCHEDULE_RECIPIENT_INCLUDE = void 0;
4
+ var REPORT_SCHEDULE_RECIPIENT_INCLUDE;
5
+ (function (REPORT_SCHEDULE_RECIPIENT_INCLUDE) {
6
+ REPORT_SCHEDULE_RECIPIENT_INCLUDE["schedule"] = "schedule";
7
+ })(REPORT_SCHEDULE_RECIPIENT_INCLUDE || (exports.REPORT_SCHEDULE_RECIPIENT_INCLUDE = REPORT_SCHEDULE_RECIPIENT_INCLUDE = {}));
@@ -0,0 +1,30 @@
1
+ import { INestedCompany } from "../company.typings";
2
+ import { REPORT_FREQUENCY, REPORTS_PLUGIN } from "../plugins/reports.plugins";
3
+ import { INestedReportScheduleRecipient } from "./reportScheduleRecipient.typings";
4
+ export declare enum REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE {
5
+ company = "company",
6
+ recipients = "recipients"
7
+ }
8
+ export interface IReportsPluginConfigCompany {
9
+ id: string;
10
+ company_id: string;
11
+ last_updated_by_superadmin_id: string;
12
+ plugin_name: REPORTS_PLUGIN;
13
+ is_enabled: boolean;
14
+ max_halt_days_for_halting_vehicles_report: number | null;
15
+ frequency_type: REPORT_FREQUENCY;
16
+ send_time: string | null;
17
+ day_of_week: number | null;
18
+ date_of_month: number | null;
19
+ to_emails: string[];
20
+ cc_emails: string[];
21
+ bcc_emails: string[];
22
+ last_run_at: string | null;
23
+ next_run_at: string | null;
24
+ created_at: string;
25
+ updated_at: string;
26
+ company: INestedCompany;
27
+ recipients: INestedReportScheduleRecipient[];
28
+ }
29
+ export interface INestedReportsPluginConfigCompany extends Omit<IReportsPluginConfigCompany, "company" | "recipients"> {
30
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE = void 0;
4
+ var REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE;
5
+ (function (REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE) {
6
+ REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE["company"] = "company";
7
+ REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE["recipients"] = "recipients";
8
+ })(REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE || (exports.REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE = REPORTS_PLUGIN_CONFIG_COMPANY_INCLUDE = {}));
@@ -0,0 +1,8 @@
1
+ import { IReportsPluginConfigCompany } from "../typings/system/reportsPluginConfigCompany.typings";
2
+ export type IScheduleShape = Pick<IReportsPluginConfigCompany, "frequency_type" | "send_time" | "day_of_week" | "date_of_month">;
3
+ /**
4
+ * Returns the next run instant (UTC Date) strictly after `after`.
5
+ * `send_time` ("HH:mm"), `day_of_week` (0-6) and `date_of_month` (1-31) are in IST.
6
+ * MONTHLY clamps `date_of_month` to the last day of shorter months.
7
+ */
8
+ export declare const calculateNextRunAt: (scheduleConfig: IScheduleShape, after: Date) => Date | null;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateNextRunAt = void 0;
4
+ const reports_plugins_1 = require("../typings/plugins/reports.plugins");
5
+ const IST_OFFSET_MS = 330 * 60 * 1000;
6
+ /**
7
+ * Returns the next run instant (UTC Date) strictly after `after`.
8
+ * `send_time` ("HH:mm"), `day_of_week` (0-6) and `date_of_month` (1-31) are in IST.
9
+ * MONTHLY clamps `date_of_month` to the last day of shorter months.
10
+ */
11
+ const calculateNextRunAt = (scheduleConfig, after) => {
12
+ var _a, _b;
13
+ const [sendHour, sendMinute] = ((_a = scheduleConfig.send_time) !== null && _a !== void 0 ? _a : "00:00")
14
+ .split(":")
15
+ .map(Number);
16
+ const afterInIst = new Date(after.getTime() + IST_OFFSET_MS);
17
+ const istYear = afterInIst.getUTCFullYear();
18
+ const istMonth = afterInIst.getUTCMonth();
19
+ const istDate = afterInIst.getUTCDate();
20
+ /** Converts the IST back to UTC */
21
+ const getUtcRunAtForIstDate = (year, month, date) => new Date(Date.UTC(year, month, date, sendHour, sendMinute) - IST_OFFSET_MS);
22
+ switch (scheduleConfig.frequency_type) {
23
+ case reports_plugins_1.REPORT_FREQUENCY.DAILY: {
24
+ const todayRunAt = getUtcRunAtForIstDate(istYear, istMonth, istDate);
25
+ return todayRunAt > after
26
+ ? todayRunAt
27
+ : getUtcRunAtForIstDate(istYear, istMonth, istDate + 1);
28
+ }
29
+ case reports_plugins_1.REPORT_FREQUENCY.WEEKLY: {
30
+ const daysUntilTargetWeekday = (((_b = scheduleConfig.day_of_week) !== null && _b !== void 0 ? _b : 0) - afterInIst.getUTCDay() + 7) % 7;
31
+ const thisWeekRunAt = getUtcRunAtForIstDate(istYear, istMonth, istDate + daysUntilTargetWeekday);
32
+ return thisWeekRunAt > after
33
+ ? thisWeekRunAt
34
+ : getUtcRunAtForIstDate(istYear, istMonth, istDate + daysUntilTargetWeekday + 7);
35
+ }
36
+ case reports_plugins_1.REPORT_FREQUENCY.MONTHLY: {
37
+ const getMonthlyRunAt = (year, month) => {
38
+ var _a;
39
+ const lastDateOfMonth = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
40
+ return getUtcRunAtForIstDate(year, month, Math.min((_a = scheduleConfig.date_of_month) !== null && _a !== void 0 ? _a : 1, lastDateOfMonth));
41
+ };
42
+ const thisMonthRunAt = getMonthlyRunAt(istYear, istMonth);
43
+ return thisMonthRunAt > after
44
+ ? thisMonthRunAt
45
+ : getMonthlyRunAt(istYear, istMonth + 1);
46
+ }
47
+ default:
48
+ return null;
49
+ }
50
+ };
51
+ exports.calculateNextRunAt = calculateNextRunAt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcommons",
3
- "version": "18.25.6",
3
+ "version": "18.26.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",