Ver código fonte

合同接口金额计算及原币值优化

chengchaohua 1 semana atrás
pai
commit
73723a1f2b

+ 16 - 10
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/webapi/ContractbillApiPlugin.java

@@ -407,9 +407,9 @@ public class ContractbillApiPlugin implements Serializable {
                 // 未付金额=含税金额 - 已付金额,未付金额(本位币)=含税金额(本位币) - 已付金额(本位币)
                 newEntry3.set("oriexpnotpayamount",fexpapplyamount.subtract(newEntry3.getBigDecimal("oriexppayedamount"))); // 未付金额
                 newEntry3.set("expnotpayamount",fexpapplyamountBen.subtract(newEntry3.getBigDecimal("exppayedamount"))); // 未付金额(本位币)
-                // 可预付金额=含税金额 - 已付金额,可预付金额(本位币)=含税金额(本位币) - 已付金额(本位币)
-                newEntry3.set("canloanamount",fexpapplyamount.subtract(newEntry3.getBigDecimal("oriexppayedamount"))); // 可预付金额
-                newEntry3.set("canloancurramount",fexpapplyamountBen.subtract(newEntry3.getBigDecimal("exppayedamount"))); // 可预付金额(本位币)
+                // 可预付金额=含税金额 - 已付金额,可预付金额(本位币)=含税金额(本位币) - 已付金额(本位币)
+                newEntry3.set("canloanamount",fexpapplyamount.subtract(newEntry3.getBigDecimal("pushedamount"))); // 可预付金额
+                newEntry3.set("canloancurramount",fexpapplyamountBen.subtract(newEntry3.getBigDecimal("pushedcurramount"))); // 可预付金额(本位币)
                 // 可报销金额=含税金额 - 已报销金额,可报销金额(本位币)=含税金额(本位币) - 已报销金额(本位币)
                 newEntry3.set("orgiexpebalanceamount",fexpapplyamount.subtract(newEntry3.getBigDecimal("reimbursedamount"))); // 可报销金额
                 newEntry3.set("expebalanceamount",fexpapplyamountBen.subtract(newEntry3.getBigDecimal("reimbursedcurramount"))); // 可报销金额(本位币)
@@ -469,8 +469,6 @@ public class ContractbillApiPlugin implements Serializable {
             dynamicObject.set("contractamount", hetongjinetotalfist); // 头表字段:合同总额(初始)
             dynamicObject.set("oriapplyamount", hetongjinetotalfist); // 头表字段:合同总额(变更后)
             dynamicObject.set("originalamount", hetongjinetotalfist); // 头表字段:合同总额(不含税)
-            dynamicObject.set("oriavailableamount", hetongjinetotalfist); // 头表字段:可用金额
-            dynamicObject.set("availableamount", hetongjinetotalfistBen); // 头表字段:可用金额(本位币)
             if (isnew) {
                 // 第一次合同送入,新增
                 dynamicObject.set("oripayedamount", 0); // 头表字段:已付金额
@@ -483,6 +481,8 @@ public class ContractbillApiPlugin implements Serializable {
                 dynamicObject.set("billcanloanamount", hetongjinetotalfistBen); // 头表字段:可预付金额(本位币)
                 dynamicObject.set("oribalanceamount", hetongjinetotalfist); // 头表字段:可报销金额
                 dynamicObject.set("balanceamount", hetongjinetotalfistBen); // 头表字段:可报销金额(本位币)
+                dynamicObject.set("oriavailableamount", hetongjinetotalfist); // 头表字段:可用金额
+                dynamicObject.set("availableamount", hetongjinetotalfistBen); // 头表字段:可用金额(本位币)
             } else {
                 // 第二次合同送入,更新
                 // a)头表字段:已付金额,已付金额(本位币)是星翰系统反写到合同台账单上的
@@ -491,16 +491,22 @@ public class ContractbillApiPlugin implements Serializable {
                 // b)头表字段:已报销金额,已报销金额(本位币)是星翰系统反写到合同台账单上的
                 BigDecimal oriusedamount = dynamicObject.getBigDecimal("oriusedamount"); // 头表字段:已报销金额
                 BigDecimal usedamount = dynamicObject.getBigDecimal("usedamount"); // 头表字段:已报销金额(本位币)
+                // c)头表字段:已预付金额,已预付金额(本位币)是星翰系统反写到合同台账单上的
+                BigDecimal oriloanedamount = dynamicObject.getBigDecimal("oriloanedamount"); // 头表字段:已预付金额
+                BigDecimal loanedamount = dynamicObject.getBigDecimal("loanedamount"); // 头表字段:已预付金额(本位币)
 
-                // c)未付金额=合同金额 - 已付金额,未付金额(本位币)=合同金额(本位币) - 已付金额(本位币)
+                // d)未付金额=合同金额 - 已付金额,未付金额(本位币)=合同金额(本位币) - 已付金额(本位币)
                 dynamicObject.set("orinotpayamount", hetongjinetotalfist.subtract(oripayedamount)); // 头表字段:未付金额
                 dynamicObject.set("notpayamount", hetongjinetotalfistBen.subtract(payedamount)); // 头表字段:未付金额(本位币)
-                // d)可预付金额=合同金额 - 已付金额,可预付金额(本位币)=合同金额(本位币) - 已付金额(本位币)
-                dynamicObject.set("oricanloanamount", hetongjinetotalfist.subtract(oripayedamount)); // 头表字段:可预付金额
-                dynamicObject.set("billcanloanamount", hetongjinetotalfistBen.subtract(payedamount)); // 头表字段:可预付金额(本位币)
-                // e)可报销金额=合同金额 - 已报销金额,可报销金额(本位币)=合同金额(本位币) - 已报销金额(本位币)
+                // e)可预付金额=合同金额 - 已预付金额,可预付金额(本位币)=合同金额(本位币) - 已付金额(本位币)
+                dynamicObject.set("oricanloanamount", hetongjinetotalfist.subtract(oriloanedamount)); // 头表字段:可预付金额
+                dynamicObject.set("billcanloanamount", hetongjinetotalfistBen.subtract(loanedamount)); // 头表字段:可预付金额(本位币)
+                // f)可报销金额=合同金额 - 已报销金额,可报销金额(本位币)=合同金额(本位币) - 已报销金额(本位币)
                 dynamicObject.set("oribalanceamount", hetongjinetotalfist.subtract(oriusedamount)); // 头表字段:可报销金额
                 dynamicObject.set("balanceamount", hetongjinetotalfist.subtract(usedamount)); // 头表字段:可报销金额(本位币)
+                // g)可用金额=合同金额 - 已付金额,可用金额(本位币)=合同金额(本位币) - 已付金额(本位币)
+                dynamicObject.set("oriavailableamount", hetongjinetotalfist.subtract(oripayedamount)); // 头表字段:可用金额
+                dynamicObject.set("availableamount", hetongjinetotalfistBen.subtract(payedamount)); // 头表字段:可用金额(本位币)
             }
 
             dynamicObject.set("expenseentryentity", plannewColl); // 付款计划分录