r3000 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/ejbinterface lima-business/src/main/java/org/chorem/lima/business/utils lima-callao/src/main/java/org/chorem/lima/entity lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/accountsreports lima-swing/src/main/java/org/chorem/lima/ui/balance lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports lima-swing/src/main/java/org/chorem/lima/ui/finan
Author: jpepin Date: 2010-08-12 15:51:19 +0200 (Thu, 12 Aug 2010) New Revision: 3000 Url: http://chorem.org/repositories/revision/lima/3000 Log: Ajout d'une fonction pour v?\195?\169rifier la concordance entre le plan BCR et le plan des comptes. Refactor du type Double vers BigDecimal. Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -38,7 +38,6 @@ import org.chorem.lima.business.utils.AccountComparator; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountDAO; -import org.chorem.lima.entity.FinancialStatement; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; @@ -440,9 +439,10 @@ /** * Convert string of extends number to list of accounts * Example '22, 45..48, 67' -> [22, 45, 46, 47, 48, 67] + * SubAccountsMode return list of existing subaccounts ex 6 return : 61, 62, .., 69, 610, .., 619 etc */ @Override - public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, TopiaContext topiaContext) throws LimaException{ + public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, Boolean subAccountsMode, TopiaContext topiaContext) throws LimaException{ List<Account> accounts = new ArrayList<Account>(); if (selectedAccounts != null){ try { @@ -452,45 +452,96 @@ selectedAccounts = StringUtils.deleteWhitespace(selectedAccounts); //use hashset for delete duplicate numbers HashSet<String> accountNumbers = new HashSet<String>(); - //Split comma - StringTokenizer stComma = new StringTokenizer(selectedAccounts, ","); - while (stComma.hasMoreTokens()) { - String s = stComma.nextToken(); - if (s.contains("..")){ - //Split .. - String stringDoubleDot[] = s.split("\\.\\."); - int lowAccount=Integer.parseInt(stringDoubleDot[0]); - int highAccount=Integer.parseInt(stringDoubleDot[1]); - for (int i=lowAccount; i <= highAccount; i++) { - accountNumbers.add(String.valueOf(i)); - } - } - else{ - accountNumbers.add(s); - } - } - + HashSet<String> accountNumbersToRemove = new HashSet<String>(); + Boolean first = true; + StringTokenizer stStar = new StringTokenizer(selectedAccounts, "-"); + while (stStar.hasMoreTokens()) { + String subString = stStar.nextToken(); + + //Split comma + StringTokenizer stComma = new StringTokenizer(subString, ","); + while (stComma.hasMoreTokens()) { + String s = stComma.nextToken(); + if (s.contains("..")){ + //Split .. + String stringDoubleDot[] = s.split("\\.\\."); + int lowAccount=Integer.parseInt(stringDoubleDot[0]); + int highAccount=Integer.parseInt(stringDoubleDot[1]); + for (int i=lowAccount; i <= highAccount; i++) { + //if first add accounts, else remove + if (first){ + accountNumbers.add(String.valueOf(i)); + } + else { + accountNumbersToRemove.add(String.valueOf(i)); + } + } + } + else{ + //if first + if (first){ + accountNumbers.add(s); + } + else { + accountNumbersToRemove.add(s); + } + } + } + first=false; + } + //add all accounts + log.debug("accountNumbers "+accountNumbers); for (String accountNumber : accountNumbers) { - Account account = accountDAO.findByAccountNumber(accountNumber); - if (account == null){ - TopiaQuery query = accountDAO.createQuery(); - query.addWhere(Account.ACCOUNT_NUMBER, Op.LIKE, accountNumber+"%"); - List<Account> accountsResult = accountDAO.findAllByQuery(query); - if (accountsResult != null){ - accounts.addAll(accountsResult); + if (subAccountsMode){ + Account account = accountDAO.findSubAccountByNumber(accountNumber); + if (account == null){ + TopiaQuery query = accountDAO.createQuery(); + String subAccountsProperty = TopiaQuery.getProperty(Account.SUB_ACCOUNTS); + String subLedgersProperty = TopiaQuery.getProperty(Account.SUB_LEDGERS); + query.addWhere("not exists elements ("+subAccountsProperty+")") + .addWhere("not exists elements ("+subLedgersProperty+")") + .addWhere(Account.ACCOUNT_NUMBER, Op.LIKE, accountNumber+"%"); + List<Account> accountsResult = accountDAO.findAllByQuery(query); + if (accountsResult != null){ + accounts.addAll(accountsResult); + } } + //add account if exist + else { + accounts.add(account); + } } - //add account if exist else { - accounts.add(account); + Account account = accountDAO.findByAccountNumber(accountNumber); + if (account != null){ + accounts.add(account); + } } + } + //remove all accounts + log.debug("accountNumbersToRemove "+accountNumbersToRemove); + for (String accountNumber : accountNumbersToRemove) { + Account account = null; + if (subAccountsMode){ + account = accountDAO.findSubAccountByNumber(accountNumber); + } + else { + account = accountDAO.findByAccountNumber(accountNumber); + } + if (account != null) { + accounts.remove(account); + } + } } catch (TopiaException ex) { doCatch(topiaContext, ex, log); } } - + for (Account account : accounts) { + log.debug("accounts " + account.getAccountNumber()); + } + return accounts; } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -24,6 +24,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; @@ -377,10 +378,16 @@ String label = financialStatementAmount.getLabel(); int level = financialStatementAmount.getLevel(); - Double grossAmount = + BigDecimal grossAmount = financialStatementAmount.getGrossAmount(); - Double provisionDeprecationAmount = + if (grossAmount == null){ + grossAmount = new BigDecimal(0); + } + BigDecimal provisionDeprecationAmount = financialStatementAmount.getProvisionDeprecationAmount(); + if (provisionDeprecationAmount == null){ + provisionDeprecationAmount = new BigDecimal(0); + } if (financialStatementAmount.getSubAmount() && level==1){ cell.setGrayFill(0.88f); @@ -414,7 +421,7 @@ c.setHorizontalAlignment(Element.ALIGN_LEFT); t.addCell(c); //cell2 - if (grossAmount != 0.0){ + if (grossAmount.doubleValue() != 0){ phrase = new Phrase(String.valueOf( grossAmount), normalFont); } @@ -423,7 +430,7 @@ } t.addCell(phrase); //cell 3 - if (provisionDeprecationAmount != 0.0){ + if (provisionDeprecationAmount.doubleValue() != 0){ phrase = new Phrase(String.valueOf( provisionDeprecationAmount), normalFont); } @@ -432,9 +439,10 @@ } t.addCell(phrase); //cell 4 - if (grossAmount-provisionDeprecationAmount != 0.0){ - phrase = new Phrase(String.valueOf( - grossAmount-provisionDeprecationAmount), normalFont); + BigDecimal solde = grossAmount; + solde = solde.subtract(provisionDeprecationAmount); + if (solde.doubleValue() != 0){ + phrase = new Phrase(solde.toString(), normalFont); } else { phrase = new Phrase(""); @@ -476,8 +484,8 @@ String dateS = dateFormat.format(newDate); String hourS = hourFormat.format(newDate); - Double currentAmountDebit = 0.0; - Double currentAmountCredit = 0.0; + BigDecimal currentAmountDebit = new BigDecimal(0); + BigDecimal currentAmountCredit = new BigDecimal(0); String accountcarry =""; String filePath = path+File.separator+DocumentsEnum.LEDGER.getFileName(); @@ -537,8 +545,12 @@ for (Object object : subList) { if (object instanceof Entry){ Entry entry = (Entry) object; - currentAmountDebit += entry.getDebit() ? entry.getAmount() : 0; - currentAmountCredit += entry.getDebit() ? 0 : entry.getAmount(); + if (entry.getDebit()){ + currentAmountDebit = currentAmountDebit.add(entry.getAmount()); + } + else { + currentAmountCredit = currentAmountCredit.add(entry.getAmount()); + } } else { ReportsDatas reportsDatas = (ReportsDatas) object; @@ -636,8 +648,8 @@ if (account != null){ accountS = account.getAccountNumber()+"\t"+account.getLabel(); } - Double amountCredit = reportsDatas.getAmountCredit(); - Double amountDebit = reportsDatas.getAmountDebit(); + BigDecimal amountCredit = reportsDatas.getAmountCredit(); + BigDecimal amountDebit = reportsDatas.getAmountDebit(); Cell c = new Cell(new Phrase(accountS, boldFont)); c.setColspan(4); @@ -645,7 +657,9 @@ t.addCell(c); t.addCell(new Phrase(String.valueOf(amountDebit), boldFont)); t.addCell(new Phrase(String.valueOf(amountCredit), boldFont)); - t.addCell(new Phrase(String.valueOf(amountDebit-amountCredit), boldFont)); + BigDecimal solde = amountDebit; + solde = solde.subtract(amountCredit); + t.addCell(new Phrase(String.valueOf(solde), boldFont)); } else { Entry entry = (Entry) object; @@ -655,21 +669,27 @@ if (entryBook != null){ entryBookCode = entryBook.getCode(); } + BigDecimal amountDebit = new BigDecimal(0), + amountCredit = new BigDecimal(0); + if (entry.getDebit()){ + amountDebit = entry.getAmount(); + } + else { + amountCredit = entry.getAmount(); + } - Double amountDebit = entry.getDebit() ? entry.getAmount() : 0; - Double amountCredit = entry.getDebit() ? 0 : entry.getAmount(); - t.addCell(new Phrase(dateFormat.format( entry.getFinancialTransaction().getTransactionDate()), normalFont)); t.addCell(new Phrase(entryBookCode, normalFont)); t.addCell(new Phrase(entry.getVoucher(), normalFont)); t.addCell(new Phrase(entry.getDescription(), normalFont)); - t.addCell(new Phrase(String.valueOf(amountDebit), + t.addCell(new Phrase(amountDebit.toString(), normalFont)); - t.addCell(new Phrase(String.valueOf(amountCredit), + t.addCell(new Phrase(amountCredit.toString(), normalFont)); - t.addCell(new Phrase(String.valueOf(amountDebit-amountCredit), + BigDecimal solde = amountDebit.subtract(amountCredit); + t.addCell(new Phrase(solde.toString(), normalFont)); } @@ -681,7 +701,7 @@ return t; } - public Table createLedgerAmountTable(String account, String title, Double credit, Double debit){ + public Table createLedgerAmountTable(String account, String title, BigDecimal debit, BigDecimal credit){ Table t = null; try { t = new Table(5,1); @@ -695,7 +715,6 @@ cell.setBorder(Rectangle.RIGHT); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); t.setDefaultCell(cell); - Cell accountCell = new Cell(new Phrase(account, boldFont)); accountCell.setHorizontalAlignment(Element.ALIGN_LEFT); accountCell.setBorder(Rectangle.NO_BORDER); @@ -703,7 +722,7 @@ t.addCell(new Phrase(title, boldFont)); t.addCell(new Phrase(debit.toString(), boldFont)); t.addCell(new Phrase(credit.toString(), boldFont)); - Double solde = debit-credit; + BigDecimal solde = debit.subtract(credit); t.addCell(new Phrase(solde.toString(), boldFont)); } catch (BadElementException eeBEE) { log.error("Can't create table", eeBEE); @@ -765,22 +784,22 @@ List<Entry> entries = entryDAO.findAllByQuery(query); List<Object[]> results = new ArrayList<Object[]>(); - Double debit = 0.0; - Double credit = 0.0; + BigDecimal debit = new BigDecimal(0); + BigDecimal credit = new BigDecimal(0); query.setSelect(Entry.DEBIT, "SUM("+Entry.AMOUNT+")"); query.addGroup(Entry.DEBIT); results = query.execute(transaction); int nbAmount = results.size(); if(nbAmount==2){ - debit = (Double)results.get(0)[1]; - credit = (Double)results.get(1)[1]; + debit = (BigDecimal)results.get(0)[1]; + credit = (BigDecimal)results.get(1)[1]; } if (nbAmount==1){ if ((Boolean)results.get(0)[0]){ - debit = (Double)results.get(0)[1]; + debit = (BigDecimal)results.get(0)[1]; } else { - credit = (Double)results.get(0)[1]; + credit = (BigDecimal)results.get(0)[1]; } } @@ -913,7 +932,7 @@ return t; } - public Table createEntryBooksAmountTable(String title, Double credit, Double debit){ + public Table createEntryBooksAmountTable(String title, BigDecimal credit, BigDecimal debit){ Table t = null; try { t = new Table(3,1); @@ -954,10 +973,10 @@ String hourS = hourFormat.format(newDate); String fileDateS = filedateFormat.format(newDate); - Double currentAmountDebit = 0.0; - Double currentAmountCredit = 0.0; - Double currentSoldeDebit = 0.0; - Double currentSoldeCredit = 0.0; + BigDecimal currentAmountDebit = new BigDecimal(0); + BigDecimal currentAmountCredit = new BigDecimal(0); + BigDecimal currentSoldeDebit = new BigDecimal(0); + BigDecimal currentSoldeCredit = new BigDecimal(0); String filePath = path+File.separator+DocumentsEnum.BALANCE.getFileName(); FileOutputStream fileOut = new FileOutputStream(filePath+format.getExtension()); @@ -1014,12 +1033,14 @@ paragraphTable.add(table); chapter.add(paragraphTable); for (ReportsDatas reportsDatas : subList){ - currentAmountDebit += reportsDatas.getAmountDebit(); - currentAmountCredit += reportsDatas.getAmountCredit(); - currentSoldeDebit += - reportsDatas.getSoldeDebit() ? reportsDatas.getAmountSolde() : 0; - currentSoldeCredit += - reportsDatas.getSoldeDebit() ? 0 : reportsDatas.getAmountSolde(); + currentAmountDebit = currentAmountDebit.add(reportsDatas.getAmountDebit()); + currentAmountCredit = currentAmountCredit.add(reportsDatas.getAmountCredit()); + if (reportsDatas.getSoldeDebit()){ + currentSoldeDebit = currentSoldeDebit.add(reportsDatas.getAmountSolde()); + } + else { + currentSoldeCredit = currentSoldeCredit.add(reportsDatas.getAmountSolde()); + } } //forward amounts if (n > max && i <= n-max){ @@ -1118,7 +1139,7 @@ return t; } - public Table createBalanceAmountTable(String title, Double amountDebit, Double amountCredit, Double soldeDebit, Double soldeCredit ){ + public Table createBalanceAmountTable(String title, BigDecimal amountDebit, BigDecimal amountCredit, BigDecimal soldeDebit, BigDecimal soldeCredit){ Table t = null; try { t = new Table(5,1); @@ -1191,21 +1212,21 @@ financialPeriodDAO.findAllByQuery(financialPeriodsQuery); List<GeneralEntryBooksDatas> list = new ArrayList<GeneralEntryBooksDatas>(); - Double amountDebit = 0.0; - Double amountCredit = 0.0; + BigDecimal amountDebit = new BigDecimal(0); + BigDecimal amountCredit = new BigDecimal(0); for (FinancialPeriod financialPeriod : financialPeriods) { List<ClosedPeriodicEntryBook> closedPeriodicEntryBookList = closedPeriodicEntryBookDAO.findAllByDates( financialPeriod.getBeginDate(), financialPeriod.getEndDate()); - Double subAmountDebit = 0.0; - Double subAmountCredit = 0.0; + BigDecimal subAmountDebit = new BigDecimal(0); + BigDecimal subAmountCredit = new BigDecimal(0); for (ClosedPeriodicEntryBook closedPeriodicEntryBook : closedPeriodicEntryBookList) { List<Object[]> results = new ArrayList<Object[]>(); TopiaQuery query = entryDAO.createQuery(); - Double debit = 0.0; - Double credit = 0.0; + BigDecimal debit = new BigDecimal(0); + BigDecimal credit = new BigDecimal(0); String financialPeriodProperty = TopiaQuery.getProperty( Entry.FINANCIAL_TRANSACTION, @@ -1223,15 +1244,15 @@ int nbAmount = results.size(); if(nbAmount == 2){ - debit = (Double)results.get(0)[1]; - credit = (Double)results.get(1)[1]; + debit = (BigDecimal)results.get(0)[1]; + credit = (BigDecimal)results.get(1)[1]; } if (nbAmount == 1){ if ((Boolean)results.get(0)[0]){ - debit = (Double)results.get(0)[1]; + debit = (BigDecimal)results.get(0)[1]; } else { - credit = (Double)results.get(0)[1]; + credit = (BigDecimal)results.get(0)[1]; } } GeneralEntryBooksDatas generalEntryBooksDatas = @@ -1245,8 +1266,8 @@ generalEntryBooksDatas.setCredit(credit); generalEntryBooksDatas.setDebit(debit); list.add(generalEntryBooksDatas); - subAmountCredit += credit; - subAmountDebit += debit; + subAmountCredit = subAmountCredit.add(credit); + subAmountDebit = subAmountDebit.add(debit); } GeneralEntryBooksDatas generalEntryBooksDatas = new GeneralEntryBooksDatasImpl(); @@ -1256,8 +1277,8 @@ generalEntryBooksDatas.setPeriod( monthYearFormat.format(financialPeriod.getBeginDate())); list.add(generalEntryBooksDatas); - amountCredit += subAmountCredit; - amountDebit += subAmountDebit; + amountCredit = amountCredit.add(subAmountCredit); + amountDebit = amountDebit.add(subAmountDebit); } GeneralEntryBooksDatas generalEntryBooksDatas = new GeneralEntryBooksDatasImpl(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -21,6 +21,7 @@ import java.io.IOException; import java.io.StringWriter; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.List; import javax.ejb.Stateless; @@ -140,7 +141,7 @@ nextLine[3] = accountNumber; nextLine[5] = '"'+entry.getDescription()+'"'; nextLine[6] = '"'+entry.getVoucher()+'"'; - nextLine[7] = new Double(entry.getAmount()).toString(); + nextLine[7] = entry.getAmount().toString(); nextLine[8] = debitcredit; // Ajoute la ligne au fichier @@ -492,10 +493,8 @@ nextLine[1] = String.valueOf(numTransaction); nextLine[2] = SDateFormat.format(financialTransaction.getTransactionDate()); - nextLine[3] = new Double( - financialTransaction.getAmountDebit()).toString(); - nextLine[4] = new Double( - financialTransaction.getAmountCredit()).toString(); + nextLine[3] = financialTransaction.getAmountDebit().toString(); + nextLine[4] = financialTransaction.getAmountCredit().toString(); nextLine[5] = SDateFormat.format(financialTransaction.getFinancialPeriod(). getBeginDate()); @@ -514,7 +513,7 @@ nextLine[0] = ImportExportEntityEnum.ENTRY.getLabel(); nextLine[1] = String.valueOf(numTransaction); nextLine[2] = entry.getDescription(); - nextLine[3] = new Double(entry.getAmount()).toString(); + nextLine[3] = entry.getAmount().toString(); nextLine[4] = new Boolean(entry.getDebit()).toString(); nextLine[5] = entry.getLettering(); nextLine[6] = entry.getDetail(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -20,6 +20,8 @@ package org.chorem.lima.business.ejb; import static org.nuiton.i18n.I18n._; + +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -308,7 +310,7 @@ List<FinancialStatement> financialStatements = getChildrenFinancialStatement(financialStatement); try { - Double grossAmount = 0.0, provisionDeprecationAmount = 0.0; + BigDecimal grossAmount = new BigDecimal(0), provisionDeprecationAmount = new BigDecimal(0); List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>(); for (FinancialStatement subFinancialStatement : financialStatements) { @@ -317,19 +319,20 @@ selectedBeginDate, selectedEndDate, topiaContext); if (!subFinancialStatement.getHeader()){ //on calcul - grossAmount += financialStatementAmounts.getGrossAmount(); - provisionDeprecationAmount += - financialStatementAmounts.getProvisionDeprecationAmount(); + grossAmount = grossAmount.add(financialStatementAmounts.getGrossAmount()); + provisionDeprecationAmount = provisionDeprecationAmount.add( + financialStatementAmounts.getProvisionDeprecationAmount()); subResult.add(financialStatementAmounts); } else { FinancialStatementDatas financialStatementDatas = financialStatementReport(subFinancialStatement, selectedBeginDate, selectedEndDate, result, topiaContext); - grossAmount += financialStatementDatas. - getFinancialStatementAmounts().getGrossAmount(); - provisionDeprecationAmount += financialStatementDatas. - getFinancialStatementAmounts().getProvisionDeprecationAmount(); + grossAmount = grossAmount.add(financialStatementDatas. + getFinancialStatementAmounts().getGrossAmount()); + provisionDeprecationAmount = provisionDeprecationAmount. + add(financialStatementDatas.getFinancialStatementAmounts(). + getProvisionDeprecationAmount()); FinancialStatementAmounts headerfinancialStatementAmounts = @@ -371,8 +374,8 @@ subResult.add(headerfinancialStatementAmounts); } else { - headerfinancialStatementAmounts.setGrossAmount(0); - headerfinancialStatementAmounts.setProvisionDeprecationAmount(0); + headerfinancialStatementAmounts.setGrossAmount(new BigDecimal(0)); + headerfinancialStatementAmounts.setProvisionDeprecationAmount(new BigDecimal(0)); subResult.add(headerfinancialStatementAmounts); } //ajoute liste @@ -411,8 +414,7 @@ try { // DEBIT & CREDIT String accountsString = financialStatement.getAccounts(); - log.debug("\n" + accountsString); - Double amount = 0.0; + BigDecimal amount = new BigDecimal(0); if (accountsString != null){ //Remove Spaces accountsString = StringUtils.deleteWhitespace(accountsString); @@ -420,8 +422,8 @@ while (stQuote.hasMoreTokens()) { String s = stQuote.nextToken(); List<Account> accountsList = accountServiceLocal. - stringToListAccountsWithTransaction(s, topiaContext); - Double resAmount = 0.0; + stringToListAccountsWithTransaction(s, false, topiaContext); + BigDecimal resAmount = new BigDecimal(0); for (Account account : accountsList) { log.debug(account.getAccountNumber()); @@ -434,51 +436,53 @@ financialStatement.getMasterFinancialStatement().getWay(); switch (financialStatementWayEnum) { case BOTH: - resAmount += reportsDatas.getAmountSolde(); + resAmount = resAmount.add(reportsDatas.getAmountSolde()); break; case DEBIT: - resAmount += reportsDatas.getAmountDebit()-reportsDatas.getAmountCredit(); + resAmount = resAmount.add(reportsDatas.getAmountDebit()); + resAmount = resAmount.subtract(reportsDatas.getAmountCredit()); break; case CREDIT: - resAmount += reportsDatas.getAmountCredit()-reportsDatas.getAmountDebit(); + resAmount = resAmount.add(reportsDatas.getAmountCredit()); + resAmount = resAmount.subtract(reportsDatas.getAmountDebit()); break; } } - if (amount == 0){ - amount=resAmount; + if (amount.doubleValue() == 0){ + amount = resAmount; } else { - amount-=resAmount; + amount = amount.subtract(resAmount); } } } // CREDIT String creditAccountsString = financialStatement.getCreditAccounts(); - Double creditAmount = 0.0; + BigDecimal creditAmount = new BigDecimal(0); if (creditAccountsString != null){ List<Account> creditAccountsList = accountServiceLocal. - stringToListAccountsWithTransaction(creditAccountsString, topiaContext); + stringToListAccountsWithTransaction(creditAccountsString, false, topiaContext); for (Account account : creditAccountsList) { ReportsDatas reportsDatas = reportServiceLocal. generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext); - creditAmount += reportsDatas.getAmountCredit(); + creditAmount = creditAmount.add(reportsDatas.getAmountCredit()); } } // DEBIT String debitAccountsString = financialStatement.getDebitAccounts(); - Double debitAmount = 0.0; + BigDecimal debitAmount = new BigDecimal(0); if (debitAccountsString != null){ List<Account> debitAccountsList = accountServiceLocal. - stringToListAccountsWithTransaction(debitAccountsString, topiaContext); + stringToListAccountsWithTransaction(debitAccountsString, false, topiaContext); for (Account account : debitAccountsList) { ReportsDatas reportsDatas = reportServiceLocal. generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext); - debitAmount += reportsDatas.getAmountDebit(); + debitAmount = debitAmount.add(reportsDatas.getAmountDebit()); } } @@ -486,22 +490,23 @@ // PROVISION & DEPRECATION String provisionDeprecationAccountsString = financialStatement.getProvisionDeprecationAccounts(); - Double provisionDeprecationAmount = 0.0; + BigDecimal provisionDeprecationAmount = new BigDecimal(0); if (provisionDeprecationAccountsString != null){ List<Account> provisionDeprecationAccountsList = accountServiceLocal.stringToListAccountsWithTransaction( - provisionDeprecationAccountsString, topiaContext); + provisionDeprecationAccountsString, false, topiaContext); for (Account account : provisionDeprecationAccountsList) { ReportsDatas reportsDatas = reportServiceLocal. generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext); - provisionDeprecationAmount += reportsDatas.getAmountSolde(); + provisionDeprecationAmount = provisionDeprecationAmount.add(reportsDatas.getAmountSolde()); } } // set result - financialStatementAmounts.setGrossAmount( - amount+creditAmount+debitAmount); + amount = amount.add(creditAmount); + amount = amount.add(debitAmount); + financialStatementAmounts.setGrossAmount(amount); financialStatementAmounts.setLabel(financialStatement.getLabel()); financialStatementAmounts.setProvisionDeprecationAmount( provisionDeprecationAmount); @@ -520,36 +525,43 @@ @Override public String checkFinancialStatementChart() throws LimaException { - String result = ""; - List<Account> accountsList = new ArrayList<Account>(); - + String result =""; TopiaContext transaction = null; try { transaction = beginTransaction(); AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction); + FinancialStatementDAO financialStatementDAO = + LimaCallaoDAOHelper.getFinancialStatementDAO(transaction); - accountsList = accountDAO.findAllSubAccounts(); - Collections.sort(accountsList, new AccountComparator()); - + List<Account> accountsList = accountDAO.findAllSubAccounts(); + + List<FinancialStatement> financialStatementsList = + financialStatementDAO.findAll(); + + + for (FinancialStatement financialStatement : financialStatementsList) { + + accountsList.removeAll( + accountServiceLocal.stringToListAccountsWithTransaction( + financialStatement.getAccounts(), true, transaction)); + + accountsList.removeAll( + accountServiceLocal.stringToListAccountsWithTransaction( + financialStatement.getCreditAccounts(), true, transaction)); + + accountsList.removeAll( + accountServiceLocal.stringToListAccountsWithTransaction( + financialStatement.getDebitAccounts(), true, transaction)); + + accountsList.removeAll( + accountServiceLocal.stringToListAccountsWithTransaction( + financialStatement.getProvisionDeprecationAccounts(), true, transaction)); + } + for (Account account : accountsList) { - Boolean find = false; - String accountNumber = account.getAccountNumber(); - if (accountNumber.length()>1){ - while (!find && accountNumber.length() > 1){ - log.debug(accountNumber); - List<FinancialStatement> financialStatements = - findFinancialStatementByAccountNumber(accountNumber, transaction); - log.debug(financialStatements); - if (!(find = financialStatements.size() > 0)){ - accountNumber = accountNumber.substring(0, accountNumber.length()-1); - } - } - - if (!find){ - result += "NOT FOUND : "+account.getAccountNumber()+"\n"; - } - } + + result += "NOT FOUND : "+account.getAccountNumber()+"\n"; } } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -20,6 +20,8 @@ package org.chorem.lima.business.ejb; import static org.nuiton.i18n.I18n._; + +import java.math.BigDecimal; import java.util.Date; import java.util.List; import javax.ejb.Stateless; @@ -80,6 +82,7 @@ public void createFinancialTransactionWithTransaction( FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException { + log.debug(financialtransaction); try { //check if the financial period is blocked accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( @@ -439,22 +442,32 @@ accountingRules.updateEntryRules(entry, entryOld, topiaContext); //get new entry amounts - Double entryAmount = entry.getAmount(); - Boolean entryAmountBool = entry.getDebit(); - Double entryDebit = entryAmountBool ? entryAmount : 0; - Double entryCredit = entryAmountBool ? 0 : entryAmount; + BigDecimal entryAmount = entry.getAmount(); + Boolean entryAmountIsDebit = entry.getDebit(); + BigDecimal entryDebit = new BigDecimal(0), entryCredit = new BigDecimal(0); + if (entryAmountIsDebit){ + entryDebit = entryAmount; + } + else { + entryCredit = entryAmount; + } //get old entry amounts - Double entryAmountOld = entryOld.getAmount(); - Boolean entryAmountBoolOld = entryOld.getDebit(); - Double entryDebitOld = entryAmountBoolOld ? entryAmountOld : 0; - Double entryCreditOld = entryAmountBoolOld ? 0 : entryAmountOld; + BigDecimal entryAmountOld = entryOld.getAmount(); + Boolean entryAmountOldIsDebit = entryOld.getDebit(); + BigDecimal entryDebitOld = new BigDecimal(0), entryCreditOld = new BigDecimal(0); + if (entryAmountOldIsDebit){ + entryDebitOld = entryAmountOld; + } + else { + entryCreditOld = entryAmountOld; + } //FIXME PEPIN 20100520 conflict object already instanciate // Exist best solution ? entryOld.setAccount(entry.getAccount()); entryOld.setAmount(entryAmount); - entryOld.setDebit(entryAmountBool); + entryOld.setDebit(entryAmountIsDebit); entryOld.setDescription(entry.getDescription()); entryOld.setVoucher(entry.getVoucher()); entryOld.setFinancialTransaction(entry.getFinancialTransaction()); @@ -464,13 +477,17 @@ //calculate financial transaction amounts FinancialTransaction financialTransaction = entryOld.getFinancialTransaction(); - Double amountDebit = financialTransaction.getAmountDebit(); - Double amountCredit = financialTransaction.getAmountCredit(); - financialTransaction.setAmountDebit( - amountDebit-entryDebitOld+entryDebit); - financialTransaction.setAmountCredit( - amountCredit-entryCreditOld+entryCredit); + BigDecimal amountDebit = financialTransaction.getAmountDebit(); + amountDebit = amountDebit.subtract(entryDebitOld); + amountDebit = amountDebit.add(entryDebit); + financialTransaction.setAmountDebit(amountDebit); + + BigDecimal amountCredit = financialTransaction.getAmountCredit(); + amountCredit = amountCredit.subtract(entryCreditOld); + amountCredit = amountCredit.add(entryCredit); + financialTransaction.setAmountCredit(amountCredit); + //update financial transaction updateFinancialTransactionWithTransaction( financialTransaction, topiaContext); @@ -503,18 +520,26 @@ entry.getFinancialTransaction(), topiaContext); //get entry amounts - Double entryAmount = entry.getAmount(); - Boolean entryAmountBool = entry.getDebit(); - Double entryDebit = entryAmountBool ? entryAmount : 0; - Double entryCredit = entryAmountBool ? 0 : entryAmount; + BigDecimal entryAmount = entry.getAmount(); + Boolean entryAmountIsDebit = entry.getDebit(); + BigDecimal entryDebit = new BigDecimal(0), entryCredit = new BigDecimal(0); + if (entryAmountIsDebit){ + entryDebit = entryAmount; + } + else { + entryCredit = entryAmount; + } //calculate financial transaction amounts FinancialTransaction financialTransaction = entry.getFinancialTransaction(); - Double amountDebit = financialTransaction.getAmountDebit(); - Double amountCredit = financialTransaction.getAmountCredit(); - financialTransaction.setAmountDebit(amountDebit-entryDebit); - financialTransaction.setAmountCredit(amountCredit-entryCredit); + BigDecimal amountDebit = financialTransaction.getAmountDebit(); + amountDebit = amountDebit.subtract(entryDebit); + financialTransaction.setAmountDebit(amountDebit); + + BigDecimal amountCredit = financialTransaction.getAmountCredit(); + amountCredit = amountCredit.subtract(entryCredit); + financialTransaction.setAmountCredit(amountCredit); //update financial transaction updateFinancialTransactionWithTransaction( Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -21,10 +21,12 @@ import java.io.IOException; import java.io.StringReader; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -65,6 +67,7 @@ import org.chorem.lima.business.ejbinterface.ImportService; import org.chorem.lima.business.ejbinterface.ImportServiceLocal; import org.chorem.lima.business.utils.AccountEBPComparator; +import org.chorem.lima.business.utils.EntryEBPComparator; import org.chorem.lima.business.utils.FiscalPeriodComparator; import org.chorem.lima.business.utils.ImportExportEntityEnum; import org.chorem.lima.entity.Account; @@ -188,16 +191,20 @@ CsvToBean<EntryEBPImpl> csv = new CsvToBean<EntryEBPImpl>(); List<EntryEBPImpl> list = csv.parse(strat, csvReader); + Collections.sort(list, new EntryEBPComparator()); // DAOs AccountDAO accountDAO = LimaCallaoDAOHelper .getAccountDAO(topiaContext); EntryBookDAO entryBookDAO = LimaCallaoDAOHelper .getEntryBookDAO(topiaContext); + List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllUnblockedFiscalPeriods(); + Collections.sort(fiscalPeriods, new FiscalPeriodComparator()); + int nbFiscalPeriods = fiscalPeriods.size(); FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper .getFinancialPeriodDAO(topiaContext); - if (financialPeriodDAO.findAll().size() == 0) { + if (nbFiscalPeriods == 0) { throw new LimaBusinessException( "Can't import entries, no fiscalperiod is open"); } @@ -208,18 +215,33 @@ Entry entry = new EntryImpl(); Account account = accountDAO.findByAccountNumber(entryEBP .getCompte()); + + Date date = epbDateFormat.parse(entryEBP.getDatEcr()); + Date beginDate = fiscalPeriods.get(0).getBeginDate(); + Date endDate = fiscalPeriods.get(nbFiscalPeriods-1).getEndDate(); + // if account not exist not export if (account == null) { throw new LimaBusinessException( "FAILED : Account " + entryEBP.getCompte() + " not exist !\n" - + "Import or create all accounts before import entries"); - } else { + + "Import aborted ! Create all accounts before import entries"); + } + + else if (date.compareTo(beginDate) < 0 || date.compareTo(endDate) > 0){ + + result += "WARNING : " + date + " entries is out of range of" + + " opened fiscal periods. " + + "Entry was skip !\n"; + } + else { entry.setAccount(account); - Double debit = new Double(entryEBP.getDebit()); - Double credit = new Double(entryEBP.getCredit()); - if (debit == 0) { + BigDecimal debit = new BigDecimal(entryEBP.getDebit()); + log.debug(debit); + BigDecimal credit = new BigDecimal(entryEBP.getCredit()); + log.debug(credit); + if (debit.doubleValue() == 0) { entry.setDebit(false); entry.setAmount(credit); } else { @@ -229,7 +251,6 @@ entry.setDescription(entryEBP.getLibelle()); entry.setLettering(entryEBP.getLettre()); entry.setVoucher(entryEBP.getPiece()); - Date date = epbDateFormat.parse(entryEBP.getDatEcr()); String entryBookCode = entryEBP.getJournal(); EntryBook entryBook = entryBookDAO .findByCode(entryBookCode); @@ -245,11 +266,9 @@ } if (financialTransaction == null - || !(date.equals(financialTransaction - .getTransactionDate()) && entryBook - .getCode().equals( - financialTransaction.getEntryBook() - .getCode()))) { + || !(date.equals(financialTransaction.getTransactionDate()) + && entryBook.getCode().equals(financialTransaction.getEntryBook().getCode()))) { + // update previous financial transaction before create // new if (financialTransaction != null) { @@ -1085,9 +1104,9 @@ .parse(financialTransactionImport.getDate()); financialTransaction .setTransactionDate(dateFinancialTransaction); - financialTransaction.setAmountDebit(new Double( + financialTransaction.setAmountDebit(new BigDecimal( financialTransactionImport.getAmountDebit())); - financialTransaction.setAmountCredit(new Double( + financialTransaction.setAmountCredit(new BigDecimal( financialTransactionImport.getAmountCredit())); EntryBook entryBook = entryBookDAO .findByCode(financialTransactionImport @@ -1107,7 +1126,7 @@ .findByAccountNumber(entryImport.getAccount()); entry.setAccount(account); entry.setDescription(entryImport.getDescription()); - entry.setAmount(new Double(entryImport.getAmount())); + entry.setAmount(new BigDecimal(entryImport.getAmount())); entry.setDebit(new Boolean(entryImport.getDebit())); entry.setLettering(entryImport.getLettering()); entry.setDetail(entryImport.getDetail()); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -19,6 +19,7 @@ package org.chorem.lima.business.ejb; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -103,7 +104,9 @@ @Override public ReportsDatas generateAccountReportsWithTransaction (Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException{ ReportsDatas reportsDatas = new ReportsDatasImpl(); - double credit = 0, debit = 0, solde = 0; + BigDecimal credit = new BigDecimal(0); + BigDecimal debit = new BigDecimal(0); + BigDecimal solde = new BigDecimal(0); if (account != null){ // First subaccount List<Account> accounts = (List<Account>) account.getSubAccounts(); @@ -119,15 +122,18 @@ ReportsDatas subReportsDatas = generateAccountReportsWithTransaction(subAccount, beginDate,endDate, topiaContext); - debit += subReportsDatas.getAmountDebit(); - credit += subReportsDatas.getAmountCredit(); + debit = debit.add(subReportsDatas.getAmountDebit()); + credit = credit.add(subReportsDatas.getAmountCredit()); entries.addAll(subReportsDatas.getListEntry()); } - solde = debit - credit; - if (solde > 0){ + //solde = debit - credit + solde = solde.add(debit); + solde = solde.subtract(credit); + + if (solde.doubleValue() > 0){ reportsDatas.setSoldeDebit(true); } - solde = Math.abs(solde); + solde = solde.abs(); reportsDatas.setAmountCredit(credit); reportsDatas.setAmountDebit(debit); reportsDatas.setAmountSolde(solde); @@ -170,7 +176,10 @@ @SuppressWarnings("unchecked") protected ReportsDatas generateSubAccountReportsWithTransaction(Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException { ReportsDatas reportsDatas = new ReportsDatasImpl(); - double credit = 0, debit = 0, solde = 0; + BigDecimal credit = new BigDecimal(0); + BigDecimal debit = new BigDecimal(0); + BigDecimal solde = new BigDecimal(0); + List<Object[]> results = new ArrayList<Object[]>(); String queryAlias = "E"; if (beginDate != null && endDate != null){ @@ -194,24 +203,27 @@ results = amountsQuery.execute(topiaContext); int nbAmount = results.size(); if(nbAmount==2){ - debit = (Double)results.get(0)[1]; - credit = (Double)results.get(1)[1]; + debit = (BigDecimal) results.get(0)[1]; + credit = (BigDecimal)results.get(1)[1]; } if (nbAmount==1){ if ((Boolean)results.get(0)[0]){ - debit = (Double)results.get(0)[1]; + debit = (BigDecimal) results.get(0)[1]; } else { - credit = (Double)results.get(0)[1]; + credit = (BigDecimal)results.get(0)[1]; } } // set the amounts and solde - solde = debit - credit; - if (solde > 0){ + //solde = debit - credit + solde = solde.add(debit); + solde = solde.subtract(credit); + + if (solde.doubleValue() > 0){ reportsDatas.setSoldeDebit(true); } - solde = Math.abs(solde); + solde = solde.abs(); reportsDatas.setAmountCredit(credit); reportsDatas.setAmountDebit(debit); @@ -235,10 +247,15 @@ @SuppressWarnings("unchecked") protected ReportsDatas generateSubAccountBalanceWithTransaction(Account account, Date beginDate, Date endDate, Boolean getEntries, TopiaContext topiaContext) throws LimaException { ReportsDatas reportsDatas = new ReportsDatasImpl(); - double credit = 0, debit = 0, solde = 0; + BigDecimal credit = new BigDecimal(0); + BigDecimal debit = new BigDecimal(0); + BigDecimal solde = new BigDecimal(0); + + List<Object[]> results = new ArrayList<Object[]>(); String queryAlias = "E"; if (beginDate != null && endDate != null){ + log.debug("solde 0 : "+solde); try { EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaContext); @@ -261,24 +278,28 @@ results = amountsQuery.execute(topiaContext); int nbAmount = results.size(); if(nbAmount==2){ - debit = (Double)results.get(0)[1]; - credit = (Double)results.get(1)[1]; + debit = (BigDecimal)results.get(0)[1]; + credit = (BigDecimal)results.get(1)[1]; } if (nbAmount==1){ if ((Boolean)results.get(0)[0]){ - debit = (Double)results.get(0)[1]; + debit = (BigDecimal)results.get(0)[1]; } else { - credit = (Double)results.get(0)[1]; + credit = (BigDecimal)results.get(0)[1]; } } // set the amounts and solde - solde = debit - credit; - if (solde > 0){ + //solde = debit - credit + solde = solde.add(debit); + solde = solde.subtract(credit); + + if (solde.doubleValue() > 0){ reportsDatas.setSoldeDebit(true); + } - solde = Math.abs(solde); + solde = solde.abs(); reportsDatas.setAmountCredit(credit); reportsDatas.setAmountDebit(debit); @@ -306,7 +327,10 @@ @Override public ReportsDatas generateEntryBooksReports(EntryBook entryBook, Date beginDate, Date endDate) throws LimaException { ReportsDatas reportsDatas = new ReportsDatasImpl(); - double credit = 0, debit = 0, solde = 0; + BigDecimal credit = new BigDecimal(0); + BigDecimal debit = new BigDecimal(0); + BigDecimal solde = new BigDecimal(0); + List<Object[]> results = new ArrayList<Object[]>(); if (entryBook != null && beginDate != null && endDate != null){ // Get all entries with a topia query @@ -339,24 +363,26 @@ results = amountsQuery.execute(topiaTransaction); int nbAmount = results.size(); if(nbAmount==2){ - debit = (Double)results.get(0)[1]; - credit = (Double)results.get(1)[1]; + debit = (BigDecimal)results.get(0)[1]; + credit = (BigDecimal)results.get(1)[1]; } if (nbAmount==1){ if ((Boolean)results.get(0)[0]){ - debit = (Double)results.get(0)[1]; + debit = (BigDecimal)results.get(0)[1]; } else { - credit = (Double)results.get(0)[1]; + credit = (BigDecimal)results.get(0)[1]; } } // set the amounts and solde - solde = debit - credit; - if (solde > 0){ + //solde = debit - credit; + solde = solde.add(debit); + solde = solde.subtract(credit); + if (solde.doubleValue() > 0){ reportsDatas.setSoldeDebit(true); } - solde = Math.abs(solde); + solde = solde.abs(); reportsDatas.setAmountCredit(credit); reportsDatas.setAmountDebit(debit); @@ -419,8 +445,9 @@ public BalanceTrial generateBalanceTrial(Date beginDate, Date endDate, String selectedAccounts, Boolean getEntries, Boolean movementedFilter) throws LimaException { BalanceTrial balanceTrial = new BalanceTrialImpl(); balanceTrial.setReportsDatas(new ArrayList<ReportsDatas>()); - double credit = 0, debit = 0, solde = 0; - + BigDecimal credit = new BigDecimal(0); + BigDecimal debit = new BigDecimal(0); + BigDecimal solde = new BigDecimal(0); TopiaContext topiaTransaction = null; try { topiaTransaction = beginTransaction(); @@ -439,16 +466,20 @@ } //build list account from selectedAccounts else{ - accounts=accountServiceLocal.stringToListAccountsWithTransaction(selectedAccounts, topiaTransaction); + accounts = accountServiceLocal.stringToListAccountsWithTransaction( + selectedAccounts, false, topiaTransaction); } for (Account account : accounts) { ReportsDatas reportsDatas = generateSubAccountBalanceWithTransaction(account, beginDate, endDate, getEntries, topiaTransaction); reportsDatas.setAccount(account); - Double amount = reportsDatas.getAmountSolde(); + BigDecimal amount = reportsDatas.getAmountSolde(); + if (amount == null){ + amount = new BigDecimal(0); + } if (movementedFilter){ - if (amount != 0){ + if (amount.doubleValue() != 0){ // add balance sheet to balance trial balanceTrial.addReportsDatas(reportsDatas); } @@ -459,18 +490,20 @@ } if (reportsDatas.getSoldeDebit()) { - debit += amount; + debit = debit.add(amount); } else { - credit += amount; + credit = credit.add(amount); } } // set the amounts and solde - solde = debit - credit; - if (solde > 0){ + //solde = debit - credit; + solde = solde.add(debit); + solde = solde.subtract(credit); + if (solde.doubleValue() > 0){ balanceTrial.setSoldeDebit(true); } - solde = Math.abs(solde); + solde = solde.abs(); balanceTrial.setAmountCredit(credit); balanceTrial.setAmountDebit(debit); balanceTrial.setAmountSolde(solde); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/AccountServiceLocal.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -40,7 +40,7 @@ @Local public interface AccountServiceLocal extends AccountService{ - public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, TopiaContext topiaContext) throws LimaException; + public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, Boolean subAccountsMode, TopiaContext topiaContext) throws LimaException; void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException, LimaBusinessException; void createSubLedgerWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException; Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryEBPComparator.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -0,0 +1,38 @@ +/* *##% Lima Business + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ + +package org.chorem.lima.business.utils; + +import java.util.Comparator; +import org.chorem.lima.beans.EntryEBP; + +public class EntryEBPComparator implements Comparator<EntryEBP>{ + + @Override + public int compare(EntryEBP o1, EntryEBP o2) { + + int result = o1.getDatEcr().compareTo(o2.getDatEcr()); + + if(result==0) + result = o1.getJournal().compareTo(o2.getJournal()); + + return result; + } + +} Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAOImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -47,4 +47,15 @@ return (List<Account>) findAllByQuery(query); } + @Override + public Account findSubAccountByNumber(String number) throws TopiaException { + TopiaQuery query = createQuery(); + String subAccountsProperty = TopiaQuery.getProperty(Account.SUB_ACCOUNTS); + String subLedgersProperty = TopiaQuery.getProperty(Account.SUB_LEDGERS); + query.addWhere("not exists elements ("+subAccountsProperty+")") + .addWhere("not exists elements ("+subLedgersProperty+")") + .addEquals(Account.ACCOUNT_NUMBER, number); + return findByQuery(query); + } + } Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionImpl.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -1,17 +1,25 @@ package org.chorem.lima.entity; +import java.math.BigDecimal; + public class FinancialTransactionImpl extends FinancialTransactionAbstract { @Override public void setAmounts() { + if (amountDebit == null){ + amountDebit = new BigDecimal(0); + } + if (amountCredit == null){ + amountCredit = new BigDecimal(0); + } for (Entry entryFT : entry) { if (entryFT.getDebit()){ - amountDebit += entryFT.getAmount(); + amountDebit = amountDebit.add(entryFT.getAmount()); } else { - amountCredit += entryFT.getAmount(); + amountCredit = amountCredit.add(entryFT.getAmount()); } } } Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsView.jaxx 2010-08-12 13:51:19 UTC (rev 3000) @@ -42,7 +42,7 @@ getEndDatePicker().setDate(endDate); void $afterCompleteSetup() { - getHandler().refresh(); + //getHandler().refresh(); } ]]> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -19,6 +19,8 @@ package org.chorem.lima.ui.accountsreports; import static org.nuiton.i18n.I18n._; + +import java.math.BigDecimal; import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -91,15 +93,18 @@ public ReportsDatas getDataList(){ ReportsDatas results = null; - try { - results = reportService.generateAccountsReports(selectedAccount, - selectedBeginDate, selectedEndDate); - } - catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.debug("Can't update model", eee); + //avoid unnecessary call to service + if (selectedAccount != null){ + try { + results = reportService.generateAccountsReports(selectedAccount, + selectedBeginDate, selectedEndDate); } - ErrorHelper.showErrorDialog("Can't get entries list", eee); + catch (LimaException eee) { + if (log.isErrorEnabled()) { + log.debug("Can't update model", eee); + } + ErrorHelper.showErrorDialog("Can't get entries list", eee); + } } return results; } @@ -117,13 +122,13 @@ if (datasList != null){ // set amounts credit and debit and solde - view.amountCreditLabel.setText(String.valueOf(datasList.getAmountCredit())); - view.amountDebitLabel.setText(String.valueOf(datasList.getAmountDebit())); - Double amountSolde = datasList.getAmountSolde(); - view.amountSoldeLabel.setText(String.valueOf(amountSolde)); + view.amountCreditLabel.setText(datasList.getAmountCredit().toString()); + view.amountDebitLabel.setText(datasList.getAmountDebit().toString()); + BigDecimal amountSolde = datasList.getAmountSolde(); + view.amountSoldeLabel.setText(amountSolde.toString()); - if (amountSolde == 0){ + if (amountSolde.doubleValue() == 0){ view.soldeLabel.setText(_("lima.solde")); } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -21,6 +21,7 @@ import static org.nuiton.i18n.I18n._; import java.awt.Desktop; import java.io.IOException; +import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; @@ -134,11 +135,11 @@ // set amounts credit, debit and solde view.amountCreditLabel.setText(String.valueOf(datasList.getAmountCredit())); view.amountDebitLabel.setText(String.valueOf(datasList.getAmountDebit())); - Double amountSolde = datasList.getAmountSolde(); + BigDecimal amountSolde = datasList.getAmountSolde(); view.amountSoldeLabel.setText(String.valueOf(amountSolde)); - if (amountSolde == 0){ + if (amountSolde.doubleValue() == 0){ view.soldeLabel.setText(_("lima.solde")); } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -48,7 +48,7 @@ int result = 0; // just prevent too much result - if (cacheDataList.getListEntry() != null) { + if (cacheDataList != null && cacheDataList.getListEntry() != null) { result = cacheDataList.getListEntry().size(); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsView.jaxx 2010-08-12 13:51:19 UTC (rev 3000) @@ -43,7 +43,7 @@ getEndDatePicker().setDate(endDate); void $afterCompleteSetup() { - getHandler().refresh(); + //getHandler().refresh(); } ]]> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -22,6 +22,7 @@ import java.awt.Desktop; import java.io.IOException; +import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; @@ -43,7 +44,6 @@ import org.chorem.lima.business.utils.FormatsEnum; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.service.LimaServiceFactory; -import org.chorem.lima.ui.combobox.EntryBookComboBoxModel; import org.chorem.lima.util.ErrorHelper; @@ -114,16 +114,18 @@ } public ReportsDatas getDataList(){ - ReportsDatas results = new ReportsDatasImpl(); - try { - results = - reportService.generateEntryBooksReports(selectedEntryBook, selectedBeginDate, selectedEndDate); - } - catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.debug("Can't update model", eee); + ReportsDatas results = null; + if (selectedEntryBook != null){ + try { + results = + reportService.generateEntryBooksReports(selectedEntryBook, selectedBeginDate, selectedEndDate); } - ErrorHelper.showErrorDialog("Can't get entries list", eee); + catch (LimaException eee) { + if (log.isErrorEnabled()) { + log.debug("Can't update model", eee); + } + ErrorHelper.showErrorDialog("Can't get entries list", eee); + } } return results; } @@ -143,11 +145,10 @@ // set amounts credit, debit and solde view.amountCreditLabel.setText(String.valueOf(datasList.getAmountCredit())); view.amountDebitLabel.setText(String.valueOf(datasList.getAmountDebit())); - Double amountSolde = datasList.getAmountSolde(); + BigDecimal amountSolde = datasList.getAmountSolde(); view.amountSoldeLabel.setText(String.valueOf(amountSolde)); - - if (amountSolde == 0){ + if (amountSolde.doubleValue() == 0){ view.soldeLabel.setText(_("lima.solde")); } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -23,6 +23,7 @@ import java.awt.Desktop; import java.io.IOException; +import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; @@ -145,8 +146,15 @@ //get entries for the period for the current row if (result instanceof FinancialStatementAmounts) { FinancialStatementAmounts currentRow = (FinancialStatementAmounts) result; - Double grossAmount = currentRow.getGrossAmount(); - Double provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount(); + BigDecimal grossAmount = currentRow.getGrossAmount(); + if (grossAmount == null ){ + grossAmount = new BigDecimal(0); + } + + BigDecimal provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount(); + if (provisionDeprecationAmount == null ){ + provisionDeprecationAmount = new BigDecimal(0); + } switch (column) { case 0: result = ""; @@ -159,7 +167,7 @@ } break; case 1: - if (grossAmount == 0){ + if (grossAmount.doubleValue() == 0){ result = null; } else { @@ -167,7 +175,7 @@ } break; case 2: - if (provisionDeprecationAmount == 0){ + if (provisionDeprecationAmount.doubleValue() == 0){ result = null; } else { @@ -175,11 +183,12 @@ } break; case 3: - if (grossAmount-provisionDeprecationAmount == 0){ + BigDecimal solde = grossAmount.subtract(provisionDeprecationAmount); + if (solde.doubleValue() == 0){ result = null; } else { - result = grossAmount-provisionDeprecationAmount; + result = solde; } break; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -19,6 +19,8 @@ package org.chorem.lima.ui.financialtransaction; import static org.nuiton.i18n.I18n._; + +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -160,13 +162,13 @@ result = String.class; break; case 6: - result = Double.class; + result = BigDecimal.class; break; case 7: - result = Double.class; + result = BigDecimal.class; break; case 8: - result = Double.class; + result = BigDecimal.class; break; } @@ -231,8 +233,8 @@ if (result instanceof FinancialTransaction) { FinancialTransaction currentRow = (FinancialTransaction)result; - Double amountDebit = currentRow.getAmountDebit(); - Double amountCredit = currentRow.getAmountCredit(); + BigDecimal amountDebit = currentRow.getAmountDebit(); + BigDecimal amountCredit = currentRow.getAmountCredit(); switch (column) { case 0: @@ -265,7 +267,7 @@ result = amountCredit; break; case 8: - result = amountDebit - amountCredit; + result = amountDebit.subtract(amountCredit); break; } } @@ -458,11 +460,11 @@ currentEntry.setPosition((String)value); break; case 6: - currentEntry.setAmount((Double)value); + currentEntry.setAmount((BigDecimal)value); currentEntry.setDebit(true); break; case 7: - currentEntry.setAmount((Double)value); + currentEntry.setAmount((BigDecimal)value); currentEntry.setDebit(false); break; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -19,6 +19,8 @@ package org.chorem.lima.ui.financialtransactionunbalanced; import static org.nuiton.i18n.I18n._; + +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -152,13 +154,13 @@ result = String.class; break; case 6: - result = Double.class; + result = BigDecimal.class; break; case 7: - result = Double.class; + result = BigDecimal.class; break; case 8: - result = Double.class; + result = BigDecimal.class; break; } @@ -224,8 +226,8 @@ if (result instanceof FinancialTransaction) { FinancialTransaction currentRow = (FinancialTransaction)result; - Double amountDebit = currentRow.getAmountDebit(); - Double amountCredit = currentRow.getAmountCredit(); + BigDecimal amountDebit = currentRow.getAmountDebit(); + BigDecimal amountCredit = currentRow.getAmountCredit(); switch (column) { case 0: @@ -258,7 +260,7 @@ result = amountCredit; break; case 8: - result = amountDebit - amountCredit; + result = amountDebit.subtract(amountCredit); break; } } @@ -403,11 +405,11 @@ currentEntry.setPosition((String)value); break; case 6: - currentEntry.setAmount((Double)value); + currentEntry.setAmount((BigDecimal)value); currentEntry.setDebit(true); break; case 7: - currentEntry.setAmount((Double)value); + currentEntry.setAmount((BigDecimal)value); currentEntry.setDebit(false); break; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -20,6 +20,8 @@ package org.chorem.lima.ui.ledger; import static org.nuiton.i18n.I18n._; + +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.List; import javax.swing.table.AbstractTableModel; @@ -110,8 +112,8 @@ if (result instanceof ReportsDatas) { ReportsDatas currentRow = (ReportsDatas)result; - Double amountDebit = currentRow.getAmountDebit(); - Double amountCredit = currentRow.getAmountCredit(); + BigDecimal amountDebit = currentRow.getAmountDebit(); + BigDecimal amountCredit = currentRow.getAmountCredit(); switch (column) { case 0: @@ -141,15 +143,21 @@ result = amountCredit; break; case 7: - result = amountDebit - amountCredit; + result = amountDebit.subtract(amountCredit); break; } } else if (result instanceof Entry) { Entry currentRow = (Entry)result; - Double amountDebit = currentRow.getDebit() ? currentRow.getAmount() : 0; - Double amountCredit = currentRow.getDebit() ? 0 : currentRow.getAmount(); - + BigDecimal amountDebit = new BigDecimal(0), + amountCredit = new BigDecimal(0); + if (currentRow.getDebit()){ + amountDebit = currentRow.getAmount(); + } + else { + amountCredit = currentRow.getAmount(); + } + switch (column) { case 0: result = null; // account @@ -179,7 +187,7 @@ result = amountCredit; break; case 7: - result = amountDebit - amountCredit; + result = amountDebit.subtract(amountCredit); break; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2010-08-11 14:50:40 UTC (rev 2999) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2010-08-12 13:51:19 UTC (rev 3000) @@ -22,6 +22,7 @@ import java.awt.Desktop; import java.io.IOException; +import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; @@ -164,11 +165,11 @@ String.valueOf(balanceTrialCache.getAmountCredit())); view.amountDebitLabel.setText( String.valueOf(balanceTrialCache.getAmountDebit())); - Double amountSolde = balanceTrialCache.getAmountSolde(); + BigDecimal amountSolde = balanceTrialCache.getAmountSolde(); view.amountSoldeLabel.setText( String.valueOf(amountSolde)); - if (amountSolde == 0){ + if (amountSolde.doubleValue() == 0){ view.soldeLabel.setText(_("lima.solde")); } else {
participants (1)
-
jpepin@users.chorem.org