}
}
private Invoice saveInvoice() {
Log.out.debug("Begin EditInvoice.saveInvoice()");
Invoice invc = null;
try {
connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
invc = new Invoice(getSession().getDms(), getId());
invc.setBaseAmounts(getBaseAmounts());
bindObject(this,invc);
if (getBillDay()>0 && getBillMonth()>0 && getBillYear()>0) {
invc.setInvoiceDate(new Date(getBillYear()-1900, getBillMonth()-1, getBillDay()));
} else {
invc.remove("year");
invc.remove("quarter");
invc.remove("month");
invc.remove("invoice_date");
}
if (getDueDay()>0 && getDueMonth()>0 && getDueYear()>0)
invc.setDueDate(new Date(getDueYear()-1900, getDueMonth()-1, getDueDay()));
invc.save(getSession(), getSessionAttribute("user_uuid"), getProcessed(), getApproved(), getMistakes());
BigDecimal total = invc.computeTotal();
if (getTotalAmount().subtract(total).abs().floatValue()>0.04f) {
Log.out.warn("Invoice "+invc.id()+" mismatch between supplied ("+getTotalAmount().toString()+") and computed ("+total.toString()+") total amounts");
DAO.log(getSession(), invc.getDocument(), Invoice.class, "AMOUNT MISMATCH", Level.WARNING, "mismatch between supplied ("+getTotalAmount().toString()+") and computed ("+total.toString()+") total amounts");
}
disconnect();
} catch (Exception xcpt) {
Log.out.error(xcpt.getMessage(), xcpt);
} finally {