/** * Open the header record. * @return The new header record. */ public Record openHeaderRecord() { return new Vendor(this); } /**
/** * SetProperty Method. */ public boolean setProperty(String strKey, String strProperty) { if (TrxMessageHeader.DESTINATION_PARAM.equalsIgnoreCase(strKey)) this.getField(Vendor.WEB).setString(strProperty); else ((PropertiesField)this.getField(Vendor.PROPERTIES)).setProperty(strKey, strProperty); return true; } /**
/** * Add the behaviors to calculate the "Amount Selected" and Balance field. */ public ApTrx addSelectBehaviors() { RecordOwner recordOwner = this.findRecordOwner(); ApTrx recApTrx2 = new ApTrx(recordOwner); // Don't add second copy to screen if (recordOwner != null) recordOwner.removeRecord(recApTrx2); this.addListener(new FreeOnFreeHandler(recApTrx2)); // ...but be sure to free it recApTrx2.addListener(new SubFileFilter(this)); this.addListener(new RecountOnValidHandler(recApTrx2)); BooleanField fldTrue = new BooleanField(null, "True", 1, null, new Boolean(true)); recApTrx2.addListener(new FreeOnFreeHandler(fldTrue)); recApTrx2.addListener(new CompareFileFilter(ApTrx.ACTIVE_TRX, fldTrue, "=", fldTrue, true)); recApTrx2.addListener(new SubCountHandler(this.getField(Vendor.AMOUNT_SELECTED), ApTrx.AMOUNT_SELECTED, true, true)); recApTrx2.addListener(new SubCountHandler(this.getField(Vendor.VENDOR_BALANCE), ApTrx.INVOICE_BALANCE, true, true)); return recApTrx2; } /**
|| (recVendor.getEditMode() == DBConstants.EDIT_ADD) || (recVendor.getEditMode() == DBConstants.EDIT_NONE)) return DBConstants.ERROR_RETURN; this.setOpenMode(iOldOpenMode & ~DBConstants.OPEN_READ_ONLY); // Allow write (I don't know where this file has been) this.addNew(); // Each A/P Trx contains one detail item if (OperationTypeField.INDIVIDUALLY_CODE.equalsIgnoreCase(recVendor.getField(Vendor.OPERATION_TYPE_CODE).toString())) this.addNew(); // Each A/P Trx contains one detail item else this.getField(ApTrx.VENDOR_ID).moveFieldToThis(recVendor.getField(Vendor.ID)); if (OperationTypeField.LIKE_TOGETHER_CODE.equalsIgnoreCase(recVendor.getField(Vendor.OPERATION_TYPE_CODE).toString())) this.getField(ApTrx.PRODUCT_TYPE_ID).moveFieldToThis((BaseField)recBookingDetail.getField(BookingDetailModel.PRODUCT_TYPE_ID)); if ((this.seek(">=")) && (this.getField(ApTrx.TOUR_ID).equals(recBookingDetail.getField(BookingDetailModel.TOUR_ID))) && (this.getField(ApTrx.VENDOR_ID).equals(recVendor.getField(Vendor.ID))))
/** * GetNextMessageDetailTarget Method. */ public MessageDetailTarget getNextMessageDetailTarget() { if (m_recApControl == null) { RecordOwner recordOwner = this.findRecordOwner(); m_recApControl = new ApControl(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recApControl); this.addListener(new FreeOnFreeHandler(m_recApControl)); } return m_recApControl; } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); Vendor recVendor = (Vendor)this.getMainRecord(); Record recScreenRecord = this.getScreenRecord(); ((NumberField)recScreenRecord.getField(VendorScreenRecord.VENDOR_KEY)).setValue(0, DBConstants.DISPLAY, DBConstants.INIT_MOVE); recScreenRecord.getField(VendorScreenRecord.VENDOR_KEY).addListener(new RegisterValueHandler(null)); this.setEditing(false); SortOrderHandler keyBehavior = new SortOrderHandler(this); keyBehavior.setGridTable(Vendor.NAME_SORT_KEY, recVendor, 0); keyBehavior.setGridTable(Vendor.CODE_KEY, recVendor, 1); recScreenRecord.getField(VendorScreenRecord.VENDOR_KEY).addListener(keyBehavior); recVendor.addListener(new ExtractRangeFilter(Vendor.NAME_SORT, recScreenRecord.getField(VendorScreenRecord.VENDOR_NAME), ExtractRangeFilter.PAD_END_FIELD)); recVendor.addListener(new ExtractRangeFilter(Vendor.COUNTRY_ID, recScreenRecord.getField(VendorScreenRecord.VENDOR_COUNTRY), ExtractRangeFilter.PAD_END_FIELD)); recScreenRecord.getField(VendorScreenRecord.VENDOR_NAME).addListener(new FieldReSelectHandler(this)); recScreenRecord.getField(VendorScreenRecord.VENDOR_COUNTRY).addListener(new FieldReSelectHandler(this)); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.getMainRecord().setKeyArea(Vendor.CURRENCYS_ID_KEY); this.getMainRecord().addListener(new SubFileFilter(this.getScreenRecord().getField(CurrencyReqScreenRecord.CURRENCYS_ID), Vendor.CURRENCYS_ID, null, null, null, null, true)); this.getScreenRecord().getField(CurrencyReqScreenRecord.CURRENCYS_ID).addListener(new FieldReSelectHandler(this)); ApTrx recApTrx = ((Vendor)this.getMainRecord()).addSelectBehaviors(); this.getMainRecord().addListener(new SubCountHandler(this.getScreenRecord().getField(CurrencyReqScreenRecord.BALANCE_TOTAL), Vendor.VENDOR_BALANCE, true, true)); this.getMainRecord().addListener(new SubCountHandler(this.getScreenRecord().getField(CurrencyReqScreenRecord.TOTAL_TOTAL), Vendor.AMOUNT_SELECTED, true, true)); this.setEnabled(false); } /**
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); ((Vendor)this.getMainRecord()).addPropertyListeners(); this.addMainKeyBehavior(); this.getMainRecord().getField(Vendor.COUNTRY_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.COUNTRY_ID))); this.getMainRecord().getField(Vendor.CURRENCYS_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.CURRENCYS_ID))); this.getMainRecord().getField(Vendor.MESSAGE_TRANSPORT_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.MESSAGE_TRANSPORT_ID))); this.getMainRecord().getField(Vendor.VENDOR_STATUS_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.VENDOR_STATUS_ID))); this.getMainRecord().getField(Vendor.PAYMENT_CYCLE_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.PAYMENT_CYCLE_ID))); this.getMainRecord().getField(Vendor.PAYMENT_CODE_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.PAYMENT_CODE_ID))); this.getMainRecord().getField(Vendor.PREPAY_TYPE_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.PREPAY_TYPE_ID))); this.getMainRecord().getField(Vendor.DEFAULT_ACCOUNT_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.COST_ACCOUNT_ID))); Record recCountry = ((ReferenceField)this.getMainRecord().getField(Vendor.COUNTRY_ID)).getReferenceRecord(); this.getMainRecord().getField(Vendor.COUNTRY_ID).addListener(new MoveOnChangeHandler(this.getMainRecord().getField(Vendor.COUNTRY), recCountry.getField(Country.NAME), false, true)); } /**
if (this.getField(ApTrx.VENDOR_ID).compareTo(recBookingDetail.getField(BookingDetailModel.VENDOR_ID)) != 0) break; if (recVendor.getEditMode() == DBConstants.EDIT_CURRENT) if (OperationTypeField.LIKE_TOGETHER_CODE.equalsIgnoreCase(recVendor.getField(Vendor.OPERATION_TYPE_CODE).toString())) if (this.getField(ApTrx.PRODUCT_TYPE_ID).compareTo(recBookingDetail.getField(BookingDetailModel.PRODUCT_TYPE_ID)) != 0) break; // Each A/P Trx contains all detail items in this product type if (recVendor.getEditMode() == DBConstants.EDIT_CURRENT) if (OperationTypeField.INDIVIDUALLY_CODE.equalsIgnoreCase(recVendor.getField(Vendor.OPERATION_TYPE_CODE).toString())) break; // Each A/P Trx contains one detail item
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); this.addMainKeyBehavior(); TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE); EnableScreenHandler behavior = new EnableScreenHandler(ApTrx.TRX_STATUS_ID); this.getMainRecord().addListener(behavior); recTrxStatus.getTrxStatusID(TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.PREPAYMENT); behavior.addComparison(recTrxStatus.getField(TrxStatus.ID).getData()); recTrxStatus.getTrxStatusID(TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.DEBIT_MEMO); behavior.addComparison(recTrxStatus.getField(TrxStatus.ID).getData()); recTrxStatus.getTrxStatusID(TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.BROKER_PAYMENT); behavior.addComparison(recTrxStatus.getField(TrxStatus.ID).getData()); m_recSelectApTrx = ((Vendor)this.getRecord(Vendor.VENDOR_FILE)).addSelectBehaviors(); FilterApTrxHandler filter = new FilterApTrxHandler(null); m_recSelectApTrx.addListener(filter); filter.addTrxStatusID(ApTrx.INVOICE); filter.addTrxStatusID(ApTrx.INVOICE_NON_TOUR); filter.addTrxStatusID(ApTrx.CREDIT_MEMO); } /**
/** * Override this to open the main file. * <p />You should pass this record owner to the new main file (ie., new MyNewTable(thisRecordOwner)). * @return The new record. */ public Record openMainRecord() { return new Vendor(this); } /**
/** * OpenHeaderRecord Method. */ public Record openHeaderRecord() { return new Vendor(this); } /**
/** * Add the information from this record to this message header. */ public MessageTransport getMessageTransport(TrxMessageHeader trxMessageHeader) { return (MessageTransport)((ReferenceField)this.getField(Vendor.MESSAGE_TRANSPORT_ID)).getReference(); } /**
/** * Override this to open the main file. * <p />You should pass this record owner to the new main file (ie., new MyNewTable(thisRecordOwner)). * @return The new record. */ public Record openMainRecord() { return new Vendor(this); } /**
/** * Add the destination information of this person to the message. */ public TrxMessageHeader addDestInfo(TrxMessageHeader trxMessageHeader) { String strMessageTransport = (String)trxMessageHeader.get(MessageTransport.SEND_MESSAGE_BY_PARAM); if (((MessageTransport.SOAP.equalsIgnoreCase(strMessageTransport)) || (MessageTransport.XML.equalsIgnoreCase(strMessageTransport))) && (trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM) == null)) { String strDestination = ((PropertiesField)this.getField(Vendor.PROPERTIES)).getProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM); if (strDestination != null) { if (strDestination.startsWith("/")) if (!this.getField(Person.WEB).isNull()) strDestination = this.getField(Person.WEB).toString() + strDestination; trxMessageHeader.put(TrxMessageHeader.DESTINATION_PARAM, strDestination); } else trxMessageHeader.put(TrxMessageHeader.DESTINATION_PARAM, this.getField(Person.WEB).toString()); } trxMessageHeader = super.addDestInfo(trxMessageHeader); return trxMessageHeader; } /**
/** * Override this to open the main file. * <p />You should pass this record owner to the new main file (ie., new MyNewTable(thisRecordOwner)). * @return The new record. */ public Record openMainRecord() { return new Vendor(this); } /**
/** * Utility method to get the invoice amount and convert it to USD * using the last exchange rate in the currency file. * @return The invoice amount converted to USD. */ public double getInvoiceAmtUSD() { Record recApTrx = this.getOwner(); double dAmountUSD = 0; Vendor recVendor = (Vendor)((ReferenceField)recApTrx.getField(ApTrx.VENDOR_ID)).getReference(); Currencys recCurrencys = null; if (recVendor != null) recCurrencys = (Currencys)((ReferenceField)recVendor.getField(Vendor.CURRENCYS_ID)).getReference(); double dExchange = 1; if (recCurrencys != null) dExchange = recCurrencys.getField(Currencys.LAST_RATE).getValue(); double dAmount = recApTrx.getField(ApTrx.INVOICE_AMOUNT).getValue(); dAmountUSD = (Math.floor(dAmount * dExchange * 100 + 0.5)) / 100; return dAmountUSD; } /**
/** * OpenHeaderRecord Method. */ public Record openHeaderRecord() { return new Vendor(this); } /**
/** * AddPropertyListeners Method. */ public void addPropertyListeners() { BaseField fldProperties = this.getField(Vendor.PROPERTIES); BaseField fldDisplay = this.getField(Vendor.MESSAGE_SERVER); FieldListener listener = new CopyConvertersHandler(new PropertiesConverter(fldProperties, TrxMessageHeader.DESTINATION_MESSAGE_PARAM)); listener.setRespondsToMode(DBConstants.INIT_MOVE, false); listener.setRespondsToMode(DBConstants.READ_MOVE, false); fldDisplay.addListener(listener); listener = new CopyConvertersHandler(fldDisplay, new PropertiesConverter(fldProperties, TrxMessageHeader.DESTINATION_MESSAGE_PARAM)); fldProperties.addListener(listener); fldDisplay = this.getField(Vendor.WSDL_PATH); listener = new CopyConvertersHandler(new PropertiesConverter(fldProperties, TrxMessageHeader.WSDL_PATH)); listener.setRespondsToMode(DBConstants.INIT_MOVE, false); listener.setRespondsToMode(DBConstants.READ_MOVE, false); fldDisplay.addListener(listener); listener = new CopyConvertersHandler(fldDisplay, new PropertiesConverter(fldProperties, TrxMessageHeader.WSDL_PATH)); fldProperties.addListener(listener); } /**