| 
					
				 | 
			
			
				@@ -0,0 +1,1099 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Source code recreated from a .class file by IntelliJ IDEA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// (powered by FernFlower decompiler) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package kd.fi.er.formplugin.web; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.LocalDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Collections; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.EventObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Iterator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Set; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.TreeMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.bill.OperationStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.entity.DynamicObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.entity.DynamicObjectCollection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.metadata.IDataEntityProperty; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.dataentity.resource.ResManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.MainEntityType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.datamodel.IDataModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.datamodel.events.ChangeData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.datamodel.events.PropertyChangedArgs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.entity.property.BasedataProp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.ConfirmCallBackListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.FormShowParameter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.IFormView; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.MessageBoxOptions; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.MessageBoxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.control.Control; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.events.MessageBoxClosedEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.field.BasedataEdit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.field.DateRangeEdit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.field.FieldEdit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.field.MulBasedataEdit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.form.plugin.AbstractFormPlugin; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.list.ListShowParameter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.logging.Log; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.logging.LogFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.orm.query.QFilter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.servicehelper.BusinessDataServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.bos.servicehelper.org.OrgUnitServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.bean.CostDeptF7ChangePram; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.invoicecloud.ItemFrom; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.servicehelper.BaseCurrencyServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.servicehelper.CommonServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.servicehelper.CoreBaseBillServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.servicehelper.ExpenseItemServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.tripstd.service.IErTripStdService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.tripstd.service.imp.ErTripStdServiceImp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.utils.AmountUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.utils.ErCommonUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.utils.ErCostCenterUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.utils.ErEntityTypeUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.utils.ErStdConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.business.utils.SystemParamterUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.common.ControlMethodEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.common.SettlementTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.formplugin.budget.BudgetCommonUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.BeforeCostCompanyF7SelectListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.BeforeCostDeptF7SelectListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.BeforeExpenseItemF7SelectListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.formplugin.daily.mobile.reimburse.listener.TripBeforeCostCenterF7SelectListener; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import kd.fi.er.formplugin.daily.web.workflow.ErMobWorkFlowOtherViewEditUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.ObjectUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class TripEntryEditEx extends AbstractFormPlugin { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final Log log = LogFactory.getLog(TripEntryEdit.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final String TRIP_ENTRY_ROW_INDEX = "tripEntryRowIndex"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final String BTN_OK = "btnok"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public TripEntryEditEx() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void registerListener(EventObject e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.registerListener(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.addClickListeners(new String[]{"btnok"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        MulBasedataEdit travelersF7 = (MulBasedataEdit)this.getControl("travelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getF7FilterInfo(travelersF7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BasedataEdit travelerF7 = (BasedataEdit)this.getControl("traveler"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getF7FilterInfo(travelerF7); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (this.getView().getParentView() != null && this.getView().getParentView().getModel() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IDataModel parentModel = this.getView().getParentView().getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String number = parentModel.getDataEntityType().getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ErEntityTypeUtils.isTripReqBill(number) && (Boolean)model.getValue("isloan")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                number = "er_loanbill"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BasedataEdit tripExpenseItemF7 = (BasedataEdit)this.getControl("tripexpenseitem"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tripExpenseItemF7.addBeforeF7SelectListener(new BeforeExpenseItemF7SelectListener(this.getView(), number, "entrycostdept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.costDeptF7Filter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.costCompanyF7Filter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.costCenterF7Filter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void costCenterF7Filter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TripBeforeCostCenterF7SelectListener beforeCostCenterF7SelectListener = new TripBeforeCostCenterF7SelectListener(this.getView()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BasedataEdit entryCostCenterF7 = (BasedataEdit)this.getControl("std_entrycostcenter"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (entryCostCenterF7 != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            entryCostCenterF7.addBeforeF7SelectListener(beforeCostCenterF7SelectListener); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected void costDeptF7Filter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BasedataEdit entrycostDeptF7 = (BasedataEdit)this.getControl("entrycostdept"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (entrycostDeptF7 != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BeforeCostDeptF7SelectListener beforeCostDeptF7SelectListener = new BeforeCostDeptF7SelectListener(this.getView()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            entrycostDeptF7.addBeforeF7SelectListener(beforeCostDeptF7SelectListener); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected void costCompanyF7Filter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BasedataEdit costCompanyF7 = (BasedataEdit)this.getControl("entrycostcompany"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Object costDept = this.getModel().getValue("entrycostdept"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Object company = this.getModel().getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (costCompanyF7 != null && costDept != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BeforeCostCompanyF7SelectListener beforeCostCompanyF7SelectListener = new BeforeCostCompanyF7SelectListener(ErCommonUtils.getPk(costDept), ErCommonUtils.getPk(company)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            costCompanyF7.addBeforeF7SelectListener(beforeCostCompanyF7SelectListener); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void getF7FilterInfo(BasedataEdit travelerF7) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        travelerF7.addBeforeF7SelectListener((listener) -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ListShowParameter list = (ListShowParameter)listener.getFormShowParameter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IFormView parentView = this.getView().getParentView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (parentView != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                IDataModel parentModel = parentView.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject org = (DynamicObject)parentModel.getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (org != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    boolean travelersrelationtripreq = SystemParamterUtil.getBoolParamResult(ErCommonUtils.getPk(org), "travelersrelationtripreq"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (travelersrelationtripreq) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Set<Object> longSet = new HashSet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        DynamicObjectCollection clearloanentry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (parentModel.getProperty("writeoffapply") != null && !parentModel.getEntryEntity("writeoffapply").isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            clearloanentry = parentModel.getEntryEntity("writeoffapply"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Iterator var9 = clearloanentry.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            label106: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            while(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                DynamicObjectCollection applytravelers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (!var9.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        break label106; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    DynamicObject itemx = (DynamicObject)var9.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    applytravelers = itemx.getDynamicObjectCollection("applytravelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } while(applytravelers == null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Iterator var12 = applytravelers.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                while(var12.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    DynamicObject apply = (DynamicObject)var12.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    longSet.add(ErCommonUtils.getPk(apply.getDynamicObject("fbasedataid"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (parentModel.getProperty("clearloanentry") != null && !parentModel.getEntryEntity("clearloanentry").isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            clearloanentry = parentModel.getEntryEntity("clearloanentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            HashSet<Long> applyIdSet = new HashSet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Iterator var25 = clearloanentry.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            while(var25.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                DynamicObject item = (DynamicObject)var25.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if ("er_tripreqbill".equals(item.getString("srcbilltype"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    applyIdSet.add(item.getLong("loanbillid")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            DynamicObject[] reqBills = BusinessDataServiceHelper.load("er_tripreqbill", "tripentry.travelers", new QFilter[]{new QFilter("id", "in", applyIdSet)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            DynamicObject[] var29 = reqBills; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            int var31 = reqBills.length; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            label83: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            for(int var32 = 0; var32 < var31; ++var32) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                DynamicObject reqBill = var29[var32]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                DynamicObjectCollection tripentry = reqBill.getDynamicObjectCollection("tripentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (null != tripentry) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    Iterator var16 = tripentry.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    while(true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        DynamicObjectCollection travelers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        do { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            if (!var16.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                continue label83; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            DynamicObject entry = (DynamicObject)var16.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            travelers = entry.getDynamicObjectCollection("travelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } while(null == travelers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        Iterator var19 = travelers.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        while(var19.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            DynamicObject traveler = (DynamicObject)var19.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            longSet.add(ErCommonUtils.getPk(traveler.getDynamicObject("fbasedataid"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        longSet.remove((Object)null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (!longSet.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            list.getListFilterParameter().setFilter(new QFilter("id", "in", longSet)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int multravelersrange = SystemParamterUtil.getMulTravelersRange(ErCommonUtils.getPk(org)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    List allOrgList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    switch (multravelersrange) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        case 0: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            DynamicObject dept = (DynamicObject)parentModel.getValue("org"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            list.getListFilterParameter().setFilter(QFilter.of("entryentity.dpt.masterid=?", new Object[]{dept.get("masterid")}).and(new QFilter("enable", "=", Boolean.TRUE))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        case 1: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            allOrgList = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, Collections.singletonList(ErCommonUtils.getPk(org)), true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            list.getListFilterParameter().setFilter((new QFilter("entryentity.dpt.masterid", "in", allOrgList)).and(new QFilter("enable", "=", Boolean.TRUE))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        case 2: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            long rootOrgId = OrgUnitServiceHelper.getRootOrgId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            allOrgList = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, Collections.singletonList(rootOrgId), true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            list.getListFilterParameter().setFilter((new QFilter("entryentity.dpt.masterid", "in", allOrgList)).and(new QFilter("enable", "=", Boolean.TRUE))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (multravelersrange == 0 || multravelersrange == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Long id = ErCommonUtils.getPk(parentModel.getValue("org")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (multravelersrange == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            id = ErCommonUtils.getPk(org); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        listener.getFormShowParameter().setCustomParam("initRootOrgId", id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        listener.getFormShowParameter().setCustomParam("initOrgId", id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    list.setCustomParam("isIncludeAllSub", true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void afterCreateNewData(EventObject e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.afterCreateNewData(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IFormView parentView = this.getView().getParentView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (parentView != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IDataModel parentModel = parentView.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("formid", parentModel.getValue("formid")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("iscurrency", parentModel.getValue("iscurrency")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("currency", ErCommonUtils.getPk(parentModel.getValue("currency"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("isloan", parentModel.getValue("isloan")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("company", parentModel.getValue("company")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("org", parentModel.getValue("org")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("bizdate", parentModel.getValue("bizdate")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("costorgusemode", parentModel.getValue("costorgusemode")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("tripentrystatus", "A"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject applierOb = (DynamicObject)parentModel.getValue("applier"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String formId = (String)model.getValue("formid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (applierOb != null && (ErEntityTypeUtils.isTripReqBill(parentView.getEntityId()) || ErEntityTypeUtils.isTripReimburseBill(parentView.getEntityId()))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MulBasedataEdit travelersF7 = (MulBasedataEdit)this.getControl("travelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                travelersF7.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.setRowIndexPageCache(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject company = (DynamicObject)model.getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String costMode = ErCommonUtils.getCostOrgUseMode(company == null ? 0L : (Long)company.getPkValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!"0".equals(costMode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BasedataEdit entryCostCenter = (BasedataEdit)this.getControl("std_entrycostcenter"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                entryCostCenter.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int tripEntryRowIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tripEntryRowIndex != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject tripEntry = parentModel.getEntryRowEntity("tripentry", tripEntryRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DataEntityPropertyCollection tripEntryProps = tripEntry.getDataEntityType().getProperties(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DataEntityPropertyCollection properties = model.getDataEntityType().getProperties(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Iterator var13 = properties.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while(var13.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    IDataEntityProperty property = (IDataEntityProperty)var13.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String propertyName = property.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (tripEntryProps.get(propertyName) != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        model.setValue(propertyName, ErCommonUtils.getObjectValue(tripEntry.get(propertyName))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ErEntityTypeUtils.isTripReimburseBill(formId) && tripEntry.get("tripentryarea") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("triparea", ErCommonUtils.getPk(tripEntry.get("tripentryarea"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("entrycostdept", ErCommonUtils.getPk(parentModel.getValue("costdept"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String centerKey = "std_entrycostcenter"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!"0".equals(costMode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ErCostCenterUtil.initEntryCostCenter(this.getModel(), "tripentry", model.getEntryCurrentRowIndex("std_entrycostcenter"), -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject costCenter = (DynamicObject)parentModel.getValue("std_costcenter"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (model.getProperty(centerKey) == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        centerKey = "entrycostcenter"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (costCenter != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        model.setValue(centerKey, costCenter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("entrycostcompany", ErCommonUtils.getPk(parentModel.getValue("costcompany"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!"0".equals(costMode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (model.getProperty(centerKey) == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        centerKey = "entrycostcenter"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (ErCostCenterUtil.costCenterHasCostCompany(model.getValue(centerKey), parentModel.getValue("costcompany"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        model.setValue(centerKey, (Object)null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripcurrency", ErCommonUtils.getPk(parentModel.getValue("currency"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObjectCollection parentTripEntry = parentModel.getEntryEntity("tripentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (parentTripEntry != null && parentTripEntry.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject tripEntry = (DynamicObject)parentTripEntry.get(parentTripEntry.size() - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject toPlace = tripEntry.getDynamicObject("to"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("from", ErCommonUtils.getPk(toPlace)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("startdate", tripEntry.getDate("enddate")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("triphappendate", tripEntry.getDate("enddate")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripexchangerate", BigDecimal.ONE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObjectCollection travelers = (DynamicObjectCollection)model.getValue("travelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (travelers != null && applierOb != null && travelers.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Long pkid = (Long)applierOb.getPkValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Long[] applierIds = new Long[]{pkid}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("travelers", applierIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FormShowParameter formShowParameter = this.getView().getFormShowParameter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Object istravelers = formShowParameter.getCustomParam("istravelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("istravelers", istravelers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (model.getValue("company") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object pkValue = ((DynamicObject)model.getValue("company")).getPkValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                boolean isControl = SystemParamterUtil.isEnableTripStandard(Long.parseLong(pkValue.toString())) && SystemParamterUtil.getTripStandardControlLevel(Long.parseLong(pkValue.toString())) != ControlMethodEnum.NO_CONTROL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("istripcontrol", isControl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (company != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int showType = ErCommonUtils.getExpenseAssumeShowTypes((Long)company.getPkValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("expensesassumeshowtypes", String.valueOf(showType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (showType == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    FieldEdit costDept = (FieldEdit)this.getControl("entrycostdept"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    costDept.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    FieldEdit costCompany = (FieldEdit)this.getControl("entrycostcompany"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    costCompany.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.showExchangeRate(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Boolean isMonth = (Boolean)formShowParameter.getCustomParam("isMonth"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (isMonth != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("ismonth", isMonth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Object ismulwayto = formShowParameter.getCustomParam("ismulwayto"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("ismulwayto", ismulwayto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CommonServiceHelper.setMulWayToVisible(parentModel, this.getView()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            boolean iscurrencyshowintripentry = SystemParamterUtil.getIsCurrencyShowinTripentry(ErCommonUtils.getPk(company)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            model.setValue("iscurrencyshowintripentry", iscurrencyshowintripentry); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.setBudgetInfoByDefaultValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setBudgetInfoByDefaultValue() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FormShowParameter formShowParameter = this.getView().getFormShowParameter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OperationStatus status = formShowParameter.getStatus(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean isQueryBudget = (Boolean)formShowParameter.getCustomParam("isquerybudget"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Object expenseItemObj = this.getModel().getValue("tripexpenseitem"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (expenseItemObj != null && status.equals(OperationStatus.ADDNEW) && isQueryBudget) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void afterBindData(EventObject e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.afterBindData(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.setControlVisible(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IFormView parentView = this.getView().getParentView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long companyId = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (parentView != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            companyId = ErCommonUtils.getPk(parentView.getModel().getValue("company")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!SystemParamterUtil.getTripexpenseitemMustInput(companyId) && !this.isShowExpenseItem()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.getView().setVisible(false, new String[]{"tripexpenseitem"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FieldEdit editor = (FieldEdit)this.getView().getControl("tripexpenseitem"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           // editor.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.getView().setVisible(true, new String[]{"tripexpenseitem"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String formId = (String)model.getValue("formid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean istripcontrol = (Boolean)model.getValue("istripcontrol"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ErEntityTypeUtils.isTripReimburseBill(formId) && istripcontrol) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FieldEdit editor = (FieldEdit)this.getView().getControl("triparea"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            editor.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FieldEdit tripexchangerateEditor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ErEntityTypeUtils.isTripReqBill(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Object type = model.getValue("triporiamouctrltype"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String tripamountctrltype = type == null ? "" : type.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ("1".equals(tripamountctrltype) || "3".equals(tripamountctrltype)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripexchangerateEditor = (FieldEdit)this.getView().getControl("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripexchangerateEditor.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean iscurrency = (Boolean)model.getValue("iscurrency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (iscurrency) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            FieldEdit editor = (FieldEdit)this.getView().getControl("tripcurrency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            editor.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tripexchangerateEditor = (FieldEdit)this.getView().getControl("tripexchangerate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tripexchangerateEditor.setMustInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.setRowIndexPageCache(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int tripIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tripIndex >= 0 && this.getView().getParentView() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IDataModel pModel = this.getView().getParentView().getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject trip = pModel.getEntryRowEntity("tripentry", tripIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ErEntityTypeUtils.isTripReimburseBill(formId) && trip != null && trip.getDynamicObjectCollection("entryentity").stream().anyMatch((v) -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return "2".equals(v.getString("settlementtype")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            })) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getView().setEnable(false, new String[]{"tripcurrency"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FormShowParameter formShowParameter = this.getView().getFormShowParameter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> customParams = formShowParameter.getCustomParams(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (customParams.containsKey("tripEntryRowIndex")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int tripEntryRowIndex = (Integer)customParams.get("tripEntryRowIndex"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            boolean isEnable = (Boolean)customParams.get("isEnable"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, IDataEntityProperty> allFields = this.getModel().getDataEntityType().getAllFields(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String entityId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tripEntryRowIndex != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Iterator var14 = allFields.keySet().iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while(var14.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    entityId = (String)var14.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setEnable(isEnable, new String[]{entityId}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getView().setEnable(isEnable, new String[]{"tirpdate"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getView().setVisible(isEnable, new String[]{"btnok", "btncancel"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IFormView view = this.getView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (parentView != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                entityId = parentView.getEntityId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Boolean isloan = (Boolean)parentView.getModel().getValue("isloan", tripEntryRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ("er_tripreqbill_ssc".equals(entityId) && isloan) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    view.setEnable(Boolean.FALSE, new String[]{"from", "to", "mulwayto", "tirpdate", "vehicle", "vehicles", "entrycostcompany", "triporiamount", "entrycostdept", "std_project"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!"er_tripreqbill_ssc".equals(entityId) && (this.readOnly() || this.multiVehicles())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    view.setVisible(Boolean.TRUE, new String[]{"vehicles"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    view.setVisible(Boolean.FALSE, new String[]{"vehicle"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    view.setVisible(Boolean.FALSE, new String[]{"vehicles"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    view.setVisible(Boolean.TRUE, new String[]{"vehicle"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ErEntityTypeUtils.isTripReimburseBill(entityId) && tripEntryRowIndex != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    boolean enable = !((DynamicObject)parentView.getModel().getDataEntity(true).getDynamicObjectCollection("tripentry").get(tripEntryRowIndex)).getDynamicObjectCollection("entryentity").stream().anyMatch((v) -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return StringUtils.equals(ItemFrom.InvoiceCloud.getValue(), v.getString("itemfrom")) && StringUtils.isNotBlank(v.getString("invoiceno_entry")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setEnable(enable, new String[]{"tripcurrency"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ErMobWorkFlowOtherViewEditUtils.setWorkFlowEditView(this.getView(), customParams, model, 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.setTripDateControl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected boolean readOnly() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IFormView parentView = this.getView().getParentView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return parentView != null && !"A".equals(parentView.getModel().getValue("billstatus")) && !"D".equals(parentView.getModel().getValue("billstatus")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected boolean multiVehicles() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return !this.getVihicleFromStdConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private boolean getVihicleFromStdConfig() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return StringUtils.equals(ErStdConfig.get("notMultiVehicles"), "true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setRowIndexPageCache() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FormShowParameter formShowParameter = this.getView().getFormShowParameter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> customParams = formShowParameter.getCustomParams(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String tripRowIndex = "-1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (customParams.get("tripEntryRowIndex") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tripRowIndex = customParams.get("tripEntryRowIndex").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getPageCache().put("tripEntryRowIndex", tripRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setControlVisible() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FormShowParameter formShowParameter = this.getView().getFormShowParameter(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> customParams = formShowParameter.getCustomParams(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null != this.getView().getParentView() && null != this.getView().getParentView().getModel() && null != this.getView().getParentView().getModel().getProperty("formid") && null != this.getView().getParentView().getModel().getValue("company")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Long companyId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject company = (DynamicObject)this.getView().getParentView().getModel().getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (company != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                companyId = (Long)company.getPkValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (companyId != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String formId = (String)this.getView().getParentView().getModel().getValue("formid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (customParams.get("isSsc") != null && "er_tripreqbill".equalsIgnoreCase(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setVisible(true, new String[]{"triporiaccappamount"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.setControlEnable(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (customParams.get("isSsc") != null && "er_tripreimbursebill".equalsIgnoreCase(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setVisible(false, new String[]{"triporiaccappamount"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.setControlEnable(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    boolean isEnable = (Boolean)customParams.get("isEnable"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setVisible(!isEnable, new String[]{"triporiaccappamount"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.setControlEnable(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Boolean isQueryBudget = (Boolean)customParams.get("isquerybudget"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String budgeMsgValue = (String)ErCommonUtils.getEMParameter(companyId, "budgeMsgControl"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BudgetCommonUtil.setIsQueryBudgetFlag(this.getPageCache(), isQueryBudget); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ((isQueryBudget == null || !isQueryBudget) && !BudgetCommonUtil.getIsQueryEASBudgetFlag(this.getPageCache())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setVisible(false, new String[]{"budgetamount"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().setVisible(false, new String[]{"budgetmsg"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BudgetCommonUtil.setBudgeInfoVisible(budgeMsgValue, this.getView()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setControlEnable(Boolean isSsc) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"from"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"to"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"tirpdate"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"vehicle"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"tripcurrency"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"tripexchangerate"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(isSsc, new String[]{"triporiamount"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Boolean isShowExpenseItem() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String formId = (String)model.getValue("formid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean isLoan = (Boolean)model.getValue("isloan"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean istravelers = (Boolean)model.getValue("istravelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return (!ErEntityTypeUtils.isTripReqBill(formId) || !isLoan) && (!ErEntityTypeUtils.isTripReqBill(formId) || isLoan || !istravelers) && !BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()) && !BudgetCommonUtil.getIsQueryEASBudgetFlag(this.getPageCache()) && !BudgetCommonUtil.getIsTripReqShowExpenseitemFlag(this.getPageCache()) && !ErEntityTypeUtils.isTripReimburseBill(formId) ? false : true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void click(EventObject evt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.click(evt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        switch (((Control)evt.getSource()).getKey()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "btnok": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                IFormView parentView = this.getView().getParentView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                IDataModel parentModel = parentView.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String formId = (String)parentModel.getValue("formid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ErEntityTypeUtils.isTripReqBill(formId) && this.amountIsZero()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    boolean isloan = (Boolean)model.getValue("isloan"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Object type = model.getValue("triporiamouctrltype"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String tripamountctrltype = type == null ? "" : type.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (isloan && ("2".equals(tripamountctrltype) || "3".equals(tripamountctrltype))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getView().showTipNotification(ResManager.loadKDString("行程金额必须大于0。", "TripEntryEdit_0", "fi-er-formplugin", new Object[0])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ErEntityTypeUtils.isTripReqBill(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal triporiaccappamount = (BigDecimal)model.getValue("triporiaccappamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal tripOriAmount = (BigDecimal)model.getValue("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (triporiaccappamount.compareTo(tripOriAmount) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getView().showErrorNotification(ResManager.loadKDString("核定金额不允许超过借款金额。", "TripEntryEdit_1", "fi-er-formplugin", new Object[0])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String billName = parentModel.getDataEntity().getDataEntityType().getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                boolean isTripReimburse = ErEntityTypeUtils.isTripReimburseBill(billName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                boolean tripdatecontrol = SystemParamterUtil.isOpenTripDateControl(ErCommonUtils.getPk(parentModel.getValue("company"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!(Boolean)parentModel.getValue("istravelers") && !isTripReimburse || !(Boolean)parentModel.getValue("istravelers") && isTripReimburse && tripdatecontrol) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String error = this.validateTripDate(parentModel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (StringUtils.isNotBlank(error)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getView().showErrorNotification(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object from = model.getValue("from"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object to = model.getValue("to"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String cityMS = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (from.equals(to)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    cityMS = ResManager.loadKDString("出发地与目的地相同,确认继续?", "TripEntryEdit_2", "fi-er-formplugin", new Object[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String currencyMs = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int tripEntryRowIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tripEntryRowIndex == 0 || parentModel.getEntryRowCount("tripentry") == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Object costCompany = model.getValue("entrycostcompany"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Object company = parentModel.getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Long newCurrency = BaseCurrencyServiceHelper.getBaseCurrencyId(company, costCompany); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Long oldCurrency = ErCommonUtils.getPk(parentModel.getValue("currency")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (newCurrency == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getView().showErrorNotification(ResManager.loadKDString("未设置本位币,请联系管理员设置本位币。", "TripEntryEdit_7", "fi-er-formplugin", new Object[0])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!newCurrency.equals(oldCurrency)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currencyMs = ResManager.loadKDString("切换费用承担公司导致本位币变化,将清空填写分录信息,是否继续?", "TripEntryEdit_3", "fi-er-formplugin", new Object[0]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (StringUtils.isNotBlank(cityMS) || StringUtils.isNotBlank(currencyMs)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String callBackId = "samecity"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (StringUtils.isNotBlank(currencyMs)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        callBackId = "changecurrency"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().showConfirm(cityMS + "\r\n" + currencyMs, MessageBoxOptions.OKCancel, new ConfirmCallBackListener(callBackId, this)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.clickOk(model, parentView, parentModel, formId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private boolean amountIsZero() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal triporiamount = (BigDecimal)this.getModel().getValue("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal tripAmount = (BigDecimal)this.getModel().getValue("tripamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return tripAmount.compareTo(BigDecimal.ZERO) <= 0 || triporiamount.compareTo(BigDecimal.ZERO) <= 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected String validateTripDate(IDataModel parentModel) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObjectCollection parentTripEntry = parentModel.getEntryEntity("tripentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int parentSize = parentTripEntry.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Integer, Object> sortMap = new TreeMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (parentSize > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            parentTripEntry.forEach((entity) -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!sortMap.containsKey(entity.getInt("seq"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sortMap.put(entity.getInt("seq") - 1, entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date startDate = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date endDate = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject curTripEntry = this.getModel().getDataEntity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int index = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (index == -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            index = parentSize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject lastTripEntry = (DynamicObject)sortMap.get(index - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (lastTripEntry != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            startDate = curTripEntry.getDate("startdate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            endDate = lastTripEntry.getDate("enddate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (startDate != null && endDate != null && startDate.before(endDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return String.format(ResManager.loadKDString("第%1$s程行程期间不能早于第%2$s程行程期间。", "TripEntryEdit_9", "fi-er-formplugin", new Object[0]), index + 1, index); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject nextTripEntry = (DynamicObject)sortMap.get(index + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (nextTripEntry != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            endDate = curTripEntry.getDate("enddate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            startDate = nextTripEntry.getDate("startdate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (startDate != null && endDate != null && startDate.before(endDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return String.format(ResManager.loadKDString("第%1$s程行程期间不能晚于第%2$s程行程期间。", "TripEntryEdit_10", "fi-er-formplugin", new Object[0]), index + 1, index + 2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.confirmCallBack(messageBoxClosedEvent); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String callBackId = messageBoxClosedEvent.getCallBackId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IFormView parentView = this.getView().getParentView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel parentModel = parentView.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String formId = (String)parentModel.getValue("formid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.clickOk(this.getModel(), parentView, parentModel, formId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected void clickOk(IDataModel model, IFormView parentView, IDataModel parentModel, String formId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setEnable(false, new String[]{"btnok"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DataEntityPropertyCollection tripEntryProps = parentModel.getDataEntity(true).getDynamicObjectCollection("tripentry").getDynamicObjectType().getProperties(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int tripEntryRowIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DataEntityPropertyCollection properties = model.getDataEntityType().getProperties(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Object> returnParam = new HashMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObjectCollection tripEntry = parentModel.getDataEntity().getDynamicObjectCollection("tripentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long oldCurrncy = ErCommonUtils.getPk(parentModel.getValue("currency")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataEntityProperty tripamount = (IDataEntityProperty)properties.get("tripamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataEntityProperty triporiamount = (IDataEntityProperty)properties.get("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataEntityProperty property; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tripamount != null && triporiamount != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IDataEntityProperty first = (IDataEntityProperty)properties.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            property = (IDataEntityProperty)properties.get(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            i = properties.indexOf(tripamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int triporiamountIndex = properties.indexOf(triporiamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            properties.set(0, tripamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            properties.set(1, triporiamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            properties.set(i, first); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            properties.set(triporiamountIndex, property); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int entrySize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int rowIndex; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tripEntryRowIndex == -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (StringUtils.isNotEmpty(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                entrySize = ErCommonUtils.getExpenseAssumeShowTypes(ErCommonUtils.getPk(parentModel.getValue("company"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (entrySize != 1 && parentModel.getDataEntity(true).getDynamicObjectCollection("tripentry").isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.beginInit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue("costdept", model.getValue("entrycostdept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.endInit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue("costcompany", model.getValue("entrycostcompany")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().getParentView().updateView("costdept"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (oldCurrncy != ErCommonUtils.getPk(parentModel.getValue("currency"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        parentView.updateView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getView().sendFormAction(parentView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        this.getView().close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!(Boolean)parentModel.getValue("iscurrency")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        model.setValue("tripcurrency", parentModel.getValue("currency")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rowIndex = parentModel.createNewEntryRow("tripentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.setEntryCurrentRowIndex("tripentry", rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Iterator var23 = properties.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                while(var23.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     property = (IDataEntityProperty)var23.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (tripEntry.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String propertyName = property.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (tripEntryProps.get(propertyName) != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if ("vehicles".equalsIgnoreCase(propertyName) && ErEntityTypeUtils.isTripReimburseBill(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                String vehicles = (String)model.getValue(propertyName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                CoreBaseBillServiceHelper.mulTripVehicle(parentModel, vehicles, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if ("tripexchangerate".equals(propertyName) && properties.containsKey("tripcurrency")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                parentModel.setValue("tripcurrency", ErCommonUtils.getObjectValue(model.getValue("tripcurrency")), rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            parentModel.setValue(propertyName, ErCommonUtils.getObjectValue(model.getValue(propertyName)), rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tripEntry.size() > 0 && ErEntityTypeUtils.isTripReimburseBill(formId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    CoreBaseBillServiceHelper.addDefaultTripExpenseEntry(parentModel, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.setExpenseEntryValue(parentModel, model, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                returnParam.put("currentTripEntryIndex", rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            returnParam.put("isUpdate", false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (parentModel.getEntryEntity("tripentry").size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tripEntryRowIndex == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.beginInit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.setValue("costdept", model.getValue("entrycostdept")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.endInit(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object std_entrycostcenter = model.getValue("std_entrycostcenter"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (std_entrycostcenter != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue("std_costcenter", std_entrycostcenter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.setValue("costcompany", model.getValue("entrycostcompany")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getView().getParentView().updateView("costdept"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (oldCurrncy != ErCommonUtils.getPk(parentModel.getValue("currency"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentView.updateView(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().sendFormAction(parentView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getView().close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Iterator var21 = properties.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while(var21.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                property = (IDataEntityProperty)var21.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String propertyName = property.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (parentModel.getEntryEntity("tripentry").size() > 0 && tripEntryProps.get(propertyName) != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if ("tripexchangerate".equals(propertyName) && properties.containsKey("tripcurrency")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        parentModel.setValue("tripcurrency", ErCommonUtils.getObjectValue(model.getValue("tripcurrency")), tripEntryRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue(propertyName, ErCommonUtils.getObjectValue(model.getValue(propertyName)), tripEntryRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ErEntityTypeUtils.isTripReimburseBill(formId) && parentModel.getEntryEntity("tripentry").size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.setExpenseEntryValue(parentModel, model, tripEntryRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (parentModel.getEntryEntity("tripentry").size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                entrySize = parentModel.getEntryRowCount("entryentity"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                rowIndex = (Integer)parentModel.getValue("tripday", tripEntryRowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for(i = 0; i < entrySize; ++i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue("daycount", rowIndex, i, parentModel.getEntryCurrentRowIndex("tripentry")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                returnParam.put("isUpdate", true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                returnParam.put("currentTripEntryIndex", parentModel.getEntryCurrentRowIndex("tripentry")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        returnParam.put("isOK", true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        returnParam.put("startDate", model.getValue("startDate")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        returnParam.put("endDate", model.getValue("endDate")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().returnDataToParent(returnParam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().sendFormAction(parentView); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setExpenseEntryValue(IDataModel parentModel, IDataModel dataModel, int rowIndex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject tripEntry = parentModel.getEntryRowEntity("tripentry", rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int tripDay = tripEntry.getInt("tripday"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObjectCollection tripTravlers = tripEntry.getDynamicObjectCollection("travelers"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        parentModel.setValue("tripentryarea", ErCommonUtils.getPk(dataModel.getValue("triparea")), rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObjectCollection expenseEntry = tripEntry.getDynamicObjectCollection("entryentity"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (expenseEntry != null && !expenseEntry.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(int i = 0; i < expenseEntry.size(); ++i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.setValue("triparea", ErCommonUtils.getPk(dataModel.getValue("tripArea")), i, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parentModel.setValue("daycount", tripDay, i, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!SettlementTypeEnum.MONTH_SETTLEMENT.getCode().equals(parentModel.getValue("settlementtype", i, rowIndex))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue("trip2travelers", tripTravlers, i, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    parentModel.setValue("trip2travelerscount", tripTravlers == null ? 0 : tripTravlers.size(), i, rowIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void propertyChanged(PropertyChangedArgs e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        super.propertyChanged(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ChangeData[] valueSet = e.getChangeSet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Object propValue = valueSet[0].getNewValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String propName = e.getProperty().getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String quoteType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal tripOriAmount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal exchangeRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int currencyPrecision; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal tripAmount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal triporiaccappamount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal tripaccappamount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date startDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Date endDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long tripDays; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        switch (propName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "tripcurrency": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (propValue == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("tripcurrency", ErCommonUtils.getPk(valueSet[0].getOldValue())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.showExchangeRate(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal tripEntryAmount = (BigDecimal)this.getModel().getValue("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getModel().setValue("triporiamount", BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getModel().setValue("triporiamount", tripEntryAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "triporiamount": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quoteType = this.getModel().getProperty("tripquotetype") == null ? "0" : (String)ObjectUtils.defaultIfNull((String)this.getModel().getValue("tripquotetype"), "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripOriAmount = (BigDecimal)propValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                exchangeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)model.getValue("tripexchangerate"), BigDecimal.ONE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                currencyPrecision = AmountUtils.getCurrencyPrecision(model, "currency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripAmount = AmountUtils.getCurrencyAmount(tripOriAmount, exchangeRate, currencyPrecision, quoteType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripamount", tripAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("triporiaccappamount", tripOriAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripaccappamount", tripAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "triporiaccappamount": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quoteType = this.getModel().getProperty("tripquotetype") == null ? "0" : (String)ObjectUtils.defaultIfNull((String)this.getModel().getValue("tripquotetype"), "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                triporiaccappamount = (BigDecimal)propValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal triporiamount = (BigDecimal)model.getValue("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (triporiaccappamount.compareTo(triporiamount) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    triporiaccappamount = triporiamount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("triporiaccappamount", triporiamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                currencyPrecision = AmountUtils.getCurrencyPrecision(model, "currency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                BigDecimal changeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)model.getValue("tripexchangerate"), BigDecimal.ONE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (changeRate == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    changeRate = BigDecimal.ONE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripaccappamount = AmountUtils.getCurrencyAmount(triporiaccappamount, changeRate, currencyPrecision, quoteType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripaccappamount", tripaccappamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "tripexchangerate": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quoteType = this.getModel().getProperty("tripquotetype") == null ? "0" : (String)ObjectUtils.defaultIfNull((String)this.getModel().getValue("tripquotetype"), "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                exchangeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)propValue, BigDecimal.ONE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripOriAmount = (BigDecimal)model.getValue("triporiamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                triporiaccappamount = (BigDecimal)model.getValue("triporiaccappamount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                currencyPrecision = AmountUtils.getCurrencyPrecision(model, "currency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripAmount = AmountUtils.getCurrencyAmount(tripOriAmount, exchangeRate, currencyPrecision, quoteType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripaccappamount = AmountUtils.getCurrencyAmount(triporiaccappamount, exchangeRate, currencyPrecision, quoteType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripamount", tripAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripaccappamount", tripaccappamount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "startdate": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                startDate = (Date)propValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                endDate = (Date)model.getValue("enddate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripDays = CommonServiceHelper.calcDays(startDate, endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripday", tripDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (startDate != null && model.getValue("triphappendate") == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    model.setValue("triphappendate", startDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "enddate": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                endDate = (Date)propValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                startDate = (Date)model.getValue("startdate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripDays = CommonServiceHelper.calcDays(startDate, endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripday", tripDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "to": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject to = (DynamicObject)propValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (to != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    IDataModel parentModel = this.getView().getParentView().getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject company = (DynamicObject)parentModel.getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Long toCityId = (Long)to.getPkValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Long companyId = (Long)company.getPkValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    MainEntityType dataEntityType = model.getDataEntityType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String orgProp = ((BasedataProp)dataEntityType.getProperty("triparea")).getOrgProp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ErCommonUtils.getPk(parentModel.getValue(orgProp)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    IErTripStdService stdService = new ErTripStdServiceImp(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject tripArea = stdService.getTripAreaByCityIdAndCompanyId(toCityId, ErCommonUtils.getPk(parentModel.getValue(orgProp))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (tripArea != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        model.setValue("triparea", tripArea.getPkValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        model.setValue("triparea", (Object)null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "entrycostdept": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (propValue == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    propValue = valueSet[0].getOldValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getModel().setValue("entrycostdept", ErCommonUtils.getPk(propValue)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String costDeptShowType = CommonServiceHelper.getBillCostOrgShowType(this.getView()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!StringUtils.equals("3", costDeptShowType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.costDeptChange((DynamicObject)propValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject expenseItem = (DynamicObject)model.getValue("tripexpenseitem"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("当前 costDeptShowType" + costDeptShowType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("当前 getPageCache" + BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (expenseItem != null && "2".equals(costDeptShowType) && BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.checkExpenseItem(propValue, model); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "entrycostcompany": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (propValue == null && valueSet[0].getOldValue() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getModel().setValue("entrycostcompany", valueSet[0].getOldValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "tripexpenseitem": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()) && propValue != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "std_project": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "vehicle": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (this.getVihicleFromStdConfig()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    this.getModel().setValue("vehicles", propValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            case "std_entrycostcenter": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (propValue != null && propValue != "") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ErCostCenterUtil.costCenterChangeForTripEdit(this.getView(), propValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected void checkExpenseItem(Object propValue, IDataModel model) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (propValue != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Set<Long> exceptRelExpItems = ExpenseItemServiceHelper.getNotRelOrgExpItemIds((Long)((DynamicObject)propValue).getPkValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject tripExpenseItem = (DynamicObject)this.getModel().getValue("tripexpenseitem"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tripExpenseItem != null && exceptRelExpItems.contains(tripExpenseItem.getLong("id"))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                model.setValue("tripexpenseitem", (Object)null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    protected void costDeptChange(DynamicObject entryCostDept) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (entryCostDept != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject company = (DynamicObject)this.getModel().getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject costCompany = (DynamicObject)this.getModel().getValue("entrycostcompany"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CostDeptF7ChangePram costDeptF7ChangePram = new CostDeptF7ChangePram(Boolean.TRUE, entryCostDept, costCompany, company); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Long costCompanyId = CoreBaseBillServiceHelper.getAccountOrgId(costDeptF7ChangePram); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.getModel().setValue("entrycostcompany", costCompanyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void showExchangeRate(boolean refreshExchangeRate) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel model = this.getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel parentModel = this.getView().getParentView().getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject tripCurrency = (DynamicObject)model.getValue("tripcurrency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject currency = (DynamicObject)parentModel.getValue("currency"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        boolean showExchangeRate = tripCurrency != null && currency != null && !tripCurrency.getPkValue().equals(currency.getPkValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.getView().setVisible(showExchangeRate, new String[]{"tripexchangerate", "tripamount"}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String quoteType = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (refreshExchangeRate) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal exchangeRate = BigDecimal.ONE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (tripCurrency != null && currency != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                long sourceCurrencyId = tripCurrency.getLong("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                long targetCurrencyId = currency.getLong("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                long companyId = (Long)parentModel.getValue("company_Id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String, Object> exchangeRateAndQuoteType = CommonServiceHelper.getExchangeRateFromSysParams(companyId, parentModel.getValue("costcompany"), sourceCurrencyId, targetCurrencyId, model); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quoteType = (String)ObjectUtils.defaultIfNull((String)exchangeRateAndQuoteType.get("quoteType"), "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                exchangeRate = (BigDecimal)ObjectUtils.defaultIfNull((BigDecimal)exchangeRateAndQuoteType.get("exchangeRate"), BigDecimal.ONE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (this.getModel().getProperty("tripquotetype") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.getModel().setValue("tripquotetype", quoteType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.getModel().setValue("tripexchangerate", exchangeRate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setTripDateControl() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        IDataModel pModel = this.getView().getParentView().getModel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DateRangeEdit tripDate = (DateRangeEdit)this.getControl("tirpdate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String entryName = pModel.getDataEntityType().getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate now = LocalDate.now(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long companyId = ErCommonUtils.getPk(pModel.getValue("company")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ErEntityTypeUtils.isTripReqBill(entryName) && StringUtils.equals("1", ErCommonUtils.getTripDateSelectRange(companyId))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tripDate.setMinDate(ErCommonUtils.getDateFromLocalDate(now)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ErEntityTypeUtils.isTripReimburseBill(entryName) && StringUtils.equals("0", SystemParamterUtil.getTripReimDateSelectRange(companyId))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tripDate.setMaxDate(ErCommonUtils.getDateFromLocalDate(now)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (pModel.getProperty("isopentripstd") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object company = pModel.getValue("company"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ((!(Boolean)pModel.getValue("istravelers") || (Boolean)pModel.getValue("travelerssamestd")) && SystemParamterUtil.isOpenTripDateControl(ErCommonUtils.getPk(company)) && (Boolean)pModel.getValue("isopentripstd") && pModel.getEntryRowCount("tripentry") != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int currentIndex = Integer.parseInt(this.getPageCache().get("tripEntryRowIndex")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    currentIndex = currentIndex == -1 ? pModel.getEntryRowCount("tripentry") - 1 : currentIndex - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObjectCollection tripEntry = pModel.getDataEntity(true).getDynamicObjectCollection("tripentry"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (currentIndex >= 0 && tripEntry.size() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        DynamicObject preRow = (DynamicObject)tripEntry.get(currentIndex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Date minDate = preRow.getDate("enddate"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tripDate.setMinDate(minDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |