From 452407ceba1efd8e52240dcad4d7d22614730ec2 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Mon, 2 Dec 2024 22:44:45 +0100 Subject: [PATCH] fixed calculation / display issue. issue #2714 --- .../jlawyer/client/editors/files/ArchiveFilePanel.java | 3 ++- .../jlawyer/client/editors/files/InvoiceDialog.java | 2 +- .../com/jdimension/jlawyer/persistence/CaseAccountEntry.java | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java index 2b517e12..785cfa4d 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java @@ -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) { @@ -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); diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java index cadcb209..548edd77 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/InvoiceDialog.java @@ -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()}); } diff --git a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/CaseAccountEntry.java b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/CaseAccountEntry.java index 3dffe0a9..186dcd8d 100644 --- a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/CaseAccountEntry.java +++ b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/CaseAccountEntry.java @@ -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() {