|
@@ -0,0 +1,409 @@
|
|
|
+package fi.em.formPlugin;
|
|
|
+
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
+import kd.bos.exception.KDBizException;
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
+import kd.bos.list.plugin.AbstractListPlugin;
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+
|
|
|
+public class TravelCollectionEntryAmtFromPlugin extends AbstractListPlugin implements Plugin {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs e) {
|
|
|
+ String operateKey = e.getOperateKey();
|
|
|
+ if ("deleteentryyufu".equals(e.getOperateKey())) {
|
|
|
+ DynamicObjectCollection nckdClearloanentry = this.getModel().getEntryEntity("nckd_clearloanentry");
|
|
|
+ if(nckdClearloanentry.isEmpty()){
|
|
|
+ String nckdAmountfield4 = this.getModel().getValue("approveamount").toString();
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(nckdAmountfield4);//总报销金额
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ String orireceiveamount = this.getModel().getValue("nckd_orireceiveamount", 0).toString();
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);//收款第一行
|
|
|
+ if(accountentry.size()==1){
|
|
|
+ bigDecimal=bigDecimal.subtract(bigDecimal1);
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",bigDecimal,0);
|
|
|
+ }else{
|
|
|
+ BigDecimal bigDecimal3 = new BigDecimal(0);
|
|
|
+ for(int i=0;i<accountentry.size();i++){
|
|
|
+ DynamicObject dynamicObjects = accountentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObjects.getBigDecimal("nckd_orireceiveamount");
|
|
|
+ if(i>0){
|
|
|
+ bigDecimal3=bigDecimal3.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal con1=bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
|
|
|
+ if(con1.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",con1,0);
|
|
|
+ }else {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String nckdAmountfield4 = this.getModel().getValue("approveamount").toString();
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(nckdAmountfield4);
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ DynamicObjectCollection nckdClearloanentrys = this.getModel().getEntryEntity("nckd_clearloanentry");
|
|
|
+ for(int i=0;i<nckdClearloanentrys.size();i++){
|
|
|
+ DynamicObject dynamicObject = nckdClearloanentrys.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObject.getBigDecimal("nckd_unexporiusedamount");
|
|
|
+ bigDecimal1=bigDecimal1.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ if(bigDecimal1.compareTo(bigDecimal) == 1){
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (bigDecimal1.compareTo(bigDecimal) == 0) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ String orireceiveamount = this.getModel().getValue("nckd_orireceiveamount", 0).toString();
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);
|
|
|
+ if(accountentry.size()==1){
|
|
|
+ bigDecimal=bigDecimal.subtract(bigDecimal1);
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",bigDecimal,0);
|
|
|
+ }else{
|
|
|
+ BigDecimal bigDecimal3 = new BigDecimal(0);
|
|
|
+ for(int i=0;i<accountentry.size();i++){
|
|
|
+ DynamicObject dynamicObjects = accountentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObjects.getBigDecimal("nckd_orireceiveamount");
|
|
|
+ if(i>0){
|
|
|
+ bigDecimal3=bigDecimal3.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal con1=bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
|
|
|
+ con1=con1.subtract(bigDecimal1);
|
|
|
+ if(con1.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",con1,0);
|
|
|
+ }else {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void propertyChanged(PropertyChangedArgs e) {
|
|
|
+ super.beforePropertyChanged(e);
|
|
|
+ String name = e.getProperty().getName();//获取字段标识
|
|
|
+ if ("tripstdshow".equals(name)) {
|
|
|
+ ChangeData[] changeSet = e.getChangeSet();//获取值
|
|
|
+ int rs =0;
|
|
|
+ for (ChangeData changeData : changeSet) {
|
|
|
+ rs++;
|
|
|
+ int rowIndex = changeData.getRowIndex();
|
|
|
+ Object newValue = changeData.getNewValue();
|
|
|
+ Object oldValue = changeData.getOldValue();
|
|
|
+ String nckdAmountfield4 = this.getModel().getValue("approveamount").toString();
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(nckdAmountfield4);
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ DynamicObjectCollection nckdClearloanentry = this.getModel().getEntryEntity("nckd_clearloanentry");
|
|
|
+ for(int i=0;i<nckdClearloanentry.size();i++){
|
|
|
+ DynamicObject dynamicObject = nckdClearloanentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObject.getBigDecimal("nckd_unexporiusedamount");
|
|
|
+ bigDecimal1=bigDecimal1.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ if(bigDecimal1.compareTo(bigDecimal) == 1){
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if(accountentry==null){
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (bigDecimal1.compareTo(bigDecimal) == 0) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if(accountentry==null){
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if(accountentry==null){
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if(dynamicObject!=null){
|
|
|
+ String orireceiveamount = this.getModel().getValue("nckd_orireceiveamount", 0).toString();
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);
|
|
|
+ if(accountentry.size()==1){
|
|
|
+ bigDecimal=bigDecimal.subtract(bigDecimal1);
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",bigDecimal,0);
|
|
|
+ }else{
|
|
|
+ BigDecimal bigDecimal3 = new BigDecimal(0);
|
|
|
+ for(int i=0;i<accountentry.size();i++){
|
|
|
+ DynamicObject dynamicObjects = accountentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObjects.getBigDecimal("nckd_orireceiveamount");
|
|
|
+ if(i>0){
|
|
|
+ bigDecimal3=bigDecimal3.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal con1=bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
|
|
|
+ con1=con1.subtract(bigDecimal1);
|
|
|
+ if(con1.compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",con1,0);
|
|
|
+ }else {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount",new BigDecimal(0),0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if ("nckd_unexporiusedamount".equals(name)) {
|
|
|
+ ChangeData[] changeSet = e.getChangeSet();//获取值
|
|
|
+ int rs =0;
|
|
|
+ for (ChangeData changeData : changeSet) {
|
|
|
+ rs++;
|
|
|
+ int rowIndex = changeData.getRowIndex();
|
|
|
+ Object newValue = changeData.getNewValue();
|
|
|
+ Object oldValue = changeData.getOldValue();
|
|
|
+ String nckdAmountfield4 = this.getModel().getValue("approveamount").toString();
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(nckdAmountfield4);
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ DynamicObjectCollection nckdClearloanentry = this.getModel().getEntryEntity("nckd_clearloanentry");
|
|
|
+ if (nckdClearloanentry.isEmpty()) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", bigDecimal, 0);
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < nckdClearloanentry.size(); i++) {
|
|
|
+ DynamicObject dynamicObject = nckdClearloanentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObject.getBigDecimal("nckd_unexporiusedamount");
|
|
|
+ bigDecimal1 = bigDecimal1.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ if (bigDecimal1.compareTo(bigDecimal) == 1) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (bigDecimal1.compareTo(bigDecimal) == 0) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ String orireceiveamount = this.getModel().getValue("nckd_orireceiveamount", 0).toString();
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);
|
|
|
+ if (accountentry.size() == 1) {
|
|
|
+ bigDecimal = bigDecimal.subtract(bigDecimal1);
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", bigDecimal, 0);
|
|
|
+ } else {
|
|
|
+ BigDecimal bigDecimal3 = new BigDecimal(0);
|
|
|
+ for (int i = 0; i < accountentry.size(); i++) {
|
|
|
+ DynamicObject dynamicObjects = accountentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObjects.getBigDecimal("nckd_orireceiveamount");
|
|
|
+ if (i > 0) {
|
|
|
+ bigDecimal3 = bigDecimal3.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal con1 = bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
|
|
|
+ con1 = con1.subtract(bigDecimal1);
|
|
|
+ if (con1.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", con1, 0);
|
|
|
+ } else {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if ("orireceiveamount".equals(name)) {
|
|
|
+ ChangeData[] changeSet = e.getChangeSet();//获取值
|
|
|
+ int rs = 0;
|
|
|
+ for (ChangeData changeData : changeSet) {
|
|
|
+ rs++;
|
|
|
+ int rowIndex = changeData.getRowIndex();
|
|
|
+ Object newValue = changeData.getNewValue();
|
|
|
+ Object oldValue = changeData.getOldValue();
|
|
|
+ String nckdAmountfield4 = this.getModel().getValue("approveamount").toString();
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(nckdAmountfield4);
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ DynamicObjectCollection nckdClearloanentry = this.getModel().getEntryEntity("nckd_clearloanentry");
|
|
|
+ if (nckdClearloanentry.isEmpty()) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", bigDecimal, 0);
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < nckdClearloanentry.size(); i++) {
|
|
|
+ DynamicObject dynamicObject = nckdClearloanentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObject.getBigDecimal("nckd_unexporiusedamount");
|
|
|
+ bigDecimal1 = bigDecimal1.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ if (bigDecimal1.compareTo(bigDecimal) == 1) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (bigDecimal1.compareTo(bigDecimal) == 0) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ String orireceiveamount = this.getModel().getValue("nckd_orireceiveamount", 0).toString();
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);
|
|
|
+ if (accountentry.size() == 1) {
|
|
|
+ bigDecimal = bigDecimal.subtract(bigDecimal1);
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", bigDecimal, 0);
|
|
|
+ } else {
|
|
|
+ BigDecimal bigDecimal3 = new BigDecimal(0);
|
|
|
+ for (int i = 0; i < accountentry.size(); i++) {
|
|
|
+ DynamicObject dynamicObjects = accountentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObjects.getBigDecimal("nckd_orireceiveamount");
|
|
|
+ if (i > 0) {
|
|
|
+ bigDecimal3 = bigDecimal3.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal con1 = bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
|
|
|
+ con1 = con1.subtract(bigDecimal1);
|
|
|
+ if (con1.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", con1, 0);
|
|
|
+ } else {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ("approveamount".equals(name)) {
|
|
|
+ ChangeData[] changeSet = e.getChangeSet();//获取值
|
|
|
+ int rs = 0;
|
|
|
+ for (ChangeData changeData : changeSet) {
|
|
|
+ rs++;
|
|
|
+ int rowIndex = changeData.getRowIndex();
|
|
|
+ Object newValue = changeData.getNewValue();
|
|
|
+ Object oldValue = changeData.getOldValue();
|
|
|
+ String nckdAmountfield4 = this.getModel().getValue("approveamount").toString();
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(nckdAmountfield4);
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(0);
|
|
|
+ DynamicObjectCollection nckdClearloanentry = this.getModel().getEntryEntity("nckd_clearloanentry");
|
|
|
+ if (nckdClearloanentry.isEmpty()) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", bigDecimal, 0);
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < nckdClearloanentry.size(); i++) {
|
|
|
+ DynamicObject dynamicObject = nckdClearloanentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObject.getBigDecimal("nckd_unexporiusedamount");
|
|
|
+ bigDecimal1 = bigDecimal1.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ if (bigDecimal1.compareTo(bigDecimal) == 1) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (bigDecimal1.compareTo(bigDecimal) == 0) {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
|
|
|
+ if (accountentry == null) {
|
|
|
+ throw new KDBizException("收款明细分录为空,请维护!");
|
|
|
+ }
|
|
|
+ DynamicObject dynamicObject = accountentry.get(0);
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ String orireceiveamount = this.getModel().getValue("nckd_orireceiveamount", 0).toString();
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);
|
|
|
+ if (accountentry.size() == 1) {
|
|
|
+ bigDecimal = bigDecimal.subtract(bigDecimal1);
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", bigDecimal, 0);
|
|
|
+ } else {
|
|
|
+ BigDecimal bigDecimal3 = new BigDecimal(0);
|
|
|
+ for (int i = 0; i < accountentry.size(); i++) {
|
|
|
+ DynamicObject dynamicObjects = accountentry.get(i);
|
|
|
+ BigDecimal nckdUnexporiusedamount = dynamicObjects.getBigDecimal("nckd_orireceiveamount");
|
|
|
+ if (i > 0) {
|
|
|
+ bigDecimal3 = bigDecimal3.add(nckdUnexporiusedamount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal con1 = bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
|
|
|
+ con1 = con1.subtract(bigDecimal1);
|
|
|
+ if (con1.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", con1, 0);
|
|
|
+ } else {
|
|
|
+ this.getModel().setValue("nckd_orireceiveamount", new BigDecimal(0), 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|