|
@@ -2,6 +2,7 @@ package fi.em.formPlugin;
|
|
|
import com.aliyun.odps.security.User;
|
|
|
import kd.bos.exception.KDBizException;
|
|
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
+import kd.fi.er.mservice.ext.IErService4Ext;
|
|
|
import kd.sdk.plugin.Plugin;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -28,9 +29,9 @@ import java.util.*;
|
|
|
public class ReimbursementFormPlugin extends AbstractFormPlugin implements Plugin {
|
|
|
private final static String KEY_OK = "btnok";//确定按钮标识
|
|
|
private final static String KEY_CANCEL = "btncancel";//页面取消按钮标识
|
|
|
- private final static String KEY_SEARCH = "search";//动态表单查询按钮操作
|
|
|
private final static String FORMID_ENTRY = "nckd_entryentity";//动态表单单据体标识
|
|
|
private static String er_prepaybill = "er_prepaybill";//预付单标识
|
|
|
+ private static String nckd_er_prepaybill_ext="nckd_er_prepaybill_ext";//预付借款单标识
|
|
|
|
|
|
/**
|
|
|
* 页面点击事件
|
|
@@ -72,7 +73,7 @@ public class ReimbursementFormPlugin extends AbstractFormPlugin implements Plugi
|
|
|
}
|
|
|
this.getView().close();
|
|
|
} else if (StringUtils.equals(source.getKey(), KEY_CANCEL)) {
|
|
|
- //被点击控件为取消则设置返回值为空并关闭页面(在页面关闭回调方法中必须验证返回值不为空,否则会报空指针)
|
|
|
+ //被点击控件为取消则设置返回值为空并关闭页面(在页面关闭回调方yu法中必须验证返回值不为空,否则会报空指针)
|
|
|
this.getView().returnDataToParent(null);
|
|
|
this.getView().close();
|
|
|
} else {
|
|
@@ -108,57 +109,58 @@ public class ReimbursementFormPlugin extends AbstractFormPlugin implements Plugi
|
|
|
QFilter nckd_orgamountFilter = new QFilter("costdept.number", QCP.equals, costdeptNumber);
|
|
|
nckd_orgamountFilter.and("billstatus", QCP.equals, "E");
|
|
|
nckd_orgamountFilter.and("creator.number",QCP.equals,creatorNumber);
|
|
|
-
|
|
|
DynamicObject[] nckd_orgamountaccount = BusinessDataServiceHelper.
|
|
|
- load(er_prepaybill, "id,number", new QFilter[]{nckd_orgamountFilter});
|
|
|
+ load(er_prepaybill, "id", new QFilter[]{nckd_orgamountFilter});
|
|
|
|
|
|
for (int c=0;c<nckd_orgamountaccount.length;c++){
|
|
|
//当前循环动因基础资料单头
|
|
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(nckd_orgamountaccount[c].getPkValue(), nckd_orgamountaccount[c].getDynamicObjectType().getName());
|
|
|
-
|
|
|
+ //单据编号
|
|
|
String billno= dynamicObject.getString("billno");
|
|
|
//循环分录
|
|
|
for (DynamicObject entryentity : dynamicObject.getDynamicObjectCollection("expenseentryentity")) {
|
|
|
-
|
|
|
//获取费用承担部门
|
|
|
DynamicObject entrycostdept = entryentity.getDynamicObject("entrycostdept");
|
|
|
-
|
|
|
//获取费用项目
|
|
|
DynamicObject expenseitem=entryentity.getDynamicObject("expenseitem");
|
|
|
-
|
|
|
//申请金额
|
|
|
BigDecimal expenseamount=entryentity.getBigDecimal("expenseamount");
|
|
|
-
|
|
|
- //结算金额
|
|
|
- BigDecimal exporiusedamount=entryentity.getBigDecimal("exporiusedamount");
|
|
|
-
|
|
|
+ //结算金额(借款余额)
|
|
|
+ BigDecimal exporiusedamount=entryentity.getBigDecimal("nckd_settleamount_et");
|
|
|
//未结算金额
|
|
|
- BigDecimal orgiexpebalanceamount=entryentity.getBigDecimal("orgiexpebalanceamount");
|
|
|
-
|
|
|
+ BigDecimal orgiexpebalanceamount=entryentity.getBigDecimal("nckd_unsettleamount_et");
|
|
|
//备注
|
|
|
String remark=entryentity.getString("remark");
|
|
|
|
|
|
- //新增动态单据分录
|
|
|
- int rowIndex = this.getModel().createNewEntryRow(FORMID_ENTRY);
|
|
|
- //赋值给新增分录
|
|
|
- this.getModel().setValue("nckd_billno",billno,rowIndex);
|
|
|
- this.getModel().setValue("nckd_entrycostdept",entrycostdept,rowIndex);
|
|
|
- this.getModel().setValue("nckd_expenseitem",expenseitem,rowIndex);
|
|
|
- this.getModel().setValue("nckd_expenseamount",expenseamount,rowIndex);
|
|
|
- this.getModel().setValue("nckd_exporiusedamount",exporiusedamount,rowIndex);
|
|
|
- this.getModel().setValue("nckd_unexporiusedamount",orgiexpebalanceamount,rowIndex);
|
|
|
- this.getModel().setValue("nckd_remarke",remark,rowIndex);
|
|
|
- //将选中的数据放到缓存中
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
- //放入缓存
|
|
|
- obj.put("nckd_billno",billno);
|
|
|
- obj.put("nckd_entrycostdept",entrycostdept.getString("number"));
|
|
|
- obj.put("nckd_expenseitem",expenseitem.getString("number"));
|
|
|
- obj.put("nckd_expenseamount",expenseamount);
|
|
|
- obj.put("nckd_exporiusedamount",exporiusedamount);
|
|
|
- obj.put("nckd_unexporiusedamount",orgiexpebalanceamount);
|
|
|
- obj.put("nckd_remark",remark);
|
|
|
- resdate.add(obj);
|
|
|
+ Long id=entryentity.getLong("id");
|
|
|
+ //借款余额大于0
|
|
|
+// if (exporiusedamount.compareTo(BigDecimal.ZERO)>0)
|
|
|
+// {
|
|
|
+ //新增动态单据分录
|
|
|
+ int rowIndex = this.getModel().createNewEntryRow(FORMID_ENTRY);
|
|
|
+ //赋值给新增分录
|
|
|
+ this.getModel().setValue("nckd_bigintfield",id,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_billno",billno,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_entrycostdept",entrycostdept,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_expenseitem",expenseitem,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_expenseamount",expenseamount,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_exporiusedamount",exporiusedamount,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_unexporiusedamount",orgiexpebalanceamount,rowIndex);
|
|
|
+ this.getModel().setValue("nckd_remarke",remark,rowIndex);
|
|
|
+ //将选中的数据放到缓存中
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ //放入缓存
|
|
|
+ obj.put("nckd_billno",billno);
|
|
|
+ obj.put("nckd_entrycostdept",entrycostdept.getString("number"));
|
|
|
+ obj.put("nckd_expenseitem",expenseitem.getString("number"));
|
|
|
+ obj.put("nckd_expenseamount",expenseamount);
|
|
|
+ obj.put("nckd_exporiusedamount",exporiusedamount);
|
|
|
+ obj.put("nckd_unexporiusedamount",orgiexpebalanceamount);
|
|
|
+ obj.put("nckd_remark",remark);
|
|
|
+ obj.put("nckd_bigintfield",id);
|
|
|
+ resdate.add(obj);
|
|
|
+// }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
String pageId = this.getView().getPageId();
|
|
@@ -167,5 +169,4 @@ public class ReimbursementFormPlugin extends AbstractFormPlugin implements Plugi
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|