|
@@ -0,0 +1,3039 @@
|
|
|
|
+package fi.cas.formplugin;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import kd.bos.bill.BillShowParameter;
|
|
|
|
+import kd.bos.bill.OperationStatus;
|
|
|
|
+import kd.bos.context.RequestContext;
|
|
|
|
+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.resource.ResManager;
|
|
|
|
+import kd.bos.dataentity.serialization.SerializationUtils;
|
|
|
|
+import kd.bos.dataentity.utils.ObjectUtils;
|
|
|
|
+import kd.bos.dataentity.utils.StringUtils;
|
|
|
|
+import kd.bos.entity.AppMetadataCache;
|
|
|
|
+import kd.bos.entity.EntityMetadataCache;
|
|
|
|
+import kd.bos.entity.ValueMapItem;
|
|
|
|
+import kd.bos.entity.datamodel.*;
|
|
|
|
+import kd.bos.entity.datamodel.events.*;
|
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
+import kd.bos.entity.param.AppParam;
|
|
|
|
+import kd.bos.entity.property.ComboProp;
|
|
|
|
+import kd.bos.entity.property.EntryProp;
|
|
|
|
+import kd.bos.exception.KDBizException;
|
|
|
|
+import kd.bos.extplugin.PluginProxy;
|
|
|
|
+import kd.bos.form.*;
|
|
|
|
+import kd.bos.form.control.Control;
|
|
|
|
+import kd.bos.form.control.EntryGrid;
|
|
|
|
+import kd.bos.form.control.Image;
|
|
|
|
+import kd.bos.form.control.Label;
|
|
|
|
+import kd.bos.form.control.events.*;
|
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
|
+import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
|
+import kd.bos.form.events.ClosedCallBackEvent;
|
|
|
|
+import kd.bos.form.events.MessageBoxClosedEvent;
|
|
|
|
+import kd.bos.form.field.BasedataEdit;
|
|
|
|
+import kd.bos.form.field.ComboEdit;
|
|
|
|
+import kd.bos.form.field.ComboItem;
|
|
|
|
+import kd.bos.form.field.FieldEdit;
|
|
|
|
+import kd.bos.form.operate.AbstractOperate;
|
|
|
|
+import kd.bos.form.operate.FormOperate;
|
|
|
|
+import kd.bos.list.ListFilterParameter;
|
|
|
|
+import kd.bos.list.ListShowParameter;
|
|
|
|
+import kd.bos.logging.Log;
|
|
|
|
+import kd.bos.logging.LogFactory;
|
|
|
|
+import kd.bos.mvc.bill.BillModel;
|
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
|
+import kd.bos.orm.util.CollectionUtils;
|
|
|
|
+import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
|
+import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
|
|
|
|
+import kd.bos.servicehelper.parameter.SystemParamServiceHelper;
|
|
|
|
+import kd.fi.cas.business.errorcode.ReceivErrorCode;
|
|
|
|
+import kd.fi.cas.business.helper.PayBillHepler;
|
|
|
|
+import kd.fi.cas.business.helper.RecDraftHelper;
|
|
|
|
+import kd.fi.cas.business.helper.VisibleVirtualAcctHelper;
|
|
|
|
+import kd.fi.cas.business.paywarning.RecWarningHelper;
|
|
|
|
+import kd.fi.cas.enums.*;
|
|
|
|
+import kd.fi.cas.formplugin.ReceivingBillEdit;
|
|
|
|
+import kd.fi.cas.formplugin.common.CasBillEdit;
|
|
|
|
+import kd.fi.cas.helper.*;
|
|
|
|
+import kd.fi.cas.util.DateUtils;
|
|
|
|
+import kd.fi.cas.util.EmptyUtil;
|
|
|
|
+import kd.sdk.fi.cas.extpoint.recbill.IRecbillFilter;
|
|
|
|
+
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
+
|
|
|
|
+public class RecBillEditPlugin extends CasBillEdit implements ClickListener, EntryGridBindDataListener {
|
|
|
|
+ private static Log logger = LogFactory.getLog(ReceivingBillEdit.class);
|
|
|
|
+ private static final String CONFIRM_DEL_CALLBACK = "CONFIRM_DEL_CALLBACK";
|
|
|
|
+ private static final String CONFIRM_DELETE_CALLBACK = "CONFIRM_DELETE_CALLBACK";
|
|
|
|
+ private static final String KEY_CLOSECALLBACK_CHARGEBACK = "CALLBACK_SELECTDRAFT";
|
|
|
|
+ private static final String KEY_CLOSECALLBACK_CLEARRECEIVINGTYPECONFIRM = "clearReceivingTypeConfirm";
|
|
|
|
+ private static final String ENTRY = "entry";
|
|
|
|
+ private Set<String> settleTypes;
|
|
|
|
+
|
|
|
|
+ public RecBillEditPlugin() {
|
|
|
|
+ this.settleTypes = (Set) Stream.of(SettleMentTypeEnum.PROMISSORY.getValue(), SettleMentTypeEnum.CHECK.getValue(), SettleMentTypeEnum.DRAFT.getValue(), SettleMentTypeEnum.BUSINESS.getValue(), SettleMentTypeEnum.BANK.getValue()).collect(Collectors.toSet());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void initialize() {
|
|
|
|
+ super.initialize();
|
|
|
|
+ Control entryentity = this.getView().getControl("entry");
|
|
|
|
+ EntryGrid entry = (EntryGrid)entryentity;
|
|
|
|
+ entry.addDataBindListener(this);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterLoadData(EventObject e) {
|
|
|
|
+ super.afterLoadData(e);
|
|
|
|
+ String payertypeTypeID = this.getString("payertype");
|
|
|
|
+ if (payertypeTypeID.equals(AsstActTypeEnum.EMPLOYEE.getValue()) && CasHelper.isEmpty(this.getValue("f7_payerbank")) && CasHelper.isEmpty(this.getValue("payeracctbanknum"))) {
|
|
|
|
+ this.userF7Changed((PropertyChangedArgs)null, this.getValue("userf7"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FormShowParameter param = this.getView().getFormShowParameter();
|
|
|
|
+ OperationStatus status = param.getStatus();
|
|
|
|
+ if (status.equals(OperationStatus.VIEW)) {
|
|
|
|
+ this.getModel().setDataChanged(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void registerListener(EventObject e) {
|
|
|
|
+ super.registerListener(e);
|
|
|
|
+ this.addClickListeners(new String[]{"changepayee", "addpayerlb2", "addpayerlb1", "changepayer", "e_corebillno", "settletnumber"});
|
|
|
|
+ this.fillRecType();
|
|
|
|
+ this.fillEntryRecType();
|
|
|
|
+ this.fillPayeeAcctBank();
|
|
|
|
+ this.fillCurrency();
|
|
|
|
+ this.fillSettleOrg();
|
|
|
|
+ this.fillFundFlow();
|
|
|
|
+ this.expenseItem();
|
|
|
|
+ Object vtual = this.getModel().getValue("isvirtual");
|
|
|
|
+ if (vtual != null) {
|
|
|
|
+ Boolean isvirtual = (Boolean)vtual;
|
|
|
|
+ if (isvirtual) {
|
|
|
|
+ this.setVirtualSettlementTypeFilter();
|
|
|
|
+ } else {
|
|
|
|
+ this.setSettlementTypeFilter();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillEntryRecType() {
|
|
|
|
+ BasedataEdit receivabletypeF7 = (BasedataEdit)this.getControl("e_receivingtype");
|
|
|
|
+ receivabletypeF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
|
|
|
|
+ ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
|
|
|
|
+ QFilter qFilter = new QFilter("enable", "=", "1");
|
|
|
|
+ qFilter.and(new QFilter("biztype", "!=", "110"));
|
|
|
|
+ showParameter.getListFilterParameter().setFilter(qFilter);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void expenseItem() {
|
|
|
|
+ BasedataEdit orgCtrl = (BasedataEdit)this.getControl("e_expenseitem");
|
|
|
|
+ orgCtrl.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
|
|
|
|
+ ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
|
|
|
|
+ DynamicObject[] objects = BusinessDataServiceHelper.load("er_expenseitembill", "id,expenseitem", new QFilter[]{new QFilter("billtype.bill_number.number", "=", "nckd_cas_recbill_xz")});
|
|
|
|
+ if (!EmptyUtil.isEmpty(objects)) {
|
|
|
|
+ List<Object> ids = (List) Arrays.stream(objects).map((o) -> {
|
|
|
|
+ return o.get("expenseitem.id");
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ QFilter qFilter = new QFilter("id", "in", ids);
|
|
|
|
+ showParameter.getListFilterParameter().getQFilters().add(qFilter);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillFundFlow() {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected String getControlBankAcctForSettleType() {
|
|
|
|
+ return "accountbank";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillPayerType() {
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ DynamicObject receivingtype = (DynamicObject)this.getModel().getValue("receivingtype");
|
|
|
|
+ DynamicObject org = (DynamicObject)this.getModel().getValue("org");
|
|
|
|
+ boolean isSelectallpayertype = false;
|
|
|
|
+ if (EmptyUtil.isNoEmpty(org)) {
|
|
|
|
+ isSelectallpayertype = SystemParameterHelper.getParameterBoolean(org.getLong("id"), "selectallpayertype");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ComboEdit payertypeCbo = (ComboEdit)this.getView().getControl("payertype");
|
|
|
|
+ Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
|
|
|
+ String rectype = (String)customParams.get("recmentType");
|
|
|
|
+ if (rectype == null) {
|
|
|
|
+ Object type = this.getValue("biztype");
|
|
|
|
+ rectype = type != null ? type.toString() : "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ComboItem> comboItem = new ArrayList();
|
|
|
|
+ if (rectype.equals(RecTypeEnum.OtherRec.toString())) {
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.EMPLOYEE.getName()), AsstActTypeEnum.EMPLOYEE.getValue()));
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.CUSTOMER.getName()), AsstActTypeEnum.CUSTOMER.getValue()));
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.SUPPLIER.getName()), AsstActTypeEnum.SUPPLIER.getValue()));
|
|
|
|
+ if (multireceivingtype || EmptyUtil.isNoEmpty(receivingtype) && (!receivingtype.getBoolean("ispartreceivable") || receivingtype.getBoolean("ispartreceivable") && isSelectallpayertype)) {
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.OTHER.getName()), AsstActTypeEnum.OTHER.getValue()));
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.COMPANY.getName()), AsstActTypeEnum.COMPANY.getValue()));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.CUSTOMER.getName()), AsstActTypeEnum.CUSTOMER.getValue()));
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.SUPPLIER.getName()), AsstActTypeEnum.SUPPLIER.getValue()));
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.EMPLOYEE.getName()), AsstActTypeEnum.EMPLOYEE.getValue()));
|
|
|
|
+ if (multireceivingtype || EmptyUtil.isNoEmpty(receivingtype) && receivingtype.getBoolean("ispartreceivable") && isSelectallpayertype) {
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.OTHER.getName()), AsstActTypeEnum.OTHER.getValue()));
|
|
|
|
+ comboItem.add(new ComboItem(new LocaleString(AsstActTypeEnum.COMPANY.getName()), AsstActTypeEnum.COMPANY.getValue()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ payertypeCbo.setComboItems(comboItem);
|
|
|
|
+ Object value = this.getModel().getValue("payertype");
|
|
|
|
+ boolean ishave = false;
|
|
|
|
+ Iterator var11 = comboItem.iterator();
|
|
|
|
+
|
|
|
|
+ while(var11.hasNext()) {
|
|
|
|
+ ComboItem combo = (ComboItem)var11.next();
|
|
|
|
+ if (value != null && combo.getValue().equals(value)) {
|
|
|
|
+ ishave = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!ishave) {
|
|
|
|
+ this.getModel().setValue("payertype", (Object)null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillCurrency() {
|
|
|
|
+ BasedataEdit currencyF7 = (BasedataEdit)this.getControl("currency");
|
|
|
|
+ currencyF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
|
|
|
|
+ ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
|
|
|
|
+ QFilter qFilter = new QFilter("enable", "=", "1");
|
|
|
|
+ DynamicObject settleType = this.getDynamicObject("settletype");
|
|
|
|
+ boolean isCash = BaseDataHelper.isSettleTypeCash(settleType);
|
|
|
|
+ Collection<Long> currencyPks = new ArrayList();
|
|
|
|
+ DynamicObject accountCash;
|
|
|
|
+ if (isCash) {
|
|
|
|
+ accountCash = this.getDynamicObject("accountcash");
|
|
|
|
+ if (accountCash != null) {
|
|
|
|
+ currencyPks = AccountCashHelper.getCurrencys(Collections.singletonList((Long)accountCash.getPkValue()));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ accountCash = this.getDynamicObject("accountbank");
|
|
|
|
+ if (accountCash != null) {
|
|
|
|
+ currencyPks = AccountBankHelper.getCurrencyPks(accountCash.getLong("id"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ qFilter = qFilter.and(new QFilter("id", "in", currencyPks));
|
|
|
|
+ showParameter.getListFilterParameter().setFilter(qFilter);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillSettleOrg() {
|
|
|
|
+ BasedataEdit settleorg = (BasedataEdit)this.getControl("e_settleorg");
|
|
|
|
+ settleorg.addBeforeF7SelectListener((select) -> {
|
|
|
|
+ ListShowParameter showParam = (ListShowParameter)select.getFormShowParameter();
|
|
|
|
+ showParam.setCustomParam("orgFuncId", "10");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void propertyChanged(PropertyChangedArgs e) {
|
|
|
|
+ String key = e.getProperty().getName();
|
|
|
|
+ ChangeData[] changeData = e.getChangeSet();
|
|
|
|
+ Object newValue = changeData[0].getNewValue();
|
|
|
|
+ Object oldValue = changeData[0].getOldValue();
|
|
|
|
+ int iRow = changeData[0].getRowIndex();
|
|
|
|
+ if (newValue != oldValue) {
|
|
|
|
+ switch (key) {
|
|
|
|
+ case "isagent":
|
|
|
|
+ this.setAgent((Boolean)newValue);
|
|
|
|
+ break;
|
|
|
|
+ case "org":
|
|
|
|
+ this.setOpenOrg();
|
|
|
|
+ this.controlRecAmt();
|
|
|
|
+ this.fillPayerType();
|
|
|
|
+ this.resetExrateTableWhenSwitchOrg(newValue);
|
|
|
|
+ break;
|
|
|
|
+ case "accountbank":
|
|
|
|
+ this.payeeAcctBankF7Changed(e, newValue);
|
|
|
|
+ break;
|
|
|
|
+ case "accountcash":
|
|
|
|
+ this.accountCashChanged();
|
|
|
|
+ break;
|
|
|
|
+ case "currency":
|
|
|
|
+ this.currencyF7Changed();
|
|
|
|
+ this.updateCoreBill(true, -1);
|
|
|
|
+ break;
|
|
|
|
+ case "bizdate":
|
|
|
|
+ this.exratedateChanged(newValue);
|
|
|
|
+ this.currencyF7Changed();
|
|
|
|
+ break;
|
|
|
|
+ case "exratetable":
|
|
|
|
+ this.currencyF7Changed();
|
|
|
|
+ break;
|
|
|
|
+ case "exratedate":
|
|
|
|
+ this.currencyF7Changed();
|
|
|
|
+ break;
|
|
|
|
+ case "payertype":
|
|
|
|
+ this.payerTypeChanged(e, newValue, true);
|
|
|
|
+ this.updateCoreBill(true, -1);
|
|
|
|
+ break;
|
|
|
|
+ case "exchangerate":
|
|
|
|
+ case "quotation":
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ break;
|
|
|
|
+ case "userf7":
|
|
|
|
+ this.userF7Changed(e, newValue);
|
|
|
|
+ break;
|
|
|
|
+ case "billstatus":
|
|
|
|
+ this.fillToolBar();
|
|
|
|
+ break;
|
|
|
|
+ case "e_actamt":
|
|
|
|
+ case "e_receivableamt":
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ break;
|
|
|
|
+ case "e_discountamt":
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ break;
|
|
|
|
+ case "receivingtype":
|
|
|
|
+ this.receivingTypeChanged(oldValue, newValue);
|
|
|
|
+ this.setSettleOrg(false);
|
|
|
|
+ this.setEcorebilltype();
|
|
|
|
+ this.fillPayerType();
|
|
|
|
+ this.setEntryExpenseitemEnable();
|
|
|
|
+ break;
|
|
|
|
+ case "settletype":
|
|
|
|
+ this.settleTypeChanged((DynamicObject)newValue);
|
|
|
|
+ this.isClearSettleType((DynamicObject)oldValue, (DynamicObject)newValue);
|
|
|
|
+ break;
|
|
|
|
+ case "fee":
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ break;
|
|
|
|
+ case "e_fee":
|
|
|
|
+ this.calculateFee(iRow);
|
|
|
|
+ break;
|
|
|
|
+ case "e_corebilltype":
|
|
|
|
+ int index = this.getModel().getEntryCurrentRowIndex("entry");
|
|
|
|
+ this.updateCoreBill(false, index);
|
|
|
|
+ this.getModel().setValue("e_corebillno", (Object)null, index);
|
|
|
|
+ this.getModel().setValue("e_corebillentryseq", (Object)null, index);
|
|
|
|
+ this.getModel().setValue("conbillentity", (Object)null, index);
|
|
|
|
+ this.getModel().setValue("conbillnumber", (Object)null, index);
|
|
|
|
+ this.getModel().setValue("conbillrownum", (Object)null, index);
|
|
|
|
+ break;
|
|
|
|
+ case "e_corebillno":
|
|
|
|
+ if (EmptyUtil.isEmpty(e.getChangeSet()[0].getNewValue())) {
|
|
|
|
+ int entryIndex = this.getModel().getEntryCurrentRowIndex("entry");
|
|
|
|
+ this.updateCoreBill(false, entryIndex);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "multireceivingtype":
|
|
|
|
+ this.dealMultiReceType(newValue);
|
|
|
|
+ this.setEntryExpenseitemEnable();
|
|
|
|
+ this.setEcorebilltype();
|
|
|
|
+ break;
|
|
|
|
+ case "e_receivingtype":
|
|
|
|
+ this.dealEntryReceType(newValue, iRow);
|
|
|
|
+ break;
|
|
|
|
+ case "payeracctbank":
|
|
|
|
+ this.fillInnerAccount(newValue);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillInnerAccount(Object newValue) {
|
|
|
|
+ if (newValue != null) {
|
|
|
|
+ Long payeracctbankId = (Long)newValue;
|
|
|
|
+ DynamicObject accountbank = this.getModel().getDataEntity().getDynamicObject("accountbank");
|
|
|
|
+ DynamicObject receivingtype = this.getModel().getDataEntity().getDynamicObject("receivingtype");
|
|
|
|
+ if (receivingtype != null && accountbank != null) {
|
|
|
|
+ String biztype = receivingtype.getString("biztype");
|
|
|
|
+ if ("108".equals(biztype)) {
|
|
|
|
+ QFilter qFilter = new QFilter("enable", "=", "1");
|
|
|
|
+ qFilter.and("entryentity.e_account", "=", payeracctbankId);
|
|
|
|
+ qFilter.and("entryentity.e_parentacct", "=", accountbank.getPkValue());
|
|
|
|
+ DynamicObject linkPayRelation = BusinessDataServiceHelper.loadSingle("am_linkpayrelation", "entryentity,entryentity.e_internalacct,entryentity.e_parentacct,entryentity.e_account", new QFilter[]{qFilter});
|
|
|
|
+ if (linkPayRelation != null) {
|
|
|
|
+ DynamicObjectCollection entries = linkPayRelation.getDynamicObjectCollection("entryentity");
|
|
|
|
+ Iterator var9 = entries.iterator();
|
|
|
|
+
|
|
|
|
+ while(var9.hasNext()) {
|
|
|
|
+ DynamicObject entrie = (DynamicObject)var9.next();
|
|
|
|
+ DynamicObject e_account = entrie.getDynamicObject("e_account");
|
|
|
|
+ DynamicObject e_parentacct = entrie.getDynamicObject("e_parentacct");
|
|
|
|
+ if (e_account != null && e_parentacct != null && e_account.getPkValue().equals(payeracctbankId) && e_parentacct.getPkValue().equals(accountbank.getPkValue())) {
|
|
|
|
+ DynamicObject e_internalacct = entrie.getDynamicObject("e_internalacct");
|
|
|
|
+ if (e_internalacct != null) {
|
|
|
|
+ this.getModel().setValue("inneraccount", e_internalacct);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void dealEntryReceType(Object newValue, int iRow) {
|
|
|
|
+ DynamicObject e_receivingtype = (DynamicObject)newValue;
|
|
|
|
+ if (!EmptyUtil.isEmpty(e_receivingtype)) {
|
|
|
|
+ DynamicObject fundflowitem = e_receivingtype.getDynamicObject("fundflowitem");
|
|
|
|
+ if (!EmptyUtil.isEmpty(fundflowitem)) {
|
|
|
|
+ this.setValue("e_fundflowitem", fundflowitem.getPkValue(), iRow);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setEntryExpenseitemEnable() {
|
|
|
|
+ String rectype = (String)this.getModel().getValue("biztype");
|
|
|
|
+ DynamicObject receivingtype = this.getDynamicObject("receivingtype");
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ if (multireceivingtype || rectype.equals(RecTypeEnum.OtherRec.toString()) && EmptyUtil.isNoEmpty(receivingtype) && !receivingtype.getBoolean("ispartreceivable")) {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"e_material"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void dealMultiReceType(Object newValue) {
|
|
|
|
+ boolean ishave = false;
|
|
|
|
+ String rectype = (String)this.getModel().getValue("biztype");
|
|
|
|
+ DynamicObject receivingtype = this.getDynamicObject("receivingtype");
|
|
|
|
+ boolean multireceivingtype = (Boolean)newValue;
|
|
|
|
+ if (multireceivingtype) {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"e_settleorg"});
|
|
|
|
+ QFilter qFilter = new QFilter("biztype", "=", "110");
|
|
|
|
+ qFilter.and("default", "=", '1');
|
|
|
|
+ qFilter.and("enable", "=", "1");
|
|
|
|
+ DynamicObject[] payMentBillTypes = BusinessDataServiceHelper.load("cas_receivingbilltype", "id,name,number,ispartpayment,biztype", qFilter.toArray());
|
|
|
|
+ if (EmptyUtil.isEmpty(payMentBillTypes)) {
|
|
|
|
+ this.getModel().setValue("receivingtype", (Object)null);
|
|
|
|
+ } else {
|
|
|
|
+ this.getModel().setValue("receivingtype", payMentBillTypes[0]);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ if (count == 0) {
|
|
|
|
+ this.getModel().setValue("receivingtype", (Object)null);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject e_paymenttype = (DynamicObject)this.getModel().getValue("e_receivingtype", i);
|
|
|
|
+ if (EmptyUtil.isNoEmpty(e_paymenttype)) {
|
|
|
|
+ ishave = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (ishave) {
|
|
|
|
+ this.getView().showConfirm(ResManager.loadKDString("关闭多收款类型将自动清空收款明细收款类型,请确认是否继续?", "ReceivingBillEdit_35", "fi-cas-formplugin", new Object[0]), MessageBoxOptions.OKCancel, new ConfirmCallBackListener("clearReceivingTypeConfirm", this));
|
|
|
|
+ } else {
|
|
|
|
+ this.getModel().setValue("receivingtype", (Object)null);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void isClearSettleType(DynamicObject oldValue, DynamicObject newValue) {
|
|
|
|
+ String settletnumber = (String)this.getModel().getValue("settletnumber");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(settletnumber) && Objects.nonNull(oldValue) && SettleMentTypeEnum.CREDIT.getValue().equals(oldValue.getString("settlementtype")) && Objects.nonNull(newValue) && !SettleMentTypeEnum.CREDIT.getValue().equals(newValue.getString("settlementtype"))) {
|
|
|
|
+ this.getModel().setValue("settletnumber", (Object)null);
|
|
|
|
+ this.getModel().setValue("sourcebilltype", (Object)null);
|
|
|
|
+ this.getModel().setValue("sourcebillid", (Object)null);
|
|
|
|
+ this.getModel().deleteEntryData("billhead_lk");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void updateCoreBill(boolean isClearAll, int entryIndex) {
|
|
|
|
+ DynamicObjectCollection entrys = this.getModel().getEntryEntity("entry");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(entrys)) {
|
|
|
|
+ for(int i = 0; i < entrys.size(); ++i) {
|
|
|
|
+ if (isClearAll || entryIndex == i) {
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ this.getModel().setValue("e_corebillno", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("e_corebillentryseq", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("e_corebillid", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("e_sourcebillentryid", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("e_sourcebillid", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("conbillentity", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("conbillnumber", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("conbillrownum", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("conbillid", (Object)null, i);
|
|
|
|
+ this.getModel().setValue("conbillentryid", (Object)null, i);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("e_corebillno", i);
|
|
|
|
+ this.getView().updateView("e_corebillentryseq", i);
|
|
|
|
+ this.getView().updateView("e_corebillid", i);
|
|
|
|
+ this.getView().updateView("e_sourcebillentryid", i);
|
|
|
|
+ this.getView().updateView("e_sourcebillid", i);
|
|
|
|
+ this.getView().updateView("conbillentity", i);
|
|
|
|
+ this.getView().updateView("conbillnumber", i);
|
|
|
|
+ this.getView().updateView("conbillrownum", i);
|
|
|
|
+ this.getView().updateView("conbillid", i);
|
|
|
|
+ this.getView().updateView("conbillentryid", i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean isOpenSelectCorebill(Object corebilltype) {
|
|
|
|
+ return !corebilltype.equals("ar_finarbill") && !corebilltype.equals("sm_salorder") && !corebilltype.equals("cas_paybill") && !corebilltype.equals("er_repaymentbill") && !corebilltype.equals("fr_glreim_recbill") && !corebilltype.equals("conm_salcontract");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getCorebilltypeToChange() {
|
|
|
|
+ int iRow = this.getModel().getEntryCurrentRowIndex("entry");
|
|
|
|
+ Object corebilltype = this.getModel().getValue("e_corebilltype", iRow);
|
|
|
|
+ if (corebilltype != null && !"".equals(corebilltype)) {
|
|
|
|
+ if (!this.isOpenSelectCorebill(corebilltype)) {
|
|
|
|
+ ListShowParameter lsp = null;
|
|
|
|
+ Object accountcurrency;
|
|
|
|
+ if (corebilltype.equals("er_repaymentbill")) {
|
|
|
|
+ FormShowParameter para = new FormShowParameter();
|
|
|
|
+ para.setFormId("cas_repaymentbill");
|
|
|
|
+ para.setCustomParam("openSource", "nckd_cas_recbill_xz");
|
|
|
|
+ Object payertype = this.getValue("payertype");
|
|
|
|
+ if (EmptyUtil.isEmpty(payertype)) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("核心单据类型为还款单,请先指定付款人类型", "ReceivingBillEdit_22", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ } else {
|
|
|
|
+ para.setCustomParam("payertype", payertype);
|
|
|
|
+ Object payername = null;
|
|
|
|
+ if ("other".equals(payertype)) {
|
|
|
|
+ payername = this.getValue("payername");
|
|
|
|
+ } else {
|
|
|
|
+ payername = this.getValue("payer");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (CasHelper.isEmpty(payername)) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("核心单据类型为还款单,请先指定付款方", "ReceivingBillEdit_23", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ } else {
|
|
|
|
+ para.setCustomParam("payername", payername);
|
|
|
|
+ accountcurrency = this.getValue("currency");
|
|
|
|
+ if (EmptyUtil.isEmpty(accountcurrency)) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("核心单据类型为还款单,请先指定币种", "ReceivingBillEdit_24", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ } else {
|
|
|
|
+ para.setCustomParam("accountcurrency", ((DynamicObject)accountcurrency).getPkValue());
|
|
|
|
+ para.getOpenStyle().setShowType(ShowType.Modal);
|
|
|
|
+ para.setShowTitle(true);
|
|
|
|
+ para.setStatus(OperationStatus.ADDNEW);
|
|
|
|
+ StyleCss css = new StyleCss();
|
|
|
|
+ css.setWidth("960");
|
|
|
|
+ css.setHeight("580");
|
|
|
|
+ para.getOpenStyle().setInlineStyleCss(css);
|
|
|
|
+ para.getOpenStyle().setShowType(ShowType.Modal);
|
|
|
|
+ para.setCloseCallBack(new CloseCallBack(this, "e_corebillno"));
|
|
|
|
+ this.getView().showForm(para);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ lsp = ShowFormHelper.createShowListForm(String.valueOf(corebilltype), true, 2);
|
|
|
|
+ ListFilterParameter lfp = new ListFilterParameter();
|
|
|
|
+ Object settleOrg3;
|
|
|
|
+ switch (String.valueOf(corebilltype)) {
|
|
|
|
+ case "ar_finarbill":
|
|
|
|
+ accountcurrency = this.getModel().getValue("e_settleorg", iRow);
|
|
|
|
+ if (accountcurrency == null) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先填写结算组织。", "ReceivingBillEdit_16", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object pkValue = ((DynamicObject)accountcurrency).getPkValue();
|
|
|
|
+ lfp.setFilter(new QFilter("org", "=", pkValue));
|
|
|
|
+ lfp.setFilter(new QFilter("billstatus", "=", BillStatusEnum.AUDIT.getValue()));
|
|
|
|
+ lfp.setFilter(new QFilter("settlestatus", "in", new String[]{"unsettle", "partsettle"}));
|
|
|
|
+ break;
|
|
|
|
+ case "sm_salorder":
|
|
|
|
+ Object e_settleorg1 = this.getModel().getValue("e_settleorg", iRow);
|
|
|
|
+ if (e_settleorg1 == null) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先填写结算组织。", "ReceivingBillEdit_16", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object pkValue1 = ((DynamicObject)e_settleorg1).getPkValue();
|
|
|
|
+ lfp.setFilter(new QFilter("billentry.entrysettleorg", "=", pkValue1));
|
|
|
|
+ Object payer = this.getModel().getValue("payer");
|
|
|
|
+ lfp.setFilter(new QFilter("customer", "=", !ObjectUtils.isEmpty(payer) ? payer : 0L));
|
|
|
|
+ lfp.setFilter(new QFilter("billstatus", "=", BillStatusEnum.AUDIT.getValue()));
|
|
|
|
+ lfp.setFilter(new QFilter("changestatus", "<>", "B"));
|
|
|
|
+ lfp.setFilter(QFilter.of(" receiptamount < totalallamount ", new Object[0]));
|
|
|
|
+ break;
|
|
|
|
+ case "conm_salcontract":
|
|
|
|
+ Object e_settleorg2 = this.getModel().getValue("e_settleorg", iRow);
|
|
|
|
+ if (e_settleorg2 == null) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先填写结算组织。", "ReceivingBillEdit_16", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object pkValue2 = ((DynamicObject)e_settleorg2).getPkValue();
|
|
|
|
+ lfp.setFilter(new QFilter("billentry.entrysettleorg", "=", pkValue2));
|
|
|
|
+ Object payer1 = this.getModel().getValue("payer");
|
|
|
|
+ lfp.setFilter(new QFilter("customer", "=", !ObjectUtils.isEmpty(payer1) ? payer1 : 0L));
|
|
|
|
+ lfp.setFilter(new QFilter("validstatus", "<>", "A"));
|
|
|
|
+ lfp.setFilter(new QFilter("changestatus", "<>", "B"));
|
|
|
|
+ lfp.setFilter(QFilter.of(" receiptallamount < totalallamount ", new Object[0]));
|
|
|
|
+ break;
|
|
|
|
+ case "cas_paybill":
|
|
|
|
+ DynamicObject recType = this.getDynamicObject("e_receivingtype", iRow);
|
|
|
|
+ boolean isAr = recType.getBoolean("ispartreceivable");
|
|
|
|
+ DynamicObject payerAcctBank;
|
|
|
|
+ if (isAr) {
|
|
|
|
+ settleOrg3 = this.getModel().getValue("e_settleorg", iRow);
|
|
|
|
+ if (settleOrg3 == null) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先填写结算组织。", "ReceivingBillEdit_16", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ payerAcctBank = (DynamicObject)this.getModel().getValue("currency");
|
|
|
|
+ lfp.setQFilters(this.getRecTypePayBillFilter(payerAcctBank, (DynamicObject)settleOrg3));
|
|
|
|
+ } else {
|
|
|
|
+ lfp.setFilter(new QFilter("billstatus", "=", "D"));
|
|
|
|
+ boolean isCash = BaseDataHelper.isSettleTypeCash((DynamicObject)this.getModel().getValue("settletype"));
|
|
|
|
+ payerAcctBank = this.getDynamicObject("accountbank");
|
|
|
|
+ DynamicObject accountCash = this.getDynamicObject("accountcash");
|
|
|
|
+ QFilter payeracctbank = null;
|
|
|
|
+ if (isCash && accountCash != null) {
|
|
|
|
+ payeracctbank = new QFilter("payeracctcash", "=", accountCash.getPkValue());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isCash && payerAcctBank != null) {
|
|
|
|
+ payeracctbank = new QFilter("payeracctbank", "=", payerAcctBank.getPkValue());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (EmptyUtil.isEmpty(payeracctbank)) {
|
|
|
|
+ payeracctbank = (new QFilter("payeracctcash", "=", (Object)null)).and(new QFilter("payeracctbank", "=", (Object)null));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lfp.setFilter(payeracctbank);
|
|
|
|
+ String payerType = (String)this.getModel().getValue("payertype");
|
|
|
|
+ if ("other".equals(payerType)) {
|
|
|
|
+ lfp.setFilter(new QFilter("payeename", "=", this.getModel().getValue("payername")));
|
|
|
|
+ } else {
|
|
|
|
+ lfp.setFilter(new QFilter("payee", "=", this.getModel().getValue("payer")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "fr_glreim_recbill":
|
|
|
|
+ settleOrg3 = this.getModel().getValue("org", iRow);
|
|
|
|
+ if (settleOrg3 == null) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先选择收款组织。", "ReceivingBillEdit_16_1", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object orgPkValue = ((DynamicObject)settleOrg3).getPkValue();
|
|
|
|
+ lfp.setFilter(new QFilter("accountingorg", "=", orgPkValue));
|
|
|
|
+ lfp.setFilter(new QFilter("billstatus", "=", "D"));
|
|
|
|
+ lfp.setFilter(new QFilter("castorecamount", ">=", 0));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setIFilters(lfp, this.getModel().getDataEntity());
|
|
|
|
+ if (ClaimCoreBillTypeEnum.SALCONTRACT.getValue().equals(corebilltype)) {
|
|
|
|
+ lfp.setSelectEntity("payentry");
|
|
|
|
+ } else if (ClaimCoreBillTypeEnum.SALORDER.getValue().equals(corebilltype)) {
|
|
|
|
+ lfp.setSelectEntity("recplanentry");
|
|
|
|
+ } else if (ClaimCoreBillTypeEnum.FINARBILL.getValue().equals(corebilltype)) {
|
|
|
|
+ lfp.setSelectEntity("entry");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lsp.setCustomParam("ismergerows", Boolean.FALSE);
|
|
|
|
+ lsp.setListFilterParameter(lfp);
|
|
|
|
+ CloseCallBack closeCallBack = new CloseCallBack(this, "e_corebillno");
|
|
|
|
+ lsp.setCloseCallBack(closeCallBack);
|
|
|
|
+ this.getView().showForm(lsp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请先指定核心单据类型。", "ReceivingBillEdit_15", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<QFilter> getRecTypePayBillFilter(DynamicObject currency, DynamicObject settleorg) {
|
|
|
|
+ List<QFilter> qFilters = new ArrayList();
|
|
|
|
+ qFilters.add(new QFilter("paymenttype.ispartpayment", "=", "1"));
|
|
|
|
+ qFilters.add(new QFilter("dpcurrency", "=", currency.getPkValue()));
|
|
|
|
+ qFilters.add(new QFilter("billstatus", "=", "D"));
|
|
|
|
+ qFilters.add(new QFilter("entry.settleorg", "=", settleorg.getPkValue()));
|
|
|
|
+ return qFilters;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void settleNumberClick() {
|
|
|
|
+ DynamicObject settleType = (DynamicObject)this.getModel().getValue("settletype");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(settleType) && SettleMentTypeEnum.CREDIT.getValue().equals(settleType.getString("settlementtype"))) {
|
|
|
|
+ String appId = AppMetadataCache.getAppInfo("lc").getId();
|
|
|
|
+ DynamicObject org = (DynamicObject)this.getModel().getValue("org");
|
|
|
|
+ AppParam param = new AppParam();
|
|
|
|
+ param.setAppId(appId);
|
|
|
|
+ param.setOrgId(org.getLong("id"));
|
|
|
|
+ param.setViewType("08");
|
|
|
|
+ String recmethod = (String) SystemParamServiceHelper.loadAppParameterFromCache(param, "recmethod");
|
|
|
|
+ if ("0".equals(recmethod)) {
|
|
|
|
+ CloseCallBack closeCallBack = new CloseCallBack(this, "settletnumber");
|
|
|
|
+ QFilter qFilterSour = new QFilter("arrivalstatus", "=", "present_confirm");
|
|
|
|
+ qFilterSour.and("arrivalway", "!=", "protest");
|
|
|
|
+ qFilterSour.and(QFilter.sqlExpress("arrivalamount", ">", "flockamount"));
|
|
|
|
+ CasBotpHelper.doBeforeDraw(this.getView(), "lc_present", this.getModel().getDataEntityType().getName(), false, qFilterSour, closeCallBack);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void exratedateChanged(Object newValue) {
|
|
|
|
+ if (newValue != null) {
|
|
|
|
+ this.setValue("exratedate", newValue);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void accountCashChanged() {
|
|
|
|
+ DynamicObject accountCash = this.getDynamicObject("accountcash");
|
|
|
|
+ if (accountCash == null) {
|
|
|
|
+ if (!this.isBotpCreate()) {
|
|
|
|
+ this.setValue("currency", this.getDynamicObject("basecurrency"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ boolean containCurrency = AccountBankHelper.isAcctBankContainCurrency("cas_accountcash", accountCash.getPkValue(), currency);
|
|
|
|
+ if (!containCurrency) {
|
|
|
|
+ DynamicObject defaultCurrency = accountCash.getDynamicObject("defaultcurrency");
|
|
|
|
+ if (this.isBotpCreate()) {
|
|
|
|
+ this.setValueIfAbsent("currency", defaultCurrency);
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("currency", defaultCurrency);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setCurrencyEditable();
|
|
|
|
+ this.setValue("openorg", accountCash.getDynamicObject("openorg"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void settleTypeChanged(DynamicObject settleType) {
|
|
|
|
+ if (BaseDataHelper.isSettleTypeCash(settleType)) {
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ this.setValue("accountbank", (Object)null);
|
|
|
|
+ this.setValue("payeebank", (Object)null);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.setValue("accountcash", AccountCashHelper.getDefaultAccountcash(this.getPk("org"), "payee"));
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("accountcash", (Object)null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (BaseDataHelper.isSettleTypeMatch(settleType)) {
|
|
|
|
+ this.setValue("matchflag", AutoMatchFlagEnum.NONEED.getValue());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setPayeeInfo4Lb();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void receivingTypeChanged(Object oldValue, Object newValue) {
|
|
|
|
+ DynamicObject newobject = (DynamicObject)newValue;
|
|
|
|
+ DynamicObject oldobject = (DynamicObject)oldValue;
|
|
|
|
+ if (newobject != null && oldobject != null && newobject.getBoolean("ispartreceivable") != oldobject.getBoolean("ispartreceivable")) {
|
|
|
|
+ this.addEntryCache();
|
|
|
|
+ this.getModel().deleteEntryData("entry");
|
|
|
|
+ this.getModel().createNewEntryRow("entry");
|
|
|
|
+ this.setValue("actrecamt", BigDecimal.ZERO);
|
|
|
|
+ this.setValue("localamt", BigDecimal.ZERO);
|
|
|
|
+ this.getEntryCache();
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.fillFundflowItem(true);
|
|
|
|
+ this.setEntryAmountCaption();
|
|
|
|
+ boolean multireceivingtype = this.getModel().getDataEntity().getBoolean("multireceivingtype");
|
|
|
|
+ if (!multireceivingtype) {
|
|
|
|
+ for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
|
|
|
|
+ this.setValue("e_receivingtype", newobject, i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setEntryAmountCaption() {
|
|
|
|
+ DynamicObject recType = this.getDynamicObject("receivingtype");
|
|
|
|
+ if (recType != null) {
|
|
|
|
+ boolean isAr = recType.getBoolean("ispartreceivable");
|
|
|
|
+ if (isAr) {
|
|
|
|
+ EntryGrid entryCtr = (EntryGrid)this.getControl("entry");
|
|
|
|
+ entryCtr.setColumnProperty("e_receivableamt", "header", new LocaleString(ResManager.loadKDString("应收金额", "ReceivingBillEdit_0", "fi-cas-formplugin", new Object[0])));
|
|
|
|
+ entryCtr.setColumnProperty("e_receivablelocamt", "header", new LocaleString(ResManager.loadKDString("应收折本币", "ReceivingBillEdit_1", "fi-cas-formplugin", new Object[0])));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void addEntryCache() {
|
|
|
|
+ DynamicObjectCollection entry = this.getModel().getEntryEntity("entry");
|
|
|
|
+ List<Map<String, Object>> list = new ArrayList();
|
|
|
|
+ Iterator var3 = entry.iterator();
|
|
|
|
+
|
|
|
|
+ while(var3.hasNext()) {
|
|
|
|
+ DynamicObject row = (DynamicObject)var3.next();
|
|
|
|
+ Map<String, Object> map = new HashMap();
|
|
|
|
+ map.put("e_expenseitem", row.get("e_expenseitem") == null ? null : ((DynamicObject)row.get("e_expenseitem")).getPkValue());
|
|
|
|
+ map.put("e_receivableamt", row.get("e_receivableamt"));
|
|
|
|
+ map.put("project", row.get("project") == null ? null : row.getDynamicObject("project").getPkValue());
|
|
|
|
+ map.put("e_fundflowitem", row.get("e_fundflowitem") == null ? null : row.getDynamicObject("e_fundflowitem").getPkValue());
|
|
|
|
+ map.put("e_remark", row.get("e_remark"));
|
|
|
|
+ map.put("e_receivingtype", row.get("e_receivingtype") == null ? null : row.getDynamicObject("e_receivingtype").getPkValue());
|
|
|
|
+ list.add(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, List<Map<String, Object>>> map = new HashMap();
|
|
|
|
+ map.put("entry", list);
|
|
|
|
+ String mapJson = SerializationUtils.toJsonString(map);
|
|
|
|
+ this.getPageCache().put("entry", mapJson);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getEntryCache() {
|
|
|
|
+ String str_json = this.getPageCache().get("entry");
|
|
|
|
+ if (str_json != null) {
|
|
|
|
+ this.getModel().deleteEntryRow("entry", 0);
|
|
|
|
+ TableValueSetter vs = new TableValueSetter(new String[0]);
|
|
|
|
+ vs.addField("e_expenseitem", new Object[0]).addField("e_receivableamt", new Object[0]).addField("project", new Object[0]).addField("e_fundflowitem", new Object[0]).addField("e_remark", new Object[0]).addField("e_receivingtype", new Object[0]);
|
|
|
|
+ Map<String, ArrayList<Map<String, String>>> maps = (Map)SerializationUtils.fromJsonString(str_json, Map.class);
|
|
|
|
+ ArrayList<Map<String, String>> list = (ArrayList)maps.get("entry");
|
|
|
|
+ Iterator var5 = list.iterator();
|
|
|
|
+
|
|
|
|
+ while(var5.hasNext()) {
|
|
|
|
+ Map<String, String> map = (Map)var5.next();
|
|
|
|
+ vs.addRow(new Object[]{map.get("e_expenseitem"), map.get("e_receivableamt"), map.get("project"), map.get("e_fundflowitem"), map.get("e_remark"), map.get("e_receivingtype")});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AbstractFormDataModel model = (AbstractFormDataModel)this.getModel();
|
|
|
|
+ model.batchCreateNewEntryRow("entry", vs);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setAgent(boolean newValue) {
|
|
|
|
+ if (!newValue) {
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ this.setValue("realreccompany", (Object)null, i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void userF7Changed(PropertyChangedArgs e, Object newValue) {
|
|
|
|
+ DynamicObject user = (DynamicObject)newValue;
|
|
|
|
+ if (user != null) {
|
|
|
|
+ DynamicObject erPayeeInfo = this.getErPayeeInfo(user.getLong("id"), user.get("name").toString());
|
|
|
|
+ if (erPayeeInfo != null) {
|
|
|
|
+ this.setValue("f7_payerbank", erPayeeInfo.getDynamicObject("payerbank"));
|
|
|
|
+ this.setValue("payeracctbanknum", erPayeeInfo.getString("payeraccount"));
|
|
|
|
+ this.setValue("payeraccformid", "er_payeer");
|
|
|
|
+ this.setValue("payeracctbank", erPayeeInfo.getLong("id"));
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("payeracctbanknum", (Object)null);
|
|
|
|
+ this.setValue("f7_payerbank", (Object)null);
|
|
|
|
+ this.setValue("payeraccformid", (Object)null);
|
|
|
|
+ this.setValue("payeracctbank", (Object)null);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("payeracctbanknum", (Object)null);
|
|
|
|
+ this.setValue("f7_payerbank", (Object)null);
|
|
|
|
+ this.setValue("payeraccformid", (Object)null);
|
|
|
|
+ this.setValue("payeracctbank", (Object)null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void click(EventObject evt) {
|
|
|
|
+ super.click(evt);
|
|
|
|
+ Control c = (Control)evt.getSource();
|
|
|
|
+ switch (c.getKey().toLowerCase()) {
|
|
|
|
+ case "changepayee":
|
|
|
|
+ this.changePayeePage();
|
|
|
|
+ break;
|
|
|
|
+ case "addpayerlb1":
|
|
|
|
+ case "addpayerlb2":
|
|
|
|
+ this.addPayer(OperationStatus.ADDNEW);
|
|
|
|
+ break;
|
|
|
|
+ case "changepayer":
|
|
|
|
+ this.addPayer(OperationStatus.EDIT);
|
|
|
|
+ break;
|
|
|
|
+ case "e_corebillno":
|
|
|
|
+ this.getCorebilltypeToChange();
|
|
|
|
+ break;
|
|
|
|
+ case "settletnumber":
|
|
|
|
+ this.settleNumberClick();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void addPayer(OperationStatus status) {
|
|
|
|
+ Map<String, Object> paramMap = new HashMap();
|
|
|
|
+ if (this.isHwControl()) {
|
|
|
|
+ paramMap.put("hw_payeesiteid", this.getValue("hw_payeesiteid"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ paramMap.put("org", this.getDynamicObject("org"));
|
|
|
|
+ paramMap.put("asstActType", this.getString("payertype"));
|
|
|
|
+ FormShowParameter parameter = new FormShowParameter();
|
|
|
|
+ parameter.getOpenStyle().setShowType(ShowType.Modal);
|
|
|
|
+ parameter.setFormId("cas_recaddpayer");
|
|
|
|
+ parameter.setStatus(status);
|
|
|
|
+ parameter.getCustomParams().putAll(paramMap);
|
|
|
|
+ parameter.setCloseCallBack(new CloseCallBack(this, "addpayer"));
|
|
|
|
+ this.getView().showForm(parameter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void changePayeePage() {
|
|
|
|
+ DynamicObject settleType = this.getDynamicObject("settletype");
|
|
|
|
+ Map<String, Object> payerInfo = new HashMap();
|
|
|
|
+ payerInfo.put("virtual", BaseDataHelper.isSettleTypeVirtual(settleType));
|
|
|
|
+ payerInfo.put("ReceivingBill", true);
|
|
|
|
+ FormShowParameter parameter = new FormShowParameter();
|
|
|
|
+ parameter.getOpenStyle().setShowType(ShowType.Modal);
|
|
|
|
+ parameter.setFormId("cas_changepayee");
|
|
|
|
+ parameter.getCustomParams().putAll(payerInfo);
|
|
|
|
+ parameter.setCloseCallBack(new CloseCallBack(this, "changepayee"));
|
|
|
|
+ this.getView().showForm(parameter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void closedCallBack(ClosedCallBackEvent e) {
|
|
|
|
+ super.closedCallBack(e);
|
|
|
|
+ Map resultMap;
|
|
|
|
+ if ("changepayee".equals(e.getActionId())) {
|
|
|
|
+ resultMap = (Map)e.getReturnData();
|
|
|
|
+ if (resultMap != null) {
|
|
|
|
+ this.changePayeeValue(resultMap);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("addpayer".equals(e.getActionId())) {
|
|
|
|
+ resultMap = (Map)e.getReturnData();
|
|
|
|
+ if (resultMap != null) {
|
|
|
|
+ this.addPayerValue(resultMap);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("beforeSubmit".equals(e.getActionId()) && e != null && e.getReturnData() != null) {
|
|
|
|
+ boolean confirm = (Boolean)e.getReturnData();
|
|
|
|
+ if (confirm) {
|
|
|
|
+ this.getView().invokeOperation("submit");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("beforesubmitnew".equals(e.getActionId())) {
|
|
|
|
+ String confirm = (String)e.getReturnData();
|
|
|
|
+ if (confirm != null && confirm.equals("ok")) {
|
|
|
|
+ this.getView().invokeOperation("submitandnew");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("e_corebillno".equals(e.getActionId())) {
|
|
|
|
+ Object returnData = e.getReturnData();
|
|
|
|
+ if (!CasHelper.isEmpty(returnData)) {
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
+ int currentRowIndex = model.getEntryCurrentRowIndex("entry");
|
|
|
|
+ String coreBillType = (String)model.getValue("e_corebilltype", currentRowIndex);
|
|
|
|
+ if (this.isOpenSelectCorebill(coreBillType)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ListSelectedRowCollection coreBillCollection = (ListSelectedRowCollection)returnData;
|
|
|
|
+ int entryRowCount = model.getEntryRowCount("entry");
|
|
|
|
+ int followingRowCount = entryRowCount - currentRowIndex - 1;
|
|
|
|
+ if (coreBillCollection.size() - 1 > followingRowCount) {
|
|
|
|
+ model.appendEntryRow("entry", entryRowCount - 1, coreBillCollection.size() - 1 - followingRowCount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject settleorg = (DynamicObject)model.getValue("e_settleorg", currentRowIndex);
|
|
|
|
+ FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
|
|
|
+ formShowParameter.setCustomParam("isSelectCoreBillNo", "true");
|
|
|
|
+ Map<Integer, Long> actMap = new HashMap(coreBillCollection.size());
|
|
|
|
+
|
|
|
|
+ String entryEntityKey;
|
|
|
|
+ for(int i = 0; i < coreBillCollection.size(); ++i) {
|
|
|
|
+ ListSelectedRow listSelectedRow = coreBillCollection.get(i);
|
|
|
|
+ model.setValue("e_settleorg", settleorg, currentRowIndex + i);
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ model.setValue("e_corebilltype", coreBillType, currentRowIndex + i);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("e_corebilltype", currentRowIndex + i);
|
|
|
|
+ model.setValue("e_corebillno", listSelectedRow.getBillNo(), currentRowIndex + i);
|
|
|
|
+ if (StringUtils.equals(coreBillType, ClaimCoreBillTypeEnum.REPAYMENTBILL.getValue())) {
|
|
|
|
+ model.setValue("e_sourcebillid", listSelectedRow.getPrimaryKeyValue(), currentRowIndex + i);
|
|
|
|
+ model.setValue("e_sourcebillentryid", listSelectedRow.getEntryPrimaryKeyValue(), currentRowIndex + i);
|
|
|
|
+ model.setValue("e_corebillid", listSelectedRow.getEntryPrimaryKeyValue(), currentRowIndex + i);
|
|
|
|
+ actMap.put(currentRowIndex + i, (Long)listSelectedRow.getEntryPrimaryKeyValue());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entryEntityKey = listSelectedRow.getEntryEntityKey();
|
|
|
|
+ Object entryPKValue = listSelectedRow.getEntryPrimaryKeyValue();
|
|
|
|
+ if (!kd.fi.cas.util.StringUtils.isEmpty(entryEntityKey) && !ObjectUtils.isEmpty(entryPKValue)) {
|
|
|
|
+ QFilter[] filters = new QFilter[]{new QFilter(entryEntityKey + ".id", "=", entryPKValue)};
|
|
|
|
+ DynamicObject coreBill = QueryServiceHelper.queryOne(coreBillType, entryEntityKey + ".seq", filters);
|
|
|
|
+ if (coreBill != null) {
|
|
|
|
+ model.setValue("e_corebillentryseq", coreBill.getString(entryEntityKey + ".seq"), currentRowIndex + i);
|
|
|
|
+ model.setValue("e_corebillentryid", entryPKValue, currentRowIndex + i);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ model.setValue("e_corebillentryseq", (Object)null, currentRowIndex + i);
|
|
|
|
+ model.setValue("e_corebillentryid", (Object)null, currentRowIndex + i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ if (ClaimCoreBillTypeEnum.SALORDER.getValue().equals(coreBillType) || ClaimCoreBillTypeEnum.SALCONTRACT.getValue().equals(coreBillType)) {
|
|
|
|
+ boolean isSalOrder = ClaimCoreBillTypeEnum.SALORDER.getValue().equals(coreBillType);
|
|
|
|
+ boolean isSelectEntry = !kd.fi.cas.util.StringUtils.isEmpty(entryEntityKey) && !ObjectUtils.isEmpty(entryPKValue);
|
|
|
|
+ boolean isMaterialEntry = !kd.fi.cas.util.StringUtils.isEmpty(entryEntityKey) && "billentry".equals(entryEntityKey);
|
|
|
|
+ List conGroupFields;
|
|
|
|
+ DynamicObject queryInfo;
|
|
|
|
+ if (isSelectEntry && isMaterialEntry) {
|
|
|
|
+ conGroupFields = isSalOrder ? Arrays.asList(entryEntityKey + ".conbillnumber", entryEntityKey + ".conbillrownum", entryEntityKey + ".conbillid", entryEntityKey + ".conbillentryid") : Arrays.asList("id", "billno", entryEntityKey + ".lineno", entryEntityKey + ".id");
|
|
|
|
+ QFilter[] filters = new QFilter[]{new QFilter(entryEntityKey + ".id", "=", entryPKValue)};
|
|
|
|
+ queryInfo = QueryServiceHelper.queryOne(coreBillType, String.join(",", conGroupFields), filters);
|
|
|
|
+ if (queryInfo != null) {
|
|
|
|
+ model.setValue("conbillentity", "conm_salcontract", currentRowIndex + i);
|
|
|
|
+ model.setValue("conbillnumber", isSalOrder ? queryInfo.getString(entryEntityKey + ".conbillnumber") : queryInfo.getString("billno"), currentRowIndex + i);
|
|
|
|
+ model.setValue("conbillrownum", isSalOrder ? queryInfo.getString(entryEntityKey + ".conbillrownum") : queryInfo.getString(entryEntityKey + ".lineno"), currentRowIndex + i);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (isSalOrder) {
|
|
|
|
+ conGroupFields = Arrays.asList("billentry.conbillnumber", "billentry.conbillrownum", "billentry.conbillid", "billentry.conbillentryid");
|
|
|
|
+ QFilter filter = new QFilter("id", "=", listSelectedRow.getPrimaryKeyValue());
|
|
|
|
+ queryInfo = QueryServiceHelper.queryOne(coreBillType, String.join(",", conGroupFields), new QFilter[]{filter});
|
|
|
|
+ if (queryInfo != null) {
|
|
|
|
+ model.setValue("conbillnumber", queryInfo.getString("billentry.conbillnumber"), currentRowIndex + i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ model.setValue("conbillentity", "conm_salcontract", currentRowIndex + i);
|
|
|
|
+ model.setValue("conbillrownum", "", currentRowIndex + i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("conbillentity", currentRowIndex + i);
|
|
|
|
+ this.getView().updateView("conbillnumber", currentRowIndex + i);
|
|
|
|
+ this.getView().updateView("conbillrownum", currentRowIndex + i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QFilter qFilter;
|
|
|
|
+ Map actpayamt;
|
|
|
|
+ if (StringUtils.equals(coreBillType, ClaimCoreBillTypeEnum.PAYBILL.getValue())) {
|
|
|
|
+ qFilter = new QFilter("id", "in", actMap.keySet());
|
|
|
|
+ actpayamt = (Map)QueryServiceHelper.query("cas_paybill", "id , actpayamt", new QFilter[]{qFilter}).stream().collect(Collectors.toMap((dy) -> {
|
|
|
|
+ return dy.getLong("id");
|
|
|
|
+ }, (dy) -> {
|
|
|
|
+ return dy.getBigDecimal("actpayamt");
|
|
|
|
+ }));
|
|
|
|
+ Iterator var32 = actMap.entrySet().iterator();
|
|
|
|
+
|
|
|
|
+ while(var32.hasNext()) {
|
|
|
|
+ Map.Entry<Integer, Long> act = (Map.Entry)var32.next();
|
|
|
|
+ this.getModel().setValue("e_receivableamt", actpayamt.get(act.getValue()), (Integer)act.getKey());
|
|
|
|
+ }
|
|
|
|
+ } else if (StringUtils.equals(coreBillType, ClaimCoreBillTypeEnum.REPAYMENTBILL.getValue())) {
|
|
|
|
+ qFilter = new QFilter("er_repaymentbill.repaymententry.id", "in", actMap.values());
|
|
|
|
+ actpayamt = (Map)QueryServiceHelper.query("er_repaymentbill", "er_repaymentbill.repaymententry.id id, er_repaymentbill.repaymententry.orirepayamount orirepayamount, er_repaymentbill.repaymententry.orirecamount orirecamount,er_repaymentbill.repaymententry.remarks remarks,er_repaymentbill.repaymententry.sourceexpenseitem.id expenseitem", new QFilter[]{qFilter}).stream().collect(Collectors.toMap((dy) -> {
|
|
|
|
+ return dy.getLong("id");
|
|
|
|
+ }, (dy) -> {
|
|
|
|
+ return dy;
|
|
|
|
+ }, (m1, m2) -> {
|
|
|
|
+ return m1;
|
|
|
|
+ }));
|
|
|
|
+ entryEntityKey = null;
|
|
|
|
+ Iterator var33 = actMap.entrySet().iterator();
|
|
|
|
+
|
|
|
|
+ while(var33.hasNext()) {
|
|
|
|
+ Map.Entry<Integer, Long> act = (Map.Entry)var33.next();
|
|
|
|
+ DynamicObject repayDy = (DynamicObject)actpayamt.get(act.getValue());
|
|
|
|
+ if (EmptyUtil.isNoEmpty(repayDy)) {
|
|
|
|
+ this.getModel().setValue("e_receivableamt", repayDy.getBigDecimal("orirepayamount").subtract(repayDy.getBigDecimal("orirecamount")), (Integer)act.getKey());
|
|
|
|
+ this.getModel().setValue("e_actamt", repayDy.getBigDecimal("orirepayamount").subtract(repayDy.getBigDecimal("orirecamount")), (Integer)act.getKey());
|
|
|
|
+ this.getModel().setValue("e_remark", repayDy.get("remarks"), (Integer)act.getKey());
|
|
|
|
+ this.getModel().setValue("e_expenseitem", repayDy.get("expenseitem"), (Integer)act.getKey());
|
|
|
|
+ } else {
|
|
|
|
+ this.getModel().setValue("e_receivableamt", (Object)null, (Integer)act.getKey());
|
|
|
|
+ this.getModel().setValue("e_actamt", (Object)null, (Integer)act.getKey());
|
|
|
|
+ this.getModel().setValue("e_remark", (Object)null, (Integer)act.getKey());
|
|
|
|
+ this.getModel().setValue("e_expenseitem", (Object)null, (Integer)act.getKey());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ formShowParameter.setCustomParam("isSelectCoreBillNo", "false");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.equals(e.getActionId(), "CALLBACK_SELECTDRAFT")) {
|
|
|
|
+ Map<String, Object> returnData = (HashMap)e.getReturnData();
|
|
|
|
+ Object draftIdList = null;
|
|
|
|
+ if (!EmptyUtil.isEmpty(returnData)) {
|
|
|
|
+ draftIdList = returnData.get("draftBillIdList");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (draftIdList != null) {
|
|
|
|
+ this.displayDraftInfo(draftIdList);
|
|
|
|
+ OperateOption option = OperateOption.create();
|
|
|
|
+ option.setVariableValue("draftids", JSON.toJSONString(draftIdList));
|
|
|
|
+ option.setVariableValue("selectdraft", "true");
|
|
|
|
+ this.getView().invokeOperation("receivingrec", option);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("settletnumber".equals(e.getActionId())) {
|
|
|
|
+ ListSelectedRowCollection rows = (ListSelectedRowCollection)e.getReturnData();
|
|
|
|
+ if (EmptyUtil.isNoEmpty(rows)) {
|
|
|
|
+ this.getModel().deleteEntryData("entry");
|
|
|
|
+ this.getModel().deleteEntryData("detailinfo_entry");
|
|
|
|
+ this.getModel().deleteEntryData("infoentry");
|
|
|
|
+ CasBotpHelper.doDraw(this.getView(), "lc_present", this.getModel().getDataEntityType().getName(), rows);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void displayDraftInfo(Object draftIdList) {
|
|
|
|
+ if (!EmptyUtil.isEmpty(draftIdList)) {
|
|
|
|
+ List<Object> draftIds = (List)draftIdList;
|
|
|
|
+ DynamicObjectCollection draftBills = QueryServiceHelper.query("cdm_draftbillf7", "id,rptype,currency", new QFilter[]{new QFilter("id", "in", draftIds)});
|
|
|
|
+ Map<Long, BigDecimal> recNewAvailamountMap = DraftHelper.getNewestAvailamountMap(draftBills, "draft");
|
|
|
|
+ AbstractFormDataModel model = (AbstractFormDataModel)this.getModel();
|
|
|
|
+ model.beginInit();
|
|
|
|
+ TableValueSetter vs = new TableValueSetter(new String[0]);
|
|
|
|
+ vs.addField("draftbillinfo", new Object[0]);
|
|
|
|
+ vs.addField("recbillcurrency", new Object[0]);
|
|
|
|
+ vs.addField("transamount", new Object[0]);
|
|
|
|
+ vs.addField("draftbilllogid", new Object[0]);
|
|
|
|
+ vs.addField("srcbilltype", new Object[0]);
|
|
|
|
+ vs.addField("srcbillindex", new Object[0]);
|
|
|
|
+ Iterator var7 = draftBills.iterator();
|
|
|
|
+
|
|
|
|
+ while(var7.hasNext()) {
|
|
|
|
+ DynamicObject draftBill = (DynamicObject)var7.next();
|
|
|
|
+ long draftId = draftBill.getLong("id");
|
|
|
|
+ vs.addRow(new Object[]{draftId, draftBill.getLong("currency"), recNewAvailamountMap.get(draftId), 0, "nckd_cas_recbill_xz", 1});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ model.batchCreateNewEntryRow("cas_draftinfo", vs);
|
|
|
|
+ model.endInit();
|
|
|
|
+ this.getView().updateView("cas_draftinfo");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void addPayerValue(Map<String, Object> resultMap) {
|
|
|
|
+ this.setValue("payerformid", resultMap.get("payerformid"));
|
|
|
|
+ this.setValue("payer", resultMap.get("payer"));
|
|
|
|
+ this.setValue("payername", resultMap.get("payername"));
|
|
|
|
+ this.setValue("payernumber", resultMap.get("payernumber"));
|
|
|
|
+ if (this.isHwControl()) {
|
|
|
|
+ this.setValue("hw_payeesiteid", resultMap.get("hw_payeesiteid"));
|
|
|
|
+ this.setValue("scorg", resultMap.get("scorg"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("payeraccformid", resultMap.get("payeraccformid"));
|
|
|
|
+ this.setValue("payeracctbank", resultMap.get("payeracctbank"));
|
|
|
|
+ this.setValue("payeracctbanknum", resultMap.get("payeracctbanknum"));
|
|
|
|
+ this.setValue("f7_payerbank", resultMap.get("payerbank"));
|
|
|
|
+ this.setValue("payerbankname", resultMap.get("payerbankname"));
|
|
|
|
+ this.setPayerInfo4Lb();
|
|
|
|
+ this.getValue("f7_payerbank");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setPayerInfo4Lb() {
|
|
|
|
+ IBillModel model = (IBillModel)this.getModel();
|
|
|
|
+ String payername = this.getString("payername");
|
|
|
|
+ Image payeePic = (Image)this.getControl("payeepic");
|
|
|
|
+ long payeeId = 0L;
|
|
|
|
+ if (model.getValue("payer") != null) {
|
|
|
|
+ payeeId = Long.parseLong(model.getValue("payer").toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String payertype = this.getString("payertype");
|
|
|
|
+ String defaultUrl = BaseDataHelper.getPictureUrl(payeeId, payertype);
|
|
|
|
+ defaultUrl = defaultUrl == null ? "/icons/pc/entrance/cn_fk_80_80.png" : defaultUrl;
|
|
|
|
+ if (!CasHelper.isEmpty(payeeId)) {
|
|
|
|
+ DynamicObject obj = null;
|
|
|
|
+ if (!payertype.equals("bd_supplier") && !payertype.equals("bd_customer")) {
|
|
|
|
+ if (payertype.equals("bos_user")) {
|
|
|
|
+ obj = BusinessDataServiceHelper.loadSingleFromCache(payeeId, payertype, "name");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ obj = BusinessDataServiceHelper.loadSingleFromCache(payeeId, payertype, "name");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (obj != null) {
|
|
|
|
+ payername = CasHelper.getLocalValue(obj, "name");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("payername", payername);
|
|
|
|
+ this.setValue("payeenamev", payername);
|
|
|
|
+ payeePic.setUrl(defaultUrl);
|
|
|
|
+ ((Label)this.getControl("payerbanknumv")).setText(kd.fi.cas.util.StringUtils.splitString((String)model.getValue("payeracctbanknum"), 4, " "));
|
|
|
|
+ ((Label)this.getControl("payerbanknamev")).setText(this.getString("payerbankname"));
|
|
|
|
+ boolean hasPayerInfo = this.hasPayerInfo();
|
|
|
|
+ this.getView().setVisible(!hasPayerInfo, new String[]{"flex_addpayee"});
|
|
|
|
+ this.getView().setVisible(hasPayerInfo, new String[]{"flex_payeeinfo"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void changePayeeValue(Map<String, Object> returnMap) {
|
|
|
|
+ DynamicObject new_org = (DynamicObject)returnMap.get("org");
|
|
|
|
+ DynamicObject old_org = this.getDynamicObject("org");
|
|
|
|
+ DynamicObject new_acctbank;
|
|
|
|
+ if (!CasHelper.isEquals(new_org, old_org)) {
|
|
|
|
+ this.setValue("org", new_org);
|
|
|
|
+ new_acctbank = OrgHelper.getBaseCurrency((Long)new_org.getPkValue());
|
|
|
|
+ this.setValue("basecurrency", new_acctbank);
|
|
|
|
+ this.setSettleOrg(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ new_acctbank = (DynamicObject)returnMap.get("accountbank");
|
|
|
|
+ DynamicObject old_acctbank = this.getDynamicObject("accountbank");
|
|
|
|
+ if (!CasHelper.isEquals(new_acctbank, old_acctbank)) {
|
|
|
|
+ this.setValue("accountbank", new_acctbank);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject new_acctcash = (DynamicObject)returnMap.get("accountcash");
|
|
|
|
+ DynamicObject old_acctcash = this.getDynamicObject("accountcash");
|
|
|
|
+ if (!CasHelper.isEquals(new_acctcash, old_acctcash)) {
|
|
|
|
+ this.setValue("accountcash", new_acctcash);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject new_bank = (DynamicObject)returnMap.get("payeebank");
|
|
|
|
+ DynamicObject old_bank = this.getDynamicObject("payeebank");
|
|
|
|
+ if (!CasHelper.isEquals(old_bank, new_bank)) {
|
|
|
|
+ this.setValue("payeebank", new_bank);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject newOpenOrg = (DynamicObject)returnMap.get("openorg");
|
|
|
|
+ DynamicObject oldOpenOrg = this.getDynamicObject("openorg");
|
|
|
|
+ if (!CasHelper.isEquals(oldOpenOrg, newOpenOrg)) {
|
|
|
|
+ this.setValue("openorg", newOpenOrg);
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
|
|
|
|
+ this.setValue("e_settleorg", newOpenOrg.getPkValue(), i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setPayeeInfo4Lb();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private DynamicObject getErPayeeInfo(long userId, String name) {
|
|
|
|
+ QFilter uFilter = new QFilter("payer", "=", userId);
|
|
|
|
+ uFilter = uFilter.and(new QFilter("status", "=", 'C'));
|
|
|
|
+ QFilter eFilter = new QFilter("enable", "=", "1");
|
|
|
|
+ QFilter[] qFilters = new QFilter[]{uFilter, eFilter};
|
|
|
|
+ String selectFields = "id,name,payer,payeraccount,payeraccount01,payeraccount02,payerbank_id,payerbank.name,payerbank.number";
|
|
|
|
+ String orderBys = "isdefault desc";
|
|
|
|
+ DynamicObjectCollection defaultAccounts = QueryServiceHelper.query("er_payeer", selectFields, qFilters, orderBys, 1);
|
|
|
|
+ DynamicObject dynamicObject = null;
|
|
|
|
+ if (defaultAccounts != null && defaultAccounts.size() > 0) {
|
|
|
|
+ dynamicObject = (DynamicObject)defaultAccounts.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return dynamicObject;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void payeeF7Changed(PropertyChangedArgs e, Object newValue) {
|
|
|
|
+ DynamicObject org = (DynamicObject)newValue;
|
|
|
|
+ if (org != null) {
|
|
|
|
+ Long orgId = (Long)org.getPkValue();
|
|
|
|
+ DynamicObject defaultRecAccount = AccountBankHelper.getDefaultRecAccount(orgId);
|
|
|
|
+ if (defaultRecAccount != null && (BaseDataHelper.isSettleTypeVirtual(this.getDynamicObject("settletype")) && VisibleVirtualAcctHelper.checkVirtualAcct(defaultRecAccount) || !BaseDataHelper.isSettleTypeVirtual(this.getDynamicObject("settletype")) && !VisibleVirtualAcctHelper.checkVirtualAcct(defaultRecAccount))) {
|
|
|
|
+ this.setValue("accountbank", defaultRecAccount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject baseCurrency = OrgHelper.getBaseCurrency(orgId);
|
|
|
|
+ this.setValue("basecurrency", baseCurrency);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void payerTypeChanged(PropertyChangedArgs e, Object newValue, boolean isChanged) {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"flex_addpayee"});
|
|
|
|
+ this.getView().setVisible(false, new String[]{"flex_payeeinfo"});
|
|
|
|
+ Object value = null;
|
|
|
|
+ this.setValue("payerformid", value);
|
|
|
|
+ this.setValue("payer", value);
|
|
|
|
+ this.setValue("payername", value);
|
|
|
|
+ this.setValue("payeraccformid", value);
|
|
|
|
+ this.setValue("payeracctbank", value);
|
|
|
|
+ this.setValue("payeracctbanknum", value);
|
|
|
|
+ this.setValue("f7_payerbank", value);
|
|
|
|
+ this.setValue("payerbankname", value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void currencyF7Changed() {
|
|
|
|
+ this.setExchangerateEditable();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateAmtByActamt() {
|
|
|
|
+ BigDecimal exchangeRate = this.getBigDecimal("exchangerate");
|
|
|
|
+ String quotation = this.getString("quotation");
|
|
|
|
+ if (null == quotation) {
|
|
|
|
+ quotation = this.quoteType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal fee = this.getBigDecimal("fee");
|
|
|
|
+ if (exchangeRate == null) {
|
|
|
|
+ exchangeRate = BigDecimal.ONE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (fee == null) {
|
|
|
|
+ fee = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ if (currency != null) {
|
|
|
|
+ DynamicObject basecurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ int round = 10;
|
|
|
|
+ if (basecurrency != null) {
|
|
|
|
+ round = basecurrency.getInt("amtprecision");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ BigDecimal sumAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal sumFee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal amount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal sumLocalAmt = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ BigDecimal actAndDisc = rowInfo.getBigDecimal("e_actamt").add(rowInfo.getBigDecimal("e_discountamt"));
|
|
|
|
+ amount = amount.add(actAndDisc);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal countFee = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ BigDecimal actAmount = rowInfo.getBigDecimal("e_actamt");
|
|
|
|
+ BigDecimal discountAmt;
|
|
|
|
+ if (actAmount != null) {
|
|
|
|
+ discountAmt = QuotationHelper.callToCurrency(actAmount, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_localamt", discountAmt, i);
|
|
|
|
+ sumLocalAmt = sumLocalAmt.add(discountAmt);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ discountAmt = rowInfo.getBigDecimal("e_discountamt");
|
|
|
|
+ if (discountAmt != null) {
|
|
|
|
+ this.setValue("e_discountlocamt", QuotationHelper.callToCurrency(discountAmt, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unsettledamt", actAmount, i);
|
|
|
|
+ this.setValue("e_unlockamt", actAmount, i);
|
|
|
|
+ if (actAmount != null) {
|
|
|
|
+ BigDecimal actAmtAndDisc = actAmount.add(discountAmt);
|
|
|
|
+ this.setValue("e_fee", BigDecimal.ZERO, i);
|
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
+ BigDecimal efee = actAmtAndDisc.multiply(fee).divide(amount, currency.getInt("amtprecision"), RoundingMode.DOWN);
|
|
|
|
+ if (this.getLastRow(i)) {
|
|
|
|
+ efee = fee.subtract(countFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ countFee = countFee.add(efee);
|
|
|
|
+ this.setValue("e_fee", efee, i);
|
|
|
|
+ sumFee = sumFee.add(efee);
|
|
|
|
+ actAmtAndDisc = actAmtAndDisc.add(efee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_receivableamt", actAmtAndDisc, i);
|
|
|
|
+ this.setValue("e_receivablelocamt", QuotationHelper.callToCurrency(actAmtAndDisc, exchangeRate, quotation, round), i);
|
|
|
|
+ this.setValue("e_unsettledamt", actAmtAndDisc, i);
|
|
|
|
+ if (actAmtAndDisc != null) {
|
|
|
|
+ this.setValue("e_unsettledlocalamt", QuotationHelper.callToCurrency(actAmtAndDisc, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unlockamt", actAmtAndDisc, i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (actAmount != null) {
|
|
|
|
+ sumAmt = sumAmt.add(actAmount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("e_fee", i);
|
|
|
|
+ this.getView().updateView("e_receivableamt", i);
|
|
|
|
+ this.getView().updateView("e_receivablelocamt", i);
|
|
|
|
+ this.getView().updateView("e_receivablelocamt", i);
|
|
|
|
+ this.getView().updateView("e_discountlocamt", i);
|
|
|
|
+ this.getView().updateView("e_unsettledamt", i);
|
|
|
|
+ this.getView().updateView("e_unlockamt", i);
|
|
|
|
+ this.getView().updateView("e_localamt", i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("actrecamt", sumAmt);
|
|
|
|
+ this.setValue("fee", sumFee);
|
|
|
|
+ this.setValue("localamt", sumLocalAmt);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String quoteType() {
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ DynamicObject baseCurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ DynamicObject exRateTable = this.getDynamicObject("exratetable");
|
|
|
|
+ Date exRateDate = (Date)this.getValue("exratedate");
|
|
|
|
+ String quoteType = "0";
|
|
|
|
+ if (currency != null && baseCurrency != null && exRateTable != null && exRateDate != null) {
|
|
|
|
+ Map<String, Object> exchangeRateByRules = BaseDataServiceHelper.getExchangeRateMap(currency.getLong("id"), baseCurrency.getLong("id"), exRateTable.getLong("id"), exRateDate);
|
|
|
|
+ if (exchangeRateByRules.get("quoteType") != null && (Boolean)exchangeRateByRules.get("quoteType")) {
|
|
|
|
+ quoteType = "1";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return quoteType;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateAmt() {
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
+ Object org = model.getValue("org");
|
|
|
|
+ if (org != null) {
|
|
|
|
+ int cs = SystemParameterHelper.getParameterInteger(((DynamicObject)org).getLong("id"), "cs117");
|
|
|
|
+ if (RecAmtTypeEnum.RECEIVABLEAMT.getValue().equals(String.valueOf(cs))) {
|
|
|
|
+ this.calculateAmtByRecamt();
|
|
|
|
+ } else {
|
|
|
|
+ this.calculateAmtByActamt();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateAmtByRecamt() {
|
|
|
|
+ String quotation = this.getString("quotation");
|
|
|
|
+ if (null == quotation) {
|
|
|
|
+ quotation = this.quoteType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal exchangeRate = this.getBigDecimal("exchangerate");
|
|
|
|
+ BigDecimal fee = this.getBigDecimal("fee");
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ if (currency != null) {
|
|
|
|
+ DynamicObject basecurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ int round = 10;
|
|
|
|
+ if (basecurrency != null) {
|
|
|
|
+ round = basecurrency.getInt("amtprecision");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ BigDecimal sumAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal sumFee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal amount = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal sumLocalAmt = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ BigDecimal subtract = rowInfo.getBigDecimal("e_receivableamt").subtract(rowInfo.getBigDecimal("e_discountamt"));
|
|
|
|
+ amount = amount.add(subtract);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal countFee = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ BigDecimal recAmount = rowInfo.getBigDecimal("e_receivableamt");
|
|
|
|
+ if (recAmount != null) {
|
|
|
|
+ this.setValue("e_receivablelocamt", QuotationHelper.callToCurrency(recAmount, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal discountAmt = rowInfo.getBigDecimal("e_discountamt");
|
|
|
|
+ if (discountAmt != null) {
|
|
|
|
+ this.setValue("e_discountlocamt", QuotationHelper.callToCurrency(discountAmt, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (recAmount != null) {
|
|
|
|
+ BigDecimal actAmt = recAmount.subtract(discountAmt);
|
|
|
|
+ this.setValue("e_fee", BigDecimal.ZERO, i);
|
|
|
|
+ BigDecimal efee;
|
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
+ efee = actAmt.multiply(fee).divide(amount, currency.getInt("amtprecision"), RoundingMode.DOWN);
|
|
|
|
+ if (this.getLastRow(i)) {
|
|
|
|
+ efee = fee.subtract(countFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ countFee = countFee.add(efee);
|
|
|
|
+ this.setValue("e_fee", efee, i);
|
|
|
|
+ sumFee = sumFee.add(efee);
|
|
|
|
+ actAmt = actAmt.subtract(efee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sumAmt = sumAmt.add(actAmt);
|
|
|
|
+ this.setValue("e_actamt", actAmt, i);
|
|
|
|
+ efee = QuotationHelper.callToCurrency(actAmt, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_localamt", efee, i);
|
|
|
|
+ sumLocalAmt = sumLocalAmt.add(efee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unsettledamt", recAmount, i);
|
|
|
|
+ if (recAmount != null) {
|
|
|
|
+ this.setValue("e_unsettledlocalamt", QuotationHelper.callToCurrency(recAmount, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unlockamt", recAmount, i);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("e_fee", i);
|
|
|
|
+ this.getView().updateView("e_actamt", i);
|
|
|
|
+ this.getView().updateView("e_localamt", i);
|
|
|
|
+ this.getView().updateView("e_receivablelocamt", i);
|
|
|
|
+ this.getView().updateView("e_discountlocamt", i);
|
|
|
|
+ this.getView().updateView("e_unsettledamt", i);
|
|
|
|
+ this.getView().updateView("e_unlockamt", i);
|
|
|
|
+ this.getView().updateView("e_unlockamt", i);
|
|
|
|
+ this.getView().updateView("e_unsettledlocalamt", i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("actrecamt", sumAmt);
|
|
|
|
+ this.setValue("fee", sumFee);
|
|
|
|
+ this.setValue("localamt", sumLocalAmt);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateAmtImport() {
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
+ Object org = model.getValue("org");
|
|
|
|
+ if (org != null) {
|
|
|
|
+ int cs = SystemParameterHelper.getParameterInteger(((DynamicObject)org).getLong("id"), "cs117");
|
|
|
|
+ if (RecAmtTypeEnum.RECEIVABLEAMT.getValue().equals(String.valueOf(cs))) {
|
|
|
|
+ this.calculateAmtByRecamtImport();
|
|
|
|
+ } else {
|
|
|
|
+ this.calculateAmtByActamtImport();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateAmtByActamtImport() {
|
|
|
|
+ BigDecimal exchangeRate = this.getBigDecimal("exchangerate");
|
|
|
|
+ String quotation = this.getString("quotation");
|
|
|
|
+ if (null == quotation) {
|
|
|
|
+ quotation = this.quoteType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().setValue("quotation", quotation);
|
|
|
|
+ BigDecimal fee = this.getBigDecimal("fee");
|
|
|
|
+ if (exchangeRate == null) {
|
|
|
|
+ exchangeRate = BigDecimal.ONE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (fee == null) {
|
|
|
|
+ fee = BigDecimal.ZERO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ if (currency != null) {
|
|
|
|
+ DynamicObject basecurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ int round = 10;
|
|
|
|
+ if (basecurrency != null) {
|
|
|
|
+ round = basecurrency.getInt("amtprecision");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ BigDecimal sumAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal amount = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ BigDecimal countFee;
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ countFee = rowInfo.getBigDecimal("e_actamt").add(rowInfo.getBigDecimal("e_discountamt"));
|
|
|
|
+ amount = amount.add(countFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ boolean feeTemp = false;
|
|
|
|
+
|
|
|
|
+ BigDecimal sumLocalAmt;
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ sumLocalAmt = rowInfo.getBigDecimal("e_fee");
|
|
|
|
+ if (CasHelper.isNotEmpty(sumLocalAmt)) {
|
|
|
|
+ feeTemp = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal sumFee = BigDecimal.ZERO;
|
|
|
|
+ countFee = BigDecimal.ZERO;
|
|
|
|
+ sumLocalAmt = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ BigDecimal actAmount = rowInfo.getBigDecimal("e_actamt");
|
|
|
|
+ BigDecimal discountAmt;
|
|
|
|
+ if (actAmount != null) {
|
|
|
|
+ discountAmt = QuotationHelper.callToCurrency(actAmount, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_localamt", discountAmt, i);
|
|
|
|
+ sumLocalAmt = sumLocalAmt.add(discountAmt);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ discountAmt = rowInfo.getBigDecimal("e_discountamt");
|
|
|
|
+ if (discountAmt != null) {
|
|
|
|
+ this.setValue("e_discountlocamt", QuotationHelper.callToCurrency(discountAmt, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unsettledamt", actAmount, i);
|
|
|
|
+ this.setValue("e_unlockamt", actAmount, i);
|
|
|
|
+ BigDecimal actAmtAndDisc;
|
|
|
|
+ BigDecimal e_fee;
|
|
|
|
+ if (actAmount != null && !feeTemp) {
|
|
|
|
+ actAmtAndDisc = actAmount.add(discountAmt);
|
|
|
|
+ this.setValue("e_fee", BigDecimal.ZERO, i);
|
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
+ e_fee = actAmtAndDisc.multiply(fee).divide(amount, currency.getInt("amtprecision"), RoundingMode.DOWN);
|
|
|
|
+ if (this.getLastRow(i)) {
|
|
|
|
+ e_fee = fee.subtract(countFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ countFee = countFee.add(e_fee);
|
|
|
|
+ this.setValue("e_fee", e_fee, i);
|
|
|
|
+ actAmtAndDisc = actAmtAndDisc.add(e_fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_receivableamt", actAmtAndDisc, i);
|
|
|
|
+ this.setValue("e_receivablelocamt", QuotationHelper.callToCurrency(actAmtAndDisc, exchangeRate, quotation, round), i);
|
|
|
|
+ this.setValue("e_unsettledamt", actAmtAndDisc, i);
|
|
|
|
+ if (actAmtAndDisc != null) {
|
|
|
|
+ this.setValue("e_unsettledlocalamt", QuotationHelper.callToCurrency(actAmtAndDisc, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unlockamt", actAmtAndDisc, i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (actAmount != null && feeTemp) {
|
|
|
|
+ actAmtAndDisc = actAmount.add(discountAmt);
|
|
|
|
+ e_fee = rowInfo.getBigDecimal("e_fee");
|
|
|
|
+ if (e_fee != null) {
|
|
|
|
+ sumFee = e_fee.add(sumFee);
|
|
|
|
+ actAmtAndDisc = actAmtAndDisc.add(e_fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_receivableamt", actAmtAndDisc, i);
|
|
|
|
+ this.setValue("e_receivablelocamt", QuotationHelper.callToCurrency(actAmtAndDisc, exchangeRate, quotation, round), i);
|
|
|
|
+ this.setValue("e_unsettledamt", actAmtAndDisc, i);
|
|
|
|
+ if (actAmtAndDisc != null) {
|
|
|
|
+ this.setValue("e_unsettledlocalamt", QuotationHelper.callToCurrency(actAmtAndDisc, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unlockamt", actAmtAndDisc, i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (actAmount != null) {
|
|
|
|
+ sumAmt = sumAmt.add(actAmount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("e_fee", i);
|
|
|
|
+ this.getView().updateView("e_receivableamt", i);
|
|
|
|
+ this.getView().updateView("e_receivablelocamt", i);
|
|
|
|
+ this.getView().updateView("e_receivablelocamt", i);
|
|
|
|
+ this.getView().updateView("e_discountlocamt", i);
|
|
|
|
+ this.getView().updateView("e_unsettledamt", i);
|
|
|
|
+ this.getView().updateView("e_unlockamt", i);
|
|
|
|
+ this.getView().updateView("e_localamt", i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("actrecamt", sumAmt);
|
|
|
|
+ this.setValue("localamt", sumLocalAmt);
|
|
|
|
+ if (feeTemp) {
|
|
|
|
+ this.setValue("fee", sumFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateAmtByRecamtImport() {
|
|
|
|
+ String quotation = this.getString("quotation");
|
|
|
|
+ if (null == quotation) {
|
|
|
|
+ quotation = this.quoteType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().setValue("quotation", quotation);
|
|
|
|
+ BigDecimal exchangeRate = this.getBigDecimal("exchangerate");
|
|
|
|
+ BigDecimal fee = this.getBigDecimal("fee");
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ if (currency != null) {
|
|
|
|
+ DynamicObject basecurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ int round = 10;
|
|
|
|
+ if (basecurrency != null) {
|
|
|
|
+ round = basecurrency.getInt("amtprecision");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ BigDecimal sumAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal amount = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ BigDecimal countFee;
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ countFee = rowInfo.getBigDecimal("e_receivableamt").subtract(rowInfo.getBigDecimal("e_discountamt"));
|
|
|
|
+ amount = amount.add(countFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ boolean feeTemp = false;
|
|
|
|
+
|
|
|
|
+ BigDecimal sumLocalAmt;
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ sumLocalAmt = rowInfo.getBigDecimal("e_fee");
|
|
|
|
+ if (CasHelper.isNotEmpty(sumLocalAmt)) {
|
|
|
|
+ feeTemp = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal sumFee = BigDecimal.ZERO;
|
|
|
|
+ countFee = BigDecimal.ZERO;
|
|
|
|
+ sumLocalAmt = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ BigDecimal recAmount = rowInfo.getBigDecimal("e_receivableamt");
|
|
|
|
+ if (recAmount != null) {
|
|
|
|
+ this.setValue("e_receivablelocamt", QuotationHelper.callToCurrency(recAmount, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal discountAmt = rowInfo.getBigDecimal("e_discountamt");
|
|
|
|
+ if (discountAmt != null) {
|
|
|
|
+ this.setValue("e_discountlocamt", QuotationHelper.callToCurrency(discountAmt, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal actAmt;
|
|
|
|
+ BigDecimal e_fee;
|
|
|
|
+ if (recAmount != null && !feeTemp) {
|
|
|
|
+ actAmt = recAmount.subtract(discountAmt);
|
|
|
|
+ this.setValue("e_fee", BigDecimal.ZERO, i);
|
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
+ e_fee = actAmt.multiply(fee).divide(amount, currency.getInt("amtprecision"), RoundingMode.DOWN);
|
|
|
|
+ if (this.getLastRow(i)) {
|
|
|
|
+ e_fee = fee.subtract(countFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ countFee = countFee.add(e_fee);
|
|
|
|
+ this.setValue("e_fee", e_fee, i);
|
|
|
|
+ actAmt = actAmt.subtract(e_fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sumAmt = sumAmt.add(actAmt);
|
|
|
|
+ this.setValue("e_actamt", actAmt, i);
|
|
|
|
+ e_fee = QuotationHelper.callToCurrency(actAmt, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_localamt", e_fee, i);
|
|
|
|
+ sumLocalAmt = sumLocalAmt.add(e_fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (recAmount != null && feeTemp) {
|
|
|
|
+ actAmt = recAmount.subtract(discountAmt);
|
|
|
|
+ e_fee = rowInfo.getBigDecimal("e_fee");
|
|
|
|
+ if (e_fee != null) {
|
|
|
|
+ sumFee = e_fee.add(sumFee);
|
|
|
|
+ actAmt = actAmt.subtract(e_fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sumAmt = sumAmt.add(actAmt);
|
|
|
|
+ this.setValue("e_actamt", actAmt, i);
|
|
|
|
+ BigDecimal localAmt = QuotationHelper.callToCurrency(actAmt, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_localamt", localAmt, i);
|
|
|
|
+ sumLocalAmt = sumLocalAmt.add(localAmt);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unsettledamt", recAmount, i);
|
|
|
|
+ if (recAmount != null) {
|
|
|
|
+ this.setValue("e_unsettledlocalamt", QuotationHelper.callToCurrency(recAmount, exchangeRate, quotation, round), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("e_unlockamt", recAmount, i);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ this.getView().updateView("e_fee", i);
|
|
|
|
+ this.getView().updateView("e_actamt", i);
|
|
|
|
+ this.getView().updateView("e_localamt", i);
|
|
|
|
+ this.getView().updateView("e_receivablelocamt", i);
|
|
|
|
+ this.getView().updateView("e_discountlocamt", i);
|
|
|
|
+ this.getView().updateView("e_unsettledamt", i);
|
|
|
|
+ this.getView().updateView("e_unlockamt", i);
|
|
|
|
+ this.getView().updateView("e_unlockamt", i);
|
|
|
|
+ this.getView().updateView("e_unsettledlocalamt", i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("actrecamt", sumAmt);
|
|
|
|
+ this.setValue("localamt", sumLocalAmt);
|
|
|
|
+ if (feeTemp) {
|
|
|
|
+ this.setValue("fee", sumFee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateFee(int iRow) {
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
+ Object org = model.getValue("org");
|
|
|
|
+ if (org != null) {
|
|
|
|
+ int cs = SystemParameterHelper.getParameterInteger(((DynamicObject)org).getLong("id"), "cs117");
|
|
|
|
+ if (RecAmtTypeEnum.RECEIVABLEAMT.getValue().equals(String.valueOf(cs))) {
|
|
|
|
+ this.calculateFeeByRec(iRow);
|
|
|
|
+ } else {
|
|
|
|
+ this.calculateFeeAct(iRow);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateFeeByRec(int iRow) {
|
|
|
|
+ IFormView view = this.getView();
|
|
|
|
+ BigDecimal exchangeRate = this.getBigDecimal("exchangerate");
|
|
|
|
+ String quotation = this.getString("quotation");
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ if (currency != null) {
|
|
|
|
+ DynamicObject basecurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ int round = 10;
|
|
|
|
+ if (basecurrency != null) {
|
|
|
|
+ round = basecurrency.getInt("amtprecision");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ BigDecimal countFee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal sumAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal actAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal fee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal sumLocalAmt = BigDecimal.ZERO;
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ if (iRow == i) {
|
|
|
|
+ BigDecimal recAmount = rowInfo.getBigDecimal("e_receivableamt");
|
|
|
|
+ BigDecimal discountAmt = rowInfo.getBigDecimal("e_discountamt");
|
|
|
|
+ actAmt = recAmount.subtract(discountAmt);
|
|
|
|
+ actAmt = actAmt.subtract(rowInfo.getBigDecimal("e_fee"));
|
|
|
|
+ BigDecimal actLocalAmt = QuotationHelper.callToCurrency(actAmt, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_actamt", actAmt, i);
|
|
|
|
+ this.setValue("e_localamt", actLocalAmt, i);
|
|
|
|
+ view.updateView("e_actamt", i);
|
|
|
|
+ view.updateView("e_localamt", i);
|
|
|
|
+ } else {
|
|
|
|
+ actAmt = rowInfo.getBigDecimal("e_actamt");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sumAmt = sumAmt.add(actAmt);
|
|
|
|
+ sumLocalAmt = sumLocalAmt.add(rowInfo.getBigDecimal("e_localamt"));
|
|
|
|
+ fee = rowInfo.getBigDecimal("e_fee");
|
|
|
|
+ countFee = countFee.add(fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("actrecamt", sumAmt);
|
|
|
|
+ this.setValue("localamt", sumLocalAmt);
|
|
|
|
+ this.setValue("fee", countFee);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ view.updateView("fee");
|
|
|
|
+ view.updateView("actrecamt");
|
|
|
|
+ view.updateView("localamt");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void calculateFeeAct(int iRow) {
|
|
|
|
+ IFormView view = this.getView();
|
|
|
|
+ BigDecimal exchangeRate = this.getBigDecimal("exchangerate");
|
|
|
|
+ String quotation = this.getString("quotation");
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ if (currency != null) {
|
|
|
|
+ DynamicObject basecurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ int round = 10;
|
|
|
|
+ if (basecurrency != null) {
|
|
|
|
+ round = basecurrency.getInt("amtprecision");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int count = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ BigDecimal countFee = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal actAmt = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal fee = BigDecimal.ZERO;
|
|
|
|
+ this.getModel().beginInit();
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ DynamicObject rowInfo = this.getModel().getEntryRowEntity("entry", i);
|
|
|
|
+ if (iRow == i) {
|
|
|
|
+ BigDecimal recAmount = rowInfo.getBigDecimal("e_actamt");
|
|
|
|
+ BigDecimal discountAmt = rowInfo.getBigDecimal("e_discountamt");
|
|
|
|
+ actAmt = recAmount.add(discountAmt);
|
|
|
|
+ actAmt = actAmt.add(rowInfo.getBigDecimal("e_fee"));
|
|
|
|
+ BigDecimal actLocalAmt = QuotationHelper.callToCurrency(actAmt, exchangeRate, quotation, round);
|
|
|
|
+ this.setValue("e_receivableamt", actAmt, i);
|
|
|
|
+ this.setValue("e_receivablelocamt", actLocalAmt, i);
|
|
|
|
+ this.setValue("e_unsettledamt", actAmt, i);
|
|
|
|
+ this.setValue("e_unlockamt", actAmt, i);
|
|
|
|
+ view.updateView("e_unsettledamt", i);
|
|
|
|
+ view.updateView("e_unlockamt", i);
|
|
|
|
+ view.updateView("e_receivableamt", i);
|
|
|
|
+ view.updateView("e_receivablelocamt", i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fee = rowInfo.getBigDecimal("e_fee");
|
|
|
|
+ countFee = countFee.add(fee);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("fee", countFee);
|
|
|
|
+ this.getModel().endInit();
|
|
|
|
+ view.updateView("fee");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Boolean getLastRow(int row) {
|
|
|
|
+ int entryRowCount = this.getModel().getEntryRowCount("entry");
|
|
|
|
+ return row < entryRowCount - 1 ? Boolean.FALSE : Boolean.TRUE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void payeeAcctBankF7Changed(PropertyChangedArgs e, Object newValue) {
|
|
|
|
+ DynamicObject payeeAcctBank = (DynamicObject)newValue;
|
|
|
|
+ if (payeeAcctBank != null) {
|
|
|
|
+ DynamicObject currency = this.getDynamicObject("currency");
|
|
|
|
+ boolean containCurrency = AccountBankHelper.isAcctBankContainCurrency("bd_accountbanks", payeeAcctBank.getPkValue(), currency);
|
|
|
|
+ if (!containCurrency) {
|
|
|
|
+ Long currencyId = (Long)payeeAcctBank.get("defaultcurrency.id");
|
|
|
|
+ if (this.isBotpCreate()) {
|
|
|
|
+ this.setValueIfAbsent("currency", currencyId);
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("currency", currencyId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setValue("payeebank", payeeAcctBank.getDynamicObject("bank"));
|
|
|
|
+ this.setCurrencyEditable();
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("payeebank", (Object)null);
|
|
|
|
+ if (!this.isBotpCreate()) {
|
|
|
|
+ this.setValue("currency", this.getDynamicObject("basecurrency"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setOpenOrg();
|
|
|
|
+ this.setSettleOrg(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillPayeeAcctBank() {
|
|
|
|
+ BasedataEdit payerAcctBankF7 = (BasedataEdit)this.getControl("accountbank");
|
|
|
|
+ payerAcctBankF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
|
|
|
|
+ ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
|
|
|
|
+ showParameter.setIsolationOrg(false);
|
|
|
|
+ DynamicObject payee = (DynamicObject)this.getModel().getValue("org");
|
|
|
|
+ if (payee != null) {
|
|
|
|
+ QFilter[] usableAccountFilter = AccountBankHelper.getUsableAccountFilter((Long)payee.getPkValue());
|
|
|
|
+ showParameter.getListFilterParameter().setQFilters(Arrays.asList(usableAccountFilter));
|
|
|
|
+ } else {
|
|
|
|
+ showParameter.getListFilterParameter().setFilter(AccountBankHelper.getUsableFilter());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillRecType() {
|
|
|
|
+ BasedataEdit receivabletypeF7 = (BasedataEdit)this.getControl("receivingtype");
|
|
|
|
+ receivabletypeF7.addBeforeF7SelectListener((beforeF7SelectEvent) -> {
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
|
|
|
|
+ QFilter qFilter = new QFilter("enable", "=", "1");
|
|
|
|
+ String rectype = this.getModel().getValue("biztype").toString();
|
|
|
|
+ if (RecTypeEnum.SalesRec.toString().equals(rectype)) {
|
|
|
|
+ qFilter.and("ispartreceivable", "=", "1");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("sm_salorder".equals(this.getString("sourcebilltype")) || "conm_salcontract".equals(this.getString("sourcebilltype"))) {
|
|
|
|
+ qFilter.and(new QFilter("biztype", "=", "101"));
|
|
|
|
+ qFilter.and(new QFilter("ispartreceivable", "=", "1"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (multireceivingtype) {
|
|
|
|
+ qFilter.and(new QFilter("biztype", "=", "110"));
|
|
|
|
+ } else {
|
|
|
|
+ qFilter.and(new QFilter("biztype", "!=", "110"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (multireceivingtype) {
|
|
|
|
+ QFilter multipaymenttypeqFilter = new QFilter("enable", "=", "1");
|
|
|
|
+ multipaymenttypeqFilter.and(new QFilter("biztype", "=", "110"));
|
|
|
|
+ qFilter = multipaymenttypeqFilter;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ showParameter.getListFilterParameter().setFilter(qFilter);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterCreateNewData(EventObject e) {
|
|
|
|
+ super.afterCreateNewData(e);
|
|
|
|
+ Object obj = this.getModel().getContextVariable("IGNORE_RELOADDATAMODEL");
|
|
|
|
+ if (null == obj || !(Boolean)obj) {
|
|
|
|
+ BillModel model = (BillModel)this.getModel();
|
|
|
|
+ if (!model.isFromImport()) {
|
|
|
|
+ this.createNewModel();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void createNewModel() {
|
|
|
|
+ FormShowParameter parameter = this.getView().getFormShowParameter();
|
|
|
|
+ Map<String, Object> customParams = parameter.getCustomParams();
|
|
|
|
+ IBillModel model = (IBillModel)this.getModel();
|
|
|
|
+ Object org = model.getValue("org");
|
|
|
|
+ if (org == null) {
|
|
|
|
+ String appId = this.getView().getFormShowParameter().getAppId();
|
|
|
|
+ if (EmptyUtil.isNotEmpty(appId)) {
|
|
|
|
+ appId = AppMetadataCache.getAppInfo(appId).getId();
|
|
|
|
+ } else {
|
|
|
|
+ appId = AppMetadataCache.getAppInfo("cas").getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Long> authorizedBankOrgId = OrgHelper.getAuthorizedBankOrgId(RequestContext.get().getCurrUserId(), appId, "nckd_cas_recbill_xz", "47156aff000000ac");
|
|
|
|
+ if (!CollectionUtils.isEmpty(authorizedBankOrgId)) {
|
|
|
|
+ this.setValue("org", authorizedBankOrgId.get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject receivingtype = this.getDynamicObject("receivingtype");
|
|
|
|
+ DynamicObjectCollection entrys = this.getModel().getDataEntity().getDynamicObjectCollection("entry");
|
|
|
|
+ Iterator var7 = entrys.iterator();
|
|
|
|
+
|
|
|
|
+ DynamicObject entry;
|
|
|
|
+ while(var7.hasNext()) {
|
|
|
|
+ entry = (DynamicObject)var7.next();
|
|
|
|
+ entry.set("e_receivingtype", receivingtype);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (customParams != null && customParams.containsKey("recmentType")) {
|
|
|
|
+ String bizType = "999";
|
|
|
|
+ String rectype = (String)customParams.get("recmentType");
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ this.getModel().setValue("biztype", rectype);
|
|
|
|
+ if (rectype.equals(RecTypeEnum.OtherRec.toString())) {
|
|
|
|
+ this.setValue("payertype", AsstActTypeEnum.OTHER.getValue());
|
|
|
|
+ if (!multireceivingtype) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"e_material"});
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ bizType = "100";
|
|
|
|
+ this.setValue("payertype", AsstActTypeEnum.CUSTOMER.getValue());
|
|
|
|
+ this.getView().setVisible(true, new String[]{"e_material"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QFilter filter = (new QFilter("biztype", "=", bizType)).and(new QFilter("enable", "=", "1"));
|
|
|
|
+ if (RecTypeEnum.SalesRec.toString().equals(this.getModel().getValue("biztype"))) {
|
|
|
|
+ filter.and("ispartreceivable", "=", "1");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<Object, DynamicObject> recbilltypes = BusinessDataServiceHelper.loadFromCache("cas_receivingbilltype", "fid,enable,fundflowitem,number,name,biztype,ispartreceivable,description,predata,default", new QFilter[]{filter}, "default desc,predata desc");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(recbilltypes)) {
|
|
|
|
+ Iterator<Map.Entry<Object, DynamicObject>> iterator = recbilltypes.entrySet().iterator();
|
|
|
|
+ if (iterator.hasNext()) {
|
|
|
|
+ DynamicObject receivingType = (DynamicObject)((Map.Entry)iterator.next()).getValue();
|
|
|
|
+ this.setValue("receivingtype", receivingType);
|
|
|
|
+ this.setEntryExpenseitemEnable();
|
|
|
|
+ Iterator var14 = entrys.iterator();
|
|
|
|
+
|
|
|
|
+ while(var14.hasNext()) {
|
|
|
|
+ entry = (DynamicObject)var14.next();
|
|
|
|
+ entry.set("e_receivingtype", receivingType);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.setValue("receivingtype", (Object)null);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Date currentDate = DateUtils.getCurrentDate();
|
|
|
|
+ this.setValueIfAbsent("bizdate", currentDate);
|
|
|
|
+ this.setValueIfAbsent("exratedate", currentDate);
|
|
|
|
+ org = model.getValue("org");
|
|
|
|
+ if (org != null) {
|
|
|
|
+ Long orgId = (Long)((DynamicObject)org).getPkValue();
|
|
|
|
+ this.setDefaultExratetable(orgId);
|
|
|
|
+ if (!SystemStatusCtrolHelper.isInitEnable(orgId)) {
|
|
|
|
+ this.getView().setEnable(false, new String[]{"bar_save", "bar_submit"});
|
|
|
|
+ this.getView().showErrorNotification(SystemStatusCtrolHelper.getNotInitMsg(CasHelper.getLocalValue((DynamicObject)org, "name")));
|
|
|
|
+ } else {
|
|
|
|
+ this.getView().setEnable(true, new String[]{"bar_save", "bar_submit"});
|
|
|
|
+ this.getView().setEnable(false, new String[]{"payeebank"});
|
|
|
|
+ this.setValueIfAbsent("settletype", BaseDataHelper.getDefaultSettleType());
|
|
|
|
+ this.payeeF7Changed((PropertyChangedArgs)null, this.getValue("org"));
|
|
|
|
+ this.payeeAcctBankF7Changed((PropertyChangedArgs)null, this.getDynamicObject("accountbank"));
|
|
|
|
+ this.currencyF7Changed();
|
|
|
|
+ this.getView().setVisible(true, new String[]{"customerf7"});
|
|
|
|
+ this.setPayeeInfo4Lb();
|
|
|
|
+ this.fillPayerType();
|
|
|
|
+ this.setOpenOrg();
|
|
|
|
+ this.setSettleOrg(false);
|
|
|
|
+ this.setSettleValue(0);
|
|
|
|
+ entry = this.getDynamicObject("settletype");
|
|
|
|
+ if (BaseDataHelper.isSettleTypeCash(entry) && org != null) {
|
|
|
|
+// Long orgId = (Long)((DynamicObject)org).getPkValue();
|
|
|
|
+ this.setValue("accountcash", AccountCashHelper.getDefaultAccountcash(orgId, "payee"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.fillFundflowItem(true);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.getView().setEnable(false, new String[]{"bar_save", "bar_submit"});
|
|
|
|
+ this.getView().showErrorNotification(ResManager.loadKDString("请先选择收款人。", "ReceivingBillEdit_34", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void beforeBindData(EventObject e) {
|
|
|
|
+ super.beforeBindData(e);
|
|
|
|
+ if (this.isBotpNew()) {
|
|
|
|
+ this.supplePayerInfo();
|
|
|
|
+ DynamicObject settleType = this.getDynamicObject("settletype");
|
|
|
|
+ Object org = this.getModel().getValue("org");
|
|
|
|
+ if (BaseDataHelper.isSettleTypeCash(settleType) && org != null) {
|
|
|
|
+ this.setValue("accountbank", (Object)null);
|
|
|
|
+ Long orgId = (Long)((DynamicObject)org).getPkValue();
|
|
|
|
+ this.setValue("accountcash", AccountCashHelper.getDefaultAccountcash(orgId, "payee"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (CasHelper.isEmpty(this.getModel().getValue("exchangerate"))) {
|
|
|
|
+ this.getModel().setValue("exchangerate", BigDecimal.ONE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void supplePayerInfo() {
|
|
|
|
+ Object sourcebilltype = this.getModel().getValue("sourcebilltype");
|
|
|
|
+ if (!CasHelper.isEmpty(sourcebilltype)) {
|
|
|
|
+ Object payer = this.getModel().getValue("payer");
|
|
|
|
+ Object payeracctbanknumMo = this.getModel().getValue("payeracctbanknum");
|
|
|
|
+ Object payeebankMo = this.getModel().getValue("f7_payerbank");
|
|
|
|
+ Object payertype = this.getValue("payertype");
|
|
|
|
+ if (CasHelper.isEmpty(payeracctbanknumMo) && CasHelper.isEmpty(payeebankMo)) {
|
|
|
|
+ String billName = this.getModel().getDataEntityType().getName();
|
|
|
|
+ Map<String, Object> resultMap = CasPayeeOrPayerHelper.getPayeeOrPayerInfo(payer, payertype, billName);
|
|
|
|
+ if (resultMap.size() > 0) {
|
|
|
|
+ Object payeracctbanknum = resultMap.get("payeracctbanknum");
|
|
|
|
+ DynamicObject f7_payerbank = (DynamicObject)resultMap.get("f7_payerbank");
|
|
|
|
+ this.getModel().setValue("payeracctbanknum", payeracctbanknum);
|
|
|
|
+ if (!CasHelper.isEmpty(f7_payerbank)) {
|
|
|
|
+ this.getModel().setValue("f7_payerbank", f7_payerbank);
|
|
|
|
+ this.getModel().setValue("payerbankname", CasHelper.getLocalValue(f7_payerbank, "name"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterDeleteRow(AfterDeleteRowEventArgs e) {
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterImportData(ImportDataEventArgs e) {
|
|
|
|
+ super.afterImportData(e);
|
|
|
|
+ DynamicObject cur = OrgHelper.getBaseCurrency(this.getPk("org"));
|
|
|
|
+ this.setValue("basecurrency", cur);
|
|
|
|
+ DynamicObject accountBank = this.getDynamicObject("accountbank");
|
|
|
|
+ if (accountBank != null) {
|
|
|
|
+ this.setValue("payeebank", accountBank.getDynamicObject("bank"));
|
|
|
|
+ Object openorg = this.getValue("openorg");
|
|
|
|
+ if (CasHelper.isEmpty(openorg)) {
|
|
|
|
+ this.setValue("openorg", accountBank.getDynamicObject("openorg"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObjectCollection entry = this.getModel().getEntryEntity("entry");
|
|
|
|
+ Iterator var6 = entry.iterator();
|
|
|
|
+
|
|
|
|
+ while(var6.hasNext()) {
|
|
|
|
+ DynamicObject rowInfo = (DynamicObject)var6.next();
|
|
|
|
+ Object rowOpenOrg = rowInfo.get("e_settleorg");
|
|
|
|
+ if (CasHelper.isEmpty(rowOpenOrg)) {
|
|
|
|
+ this.setValueIfAbsent("e_settleorg", accountBank.getDynamicObject("openorg"), rowInfo.getInt("seq") - 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.calculateAmtImport();
|
|
|
|
+ DynamicObject receivingtype = this.getDynamicObject("receivingtype");
|
|
|
|
+ if (receivingtype != null) {
|
|
|
|
+ receivingtype = BusinessDataServiceHelper.loadSingleFromCache(receivingtype.getPkValue(), "cas_receivingbilltype", "id,fundflowitem");
|
|
|
|
+ this.fillFundflowItem(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterCopyData(EventObject e) {
|
|
|
|
+ super.afterCopyData(e);
|
|
|
|
+ BillShowParameter parameter = (BillShowParameter)this.getView().getFormShowParameter();
|
|
|
|
+ Object operate = parameter.getCustomParam("operate");
|
|
|
|
+ if (operate != null && !operate.equals(OperateTypeEnum.COPY.name())) {
|
|
|
|
+ if (operate.equals(OperateTypeEnum.OFFSET.name())) {
|
|
|
|
+ this.create4Copy(true);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.create4Copy(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().setValue("isrefund", false);
|
|
|
|
+ this.getModel().setValue("isfullrefund", false);
|
|
|
|
+ this.getModel().setValue("cas_draftinfo", (Object)null);
|
|
|
|
+ this.getModel().setValue("logids", "");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void create4Copy(boolean isOffset) {
|
|
|
|
+ IBillModel model = (IBillModel)this.getModel();
|
|
|
|
+ int count = model.getEntryRowCount("entry");
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ BigDecimal e_receivableamt = (BigDecimal)model.getValue("e_receivableamt", i);
|
|
|
|
+ model.setValue("e_unlockamt", e_receivableamt, i);
|
|
|
|
+ model.setValue("e_unsettledamt", e_receivableamt, i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isOffset) {
|
|
|
|
+ this.setNegateAmt(model);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getView().setEnable(false, new String[]{"org"});
|
|
|
|
+ this.setPayerInfo4Lb();
|
|
|
|
+ this.setPayeeInfo4Lb();
|
|
|
|
+ String payeeTypeID = (String)model.getValue("payertype");
|
|
|
|
+ if (AsstActTypeEnum.EMPLOYEE.getValue().equals(payeeTypeID) && CasHelper.isEmpty(this.getModel().getValue("f7_payerbank")) && CasHelper.isEmpty(this.getModel().getValue("payeracctbanknum"))) {
|
|
|
|
+ this.userF7Changed((PropertyChangedArgs)null, model.getValue("userf7"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject payeeAcctBank = (DynamicObject)this.getModel().getValue("accountbank");
|
|
|
|
+ if (payeeAcctBank != null && !(Boolean)payeeAcctBank.get("ismulcurrency")) {
|
|
|
|
+ this.getView().setEnable(false, new String[]{"currency"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setNegateAmt(IBillModel model) {
|
|
|
|
+ int count = model.getEntryRowCount("entry");
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < count; ++i) {
|
|
|
|
+ model.setValue("e_actamt", ((BigDecimal)model.getValue("e_actamt", i)).negate(), i);
|
|
|
|
+ model.setValue("e_localamt", ((BigDecimal)model.getValue("e_localamt", i)).negate(), i);
|
|
|
|
+ model.setValue("e_receivableamt", ((BigDecimal)model.getValue("e_receivableamt", i)).negate(), i);
|
|
|
|
+ model.setValue("e_receivablelocamt", ((BigDecimal)model.getValue("e_receivablelocamt", i)).negate(), i);
|
|
|
|
+ model.setValue("e_discountamt", ((BigDecimal)model.getValue("e_discountamt", i)).negate(), i);
|
|
|
|
+ model.setValue("e_discountlocamt", ((BigDecimal)model.getValue("e_discountlocamt", i)).negate(), i);
|
|
|
|
+ model.setValue("e_unlockamt", ((BigDecimal)model.getValue("e_unlockamt", i)).negate(), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ model.setValue("actrecamt", ((BigDecimal)model.getValue("actrecamt")).negate());
|
|
|
|
+ model.setValue("localamt", ((BigDecimal)model.getValue("localamt")).negate());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterBindData(EventObject e) {
|
|
|
|
+ super.afterBindData(e);
|
|
|
|
+ this.afterBindData();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void entryGridBindData(EntryGridBindDataEvent e) {
|
|
|
|
+// super.entryGridBindData(e);
|
|
|
|
+ this.controlRecAmt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void controlRecAmt() {
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
+ IFormView view = this.getView();
|
|
|
|
+ int entryCount = model.getEntryRowCount("entry");
|
|
|
|
+ Object org = model.getValue("org");
|
|
|
|
+ String field = "e_actamt";
|
|
|
|
+ int i;
|
|
|
|
+ if (org != null) {
|
|
|
|
+ boolean isFinish = SystemStatusCtrolHelper.isInitEnable(((DynamicObject)org).getLong("id"));
|
|
|
|
+ this.getView().setEnable(isFinish, new String[]{"bar_save", "bar_submit"});
|
|
|
|
+ if (!isFinish) {
|
|
|
|
+ this.getView().showErrorNotification(SystemStatusCtrolHelper.getNotInitMsg(CasHelper.getLocalValue((DynamicObject)org, "name")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ i = SystemParameterHelper.getParameterInteger(((DynamicObject)org).getLong("id"), "cs117");
|
|
|
|
+ if (RecAmtTypeEnum.ACTAMT.getValue().equals(String.valueOf(i))) {
|
|
|
|
+ field = "e_receivableamt";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String enableField = "e_actamt".equals(field) ? "e_receivableamt" : "e_actamt";
|
|
|
|
+ ((FieldEdit)view.getControl(enableField)).setMustInput(true);
|
|
|
|
+
|
|
|
|
+ for(i = 0; i < entryCount; ++i) {
|
|
|
|
+ view.setEnable(true, i, new String[]{enableField});
|
|
|
|
+ view.setEnable(false, i, new String[]{field});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterBindData() {
|
|
|
|
+ BillShowParameter billShowParameter = (BillShowParameter)this.getView().getFormShowParameter();
|
|
|
|
+ IBillModel model = (IBillModel)this.getModel();
|
|
|
|
+ DynamicObject editData = model.getDataEntity();
|
|
|
|
+ this.fillToolBar();
|
|
|
|
+ String sourcebilltype = editData.getString("sourcebilltype");
|
|
|
|
+ this.fillterEntryReceType();
|
|
|
|
+ if (!CasHelper.isEmpty(sourcebilltype)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"copyentryrow"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("cas_paybill".equals(sourcebilltype)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee"});
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayer"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.fillPayerType();
|
|
|
|
+ DynamicObject receivingtype;
|
|
|
|
+ if (this.isBotpNew()) {
|
|
|
|
+ receivingtype = OrgHelper.getBaseCurrency(this.getPk("org"));
|
|
|
|
+ if (receivingtype == null) {
|
|
|
|
+ this.getView().setEnable(false, new String[]{"bar_save", "bar_submit"});
|
|
|
|
+ this.getView().showErrorNotification(SystemStatusCtrolHelper.notFinishInitSetMsg(CasHelper.getLocalValue(this.getDynamicObject("org"), "name")));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject accountBank = this.getDynamicObject("accountbank");
|
|
|
|
+ if (accountBank != null) {
|
|
|
|
+ this.setValueIfAbsent("payeebank", accountBank.getDynamicObject("bank"));
|
|
|
|
+ this.setValueIfAbsent("openorg", accountBank.getDynamicObject("openorg"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.fillFundflowItem(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.setSettleOrg(true);
|
|
|
|
+ this.setPayerInfo4Lb();
|
|
|
|
+ this.setPayeeInfo4Lb();
|
|
|
|
+ this.setCurrencyEditable();
|
|
|
|
+ this.setEntryAmountCaption();
|
|
|
|
+ this.setExchangerateEditable();
|
|
|
|
+ this.setEcorebilltype();
|
|
|
|
+ this.showChargeReason();
|
|
|
|
+ if ("nckd_cas_recbill_xz".equals(sourcebilltype)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayer"});
|
|
|
|
+ this.getView().setEnable(false, new String[]{"e_actamt"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ receivingtype = (DynamicObject)this.getValue("receivingtype");
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ if (receivingtype != null && receivingtype.getBoolean("ispartreceivable")) {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"e_settleorg"});
|
|
|
|
+ } else if (!multireceivingtype) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"e_settleorg"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().setDataChanged(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillterEntryReceType() {
|
|
|
|
+ boolean ishavenull = false;
|
|
|
|
+ DynamicObject defaultPayMentBillType = BusinessDataServiceHelper.loadSingle(1833464176371407872L, "cas_receivingbilltype");
|
|
|
|
+ DynamicObject receivingtype = (DynamicObject)this.getModel().getValue("receivingtype");
|
|
|
|
+ Set<DynamicObject> entryReceTypes = new HashSet(4);
|
|
|
|
+ DynamicObjectCollection entrys = (DynamicObjectCollection)this.getModel().getValue("entry");
|
|
|
|
+ Iterator iterator = entrys.iterator();
|
|
|
|
+
|
|
|
|
+ while(iterator.hasNext()) {
|
|
|
|
+ DynamicObject entry = (DynamicObject)iterator.next();
|
|
|
|
+ DynamicObject e_paymenttype = entry.getDynamicObject("e_receivingtype");
|
|
|
|
+ if (e_paymenttype != null) {
|
|
|
|
+ entryReceTypes.add(e_paymenttype);
|
|
|
|
+ } else {
|
|
|
|
+ ishavenull = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (entryReceTypes != null && entryReceTypes.size() > 0) {
|
|
|
|
+ if (entryReceTypes.size() > 1) {
|
|
|
|
+ this.getModel().setValue("multireceivingtype", true);
|
|
|
|
+ if (receivingtype == null) {
|
|
|
|
+ this.getModel().setValue("receivingtype", defaultPayMentBillType);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (!ishavenull) {
|
|
|
|
+ this.getModel().setValue("multireceivingtype", false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (receivingtype == null) {
|
|
|
|
+ iterator = entryReceTypes.iterator();
|
|
|
|
+ if (iterator.hasNext()) {
|
|
|
|
+ this.getModel().setValue("receivingtype", iterator.next());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (receivingtype != null) {
|
|
|
|
+ for(int i = 0; i < entrys.size(); ++i) {
|
|
|
|
+ this.getModel().setValue("e_receivingtype", receivingtype, i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().setValue("multireceivingtype", false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void showChargeReason() {
|
|
|
|
+ Object chargereason = this.getModel().getValue("reason");
|
|
|
|
+ if (chargereason != null && !"".equals(chargereason) && this.getPageCache().get("chargereason") == null) {
|
|
|
|
+ String msg = String.format(ResManager.loadKDString("收款单“%1$s”已退单。退单原因:%2$s。", "ReceivingBillEdit_17", "fi-cas-formplugin", new Object[0]), this.getModel().getValue("billno"), String.valueOf(chargereason));
|
|
|
|
+ this.getView().showMessage(msg);
|
|
|
|
+ this.getPageCache().put("chargereason", "yes");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setEcorebilltype() {
|
|
|
|
+ DynamicObject recType = this.getDynamicObject("receivingtype");
|
|
|
|
+ if (recType == null) {
|
|
|
|
+ this.setByIspartreceivable();
|
|
|
|
+ } else {
|
|
|
|
+ boolean isAr = recType.getBoolean("ispartreceivable");
|
|
|
|
+ this.setByIspartreceivable(isAr);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setByIspartreceivable() {
|
|
|
|
+ List<ComboItem> coreComboItem = new ArrayList();
|
|
|
|
+ ComboProp property = (ComboProp) EntityMetadataCache.getDataEntityType("nckd_cas_recbill_xz").getProperty("settlecorebilltype");
|
|
|
|
+ ComboProp propertyUn = (ComboProp)EntityMetadataCache.getDataEntityType("nckd_cas_recbill_xz").getProperty("unsettlecorebilltype");
|
|
|
|
+ this.getCoreComboItem(coreComboItem, property, false);
|
|
|
|
+ this.getCoreComboItem(coreComboItem, propertyUn, false);
|
|
|
|
+ ComboEdit coreCbo = (ComboEdit)this.getView().getControl("e_corebilltype");
|
|
|
|
+ coreCbo.setComboItems(coreComboItem);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setByIspartreceivable(boolean isPart) {
|
|
|
|
+ List<ComboItem> coreComboItem = new ArrayList();
|
|
|
|
+ ComboProp property = (ComboProp)EntityMetadataCache.getDataEntityType("nckd_cas_recbill_xz").getProperty(isPart ? "settlecorebilltype" : "unsettlecorebilltype");
|
|
|
|
+ this.getCoreComboItem(coreComboItem, property, isPart);
|
|
|
|
+ ComboEdit coreCbo = (ComboEdit)this.getView().getControl("e_corebilltype");
|
|
|
|
+ coreCbo.setComboItems(coreComboItem);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getCoreComboItem(List<ComboItem> coreComboItem, ComboProp property, boolean isPart) {
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ Iterator comboItem;
|
|
|
|
+ if (EmptyUtil.isNoEmpty(property)) {
|
|
|
|
+ List<ValueMapItem> comboItems = property.getComboItems();
|
|
|
|
+ if (EmptyUtil.isNoEmpty(comboItems)) {
|
|
|
|
+ ComboItem comboItem1 = null;
|
|
|
|
+ comboItem = comboItems.iterator();
|
|
|
|
+
|
|
|
|
+ while(comboItem.hasNext()) {
|
|
|
|
+ ValueMapItem valueMapItem = (ValueMapItem)comboItem.next();
|
|
|
|
+ comboItem1 = new ComboItem(valueMapItem.getName(), valueMapItem.getValue());
|
|
|
|
+ coreComboItem.add(comboItem1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (multireceivingtype) {
|
|
|
|
+ ComboProp propertyOther = (ComboProp)EntityMetadataCache.getDataEntityType("nckd_cas_recbill_xz").getProperty(isPart ? "unsettlecorebilltype" : "settlecorebilltype");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(propertyOther)) {
|
|
|
|
+ List<ValueMapItem> comboItemsOther = propertyOther.getComboItems();
|
|
|
|
+ if (EmptyUtil.isNoEmpty(comboItemsOther)) {
|
|
|
|
+ comboItem = null;
|
|
|
|
+ Iterator var13 = comboItemsOther.iterator();
|
|
|
|
+
|
|
|
|
+ while(var13.hasNext()) {
|
|
|
|
+ ValueMapItem valueMapItem = (ValueMapItem)var13.next();
|
|
|
|
+ if (!"cas_paybill".equals(valueMapItem.getValue())) {
|
|
|
|
+ ComboItem comboItem1 = new ComboItem(valueMapItem.getName(), valueMapItem.getValue());
|
|
|
|
+ coreComboItem.add(comboItem1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setDefaultExratetable(Long orgId) {
|
|
|
|
+ Long exchangeRateTableId = 0L;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ exchangeRateTableId = SystemStatusCtrolHelper.getExrateTable(orgId).getLong("id");
|
|
|
|
+ } catch (Exception var4) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getModel().setValue("exratetable", exchangeRateTableId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setSettleOrg(boolean isBindData) {
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
+ DynamicObject receivingtype = (DynamicObject)this.getValue("receivingtype");
|
|
|
|
+ Object openOrg = model.getValue("openorg");
|
|
|
|
+ if (receivingtype != null && receivingtype.getBoolean("ispartreceivable")) {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"e_settleorg"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Object sourceBillType = model.getValue("sourcebilltype");
|
|
|
|
+ if (!"ar_finarbill".equals(sourceBillType)) {
|
|
|
|
+ if (openOrg != null) {
|
|
|
|
+ DynamicObject accountOrg = (DynamicObject)openOrg;
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < model.getEntryRowCount("entry"); ++i) {
|
|
|
|
+ if (isBindData && CasHelper.isEmpty(model.getValue("e_settleorg", i))) {
|
|
|
|
+ this.setValue("e_settleorg", accountOrg.getPkValue(), i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isBindData) {
|
|
|
|
+ this.setValue("e_settleorg", accountOrg.getPkValue(), i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected void setExchangerateEditable() {
|
|
|
|
+ DynamicObject srcCurrency = this.getDynamicObject("currency");
|
|
|
|
+ DynamicObject destCurrency = this.getDynamicObject("basecurrency");
|
|
|
|
+ if (srcCurrency != null && destCurrency != null) {
|
|
|
|
+ if (srcCurrency.getLong("id") == destCurrency.getLong("id")) {
|
|
|
|
+ this.getView().setEnable(false, new String[]{"exchangerate"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setCurrencyEditable() {
|
|
|
|
+ boolean isCurrencyEditable = true;
|
|
|
|
+ if (this.isBotpCreate()) {
|
|
|
|
+ isCurrencyEditable = false;
|
|
|
|
+ } else {
|
|
|
|
+ DynamicObject settleType = this.getDynamicObject("settletype");
|
|
|
|
+ boolean isCash = BaseDataHelper.isSettleTypeCash(settleType);
|
|
|
|
+ DynamicObject accountCash;
|
|
|
|
+ if (isCash) {
|
|
|
|
+ accountCash = this.getDynamicObject("accountcash");
|
|
|
|
+ if (accountCash != null) {
|
|
|
|
+ isCurrencyEditable = !accountCash.getBoolean("isbycurrency");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ accountCash = this.getDynamicObject("accountbank");
|
|
|
|
+ if (accountCash != null) {
|
|
|
|
+ isCurrencyEditable = accountCash.getBoolean("ismulcurrency");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getView().setEnable(isCurrencyEditable, new String[]{"currency"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
|
|
|
|
+ super.confirmCallBack(messageBoxClosedEvent);
|
|
|
|
+ String id = messageBoxClosedEvent.getCallBackId();
|
|
|
|
+ MessageBoxResult res = messageBoxClosedEvent.getResult();
|
|
|
|
+ if (StringUtils.equals(id, "CONFIRM_CANCELREC_CALLBACK") && MessageBoxResult.Yes.equals(res)) {
|
|
|
|
+ String billno = (String)this.getModel().getValue("billno");
|
|
|
|
+ DynamicObject recObj = BusinessDataServiceHelper.loadSingle("nckd_cas_recbill_xz", "id,billno", new QFilter[]{new QFilter("billno", "=", billno)});
|
|
|
|
+ if (!CasPluginHelper.cancelCheckSettleForRec(this, this.getView(), recObj)) {
|
|
|
|
+ this.getView().invokeOperation("cancelrec");
|
|
|
|
+ }
|
|
|
|
+ } else if (StringUtils.equals(id, "CONFIRM_CANCELPAY_SETTLE_CALLBACK") && MessageBoxResult.Yes.equals(res)) {
|
|
|
|
+ this.getView().invokeOperation("cancelrec");
|
|
|
|
+ } else if (id.equals("CONFIRM_DEL_CALLBACK")) {
|
|
|
|
+ OperateOption option = OperateOption.create();
|
|
|
|
+ if (MessageBoxResult.Yes.equals(res)) {
|
|
|
|
+ option.setVariableValue("delrecpay", "1");
|
|
|
|
+ this.getView().invokeOperation("delete", option);
|
|
|
|
+ }
|
|
|
|
+ } else if (id.equals("CONFIRM_DELETE_CALLBACK") && MessageBoxResult.Yes.equals(res)) {
|
|
|
|
+ this.getView().invokeOperation("delete");
|
|
|
|
+ } else if ("clearReceivingTypeConfirm".equals(id) && MessageBoxResult.Yes.equals(res)) {
|
|
|
|
+ this.getModel().setValue("receivingtype", (Object)null);
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
|
|
|
|
+ this.setValue("e_receivingtype", (Object)null, i);
|
|
|
|
+ }
|
|
|
|
+ } else if ("clearReceivingTypeConfirm".equals(id) && MessageBoxResult.Cancel.equals(res)) {
|
|
|
|
+ this.getModel().setValue("multireceivingtype", true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
|
|
+ super.beforeDoOperation(args);
|
|
|
|
+ AbstractOperate op = (AbstractOperate)args.getSource();
|
|
|
|
+ FormOperate operate = (FormOperate)args.getSource();
|
|
|
|
+ String operateKey = operate.getOperateKey();
|
|
|
|
+ EntryGrid entry;
|
|
|
|
+ if ("copyentryrow".equals(operateKey)) {
|
|
|
|
+ entry = (EntryGrid)this.getControl("entry");
|
|
|
|
+ if (entry.getSelectRows().length == 0) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请选中一行再进行操作。", "ReceivingBillEdit_9", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String sourceBillType;
|
|
|
|
+ DynamicObject accountBank;
|
|
|
|
+ if ("trackdown".equals(operateKey)) {
|
|
|
|
+ accountBank = (DynamicObject)this.getModel().getValue("settletype");
|
|
|
|
+ if (accountBank != null) {
|
|
|
|
+ sourceBillType = accountBank.getString("settlementtype");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(sourceBillType) && this.settleTypes.contains(sourceBillType)) {
|
|
|
|
+ op.getOption().setVariableValue("botp_track_edit_status", "true");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("deleteentry".equals(operateKey)) {
|
|
|
|
+ entry = (EntryGrid)this.getControl("entry");
|
|
|
|
+ if (entry.getSelectRows().length == 0) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("请选中一行再进行操作。", "ReceivingBillEdit_9", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("recbook".equals(operateKey)) {
|
|
|
|
+ accountBank = this.getDynamicObject("accountbank");
|
|
|
|
+ if (null != accountBank && AccountBankHelper.isClosed(accountBank.getLong("id"))) {
|
|
|
|
+ throw new KDBizException(String.format(ResManager.loadKDString("账户%s当前状态为已销户,暂无法进行业务处理。", "PaymentErrorCode_47", "fi-cas-business", new Object[0]), accountBank.getString("number")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("receivingrec".equals(operateKey)) {
|
|
|
|
+ Object recPkValue = this.getModel().getDataEntity().getPkValue();
|
|
|
|
+ String draftIds;
|
|
|
|
+ if (!CasHelper.isEmpty(recPkValue)) {
|
|
|
|
+ DynamicObject recdb = BusinessDataServiceHelper.loadSingle(recPkValue, "nckd_cas_recbill_xz", "id,billstatus");
|
|
|
|
+ draftIds = recdb.getString("billstatus");
|
|
|
|
+ if (!draftIds.equals(BillStatusEnum.AUDIT.getValue())) {
|
|
|
|
+ throw new KDBizException((new ReceivErrorCode()).STATUS_CANNOT_REC(), new Object[0]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sourceBillType = (String)this.getValue("sourcebilltype");
|
|
|
|
+ if ("cas_claimcenterbill".equals(sourceBillType)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ draftIds = op.getOption().getVariableValue("draftids", "");
|
|
|
|
+ if (StringUtils.isEmpty(draftIds)) {
|
|
|
|
+ List<DynamicObject> fillDraft = RecDraftHelper.fillDraft(new Object[]{recPkValue}, false);
|
|
|
|
+ if (fillDraft != null && fillDraft.size() > 0) {
|
|
|
|
+ DynamicObjectCollection draftDataColl = ((DynamicObject)fillDraft.get(0)).getDynamicObjectCollection("draftbill");
|
|
|
|
+ List<Object> draftNoList = (List)draftDataColl.stream().map((o) -> {
|
|
|
|
+ return o.getDynamicObject("fbasedataid").getPkValue();
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ op.getOption().setVariableValue("draftids", JSON.toJSONString(draftNoList));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject orgData = (DynamicObject)this.getValue("org");
|
|
|
|
+ Long pkValue = (Long)orgData.getPkValue();
|
|
|
|
+ boolean selectDraftFlag = SystemParameterHelper.getParameterBoolean(pkValue, "cs123");
|
|
|
|
+ DynamicObject data = this.getModel().getDataEntity(true);
|
|
|
|
+ if (selectDraftFlag && PaymentBillPluginHelper.needSelectedDraft(data)) {
|
|
|
|
+ FormShowParameter showParameter = new FormShowParameter();
|
|
|
|
+ showParameter.setAppId("cas");
|
|
|
|
+ showParameter.setFormId("cas_receiver_selectdraft");
|
|
|
|
+ showParameter.setCustomParam("recBillId", data.getPkValue());
|
|
|
|
+ showParameter.getOpenStyle().setShowType(ShowType.Modal);
|
|
|
|
+ showParameter.setCloseCallBack(new CloseCallBack(this, "CALLBACK_SELECTDRAFT"));
|
|
|
|
+ this.getView().showForm(showParameter);
|
|
|
|
+ args.setCancel(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (Arrays.asList("unaudit", "chargeback", "delete", "receivingrec").contains(operateKey) && PayBillHepler.getViewSettle(this.getModel().getDataEntity()).size() > 0) {
|
|
|
|
+ this.getView().showErrorNotification(String.format(ResManager.loadKDString("%s已存在结算记录,导致操作失败。如需继续执行操作,请先反结算。", "PaymentBillList_36", "fi-cas-formplugin", new Object[0]), ""));
|
|
|
|
+ args.setCancel(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs arg) {
|
|
|
|
+ super.afterDoOperation(arg);
|
|
|
|
+ String operateKey = arg.getOperateKey();
|
|
|
|
+ OperationResult operationResult = arg.getOperationResult();
|
|
|
|
+ if ("beforesubmit".equals(operateKey) && operationResult != null && operationResult.isSuccess()) {
|
|
|
|
+ DynamicObject dataEntity = this.getModel().getDataEntity();
|
|
|
|
+ RecWarningHelper.submitValidate(dataEntity, this);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("receivingrec".equals(operateKey) && operationResult != null && operationResult.isSuccess()) {
|
|
|
|
+ this.getView().invokeOperation("refresh", OperateOption.create());
|
|
|
|
+ long payer = (Long)this.getModel().getValue("payer");
|
|
|
|
+ String payerType = (String)this.getModel().getValue("payertype");
|
|
|
|
+ Object companyId = null;
|
|
|
|
+ boolean showSuccess = Boolean.FALSE;
|
|
|
|
+ QFilter filter;
|
|
|
|
+ DynamicObject currentPeriod;
|
|
|
|
+ DynamicObject internal_company;
|
|
|
|
+ if (AsstActTypeEnum.SUPPLIER.getValue().equals(payerType)) {
|
|
|
|
+ filter = new QFilter("id", "in", payer);
|
|
|
|
+ currentPeriod = BusinessDataServiceHelper.loadSingle(AsstActTypeEnum.SUPPLIER.getValue(), "id,internal_company", filter.toArray());
|
|
|
|
+ internal_company = currentPeriod.getDynamicObject("internal_company");
|
|
|
|
+ if (CasHelper.isEmpty(internal_company)) {
|
|
|
|
+ logger.info("====SUPPLIER非内部客商。");
|
|
|
|
+ showSuccess = Boolean.TRUE;
|
|
|
|
+ } else {
|
|
|
|
+ companyId = internal_company.getPkValue();
|
|
|
|
+ }
|
|
|
|
+ } else if (AsstActTypeEnum.CUSTOMER.getValue().equals(payerType)) {
|
|
|
|
+ filter = new QFilter("id", "in", payer);
|
|
|
|
+ currentPeriod = BusinessDataServiceHelper.loadSingle(AsstActTypeEnum.CUSTOMER.getValue(), "id,internal_company", filter.toArray());
|
|
|
|
+ internal_company = currentPeriod.getDynamicObject("internal_company");
|
|
|
|
+ if (CasHelper.isEmpty(internal_company)) {
|
|
|
|
+ showSuccess = Boolean.TRUE;
|
|
|
|
+ } else {
|
|
|
|
+ companyId = internal_company.getPkValue();
|
|
|
|
+ }
|
|
|
|
+ } else if (AsstActTypeEnum.COMPANY.getValue().equals(payerType)) {
|
|
|
|
+ companyId = payer;
|
|
|
|
+ } else {
|
|
|
|
+ showSuccess = Boolean.TRUE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (showSuccess) {
|
|
|
|
+ this.getView().showSuccessNotification(ResManager.loadKDString("确认收款成功。", "ReceivingBillEdit_38", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (EmptyUtil.isNoEmpty(companyId)) {
|
|
|
|
+ Date bizDate = (Date)this.getModel().getValue("bizdate");
|
|
|
|
+ currentPeriod = SystemStatusCtrolHelper.getCurrentPeriod((Long)companyId);
|
|
|
|
+ if (EmptyUtil.isNoEmpty(bizDate) && EmptyUtil.isNoEmpty(currentPeriod) && bizDate.before(currentPeriod.getDate("begindate"))) {
|
|
|
|
+ Object CS048 = SystemParameterHelper.getCASParamByOrgIds((Long)companyId, "cs048");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(CS048)) {
|
|
|
|
+ boolean isCheck = (Boolean)CS048;
|
|
|
|
+ if (isCheck) {
|
|
|
|
+ Object allowObj = SystemParameterHelper.getCASParamByOrgIds((Long)companyId, "cs103");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(allowObj)) {
|
|
|
|
+ boolean allow = (Boolean)allowObj;
|
|
|
|
+ if (!allow) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("确认收款成功。因付款方设置不允许新增已结账期间的付款业务,因此收付协同生成付款单失败。", "ReceivingBillEdit_37", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ } else {
|
|
|
|
+ logger.info("CS103:{}", allowObj);
|
|
|
|
+ this.getView().showSuccessNotification(ResManager.loadKDString("确认收款成功。", "ReceivingBillEdit_38", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ logger.info("CS048:{}", CS048);
|
|
|
|
+ this.getView().showSuccessNotification(ResManager.loadKDString("确认收款成功。", "ReceivingBillEdit_38", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ logger.info("CS048:{}", CS048);
|
|
|
|
+ this.getView().showSuccessNotification(ResManager.loadKDString("确认收款成功。", "ReceivingBillEdit_38", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ logger.info("currentPeriod:{}", currentPeriod);
|
|
|
|
+ this.getView().showSuccessNotification(ResManager.loadKDString("确认收款成功。", "ReceivingBillEdit_38", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("copyentryrow".equals(operateKey)) {
|
|
|
|
+ this.calculateAmt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("newentry".equals(operateKey)) {
|
|
|
|
+ boolean multireceivingtype = this.getModel().getDataEntity().getBoolean("multireceivingtype");
|
|
|
|
+ DynamicObject receivingtype = this.getModel().getDataEntity().getDynamicObject("receivingtype");
|
|
|
|
+ if (!multireceivingtype) {
|
|
|
|
+ int index = this.getModel().getEntryRowCount("entry") - 1;
|
|
|
|
+ this.getModel().setValue("e_receivingtype", receivingtype, index);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (operationResult != null && operationResult.isSuccess()) {
|
|
|
|
+ String billStatus = (String)this.getModel().getValue("billstatus");
|
|
|
|
+ if (!BillStatusEnum.SAVE.getValue().equals(billStatus)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ } else {
|
|
|
|
+ Object sourceBillType = this.getModel().getValue("sourcebilltype");
|
|
|
|
+ if ("nckd_cas_recbill_xz".equals(sourceBillType)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayer"});
|
|
|
|
+ this.getView().setVisible(true, new String[]{"changepayee"});
|
|
|
|
+ } else if ("cas_paybill".equals(sourceBillType)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ } else {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("submit".equals(operateKey) || "unsubmit".equals(operateKey) || "unaudit".equals(operateKey)) {
|
|
|
|
+ this.controlRecAmt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("save".equals(operateKey) || "submit".equals(operateKey)) {
|
|
|
|
+ this.getView().updateView("multireceivingtype");
|
|
|
|
+ this.getView().updateView("receivingtype");
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
|
|
|
|
+ this.getView().updateView("e_receivingtype", i);
|
|
|
|
+ this.getView().updateView("e_settleorg", i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.fillToolBar();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void itemClick(ItemClickEvent evt) {
|
|
|
|
+ super.itemClick(evt);
|
|
|
|
+ String key = evt.getItemKey().toLowerCase();
|
|
|
|
+ if ("bar_cancelrec".equals(key)) {
|
|
|
|
+ this.cancelRec();
|
|
|
|
+ } else if ("viewarsettle".equals(key)) {
|
|
|
|
+ this.viewArSettle();
|
|
|
|
+ } else if ("viewdrafbill".equals(key)) {
|
|
|
|
+ this.viewDrafBill();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void viewDrafBill() {
|
|
|
|
+ DynamicObjectCollection draftBills = (DynamicObjectCollection)this.getModel().getValue("draftbill");
|
|
|
|
+ if (draftBills != null && draftBills.size() > 0) {
|
|
|
|
+ Set<Long> idSet = new HashSet();
|
|
|
|
+ Iterator var3 = draftBills.iterator();
|
|
|
|
+
|
|
|
|
+ while(var3.hasNext()) {
|
|
|
|
+ DynamicObject draftBill = (DynamicObject)var3.next();
|
|
|
|
+ idSet.add(((DynamicObject)draftBill.get("fbasedataid")).getLong("id"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ListShowParameter parameter = new ListShowParameter();
|
|
|
|
+ parameter.setBillFormId("cdm_payandrecdraft_f7");
|
|
|
|
+ parameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
|
|
|
+ parameter.setLookUp(true);
|
|
|
|
+ QFilter qFilter = new QFilter("id", "in", idSet);
|
|
|
|
+ parameter.getListFilterParameter().getQFilters().add(qFilter);
|
|
|
|
+ this.getView().showForm(parameter);
|
|
|
|
+ } else {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("暂无关联的票据记录。", "PaymentBillDraftEditPlugin_9", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void cancelRec() {
|
|
|
|
+ String billno = (String)this.getModel().getValue("billno");
|
|
|
|
+ DynamicObject recObj = BusinessDataServiceHelper.loadSingle("nckd_cas_recbill_xz", "id,billno,isvoucher,billstatus,receivingtype", new QFilter[]{new QFilter("billno", "=", billno)});
|
|
|
|
+ String billstatus = recObj.getString("billstatus");
|
|
|
|
+ if (!billstatus.equals("D")) {
|
|
|
|
+ this.getView().invokeOperation("cancelrec");
|
|
|
|
+ } else {
|
|
|
|
+ Object org = this.getModel().getValue("org");
|
|
|
|
+ if (org != null) {
|
|
|
|
+ int CS114 = SystemParameterHelper.getParameterInteger(((DynamicObject)org).getLong("id"), "cs114");
|
|
|
|
+ Boolean isv = recObj.getBoolean("isvoucher");
|
|
|
|
+ if (3 == CS114 && isv) {
|
|
|
|
+ this.getView().showConfirm(String.format(ResManager.loadKDString("“%s”单据已经生成凭证,是否继续取消收款?", "ReceivingBillEdit_10", "fi-cas-formplugin", new Object[0]), billno), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("CONFIRM_CANCELREC_CALLBACK", this));
|
|
|
|
+ } else if (!CasPluginHelper.cancelCheckSettleForRec(this, this.getView(), recObj)) {
|
|
|
|
+ this.getView().invokeOperation("cancelrec");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getView().updateView("entry");
|
|
|
|
+ this.getView().updateView("flex_amountinfo");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillToolBar() {
|
|
|
|
+ boolean isSuppleContract = (Boolean)this.getModel().getValue("issupplecontract");
|
|
|
|
+ boolean isOrgsDivide = (Boolean)this.getModel().getValue("isorgsdivide");
|
|
|
|
+ String sourceBillType = (String)this.getModel().getValue("sourcebilltype");
|
|
|
|
+ if (!isSuppleContract && !isOrgsDivide && !"pmct_incomeapply".equals(sourceBillType)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"contractnumber"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isSuppleContract && !isOrgsDivide) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"bar_new", "bar_save", "bar_submit", "bar_unsubmit", "bar_submitandnew", "bar_del", "bar_audit", "bar_unaudit", "bar_rec", "bar_cancelrec", "genvoucher", "deletevoucher", "addrow", "copyentryrow", "deleterow", "moveentrydown", "moveentryup"});
|
|
|
|
+ String billStatus = this.getModel().getDataEntity().getString("billstatus");
|
|
|
|
+ if (billStatus.equals(BillStatusEnum.SAVE.getValue())) {
|
|
|
|
+ this.getView().setVisible(true, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ if ("nckd_cas_recbill_xz".equals(sourceBillType)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayer"});
|
|
|
|
+ } else if ("cas_paybill".equals(sourceBillType)) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.getView().setVisible(true, new String[]{"bar_save", "bar_submit", "bar_del", "addrow", "copyentryrow", "deleterow", "moveentrydown", "moveentryup"});
|
|
|
|
+ } else if (billStatus.equals(BillStatusEnum.SUBMIT.getValue())) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ this.getView().setVisible(true, new String[]{"bar_unsubmit", "bar_audit"});
|
|
|
|
+ } else if (billStatus.equals(BillStatusEnum.AUDIT.getValue())) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ this.getView().setVisible(true, new String[]{"bar_unaudit", "bar_rec", "genvoucher", "deletevoucher"});
|
|
|
|
+ } else if (billStatus.equals("D")) {
|
|
|
|
+ this.getView().setVisible(false, new String[]{"changepayee", "changepayer"});
|
|
|
|
+ this.getView().setVisible(true, new String[]{"bar_cancelrec", "genvoucher", "deletevoucher", "baritemap"});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setPayeeInfo4Lb() {
|
|
|
|
+ DynamicObject org = this.getDynamicObject("org");
|
|
|
|
+ ((Label)this.getControl("orgv")).setText(CasHelper.getLocalValue(org, "name"));
|
|
|
|
+ Image orgPic = (Image)this.getControl("orgpic");
|
|
|
|
+ String defaultUrl = "/icons/pc/entrance/cn_sk_80_80.png";
|
|
|
|
+ orgPic.setUrl(defaultUrl);
|
|
|
|
+ boolean isCash = BaseDataHelper.isSettleTypeCash((DynamicObject)this.getModel().getValue("settletype"));
|
|
|
|
+ DynamicObject payerAcctBank = this.getDynamicObject("accountbank");
|
|
|
|
+ DynamicObject accountCash = this.getDynamicObject("accountcash");
|
|
|
|
+ String v_payeebanknum = "";
|
|
|
|
+ if (isCash && accountCash != null) {
|
|
|
|
+ v_payeebanknum = accountCash.getString("number");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isCash && payerAcctBank != null) {
|
|
|
|
+ v_payeebanknum = kd.fi.cas.util.StringUtils.splitString(payerAcctBank.getString("bankaccountnumber"), 4, " ");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ((Label)this.getControl("payeebanknumv")).setText(v_payeebanknum);
|
|
|
|
+ DynamicObject payerBank = this.getDynamicObject("payeebank");
|
|
|
|
+ String v_payerbankname = "";
|
|
|
|
+ if (payerBank != null) {
|
|
|
|
+ v_payerbankname = CasHelper.getLocalValue(payerBank, "name");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ((Label)this.getControl("payeebanknamev")).setText(v_payerbankname);
|
|
|
|
+ this.getView().setVisible(!isCash, new String[]{"payerbanknamelb", "payeebanknamev"});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected String recPayAccount() {
|
|
|
|
+ return "accountbank";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterAddRow(AfterAddRowEventArgs e) {
|
|
|
|
+ super.afterAddRow(e);
|
|
|
|
+ EntryProp entryProp = e.getEntryProp();
|
|
|
|
+ boolean multireceivingtype = (Boolean)this.getModel().getValue("multireceivingtype");
|
|
|
|
+ DynamicObject receivingtype = (DynamicObject)this.getModel().getValue("receivingtype");
|
|
|
|
+ if ("entry".equals(entryProp.getName())) {
|
|
|
|
+ RowDataEntity[] rows = e.getRowDataEntities();
|
|
|
|
+ RowDataEntity[] var6 = rows;
|
|
|
|
+ int var7 = rows.length;
|
|
|
|
+
|
|
|
|
+ for(int var8 = 0; var8 < var7; ++var8) {
|
|
|
|
+ RowDataEntity row = var6[var8];
|
|
|
|
+ if (row.getDataEntity().get("e_settleorg") == null) {
|
|
|
|
+ this.setSettleValue(row.getRowIndex());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!multireceivingtype) {
|
|
|
|
+ this.getModel().setValue("e_receivingtype", receivingtype, row.getRowIndex());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.controlRecAmt();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void beforeItemClick(BeforeItemClickEvent evt) {
|
|
|
|
+ String opKey = evt.getOperationKey();
|
|
|
|
+ if ("delete".equals(opKey)) {
|
|
|
|
+ if ("cas_paybill".equals(this.getString("sourcebilltype"))) {
|
|
|
|
+ evt.setCancel(true);
|
|
|
|
+ String billno = this.getString("billno");
|
|
|
|
+ this.getView().showConfirm(String.format(ResManager.loadKDString("%s收款单由内部收付协同业务自动生成,是否确认删除?", "ReceivingBillEdit_19", "fi-cas-formplugin", new Object[0]), billno), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("CONFIRM_DEL_CALLBACK", this));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DynamicObject dataEntity = this.getModel().getDataEntity();
|
|
|
|
+ boolean isvirtual = dataEntity.getBoolean("isvirtual");
|
|
|
|
+ if ("nckd_cas_recbill_xz".equals(this.getString("sourcebilltype")) && isvirtual) {
|
|
|
|
+ evt.setCancel(true);
|
|
|
|
+ String billno = dataEntity.getString("billno");
|
|
|
|
+ this.getView().showConfirm(String.format(ResManager.loadKDString("%s虚拟收款单由组织间清分业务触发自动下推的单据,请确认是否删除?", "ReceivingBillEdit_33", "fi-cas-formplugin", new Object[0]), billno), MessageBoxOptions.YesNo, ConfirmTypes.Default, new ConfirmCallBackListener("CONFIRM_DELETE_CALLBACK", this));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setSettleValue(int index) {
|
|
|
|
+ DynamicObject recOrg = this.getModel().getDataEntity().getDynamicObject("org");
|
|
|
|
+ recOrg = BusinessDataServiceHelper.loadSingle(recOrg.getPkValue(), recOrg.getDynamicObjectType().getName(), "fisaccounting");
|
|
|
|
+ if (recOrg.getBoolean("fisaccounting")) {
|
|
|
|
+ this.getModel().setValue("e_settleorg", this.getValue("org"), index);
|
|
|
|
+ } else {
|
|
|
|
+ DynamicObject recAccount = this.getModel().getDataEntity().getDynamicObject("accountbank");
|
|
|
|
+ if (recAccount != null) {
|
|
|
|
+ this.getModel().setValue("e_settleorg", recAccount.get("openorg"), index);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void viewArSettle() {
|
|
|
|
+ Long billId = (Long)this.getModel().getDataEntity().getPkValue();
|
|
|
|
+ if (billId == 0L) {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("暂无结算记录。", "ReceivingBillList_2", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ } else {
|
|
|
|
+ Set<Long> mainSettleIds = SettleRecordQueryHelperForCas.getSettleIdsByMain("ar_settlerecord", "nckd_cas_recbill_xz", new Object[]{billId});
|
|
|
|
+ Set<Long> asstSettleIds = SettleRecordQueryHelperForCas.getSettleIdsByAsst("ar_settlerecord", "nckd_cas_recbill_xz", new Object[]{billId});
|
|
|
|
+ Set<Long> settleRecordIds = new HashSet();
|
|
|
|
+ settleRecordIds.addAll(mainSettleIds);
|
|
|
|
+ settleRecordIds.addAll(asstSettleIds);
|
|
|
|
+ if (settleRecordIds.size() > 0) {
|
|
|
|
+ ListShowParameter parameter = new ListShowParameter();
|
|
|
|
+ parameter.setBillFormId("ar_settlerecord");
|
|
|
|
+ parameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
|
|
|
+ ListFilterParameter param = new ListFilterParameter();
|
|
|
|
+ param.setFilter(new QFilter("id", "in", settleRecordIds));
|
|
|
|
+ parameter.setListFilterParameter(param);
|
|
|
|
+ parameter.setCustomParam("checkKey", true);
|
|
|
|
+ this.getView().showForm(parameter);
|
|
|
|
+ } else {
|
|
|
|
+ this.getView().showTipNotification(ResManager.loadKDString("暂无结算记录。", "ReceivingBillList_2", "fi-cas-formplugin", new Object[0]));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean isHwControl() {
|
|
|
|
+ return this.getPageCache().getAll().containsKey("isHwControl");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void fillFundflowItem(boolean isCover) {
|
|
|
|
+ for(int i = 0; i < this.getModel().getEntryRowCount("entry"); ++i) {
|
|
|
|
+ DynamicObject e_receivingtype = (DynamicObject)this.getModel().getValue("e_receivingtype", i);
|
|
|
|
+ if (!EmptyUtil.isEmpty(e_receivingtype)) {
|
|
|
|
+ DynamicObject fundflowitem = e_receivingtype.getDynamicObject("fundflowitem");
|
|
|
|
+ if (!EmptyUtil.isEmpty(fundflowitem)) {
|
|
|
|
+ if (isCover) {
|
|
|
|
+ this.setValue("e_fundflowitem", fundflowitem.getPkValue(), i);
|
|
|
|
+ } else {
|
|
|
|
+ this.setValueIfAbsent("e_fundflowitem", fundflowitem.getPkValue(), i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private boolean hasPayerInfo() {
|
|
|
|
+ Long payerId = Long.parseLong(this.getValue("payer") == null ? "0" : this.getValue("payer").toString());
|
|
|
|
+ String payertype = this.getString("payertype");
|
|
|
|
+ if (AsstActTypeEnum.OTHER.getValue().equals(payertype)) {
|
|
|
|
+ return !kd.fi.cas.util.StringUtils.isBlank(this.getString("payername"));
|
|
|
|
+ } else {
|
|
|
|
+ return CasHelper.isNotEmpty(payerId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setIFilters(ListFilterParameter lfp, DynamicObject recBill) {
|
|
|
|
+ logger.info("开始进行二开扩展字段对外服务业务埋点 - kd.sdk.fi.cas.extpoint.recbill.IRecbillFilter");
|
|
|
|
+ PluginProxy<IRecbillFilter> pluginProxy = PluginProxy.create(IRecbillFilter.class, "fi.cas.filter.recbill");
|
|
|
|
+ pluginProxy.callReplace((proxy) -> {
|
|
|
|
+ proxy.setIFilters(lfp, recBill);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void resetExrateTableWhenSwitchOrg(Object newValue) {
|
|
|
|
+ if (EmptyUtil.isNoEmpty(newValue)) {
|
|
|
|
+ DynamicObject org = (DynamicObject)newValue;
|
|
|
|
+ long orgId = org.getLong("id");
|
|
|
|
+ if (EmptyUtil.isNoEmpty(orgId)) {
|
|
|
|
+ long exchangeRateTableId = SystemStatusCtrolHelper.getExrateTable(orgId).getLong("id");
|
|
|
|
+ this.getModel().setValue("exratetable", exchangeRateTableId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|