This is an automated email from the git hooks/post-receive script. New change to branch develop in repository lima. See http://git.chorem.org/lima.git from 3d5a336 Merge branch 'feature/1241-account-report' into develop new a200c71 refs #1287 ajout du montant total pour à l'onglet Lettrage new 746e8ce refs #1287 import manquant new 07988ba Merge branch 'feature/1287-compute-summary-on-lettering' into develop The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 07988ba535e2b9f8e6410ef935b1805370af400d Merge: 3d5a336 746e8ce Author: dcosse <cosse@codelutin.com> Date: Mon Nov 30 13:22:21 2015 +0100 Merge branch 'feature/1287-compute-summary-on-lettering' into develop commit 746e8ced15a7685f5301a21b658bcc93c1c31cfe Author: dcosse <cosse@codelutin.com> Date: Mon Nov 30 13:20:07 2015 +0100 refs #1287 import manquant commit a200c71f682c787ac1a4b283163607cd7453e44f Author: dcosse <cosse@codelutin.com> Date: Wed Sep 9 12:50:14 2015 +0200 refs #1287 ajout du montant total pour à l'onglet Lettrage Summary of changes: .../FinancialTransactionViewHandler.java | 14 +++---- .../lima/ui/lettering/LetteringEditModel.java | 49 ++++++++++++++++++++-- .../lima/ui/lettering/LetteringViewHandler.java | 46 ++++++++++++++++++-- .../resources/i18n/lima-swing_en_GB.properties | 2 +- .../resources/i18n/lima-swing_fr_FR.properties | 2 +- 5 files changed, 97 insertions(+), 16 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit a200c71f682c787ac1a4b283163607cd7453e44f Author: dcosse <cosse@codelutin.com> Date: Wed Sep 9 12:50:14 2015 +0200 refs #1287 ajout du montant total pour à l'onglet Lettrage --- .../FinancialTransactionViewHandler.java | 14 +++---- .../lima/ui/lettering/LetteringEditModel.java | 49 ++++++++++++++++++++-- .../lima/ui/lettering/LetteringViewHandler.java | 45 ++++++++++++++++++-- .../resources/i18n/lima-swing_en_GB.properties | 2 +- .../resources/i18n/lima-swing_fr_FR.properties | 2 +- 5 files changed, 96 insertions(+), 16 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java index d8ac8b8..027dff2 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java @@ -152,14 +152,14 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo @Override public void tableChanged(TableModelEvent e) { - boolean mustRecompute = e.getType() == TableModelEvent.DELETE - || e.getType() == TableModelEvent.INSERT - || (e.getType() == TableModelEvent.UPDATE && - (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); + boolean mustRecompute = e.getType() == TableModelEvent.DELETE + || e.getType() == TableModelEvent.INSERT + || (e.getType() == TableModelEvent.UPDATE && + (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == 4 || e.getColumn() == 5)); - if (mustRecompute) { - computeBalanceStatusText(); - } + if (mustRecompute) { + computeBalanceStatusText(); + } } }); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java index 35e6237..ddb2448 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringEditModel.java @@ -56,6 +56,10 @@ public class LetteringEditModel implements Serializable { protected BigDecimal credit = BigDecimal.ZERO; protected BigDecimal sold = BigDecimal.ZERO; + protected BigDecimal tableDebit = BigDecimal.ZERO; + protected BigDecimal tableCredit = BigDecimal.ZERO; + protected BigDecimal tableSold = BigDecimal.ZERO; + public boolean isEqualized() { return equalized; } @@ -69,7 +73,7 @@ public class LetteringEditModel implements Serializable { public boolean isLettered() { return lettered; } - + public void setLettered(boolean lettered) { boolean oldLettrer = isLettered(); this.lettered = lettered && (BigDecimal.ZERO.equals(sold) || sold.doubleValue() == 0) && lettered; @@ -111,7 +115,7 @@ public class LetteringEditModel implements Serializable { if (!BigDecimal.ZERO.equals(credit)){ this.credit = credit.add(oldCredit); - }else{ + } else { this.credit=BigDecimal.ZERO; } @@ -128,20 +132,57 @@ public class LetteringEditModel implements Serializable { if (!BigDecimal.ZERO.equals(solde)){ if (credit){ this.sold = oldSold.subtract(solde); - }else{ + } else { this.sold = oldSold.add(solde); } - }else{ + } else { this.sold =BigDecimal.ZERO; } firePropertyChange(PROPERTY_SOLD, oldSold, this.sold); } + public BigDecimal getTableDebit() { + return tableDebit; + } + + public void setTableDebit(BigDecimal tableDebit) { + this.tableDebit = tableDebit; + } + + public BigDecimal getTableCredit() { + return tableCredit; + } + + public void setTableCredit(BigDecimal tableCredit) { + this.tableCredit = tableCredit; + } + + public BigDecimal getTableSold() { + return tableSold; + } + + public void setTableSold(BigDecimal tableSold) { + this.tableSold = tableSold; + } + + public void resetDebitCreditBalance(){ + setDebit(BigDecimal.ZERO); + setCredit(BigDecimal.ZERO); + setSold(BigDecimal.ZERO, false); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { pcs.addPropertyChangeListener(propertyName, listener); } + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { pcs.removePropertyChangeListener(propertyName, listener); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index 68fa963..54fd009 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -88,7 +88,11 @@ public class LetteringViewHandler{ protected LetteringFilterImpl filter; + protected BigDecimal debit = BigDecimal.ZERO; + protected BigDecimal credit = BigDecimal.ZERO; + protected BigDecimal solde = BigDecimal.ZERO; protected LetteringSelectionModel letteringSelectionModel; + protected LetteringEditModel editModel; protected List<Entry> unlockedEntries; @@ -149,10 +153,14 @@ public class LetteringViewHandler{ updateSoldStatus(); updateAllEntries(); + } public void updateSoldStatus() { view.getBalanceStatusLabel().setText(t("lima.lettering.balanceStatus", + BigDecimalToString.format(editModel.getTableDebit()), + BigDecimalToString.format(editModel.getTableCredit()), + BigDecimalToString.format(editModel.getTableSold()), BigDecimalToString.format(editModel.getDebit()), BigDecimalToString.format(editModel.getCredit()), BigDecimalToString.format(editModel.getSold()))); @@ -254,7 +262,7 @@ public class LetteringViewHandler{ && firstSelectedEntryAmount.subtract(secondSelectedEntryAmount).abs().compareTo(BigDecimal.ONE) <0) ) { onButtonModeChanged(ButtonMode.EQUALIZED); } - }else { + } else { if (log.isDebugEnabled()) { log.debug("!2 rows selected"); } @@ -331,6 +339,36 @@ public class LetteringViewHandler{ editModel.setEditable(isEditable); } + public void setValuesForEntries() { + if (editModel != null) { + Entry resultDebit = new EntryImpl(); + Entry resultCredit = new EntryImpl(); + Entry resultSold = new EntryImpl(); + + resultDebit.setAmount(BigDecimal.ZERO); + resultCredit.setAmount(BigDecimal.ZERO); + resultSold.setAmount(BigDecimal.ZERO); + + LetteringTableModel tableModel = view.getTableModel(); + for (int i = 0; i < tableModel.getRowCount(); i ++){ + Entry rowEntry = tableModel.get(i); + if (rowEntry.isDebit()) { + resultDebit.setAmount(resultDebit.getAmount().add(rowEntry.getAmount())); + resultSold.setAmount(resultSold.getAmount().subtract(rowEntry.getAmount())); + } else { + resultCredit.setAmount(resultCredit.getAmount().add(rowEntry.getAmount())); + resultSold.setAmount(resultSold.getAmount().add(rowEntry.getAmount())); + } + } + resultSold.setDebit(resultSold.getAmount().compareTo(BigDecimal.ZERO) < 0); + + editModel.setTableDebit(resultDebit.getAmount()); + editModel.setTableCredit(resultCredit.getAmount()); + editModel.setTableSold(resultSold.getAmount()); + updateSoldStatus(); + } + } + public void onBalanceChanged(Entry balance) { if (balance == null) { editModel.setCredit(BigDecimal.ZERO); @@ -361,10 +399,10 @@ public class LetteringViewHandler{ editModel.setCredit(creditVal); editModel.setSold(creditVal, true); } - }else if (creditVal.equals(BigDecimal.ZERO)){ + } else if (creditVal.equals(BigDecimal.ZERO)){ editModel.setDebit(debitVal); editModel.setSold(debitVal, false); - }else{ + } else { onBalanceChanged(null); } } @@ -445,6 +483,7 @@ public class LetteringViewHandler{ } onBalanceChanged(null); + setValuesForEntries(); } /**To make the difference between two selected entries and diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index 874305f..8a40152 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -449,7 +449,7 @@ lima.lettering.account=Accounts lima.lettering.account.aAll=All lima.lettering.account.back=← lima.lettering.account.next=→ -lima.lettering.balanceStatus= +lima.lettering.balanceStatus=<html>Debit\: <b>%s</b> - Credit\: <b>%s</b> - Sold\: <b>%s</b>. Selected entries\: Debit\: <b>%s</b> - Credit\: <b>%s</b> - Sold\: <b>%s</b> lima.lettering.checkAll=All lima.lettering.checkLettredEntry=Lettered lima.lettering.checkNoLettredEntry=Not lettered diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index 9747eee..133a4af 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -461,7 +461,7 @@ lima.lettering.account=Comptes lima.lettering.account.aAll=TOUS lima.lettering.account.back=← lima.lettering.account.next=→ -lima.lettering.balanceStatus=<html>Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Solde\: <b>%s</b> +lima.lettering.balanceStatus=<html>Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Solde\: <b>%s</b>. Entrées sélectionnées\: Débit\: <b>%s</b> - Crédit\: <b>%s</b> - Solde\: <b>%s</b> lima.lettering.checkAll=Toutes lima.lettering.checkLettredEntry=Lettrées lima.lettering.checkNoLettredEntry=Non-lettrées -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 746e8ced15a7685f5301a21b658bcc93c1c31cfe Author: dcosse <cosse@codelutin.com> Date: Mon Nov 30 13:20:07 2015 +0100 refs #1287 import manquant --- .../src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index 54fd009..9ea521d 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -42,6 +42,7 @@ import org.chorem.lima.business.exceptions.LockedFinancialPeriodException; import org.chorem.lima.business.exceptions.UnbalancedEntriesException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.EntryImpl; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.ui.combobox.AccountComboBox; import org.chorem.lima.util.BigDecimalToString; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 07988ba535e2b9f8e6410ef935b1805370af400d Merge: 3d5a336 746e8ce Author: dcosse <cosse@codelutin.com> Date: Mon Nov 30 13:22:21 2015 +0100 Merge branch 'feature/1287-compute-summary-on-lettering' into develop .../FinancialTransactionViewHandler.java | 14 +++---- .../lima/ui/lettering/LetteringEditModel.java | 49 ++++++++++++++++++++-- .../lima/ui/lettering/LetteringViewHandler.java | 46 ++++++++++++++++++-- .../resources/i18n/lima-swing_en_GB.properties | 2 +- .../resources/i18n/lima-swing_fr_FR.properties | 2 +- 5 files changed, 97 insertions(+), 16 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm