企业成本核算表单优化
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");//单据状态
|
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_assperiod", QCP.equals, period1.getPkValue()));//折旧期间
|
||||||
filter5.and(new QFilter("zcgj_entryentity.zcgj_zjuseorg", QCP.equals, org1.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",
|
"id,zcgj_entryentity.zcgj_shareamount",
|
||||||
new QFilter[]{filter5});//"设备详情"
|
new QFilter[]{filter5});//"设备详情"
|
||||||
if (eceq_equipinfo != null) {
|
if (eceq_equipinfoCollection.size() > 0) {
|
||||||
BigDecimal zcgj_shareamount = eceq_equipinfo.getBigDecimal("zcgj_entryentity.zcgj_shareamount");//设备详情的成本金额
|
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");
|
Object currentAmount = rptAssistBalanceGx.get("zcgj_debitlocal");
|
||||||
BigDecimal newAmount = new BigDecimal(currentAmount != null ? currentAmount.toString() : "0")
|
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) {
|
if (newAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
|
@ -309,20 +315,20 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
|
||||||
if (costType2 == null) return 1;
|
if (costType2 == null) return 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Double num1 = Double.parseDouble(costType1.toString().replace(".", ""));
|
Double num1 = Double.parseDouble(costType1.toString());
|
||||||
Double num2 = Double.parseDouble(costType2.toString().replace(".", ""));
|
Double num2 = Double.parseDouble(costType2.toString());
|
||||||
return num2.compareTo(num1);
|
return num1.compareTo(num2);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return costType2.toString().compareTo(costType1.toString());
|
return costType1.toString().compareTo(costType2.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 按排序后的顺序添加数据
|
// 按排序后的顺序添加数据
|
||||||
for (DynamicObject entry : sortedEntries) {
|
for (DynamicObject entry : sortedEntries) {
|
||||||
Object costtype = entry.get("costtype");
|
/* Object costtype = entry.get("costtype");
|
||||||
if (costtype == null) {
|
if (costtype == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
entryCollection.add(entry);
|
entryCollection.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue