|  | @@ -0,0 +1,1082 @@
 | 
	
		
			
				|  |  | +package kd.fi.er.formplugin.mobile;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  | +import java.lang.reflect.InvocationTargetException;
 | 
	
		
			
				|  |  | +import java.math.BigDecimal;
 | 
	
		
			
				|  |  | +import java.time.LocalDate;
 | 
	
		
			
				|  |  | +import java.util.Arrays;
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  | +import java.util.EventObject;
 | 
	
		
			
				|  |  | +import java.util.HashMap;
 | 
	
		
			
				|  |  | +import java.util.Iterator;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  | +import kd.bos.bill.AbstractMobBillPlugIn;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.OperateOption;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.entity.DynamicObject;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.entity.LocaleString;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.entity.MulBasedataDynamicObjectCollection;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.metadata.IDataEntityProperty;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.resource.ResManager;
 | 
	
		
			
				|  |  | +import kd.bos.entity.cache.RedisModelCache;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.IDataModel;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.IRefrencedataProvider;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.ListSelectedRowCollection;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.events.AfterDeleteRowEventArgs;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.events.BizDataEventArgs;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.events.ChangeData;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.events.PropertyChangedArgs;
 | 
	
		
			
				|  |  | +import kd.bos.entity.property.MulBasedataProp;
 | 
	
		
			
				|  |  | +import kd.bos.form.CloseCallBack;
 | 
	
		
			
				|  |  | +import kd.bos.form.ConfirmCallBackListener;
 | 
	
		
			
				|  |  | +import kd.bos.form.FormShowParameter;
 | 
	
		
			
				|  |  | +import kd.bos.form.IFormView;
 | 
	
		
			
				|  |  | +import kd.bos.form.IMobileView;
 | 
	
		
			
				|  |  | +import kd.bos.form.IPageCache;
 | 
	
		
			
				|  |  | +import kd.bos.form.MessageBoxOptions;
 | 
	
		
			
				|  |  | +import kd.bos.form.MessageBoxResult;
 | 
	
		
			
				|  |  | +import kd.bos.form.ShowType;
 | 
	
		
			
				|  |  | +import kd.bos.form.cardentry.CardEntry;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.AbstractGrid;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.Control;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.Label;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.events.BeforeClickEvent;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.events.ClickListener;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.events.RowClickEvent;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.events.RowClickEventListener;
 | 
	
		
			
				|  |  | +import kd.bos.form.events.BeforeClosedEvent;
 | 
	
		
			
				|  |  | +import kd.bos.form.events.ClosedCallBackEvent;
 | 
	
		
			
				|  |  | +import kd.bos.form.events.MessageBoxClosedEvent;
 | 
	
		
			
				|  |  | +import kd.bos.form.field.DateEdit;
 | 
	
		
			
				|  |  | +import kd.bos.form.field.MulBasedataEdit;
 | 
	
		
			
				|  |  | +import kd.bos.form.plugin.IFormPlugin;
 | 
	
		
			
				|  |  | +import kd.bos.list.ListFilterParameter;
 | 
	
		
			
				|  |  | +import kd.bos.list.MobileListShowParameter;
 | 
	
		
			
				|  |  | +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.QueryServiceHelper;
 | 
	
		
			
				|  |  | +import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
 | 
	
		
			
				|  |  | +import kd.bos.util.CollectionUtils;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.reimamountctl.utils.QuotaCtrlUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.servicehelper.CommonServiceHelper;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.servicehelper.CoreBaseBillServiceHelper;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.servicehelper.DailyBillServiceHelper;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.servicehelper.TripReimburseServiceHelper;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.ActionLocalCache;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.AmountChangeUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.ErCommonUtils;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.ErCostCenterUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.ErStdConfig;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.SystemParamterUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.business.utils.TripBillTravelerUtils;
 | 
	
		
			
				|  |  | +import kd.fi.er.common.ErBillStatusEnum;
 | 
	
		
			
				|  |  | +import kd.fi.er.common.ShowPageUtils;
 | 
	
		
			
				|  |  | +import kd.fi.er.formplugin.budget.BudgetCommonUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.formplugin.daily.web.workflow.ErMobWorkFlowOtherViewEditUtils;
 | 
	
		
			
				|  |  | +import kd.fi.er.formplugin.invoicecloud.usecase.ShowInvoiceCloudPageUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.formplugin.util.EntryCopyUtil;
 | 
	
		
			
				|  |  | +import kd.fi.er.formplugin.web.TripEntryEdit;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.ObjectUtils;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +public class TripReimburseConsumcordPluginEx extends AbstractMobBillPlugIn implements ClickListener, RowClickEventListener {
 | 
	
		
			
				|  |  | +    private static Log logger = LogFactory.getLog(TripEntryEdit.class);
 | 
	
		
			
				|  |  | +    private static final String[] requiredProps = new String[]{"from", "to", "startdate", "enddate", "vehicles", "travelers"};
 | 
	
		
			
				|  |  | +    private static final String[] requiredSTDProps = new String[]{"overdesc"};
 | 
	
		
			
				|  |  | +    protected static final String[] STDCTRL_ATTRIBUTE = new String[]{"5", "1", "2", "4", "7"};
 | 
	
		
			
				|  |  | +    protected static final String[] ACCD_ALLOWANCE_ATTRIBUTE = new String[]{"5", "1"};
 | 
	
		
			
				|  |  | +    protected static final String[] VEHIC_ATTRIBUTE = new String[]{"2", "4", "7"};
 | 
	
		
			
				|  |  | +    private static final String KEY_SUBMIT = "submit";
 | 
	
		
			
				|  |  | +    private static final String OPPARAM_AFTERCONFIRM = "afterconfirm";
 | 
	
		
			
				|  |  | +    private static final String INVOICE_HEAD_ENTRY = "invoiceentry";
 | 
	
		
			
				|  |  | +    private static final String INVOICE_ITEM_ENTRY = "invoiceitementry";
 | 
	
		
			
				|  |  | +    private static final String TRIPEXPENSEACTIONID = "showEspenseItem";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public TripReimburseConsumcordPluginEx() {
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void registerListener(EventObject e) {
 | 
	
		
			
				|  |  | +        super.registerListener(e);
 | 
	
		
			
				|  |  | +        this.addClickListeners(new String[]{"btn_addexpenseitem", "btn_save", "imageap_delete", "labelap_edit", "labelap_done", "image_invoice"});
 | 
	
		
			
				|  |  | +        AbstractGrid grid = (AbstractGrid)this.getView().getControl("entryentity");
 | 
	
		
			
				|  |  | +        grid.addRowClickListener(this);
 | 
	
		
			
				|  |  | +        MulBasedataEdit travelersF7 = (MulBasedataEdit)this.getControl("travelers");
 | 
	
		
			
				|  |  | +        DynamicObject company = (DynamicObject)this.getView().getParentView().getModel().getValue("company");
 | 
	
		
			
				|  |  | +        DynamicObject org = (DynamicObject)this.getView().getParentView().getModel().getValue("org");
 | 
	
		
			
				|  |  | +        TripBillTravelerUtils.getF7FilterInfo(company, org, travelersF7);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void createNewData(BizDataEventArgs e) {
 | 
	
		
			
				|  |  | +        super.createNewData(e);
 | 
	
		
			
				|  |  | +        FormShowParameter showParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +        Map<String, Object> mapCustomParam = showParameter.getCustomParams();
 | 
	
		
			
				|  |  | +        int status = (Integer)mapCustomParam.get("status");
 | 
	
		
			
				|  |  | +        IDataModel pModel = this.getView().getParentView().getModel();
 | 
	
		
			
				|  |  | +        if (status == 1 && pModel.getDataEntity().getDataEntityType().getName().equals(this.getView().getEntityId())) {
 | 
	
		
			
				|  |  | +            e.setDataEntity(pModel.getDataEntity());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void afterCreateNewData(EventObject e) {
 | 
	
		
			
				|  |  | +        super.afterCreateNewData(e);
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        CoreBaseBillServiceHelper.setFromStatus(this);
 | 
	
		
			
				|  |  | +        IFormView parentView = this.getView().getParentView();
 | 
	
		
			
				|  |  | +        IDataModel parentModel = parentView.getModel();
 | 
	
		
			
				|  |  | +        model.setValue("billstatus", parentModel.getValue("billstatus"));
 | 
	
		
			
				|  |  | +        model.setValue("editentry", "0");
 | 
	
		
			
				|  |  | +        this.getView().setVisible(false, new String[]{"labelap_done"});
 | 
	
		
			
				|  |  | +        Map<String, Object> mapCustomParam = this.getView().getFormShowParameter().getCustomParams();
 | 
	
		
			
				|  |  | +        Integer status = null;
 | 
	
		
			
				|  |  | +        Object tocity;
 | 
	
		
			
				|  |  | +        if (mapCustomParam != null) {
 | 
	
		
			
				|  |  | +            Object index = mapCustomParam.get("index");
 | 
	
		
			
				|  |  | +            if (index != null) {
 | 
	
		
			
				|  |  | +                this.getPageCache().put("parentViewTripIndex", index.toString());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            status = (Integer)mapCustomParam.get("status");
 | 
	
		
			
				|  |  | +            Object currency = mapCustomParam.get("currency");
 | 
	
		
			
				|  |  | +            if (currency != null) {
 | 
	
		
			
				|  |  | +                model.setValue("currency", Long.valueOf(currency.toString()));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            tocity = mapCustomParam.get("applier");
 | 
	
		
			
				|  |  | +            if (tocity != null) {
 | 
	
		
			
				|  |  | +                model.setValue("applier", Long.valueOf(tocity.toString()));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Long companyId = ErCommonUtils.getPk(parentModel.getValue("company"));
 | 
	
		
			
				|  |  | +        model.setValue("company", companyId);
 | 
	
		
			
				|  |  | +        model.setValue("costcompany", ErCommonUtils.getPk(parentModel.getValue("costcompany")));
 | 
	
		
			
				|  |  | +        boolean iscurrencyshowintripentry = !DailyBillServiceHelper.isNewTripReim(this.getModel()) && SystemParamterUtil.getIsCurrencyShowinTripentry(ErCommonUtils.getPk(this.getModel().getValue("company")));
 | 
	
		
			
				|  |  | +        model.setValue("iscurrencyshowintripentry", iscurrencyshowintripentry);
 | 
	
		
			
				|  |  | +        model.setValue("ismulwayto", parentModel.getValue("ismulwayto"));
 | 
	
		
			
				|  |  | +        CommonServiceHelper.setMulWayToVisible(parentModel, this.getView());
 | 
	
		
			
				|  |  | +        model.setValue("istravelers", parentModel.getValue("istravelers"));
 | 
	
		
			
				|  |  | +        model.setValue("travelerssamestd", parentModel.getValue("travelerssamestd"));
 | 
	
		
			
				|  |  | +        this.getModel().setValue("bizdate", parentView.getModel().getValue("bizdate"));
 | 
	
		
			
				|  |  | +        if (status != null && status == 0) {
 | 
	
		
			
				|  |  | +            this.initNewTripentryInfo(model, parentModel, mapCustomParam);
 | 
	
		
			
				|  |  | +        } else if (status != null && status == 1) {
 | 
	
		
			
				|  |  | +            this.updateTripentryInfo(model, parentModel, mapCustomParam, companyId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (mapCustomParam != null) {
 | 
	
		
			
				|  |  | +            tocity = mapCustomParam.get("to");
 | 
	
		
			
				|  |  | +            if (null != tocity) {
 | 
	
		
			
				|  |  | +                Long cityId = Long.parseLong(tocity.toString());
 | 
	
		
			
				|  |  | +                model.setValue("from", cityId, 0);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        AmountChangeUtil.updateExpenseDetailAmountLabelForMob(this.getView(), model);
 | 
	
		
			
				|  |  | +        this.setExpenseEntryLableCount();
 | 
	
		
			
				|  |  | +        this.copyInvoiceFromParentToChildPage(this.getView().getParentView().getModel(), model);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void updateTripentryInfo(IDataModel model, IDataModel parentModel, Map<String, Object> mapCustomParam, Long companyId) {
 | 
	
		
			
				|  |  | +        DynamicObjectCollection ptrip = (DynamicObjectCollection)parentModel.getDataEntity(true).get("tripentry");
 | 
	
		
			
				|  |  | +        Object indexObj = mapCustomParam.get("index");
 | 
	
		
			
				|  |  | +        if (indexObj != null) {
 | 
	
		
			
				|  |  | +            int index = Integer.parseInt(indexObj.toString());
 | 
	
		
			
				|  |  | +            DynamicObject viewTrip = (DynamicObject)ptrip.get(index);
 | 
	
		
			
				|  |  | +            DynamicObject tripCurrency = (DynamicObject)viewTrip.get("tripcurrency");
 | 
	
		
			
				|  |  | +            if (null == tripCurrency) {
 | 
	
		
			
				|  |  | +                tripCurrency = (DynamicObject)parentModel.getValue("currency");
 | 
	
		
			
				|  |  | +                viewTrip.set("tripcurrency", parentModel.getValue("currency"));
 | 
	
		
			
				|  |  | +                viewTrip.set("tripexchangerate", BigDecimal.ONE);
 | 
	
		
			
				|  |  | +                AmountChangeUtil.updateExpenseDetailAmountLabelForMob(this.getView(), model);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            DynamicObjectCollection trip = (DynamicObjectCollection)this.getModel().getDataEntity(true).get("tripentry");
 | 
	
		
			
				|  |  | +            trip.clear();
 | 
	
		
			
				|  |  | +            EntryCopyUtil.copyEntry2TargetColl(trip, viewTrip);
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(trip)) {
 | 
	
		
			
				|  |  | +                ((DynamicObject)trip.get(0)).set("seq", 1);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            DynamicObject tripEntryCol = (DynamicObject)trip.get(0);
 | 
	
		
			
				|  |  | +            int tripday = tripEntryCol.getInt("tripday");
 | 
	
		
			
				|  |  | +            int entryCountIndex = model.getEntryRowCount("entryentity");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            for(int i = 0; i < entryCountIndex; ++i) {
 | 
	
		
			
				|  |  | +                model.setValue("daycount", tripday, i, 0);
 | 
	
		
			
				|  |  | +                model.setValue("entrycurrency", model.getValue("entrycurrency", i, 0), i, 0);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void initNewTripentryInfo(IDataModel model, IDataModel parentModel, Map<String, Object> mapCustomParam) {
 | 
	
		
			
				|  |  | +        boolean iscurrency = (Boolean)parentModel.getValue("iscurrency");
 | 
	
		
			
				|  |  | +        model.setValue("iscurrency", iscurrency);
 | 
	
		
			
				|  |  | +        int tripRowIndex = model.createNewEntryRow("tripentry");
 | 
	
		
			
				|  |  | +        Object tocity = mapCustomParam.get("to");
 | 
	
		
			
				|  |  | +        if (null == tocity) {
 | 
	
		
			
				|  |  | +            Long cityId = ((IMobileView)this.getView()).getCurrentCityId();
 | 
	
		
			
				|  |  | +            model.setValue("from", cityId, tripRowIndex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        DynamicObject costDept = (DynamicObject)parentModel.getValue("costdept");
 | 
	
		
			
				|  |  | +        DynamicObject costCompany = (DynamicObject)parentModel.getValue("costcompany");
 | 
	
		
			
				|  |  | +        model.setValue("entrycostdept", ErCommonUtils.getPk(costDept), tripRowIndex);
 | 
	
		
			
				|  |  | +        model.setValue("entrycostcompany", ErCommonUtils.getPk(costCompany), tripRowIndex);
 | 
	
		
			
				|  |  | +        Long[] applierIds = new Long[]{ErCommonUtils.getPk(parentModel.getValue("applier"))};
 | 
	
		
			
				|  |  | +        model.setValue("travelers", applierIds, tripRowIndex);
 | 
	
		
			
				|  |  | +        model.setValue("tripcurrency", ErCommonUtils.getPk(parentModel.getValue("currency")), tripRowIndex);
 | 
	
		
			
				|  |  | +        String vehicles = (String)model.getValue("vehicles", tripRowIndex);
 | 
	
		
			
				|  |  | +        Object company = model.getValue("company");
 | 
	
		
			
				|  |  | +        if (company == null) {
 | 
	
		
			
				|  |  | +            model.setValue("company", ErCommonUtils.getPk(parentModel.getValue("company")));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        CoreBaseBillServiceHelper.mulTripVehicle(model, vehicles, tripRowIndex);
 | 
	
		
			
				|  |  | +        CoreBaseBillServiceHelper.addDefaultTripExpenseEntry(model, tripRowIndex);
 | 
	
		
			
				|  |  | +        DynamicObject dataEntity = model.getDataEntity(true);
 | 
	
		
			
				|  |  | +        long companyId = dataEntity.getLong("company_id");
 | 
	
		
			
				|  |  | +        String tripStandardControlMethod = SystemParamterUtil.getTripStandardControlLevel(companyId).getValue();
 | 
	
		
			
				|  |  | +        String vehicleConType = SystemParamterUtil.getVehicleStdControlLevel(companyId).getValue();
 | 
	
		
			
				|  |  | +        DynamicObjectCollection tripEntryColl = dataEntity.getDynamicObjectCollection("tripentry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection detailColl = ((DynamicObject)tripEntryColl.get(tripRowIndex)).getDynamicObjectCollection("entryentity");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(int i = 0; i < detailColl.size(); ++i) {
 | 
	
		
			
				|  |  | +            model.setValue("ispassentry", Boolean.FALSE, i, tripRowIndex);
 | 
	
		
			
				|  |  | +            DynamicObject tripExpItem = ((DynamicObject)detailColl.get(i)).getDynamicObject("expenseitem");
 | 
	
		
			
				|  |  | +            if (tripExpItem != null) {
 | 
	
		
			
				|  |  | +                String attribute = tripExpItem.getString("attribute");
 | 
	
		
			
				|  |  | +                if (Arrays.asList(ACCD_ALLOWANCE_ATTRIBUTE).contains(attribute)) {
 | 
	
		
			
				|  |  | +                    model.setValue("controlmethod", tripStandardControlMethod, i, tripRowIndex);
 | 
	
		
			
				|  |  | +                } else if (Arrays.asList(VEHIC_ATTRIBUTE).contains(attribute)) {
 | 
	
		
			
				|  |  | +                    model.setValue("controlmethod", vehicleConType, i, tripRowIndex);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            model.setValue("trip2travelers", ((DynamicObject)tripEntryColl.get(tripRowIndex)).getDynamicObjectCollection("travelers"), i, tripRowIndex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        ErCostCenterUtil.initEntryCostCenter(this.getModel(), "tripentry", tripRowIndex, -1);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void afterBindData(EventObject e) {
 | 
	
		
			
				|  |  | +        super.afterBindData(e);
 | 
	
		
			
				|  |  | +        FormShowParameter showParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +        Map<String, Object> mapCustomParam = showParameter.getCustomParams();
 | 
	
		
			
				|  |  | +        boolean isQueryBudget = (Boolean)mapCustomParam.get("isquerybudget");
 | 
	
		
			
				|  |  | +        BudgetCommonUtil.setIsQueryBudgetFlag(this.getPageCache(), isQueryBudget);
 | 
	
		
			
				|  |  | +        this.setBudgetShow(0);
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        Boolean iscurency = this.refreshEntryCurrency(model);
 | 
	
		
			
				|  |  | +        model.setValue("iscurrency", iscurency);
 | 
	
		
			
				|  |  | +        if (mapCustomParam != null) {
 | 
	
		
			
				|  |  | +            Object date = mapCustomParam.get("enddate");
 | 
	
		
			
				|  |  | +            if (null != date) {
 | 
	
		
			
				|  |  | +                model.setValue("startdate", date, 0);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int entryCountIndex = this.getModel().getEntryRowCount("entryentity");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(int i = 0; i < entryCountIndex; ++i) {
 | 
	
		
			
				|  |  | +            DynamicObject tripexpense = (DynamicObject)model.getValue("expenseitem", i);
 | 
	
		
			
				|  |  | +            this.isExpenseIsPassEntry(model, i, tripexpense);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        this.setTripExenseItemIcon();
 | 
	
		
			
				|  |  | +        ShowInvoiceCloudPageUtil.registCheckback(this);
 | 
	
		
			
				|  |  | +        this.setExpenseEntryLableCount();
 | 
	
		
			
				|  |  | +        if (model.getEntryEntity("entryentity").stream().anyMatch((v) -> {
 | 
	
		
			
				|  |  | +            return "2".equals(v.getString("settlementtype"));
 | 
	
		
			
				|  |  | +        })) {
 | 
	
		
			
				|  |  | +            this.getView().setEnable(Boolean.FALSE, (Integer)mapCustomParam.get("index"), new String[]{"tripcurrency"});
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        ShowPageUtils.setMobilePageFormStatus(this.getView());
 | 
	
		
			
				|  |  | +        this.vehicleVisible();
 | 
	
		
			
				|  |  | +        if (model.getEntryRowCount("entryentity") == 0) {
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        this.setTripDateControl();
 | 
	
		
			
				|  |  | +        ErMobWorkFlowOtherViewEditUtils.setWorkFlowEditView(this.getView(), mapCustomParam, model, 4);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setBudgetShow(int rowIndex) {
 | 
	
		
			
				|  |  | +        CardEntry tripCardEntry = (CardEntry)this.getControl("tripentry");
 | 
	
		
			
				|  |  | +        if (tripCardEntry != null) {
 | 
	
		
			
				|  |  | +            if (!BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()) && !BudgetCommonUtil.getIsQueryEASBudgetFlag(this.getPageCache())) {
 | 
	
		
			
				|  |  | +                tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetamount"});
 | 
	
		
			
				|  |  | +                tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetmsg"});
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                IFormView parentView = this.getView().getParentView();
 | 
	
		
			
				|  |  | +                if (parentView != null) {
 | 
	
		
			
				|  |  | +                    String budgeMsgValue = (String)ErCommonUtils.getEMParameter(ErCommonUtils.getPk(parentView.getModel().getValue("company")), "budgeMsgControl");
 | 
	
		
			
				|  |  | +                    if (StringUtils.isNotEmpty(budgeMsgValue)) {
 | 
	
		
			
				|  |  | +                        if ("0".equals(budgeMsgValue)) {
 | 
	
		
			
				|  |  | +                            tripCardEntry.setChildVisible(true, rowIndex, new String[]{"budgetamount"});
 | 
	
		
			
				|  |  | +                            tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetmsg"});
 | 
	
		
			
				|  |  | +                        } else if ("1".equals(budgeMsgValue)) {
 | 
	
		
			
				|  |  | +                            tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetamount"});
 | 
	
		
			
				|  |  | +                            tripCardEntry.setChildVisible(true, rowIndex, new String[]{"budgetmsg"});
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetamount"});
 | 
	
		
			
				|  |  | +                        tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetmsg"});
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetamount"});
 | 
	
		
			
				|  |  | +                    tripCardEntry.setChildVisible(false, rowIndex, new String[]{"budgetmsg"});
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setTripDateControl() {
 | 
	
		
			
				|  |  | +        Object company = this.getView().getParentView().getModel().getValue("company");
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.equals(SystemParamterUtil.getTripReimDateSelectRange(ErCommonUtils.getPk(company)), "0")) {
 | 
	
		
			
				|  |  | +            DateEdit startDate = (DateEdit)this.getControl("startdate");
 | 
	
		
			
				|  |  | +            DateEdit endDate = (DateEdit)this.getControl("enddate");
 | 
	
		
			
				|  |  | +            LocalDate now = LocalDate.now();
 | 
	
		
			
				|  |  | +            startDate.setMaxDate(ErCommonUtils.getDateFromLocalDate(now));
 | 
	
		
			
				|  |  | +            endDate.setMaxDate(ErCommonUtils.getDateFromLocalDate(now));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected void vehicleVisible() {
 | 
	
		
			
				|  |  | +        String vihicleKey = null;
 | 
	
		
			
				|  |  | +        if (!this.readOnly() && this.getVihicleFromStdConfig()) {
 | 
	
		
			
				|  |  | +            vihicleKey = "vehicles";
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            vihicleKey = "vehicle";
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        CardEntry tripentry = (CardEntry)this.getControl("tripentry");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(int i = 0; i < this.getModel().getEntryRowCount("tripentry"); ++i) {
 | 
	
		
			
				|  |  | +            tripentry.setChildVisible(false, i, new String[]{vihicleKey});
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected boolean readOnly() {
 | 
	
		
			
				|  |  | +        IFormView parentView = this.getView().getParentView();
 | 
	
		
			
				|  |  | +        return parentView != null && !"A".equals(parentView.getModel().getValue("billstatus")) && !"D".equals(parentView.getModel().getValue("billstatus"));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void propertyChanged(PropertyChangedArgs e) {
 | 
	
		
			
				|  |  | +        super.propertyChanged(e);
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        String propName = e.getProperty().getName();
 | 
	
		
			
				|  |  | +        ChangeData[] valueSet = e.getChangeSet();
 | 
	
		
			
				|  |  | +        Object propValue = valueSet[0].getNewValue();
 | 
	
		
			
				|  |  | +        int rowIndex = valueSet[0].getRowIndex();
 | 
	
		
			
				|  |  | +        int parentIndex = valueSet[0].getParentRowIndex();
 | 
	
		
			
				|  |  | +        switch (propName) {
 | 
	
		
			
				|  |  | +            case "startdate":
 | 
	
		
			
				|  |  | +                if (propValue != null && model.getValue("triphappendate") == null) {
 | 
	
		
			
				|  |  | +                    model.setValue("triphappendate", propValue);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                this.changeTripDay(rowIndex);
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "enddate":
 | 
	
		
			
				|  |  | +                this.changeTripDay(rowIndex);
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "vehicles":
 | 
	
		
			
				|  |  | +                CoreBaseBillServiceHelper.refreshVehicleRelateEntry(model, (String)propValue, rowIndex);
 | 
	
		
			
				|  |  | +                DynamicObjectCollection currItemEntry = ((DynamicObject)model.getDataEntity(true).getDynamicObjectCollection("tripentry").get(rowIndex)).getDynamicObjectCollection("entryentity");
 | 
	
		
			
				|  |  | +                if (currItemEntry != null && currItemEntry.size() > 0) {
 | 
	
		
			
				|  |  | +                    for(int i = 0; i < currItemEntry.size(); ++i) {
 | 
	
		
			
				|  |  | +                        this.getView().updateView("expenseitem", i, rowIndex);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "tripexpenseitem":
 | 
	
		
			
				|  |  | +                if (BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache()) && propValue != null) {
 | 
	
		
			
				|  |  | +                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), rowIndex);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "std_project":
 | 
	
		
			
				|  |  | +                if (BudgetCommonUtil.getIsQueryBudgetFlag(this.getPageCache())) {
 | 
	
		
			
				|  |  | +                    BudgetCommonUtil.buildBudgetAmountField(this.getView(), rowIndex);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "vehicle":
 | 
	
		
			
				|  |  | +                if (this.getVihicleFromStdConfig()) {
 | 
	
		
			
				|  |  | +                    this.getModel().setValue("vehicles", propValue);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "std_entrycostcenter":
 | 
	
		
			
				|  |  | +                if (propValue != null && propValue != "" && ErCostCenterUtil.isLeafCostCenter(propValue)) {
 | 
	
		
			
				|  |  | +                    DynamicObject company = (DynamicObject)model.getValue("company");
 | 
	
		
			
				|  |  | +                    String selectMode = ErCommonUtils.getCostOrgUseMode((Long)company.getPkValue());
 | 
	
		
			
				|  |  | +                    if (!"0".equals(selectMode)) {
 | 
	
		
			
				|  |  | +                        ErCostCenterUtil.costEntryCenterChangeForTripMob(this.getView(), propValue, rowIndex);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "expenseitem":
 | 
	
		
			
				|  |  | +                if (propValue != null) {
 | 
	
		
			
				|  |  | +                    this.setCurrentExpenseItemIcon(rowIndex, parentIndex, (Long)((DynamicObject)propValue).getPkValue());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if ("entrycostcompany".equals(propName) || "entrycostdept".equals(propName) || "triphappendate".equals(propName) || "tripexpenseitem".equals(propName)) {
 | 
	
		
			
				|  |  | +            this.handleExpenseEntry(rowIndex);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void handleExpenseEntry(int tripIndex) {
 | 
	
		
			
				|  |  | +        DynamicObject trip = this.getModel().getEntryRowEntity("tripentry", tripIndex);
 | 
	
		
			
				|  |  | +        DynamicObject tripEntryCostcompany = trip.getDynamicObject("entrycostcompany");
 | 
	
		
			
				|  |  | +        DynamicObject tripEntryCostdept = trip.getDynamicObject("entrycostdept");
 | 
	
		
			
				|  |  | +        Date tripEntryHappendate = trip.getDate("triphappendate");
 | 
	
		
			
				|  |  | +        DynamicObject tripEntryExpenseitem = trip.getDynamicObject("tripexpenseitem");
 | 
	
		
			
				|  |  | +        Long quotaCtrlDeptId = QuotaCtrlUtil.getQuotaCtrlDeptId(tripEntryExpenseitem, tripEntryCostdept, this.getView().getParentView().getModel());
 | 
	
		
			
				|  |  | +        trip.getDynamicObjectCollection("entryentity").forEach((v) -> {
 | 
	
		
			
				|  |  | +            v.set("travelcostcompany", tripEntryCostcompany);
 | 
	
		
			
				|  |  | +            v.set("travelcostdept", tripEntryCostdept);
 | 
	
		
			
				|  |  | +            v.set("travelhappendate", tripEntryHappendate);
 | 
	
		
			
				|  |  | +            v.set("travelexpenseitem", tripEntryExpenseitem);
 | 
	
		
			
				|  |  | +            v.set("travelquotactldept_id", quotaCtrlDeptId);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected boolean getVihicleFromStdConfig() {
 | 
	
		
			
				|  |  | +        return org.apache.commons.lang3.StringUtils.equals(ErStdConfig.get("notMultiVehicles"), "true");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void changeTripDay(int tripEntryIndex) {
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        Date startDate = (Date)model.getValue("startdate", tripEntryIndex);
 | 
	
		
			
				|  |  | +        Date endDate = (Date)model.getValue("enddate", tripEntryIndex);
 | 
	
		
			
				|  |  | +        Long tripDays = CommonServiceHelper.calcDays(startDate, endDate);
 | 
	
		
			
				|  |  | +        model.setValue("tripday", tripDays, tripEntryIndex);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void click(EventObject evt) {
 | 
	
		
			
				|  |  | +        super.click(evt);
 | 
	
		
			
				|  |  | +        Control source = (Control)evt.getSource();
 | 
	
		
			
				|  |  | +        String key = source.getKey();
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        FormShowParameter showParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +        Map<String, Object> mapCustomParam = showParameter.getCustomParams();
 | 
	
		
			
				|  |  | +        int stauts = (Integer)mapCustomParam.get("status");
 | 
	
		
			
				|  |  | +        IFormView pView = this.getView().getParentView();
 | 
	
		
			
				|  |  | +        IDataModel pModel = pView.getModel();
 | 
	
		
			
				|  |  | +        switch (key) {
 | 
	
		
			
				|  |  | +            case "btn_addexpenseitem":
 | 
	
		
			
				|  |  | +                if (!this.requiredProps(model, requiredProps)) {
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (this.checkTripArea(model)) {
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                DynamicObject company = (DynamicObject)pModel.getValue("company");
 | 
	
		
			
				|  |  | +                Long companyId = company == null ? 0L : (Long)company.getPkValue();
 | 
	
		
			
				|  |  | +                int curIndex = model.getEntryCurrentRowIndex("entryentity");
 | 
	
		
			
				|  |  | +                mapCustomParam.put("curIndex", curIndex);
 | 
	
		
			
				|  |  | +                this.openTripExpneseF7SelectView(mapCustomParam, companyId);
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "btn_save":
 | 
	
		
			
				|  |  | +                if (!this.requiredProps(model, requiredProps)) {
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (this.checkTripArea(model)) {
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (!this.isAllTripItemHasValue()) {
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                DynamicObject dataEntity = this.getModel().getDataEntity(true);
 | 
	
		
			
				|  |  | +                DynamicObjectCollection tripEntryDOs = dataEntity.getDynamicObjectCollection("tripentry");
 | 
	
		
			
				|  |  | +                Boolean confirm = Boolean.FALSE;
 | 
	
		
			
				|  |  | +                Iterator var18 = tripEntryDOs.iterator();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                while(var18.hasNext()) {
 | 
	
		
			
				|  |  | +                    DynamicObject dobjet = (DynamicObject)var18.next();
 | 
	
		
			
				|  |  | +                    Object from = dobjet.get("from");
 | 
	
		
			
				|  |  | +                    Object to = dobjet.get("to");
 | 
	
		
			
				|  |  | +                    if (from.equals(to)) {
 | 
	
		
			
				|  |  | +                        confirm = Boolean.TRUE;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (confirm) {
 | 
	
		
			
				|  |  | +                    this.getView().showConfirm(ResManager.loadKDString("出发地与目的地相同,是否继续?", "TripReimburseConsumcordPlugin_0", "fi-er-formplugin", new Object[0]), MessageBoxOptions.OKCancel, new ConfirmCallBackListener("ok", this));
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    this.clickOk(model, mapCustomParam, stauts, pView, pModel);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "labelap_edit":
 | 
	
		
			
				|  |  | +                model.setValue("editentry", "1");
 | 
	
		
			
				|  |  | +                this.getView().setVisible(Boolean.TRUE, new String[]{"labelap_done"});
 | 
	
		
			
				|  |  | +                this.getView().setVisible(Boolean.FALSE, new String[]{"labelap_edit"});
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "imageap_delete":
 | 
	
		
			
				|  |  | +                model.setValue("editentry", "2");
 | 
	
		
			
				|  |  | +                break;
 | 
	
		
			
				|  |  | +            case "labelap_done":
 | 
	
		
			
				|  |  | +                model.setValue("editentry", "3");
 | 
	
		
			
				|  |  | +                this.getView().setVisible(Boolean.FALSE, new String[]{"labelap_done"});
 | 
	
		
			
				|  |  | +                this.getView().setVisible(Boolean.TRUE, new String[]{"labelap_edit"});
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean checkTripArea(IDataModel model) {
 | 
	
		
			
				|  |  | +        if (this.getModel().getDataEntity().getBoolean("isopentripstd") && (ErBillStatusEnum.A.name().equalsIgnoreCase((String)model.getValue("billstatus")) || ErBillStatusEnum.D.name().equalsIgnoreCase((String)model.getValue("billstatus")))) {
 | 
	
		
			
				|  |  | +            return !this.requiredProps(model, new String[]{"tripentryarea"});
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            return false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected void openTripExpneseF7SelectView(Map<String, Object> mapCustomParam, Long companyId) {
 | 
	
		
			
				|  |  | +        openTripExpneseF7SelectView(this, this.getView(), mapCustomParam, companyId, "showEspenseItem");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public static void openTripExpneseF7SelectView(IFormPlugin plugin, IFormView view, Map<String, Object> mapCustomParam, Long companyId, String callBackActionId) {
 | 
	
		
			
				|  |  | +        MobileListShowParameter parameter = new MobileListShowParameter();
 | 
	
		
			
				|  |  | +        parameter.setBillFormId("er_tripexpenseitem");
 | 
	
		
			
				|  |  | +        parameter.setFormId("bos_moblisttabf7");
 | 
	
		
			
				|  |  | +        parameter.setCustomParams(mapCustomParam);
 | 
	
		
			
				|  |  | +        parameter.getOpenStyle().setShowType(ShowType.Floating);
 | 
	
		
			
				|  |  | +        parameter.setLookUp(true);
 | 
	
		
			
				|  |  | +        ListFilterParameter listFilterParameter = new ListFilterParameter();
 | 
	
		
			
				|  |  | +        String selectExpensePros = "id,number,longnumber,expenseitemicon,isdefault,isvactax,ctrltype";
 | 
	
		
			
				|  |  | +        QFilter qA = new QFilter("enable", "=", Boolean.TRUE);
 | 
	
		
			
				|  |  | +        QFilter bdFilter = BaseDataServiceHelper.getBaseDataFilter("er_tripexpenseitem", companyId);
 | 
	
		
			
				|  |  | +        DynamicObjectCollection expenseItems = QueryServiceHelper.query("er_tripexpenseitem", selectExpensePros, new QFilter[]{qA, bdFilter});
 | 
	
		
			
				|  |  | +        List<Object> list = (List)expenseItems.stream().map((d) -> {
 | 
	
		
			
				|  |  | +            return d.get("id");
 | 
	
		
			
				|  |  | +        }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        listFilterParameter.getQFilters().add(new QFilter("id", "in", list.toArray()));
 | 
	
		
			
				|  |  | +        parameter.setListFilterParameter(listFilterParameter);
 | 
	
		
			
				|  |  | +        parameter.setCloseCallBack(new CloseCallBack(plugin, callBackActionId));
 | 
	
		
			
				|  |  | +        parameter.setAppId("18XD+/5EDN8X");
 | 
	
		
			
				|  |  | +        parameter.setHasRight(true);
 | 
	
		
			
				|  |  | +        view.showForm(parameter);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void clickOk(IDataModel model, Map<String, Object> mapCustomParam, int stauts, IFormView pView, IDataModel pModel) {
 | 
	
		
			
				|  |  | +        Map<String, Object> map = new HashMap();
 | 
	
		
			
				|  |  | +        int tripcurrentRowIndex = 0;
 | 
	
		
			
				|  |  | +        long firstPageCurrencyId = ErCommonUtils.getPk(pModel.getValue("currency"));
 | 
	
		
			
				|  |  | +        long secondPageCurrencyId = ErCommonUtils.getPk(model.getValue("currency"));
 | 
	
		
			
				|  |  | +        DynamicObjectCollection trip = (DynamicObjectCollection)model.getDataEntity(true).get("tripentry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection ptrip = (DynamicObjectCollection)pModel.getDataEntity(true).get("tripentry");
 | 
	
		
			
				|  |  | +        if (firstPageCurrencyId != secondPageCurrencyId && ptrip.isEmpty()) {
 | 
	
		
			
				|  |  | +            pView.updateView();
 | 
	
		
			
				|  |  | +            this.getView().sendFormAction(pView);
 | 
	
		
			
				|  |  | +            this.getView().close();
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            ActionLocalCache.get().put("isDeleteEntryEntity", true);
 | 
	
		
			
				|  |  | +            String pageId;
 | 
	
		
			
				|  |  | +            RedisModelCache redisModelCache;
 | 
	
		
			
				|  |  | +            if (stauts == 0) {
 | 
	
		
			
				|  |  | +                this.copyInvoiceFromChildToParentPage(model, pModel);
 | 
	
		
			
				|  |  | +                EntryCopyUtil.copyColl2TargetColl(ptrip, trip);
 | 
	
		
			
				|  |  | +                this.refreshTotalAmount(pModel, "tripentry", "tripamount", "amount");
 | 
	
		
			
				|  |  | +                pageId = pView.getPageId();
 | 
	
		
			
				|  |  | +                redisModelCache = new RedisModelCache((IRefrencedataProvider)null, this.getModel().getDataEntityType(), pageId);
 | 
	
		
			
				|  |  | +                redisModelCache.storeAll(this.getModel().getDataEntity(true));
 | 
	
		
			
				|  |  | +                pView.setVisible(Boolean.FALSE, new String[]{"next"});
 | 
	
		
			
				|  |  | +                pView.setVisible(Boolean.TRUE, new String[]{"tbmain", "save", "submit", "tripentry", "flexpanel_mytrip", "listcard_tripentry", "listcardviewap", "btn_addsection"});
 | 
	
		
			
				|  |  | +                this.getView().sendFormAction(pView);
 | 
	
		
			
				|  |  | +                pView.updateView();
 | 
	
		
			
				|  |  | +                int pEntryRowCount = pModel.getEntryRowCount("tripentry");
 | 
	
		
			
				|  |  | +                tripcurrentRowIndex = pEntryRowCount - 1;
 | 
	
		
			
				|  |  | +            } else if (stauts == 1) {
 | 
	
		
			
				|  |  | +                tripcurrentRowIndex = Integer.parseInt(mapCustomParam.get("index").toString());
 | 
	
		
			
				|  |  | +                pModel.setValue("enddate", model.getValue("enddate"), tripcurrentRowIndex);
 | 
	
		
			
				|  |  | +                this.copyInvoiceFromChildToParentPage(model, pModel);
 | 
	
		
			
				|  |  | +                EntryCopyUtil.updateColl2TargetColl(ptrip, trip, tripcurrentRowIndex);
 | 
	
		
			
				|  |  | +                pageId = pView.getPageId();
 | 
	
		
			
				|  |  | +                redisModelCache = new RedisModelCache((IRefrencedataProvider)null, this.getModel().getDataEntityType(), pageId);
 | 
	
		
			
				|  |  | +                redisModelCache.storeAll(this.getModel().getDataEntity(true));
 | 
	
		
			
				|  |  | +                pView.setVisible(Boolean.FALSE, new String[]{"next"});
 | 
	
		
			
				|  |  | +                pView.setVisible(Boolean.TRUE, new String[]{"tbmain", "save", "submit", "tripentry", "flexpanel_mytrip", "listcard_tripentry", "btn_addsection"});
 | 
	
		
			
				|  |  | +                pView.updateView();
 | 
	
		
			
				|  |  | +                this.getView().sendFormAction(pView);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            map.put("tripcurrentRowIndex", tripcurrentRowIndex);
 | 
	
		
			
				|  |  | +            map.put("tripentryarea", model.getValue("tripentryarea"));
 | 
	
		
			
				|  |  | +            this.getView().returnDataToParent(map);
 | 
	
		
			
				|  |  | +            this.getView().close();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean isAllTripItemHasValue() {
 | 
	
		
			
				|  |  | +        DynamicObject dataEntity = this.getModel().getDataEntity(true);
 | 
	
		
			
				|  |  | +        DynamicObjectCollection tripEntryDOs = dataEntity.getDynamicObjectCollection("tripentry");
 | 
	
		
			
				|  |  | +        if (tripEntryDOs != null && !tripEntryDOs.isEmpty()) {
 | 
	
		
			
				|  |  | +            DynamicObjectCollection tripItemEntryDOs = ((DynamicObject)tripEntryDOs.get(0)).getDynamicObjectCollection("entryentity");
 | 
	
		
			
				|  |  | +            if (tripEntryDOs != null && !tripItemEntryDOs.isEmpty()) {
 | 
	
		
			
				|  |  | +                List<Integer> emptyTripItemRowIndexs = Lists.newLinkedList();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                for(int i = 0; i < tripItemEntryDOs.size(); ++i) {
 | 
	
		
			
				|  |  | +                    DynamicObject tripItemEntryDO = (DynamicObject)tripItemEntryDOs.get(i);
 | 
	
		
			
				|  |  | +                    Object tripItemDO = tripItemEntryDO.get("expenseitem");
 | 
	
		
			
				|  |  | +                    if (tripItemDO == null) {
 | 
	
		
			
				|  |  | +                        emptyTripItemRowIndexs.add(i + 1);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (emptyTripItemRowIndexs.isEmpty()) {
 | 
	
		
			
				|  |  | +                    return true;
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    logger.info("这些费用明细分录上的差旅项目为空:" + org.apache.commons.lang3.StringUtils.join(emptyTripItemRowIndexs, ","));
 | 
	
		
			
				|  |  | +                    this.getView().showTipNotification(String.format(ResManager.loadKDString("请填写第%s行上的差旅项目。", "TripReimburseConsumcordPlugin_1", "fi-er-formplugin", new Object[0]), org.apache.commons.lang3.StringUtils.join(emptyTripItemRowIndexs, ",")));
 | 
	
		
			
				|  |  | +                    return false;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                logger.info("费用明细二级分录为空");
 | 
	
		
			
				|  |  | +                return true;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            logger.info("行程分录为空");
 | 
	
		
			
				|  |  | +            return true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void copyInvoiceFromChildToParentPage(IDataModel model, IDataModel pModel) {
 | 
	
		
			
				|  |  | +        DynamicObjectCollection invoiceHeadEntry = model.getDataEntity(true).getDynamicObjectCollection("invoiceentry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection pInvoiceHeadEntry = pModel.getDataEntity(true).getDynamicObjectCollection("invoiceentry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection invoiceItemEntry = model.getDataEntity(true).getDynamicObjectCollection("invoiceitementry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection pInvoiceItemEntry = pModel.getDataEntity(true).getDynamicObjectCollection("invoiceitementry");
 | 
	
		
			
				|  |  | +        pInvoiceHeadEntry.clear();
 | 
	
		
			
				|  |  | +        EntryCopyUtil.copyColl2TargetColl(pInvoiceHeadEntry, invoiceHeadEntry);
 | 
	
		
			
				|  |  | +        pInvoiceItemEntry.clear();
 | 
	
		
			
				|  |  | +        EntryCopyUtil.copyColl2TargetColl(pInvoiceItemEntry, invoiceItemEntry);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void copyInvoiceFromParentToChildPage(IDataModel pModel, IDataModel model) {
 | 
	
		
			
				|  |  | +        DynamicObjectCollection invoiceHeadEntry = model.getDataEntity(true).getDynamicObjectCollection("invoiceentry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection pInvoiceHeadEntry = pModel.getDataEntity(true).getDynamicObjectCollection("invoiceentry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection invoiceItemEntry = model.getDataEntity(true).getDynamicObjectCollection("invoiceitementry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection pInvoiceItemEntry = pModel.getDataEntity(true).getDynamicObjectCollection("invoiceitementry");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection invoiceMergeEntry = model.getDataEntity(true).getDynamicObjectCollection("invoicemerge");
 | 
	
		
			
				|  |  | +        DynamicObjectCollection pinvoiceMergeEntry = pModel.getDataEntity(true).getDynamicObjectCollection("invoicemerge");
 | 
	
		
			
				|  |  | +        invoiceHeadEntry.clear();
 | 
	
		
			
				|  |  | +        EntryCopyUtil.copyColl2TargetColl(invoiceHeadEntry, pInvoiceHeadEntry);
 | 
	
		
			
				|  |  | +        invoiceItemEntry.clear();
 | 
	
		
			
				|  |  | +        EntryCopyUtil.copyColl2TargetColl(invoiceItemEntry, pInvoiceItemEntry);
 | 
	
		
			
				|  |  | +        invoiceMergeEntry.clear();
 | 
	
		
			
				|  |  | +        EntryCopyUtil.copyColl2TargetColl(invoiceMergeEntry, pinvoiceMergeEntry);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
 | 
	
		
			
				|  |  | +        super.closedCallBack(closedCallBackEvent);
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        int curEntryIndex;
 | 
	
		
			
				|  |  | +        if (!"showEspenseItem".equalsIgnoreCase(closedCallBackEvent.getActionId()) && !"er_tripexpenseitem".equalsIgnoreCase(closedCallBackEvent.getActionId())) {
 | 
	
		
			
				|  |  | +            if (this.getExpenseEditForm().equalsIgnoreCase(closedCallBackEvent.getActionId())) {
 | 
	
		
			
				|  |  | +                curEntryIndex = (Integer)closedCallBackEvent.getReturnData();
 | 
	
		
			
				|  |  | +                DynamicObject expenseItem = (DynamicObject)model.getValue("expenseitem", curEntryIndex);
 | 
	
		
			
				|  |  | +                Boolean isPass = this.isExpenseIsPassEntry(model, curEntryIndex, expenseItem);
 | 
	
		
			
				|  |  | +                model.setValue("ispassentry", isPass, curEntryIndex);
 | 
	
		
			
				|  |  | +                this.getView().updateView("entryentity", curEntryIndex);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else if (closedCallBackEvent.getReturnData() != null && closedCallBackEvent.getReturnData() instanceof ListSelectedRowCollection) {
 | 
	
		
			
				|  |  | +            ListSelectedRowCollection returnData = (ListSelectedRowCollection)closedCallBackEvent.getReturnData();
 | 
	
		
			
				|  |  | +            long expenseitemId = 0L;
 | 
	
		
			
				|  |  | +            if (returnData.size() > 0) {
 | 
	
		
			
				|  |  | +                expenseitemId = Long.parseLong(returnData.get(0).getPrimaryKeyValue().toString());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            DynamicObject selectExpenseitem = CommonServiceHelper.getObjById("er_tripexpenseitem", expenseitemId);
 | 
	
		
			
				|  |  | +            if (selectExpenseitem == null) {
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            model.batchCreateNewEntryRow("entryentity", 1);
 | 
	
		
			
				|  |  | +            curEntryIndex = model.getEntryRowCount("entryentity") - 1;
 | 
	
		
			
				|  |  | +            this.fillEntryEntityData(model, selectExpenseitem, curEntryIndex);
 | 
	
		
			
				|  |  | +            model.setValue("pic", selectExpenseitem.getString("expenseitemicon"), curEntryIndex);
 | 
	
		
			
				|  |  | +            this.getView().updateView("pic", curEntryIndex);
 | 
	
		
			
				|  |  | +            this.getView().updateView("expenseitem", curEntryIndex);
 | 
	
		
			
				|  |  | +            this.getView().setEnable(Boolean.FALSE, curEntryIndex, new String[]{"expenseitem"});
 | 
	
		
			
				|  |  | +            this.isExpenseIsPassEntry(model, curEntryIndex, selectExpenseitem);
 | 
	
		
			
				|  |  | +            boolean ispassentry = (Boolean)model.getValue("ispassentry", curEntryIndex);
 | 
	
		
			
				|  |  | +            if (ispassentry) {
 | 
	
		
			
				|  |  | +                Map<String, Object> paramMap = new HashMap();
 | 
	
		
			
				|  |  | +                paramMap.put("formId", "er_tripreimexpenseitem_m");
 | 
	
		
			
				|  |  | +                paramMap.put("formName", ResManager.loadKDString("费用明细", "TripReimburseConsumcordPlugin_3", "fi-er-formplugin", new Object[0]));
 | 
	
		
			
				|  |  | +                paramMap.put("formType", "5");
 | 
	
		
			
				|  |  | +                paramMap.put("needCallBack", Boolean.TRUE);
 | 
	
		
			
				|  |  | +                Map<String, Object> mapCustomParam = new HashMap();
 | 
	
		
			
				|  |  | +                mapCustomParam.put("iscurrency", this.refreshEntryCurrency(model));
 | 
	
		
			
				|  |  | +                mapCustomParam.put("expenseitem", expenseitemId);
 | 
	
		
			
				|  |  | +                mapCustomParam.put("index", curEntryIndex);
 | 
	
		
			
				|  |  | +                mapCustomParam.put("taxrate", model.getValue("taxrate", curEntryIndex));
 | 
	
		
			
				|  |  | +                mapCustomParam.put("entrycurrency", ErCommonUtils.getPk(model.getValue("entrycurrency", curEntryIndex)));
 | 
	
		
			
				|  |  | +                mapCustomParam.put("exchangerate", model.getValue("exchangerate", curEntryIndex));
 | 
	
		
			
				|  |  | +                mapCustomParam.put("detailquotetype", model.getValue("detailquotetype", curEntryIndex));
 | 
	
		
			
				|  |  | +                mapCustomParam.put("status", 0);
 | 
	
		
			
				|  |  | +                paramMap.put("customParam", mapCustomParam);
 | 
	
		
			
				|  |  | +                ShowPageUtils.showPage(paramMap, this);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        AmountChangeUtil.updateExpenseDetailAmountLabelForMob(this.getView(), model);
 | 
	
		
			
				|  |  | +        this.setExpenseEntryLableCount();
 | 
	
		
			
				|  |  | +        this.getModel().setValue("editentry", 0);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setTripExenseItemIcon() {
 | 
	
		
			
				|  |  | +        DynamicObjectCollection tripEntrys = this.getModel().getDataEntity(true).getDynamicObjectCollection("tripentry");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(int i = 0; i < tripEntrys.size(); ++i) {
 | 
	
		
			
				|  |  | +            DynamicObject tripEntry = (DynamicObject)tripEntrys.get(i);
 | 
	
		
			
				|  |  | +            DynamicObjectCollection entryEntitys = tripEntry.getDynamicObjectCollection("entryentity");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            for(int entryEntityIndex = 0; entryEntityIndex < entryEntitys.size(); ++entryEntityIndex) {
 | 
	
		
			
				|  |  | +                DynamicObject entryEntity = (DynamicObject)entryEntitys.get(entryEntityIndex);
 | 
	
		
			
				|  |  | +                DynamicObject tripExpenseItemDO = entryEntity.getDynamicObject("expenseitem");
 | 
	
		
			
				|  |  | +                if (tripExpenseItemDO != null) {
 | 
	
		
			
				|  |  | +                    DynamicObject tripExpenseItemDOFromDB = BusinessDataServiceHelper.loadSingleFromCache(tripExpenseItemDO.getPkValue(), "er_tripexpenseitem", "expenseitemicon");
 | 
	
		
			
				|  |  | +                    logger.info("loadSingleFromCache:" + tripExpenseItemDOFromDB);
 | 
	
		
			
				|  |  | +                    this.getModel().setValue("pic", tripExpenseItemDOFromDB.getString("expenseitemicon"), entryEntityIndex, i);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setCurrentExpenseItemIcon(int rowIndex, int parentIndex, Long tripExpenseId) {
 | 
	
		
			
				|  |  | +        DynamicObject tripExpenseItemDOFromDB = BusinessDataServiceHelper.loadSingleFromCache(tripExpenseId, "er_tripexpenseitem", "expenseitemicon");
 | 
	
		
			
				|  |  | +        logger.info("loadSingleFromCache:" + tripExpenseItemDOFromDB);
 | 
	
		
			
				|  |  | +        this.getModel().setValue("pic", tripExpenseItemDOFromDB.getString("expenseitemicon"), rowIndex, parentIndex);
 | 
	
		
			
				|  |  | +        this.getView().updateView("pic", rowIndex, parentIndex);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void fillEntryEntityData(IDataModel model, DynamicObject selectExpenseitem, int index) {
 | 
	
		
			
				|  |  | +        DynamicObject tripentry = (DynamicObject)model.getDataEntity(true).getDynamicObjectCollection("tripentry").get(0);
 | 
	
		
			
				|  |  | +        model.setValue("expenseitem", selectExpenseitem.getPkValue(), index);
 | 
	
		
			
				|  |  | +        model.setValue("pic", selectExpenseitem.getString("expenseitemicon"), index);
 | 
	
		
			
				|  |  | +        int curTripIndex = model.getEntryCurrentRowIndex("tripentry");
 | 
	
		
			
				|  |  | +        model.setValue("daycount", model.getValue("tripday", curTripIndex), index);
 | 
	
		
			
				|  |  | +        model.setValue("pic", selectExpenseitem.getString("expenseitemicon"), index);
 | 
	
		
			
				|  |  | +        TripReimburseServiceHelper.whenTripItemChanged(model, selectExpenseitem, index, curTripIndex);
 | 
	
		
			
				|  |  | +        boolean isCurrencyShowinTripentry = !DailyBillServiceHelper.isNewTripReim(this.getModel()) && SystemParamterUtil.getIsCurrencyShowinTripentry(ErCommonUtils.getPk(this.getModel().getValue("company")));
 | 
	
		
			
				|  |  | +        DynamicObject tripEntryCostcompany;
 | 
	
		
			
				|  |  | +        if (isCurrencyShowinTripentry) {
 | 
	
		
			
				|  |  | +            tripEntryCostcompany = tripentry.getDynamicObject("tripcurrency");
 | 
	
		
			
				|  |  | +            model.setValue("entrycurrency", ErCommonUtils.getPk(tripEntryCostcompany), index);
 | 
	
		
			
				|  |  | +            BigDecimal tripexchangerate = tripentry.getBigDecimal("tripexchangerate");
 | 
	
		
			
				|  |  | +            model.setValue("exchangerate", tripexchangerate, index);
 | 
	
		
			
				|  |  | +            String tripquotetype = (String)ObjectUtils.defaultIfNull(tripentry.getString("tripquotetype"), "0");
 | 
	
		
			
				|  |  | +            model.setValue("detailquotetype", tripquotetype, index);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            model.setValue("entrycurrency", model.getValue("currency"), index);
 | 
	
		
			
				|  |  | +            model.setValue("exchangerate", BigDecimal.ONE, index);
 | 
	
		
			
				|  |  | +            model.setValue("detailquotetype", BigDecimal.ZERO, index);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        model.setValue("trip2travelers", tripentry.getDynamicObjectCollection("travelers"), index);
 | 
	
		
			
				|  |  | +        model.setValue("triparea", tripentry.getDynamicObject("tripentryarea"), index);
 | 
	
		
			
				|  |  | +        tripEntryCostcompany = tripentry.getDynamicObject("entrycostcompany");
 | 
	
		
			
				|  |  | +        DynamicObject tripEntryCostdept = tripentry.getDynamicObject("entrycostdept");
 | 
	
		
			
				|  |  | +        Date tripEntryHappendate = tripentry.getDate("triphappendate");
 | 
	
		
			
				|  |  | +        DynamicObject tripEntryExpenseitem = tripentry.getDynamicObject("tripexpenseitem");
 | 
	
		
			
				|  |  | +        Long quotaCtrlDeptId = QuotaCtrlUtil.getQuotaCtrlDeptId(tripEntryExpenseitem, tripEntryCostdept, this.getView().getParentView().getModel());
 | 
	
		
			
				|  |  | +        model.setValue("travelcostcompany", tripEntryCostcompany, index);
 | 
	
		
			
				|  |  | +        model.setValue("travelcostdept", tripEntryCostdept, index);
 | 
	
		
			
				|  |  | +        model.setValue("travelhappendate", tripEntryHappendate, index);
 | 
	
		
			
				|  |  | +        model.setValue("travelexpenseitem", tripEntryExpenseitem, index);
 | 
	
		
			
				|  |  | +        model.setValue("travelquotactldept", quotaCtrlDeptId, index);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private Boolean refreshEntryCurrency(IDataModel model) {
 | 
	
		
			
				|  |  | +        boolean iscurrency = (Boolean)model.getValue("iscurrency");
 | 
	
		
			
				|  |  | +        if (!iscurrency) {
 | 
	
		
			
				|  |  | +            iscurrency = CommonServiceHelper.initCurrency();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int entryRows = model.getEntryRowCount("entryentity");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(int i = 0; i < entryRows; ++i) {
 | 
	
		
			
				|  |  | +            model.setValue("isMulticurrency", iscurrency, i);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return iscurrency;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected BigDecimal refreshTotalAmount(IDataModel model, String entryField, String entryAmountField, String totalAmountField) {
 | 
	
		
			
				|  |  | +        BigDecimal totalAmount = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +        DynamicObjectCollection entrys = model.getEntryEntity(entryField);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        BigDecimal tripAmount;
 | 
	
		
			
				|  |  | +        for(Iterator var7 = entrys.iterator(); var7.hasNext(); totalAmount = totalAmount.add(tripAmount)) {
 | 
	
		
			
				|  |  | +            DynamicObject entry = (DynamicObject)var7.next();
 | 
	
		
			
				|  |  | +            tripAmount = entry.getBigDecimal(entryAmountField);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        model.setValue(totalAmountField, totalAmount);
 | 
	
		
			
				|  |  | +        if (model.getProperty("approveamount") != null) {
 | 
	
		
			
				|  |  | +            model.setValue("approveamount", totalAmount);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (model.getProperty("encashamount") != null) {
 | 
	
		
			
				|  |  | +            model.setValue("encashamount", totalAmount);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return totalAmount;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setExpenseEntryLableCount() {
 | 
	
		
			
				|  |  | +        Label eicount = (Label)this.getView().getControl("eicount");
 | 
	
		
			
				|  |  | +        int count = this.getModel().getEntryRowCount("entryentity");
 | 
	
		
			
				|  |  | +        eicount.setText("(" + count + ")");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void entryRowClick(RowClickEvent arg0) {
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        DynamicObject dataEntity = model.getDataEntity(true);
 | 
	
		
			
				|  |  | +        if (this.requiredProps(this.getModel(), requiredProps)) {
 | 
	
		
			
				|  |  | +            if (!this.checkTripArea(model)) {
 | 
	
		
			
				|  |  | +                int selectedRowIndex = arg0.getRow();
 | 
	
		
			
				|  |  | +                this.choooseEntryRow(selectedRowIndex);
 | 
	
		
			
				|  |  | +                boolean needdropin = false;
 | 
	
		
			
				|  |  | +                DynamicObject expenseEntryRow = this.getModel().getEntryRowEntity("entryentity", selectedRowIndex);
 | 
	
		
			
				|  |  | +                if (expenseEntryRow != null) {
 | 
	
		
			
				|  |  | +                    String ordernum = expenseEntryRow.getString("ordernum");
 | 
	
		
			
				|  |  | +                    String orderformid = expenseEntryRow.getString("orderformid");
 | 
	
		
			
				|  |  | +                    if (org.apache.commons.lang3.StringUtils.isNoneEmpty(new CharSequence[]{orderformid, ordernum})) {
 | 
	
		
			
				|  |  | +                        needdropin = true;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    DynamicObject expenseitem = expenseEntryRow.getDynamicObject("expenseitem");
 | 
	
		
			
				|  |  | +                    this.isExpenseIsPassEntry(model, selectedRowIndex, expenseitem);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (expenseEntryRow != null && "2".equals(expenseEntryRow.getString("settlementtype")) && needdropin) {
 | 
	
		
			
				|  |  | +                    DynamicObject dynamicObject = expenseEntryRow.getDynamicObject("expenseitem");
 | 
	
		
			
				|  |  | +                    if (dynamicObject == null || org.apache.commons.lang3.StringUtils.isEmpty(dynamicObject.getString("attribute"))) {
 | 
	
		
			
				|  |  | +                        this.getView().showTipNotification(ResManager.loadKDString("请先选择差旅项目。", "TripReimburseConsumcordPlugin_4", "fi-er-formplugin", new Object[0]));
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    Map<String, Object> paramMap = new HashMap();
 | 
	
		
			
				|  |  | +                    Map<String, Object> mapCustomParam = new HashMap();
 | 
	
		
			
				|  |  | +                    paramMap.put("formId", "er_reimbursedetail_mb");
 | 
	
		
			
				|  |  | +                    paramMap.put("formName", ResManager.loadKDString("差旅报销费用明细月结分录详情", "TripReimburseConsumcordPlugin_5", "fi-er-formplugin", new Object[0]));
 | 
	
		
			
				|  |  | +                    paramMap.put("formType", "5");
 | 
	
		
			
				|  |  | +                    paramMap.put("needCallBack", Boolean.TRUE);
 | 
	
		
			
				|  |  | +                    IPageCache pageCache = this.getPageCache();
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("ordernum", expenseEntryRow.get("ordernum"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("currencyId", expenseEntryRow.getDynamicObject("entrycurrency").getPkValue());
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("orderformid", expenseEntryRow.get("orderformid"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("vehicleConType", pageCache.get("vehicleConType"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("index", selectedRowIndex);
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("overdesc", expenseEntryRow.getString("overdesc"));
 | 
	
		
			
				|  |  | +                    boolean isOpendStd = dataEntity.getBoolean("isopentripstd");
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("isControl", isOpendStd);
 | 
	
		
			
				|  |  | +                    if (isOpendStd) {
 | 
	
		
			
				|  |  | +                        boolean isOver = "1".equals(expenseEntryRow.getString("isover"));
 | 
	
		
			
				|  |  | +                        mapCustomParam.put("checkCabinIsOver", isOver);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    paramMap.put("customParam", mapCustomParam);
 | 
	
		
			
				|  |  | +                    ShowPageUtils.showPage(paramMap, this);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void choooseEntryRow(int selectIndex) {
 | 
	
		
			
				|  |  | +        Map<String, Object> mapCustomParam = new HashMap();
 | 
	
		
			
				|  |  | +        DynamicObjectCollection tripentrys = this.getModel().getDataEntity(true).getDynamicObjectCollection("tripentry");
 | 
	
		
			
				|  |  | +        if (tripentrys != null && !tripentrys.isEmpty()) {
 | 
	
		
			
				|  |  | +            DynamicObject tripentry = (DynamicObject)tripentrys.get(this.getModel().getEntryCurrentRowIndex("tripentry"));
 | 
	
		
			
				|  |  | +            DynamicObjectCollection entrys = tripentry.getDynamicObjectCollection("entryentity");
 | 
	
		
			
				|  |  | +            if (entrys != null && !entrys.isEmpty()) {
 | 
	
		
			
				|  |  | +                DynamicObject selectEntry = (DynamicObject)entrys.get(selectIndex);
 | 
	
		
			
				|  |  | +                Boolean iscurrency = (Boolean)this.getView().getParentView().getModel().getValue("iscurrency");
 | 
	
		
			
				|  |  | +                boolean ispassentry = selectEntry.getBoolean("ispassentry");
 | 
	
		
			
				|  |  | +                String invoiceno_entry = selectEntry.getString("invoiceno_entry");
 | 
	
		
			
				|  |  | +                if (org.apache.commons.lang3.StringUtils.isNotBlank(invoiceno_entry)) {
 | 
	
		
			
				|  |  | +                    ispassentry = true;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                String settlementtype = selectEntry.getString("settlementtype");
 | 
	
		
			
				|  |  | +                boolean hasOrder = false;
 | 
	
		
			
				|  |  | +                String ordernum = selectEntry.getString("ordernum");
 | 
	
		
			
				|  |  | +                String orderformid = selectEntry.getString("orderformid");
 | 
	
		
			
				|  |  | +                if (org.apache.commons.lang3.StringUtils.isNotEmpty(ordernum) || org.apache.commons.lang3.StringUtils.isNotEmpty(orderformid)) {
 | 
	
		
			
				|  |  | +                    hasOrder = true;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if ("2".equalsIgnoreCase(settlementtype) && hasOrder) {
 | 
	
		
			
				|  |  | +                    ispassentry = false;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (selectEntry.getDynamicObject("expenseitem") == null) {
 | 
	
		
			
				|  |  | +                    ispassentry = false;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (ispassentry) {
 | 
	
		
			
				|  |  | +                    Map<String, Object> paramMap = new HashMap();
 | 
	
		
			
				|  |  | +                    paramMap.put("formId", this.getExpenseEditForm());
 | 
	
		
			
				|  |  | +                    paramMap.put("formName", ResManager.loadKDString("费用明细", "TripReimburseConsumcordPlugin_3", "fi-er-formplugin", new Object[0]));
 | 
	
		
			
				|  |  | +                    paramMap.put("formType", "5");
 | 
	
		
			
				|  |  | +                    paramMap.put("needCallBack", Boolean.TRUE);
 | 
	
		
			
				|  |  | +                    Object parentIndex = this.getView().getFormShowParameter().getCustomParam("index");
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("index", selectIndex);
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("parentIndex", parentIndex);
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("status", 1);
 | 
	
		
			
				|  |  | +                    Object company = this.getModel().getValue("company");
 | 
	
		
			
				|  |  | +                    if (company != null) {
 | 
	
		
			
				|  |  | +                        Long pkValue = (Long)((DynamicObject)company).getPkValue();
 | 
	
		
			
				|  |  | +                        mapCustomParam.put("company", pkValue.toString());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("iscurrency", iscurrency);
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("entrycurrency", ErCommonUtils.getPk(selectEntry.getDynamicObject("entrycurrency")));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("exchangerate", selectEntry.getBigDecimal("exchangerate"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("offset", selectEntry.getBoolean("offset"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("wbsrcbilltype", selectEntry.getString("wbsrcbilltype"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("invoiceno", selectEntry.getString("invoiceno_entry"));
 | 
	
		
			
				|  |  | +                    mapCustomParam.put("automapinvoice", this.getModel().getValue("automapinvoice"));
 | 
	
		
			
				|  |  | +                    FormShowParameter showParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +                    Map<String, Object> mapCustomParams = showParameter.getCustomParams();
 | 
	
		
			
				|  |  | +                    ErMobWorkFlowOtherViewEditUtils.setWorkFlowParams(mapCustomParam, mapCustomParams);
 | 
	
		
			
				|  |  | +                    paramMap.put("customParam", mapCustomParam);
 | 
	
		
			
				|  |  | +                    ShowPageUtils.showPage(paramMap, this);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected String getExpenseEditForm() {
 | 
	
		
			
				|  |  | +        return "er_tripreimexpenseitem_m";
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected boolean requiredProps(IDataModel model, String[] props) {
 | 
	
		
			
				|  |  | +        String[] var3 = props;
 | 
	
		
			
				|  |  | +        int var4 = props.length;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(int var5 = 0; var5 < var4; ++var5) {
 | 
	
		
			
				|  |  | +            String propName = var3[var5];
 | 
	
		
			
				|  |  | +            IDataEntityProperty property = model.getProperty(propName);
 | 
	
		
			
				|  |  | +            Object propValue = model.getValue(propName);
 | 
	
		
			
				|  |  | +            if (propValue == null || property instanceof MulBasedataProp && ((MulBasedataDynamicObjectCollection)propValue).size() == 0) {
 | 
	
		
			
				|  |  | +                String displayNameStr = null;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    LocaleString displayName = (LocaleString)property.getClass().getMethod("getDisplayName").invoke(property);
 | 
	
		
			
				|  |  | +                    displayNameStr = displayName.getLocaleValue();
 | 
	
		
			
				|  |  | +                } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException var11) {
 | 
	
		
			
				|  |  | +                    logger.error(var11);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(String.format(ResManager.loadKDString("请填写“%s”。", "TripReimburseConsumcordPlugin_6", "fi-er-formplugin", new Object[0]), displayNameStr));
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return true;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean isExpenseIsPassEntry(IDataModel model, int index, DynamicObject tripexpense) {
 | 
	
		
			
				|  |  | +        if (tripexpense == null) {
 | 
	
		
			
				|  |  | +            return false;
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            Boolean isCurrency = CommonServiceHelper.initCurrency();
 | 
	
		
			
				|  |  | +            String attribute = tripexpense.getString("attribute");
 | 
	
		
			
				|  |  | +            boolean isvactax = tripexpense.getBoolean("isvactax");
 | 
	
		
			
				|  |  | +            boolean isOpenStd = (Boolean)this.getModel().getValue("isopentripstd");
 | 
	
		
			
				|  |  | +            if ((!isOpenStd || !Arrays.asList(STDCTRL_ATTRIBUTE).contains(attribute)) && !attribute.equals("2") && !isvactax && !isCurrency && !attribute.equals("6") && !attribute.equals("1")) {
 | 
	
		
			
				|  |  | +                return false;
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                model.setValue("ispassentry", Boolean.TRUE, index, 0);
 | 
	
		
			
				|  |  | +                return true;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void beforeClick(BeforeClickEvent evt) {
 | 
	
		
			
				|  |  | +        super.beforeClick(evt);
 | 
	
		
			
				|  |  | +        Control source = (Control)evt.getSource();
 | 
	
		
			
				|  |  | +        String key = source.getKey();
 | 
	
		
			
				|  |  | +        IDataModel model = this.getModel();
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.equals(key, "btn_save")) {
 | 
	
		
			
				|  |  | +            boolean hasNullTripItem = model.getDataEntity(true).getDynamicObjectCollection("tripentry").stream().flatMap((tripEntry) -> {
 | 
	
		
			
				|  |  | +                return tripEntry.getDynamicObjectCollection("entryentity").stream();
 | 
	
		
			
				|  |  | +            }).anyMatch((entryEntity) -> {
 | 
	
		
			
				|  |  | +                return entryEntity.getDynamicObject("expenseitem") == null;
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            if (hasNullTripItem) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("差旅项目不能为空,请填写差旅项目。", "TripReimburseConsumcordPlugin_10", "fi-er-formplugin", new Object[0]));
 | 
	
		
			
				|  |  | +                evt.setCancel(true);
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void beforeClosed(BeforeClosedEvent e) {
 | 
	
		
			
				|  |  | +        e.setCheckDataChange(false);
 | 
	
		
			
				|  |  | +        super.beforeClosed(e);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
 | 
	
		
			
				|  |  | +        super.confirmCallBack(messageBoxClosedEvent);
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.equals("submit", messageBoxClosedEvent.getCallBackId()) && messageBoxClosedEvent.getResult() == MessageBoxResult.Yes) {
 | 
	
		
			
				|  |  | +            OperateOption operateOption = OperateOption.create();
 | 
	
		
			
				|  |  | +            operateOption.setVariableValue("afterconfirm", "true");
 | 
	
		
			
				|  |  | +            this.getView().invokeOperation("submit", operateOption);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.equals("ok", messageBoxClosedEvent.getCallBackId()) && MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
 | 
	
		
			
				|  |  | +            FormShowParameter showParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +            Map<String, Object> mapCustomParam = showParameter.getCustomParams();
 | 
	
		
			
				|  |  | +            int stauts = (Integer)mapCustomParam.get("status");
 | 
	
		
			
				|  |  | +            this.clickOk(this.getModel(), mapCustomParam, stauts, this.getView().getParentView(), this.getView().getParentView().getModel());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void afterDeleteRow(AfterDeleteRowEventArgs e) {
 | 
	
		
			
				|  |  | +        String name = e.getEntryProp().getName();
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.equals(name, "entryentity")) {
 | 
	
		
			
				|  |  | +            this.setExpenseEntryLableCount();
 | 
	
		
			
				|  |  | +            if (((DynamicObject)this.getModel().getDataEntity(true).getDynamicObjectCollection("tripentry").get(0)).getDynamicObjectCollection("entryentity").size() == 0) {
 | 
	
		
			
				|  |  | +                this.getView().setVisible(Boolean.FALSE, new String[]{"labelap_done", "labelap_edit"});
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            this.getView().updateView("entryentity");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void afterAddRow(AfterAddRowEventArgs e) {
 | 
	
		
			
				|  |  | +        String name = e.getEntryProp().getName();
 | 
	
		
			
				|  |  | +        if (org.apache.commons.lang3.StringUtils.equals(name, "entryentity")) {
 | 
	
		
			
				|  |  | +            this.setExpenseEntryLableCount();
 | 
	
		
			
				|  |  | +            this.getView().setVisible(Boolean.TRUE, new String[]{"labelap_edit"});
 | 
	
		
			
				|  |  | +            this.getView().setVisible(Boolean.FALSE, new String[]{"labelap_done"});
 | 
	
		
			
				|  |  | +            if (!org.apache.commons.lang3.StringUtils.equals((String)this.getModel().getValue("editentry"), "2") && ((DynamicObject)this.getModel().getDataEntity(true).getDynamicObjectCollection("tripentry").get(0)).getDynamicObjectCollection("entryentity").size() == 1) {
 | 
	
		
			
				|  |  | +                this.getModel().setValue("editentry", 0);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |