// retrieve payed expirations...
ArrayList exp = new ArrayList();
for(int i=0;i<frame.getGrid().getVOListTableModel().getRowCount();i++)
exp.add( frame.getGrid().getVOListTableModel().getObjectForRow(i) );
if (exp.size()==0)
return new ErrorResponse("you need to specify at least one expiration");
PaymentVO payVO = (PaymentVO)frame.getPayForm().getVOModel().getValueObject();
// check total amount...
BigDecimal total = new BigDecimal(0);
PaymentDistributionVO vo = null;
for(int i=0;i<exp.size();i++) {
vo = (PaymentDistributionVO)exp.get(i);
if (vo.getPaymentValueDOC28()==null)
return new ErrorResponse("expirations must have a payment value");
total = total.add(vo.getPaymentValueDOC28());
}
if ( payVO.getPaymentValueDOC27().subtract(total).doubleValue()!=0)
return new ErrorResponse("payments specified for expirations are not equal to the total payment value");
Response res = ClientUtils.getData("insertPayment",new Object[]{
newPersistentObject,
exp
});