/** * Get (or make) the current record for this reference. */ public Record makeReferenceRecord(RecordOwner recordOwner) { return new Currencys(recordOwner); } /**
/** * Constructor. */ public Currencys(RecordOwner screen) { this(); this.init(screen); } /**
/** * Convert to USD. */ public double convertCostToUSD(double dCost, boolean bCostingExchange) { double dExchange; if ((bCostingExchange) && (!this.getField(Currencys.COSTING_RATE).isNull())) dExchange = this.getField(Currencys.COSTING_RATE).getValue(); else dExchange = this.getField(Currencys.LAST_RATE).getValue(); dCost = Math.floor(dCost * dExchange * 100.00 + 0.5) / 100.00; return dCost; }
/** * Add this key area description to the Record. */ public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == 0) { keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); keyArea.addKeyField(ID, DBConstants.ASCENDING); } if (iKeyArea == 1) { keyArea = this.makeIndex(DBConstants.SECONDARY_KEY, CURRENCY_CODE_KEY); keyArea.addKeyField(CURRENCY_CODE, DBConstants.ASCENDING); } if (iKeyArea == 2) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, DESCRIPTION_KEY); keyArea.addKeyField(DESCRIPTION, DBConstants.ASCENDING); } if (keyArea == null) keyArea = super.setupKey(iKeyArea); return keyArea; } /**
/** * AddMasterListeners Method. */ public void addMasterListeners() { DateUpdatedHandler update1 = new DateUpdatedHandler(Currencys.RATE_CHANGED_DATE); this.getField(Currencys.LAST_RATE).addListener(update1); ChangedByHandler name1 = new ChangedByHandler(Currencys.RATE_CHANGED_BY); this.getField(Currencys.LAST_RATE).addListener(name1); DateUpdatedHandler update2 = new DateUpdatedHandler(Currencys.COSTING_CHANGED_DATE); this.getField(Currencys.COSTING_RATE).addListener(update2); ChangedByHandler name2 = new ChangedByHandler(Currencys.COSTING_CHANGED_BY); this.getField(Currencys.COSTING_RATE).addListener(name2); } /**
/** * 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 Currencys(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; } /**
/** * 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 Currencys(this); } /**
/** * Override this to open the other files in the query. */ public void openOtherRecords() { super.openOtherRecords(); new Vendor(this); new Currencys(this); // new BkCountry(this); // new BkCity(this); } /**
/** * Override this to open the other files in the query. */ public void openOtherRecords() { super.openOtherRecords(); new Currencys(this); new Account(this); } /**
/** * Override this to open the other files in the query. */ public void openOtherRecords() { super.openOtherRecords(); new Vendor(this); new Currencys(this); } /**
/** * Override this to open the other files in the query. */ public void openOtherRecords() { super.openOtherRecords(); new Currencys(this); new Vendor(this); } /**
/** * Override this to open the other files in the query. */ public void openOtherRecords() { super.openOtherRecords(); new Currencys(this); new Vendor(this); } /**