kcommons 9.48.1 → 9.50.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.
@@ -2,7 +2,6 @@ import { IASNItem } from "../typings/asn.typings";
2
2
  import { INestedGRNItem } from "../typings/grn.typings";
3
3
  import { INestedPOItem } from "../typings/po.typings";
4
4
  import { IPOASNItemJunction } from "../typings/poAsnJunctionItems.typings";
5
- import { IVendor } from "../typings/vendor.typings";
6
5
  export declare class ASNItemWrapper implements IASNItem {
7
6
  constructor(partial: IASNItem);
8
7
  po_asn_item_junction_id: string;
@@ -31,4 +30,4 @@ export declare class ASNItemWrapper implements IASNItem {
31
30
  parent_asn: null;
32
31
  vendor: null;
33
32
  }
34
- export declare function convertPOItemToASNItem(poItem: INestedPOItem, vendor?: IVendor | null, poASNItemJunctions?: IPOASNItemJunction[] | null): IASNItem;
33
+ export declare function convertPOItemToASNItem(poItem: INestedPOItem, vendor_id?: string | null, poASNItemJunctions?: IPOASNItemJunction[] | null): IASNItem;
@@ -34,14 +34,14 @@ class ASNItemWrapper {
34
34
  }
35
35
  }
36
36
  exports.ASNItemWrapper = ASNItemWrapper;
37
- function convertPOItemToASNItem(poItem, vendor, poASNItemJunctions = []) {
37
+ function convertPOItemToASNItem(poItem, vendor_id, poASNItemJunctions = []) {
38
38
  var _a, _b;
39
39
  return new ASNItemWrapper({
40
40
  id: (0, uuid_1.v4)(),
41
41
  parent_asn_id: "",
42
42
  dispatched_quantity: ((_a = poASNItemJunctions === null || poASNItemJunctions === void 0 ? void 0 : poASNItemJunctions.find((ele) => ele.item_id === (poItem === null || poItem === void 0 ? void 0 : poItem.item_id))) === null || _a === void 0 ? void 0 : _a.pending_quantity) || 0,
43
43
  delivered_quantity: 0,
44
- vendor_id: (vendor === null || vendor === void 0 ? void 0 : vendor.id) || "",
44
+ vendor_id: vendor_id || "",
45
45
  // po_item_id: item.id,
46
46
  is_deleted: false,
47
47
  deleted_at: null,
package/build/index.d.ts CHANGED
@@ -73,6 +73,8 @@ export * from "./utils/quote.util";
73
73
  export * from "./utils/getCompanyQuestionFormLinktoken.util";
74
74
  export * from "./utils/getMediaName.util";
75
75
  export * from "./utils/removeQueryParamsFromReqStr.util";
76
+ export * from "./utils/toFixedDecimal.util";
77
+ export * from "./utils/convertToINS.util";
76
78
  export * from "./typings/verification_apis/pincode.typings";
77
79
  export * from "./typings/verification_apis/gstVerification.typings";
78
80
  export * from "./typings/verification_apis/udyamVerification.typings";
@@ -82,6 +84,10 @@ export * from "./typings/kpis/company/main/purchase/purchaseTrend.typings";
82
84
  export * from "./typings/kpis/company/main/purchase/avgVendorResponseRatePerRFQKPI.typings";
83
85
  export * from "./typings/kpis/company/main/purchase/topProcurementCategories.typings";
84
86
  export * from "./typings/kpis/company/main/vendors/topCategoryvendorDistribution.typings";
87
+ export * from "./typings/kpis/company/item/itemDashboardKPICards.typings";
88
+ export * from "./typings/kpis/company/item/issuanceVsProcurementRatio.typings";
89
+ export * from "./typings/kpis/company/item/itemPurchaseTrend.typings";
90
+ export * from "./typings/kpis/company/item/stockTrend.typings";
85
91
  export * from "./typings/kpis/company/companyKpisCommons.typings";
86
92
  export * from "./typings/kpis/vendor/vendorKpisCommons.typings";
87
93
  export * from "./typings/kpis/company/testKpi.typings";
package/build/index.js CHANGED
@@ -94,6 +94,8 @@ __exportStar(require("./utils/quote.util"), exports);
94
94
  __exportStar(require("./utils/getCompanyQuestionFormLinktoken.util"), exports);
95
95
  __exportStar(require("./utils/getMediaName.util"), exports);
96
96
  __exportStar(require("./utils/removeQueryParamsFromReqStr.util"), exports);
97
+ __exportStar(require("./utils/toFixedDecimal.util"), exports);
98
+ __exportStar(require("./utils/convertToINS.util"), exports);
97
99
  // Templates
98
100
  // Verification APIs
99
101
  __exportStar(require("./typings/verification_apis/pincode.typings"), exports);
@@ -107,6 +109,11 @@ __exportStar(require("./typings/kpis/company/main/purchase/purchaseTrend.typings
107
109
  __exportStar(require("./typings/kpis/company/main/purchase/avgVendorResponseRatePerRFQKPI.typings"), exports);
108
110
  __exportStar(require("./typings/kpis/company/main/purchase/topProcurementCategories.typings"), exports);
109
111
  __exportStar(require("./typings/kpis/company/main/vendors/topCategoryvendorDistribution.typings"), exports);
112
+ // Item Dashboard KPIs
113
+ __exportStar(require("./typings/kpis/company/item/itemDashboardKPICards.typings"), exports);
114
+ __exportStar(require("./typings/kpis/company/item/issuanceVsProcurementRatio.typings"), exports);
115
+ __exportStar(require("./typings/kpis/company/item/itemPurchaseTrend.typings"), exports);
116
+ __exportStar(require("./typings/kpis/company/item/stockTrend.typings"), exports);
110
117
  // Common KPIs
111
118
  __exportStar(require("./typings/kpis/company/companyKpisCommons.typings"), exports);
112
119
  __exportStar(require("./typings/kpis/vendor/vendorKpisCommons.typings"), exports);
@@ -114,3 +114,15 @@ export interface INestedASNItem extends Omit<IASNItem, "company" | "item" | "par
114
114
  }
115
115
  export interface ICancelASNInputs extends Pick<IASN, "cancellation_remark" | "cancelled_by_entity" | "cancelled_by_user_id"> {
116
116
  }
117
+ export interface IOPEN_ASN_CREATION_TOKEN_PAYLOAD {
118
+ po_id: string;
119
+ vendor_id: string;
120
+ tokenVersion: number;
121
+ }
122
+ export interface IOpenASNCreationOTPRes {
123
+ token: string;
124
+ }
125
+ export interface IOpenASNCreationOTPReq {
126
+ otp: number;
127
+ po_id: string;
128
+ }
@@ -0,0 +1,9 @@
1
+ import { IBaseKPIProps } from "../../basKPIS.typings";
2
+ export interface IIssuanceVsProcurementRatioReq extends IBaseKPIProps {
3
+ item_id: string;
4
+ }
5
+ export interface IItemIssuanceVsProcurementRatioData {
6
+ percentage: number;
7
+ issued_qty: number;
8
+ procured_qty: number;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ import { IBaseKPIProps } from "../../basKPIS.typings";
2
+ export interface IItemDashboardKPICardsReq extends IBaseKPIProps {
3
+ item_id: string;
4
+ }
5
+ export interface IItemDashboardKPICardsData {
6
+ price_trend: {
7
+ avg_price: number;
8
+ item_name: string;
9
+ uom: string;
10
+ increment_in_last_6_months: number;
11
+ increment_in_last_year: number;
12
+ count_of_pos: number;
13
+ };
14
+ total_purchase: {
15
+ value: number;
16
+ };
17
+ supplying_vendors: {
18
+ no_of_vendors: number;
19
+ };
20
+ previous_purchase_price: {
21
+ value: number | null;
22
+ };
23
+ total_available_stock: {
24
+ count: number;
25
+ };
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { IBaseKPIProps } from "../../basKPIS.typings";
2
+ export interface IItemPurchaseTrendReqFilters extends IBaseKPIProps {
3
+ item_id: string;
4
+ }
5
+ export interface IItemPurchaseTrendData {
6
+ data: {
7
+ values: number[];
8
+ labels: string[];
9
+ average: number;
10
+ };
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { IBaseKPIProps } from "../../basKPIS.typings";
2
+ export interface IItemPriceTrendReqFilters extends IBaseKPIProps {
3
+ item_id: string;
4
+ }
5
+ export interface IItemPriceTrendData {
6
+ data: {
7
+ values: number[];
8
+ labels: string[];
9
+ average: number;
10
+ };
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { IBaseKPIProps } from "../../basKPIS.typings";
2
+ export interface IItemStockTrendKPIReqFilters extends IBaseKPIProps {
3
+ item_id: string;
4
+ }
5
+ export interface IItemStockTrendKPIUnit {
6
+ label: string;
7
+ stock_purchased: number;
8
+ stock_issued: number;
9
+ }
10
+ export interface IItemStockTrendKPIData {
11
+ data: IItemStockTrendKPIUnit[];
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -70,6 +70,7 @@ export interface IMRN {
70
70
  send_for_approval_at: string | null;
71
71
  sent_for_approval_by_id: string | null;
72
72
  is_deleted: boolean;
73
+ closed_at: string | null;
73
74
  deleted_at: string | null;
74
75
  created_at: string;
75
76
  updated_at: string;
@@ -49,6 +49,7 @@ export interface IUser {
49
49
  is_deleted?: boolean | null;
50
50
  employee_code: string;
51
51
  profile_img?: string | null;
52
+ signature_img?: string | null;
52
53
  middlename?: string | null;
53
54
  created_by_id: string;
54
55
  lastname: string;
@@ -0,0 +1,3 @@
1
+ export declare function convertToINS(
2
+ price: string | null | undefined | number
3
+ ): string | number;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToINS = convertToINS;
4
+ const THOUSAND_LOWER_BOUND = 1000;
5
+ const LAKHS_LOWER_BOUND = THOUSAND_LOWER_BOUND * 100;
6
+ const CRORE_LOWER_BOUND = LAKHS_LOWER_BOUND * 100;
7
+ const CRORE_UNIT = "Cr";
8
+ const LAKHS_UNIT = "Lk";
9
+ const THOUSAND_UNIT = "K";
10
+ function convertToINS(price) {
11
+ if (price === null || price === undefined || isNaN(Number(price))) return "-";
12
+ const numericPrice = Number(price);
13
+ if (numericPrice >= CRORE_LOWER_BOUND) {
14
+ const priceInCrores = numericPrice / CRORE_LOWER_BOUND;
15
+ return `${priceInCrores.toFixed(2)} ${CRORE_UNIT}`;
16
+ } else if (numericPrice >= LAKHS_LOWER_BOUND) {
17
+ const priceInLakhs = numericPrice / LAKHS_LOWER_BOUND;
18
+ return `${priceInLakhs.toFixed(2)} ${LAKHS_UNIT}`;
19
+ } else if (numericPrice >= THOUSAND_LOWER_BOUND) {
20
+ const priceInThousands = numericPrice / THOUSAND_LOWER_BOUND;
21
+ console.log(priceInThousands);
22
+ return `${priceInThousands.toFixed(2)} ${THOUSAND_UNIT}`;
23
+ } else {
24
+ return numericPrice;
25
+ }
26
+ }
@@ -0,0 +1 @@
1
+ export declare function convertToINS(price: string | null | undefined | number): string | number;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToINS = convertToINS;
4
+ const THOUSAND_LOWER_BOUND = 1000;
5
+ const LAKHS_LOWER_BOUND = THOUSAND_LOWER_BOUND * 100;
6
+ const CRORE_LOWER_BOUND = LAKHS_LOWER_BOUND * 100;
7
+ const CRORE_UNIT = "Cr";
8
+ const LAKHS_UNIT = "Lk";
9
+ const THOUSAND_UNIT = "K";
10
+ function convertToINS(price) {
11
+ if (price === null || price === undefined || isNaN(Number(price)))
12
+ return "-";
13
+ const numericPrice = Number(price);
14
+ if (numericPrice >= CRORE_LOWER_BOUND) {
15
+ const priceInCrores = numericPrice / CRORE_LOWER_BOUND;
16
+ return `${priceInCrores.toFixed(2)} ${CRORE_UNIT}`;
17
+ }
18
+ else if (numericPrice >= LAKHS_LOWER_BOUND) {
19
+ const priceInLakhs = numericPrice / LAKHS_LOWER_BOUND;
20
+ return `${priceInLakhs.toFixed(2)} ${LAKHS_UNIT}`;
21
+ }
22
+ else if (numericPrice >= THOUSAND_LOWER_BOUND) {
23
+ const priceInThousands = numericPrice / THOUSAND_LOWER_BOUND;
24
+ return `${priceInThousands.toFixed(2)} ${THOUSAND_UNIT}`;
25
+ }
26
+ else {
27
+ return numericPrice;
28
+ }
29
+ }
@@ -0,0 +1 @@
1
+ export declare function toFixedDecimal(num: any): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toFixedDecimal = toFixedDecimal;
4
+ function toFixedDecimal(num) {
5
+ if (num === undefined ||
6
+ num === null ||
7
+ typeof num !== "number" ||
8
+ isNaN(num))
9
+ return "-";
10
+ return Number(Number(String(num).trim()).toFixed(0)).toLocaleString("en-IN");
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kcommons",
3
- "version": "9.48.1",
3
+ "version": "9.50.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",