企业成本核算表单优化
This commit is contained in:
parent
a96bfafcee
commit
c253c0e58b
|
|
@ -202,16 +202,22 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
|
|||
QFilter filter5 = new QFilter("billstatus", QCP.equals, "C");//单据状态
|
||||
filter5.and(new QFilter("zcgj_entryentity.zcgj_assperiod", QCP.equals, period1.getPkValue()));//折旧期间
|
||||
filter5.and(new QFilter("zcgj_entryentity.zcgj_zjuseorg", QCP.equals, org1.getPkValue()));//使用组织
|
||||
DynamicObject eceq_equipinfo = QueryServiceHelper.queryOne("eceq_equipinfo",
|
||||
DynamicObjectCollection eceq_equipinfoCollection = QueryServiceHelper.query("eceq_equipinfo",
|
||||
"id,zcgj_entryentity.zcgj_shareamount",
|
||||
new QFilter[]{filter5});//"设备详情"
|
||||
if (eceq_equipinfo != null) {
|
||||
BigDecimal zcgj_shareamount = eceq_equipinfo.getBigDecimal("zcgj_entryentity.zcgj_shareamount");//设备详情的成本金额
|
||||
if (eceq_equipinfoCollection.size() > 0) {
|
||||
BigDecimal zcgj_shareamounts = BigDecimal.ZERO;
|
||||
for (DynamicObject eceq_equipinfo : eceq_equipinfoCollection) {
|
||||
BigDecimal shareAmount = eceq_equipinfo.getBigDecimal("zcgj_entryentity.zcgj_shareamount");
|
||||
if (shareAmount != null) {
|
||||
zcgj_shareamounts = zcgj_shareamounts.add(shareAmount);
|
||||
}
|
||||
}
|
||||
|
||||
// 扣减成本金额
|
||||
Object currentAmount = rptAssistBalanceGx.get("zcgj_debitlocal");
|
||||
BigDecimal newAmount = new BigDecimal(currentAmount != null ? currentAmount.toString() : "0")
|
||||
.subtract(zcgj_shareamount != null ? zcgj_shareamount : BigDecimal.ZERO);
|
||||
.subtract(zcgj_shareamounts);
|
||||
|
||||
// 确保不会出现负数
|
||||
if (newAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
|
|
@ -309,20 +315,20 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
|
|||
if (costType2 == null) return 1;
|
||||
|
||||
try {
|
||||
Double num1 = Double.parseDouble(costType1.toString().replace(".", ""));
|
||||
Double num2 = Double.parseDouble(costType2.toString().replace(".", ""));
|
||||
return num2.compareTo(num1);
|
||||
Double num1 = Double.parseDouble(costType1.toString());
|
||||
Double num2 = Double.parseDouble(costType2.toString());
|
||||
return num1.compareTo(num2);
|
||||
} catch (NumberFormatException e) {
|
||||
return costType2.toString().compareTo(costType1.toString());
|
||||
return costType1.toString().compareTo(costType2.toString());
|
||||
}
|
||||
});
|
||||
|
||||
// 按排序后的顺序添加数据
|
||||
for (DynamicObject entry : sortedEntries) {
|
||||
Object costtype = entry.get("costtype");
|
||||
/* Object costtype = entry.get("costtype");
|
||||
if (costtype == null) {
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
entryCollection.add(entry);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue