Commit 11745b93214e919518980611001fbff50c3f53fa
1 parent
9d96349e
1.处理财务中收付款逻辑
Showing
1 changed file
with
54 additions
and
2 deletions
src/components/Common/CommonBillEvent.js
| ... | ... | @@ -4593,7 +4593,11 @@ export default (ChildComponent) => { |
| 4593 | 4593 | let models = name === 'materials' ? 'Materials' : |
| 4594 | 4594 | sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('cashier/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; |
| 4595 | 4595 | |
| 4596 | - | |
| 4596 | + if(sModelsType.includes('cashier/receipt') ) { /* 收款单 */ | |
| 4597 | + models = 'Product'; | |
| 4598 | + } else if(sModelsType.includes('cashier/payment') ) { /* 付款单 */ | |
| 4599 | + models = 'Materials'; | |
| 4600 | + } | |
| 4597 | 4601 | |
| 4598 | 4602 | if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') |
| 4599 | 4603 | || sModelsType.includes('outside/') || sModelsType.includes('semigoodsStock/') || sModelsType.includes('sales/materials') || sModelsType === 'sales/salesCheck') { |
| ... | ... | @@ -5775,7 +5779,17 @@ export default (ChildComponent) => { |
| 5775 | 5779 | }); |
| 5776 | 5780 | } |
| 5777 | 5781 | |
| 5778 | - const dTotalMoney = masterData.dTotalMoney !== undefined ? masterData.dTotalMoney : 0; | |
| 5782 | + let dTotalMoney = masterData.dTotalMoney !== undefined ? masterData.dTotalMoney : 0; | |
| 5783 | + | |
| 5784 | + if (dTotalMoney === 0) { | |
| 5785 | + if (sModelsType === "cashier/payment") { | |
| 5786 | + /* 付款单1 */ | |
| 5787 | + dTotalMoney = masterData.dMaterialsMoney; | |
| 5788 | + } else { | |
| 5789 | + dTotalMoney = masterData.dProductMoney; | |
| 5790 | + } | |
| 5791 | + } | |
| 5792 | + const models = sModelsType.includes("cashier/receipt") ? "Product" : "Materials"; | |
| 5779 | 5793 | let minusSum = 0; /* 负数求和 */ |
| 5780 | 5794 | let minusRoundingSum = 0; /* 负数舍入求和 */ |
| 5781 | 5795 | const minusData = []; /* 负数集 */ |
| ... | ... | @@ -5785,6 +5799,8 @@ export default (ChildComponent) => { |
| 5785 | 5799 | if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) { |
| 5786 | 5800 | slaveData.forEach((child) => { |
| 5787 | 5801 | child.dTotalMoney = 0; |
| 5802 | + child.dProductMoney = 0; | |
| 5803 | + child.dMaterialsMoney = 0; | |
| 5788 | 5804 | child.handleType = commonUtils.isEmpty(child.handleType) ? 'update' : child.handleType; |
| 5789 | 5805 | child.dRoundingMoney = commonUtils.isNum(child.dRoundingMoney) ? child.dRoundingMoney : 0; |
| 5790 | 5806 | child.dBalanceMoney = commonUtils.convertFixNum(child.dBalanceMoney, dNetMoney); /* 根据系统设定位数格式未付款金额*/ |
| ... | ... | @@ -5864,6 +5880,25 @@ export default (ChildComponent) => { |
| 5864 | 5880 | if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) { |
| 5865 | 5881 | slaveData.forEach((item, index) => { |
| 5866 | 5882 | slaveData[index].dTotalForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? item.dTotalMoney / dCurrencyRate : 0, dNetMoney); |
| 5883 | + slaveData[index].dProductForeignMoney = slaveData[index].dTotalForeignMoney; | |
| 5884 | + slaveData[index].dMaterialsForeignMoney = slaveData[index].dTotalForeignMoney; | |
| 5885 | + slaveData[index].dMaterialsMoney = slaveData[index].dTotalMoney; | |
| 5886 | + slaveData[index].dProductMoney = slaveData[index].dTotalMoney; | |
| 5887 | + console.log("111", slaveData[index]); | |
| 5888 | + console.log("222", models); | |
| 5889 | + if (models === "Materials" && commonUtils.isNotEmptyNumber(slaveData[index].dMaterialsQty)) { | |
| 5890 | + const dQty = slaveData[index].dMaterialsQty; | |
| 5891 | + const dMoney = slaveData[index].dMaterialsMoney; | |
| 5892 | + slaveData[index].dMaterialsPrice = commonUtils.convertFixNum(dMoney / dQty, 6); | |
| 5893 | + slaveData[index].dMaterialsForeignPrice = commonUtils.convertFixNum(slaveData[index].dMaterialsForeignMoney / dQty, 6); | |
| 5894 | + } else if (commonUtils.isNotEmptyNumber(slaveData[index].dProductQty)) { | |
| 5895 | + const dQty = slaveData[index].dProductQty; | |
| 5896 | + const dMoney = slaveData[index].dProductMoney; | |
| 5897 | + slaveData[index].dProductPrice = commonUtils.convertFixNum(dMoney / dQty, 6); | |
| 5898 | + slaveData[index].dProductForeignPrice = commonUtils.convertFixNum(slaveData[index].dProductForeignMoney / dQty, 6); | |
| 5899 | + } | |
| 5900 | + | |
| 5901 | + console.log("eeeee", slaveData[index]); | |
| 5867 | 5902 | }); |
| 5868 | 5903 | } |
| 5869 | 5904 | masterData.handleType = commonUtils.isEmpty(masterData.handleType) ? 'update' : masterData.handleType; |
| ... | ... | @@ -5906,6 +5941,23 @@ export default (ChildComponent) => { |
| 5906 | 5941 | if (commonUtils.isNotEmptyArr(slaveData) && slaveData.length > 0) { |
| 5907 | 5942 | slaveData.forEach((item, index) => { |
| 5908 | 5943 | slaveData[index].dTotalForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? item.dTotalMoney / dCurrencyRate : 0, dNetMoney); |
| 5944 | + slaveData[index].dProductForeignMoney = slaveData[index].dTotalForeignMoney; | |
| 5945 | + slaveData[index].dMaterialsForeignMoney = slaveData[index].dTotalForeignMoney; | |
| 5946 | + slaveData[index].dMaterialsMoney = slaveData[index].dTotalMoney; | |
| 5947 | + slaveData[index].dProductMoney = slaveData[index].dTotalMoney; | |
| 5948 | + console.log("333", slaveData[index].dMaterialsQty); | |
| 5949 | + console.log("441", models); | |
| 5950 | + if (models === "Materials" && commonUtils.isNotEmptyNumber(slaveData[index].dMaterialsQty)) { | |
| 5951 | + const dQty = slaveData[index].dMaterialsQty; | |
| 5952 | + const dMoney = slaveData[index].dMaterialsMoney; | |
| 5953 | + slaveData[index].dMaterialsPrice = commonUtils.convertFixNum(dMoney / dQty, 6); | |
| 5954 | + slaveData[index].dMaterialsForeignPrice = commonUtils.convertFixNum(slaveData[index].dMaterialsForeignMoney / dQty, 6); | |
| 5955 | + } else if (commonUtils.isNotEmptyNumber(slaveData[index].dProductQty)) { | |
| 5956 | + const dQty = slaveData[index].dProductQty; | |
| 5957 | + const dMoney = slaveData[index].dProductMoney; | |
| 5958 | + slaveData[index].dProductPrice = commonUtils.convertFixNum(dMoney / dQty, 6); | |
| 5959 | + slaveData[index].dProductForeignPrice = commonUtils.convertFixNum(slaveData[index].dProductForeignMoney / dQty, 6); | |
| 5960 | + } | |
| 5909 | 5961 | }); |
| 5910 | 5962 | } |
| 5911 | 5963 | masterData.dAdvanceMoney = 0; | ... | ... |