| 
					
				 | 
			
			
				@@ -0,0 +1,91 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package fi.em.editPlugin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kingdee.bos.qing.publish.model.BillModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import fi.em.service.PayamountCalcExt; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+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.list.plugin.AbstractListPlugin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.daily.reimburse.AmountObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.mservice.ext.IErService4Ext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.sdk.plugin.Plugin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @author cjz 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @date 2024/8/13 18:00 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @description:计算收款金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class AmountEditPlugin extends AbstractListPlugin implements Plugin,IErService4Ext { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String nckd_unexporiusedamount="nckd_unexporiusedamount";//冲销金额标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String nckd_er_tripreimburse_ext="nckd_er_tripreimburse_ext";//差旅报销单标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String orientryamount="orientryamount";//报销金额字段标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static BigDecimal amount_all=new BigDecimal("0");//付现金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static BigDecimal orgamount_all=new BigDecimal("0");//冲销金额总合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void propertyChanged(PropertyChangedArgs e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.beforePropertyChanged(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String name = e.getProperty().getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(nckd_unexporiusedamount.equals(name)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject data=this.getModel().getDataEntity();//获取单据模型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObjectCollection tripentry = data.getDynamicObjectCollection("tripentry");//获取形成信息分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //付现金额触发 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (DynamicObject item:tripentry) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObjectCollection entryentity_cl=item.getDynamicObjectCollection("entryentity");//差旅明细分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int i=0;i< entryentity_cl.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //判断报销金额是否有值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (entryentity_cl.get(i).getBigDecimal("orientryamount").compareTo(BigDecimal.ZERO)>0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal amount=entryentity_cl.get(i).getBigDecimal("orientryamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getModel().setValue("orientryamount",0,i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getModel().setValue("orientryamount",amount,i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (nckd_unexporiusedamount.equals(name)||orientryamount.equals(name)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject data=this.getModel().getDataEntity();//获取单据模型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //冲销金额总数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal orgiexpebalanceamount_sum = new BigDecimal("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal amountfy=new BigDecimal("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //行程信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObjectCollection tripentry = data.getDynamicObjectCollection("tripentry");//获取形成信息分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (DynamicObject item:tripentry) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObjectCollection entryentity_cl=item.getDynamicObjectCollection("entryentity");//差旅明细分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (int i=0;i< entryentity_cl.size();i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //报销金额总和 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    amountfy=amountfy.add(entryentity_cl.get(i).getBigDecimal("orientryamount")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //amountfy报销金额总和 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObjectCollection nckd_clearloanentry = data.getDynamicObjectCollection("nckd_clearloanentry");//获取冲预付借款分录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (DynamicObject entryentity:nckd_clearloanentry) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //冲销金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal orgiexpebalanceamount=entryentity.getBigDecimal("nckd_unexporiusedamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //冲销金额累加计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                orgiexpebalanceamount_sum=orgiexpebalanceamount_sum.add(orgiexpebalanceamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //计算收款金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.getModel().setValue("orireceiveamount",amountfy.subtract(orgiexpebalanceamount_sum),0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |