|
@@ -1,10 +1,14 @@
|
|
package fi.er.formPlugin;
|
|
package fi.er.formPlugin;
|
|
|
|
|
|
|
|
+import com.alibaba.druid.util.StringUtils;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
import kd.bos.list.plugin.AbstractListPlugin;
|
|
import kd.bos.list.plugin.AbstractListPlugin;
|
|
import kd.sdk.plugin.Plugin;
|
|
import kd.sdk.plugin.Plugin;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+
|
|
public class PublicreimburFormPlugin extends AbstractListPlugin implements Plugin {
|
|
public class PublicreimburFormPlugin extends AbstractListPlugin implements Plugin {
|
|
private final static String KEY_Card = "newassetentry";//资产信息分录增行
|
|
private final static String KEY_Card = "newassetentry";//资产信息分录增行
|
|
@Override
|
|
@Override
|
|
@@ -16,6 +20,26 @@ public class PublicreimburFormPlugin extends AbstractListPlugin implements Plugi
|
|
//赋值给资产信息的核算组织
|
|
//赋值给资产信息的核算组织
|
|
this.getModel().setValue("nckd_orgfield1", assetorg);
|
|
this.getModel().setValue("nckd_orgfield1", assetorg);
|
|
this.getView().updateView("assetentry");
|
|
this.getView().updateView("assetentry");
|
|
|
|
+ } else if ("newshareruleentry".equals(e.getOperateKey())) {
|
|
|
|
+ String sharemethod = (String) this.getModel().getValue("sharemethod");
|
|
|
|
+ if (StringUtils.equals(sharemethod, "avg")) {
|
|
|
|
+ DynamicObjectCollection expenseentryentity_rules = this.getModel().getEntryEntity("expenseentryentity_rule");
|
|
|
|
+ BigDecimal reimburseamount = (BigDecimal) this.getModel().getValue("reimburseamount");
|
|
|
|
+ BigDecimal nckd_ft_amount = reimburseamount.divide(BigDecimal.valueOf(expenseentryentity_rules.size()));
|
|
|
|
+ for (int i = 0; i < expenseentryentity_rules.size(); i++) {
|
|
|
|
+ this.getModel().setValue("nckd_ft_amount", nckd_ft_amount, i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if ("deleteshareruleentry".equals(e.getOperateKey())) {
|
|
|
|
+ String sharemethod = (String) this.getModel().getValue("sharemethod");
|
|
|
|
+ DynamicObjectCollection expenseentryentity_rules = this.getModel().getEntryEntity("expenseentryentity_rule");
|
|
|
|
+ if (StringUtils.equals(sharemethod, "avg") && expenseentryentity_rules.size() > 0) {
|
|
|
|
+ BigDecimal reimburseamount = (BigDecimal) this.getModel().getValue("reimburseamount");
|
|
|
|
+ BigDecimal nckd_ft_amount = reimburseamount.divide(BigDecimal.valueOf(expenseentryentity_rules.size()));
|
|
|
|
+ for (int i = 0; i < expenseentryentity_rules.size(); i++) {
|
|
|
|
+ this.getModel().setValue("nckd_ft_amount", nckd_ft_amount, i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|