@things-factory/sales-base 4.3.0-alpha.1 → 4.3.2

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.
Files changed (173) hide show
  1. package/dist-server/constants/attachment-type.js +2 -1
  2. package/dist-server/constants/attachment-type.js.map +1 -1
  3. package/dist-server/constants/index.js +2 -5
  4. package/dist-server/constants/index.js.map +1 -1
  5. package/dist-server/constants/order.js +12 -3
  6. package/dist-server/constants/order.js.map +1 -1
  7. package/dist-server/constants/release-good.js +9 -0
  8. package/dist-server/constants/release-good.js.map +1 -0
  9. package/dist-server/controllers/ecommerce/index.js +1 -5
  10. package/dist-server/controllers/ecommerce/index.js.map +1 -1
  11. package/dist-server/controllers/index.js +1 -5
  12. package/dist-server/controllers/index.js.map +1 -1
  13. package/dist-server/errors/index.js +1 -5
  14. package/dist-server/errors/index.js.map +1 -1
  15. package/dist-server/errors/validation-error.js +1 -5
  16. package/dist-server/errors/validation-error.js.map +1 -1
  17. package/dist-server/index.js +1 -5
  18. package/dist-server/index.js.map +1 -1
  19. package/dist-server/service/arrival-notice/index.js +1 -5
  20. package/dist-server/service/arrival-notice/index.js.map +1 -1
  21. package/dist-server/service/claim/index.js +1 -5
  22. package/dist-server/service/claim/index.js.map +1 -1
  23. package/dist-server/service/claim-detail/index.js +1 -5
  24. package/dist-server/service/claim-detail/index.js.map +1 -1
  25. package/dist-server/service/claim-order/index.js +1 -5
  26. package/dist-server/service/claim-order/index.js.map +1 -1
  27. package/dist-server/service/collection-order/index.js +1 -5
  28. package/dist-server/service/collection-order/index.js.map +1 -1
  29. package/dist-server/service/delivery-order/index.js +1 -5
  30. package/dist-server/service/delivery-order/index.js.map +1 -1
  31. package/dist-server/service/draft-release-good/draft-release-good-mutation.js +501 -0
  32. package/dist-server/service/draft-release-good/draft-release-good-mutation.js.map +1 -0
  33. package/dist-server/service/draft-release-good/draft-release-good-query.js +289 -0
  34. package/dist-server/service/draft-release-good/draft-release-good-query.js.map +1 -0
  35. package/dist-server/service/draft-release-good/draft-release-good-type.js +364 -0
  36. package/dist-server/service/draft-release-good/draft-release-good-type.js.map +1 -0
  37. package/dist-server/service/draft-release-good/draft-release-good.js +321 -0
  38. package/dist-server/service/draft-release-good/draft-release-good.js.map +1 -0
  39. package/dist-server/service/draft-release-good/index.js +21 -0
  40. package/dist-server/service/draft-release-good/index.js.map +1 -0
  41. package/dist-server/service/goods-receival-note/index.js +1 -5
  42. package/dist-server/service/goods-receival-note/index.js.map +1 -1
  43. package/dist-server/service/index.js +48 -24
  44. package/dist-server/service/index.js.map +1 -1
  45. package/dist-server/service/inventory-check/index.js +1 -5
  46. package/dist-server/service/inventory-check/index.js.map +1 -1
  47. package/dist-server/service/invoice/index.js +1 -5
  48. package/dist-server/service/invoice/index.js.map +1 -1
  49. package/dist-server/service/invoice-product/index.js +1 -5
  50. package/dist-server/service/invoice-product/index.js.map +1 -1
  51. package/dist-server/service/job-sheet/index.js +1 -5
  52. package/dist-server/service/job-sheet/index.js.map +1 -1
  53. package/dist-server/service/order-inventory/index.js +1 -5
  54. package/dist-server/service/order-inventory/index.js.map +1 -1
  55. package/dist-server/service/order-inventory/order-inventory-query.js +38 -1
  56. package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
  57. package/dist-server/service/order-inventory/order-inventory-types.js +9 -1
  58. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  59. package/dist-server/service/order-inventory/order-inventory.js +5 -1
  60. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  61. package/dist-server/service/order-product/index.js +1 -5
  62. package/dist-server/service/order-product/index.js.map +1 -1
  63. package/dist-server/service/order-product/order-product-types.js +13 -13
  64. package/dist-server/service/order-product/order-product-types.js.map +1 -1
  65. package/dist-server/service/order-product/order-product.js +39 -4
  66. package/dist-server/service/order-product/order-product.js.map +1 -1
  67. package/dist-server/service/order-tote/index.js +21 -0
  68. package/dist-server/service/order-tote/index.js.map +1 -0
  69. package/dist-server/service/order-tote/order-tote-mutation.js +56 -0
  70. package/dist-server/service/order-tote/order-tote-mutation.js.map +1 -0
  71. package/dist-server/service/order-tote/order-tote-query.js +123 -0
  72. package/dist-server/service/order-tote/order-tote-query.js.map +1 -0
  73. package/dist-server/service/order-tote/order-tote-types.js +79 -0
  74. package/dist-server/service/order-tote/order-tote-types.js.map +1 -0
  75. package/dist-server/service/order-tote/order-tote.js +91 -0
  76. package/dist-server/service/order-tote/order-tote.js.map +1 -0
  77. package/dist-server/service/order-tote-item/index.js +21 -0
  78. package/dist-server/service/order-tote-item/index.js.map +1 -0
  79. package/dist-server/service/order-tote-item/order-tote-item-mutation.js +56 -0
  80. package/dist-server/service/order-tote-item/order-tote-item-mutation.js.map +1 -0
  81. package/dist-server/service/order-tote-item/order-tote-item-query.js +100 -0
  82. package/dist-server/service/order-tote-item/order-tote-item-query.js.map +1 -0
  83. package/dist-server/service/order-tote-item/order-tote-item-types.js +91 -0
  84. package/dist-server/service/order-tote-item/order-tote-item-types.js.map +1 -0
  85. package/dist-server/service/order-tote-item/order-tote-item.js +104 -0
  86. package/dist-server/service/order-tote-item/order-tote-item.js.map +1 -0
  87. package/dist-server/service/order-tote-seal/index.js +21 -0
  88. package/dist-server/service/order-tote-seal/index.js.map +1 -0
  89. package/dist-server/service/order-tote-seal/order-tote-seal-mutation.js +56 -0
  90. package/dist-server/service/order-tote-seal/order-tote-seal-mutation.js.map +1 -0
  91. package/dist-server/service/order-tote-seal/order-tote-seal-query.js +97 -0
  92. package/dist-server/service/order-tote-seal/order-tote-seal-query.js.map +1 -0
  93. package/dist-server/service/order-tote-seal/order-tote-seal-types.js +71 -0
  94. package/dist-server/service/order-tote-seal/order-tote-seal-types.js.map +1 -0
  95. package/dist-server/service/order-tote-seal/order-tote-seal.js +71 -0
  96. package/dist-server/service/order-tote-seal/order-tote-seal.js.map +1 -0
  97. package/dist-server/service/order-vas/index.js +1 -5
  98. package/dist-server/service/order-vas/index.js.map +1 -1
  99. package/dist-server/service/others/index.js +1 -5
  100. package/dist-server/service/others/index.js.map +1 -1
  101. package/dist-server/service/others/other-query.js +37 -2
  102. package/dist-server/service/others/other-query.js.map +1 -1
  103. package/dist-server/service/purchase-order/index.js +1 -5
  104. package/dist-server/service/purchase-order/index.js.map +1 -1
  105. package/dist-server/service/purchase-order-other-charge/index.js +1 -5
  106. package/dist-server/service/purchase-order-other-charge/index.js.map +1 -1
  107. package/dist-server/service/release-good/index.js +1 -5
  108. package/dist-server/service/release-good/index.js.map +1 -1
  109. package/dist-server/service/release-good/release-good-mutation.js +23 -1
  110. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  111. package/dist-server/service/release-good/release-good-query.js +28 -2
  112. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  113. package/dist-server/service/release-good/release-good.js +32 -12
  114. package/dist-server/service/release-good/release-good.js.map +1 -1
  115. package/dist-server/service/retail-replenishment-order/index.js +1 -5
  116. package/dist-server/service/retail-replenishment-order/index.js.map +1 -1
  117. package/dist-server/service/return-order/index.js +1 -5
  118. package/dist-server/service/return-order/index.js.map +1 -1
  119. package/dist-server/service/reverse-kitting-order/index.js +1 -5
  120. package/dist-server/service/reverse-kitting-order/index.js.map +1 -1
  121. package/dist-server/service/reverse-kitting-order-inventory/index.js +1 -5
  122. package/dist-server/service/reverse-kitting-order-inventory/index.js.map +1 -1
  123. package/dist-server/service/shipping-order/index.js +1 -5
  124. package/dist-server/service/shipping-order/index.js.map +1 -1
  125. package/dist-server/service/transfer-order/index.js +1 -5
  126. package/dist-server/service/transfer-order/index.js.map +1 -1
  127. package/dist-server/service/vas/index.js +1 -5
  128. package/dist-server/service/vas/index.js.map +1 -1
  129. package/dist-server/service/vas-order/index.js +1 -5
  130. package/dist-server/service/vas-order/index.js.map +1 -1
  131. package/dist-server/utils/index.js +1 -5
  132. package/dist-server/utils/index.js.map +1 -1
  133. package/dist-server/utils/inventory-util.js +258 -99
  134. package/dist-server/utils/inventory-util.js.map +1 -1
  135. package/dist-server/utils/order-no-generator.js +7 -0
  136. package/dist-server/utils/order-no-generator.js.map +1 -1
  137. package/package.json +13 -13
  138. package/server/constants/attachment-type.ts +2 -1
  139. package/server/constants/index.ts +1 -0
  140. package/server/constants/order.ts +12 -2
  141. package/server/constants/release-good.ts +6 -0
  142. package/server/service/draft-release-good/draft-release-good-mutation.ts +671 -0
  143. package/server/service/draft-release-good/draft-release-good-query.ts +314 -0
  144. package/server/service/draft-release-good/draft-release-good-type.ts +261 -0
  145. package/server/service/draft-release-good/draft-release-good.ts +270 -0
  146. package/server/service/draft-release-good/index.ts +9 -0
  147. package/server/service/index.ts +51 -21
  148. package/server/service/order-inventory/order-inventory-query.ts +40 -2
  149. package/server/service/order-inventory/order-inventory-types.ts +6 -0
  150. package/server/service/order-inventory/order-inventory.ts +5 -5
  151. package/server/service/order-product/order-product-types.ts +5 -3
  152. package/server/service/order-product/order-product.ts +30 -3
  153. package/server/service/order-tote/index.ts +9 -0
  154. package/server/service/order-tote/order-tote-mutation.ts +30 -0
  155. package/server/service/order-tote/order-tote-query.ts +114 -0
  156. package/server/service/order-tote/order-tote-types.ts +47 -0
  157. package/server/service/order-tote/order-tote.ts +62 -0
  158. package/server/service/order-tote-item/index.ts +9 -0
  159. package/server/service/order-tote-item/order-tote-item-mutation.ts +30 -0
  160. package/server/service/order-tote-item/order-tote-item-query.ts +88 -0
  161. package/server/service/order-tote-item/order-tote-item-types.ts +56 -0
  162. package/server/service/order-tote-item/order-tote-item.ts +72 -0
  163. package/server/service/order-tote-seal/index.ts +9 -0
  164. package/server/service/order-tote-seal/order-tote-seal-mutation.ts +30 -0
  165. package/server/service/order-tote-seal/order-tote-seal-query.ts +60 -0
  166. package/server/service/order-tote-seal/order-tote-seal-types.ts +41 -0
  167. package/server/service/order-tote-seal/order-tote-seal.ts +46 -0
  168. package/server/service/others/other-query.ts +43 -8
  169. package/server/service/release-good/release-good-mutation.ts +24 -2
  170. package/server/service/release-good/release-good-query.ts +57 -30
  171. package/server/service/release-good/release-good.ts +28 -9
  172. package/server/utils/inventory-util.ts +287 -106
  173. package/server/utils/order-no-generator.ts +42 -48
@@ -46,113 +46,271 @@ export const InventoryUtil = {
46
46
  * @param {Object} trxMgr
47
47
  * @returns { object } {items, total}
48
48
  */
49
- async bizplaceInventoryProductGroup(bizplaces: Bizplace[], params: ListParam, context: any, trxMgr: EntityManager) {
49
+ async bizplaceProductInventory(bizplaces: Bizplace[], params: ListParam, context: any, trxMgr: EntityManager) {
50
50
  try {
51
51
  let filters = params.filters
52
+
52
53
  const { domain }: { domain: Domain } = context.state
53
54
 
54
- const { bizplaceIds, productWhereClause, bundleWhereClause, whereClause, batchBundle } = await getConditions(
55
+ const { bizplaceIds, productWhereClause, bundleWhereClause, whereClause, batchBundle, productDetailWhereClause } = await getConditions(
55
56
  bizplaces,
56
57
  filters,
57
- trxMgr
58
+ trxMgr,
59
+ false
58
60
  )
59
61
 
62
+ let productFilter = filters.find(itm => itm.name == 'productName')
63
+
60
64
  let queryStrings = `
61
- CREATE TEMP TABLE temp_inventory_product_group AS (
62
- SELECT * FROM (
63
- WITH oi as (
65
+ CREATE TEMP TABLE temp_inventory_product_group ON COMMIT DROP AS (
66
+ SELECT * FROM (
67
+ WITH oi as (
68
+ SELECT
69
+ SUM(oi.release_qty) AS release_qty,
70
+ SUM(oi.release_uom_value) AS release_uom_value,
71
+ oi.batch_id,
72
+ oi.batch_id_ref,
73
+ oi.product_id,
74
+ p.name AS product_name,
75
+ oi.packing_type,
76
+ oi.packing_size,
77
+ oi.uom
78
+ FROM
79
+ order_inventories oi
80
+ LEFT JOIN
81
+ products p
82
+ ON
83
+ oi.product_id = p.id
84
+ WHERE
85
+ (oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
86
+ AND oi.batch_id NOTNULL
87
+ AND oi.product_id NOTNULL
88
+ AND oi.packing_type NOTNULL
89
+ AND oi.packing_size NOTNULL
90
+ AND oi.inventory_id IS NULL
91
+ GROUP BY
92
+ oi.batch_id,
93
+ oi.batch_id_ref,
94
+ oi.product_id,
95
+ oi.packing_type,
96
+ oi.packing_size,
97
+ oi.uom,
98
+ p.name
99
+ )
64
100
  SELECT
65
- SUM(oi.release_qty) AS release_qty,
66
- SUM(oi.release_uom_value) AS release_uom_value,
67
- oi.batch_id,
68
- oi.batch_id_ref,
69
- oi.product_id,
70
- p.name AS product_name,
71
- oi.packing_type,
72
- oi.packing_size,
73
- oi.uom
74
- FROM
75
- order_inventories oi
76
- LEFT JOIN
77
- products p
78
- ON
79
- oi.product_id = p.id
80
- WHERE
81
- (oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
82
- AND oi.batch_id NOTNULL
83
- AND oi.product_id NOTNULL
84
- AND oi.packing_type NOTNULL
85
- AND oi.packing_size NOTNULL
86
- AND oi.inventory_id IS NULL
87
- GROUP BY
88
- oi.batch_id,
89
- oi.batch_id_ref,
90
- oi.product_id,
91
- oi.packing_type,
92
- oi.packing_size,
93
- oi.uom,
94
- p.name
95
- )
96
- SELECT
97
- i.batch_id AS "batchId",
98
- i.batch_id_ref AS "batchIdRef",
99
- i.packing_type AS "packingType",
100
- i.packing_size AS "packingSize",
101
- i.uom AS "uom",
102
- concat(p.name, ' (', p.description, ')') AS "productName",
103
- coalesce(p.sku, '') AS "productSKU",
104
- coalesce(p.brand, '') AS "productBrand",
105
- p.id AS "productId",
106
- SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)) AS "remainQty",
107
- SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) AS "remainUomValue",
108
- concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom",
109
- 'SINGLE' AS "groupType"
110
- FROM
111
- inventories i
112
- LEFT JOIN products p ON i.product_id = p.id
101
+ pd.packing_type AS "packingType",
102
+ pd.packing_size AS "packingSize",
103
+ pd.uom AS "uom",
104
+ concat(p.name, ' (', p.description, ')') AS "productName",
105
+ coalesce(p.sku, '') AS "productSKU",
106
+ coalesce(p.brand, '') AS "productBrand",
107
+ p.id AS "productId",
108
+ COALESCE(SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)),0) AS "remainQty",
109
+ COALESCE(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)),0) AS "remainUomValue",
110
+ concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)), ' ', pd.uom) AS "remainUomValueWithUom",
111
+ 'SINGLE' AS "groupType"
112
+ FROM products p
113
+ INNER join product_details pd on pd.product_id = p.id
114
+ LEFT JOIN inventories i ON i.product_id = p.id and i.domain_id = $1 and i.status = 'STORED'
115
+ INNER JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
116
+ and i.packing_type = pd.packing_type and i.packing_size = pd.packing_size and i.uom = pd.uom
113
117
  LEFT JOIN oi ON i.batch_id = oi.batch_id AND p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
114
- LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
115
118
  LEFT JOIN (
116
119
  SELECT pbs.product_id, SUM(pbs.bundle_qty * src.release_qty) AS bundle_product_release_qty, SUM(pbs.bundle_qty * src.release_uom_value) AS bundle_product_release_uom_value
117
120
  FROM product_bundle_settings pbs
118
- INNER JOIN json_populate_recordset(NULL::order_inventories,'${batchBundle}') src ON src.product_id = pbs.product_bundle_id
121
+ INNER JOIN json_populate_recordset(NULL::order_inventories, '${batchBundle}') src ON src.product_id = pbs.product_bundle_id
119
122
  GROUP BY pbs.product_id
120
123
  ) bp on i.product_id = bp.product_id
121
- WHERE i.domain_id = $1
122
- AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
123
- ${productWhereClause}
124
- GROUP BY
125
- i.batch_id,
126
- i.batch_id_ref,
127
- p.id,
128
- i.packing_type,
129
- i.packing_size,
130
- i.uom
131
- UNION
132
- SELECT 'BUNDLE' AS "batchId", null as "batchIdRef", packing_type, packing_size,'UNIT' AS "uom", name AS "productName", sku AS "productSKU", 'brand' AS "productBrand", id AS "productId",
133
- MIN(FLOOR(pbs."availableQty")) AS "remainQty",
134
- MIN(FLOOR(pbs."availableUomValue")) AS "remainUomValue",
135
- CONCAT(MIN(FLOOR(pbs."availableUomValue")),' UNIT') AS "remainUomValueWithUom",
136
- 'BUNDLE' AS "groupType"
137
- FROM product_bundles pb
138
- INNER JOIN (
139
- SELECT pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
140
- (SUM(COALESCE(i2.qty, 0)) - SUM(COALESCE(i2.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
141
- (SUM(COALESCE(i2.uom_value, 0)) - SUM(COALESCE(i2.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue"
142
- FROM product_bundle_settings pbs
143
- LEFT JOIN inventories i2 ON i2.product_id = pbs.product_id AND i2.domain_id = $1
144
- AND i2.bizplace_id IN (${bizplaceIds})
145
- AND i2.status = 'STORED'
146
- LEFT JOIN oi ON oi.product_id = i2.product_id
147
- GROUP BY pbs.product_id, pbs.product_bundle_id
148
- ) pbs ON pbs.product_bundle_id = pb.id
149
- ${bundleWhereClause}
150
- GROUP BY pb.packing_type, pb.packing_size, pb.name, pb.sku, pb.id
124
+ WHERE p.bizplace_id IN (${bizplaceIds})
125
+ ${productDetailWhereClause}
126
+ ${productFilter ? `AND (
127
+ lower(p.sku) ilike '${productFilter.value}'
128
+ OR lower(p.name) ilike '${productFilter.value}'
129
+ OR lower(p.description) ilike '${productFilter.value}'
130
+ )
131
+ ` : ``}
132
+ GROUP BY
133
+ p.id,
134
+ pd.packing_type,
135
+ pd.packing_size,
136
+ pd.uom
137
+ UNION
138
+ SELECT packing_type, packing_size,'UNIT' AS "uom", name AS "productName", sku AS "productSKU", '-' AS "productBrand", id AS "productId",
139
+ COALESCE(MIN(FLOOR(pbs."availableQty")),0) AS "remainQty",
140
+ COALESCE(MIN(FLOOR(pbs."availableUomValue")),0) AS "remainUomValue",
141
+ CONCAT(COALESCE(MIN(FLOOR(pbs."availableUomValue")),0),' UNIT') AS "remainUomValueWithUom",
142
+ 'BUNDLE' AS "groupType"
143
+ FROM product_bundles pb
144
+ LEFT JOIN (
145
+ SELECT pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
146
+ (SUM(COALESCE(i2.qty, 0)) - SUM(COALESCE(i2.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
147
+ (SUM(COALESCE(i2.uom_value, 0)) - SUM(COALESCE(i2.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue"
148
+ FROM product_bundle_settings pbs
149
+ LEFT JOIN inventories i2 ON i2.product_id = pbs.product_id AND i2.domain_id = $1
150
+ INNER JOIN locations l2 ON i2.location_id = l2.id AND i2.domain_id = l2.domain_id AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
151
+ AND i2.bizplace_id IN (${bizplaceIds})
152
+ AND i2.status = 'STORED'
153
+ LEFT JOIN oi ON oi.product_id = i2.product_id
154
+ GROUP BY
155
+ pbs.product_id,
156
+ pbs.product_bundle_id
157
+ ) pbs ON pbs.product_bundle_id = pb.id
158
+ ${bundleWhereClause}
159
+ AND pb.bizplace_id IN (${bizplaceIds})
160
+ ${productFilter ? `AND (
161
+ lower(pb.sku) ilike '${productFilter.value}'
162
+ OR lower(pb.name) ilike '${productFilter.value}'
163
+ OR lower(pb.description) ilike '${productFilter.value}'
164
+ )
165
+ ` : ``}
166
+ GROUP BY
167
+ pb.packing_type,
168
+ pb.packing_size,
169
+ pb.name,
170
+ pb.sku,
171
+ pb.id
172
+ )
173
+ AS inv_prod_grp
174
+ ${whereClause}
175
+ order by "productSKU", "productName"
151
176
  )
152
- AS inv_prod_grp
153
- ${whereClause}
177
+ `
178
+
179
+ await trxMgr.query(queryStrings, [domain.id])
180
+
181
+ const [{ total }]: any = await trxMgr.query(`select count(*) as total from temp_inventory_product_group`)
182
+ let items: any[] = []
183
+
184
+ if (params?.pagination) {
185
+ items = await trxMgr.query(`select * from temp_inventory_product_group OFFSET $1 LIMIT $2`, [
186
+ (params.pagination.page - 1) * params.pagination.limit,
187
+ params.pagination.limit
188
+ ])
189
+ } else {
190
+ items = await trxMgr.query(`select * from temp_inventory_product_group`)
191
+ }
192
+
193
+ return { items, total }
194
+ } catch (error) {
195
+ throw error
196
+ }
197
+ },
198
+
199
+ /**
200
+ * Get all available product belonging to list of bizplaces
201
+ * @param {[Object]} bizplaces
202
+ * @param {Object} params
203
+ * @param {Object} context
204
+ * @param {Object} trxMgr
205
+ * @returns { object } {items, total}
206
+ */
207
+ async bizplaceInventoryProductGroup(bizplaces: Bizplace[], params: ListParam, context: any, trxMgr: EntityManager) {
208
+ try {
209
+ let filters = params.filters
210
+ const { domain }: { domain: Domain } = context.state
211
+
212
+ const { bizplaceIds, productWhereClause, bundleWhereClause, whereClause, batchBundle } = await getConditions(
213
+ bizplaces,
214
+ filters,
215
+ trxMgr
154
216
  )
155
- `
217
+
218
+ let queryStrings = `
219
+ CREATE TEMP TABLE temp_inventory_product_group AS (
220
+ SELECT * FROM (
221
+ WITH oi as (
222
+ SELECT
223
+ SUM(oi.release_qty) AS release_qty,
224
+ SUM(oi.release_uom_value) AS release_uom_value,
225
+ oi.batch_id,
226
+ oi.batch_id_ref,
227
+ oi.product_id,
228
+ p.name AS product_name,
229
+ oi.packing_type,
230
+ oi.packing_size,
231
+ oi.uom
232
+ FROM
233
+ order_inventories oi
234
+ LEFT JOIN
235
+ products p
236
+ ON
237
+ oi.product_id = p.id
238
+ WHERE
239
+ (oi.status = 'PENDING' or oi.status = 'PENDING_RECEIVE' or oi.status = 'PENDING_WORKSHEET' or oi.status = 'PENDING_SPLIT')
240
+ AND oi.batch_id NOTNULL
241
+ AND oi.product_id NOTNULL
242
+ AND oi.packing_type NOTNULL
243
+ AND oi.packing_size NOTNULL
244
+ AND oi.inventory_id IS NULL
245
+ GROUP BY
246
+ oi.batch_id,
247
+ oi.batch_id_ref,
248
+ oi.product_id,
249
+ oi.packing_type,
250
+ oi.packing_size,
251
+ oi.uom,
252
+ p.name
253
+ )
254
+ SELECT
255
+ i.batch_id AS "batchId",
256
+ i.batch_id_ref AS "batchIdRef",
257
+ i.packing_type AS "packingType",
258
+ i.packing_size AS "packingSize",
259
+ i.uom AS "uom",
260
+ concat(p.name, ' (', p.description, ')') AS "productName",
261
+ coalesce(p.sku, '') AS "productSKU",
262
+ coalesce(p.brand, '') AS "productBrand",
263
+ p.id AS "productId",
264
+ SUM(COALESCE(i.qty, 0)) - SUM(COALESCE(i.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0)) - MAX(COALESCE(bp.bundle_product_release_qty, 0)) AS "remainQty",
265
+ SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)) AS "remainUomValue",
266
+ concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)) - MAX(COALESCE(bp.bundle_product_release_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom",
267
+ 'SINGLE' AS "groupType"
268
+ FROM
269
+ inventories i
270
+ LEFT JOIN products p ON i.product_id = p.id
271
+ LEFT JOIN oi ON i.batch_id = oi.batch_id AND p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
272
+ LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
273
+ LEFT JOIN (
274
+ SELECT pbs.product_id, SUM(pbs.bundle_qty * src.release_qty) AS bundle_product_release_qty, SUM(pbs.bundle_qty * src.release_uom_value) AS bundle_product_release_uom_value
275
+ FROM product_bundle_settings pbs
276
+ INNER JOIN json_populate_recordset(NULL::order_inventories,'${batchBundle}') src ON src.product_id = pbs.product_bundle_id
277
+ GROUP BY pbs.product_id
278
+ ) bp on i.product_id = bp.product_id
279
+ WHERE i.domain_id = $1
280
+ AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
281
+ ${productWhereClause}
282
+ GROUP BY
283
+ i.batch_id,
284
+ i.batch_id_ref,
285
+ p.id,
286
+ i.packing_type,
287
+ i.packing_size,
288
+ i.uom
289
+ UNION
290
+ SELECT 'BUNDLE' AS "batchId", null as "batchIdRef", packing_type, packing_size,'UNIT' AS "uom", name AS "productName", sku AS "productSKU", 'brand' AS "productBrand", id AS "productId",
291
+ MIN(FLOOR(pbs."availableQty")) AS "remainQty",
292
+ MIN(FLOOR(pbs."availableUomValue")) AS "remainUomValue",
293
+ CONCAT(MIN(FLOOR(pbs."availableUomValue")),' UNIT') AS "remainUomValueWithUom",
294
+ 'BUNDLE' AS "groupType"
295
+ FROM product_bundles pb
296
+ INNER JOIN (
297
+ SELECT pbs.product_id, pbs.product_bundle_id, min(pbs.bundle_qty),
298
+ (SUM(COALESCE(i2.qty, 0)) - SUM(COALESCE(i2.locked_qty, 0)) - MAX(COALESCE(oi.release_qty, 0))) / min(pbs.bundle_qty) AS "availableQty",
299
+ (SUM(COALESCE(i2.uom_value, 0)) - SUM(COALESCE(i2.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0))) / min(pbs.bundle_qty) AS "availableUomValue"
300
+ FROM product_bundle_settings pbs
301
+ LEFT JOIN inventories i2 ON i2.product_id = pbs.product_id AND i2.domain_id = $1
302
+ AND i2.bizplace_id IN (${bizplaceIds})
303
+ AND i2.status = 'STORED'
304
+ LEFT JOIN oi ON oi.product_id = i2.product_id
305
+ GROUP BY pbs.product_id, pbs.product_bundle_id
306
+ ) pbs ON pbs.product_bundle_id = pb.id
307
+ ${bundleWhereClause}
308
+ GROUP BY pb.packing_type, pb.packing_size, pb.name, pb.sku, pb.id
309
+ )
310
+ AS inv_prod_grp
311
+ ${whereClause}
312
+ )
313
+ `
156
314
 
157
315
  await trxMgr.query(queryStrings, [domain.id])
158
316
 
@@ -229,11 +387,10 @@ export const InventoryUtil = {
229
387
  SUM(COALESCE(i.locked_qty, 0)) + MAX(COALESCE(oi.release_qty, 0)) AS "totalLockedQty",
230
388
  SUM(COALESCE(i.locked_uom_value, 0)) + MAX(COALESCE(oi.release_uom_value, 0)) AS "totalLockedUomValue",
231
389
  concat(SUM(COALESCE(i.uom_value, 0)) - SUM(COALESCE(i.locked_uom_value, 0)) - MAX(COALESCE(oi.release_uom_value, 0)), ' ', i.uom) AS "remainUomValueWithUom"
232
- FROM
233
- inventories i
234
- LEFT JOIN products p ON i.product_id = p.id
235
- LEFT JOIN oi ON p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
236
- LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
390
+ FROM inventories i
391
+ LEFT JOIN products p ON i.product_id = p.id
392
+ LEFT JOIN oi ON p.name = oi.product_name AND i.packing_type = oi.packing_type AND i.packing_size = oi.packing_size AND i.uom = oi.uom
393
+ LEFT JOIN locations l2 ON i.location_id = l2.id AND i.domain_id = l2.domain_id
237
394
  WHERE i.domain_id = $1
238
395
  AND l2.type NOT IN ('${LOCATION_TYPE.QUARANTINE}', '${LOCATION_TYPE.RESERVE}')
239
396
  ${apiWhereClause}
@@ -459,12 +616,14 @@ interface Conditions {
459
616
  whereClause: string
460
617
  batchBundle: string
461
618
  apiWhereClause: string
619
+ productDetailWhereClause: string
462
620
  }
463
621
 
464
622
  async function getConditions(
465
623
  bizplaces: Bizplace[],
466
624
  filters: [{ name: string; operator: string; value: any }],
467
- trxMgr: EntityManager
625
+ trxMgr: EntityManager,
626
+ hasRemainingQty: Boolean = true
468
627
  ): Promise<Conditions> {
469
628
  let bizplaceIds = bizplaces.map((bizplace: Bizplace) => `'${bizplace.id}'`).join()
470
629
 
@@ -479,9 +638,9 @@ async function getConditions(
479
638
  WHERE pb.status = 'ACTIVATED'
480
639
  `
481
640
 
482
- let whereClause = `
483
- WHERE "remainQty" > 0
484
- `
641
+ let whereClause = hasRemainingQty ? ` WHERE "remainQty" > 0` : ` WHERE 1 = 1`
642
+
643
+ let productDetailWhereClause = ``
485
644
 
486
645
  let batchBundle: string
487
646
  if (filters?.length) {
@@ -492,6 +651,16 @@ async function getConditions(
492
651
  let value = filter.value
493
652
 
494
653
  switch (name) {
654
+ case 'productId':
655
+ if (operator == 'in')
656
+ whereClause += `AND "productId" ${operator === 'in' ? 'IN' : 'NOT IN'} (${value.map(itm => { return `'${itm}'` }).join(',')})`
657
+ break
658
+
659
+ case 'productBundleId':
660
+ if (operator == 'in')
661
+ whereClause += `AND "productId" ${operator === 'in' ? 'IN' : 'NOT IN'} (${value.map(itm => { return `'${itm}'` }).join(',')})`
662
+ break
663
+
495
664
  case 'batchId':
496
665
  whereClause += `AND LOWER("batchId") LIKE '${value.toLowerCase()}'`
497
666
  break
@@ -592,21 +761,33 @@ async function getConditions(
592
761
  case 'batch_product':
593
762
  productWhereClause += `
594
763
  AND (i.batch_id, p.id, i.packing_type) ${operator === 'in' ? 'IN' : 'NOT IN'} (${value
595
- .map(
596
- (v: { batchId: string; productId: string; packingType: string }) =>
597
- `('${v.batchId}', '${v.productId}', '${v.packingType}')`
598
- )
599
- .join()})
764
+ .map(
765
+ (v: { batchId: string; productId: string; packingType: string }) =>
766
+ `('${v.batchId}', '${v.productId}', '${v.packingType}')`
767
+ )
768
+ .join()})
600
769
  `
601
770
  break
602
771
 
603
772
  case 'batch_bundle':
604
773
  bundleWhereClause += `
605
774
  ${bundleWhereClause == '' ? 'WHERE' : 'AND'} pb.id ${operator === 'in' ? 'IN' : 'NOT IN'} (${value
606
- .map((v: { productId: string }) => `('${v.productId}')`)
607
- .join()})
775
+ .map((v: { productId: string }) => `('${v.productId}')`)
776
+ .join()})
608
777
  `
609
778
  break
779
+
780
+ case 'product':
781
+ productDetailWhereClause += `
782
+ AND (pd.product_id, pd.packing_type, pd.packing_size, pd.uom) ${operator === 'in' ? 'IN' : 'NOT IN'} (${value
783
+ .map(
784
+ (v: { productId: string; packingType: string; packingSize: string, uom: string }) =>
785
+ `('${v.productId}', '${v.packingType}', '${v.packingSize}', '${v.uom}')`
786
+ )
787
+ .join()})
788
+ `
789
+ break
790
+
610
791
  }
611
792
  })
612
793
  )
@@ -624,7 +805,7 @@ async function getConditions(
624
805
  )
625
806
  }
626
807
 
627
- return { bizplaceIds, productWhereClause, apiWhereClause, bundleWhereClause, whereClause, batchBundle }
808
+ return { bizplaceIds, productWhereClause, apiWhereClause, bundleWhereClause, whereClause, batchBundle, productDetailWhereClause }
628
809
  }
629
810
 
630
811
  async function createInventory(
@@ -3,51 +3,44 @@ import uuid from 'uuid/v4'
3
3
  export class OrderNoGenerator {
4
4
  static arrivalNotice() {
5
5
  const currentDate = new Date()
6
- return `GAN-${currentDate.getFullYear()}${
7
- currentDate.getMonth() + 1
8
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
6
+ return `GAN-${currentDate.getFullYear()}${currentDate.getMonth() + 1
7
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
9
8
  }
10
9
 
11
10
  static collectionOrder() {
12
11
  const currentDate = new Date()
13
- return `CO-${currentDate.getFullYear()}${
14
- currentDate.getMonth() + 1
15
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
12
+ return `CO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
13
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
16
14
  }
17
15
 
18
16
  static cycleCount() {
19
17
  const currentDate = new Date()
20
- return `CC-${currentDate.getFullYear()}${
21
- currentDate.getMonth() + 1
22
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
18
+ return `CC-${currentDate.getFullYear()}${currentDate.getMonth() + 1
19
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
23
20
  }
24
21
 
25
22
  static deliveryOrder() {
26
23
  const currentDate = new Date()
27
- return `DO-${currentDate.getFullYear()}${
28
- currentDate.getMonth() + 1
29
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
24
+ return `DO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
25
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
30
26
  }
31
27
 
32
28
  static goodsReceiveNote() {
33
29
  const currentDate = new Date()
34
- return `GRN-${currentDate.getFullYear()}${
35
- currentDate.getMonth() + 1
36
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
30
+ return `GRN-${currentDate.getFullYear()}${currentDate.getMonth() + 1
31
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
37
32
  }
38
33
 
39
34
  static jobSheet(domainName) {
40
35
  const currentDate = new Date()
41
- return `${domainName}-${currentDate.getFullYear()}${
42
- currentDate.getMonth() + 1
43
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
36
+ return `${domainName}-${currentDate.getFullYear()}${currentDate.getMonth() + 1
37
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
44
38
  }
45
39
 
46
40
  static manifest() {
47
41
  const currentDate = new Date()
48
- return `LM-${currentDate.getFullYear()}${
49
- currentDate.getMonth() + 1
50
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
42
+ return `LM-${currentDate.getFullYear()}${currentDate.getMonth() + 1
43
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
51
44
  }
52
45
 
53
46
  static orderInventory() {
@@ -66,18 +59,26 @@ export class OrderNoGenerator {
66
59
  return `OV-${uuid()}`
67
60
  }
68
61
 
62
+ static orderToteItem() {
63
+ return `OTI-${uuid()}`
64
+ }
65
+
69
66
  static purchaseOrder() {
70
67
  const currentDate = new Date()
71
- return `PO-${currentDate.getFullYear()}${
72
- currentDate.getMonth() + 1
73
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
68
+ return `PO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
69
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
74
70
  }
75
71
 
76
72
  static releaseGood() {
77
73
  const currentDate = new Date()
78
- return `RO-${currentDate.getFullYear()}${
79
- currentDate.getMonth() + 1
80
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
74
+ return `RO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
75
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
76
+ }
77
+
78
+ static draftReleaseGood() {
79
+ const currentDate = new Date()
80
+ return `ODO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
81
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
81
82
  }
82
83
 
83
84
  static releaseVas() {
@@ -86,50 +87,43 @@ export class OrderNoGenerator {
86
87
 
87
88
  static retailReplenishmentOrder() {
88
89
  const currentDate = new Date()
89
- return `RR-${currentDate.getFullYear()}${
90
- currentDate.getMonth() + 1
91
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
90
+ return `RR-${currentDate.getFullYear()}${currentDate.getMonth() + 1
91
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
92
92
  }
93
93
 
94
94
  static returnOrder() {
95
95
  const currentDate = new Date()
96
- return `RTO-${currentDate.getFullYear()}${
97
- currentDate.getMonth() + 1
98
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
96
+ return `RTO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
97
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
99
98
  }
100
99
 
101
100
  static shippingOrder() {
102
101
  const currentDate = new Date()
103
- return `SO-${currentDate.getFullYear()}${
104
- currentDate.getMonth() + 1
105
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
102
+ return `SO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
103
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
106
104
  }
107
105
 
108
106
  static stockTake() {
109
107
  const currentDate = new Date()
110
- return `ST-${currentDate.getFullYear()}${
111
- currentDate.getMonth() + 1
112
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
108
+ return `ST-${currentDate.getFullYear()}${currentDate.getMonth() + 1
109
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
113
110
  }
114
111
 
115
112
  static transferOrder() {
116
113
  const currentDate = new Date()
117
- return `TO-${currentDate.getFullYear()}${
118
- currentDate.getMonth() + 1
119
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
114
+ return `TO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
115
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
120
116
  }
121
117
 
122
118
  static vasOrder() {
123
119
  const currentDate = new Date()
124
- return `VO-${currentDate.getFullYear()}${
125
- currentDate.getMonth() + 1
126
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
120
+ return `VO-${currentDate.getFullYear()}${currentDate.getMonth() + 1
121
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
127
122
  }
128
123
 
129
124
  static invoice() {
130
125
  const currentDate = new Date()
131
- return `INV-${currentDate.getFullYear()}${
132
- currentDate.getMonth() + 1
133
- }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
126
+ return `INV-${currentDate.getFullYear()}${currentDate.getMonth() + 1
127
+ }${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
134
128
  }
135
129
  }