二开系统插件-付款申请单审核与反审核操作插件:修改累计收票金额逻辑
This commit is contained in:
parent
769ddb5fc8
commit
327e0259ff
|
@ -18,6 +18,8 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
import kd.ec.contract.common.enums.SourceTypeEnum;
|
import kd.ec.contract.common.enums.SourceTypeEnum;
|
||||||
|
@ -25,8 +27,7 @@ import kd.ec.contract.common.utils.EcConstant;
|
||||||
import kd.ec.contract.common.utils.EcNumberHelper;
|
import kd.ec.contract.common.utils.EcNumberHelper;
|
||||||
import kd.ec.contract.opplugin.AbstractReverseWritingContractOp;
|
import kd.ec.contract.opplugin.AbstractReverseWritingContractOp;
|
||||||
|
|
||||||
|
//二开系统插件-付款申请单审核与反审核操作插件:修改累计收票金额逻辑
|
||||||
//二开系统付款申请单审核操作插件
|
|
||||||
public class PayApplyOpExt extends AbstractReverseWritingContractOp {
|
public class PayApplyOpExt extends AbstractReverseWritingContractOp {
|
||||||
private static String selector = (String)Stream.of("totalapplyoftaxamount", "totalapplyamount", "taxrate", "totalinvoiceamount", "totalinvoiceoftaxamount", "currency", "org").collect(Collectors.joining(","));
|
private static String selector = (String)Stream.of("totalapplyoftaxamount", "totalapplyamount", "taxrate", "totalinvoiceamount", "totalinvoiceoftaxamount", "currency", "org").collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
@ -128,6 +129,19 @@ public class PayApplyOpExt extends AbstractReverseWritingContractOp {
|
||||||
contractMap.put(contractId, contract);
|
contractMap.put(contractId, contract);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigDecimal totalInvoiceAmount = BigDecimal.ZERO;
|
||||||
|
QFilter[] contractFilter = new QFilter[]{new QFilter("zcgj_contract.id", QCP.equals, contractId).and("billstatus", QCP.equals, "C")}; // 合同筛选条件
|
||||||
|
DynamicObject[] financeConfirmObjs = BusinessDataServiceHelper.load("zcgj_ec_out_finaceconfirm", "id,billstatus,zcgj_entryentity,zcgj_entryentity.zcgj_invoiceamount", contractFilter); // 支出财务确认
|
||||||
|
for (int i = 0; i < financeConfirmObjs.length; i++) {
|
||||||
|
DynamicObject financeConfirmObj = financeConfirmObjs[i];
|
||||||
|
DynamicObjectCollection invoiceEntryList = financeConfirmObj.getDynamicObjectCollection("zcgj_entryentity"); // 支出财务确认-合同进项发票信息
|
||||||
|
for (int j = 0; j < invoiceEntryList.size(); j++) {
|
||||||
|
DynamicObject invoiceEntry = invoiceEntryList.get(j);
|
||||||
|
BigDecimal invoiceAmount = invoiceEntry.getBigDecimal("zcgj_invoiceamount"); // 发票金额
|
||||||
|
totalInvoiceAmount = totalInvoiceAmount.add(invoiceAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal totalApplyOfTaxAmount = contract.getBigDecimal("totalapplyoftaxamount");//支出合同-累计应付含税金额
|
BigDecimal totalApplyOfTaxAmount = contract.getBigDecimal("totalapplyoftaxamount");//支出合同-累计应付含税金额
|
||||||
BigDecimal totalApplyAmount = contract.getBigDecimal("totalapplyamount");//支出合同-累计应付金额
|
BigDecimal totalApplyAmount = contract.getBigDecimal("totalapplyamount");//支出合同-累计应付金额
|
||||||
DynamicObject taxRateObject = (DynamicObject)contract.get("taxrate");//支出合同-税率
|
DynamicObject taxRateObject = (DynamicObject)contract.get("taxrate");//支出合同-税率
|
||||||
|
@ -157,25 +171,25 @@ public class PayApplyOpExt extends AbstractReverseWritingContractOp {
|
||||||
BigDecimal invUnApplyAmt = invoice.getBigDecimal("unapplyamount");//进项发票登记-未申请含税金额
|
BigDecimal invUnApplyAmt = invoice.getBigDecimal("unapplyamount");//进项发票登记-未申请含税金额
|
||||||
BigDecimal invoiceUnApplyTax = invoice.getBigDecimal("unapplyinvtax");//进项发票登记-剩余税额
|
BigDecimal invoiceUnApplyTax = invoice.getBigDecimal("unapplyinvtax");//进项发票登记-剩余税额
|
||||||
if (operationKey.equals("audit")) {
|
if (operationKey.equals("audit")) {
|
||||||
invoice.set("unapplyamount", invUnApplyAmt.subtract(applyInvOftaxAmt));
|
invoice.set("unapplyamount", invUnApplyAmt.subtract(applyInvOftaxAmt));//进项发票登记-未申请含税金额
|
||||||
invoice.set("unapplyinvtax", invoiceUnApplyTax.subtract(applyInvoiceTax));
|
invoice.set("unapplyinvtax", invoiceUnApplyTax.subtract(applyInvoiceTax));//进项发票登记-剩余税额
|
||||||
} else if (StringUtils.equals(operationKey, "unaudit")) {
|
} else if (StringUtils.equals(operationKey, "unaudit")) {
|
||||||
invoice.set("unapplyamount", invUnApplyAmt.add(applyInvOftaxAmt));
|
invoice.set("unapplyamount", invUnApplyAmt.add(applyInvOftaxAmt));//进项发票登记-未申请含税金额
|
||||||
invoice.set("unapplyinvtax", invoiceUnApplyTax.add(applyInvoiceTax));
|
invoice.set("unapplyinvtax", invoiceUnApplyTax.add(applyInvoiceTax));//进项发票登记-剩余税额
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveServiceHelper.update((DynamicObject[])invoiceList.toArray(new DynamicObject[0]));
|
SaveServiceHelper.update((DynamicObject[])invoiceList.toArray(new DynamicObject[0]));//更新进项发票登记单
|
||||||
if (operationKey.equals("audit")) {
|
if (operationKey.equals("audit")) {
|
||||||
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.add(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.add(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
||||||
contract.set("totalapplyamount", totalApplyAmount.add(thisApplyAmount));//支出合同-累计应付金额
|
contract.set("totalapplyamount", totalApplyAmount.add(thisApplyAmount));//支出合同-累计应付金额
|
||||||
contract.set("totalinvoiceamount", totalinvoiceAmount.add(invoiceAmount));//支出合同-累计开票金额
|
contract.set("totalinvoiceamount", totalinvoiceAmount.add(invoiceAmount));//支出合同-累计开票金额
|
||||||
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.add(invoiceOfTaxAmont));//支出合同-累计开票价税合计
|
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.add(invoiceOfTaxAmont).add(totalInvoiceAmount));//支出合同-累计开票价税合计
|
||||||
} else if (StringUtils.equals(operationKey, "unaudit")) {
|
} else if (StringUtils.equals(operationKey, "unaudit")) {
|
||||||
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.subtract(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.subtract(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
||||||
contract.set("totalapplyamount", totalApplyAmount.subtract(thisApplyAmount));//支出合同-累计应付金额
|
contract.set("totalapplyamount", totalApplyAmount.subtract(thisApplyAmount));//支出合同-累计应付金额
|
||||||
contract.set("totalinvoiceamount", totalinvoiceAmount.subtract(invoiceAmount));//支出合同-累计开票金额
|
contract.set("totalinvoiceamount", totalinvoiceAmount.subtract(invoiceAmount));//支出合同-累计开票金额
|
||||||
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.subtract(invoiceOfTaxAmont));//支出合同-累计开票价税合计
|
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.subtract(invoiceOfTaxAmont).subtract(totalInvoiceAmount));//支出合同-累计开票价税合计
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue