Commit d21f9879c31b73635c44a5fdb483e1b91e5d2cad
1 parent
11dc43b1
1.采购发票填写把报损数量后,发票金额会变成负数
Showing
2 changed files
with
57 additions
and
7 deletions
src/components/Common/CommonNewBillEvent.js
| @@ -3330,12 +3330,62 @@ export default ChildComponent => { | @@ -3330,12 +3330,62 @@ export default ChildComponent => { | ||
| 3330 | // else { | 3330 | // else { |
| 3331 | // this.props.getServiceError(returnData); | 3331 | // this.props.getServiceError(returnData); |
| 3332 | // } | 3332 | // } |
| 3333 | - } else if (sModelsType === "sales/salesCheck" && sFieldName === "dLossMoney" && name === "slave") { | ||
| 3334 | - if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcMoney) && commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney)) { | ||
| 3335 | - const dPprice = this.props.getFloatNum("dProductPrice"); /* 获取系统设定小数位 */ | ||
| 3336 | - tableDataRow.dProductMoney = commonUtils.convertFixNum(tableDataRow.dSrcMoney - tableDataRow.dLossMoney, dPprice); | ||
| 3337 | - } else if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcMoney) && commonUtils.isEmptyNumber(tableDataRow.dLossMoney)) { | ||
| 3338 | - tableDataRow.dProductMoney = tableDataRow.dSrcMoney; | 3333 | + } else if (sModelsType === 'sales/salesCheck' && sFieldName === 'dLossMoney' && name === 'slave') { |
| 3334 | + const dPmoney = this.props.getFloatNum('dProductMoney'); | ||
| 3335 | + const { dNetPrice } = app.decimals; | ||
| 3336 | + const dCurrencyRate = commonUtils.convertIsNotNumToNumber1(masterData.dCurrencyRate); /* 汇率 */ | ||
| 3337 | + const dTaxRate = commonUtils.convertToNum(tableDataRow.dTaxRate); /* 税率 */ | ||
| 3338 | + const dProductQty = commonUtils.convertToNum(tableDataRow.dProductQty); /* 数量 */ | ||
| 3339 | + if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcNoCheckMoney) && commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney)) { | ||
| 3340 | + const dProductForeignMoney = commonUtils.convertFixNum(tableDataRow.dSrcNoCheckMoney - tableDataRow.dLossMoney, dPmoney); | ||
| 3341 | + const dProductMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? dProductForeignMoney * dCurrencyRate : 0, dPmoney); /* 本位币金额 */ | ||
| 3342 | + tableDataRow.dProductForeignMoney = dProductForeignMoney; | ||
| 3343 | + tableDataRow.dProductMoney = dProductMoney; | ||
| 3344 | + const dProductNoTaxMoney = commonUtils.convertFixNum(dProductMoney / (1 + (dTaxRate / 100)), dPmoney); /* 不含税金额 */ | ||
| 3345 | + const dProductNoTaxPrice = commonUtils.convertFixNum(dProductQty !== 0 ? dProductNoTaxMoney / dProductQty : 0, dPmoney); /* 不含税价 */ | ||
| 3346 | + const dProductTaxMoney = commonUtils.convertFixNum(dProductMoney - dProductNoTaxMoney, dPmoney); /* 税额 */ | ||
| 3347 | + const dProductTaxForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? dProductTaxMoney / dCurrencyRate : 0, dPmoney); /* 外币税额 */ | ||
| 3348 | + tableDataRow.dProductNoTaxMoney = dProductNoTaxMoney; /* 不含税金额 */ | ||
| 3349 | + tableDataRow.dProductNoTaxPrice = dProductNoTaxPrice; /* 不含税价 */ | ||
| 3350 | + tableDataRow.dProductTaxMoney = dProductTaxMoney; /* 税额 */ | ||
| 3351 | + tableDataRow.dProductTaxForeignMoney = dProductTaxForeignMoney; /* 外币税额 */ | ||
| 3352 | + /* 报损金额改变后 反算单价 */ | ||
| 3353 | + tableDataRow.dProductForeignPrice = tableDataRow.dProductQty !==0 ? commonUtils.convertFixNum( dProductForeignMoney/tableDataRow.dProductQty, dNetPrice) : 0; /* 外币税额 */ | ||
| 3354 | + tableDataRow.dProductPrice = tableDataRow.dProductQty !==0 ? commonUtils.convertFixNum( dProductMoney/tableDataRow.dProductQty, dNetPrice) : 0; /* 外币税额 */ | ||
| 3355 | + } else if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcNoCheckMoney) && commonUtils.isEmptyNumber(tableDataRow.dLossMoney)) { | ||
| 3356 | + const dProductForeignMoney = commonUtils.isNull(tableDataRow.dSrcNoCheckMoney, 0); | ||
| 3357 | + const dProductMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? dProductForeignMoney * dCurrencyRate : 0, dPmoney); /* 本位币金额 */ | ||
| 3358 | + tableDataRow.dProductForeignMoney = dProductForeignMoney; | ||
| 3359 | + tableDataRow.dProductMoney = dProductMoney; | ||
| 3360 | + tableDataRow.dLossMoney = 0; | ||
| 3361 | + const dProductNoTaxMoney = commonUtils.convertFixNum(dProductMoney / (1 + (dTaxRate / 100)), dPmoney); /* 不含税金额 */ | ||
| 3362 | + const dProductNoTaxPrice = commonUtils.convertFixNum(dProductQty !== 0 ? dProductNoTaxMoney / dProductQty : 0, dPmoney); /* 不含税价 */ | ||
| 3363 | + const dProductTaxMoney = commonUtils.convertFixNum(dProductMoney - dProductNoTaxMoney, dPmoney); /* 税额 */ | ||
| 3364 | + const dProductTaxForeignMoney = commonUtils.convertFixNum(dCurrencyRate !== 0 ? dProductTaxMoney / dCurrencyRate : 0, dPmoney); /* 外币税额 */ | ||
| 3365 | + tableDataRow.dProductNoTaxMoney = dProductNoTaxMoney; /* 不含税金额 */ | ||
| 3366 | + tableDataRow.dProductNoTaxPrice = dProductNoTaxPrice; /* 不含税价 */ | ||
| 3367 | + tableDataRow.dProductTaxMoney = dProductTaxMoney; /* 税额 */ | ||
| 3368 | + tableDataRow.dProductTaxForeignMoney = dProductTaxForeignMoney; /* 外币税额 */ | ||
| 3369 | + } | ||
| 3370 | + } else if (sModelsType && (sModelsType === 'purchase/purchasecheck' || sModelsType.includes('outside/outsideChecking') ) && sFieldName === 'dLossMoney' && name === 'slave') { | ||
| 3371 | + const dPmoney = this.props.getFloatNum('dMaterialsMoney'); | ||
| 3372 | + const { dNetPrice } = app.decimals; | ||
| 3373 | + const dTaxRate = commonUtils.convertToNum(tableDataRow.dTaxRate); /* 税率 */ | ||
| 3374 | + const type = 'Materials'; | ||
| 3375 | + const dProductQty = commonUtils.convertToNum(tableDataRow[`d${type}Qty`]); /* 数量 */ | ||
| 3376 | + if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcNoCheckMoney) && commonUtils.isNotEmptyNumber(tableDataRow.dLossMoney)) { | ||
| 3377 | + const dMoney = commonUtils.convertFixNum(tableDataRow.dSrcNoCheckMoney - tableDataRow.dLossMoney, dPmoney); | ||
| 3378 | + tableDataRow[`d${type}Money`] = dMoney; | ||
| 3379 | + const dProductNoTaxMoney = commonUtils.convertFixNum(dMoney / (1 + (dTaxRate / 100)), dPmoney); /* 不含税金额 */ | ||
| 3380 | + const dProductNoTaxPrice = commonUtils.convertFixNum(dProductQty !== 0 ? dProductNoTaxMoney / dProductQty : 0, dPmoney); /* 不含税价 */ | ||
| 3381 | + const dProductTaxMoney = commonUtils.convertFixNum(dMoney - dProductNoTaxMoney, dPmoney); /* 税额 */ | ||
| 3382 | + tableDataRow[`d${type}NoTaxMoney`] = dProductNoTaxMoney; /* 不含税金额 */ | ||
| 3383 | + tableDataRow[`d${type}NoTaxPrice`] = dProductNoTaxPrice; /* 不含税价 */ | ||
| 3384 | + tableDataRow[`d${type}TaxMoney`] = dProductTaxMoney; /* 税额 */ | ||
| 3385 | + /* 报损金额改变后 反算单价 */ | ||
| 3386 | + tableDataRow[`d${type}Price`] = dProductQty !==0 ? commonUtils.convertFixNum( dMoney/dProductQty, dNetPrice) : 0; /* 外币税额 */ | ||
| 3387 | + } else if (commonUtils.isNotEmptyNumber(tableDataRow.dSrcNoCheckMoney) && commonUtils.isEmptyNumber(tableDataRow.dLossMoney)) { | ||
| 3388 | + tableDataRow.dMaterialsMoney = commonUtils.isNull(tableDataRow.dSrcNoCheckMoney, 0); | ||
| 3339 | tableDataRow.dLossMoney = 0; | 3389 | tableDataRow.dLossMoney = 0; |
| 3340 | } | 3390 | } |
| 3341 | } | 3391 | } |
src/components/Common/CommonTable/index.js
| @@ -4883,7 +4883,7 @@ class CommonTableRc extends React.Component { | @@ -4883,7 +4883,7 @@ class CommonTableRc extends React.Component { | ||
| 4883 | } | 4883 | } |
| 4884 | tableDataTotal.bSum = true; | 4884 | tableDataTotal.bSum = true; |
| 4885 | tableDataTotal.key = '0000'; | 4885 | tableDataTotal.key = '0000'; |
| 4886 | - console.log('tableDat212222222aTotal', tableDataTotal); | 4886 | + |
| 4887 | 4887 | ||
| 4888 | if (this.mounted) { | 4888 | if (this.mounted) { |
| 4889 | // 计算选中的行数,添加防御性检查 | 4889 | // 计算选中的行数,添加防御性检查 |