/**
  * Called when a valid record is read from the table/query.
  *
  * @param bDisplayOption If true, display any changes.
  */
 public void doValidRecord(boolean bDisplayOption) {
   super.doValidRecord(bDisplayOption);
   Record recApTrx = this.getOwner();
   if (m_iDepartureEstimate == -1) {
     TrxStatus recTrxStatus =
         new TrxStatus(
             this.getOwner()
                 .findRecordOwner()); // Rarely, but if it doesn't exist in the screen, add it!
     m_iDepartureEstimate =
         recTrxStatus.getTrxStatusID(
             TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.DEP_ESTIMATE);
     m_iDepartureEstimateManual =
         recTrxStatus.getTrxStatusID(
             TransactionType.ACCTPAY, ApTrx.AP_TRX_FILE, ApTrx.DEPARTURE_EST_MANUAL);
     recTrxStatus.free();
   }
   if ((recApTrx.getField(ApTrx.TRX_STATUS_ID).getValue() == m_iDepartureEstimate)
       || (recApTrx.getField(ApTrx.TRX_STATUS_ID).getValue() == m_iDepartureEstimateManual)) {
     recApTrx
         .getField(ApTrx.INVOICE_AMOUNT)
         .moveFieldToThis(recApTrx.getField(ApTrx.DEPARTURE_ESTIMATE));
     recApTrx
         .getField(ApTrx.INVOICE_BALANCE)
         .moveFieldToThis(recApTrx.getField(ApTrx.DEPARTURE_ESTIMATE));
     recApTrx
         .getField(ApTrx.INVOICE_BALANCE_LOCAL)
         .moveFieldToThis(recApTrx.getField(ApTrx.DEPARTURE_ESTIMATE_LOCAL));
   }
 }
Beispiel #2
0
 /**
  * Set up the default screen control for this field.
  *
  * @param itsLocation Location of this component on screen (ie., GridBagConstraint).
  * @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
  * @param converter The converter to set the screenfield to.
  * @param iDisplayFieldDesc Display the label? (optional).
  * @param properties Extra properties
  * @return Return the component or ScreenField that is created for this field.
  */
 public ScreenComponent setupDefaultView(
     ScreenLoc itsLocation,
     ComponentParent targetScreen,
     Convert converter,
     int iDisplayFieldDesc,
     Map<String, Object> properties) {
   if (targetScreen != null) {
     Record recCurrencys =
         (Record) Utility.getRecordOwner(targetScreen).getRecord(Currencys.CURRENCYS_FILE);
     if (recCurrencys != null) {
       BaseField fldCurrencyCode = recCurrencys.getField(Currencys.CURRENCY_CODE);
       Converter conv =
           new FieldDescConverter(
               fldCurrencyCode, (Converter) converter); // Use the description for this field
       ScreenComponent sfCurrency =
           createScreenComponent(
               ScreenModel.EDIT_TEXT,
               itsLocation,
               targetScreen,
               conv,
               iDisplayFieldDesc,
               properties);
       sfCurrency.setEnabled(false);
       itsLocation =
           targetScreen.getNextLocation(
               ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR);
       iDisplayFieldDesc = ScreenConstants.DONT_DISPLAY_DESC; // Display it only once
     }
   }
   return super.setupDefaultView(
       itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
 }
Beispiel #3
0
 /** Set up all the screen fields. */
 public void setupSFields() {
   Record recVendor =
       ((ReferenceField) this.getMainRecord().getField(ApTrx.VENDOR_ID)).getReferenceRecord(this);
   if (recVendor != null) { // Make sure currency is read for LocalCurrencyField(s).
     Record recCurrencys =
         ((ReferenceField) recVendor.getField(Vendor.CURRENCYS_ID)).getReferenceRecord(this);
     recVendor.getField(Vendor.CURRENCYS_ID).addListener(new ReadSecondaryHandler(recCurrencys));
   }
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.CODE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.TRX_STATUS_ID)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.VENDOR_ID)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.TOUR_ID)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DESCRIPTION)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.START_SERVICE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.END_SERVICE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.FINALIZATION_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_ESTIMATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_EXCHANGE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.DEPARTURE_ESTIMATE_LOCAL)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_NO)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_AMOUNT)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_LOCAL)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_BALANCE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.INVOICE_BALANCE_LOCAL)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.AMOUNT_SELECTED)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.ACKNOWLEDGE_DATE)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.ACKNOWLEDGED_ON)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
   this.getRecord(ApTrx.AP_TRX_FILE)
       .getField(ApTrx.ACKNOWLEDGED_BY)
       .setupDefaultView(
           this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT),
           this,
           ScreenConstants.DEFAULT_DISPLAY);
 }