/** * FieldChanged Method. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { Double doubleOriginalData = (Double)this.getOriginalData(); if (doubleOriginalData == null) doubleOriginalData = DoubleField.ZERO; Record recBooking = this.getOwner().getRecord(); double dNet = recBooking.getField(Booking.NET).getValue(); if (doubleOriginalData.doubleValue() != 0) // If this was just 0 zero before this change, there is no was this will trigger anything if (dNet > 0) { double dBalance = Math.floor(recBooking.getField(Booking.BALANCE).getValue() * 100 + 0.5) / 100; double dPaid = Math.floor((dNet - dBalance) * 100 + 0.5) / 100; if (dPaid >= recBooking.getField(Booking.DEPOSIT).getValue()) recBooking.getField(Booking.DEPOSIT_RECEIVED).setState(true); if (dBalance <= 0) recBooking.getField(Booking.FINAL_PAYMENT_RECEIVED).setState(true); } return super.fieldChanged(bDisplayOption, iMoveMode); }
/** * FieldChanged Method. */ public int fieldChanged(boolean bDisplayOption, int iMoveMode) { Double doubleOriginalData = (Double)this.getOriginalData(); if (doubleOriginalData == null) doubleOriginalData = DoubleField.ZERO; Record recBooking = this.getOwner().getRecord(); double dNet = recBooking.getField(Booking.NET).getValue(); if (doubleOriginalData.doubleValue() != 0) // If this was just 0 zero before this change, there is no was this will trigger anything if (dNet > 0) { double dBalance = Math.floor(recBooking.getField(Booking.BALANCE).getValue() * 100 + 0.5) / 100; double dPaid = Math.floor((dNet - dBalance) * 100 + 0.5) / 100; if (dPaid >= recBooking.getField(Booking.DEPOSIT).getValue()) recBooking.getField(Booking.DEPOSIT_RECEIVED).setState(true); if (dBalance <= 0) recBooking.getField(Booking.FINAL_PAYMENT_RECEIVED).setState(true); } return super.fieldChanged(bDisplayOption, iMoveMode); }
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (iMoveMode == DBConstants.SCREEN_MOVE) // This is necessary if an override changes the repondsTo. { Object data = this.getOriginalData(); float fOrig = 0; if (data instanceof Float) fOrig = ((Float)data).floatValue(); float fCurrent = (float)this.getOwner().getValue(); if (fCurrent != 0) if (fCurrent != fOrig) { double dCost = this.getOwner().getRecord().getField(BookingDetail.TOTAL_COST).getValue(); dCost = Math.floor((dCost / (1 + fOrig)) * (1 + fCurrent) * 100 + 0.5) / 100; this.getOwner().getRecord().getField(BookingDetail.TOTAL_COST).setValue(dCost); } this.setOriginalData(this.getOwner().getData()); } return super.fieldChanged(bDisplayOption, iMoveMode); } });
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (iMoveMode == DBConstants.SCREEN_MOVE) // This is necessary if an override changes the repondsTo. { Object data = this.getOriginalData(); float fOrig = 0; if (data instanceof Float) fOrig = ((Float)data).floatValue(); float fCurrent = (float)this.getOwner().getValue(); if (fCurrent != 0) if (fCurrent != fOrig) { double dCost = this.getOwner().getRecord().getField(BookingDetail.TOTAL_COST).getValue(); dCost = Math.floor((dCost / (1 + fOrig)) * (1 + fCurrent) * 100 + 0.5) / 100; this.getOwner().getRecord().getField(BookingDetail.TOTAL_COST).setValue(dCost); } this.setOriginalData(this.getOwner().getData()); } return super.fieldChanged(bDisplayOption, iMoveMode); } });