Browse Source

报销单过滤

xuhao 5 months ago
parent
commit
94a6dc44d1

+ 6 - 6
src/main/java/fi/em/formPlugin/BusinessProcessingConvertPlugIn.java

@@ -21,7 +21,7 @@ public class BusinessProcessingConvertPlugIn extends AbstractConvertPlugIn imple
             String bdsupplier = this.getOption().getVariableValue("bdsupplier");
             String billtype = this.getOption().getVariableValue("billtype");
             QFilter numberQFilter = new QFilter("ap_finapbill.org.number", QCP.equals, orgnumber);
-//            numberQFilter.and("ap_finapbill.asstacttype", QCP.equals, billtype);
+            numberQFilter.and("ap_finapbill.billstatus", QCP.equals, "C");
             numberQFilter.and("ap_finapbill.asstact.id", QCP.equals, Long.valueOf(bdsupplier));
             for(int i=0;i<objects.size();i++){
                 JSONObject jsonObject = objects.getJSONObject(i);
@@ -33,7 +33,7 @@ public class BusinessProcessingConvertPlugIn extends AbstractConvertPlugIn imple
             String bdsupplier = this.getOption().getVariableValue("bdsupplier");
             String billtype = this.getOption().getVariableValue("billtype");
             QFilter numberQFilter = new QFilter("ar_finarbill.org.number", QCP.equals, orgnumber);
-//            numberQFilter.and("ar_finarbill.asstacttype", QCP.equals, billtype);
+            numberQFilter.and("ar_finarbill.billstatus", QCP.equals, "C");
             numberQFilter.and("ar_finarbill.asstact.id", QCP.equals, Long.valueOf(bdsupplier));
             for(int i=0;i<objects.size();i++){
                 JSONObject jsonObject = objects.getJSONObject(i);
@@ -42,11 +42,9 @@ public class BusinessProcessingConvertPlugIn extends AbstractConvertPlugIn imple
             }
             e.getCustQFilters().add(numberQFilter);
         }else if("drawzlht".equals(type)){
-            //String bdsupplier = this.getOption().getVariableValue("bdsupplier");
-            String billtype = this.getOption().getVariableValue("billtype");
             QFilter numberQFilter = new QFilter("fa_lease_contract.org.number", QCP.equals, orgnumber);
-//            numberQFilter.and("fa_lease_contract.asstacttype", QCP.equals, billtype);
-            //numberQFilter.and("fa_lease_contract.leaser.number", QCP.equals, bdsupplier);
+            numberQFilter.and("fa_lease_contract.status", QCP.equals,"C");
+            numberQFilter.and("fa_lease_contract.nckd_combofield", QCP.equals,"2");
             for(int i=0;i<objects.size();i++){
                 JSONObject jsonObject = objects.getJSONObject(i);
                 String id = jsonObject.getString("id");
@@ -55,6 +53,7 @@ public class BusinessProcessingConvertPlugIn extends AbstractConvertPlugIn imple
             e.getCustQFilters().add(numberQFilter);
         }else if("draw-yf".equals(type)){
             QFilter numberQFilter = new QFilter("er_prepaybill.costdept.number", QCP.equals, orgnumber);
+            numberQFilter.and("er_prepaybill.billstatus", QCP.equals, "G");
             for(int i=0;i<objects.size();i++){
                 JSONObject jsonObject = objects.getJSONObject(i);
                 String id = jsonObject.getString("id");
@@ -65,6 +64,7 @@ public class BusinessProcessingConvertPlugIn extends AbstractConvertPlugIn imple
             String bdsupplier = this.getOption().getVariableValue("bdsupplier");
             QFilter numberQFilter = new QFilter("ar_finarbill.org.number", QCP.equals, orgnumber);
             numberQFilter.and("ar_finarbill.asstact.id", QCP.equals, Long.valueOf(bdsupplier));
+            numberQFilter.and("ar_finarbill.billstatus", QCP.equals, "C");
             for(int i=0;i<objects.size();i++){
                 JSONObject jsonObject = objects.getJSONObject(i);
                 String id = jsonObject.getString("id");

+ 24 - 2
src/main/java/fi/em/formPlugin/CostAllocationEditPlugin.java

@@ -146,7 +146,9 @@ public class CostAllocationEditPlugin extends AbstractListPlugin implements Plug
         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();
@@ -176,9 +178,29 @@ public class CostAllocationEditPlugin extends AbstractListPlugin implements Plug
                     DynamicObjectCollection accountentry = this.getModel().getEntryEntity("accountentry");
                     DynamicObject dynamicObject = accountentry.get(0);
                    if(dynamicObject!=null){
-                       bigDecimal=bigDecimal.subtract(bigDecimal1);
-                       this.getModel().setValue("orireceiveamount",bigDecimal,0);
+                       String orireceiveamount = this.getModel().getValue("orireceiveamount", 0).toString();
+                       BigDecimal bigDecimal2 = new BigDecimal(orireceiveamount);
+                       if(bigDecimal2.compareTo(bigDecimal1) == 1){
+                           if(accountentry.size()==1){
+                               bigDecimal=bigDecimal.subtract(bigDecimal1);
+                               this.getModel().setValue("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("orireceiveamount");
+                                   if(i>0){
+                                       bigDecimal3=bigDecimal3.add(nckdUnexporiusedamount);
+                                   }
+                               }
+                               BigDecimal con1=bigDecimal.subtract(bigDecimal3);//收款信息第一行的金额
+                               con1=con1.subtract(bigDecimal1);
+                               this.getModel().setValue("orireceiveamount",con1,0);
+                           }
 
+                       }else {
+                           this.getModel().setValue("orireceiveamount",new BigDecimal(0),0);
+                       }
                    }
                 }
             }