/** * Compute the target value. * @param srcValue The value of this listener's owner. * @return The value to set the target field to. */ public double computeValue(double srcValue) { double dateOtherDate = 0; double dateThisDate = 0; if (m_fldOtherDate != null) dateOtherDate = m_fldOtherDate.getValue(); else dateOtherDate = DateField.todaysDate(); dateThisDate = ((DateTimeField)this.getOwner()).getValue(); double tsDifference = (Math.floor((dateThisDate - dateOtherDate + 0.5)) / DBConstants.KMS_IN_A_DAY); // Rounded number of days return tsDifference; // Difference between this date and target } }
/** * Compute the target value. * @param srcValue The value of this listener's owner. * @return The value to set the target field to. */ public double computeValue(double srcValue) { double dateOtherDate = 0; double dateThisDate = 0; if (m_fldOtherDate != null) dateOtherDate = m_fldOtherDate.getValue(); else dateOtherDate = DateField.todaysDate(); dateThisDate = ((DateTimeField)this.getOwner()).getValue(); double tsDifference = (Math.floor((dateThisDate - dateOtherDate + 0.5)) / DBConstants.KMS_IN_A_DAY); // Rounded number of days return tsDifference; // Difference between this date and target } }
/** * Compute the target value. * @param srcValue The value of this listener's owner. * @return The value to set the target field to. */ public double computeValue(double srcValue) { double dateOtherDate = 0; double dateThisDate = 0; if (m_fldOtherDate != null) dateOtherDate = m_fldOtherDate.getValue(); else dateOtherDate = DateField.todaysDate(); dateThisDate = ((DateTimeField)this.getOwner()).getValue(); double tsDifference = (Math.floor((dateThisDate - dateOtherDate + 0.5)) / DBConstants.KMS_IN_A_DAY); // Rounded number of days return tsDifference; // Difference between this date and target } }
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField) { DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); double dDate = 0; if (m_bMoveCurrentTime) dDate = DateField.currentTime(); else dDate = DateField.todaysDate(); int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } return DBConstants.NORMAL_RETURN; } }
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField) { DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); double dDate = 0; if (m_bMoveCurrentTime) dDate = DateField.currentTime(); else dDate = DateField.todaysDate(); int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } return DBConstants.NORMAL_RETURN; } }
/** * The Field has Changed. * @param bDisplayOption If true, display the change. * @param iMoveMode The type of move being done (init/read/screen). * @return The error code (or NORMAL_RETURN if okay). */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField) { DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); double dDate = 0; if (m_bMoveCurrentTime) dDate = DateField.currentTime(); else dDate = DateField.todaysDate(); int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } return DBConstants.NORMAL_RETURN; } }
/** * OnPost Method. */ public boolean onPost() { try { TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE); Object bookmark = recTrxStatus.getHandle(DBConstants.DATA_SOURCE_HANDLE); int iNewTrxType = recTrxStatus.getTrxStatusID(TransactionType.AIR, TicketTrx.TICKET_TRX_FILE, TicketTrx.ARC_SUBMITTED); recTrxStatus.setHandle(bookmark, DBConstants.DATA_SOURCE_HANDLE); Record recTicketTrx = this.getMainRecord(); recTicketTrx.close(); while (recTicketTrx.hasNext()) { recTicketTrx.next(); recTicketTrx.edit(); recTicketTrx.getField(TicketTrx.TRX_STATUS_ID).setValue(iNewTrxType); recTicketTrx.getField(TicketTrx.ARC_DATE).setValue(DateField.todaysDate()); recTicketTrx.set(); } } catch (DBException ex) { ex.printStackTrace(); return false; } return true; }
/** * Add all the screen listeners. */ public void addListeners() { super.addListeners(); TrxStatus recTrxStatus = (TrxStatus)this.getRecord(TrxStatus.TRX_STATUS_FILE); recTrxStatus.getTrxStatusID(TransactionType.AIR, TicketTrx.TICKET_TRX_FILE, TicketTrx.TICKETED); this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(TicketTrx.TRX_STATUS_ID), recTrxStatus.getField(TrxStatus.ID), "=")); this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(TicketTrx.ISSUE_DATE), this.getScreenRecord().getField(ArcReportScreenRecord.LAST_ARC_DATE), "<=")); this.getScreenRecord().getField(ArcReportScreenRecord.LAST_ARC_DATE).setSFieldToProperty(); this.getScreenRecord().getField(ArcReportScreenRecord.SUMMARY_ACCOUNT_ID).setSFieldToProperty(); if (this.getScreenRecord().getField(ArcReportScreenRecord.LAST_ARC_DATE).isNull()) this.getScreenRecord().getField(ArcReportScreenRecord.LAST_ARC_DATE).setValue(DateField.todaysDate()); if (this.getScreenRecord().getField(ArcReportScreenRecord.SUMMARY_ACCOUNT_ID).isNull()) this.getScreenRecord().getField(ArcReportScreenRecord.SUMMARY_ACCOUNT_ID).addListener(new InitFieldHandler(this.getRecord(ApControl.AP_CONTROL_FILE).getField(ApControl.ARC_SUMMARY_ACCOUNT_ID))); // Report totals this.getMainRecord().addListener(new SubCountHandler(this.getScreenRecord().getField(ArcReportScreenRecord.REPORT_TOTAL), TicketTrx.NET_FARE, true, true)); } /**