@things-factory/sales-ui 4.3.156 → 4.3.157

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.
@@ -483,6 +483,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
483
483
  await this._fetchPO()
484
484
 
485
485
  this._editable = this._purchaseOrderData?.status == PURCHASE_ORDER_STATUS.DRAFT
486
+
486
487
  this._configureProductGrist()
487
488
  } catch (e) {
488
489
  this._showToast(e)
@@ -753,7 +754,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
753
754
  }
754
755
  }
755
756
 
756
- const amountRelatedColumns = ['uomValue', 'uom', 'packQty', 'releaseQty', 'releaseUomValue', 'unitPrice']
757
+ const amountRelatedColumns = ['uomValue', 'uom', 'packQty', 'releaseQty', 'releaseUomValue']
757
758
  if (amountRelatedColumns.indexOf(changedColumn) >= 0) {
758
759
  const calcedAmount = this._calcAmount(changedColumn, changeRecord)
759
760
  for (let key in calcedAmount) {
@@ -890,14 +891,14 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
890
891
  let { packQty, totalAmt, taxAmt, taxRate, discountAmt, unitPrice, miscAmt } = changeRecord
891
892
 
892
893
  packQty = packQty || 0
893
- unitPrice = parseFloat(unitPrice || 0).toFixed(2)
894
+ unitPrice = parseFloat((unitPrice || 0).toFixed(2))
894
895
  miscAmt = parseFloat((miscAmt || 0).toFixed(2))
895
896
  taxRate = parseFloat((taxRate || 0).toFixed(2))
896
897
  discountAmt = parseFloat((discountAmt || 0).toFixed(2))
897
898
 
898
- let totalAmtBeforeTax = parseFloat(packQty * unitPrice + miscAmt - discountAmt).toFixed(2)
899
+ let totalAmtBeforeTax = packQty * unitPrice + miscAmt - discountAmt
899
900
  taxAmt = parseFloat(((totalAmtBeforeTax * taxRate) / 100).toFixed(2))
900
- totalAmt = parseFloat(totalAmtBeforeTax + taxAmt).toFixed(2)
901
+ totalAmt = parseFloat((totalAmtBeforeTax + taxAmt).toFixed(2))
901
902
 
902
903
  return { totalAmt, taxAmt, taxRate, discountAmt, unitPrice, miscAmt }
903
904
  }
@@ -1078,7 +1079,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1078
1079
  name
1079
1080
  brand
1080
1081
  description
1081
- costPrice
1082
1082
  }
1083
1083
  productDetail {
1084
1084
  id
@@ -1163,7 +1163,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1163
1163
  return {
1164
1164
  ...itm,
1165
1165
  brand: itm.product.brand,
1166
- unitPrice: itm.product.costPrice,
1167
1166
  productName: `${itm.product.name}(${itm.product.description}(${itm.product.sku}))`,
1168
1167
  ...this._calcPrice(itm)
1169
1168
  }
@@ -1243,22 +1242,9 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1243
1242
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
1244
1243
  }
1245
1244
 
1246
- if (
1247
- records.map(record => {
1248
- if (record.unitPrice) {
1249
- record.unitPrice = parseFloat(record.unitPrice)
1250
- if (isNaN(record.unitPrice)) {
1251
- throw new Error(i18next.t('text.invalid_input_in_unit_price'))
1252
- }
1253
- }
1254
- if (!record.unitPrice && record.unitPrice == 0) {
1255
- record.unitPrice = 0
1256
- }
1257
- })
1258
- )
1259
- if (records.some(({ unitPrice }) => unitPrice < 0)) {
1260
- throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
1261
- }
1245
+ if (records.some(({ unitPrice }) => unitPrice < 0)) {
1246
+ throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.unit_price') } }))
1247
+ }
1262
1248
 
1263
1249
  if (records.some(({ miscAmt }) => miscAmt < 0)) {
1264
1250
  throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.misc_amt') } }))
@@ -1294,11 +1280,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1294
1280
  remark: record?.remark || null,
1295
1281
  discountAmt: record.discountAmt,
1296
1282
  unitPrice:
1297
- status == PURCHASE_ORDER_STATUS.DRAFT
1298
- ? parseFloat(record.unitPrice)
1299
- : record.unitPrice > 0
1300
- ? parseFloat(record.unitPrice)
1301
- : 0,
1283
+ status == PURCHASE_ORDER_STATUS.DRAFT ? record.unitPrice : record.unitPrice > 0 ? record.unitPrice : 1,
1302
1284
  miscAmt: record.miscAmt,
1303
1285
  taxRate: record.taxRate
1304
1286
  }
@@ -1668,6 +1650,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1668
1650
  taxRate
1669
1651
  batchId
1670
1652
  batchIdRef
1653
+ unitPrice
1671
1654
  remark
1672
1655
  productSKU
1673
1656
  productName
@@ -1682,12 +1665,10 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1682
1665
  brand
1683
1666
  primaryUnit
1684
1667
  primaryValue
1685
- costPrice
1686
1668
  }
1687
1669
  productDetail {
1688
1670
  id
1689
1671
  name
1690
- costPrice
1691
1672
  }
1692
1673
  }
1693
1674
  }
@@ -1697,22 +1678,14 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1697
1678
 
1698
1679
  if (!response.errors) {
1699
1680
  const data = response.data.bulkUploadValidatePoOrderProducts.map(item => {
1700
- if (item.unitPrice == null) {
1701
- item.unitPrice = item.productDetail.costPrice
1702
- }
1703
- let totalAmtBeforeTax = parseFloat(item.packQty * item.unitPrice + item.miscAmt - item.discountAmt).toFixed(2)
1704
- let taxAmt = parseFloat(((totalAmtBeforeTax * item.taxRate) / 100).toFixed(2))
1705
- let totalAmt = parseFloat(totalAmtBeforeTax + item.taxAmt).toFixed(2)
1706
1681
  return {
1707
1682
  ...item,
1708
1683
  productName: item?.productName,
1709
- unitPrice: parseFloat(item.unitPrice || 0).toFixed(2),
1684
+ unitPrice: parseFloat(item.unitPrice) || 0,
1710
1685
  packQty: parseInt(item.packQty) || 0,
1711
1686
  miscAmt: parseFloat(item.miscAmt) || 0,
1712
1687
  discountAmt: parseFloat(item.discountAmt) || 0,
1713
- taxRate: parseFloat(item.taxRate) || 0,
1714
- taxAmt,
1715
- totalAmt
1688
+ taxRate: parseFloat(item.taxRate) || 0
1716
1689
  }
1717
1690
  })
1718
1691
  this.productData = {
@@ -1735,21 +1708,11 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1735
1708
  this._validateProducts(records)
1736
1709
 
1737
1710
  const orderProducts = records.map(record => {
1738
- if (record.unitPrice) {
1739
- record.unitPrice = parseFloat(record.unitPrice)
1740
- }
1741
- if (!record.unitPrice) {
1742
- if (record.unitPrice == 0) {
1743
- record.unitPrice == 0
1744
- } else {
1745
- record.unitPrice = null
1746
- }
1747
- }
1748
1711
  delete record.cuFlag
1749
1712
  delete record.id
1750
1713
  return {
1751
1714
  ...record,
1752
- unitPrice: record.unitPrice,
1715
+ unitPrice: record?.unitPrice > 0 ? parseFloat(record?.unitPrice) : 0,
1753
1716
  packQty: parseInt(record?.packQty) || 0,
1754
1717
  miscAmt: record?.miscAmt > 0 ? parseFloat(record?.miscAmt) : 0,
1755
1718
  discountAmt: record?.discountAmt > 0 ? parseFloat(record?.discountAmt) : 0,
@@ -1770,9 +1733,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
1770
1733
  records = records
1771
1734
  .filter(record => record.productSKU)
1772
1735
  .map(record => {
1773
- if (typeof record.unitPrice === 'object') {
1774
- record.unitPrice = 0
1775
- }
1776
1736
  return {
1777
1737
  ...record
1778
1738
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/sales-ui",
3
- "version": "4.3.156",
3
+ "version": "4.3.157",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,15 +23,15 @@
23
23
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/code-base": "^4.3.156",
27
- "@things-factory/form-ui": "^4.3.156",
28
- "@things-factory/grist-ui": "^4.3.156",
29
- "@things-factory/i18n-base": "^4.3.156",
30
- "@things-factory/import-ui": "^4.3.156",
31
- "@things-factory/sales-base": "^4.3.156",
32
- "@things-factory/setting-ui": "^4.3.156",
33
- "@things-factory/shell": "^4.3.156",
34
- "@things-factory/warehouse-ui": "^4.3.156"
26
+ "@things-factory/code-base": "^4.3.151",
27
+ "@things-factory/form-ui": "^4.3.151",
28
+ "@things-factory/grist-ui": "^4.3.155",
29
+ "@things-factory/i18n-base": "^4.3.151",
30
+ "@things-factory/import-ui": "^4.3.155",
31
+ "@things-factory/sales-base": "^4.3.157",
32
+ "@things-factory/setting-ui": "^4.3.155",
33
+ "@things-factory/shell": "^4.3.151",
34
+ "@things-factory/warehouse-ui": "^4.3.157"
35
35
  },
36
- "gitHead": "cbdf5546969663ba03bb1f4f10666599aa6d00bc"
36
+ "gitHead": "a1f20b08aa67f2c07f7e5ad138243122641a3d5a"
37
37
  }
@@ -45,6 +45,5 @@
45
45
  "title.purchase_orders_approval": "purchase orders approval",
46
46
  "title.purchase_orders": "purchase orders",
47
47
  "text.there_is_duplicated_products_with_same_batch_no": "there is duplicated products with same batch no",
48
- "text.invalid_input_in_unit_price": "invalid input in unit price",
49
48
  "title.tolerance_limit": "tolerance limit"
50
49
  }
@@ -45,6 +45,5 @@
45
45
  "label.total_disc_amt": "[ko] total disc amt",
46
46
  "label.tax_rate": "[ko] tax rate",
47
47
  "text.purchase_order_updated": "[ko] purchase order updated",
48
- "text.there_is_duplicated_products_with_same_batch_no": "[ko] there is duplicated products with same batch no",
49
- "text.invalid_input_in_unit_price": "[ko] invalid input in unit price"
48
+ "text.there_is_duplicated_products_with_same_batch_no": "[ko] there is duplicated products with same batch no"
50
49
  }
@@ -45,6 +45,5 @@
45
45
  "label.total_disc_amt": "[ms] total disc amt",
46
46
  "label.tax_rate": "[ms] tax rate",
47
47
  "text.purchase_order_updated": "[ms] purchase order updated",
48
- "text.there_is_duplicated_products_with_same_batch_no": "[ms] there is duplicated products with same batch no",
49
- "text.invalid_input_in_unit_price": "[ms] invalid input in unit price"
48
+ "text.there_is_duplicated_products_with_same_batch_no": "[ms] there is duplicated products with same batch no"
50
49
  }
@@ -45,6 +45,5 @@
45
45
  "label.total_disc_amt": "[zh] total disc amt",
46
46
  "label.tax_rate": "[zh] tax rate",
47
47
  "text.purchase_order_updated": "[zh] purchase order updated",
48
- "text.there_is_duplicated_products_with_same_batch_no": "[zh] there is duplicated products with same batch no",
49
- "text.invalid_input_in_unit_price": "[zh] invalid input in unit price"
48
+ "text.there_is_duplicated_products_with_same_batch_no": "[zh] there is duplicated products with same batch no"
50
49
  }