@things-factory/sales-ui 4.3.154 → 4.3.156
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,7 +483,6 @@ 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
|
-
|
|
487
486
|
this._configureProductGrist()
|
|
488
487
|
} catch (e) {
|
|
489
488
|
this._showToast(e)
|
|
@@ -754,7 +753,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
754
753
|
}
|
|
755
754
|
}
|
|
756
755
|
|
|
757
|
-
const amountRelatedColumns = ['uomValue', 'uom', 'packQty', 'releaseQty', 'releaseUomValue']
|
|
756
|
+
const amountRelatedColumns = ['uomValue', 'uom', 'packQty', 'releaseQty', 'releaseUomValue', 'unitPrice']
|
|
758
757
|
if (amountRelatedColumns.indexOf(changedColumn) >= 0) {
|
|
759
758
|
const calcedAmount = this._calcAmount(changedColumn, changeRecord)
|
|
760
759
|
for (let key in calcedAmount) {
|
|
@@ -891,14 +890,14 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
891
890
|
let { packQty, totalAmt, taxAmt, taxRate, discountAmt, unitPrice, miscAmt } = changeRecord
|
|
892
891
|
|
|
893
892
|
packQty = packQty || 0
|
|
894
|
-
unitPrice = parseFloat(
|
|
893
|
+
unitPrice = parseFloat(unitPrice || 0).toFixed(2)
|
|
895
894
|
miscAmt = parseFloat((miscAmt || 0).toFixed(2))
|
|
896
895
|
taxRate = parseFloat((taxRate || 0).toFixed(2))
|
|
897
896
|
discountAmt = parseFloat((discountAmt || 0).toFixed(2))
|
|
898
897
|
|
|
899
|
-
let totalAmtBeforeTax = packQty * unitPrice + miscAmt - discountAmt
|
|
898
|
+
let totalAmtBeforeTax = parseFloat(packQty * unitPrice + miscAmt - discountAmt).toFixed(2)
|
|
900
899
|
taxAmt = parseFloat(((totalAmtBeforeTax * taxRate) / 100).toFixed(2))
|
|
901
|
-
totalAmt = parseFloat(
|
|
900
|
+
totalAmt = parseFloat(totalAmtBeforeTax + taxAmt).toFixed(2)
|
|
902
901
|
|
|
903
902
|
return { totalAmt, taxAmt, taxRate, discountAmt, unitPrice, miscAmt }
|
|
904
903
|
}
|
|
@@ -1079,6 +1078,7 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1079
1078
|
name
|
|
1080
1079
|
brand
|
|
1081
1080
|
description
|
|
1081
|
+
costPrice
|
|
1082
1082
|
}
|
|
1083
1083
|
productDetail {
|
|
1084
1084
|
id
|
|
@@ -1163,6 +1163,7 @@ 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,
|
|
1166
1167
|
productName: `${itm.product.name}(${itm.product.description}(${itm.product.sku}))`,
|
|
1167
1168
|
...this._calcPrice(itm)
|
|
1168
1169
|
}
|
|
@@ -1242,9 +1243,22 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1242
1243
|
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.pack_qty') } }))
|
|
1243
1244
|
}
|
|
1244
1245
|
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1247
|
-
|
|
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
|
+
}
|
|
1248
1262
|
|
|
1249
1263
|
if (records.some(({ miscAmt }) => miscAmt < 0)) {
|
|
1250
1264
|
throw new Error(i18next.t('text.x_should_be_positive', { state: { x: i18next.t('label.misc_amt') } }))
|
|
@@ -1280,7 +1294,11 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1280
1294
|
remark: record?.remark || null,
|
|
1281
1295
|
discountAmt: record.discountAmt,
|
|
1282
1296
|
unitPrice:
|
|
1283
|
-
status == PURCHASE_ORDER_STATUS.DRAFT
|
|
1297
|
+
status == PURCHASE_ORDER_STATUS.DRAFT
|
|
1298
|
+
? parseFloat(record.unitPrice)
|
|
1299
|
+
: record.unitPrice > 0
|
|
1300
|
+
? parseFloat(record.unitPrice)
|
|
1301
|
+
: 0,
|
|
1284
1302
|
miscAmt: record.miscAmt,
|
|
1285
1303
|
taxRate: record.taxRate
|
|
1286
1304
|
}
|
|
@@ -1650,7 +1668,6 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1650
1668
|
taxRate
|
|
1651
1669
|
batchId
|
|
1652
1670
|
batchIdRef
|
|
1653
|
-
unitPrice
|
|
1654
1671
|
remark
|
|
1655
1672
|
productSKU
|
|
1656
1673
|
productName
|
|
@@ -1665,10 +1682,12 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1665
1682
|
brand
|
|
1666
1683
|
primaryUnit
|
|
1667
1684
|
primaryValue
|
|
1685
|
+
costPrice
|
|
1668
1686
|
}
|
|
1669
1687
|
productDetail {
|
|
1670
1688
|
id
|
|
1671
1689
|
name
|
|
1690
|
+
costPrice
|
|
1672
1691
|
}
|
|
1673
1692
|
}
|
|
1674
1693
|
}
|
|
@@ -1678,14 +1697,22 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1678
1697
|
|
|
1679
1698
|
if (!response.errors) {
|
|
1680
1699
|
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)
|
|
1681
1706
|
return {
|
|
1682
1707
|
...item,
|
|
1683
1708
|
productName: item?.productName,
|
|
1684
|
-
unitPrice: parseFloat(item.unitPrice
|
|
1709
|
+
unitPrice: parseFloat(item.unitPrice || 0).toFixed(2),
|
|
1685
1710
|
packQty: parseInt(item.packQty) || 0,
|
|
1686
1711
|
miscAmt: parseFloat(item.miscAmt) || 0,
|
|
1687
1712
|
discountAmt: parseFloat(item.discountAmt) || 0,
|
|
1688
|
-
taxRate: parseFloat(item.taxRate) || 0
|
|
1713
|
+
taxRate: parseFloat(item.taxRate) || 0,
|
|
1714
|
+
taxAmt,
|
|
1715
|
+
totalAmt
|
|
1689
1716
|
}
|
|
1690
1717
|
})
|
|
1691
1718
|
this.productData = {
|
|
@@ -1708,11 +1735,21 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1708
1735
|
this._validateProducts(records)
|
|
1709
1736
|
|
|
1710
1737
|
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
|
+
}
|
|
1711
1748
|
delete record.cuFlag
|
|
1712
1749
|
delete record.id
|
|
1713
1750
|
return {
|
|
1714
1751
|
...record,
|
|
1715
|
-
unitPrice: record
|
|
1752
|
+
unitPrice: record.unitPrice,
|
|
1716
1753
|
packQty: parseInt(record?.packQty) || 0,
|
|
1717
1754
|
miscAmt: record?.miscAmt > 0 ? parseFloat(record?.miscAmt) : 0,
|
|
1718
1755
|
discountAmt: record?.discountAmt > 0 ? parseFloat(record?.discountAmt) : 0,
|
|
@@ -1733,6 +1770,9 @@ class PurchaseOrderDetail extends connect(store)(localize(i18next)(PageView)) {
|
|
|
1733
1770
|
records = records
|
|
1734
1771
|
.filter(record => record.productSKU)
|
|
1735
1772
|
.map(record => {
|
|
1773
|
+
if (typeof record.unitPrice === 'object') {
|
|
1774
|
+
record.unitPrice = 0
|
|
1775
|
+
}
|
|
1736
1776
|
return {
|
|
1737
1777
|
...record
|
|
1738
1778
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/sales-ui",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.156",
|
|
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.
|
|
27
|
-
"@things-factory/form-ui": "^4.3.
|
|
28
|
-
"@things-factory/grist-ui": "^4.3.
|
|
29
|
-
"@things-factory/i18n-base": "^4.3.
|
|
30
|
-
"@things-factory/import-ui": "^4.3.
|
|
31
|
-
"@things-factory/sales-base": "^4.3.
|
|
32
|
-
"@things-factory/setting-ui": "^4.3.
|
|
33
|
-
"@things-factory/shell": "^4.3.
|
|
34
|
-
"@things-factory/warehouse-ui": "^4.3.
|
|
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"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "cbdf5546969663ba03bb1f4f10666599aa6d00bc"
|
|
37
37
|
}
|
package/translations/en.json
CHANGED
|
@@ -45,5 +45,6 @@
|
|
|
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",
|
|
48
49
|
"title.tolerance_limit": "tolerance limit"
|
|
49
50
|
}
|
package/translations/ko.json
CHANGED
|
@@ -45,5 +45,6 @@
|
|
|
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"
|
|
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"
|
|
49
50
|
}
|
package/translations/ms.json
CHANGED
|
@@ -45,5 +45,6 @@
|
|
|
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"
|
|
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"
|
|
49
50
|
}
|
package/translations/zh.json
CHANGED
|
@@ -45,5 +45,6 @@
|
|
|
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"
|
|
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"
|
|
49
50
|
}
|