/** * SetValue in current calendar. * @param value The date (as a calendar value) to set (only time portion is used). * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.YEAR, DBConstants.FIRST_YEAR); value.set(Calendar.MONTH, Calendar.JANUARY); value.set(Calendar.DATE, 1); } return super.setCalendar(value, bDisplayOption, moveMode); } /**
/** * SetValue in current calendar. * @param value The date (as a calendar value) to set (only time portion is used). * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.YEAR, DBConstants.FIRST_YEAR); value.set(Calendar.MONTH, Calendar.JANUARY); value.set(Calendar.DATE, 1); } return super.setCalendar(value, bDisplayOption, moveMode); } /**
/** * SetValue in current calendar. * @param value The date (as a calendar value) to set (only time portion is used). * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.YEAR, DBConstants.FIRST_YEAR); value.set(Calendar.MONTH, Calendar.JANUARY); value.set(Calendar.DATE, 1); } return super.setCalendar(value, bDisplayOption, moveMode); } /**
/** * SetValue in current calendar. * @param value The date (as a calendar value) to set (only date portion is used). * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); } /**
/** * SetValue in current calendar. * @param value The date (as a calendar value) to set (only date portion is used). * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); } /**
/** * SetValue in current calendar. * @param value The date (as a calendar value) to set (only date portion is used). * @param bDisplayOption Display changed fields if true. * @param iMoveMode The move mode. * @return The error code (or NORMAL_RETURN). */ public int setCalendar(Calendar value, boolean bDisplayOption, int moveMode) { // Set this field's value if (value != null) { value.set(Calendar.HOUR_OF_DAY, 0); value.set(Calendar.MINUTE, 0); value.set(Calendar.SECOND, 0); value.set(Calendar.MILLISECOND, 0); } return super.setCalendar(value, bDisplayOption, moveMode); } /**
/** * Bump time field by a second. * @param fieldTarget * @return */ public Date bumpTime(DateTimeField fieldTarget) { Date dateBefore = fieldTarget.getDateTime(); Calendar calTarget = fieldTarget.getCalendar(); calTarget.add(Calendar.SECOND, 1); fieldTarget.setCalendar(calTarget, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); return dateBefore; } }
/** * Bump time field by a second. * @param fieldTarget * @return */ public Date bumpTime(DateTimeField fieldTarget) { Date dateBefore = fieldTarget.getDateTime(); Calendar calTarget = fieldTarget.getCalendar(); calTarget.add(Calendar.SECOND, 1); fieldTarget.setCalendar(calTarget, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); return dateBefore; } }
/** * Bump time field by a second. * @param fieldTarget * @return */ public Date bumpTime(DateTimeField fieldTarget) { Date dateBefore = fieldTarget.getDateTime(); Calendar calTarget = fieldTarget.getCalendar(); calTarget.add(Calendar.SECOND, 1); fieldTarget.setCalendar(calTarget, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); return dateBefore; } }
calendar.add(Calendar.MONTH, m_lMonths); calendar.add(Calendar.DATE, m_lDays); return ((DateTimeField)this.getOwner()).setCalendar(calendar, bDisplayOption, iMoveMode);
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
/** * Set the date field to the current time. * Also make sure the time is not the same as it is currently. */ public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); } /**
((DateTimeField)this.getField(Tour.TICKET_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); ((DateTimeField)this.getField(Tour.SP_1_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); ((DateTimeField)this.getField(Tour.SP_2_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); ((DateTimeField)this.getField(Tour.FINAL_DOC_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); ((DateTimeField)this.getField(Tour.ORDER_COMP_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); ((DateTimeField)this.getField(Tour.FINALIZE_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); ((DateTimeField)this.getField(Tour.CLOSED_DATE)).setCalendar(calTargetDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
if (finalDate.before(calCurrentTime)) finalDate = calCurrentTime; ((DateTimeField)this.getField(Booking.FINAL_PAYMENT_DUE_DATE)).setCalendar(finalDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); if (depositDate.after(finalDate)) depositDate = finalDate; ((DateTimeField)this.getField(Booking.DEPOSIT_DUE_DATE)).setCalendar(depositDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
if (finalDate.before(calCurrentTime)) finalDate = calCurrentTime; ((DateTimeField)this.getField(Booking.FINAL_PAYMENT_DUE_DATE)).setCalendar(finalDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); if (depositDate.after(finalDate)) depositDate = finalDate; ((DateTimeField)this.getField(Booking.DEPOSIT_DUE_DATE)).setCalendar(depositDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
cal.add(Calendar.MONTH, -6); cal.set(Calendar.DAY_OF_YEAR, 1); ((DateTimeField)this.getScreenRecord().getField(ApReportScreenRecord.START_DATE)).setCalendar(cal, true, DBConstants.INIT_MOVE); cal.add(Calendar.YEAR, 1); cal.add(Calendar.DAY_OF_YEAR, -1); ((DateTimeField)this.getScreenRecord().getField(ApReportScreenRecord.END_DATE)).setCalendar(cal, true, DBConstants.INIT_MOVE);
cal.add(Calendar.MONTH, -6); cal.set(Calendar.DAY_OF_YEAR, 1); ((DateTimeField)this.getScreenRecord().getField(ApReportScreenRecord.START_DATE)).setCalendar(cal, true, DBConstants.INIT_MOVE); cal.add(Calendar.YEAR, 1); cal.add(Calendar.DAY_OF_YEAR, -1); ((DateTimeField)this.getScreenRecord().getField(ApReportScreenRecord.END_DATE)).setCalendar(cal, true, DBConstants.INIT_MOVE);
/** * Add the A/R trx entry for the total invoice amount. */ public void addInvoiceEntry() { ArTrx recArTrx = (ArTrx)this.getOwner(); Calendar calTrxDate = ((DateTimeField)this.getOwner().getField(ArTrx.TRX_DATE)).getCalendar(); if (calTrxDate != null) calTrxDate.add(Calendar.MINUTE, -1); // Just so it will come before the previous entry boolean bOldState = this.setEnabledListener(true); // This method IS disabled, but must be enabled if I update this record (so count is correct) try { SubFileFilter filter = (SubFileFilter)this.getOwner().getListener(SubFileFilter.class); BookingModel recBooking = (BookingModel)filter.getMainRecord(); recBooking.addArDetail(recArTrx, null, false); // Being careful recArTrx.addNew(); double dBalance = recBooking.getField(BookingModel.NET).getValue(); recArTrx.getField(ArTrx.AMOUNT).setValue(dBalance); ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setCalendar(calTrxDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Just before the previous entry. recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iInvoiceTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.add(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bOldState); } }
/** * Add the A/R trx entry for the total invoice amount. */ public void addInvoiceEntry() { ArTrx recArTrx = (ArTrx)this.getOwner(); Calendar calTrxDate = ((DateTimeField)this.getOwner().getField(ArTrx.TRX_DATE)).getCalendar(); if (calTrxDate != null) calTrxDate.add(Calendar.MINUTE, -1); // Just so it will come before the previous entry boolean bOldState = this.setEnabledListener(true); // This method IS disabled, but must be enabled if I update this record (so count is correct) try { SubFileFilter filter = (SubFileFilter)this.getOwner().getListener(SubFileFilter.class); BookingModel recBooking = (BookingModel)filter.getMainRecord(); recBooking.addArDetail(recArTrx, null, false); // Being careful recArTrx.addNew(); double dBalance = recBooking.getField(BookingModel.NET).getValue(); recArTrx.getField(ArTrx.AMOUNT).setValue(dBalance); ((DateTimeField)recArTrx.getField(ArTrx.TRX_DATE)).setCalendar(calTrxDate, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Just before the previous entry. recArTrx.getField(ArTrx.TRX_STATUS_ID).setValue(iInvoiceTrxStatus); recArTrx.getField(ArTrx.COMMENTS).moveFieldToThis(((ReferenceField)recArTrx.getField(ArTrx.TRX_STATUS_ID)).getReference().getField(TrxStatus.STATUS_DESC)); recArTrx.add(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bOldState); } }