* Method called by the Form panel to insert new data.
* @param newValueObject value object to save
* @return an ErrorResponse value object in case of errors, VOResponse if the operation is successfully completed
*/
public Response insertRecord(ValueObject newPersistentObject) throws Exception {
VOListTableModel gridModel = detailFrame.getGrid().getVOListTableModel();
if (gridModel.getRowCount()<1) {
return new ErrorResponse("you must insert al least one row");
}
JournalHeaderWithVatVO jhVO = (JournalHeaderWithVatVO)newPersistentObject;
jhVO.getJournalRows().clear();
JournalRowVO jrVO = null;
JournalRowWithVatVO rowVatVO = null;
VatRowVO vatVO = null;
BigDecimal vatValue = null;
BigDecimal totalValue = new BigDecimal(0);
for(int i=0;i<gridModel.getRowCount();i++) {
// create 3 rows for each vat row value object...
rowVatVO = (JournalRowWithVatVO)gridModel.getObjectForRow(i);
// 1. add taxable income to the accounting item...
jrVO = new JournalRowVO();
jrVO.setCompanyCodeSys01ACC06(jhVO.getCompanyCodeSys01ACC05());
jrVO.setAccountCodeAcc02ACC06(rowVatVO.getAccountCodeAcc02ACC06());