Skip to content

Commit

Permalink
fixed calculation / display issue. issue #2714
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Dec 2, 2024
1 parent 38c0420 commit 452407c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,7 @@ public void duplicateInvoice(String caseId, String invoiceId) {
if (this.dto.getId().equals(caseId)) {
InvoiceEntryPanel ip = new InvoiceEntryPanel(this);
ip.setEntry(this.dto, invoiceCopy, this.getInvolvedAddresses());
ip.setPaidTotal(invoiceCopy.getTotalGross(), BigDecimal.ZERO, invoiceCopy.getCurrency());
this.pnlInvoices.add(ip);
}
} catch (Exception ex) {
Expand Down Expand Up @@ -4484,7 +4485,7 @@ private void loadAccountEntries() {
if (!invoiceTotals.containsKey(cae.getInvoice().getId())) {
invoiceTotals.put(cae.getInvoice().getId(), BigDecimal.ZERO);
}
invoiceTotals.put(cae.getInvoice().getId(), invoiceTotals.get(cae.getInvoice().getId()).add(cae.calculateTotal()));
invoiceTotals.put(cae.getInvoice().getId(), invoiceTotals.get(cae.getInvoice().getId()).add(cae.calculateEarningsTotal()));
}
}
ComponentUtils.autoSizeColumns(tblAccountEntries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ public final void setEntry(Invoice invoice) {
TableUtils.clearModel(tblPayments);
BigDecimal paymentsTotal = BigDecimal.ZERO;
for (CaseAccountEntry ae : payments) {
BigDecimal aeTotal = ae.calculateTotal();
BigDecimal aeTotal = ae.calculateEarningsTotal();
paymentsTotal = paymentsTotal.add(aeTotal);
((DefaultTableModel) this.tblPayments.getModel()).addRow(new Object[]{ae.getEntryDate(), aeTotal, ae.getDescription()});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ public CaseAccountEntry(String id) {
public BigDecimal calculateTotal() {
return getEarnings().add(getEscrowIn()).add(getExpendituresIn()).subtract(getSpendings()).subtract(getEscrowOut()).subtract(getExpendituresOut());
}

public BigDecimal calculateEarningsTotal() {
return getEarnings().subtract(getSpendings());
}

@Override
public int hashCode() {
Expand Down

0 comments on commit 452407c

Please sign in to comment.