예제 #1
0
 /**
  * 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));
   }
 }
예제 #2
0
  /** Add all the screen listeners. */
  public void addListeners() {
    super.addListeners();

    this.getScreenRecord()
        .getField(McoScreenRecord.AIRLINE_ID)
        .addListener(
            new InitFieldHandler(
                this.getRecord(ArControl.AR_CONTROL_FILE).getField(ArControl.AIRLINE_ID)));

    TrxStatus recTrxStatus = (TrxStatus) this.getRecord(TrxStatus.TRX_STATUS_FILE);
    recTrxStatus.getTrxStatusID(TransactionType.ACCTREC, Mco.MCO_FILE, Mco.SUBMITTED);
    this.getMainRecord().addListener(new SubFileFilter(recTrxStatus));

    this.getMainRecord().addListener(new McoCollCalcNetBeh(null));

    this.getMainRecord()
        .addListener(
            new CompareFileFilter(
                Mco.AIRLINE_ID,
                this.getScreenRecord().getField(McoScreenRecord.AIRLINE_ID),
                "=",
                null,
                false));

    this.getMainRecord()
        .getField(Mco.PAID)
        .addListener(
            new MoveOnChangeHandler(
                this.getMainRecord().getField(Mco.AMOUNT_PAID),
                this.getScreenRecord().getField(McoScreenRecord.NET)));
    FieldListener fieldBehavior =
        new MoveOnChangeHandler(
            this.getMainRecord().getField(Mco.DATE_PAID),
            this.getScreenRecord().getField(McoScreenRecord.TODAY),
            false,
            true);
    fieldBehavior.setRespondsToMode(DBConstants.INIT_MOVE, false);
    fieldBehavior.setRespondsToMode(DBConstants.READ_MOVE, false);
    this.getMainRecord().getField(Mco.AMOUNT_PAID).addListener(fieldBehavior);

    this.setEnabled(false);
    this.getScreenRecord().getField(McoScreenRecord.AIRLINE_ID).setEnabled(true);
    this.getMainRecord().getField(Mco.DATE_PAID).setEnabled(true);
    this.getMainRecord().getField(Mco.AMOUNT_PAID).setEnabled(true);
    this.getMainRecord().getField(Mco.PAID).setEnabled(true);
  }