Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
70345f8131
|
|
@ -0,0 +1,79 @@
|
||||||
|
package shkd.sys.sys.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.bill.OperationStatus;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import shkd.sys.sys.plugin.report.InterestBearingRptListPlugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 债券成本摊销 → 单据界面插件
|
||||||
|
*/
|
||||||
|
public class ZqcbtxBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
private static final Log logger = LogFactory.getLog(ZqcbtxBillPlugin.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterBindData(EventObject e) {
|
||||||
|
super.afterBindData(e);
|
||||||
|
if (OperationStatus.ADDNEW == this.getView().getFormShowParameter().getStatus()) {
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
|
BigDecimal shkd_amountfield = dataEntity.getBigDecimal("shkd_amountfield");
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity");
|
||||||
|
assignmentEntryentity(dynamicObjectCollection, shkd_amountfield);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
|
super.afterDoOperation(afterDoOperationEventArgs);
|
||||||
|
if (afterDoOperationEventArgs.getOperateKey().equals("calculation")) {
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
|
BigDecimal shkd_amountfield = dataEntity.getBigDecimal("shkd_amountfield");
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity");
|
||||||
|
assignmentEntryentity(dynamicObjectCollection, shkd_amountfield);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String keyName = e.getProperty().getName();
|
||||||
|
if (("sharefrequency").equals(keyName) || ("e_adjustmentamount").equals(keyName)) {
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
|
BigDecimal shkd_amountfield = dataEntity.getBigDecimal("shkd_amountfield");
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entryentity");
|
||||||
|
assignmentEntryentity(dynamicObjectCollection, shkd_amountfield);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assignmentEntryentity(DynamicObjectCollection dynamicObjectCollection, BigDecimal shkd_amountfield) {
|
||||||
|
for (int i = 0; i < dynamicObjectCollection.size(); i++) {
|
||||||
|
DynamicObject dynamicObject = dynamicObjectCollection.get(i);
|
||||||
|
if (i == 0) {
|
||||||
|
this.getModel().setValue("shkd_amountfield1", shkd_amountfield, i);
|
||||||
|
} else {
|
||||||
|
DynamicObject dynamicObject1 = dynamicObjectCollection.get(i - 1);
|
||||||
|
this.getModel().setValue("shkd_amountfield1", dynamicObject1.getBigDecimal("shkd_amountfield2"), i);
|
||||||
|
}
|
||||||
|
BigDecimal shkd_amountfield1 = dynamicObject.getBigDecimal("shkd_amountfield1");// 期初摊余成本
|
||||||
|
BigDecimal e_accrualinterest = dynamicObject.getBigDecimal("e_accrualinterest");// 计提利息
|
||||||
|
BigDecimal e_payinterest = dynamicObject.getBigDecimal("e_payinterest");// 支付利息
|
||||||
|
BigDecimal e_actualamount = dynamicObject.getBigDecimal("e_actualamount");// 实际摊销
|
||||||
|
// 期初摊余成本+实际摊销
|
||||||
|
this.getModel().setValue("shkd_amountfield2", shkd_amountfield1.add(e_actualamount), i);
|
||||||
|
// 计提利息(调整后)
|
||||||
|
this.getModel().setValue("shkd_jtlx", dynamicObject.getBigDecimal("e_accrualinterest"), i);
|
||||||
|
// 支付利息(调整后)
|
||||||
|
this.getModel().setValue("shkd_zflx", dynamicObject.getBigDecimal("e_payinterest"), i);
|
||||||
|
}
|
||||||
|
this.getModel().setDataChanged(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package shkd.sys.sys.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 债券发行单据界面插件
|
||||||
|
*/
|
||||||
|
public class ZqfxBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
|
super.afterDoOperation(afterDoOperationEventArgs);
|
||||||
|
if (afterDoOperationEventArgs.getOperateKey().equals("audit")) {
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
|
String billno = dataEntity.getString("billno");
|
||||||
|
BigDecimal drawamount = dataEntity.getBigDecimal("drawamount");// 发行金额
|
||||||
|
BigDecimal feedetailamt = BigDecimal.ZERO;// 费用明细金额
|
||||||
|
boolean flag = false;
|
||||||
|
DynamicObject dynamicObject = dataEntity.getDynamicObject("org");
|
||||||
|
DynamicObject[] dynamicObjects = BusinessDataServiceHelper.load("cfm_feebill",
|
||||||
|
"id,billno,entry,entry.srcbillno,entry.feedetailamt", new QFilter("org", QCP.equals, dynamicObject.getPkValue()).toArray());
|
||||||
|
for (DynamicObject cfm_feebill : dynamicObjects) {
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = cfm_feebill.getDynamicObjectCollection("entry");
|
||||||
|
for (DynamicObject entry : dynamicObjectCollection) {
|
||||||
|
if (entry.getString("srcbillno").equals(billno)) {
|
||||||
|
feedetailamt = entry.getBigDecimal("feedetailamt");
|
||||||
|
flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataEntity.set("shkd_amountfield", drawamount.subtract(feedetailamt));
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
|
||||||
|
this.getView().invokeOperation("refresh");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue