Author: dcosse Date: 2014-01-18 00:31:14 +0100 (Sat, 18 Jan 2014) New Revision: 3741 Url: http://chorem.org/projects/lima/repository/revisions/3741 Log: refs #966 some works on report done Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 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 2014-01-17 22:12:04 UTC (rev 3740) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-01-17 23:31:14 UTC (rev 3741) @@ -148,10 +148,9 @@ String title = list.get(0).getLabel(); int i = 0; int n = list.size(); - int max = n; printedType ++; while (i < n) { - int j = i + max; + int j = i + n; if (j > n) { j = n; } @@ -210,7 +209,7 @@ } } else { //cell1 - StringBuffer tab = new StringBuffer(); + StringBuilder tab = new StringBuilder(); for (int k = 0; k < level; k++) { tab.append("\t"); } @@ -223,13 +222,13 @@ } //cell2 String grossAmountStr = ""; - if (grossAmount != BigDecimal.ZERO) { + if (!grossAmount.equals(BigDecimal.ZERO)) { grossAmountStr = grossAmount.toString(); } //cell 3 String provisionDeprecationAmountStr = ""; - if (provisionDeprecationAmount != BigDecimal.ZERO) { + if (!provisionDeprecationAmount.equals(BigDecimal.ZERO)) { provisionDeprecationAmountStr = provisionDeprecationAmount.toString(); } @@ -237,7 +236,7 @@ BigDecimal solde = grossAmount; solde = solde.subtract(provisionDeprecationAmount); String soldeStr = ""; - if (solde != BigDecimal.ZERO) { + if (!solde.equals(BigDecimal.ZERO)) { soldeStr = solde.toString(); } @@ -250,7 +249,7 @@ } } } - i = i + max; + i = i + n; financialReport += "</table>"; } } @@ -546,10 +545,9 @@ //create pages int i = 0; int n = list.size(); - int max = n; while (i < n) { - int j = i + max; + int j = i + n; if (j > n) { j = n; } @@ -565,7 +563,7 @@ balanceReport += constructTableHeader(columnsNames); balanceReport += "\t\t<tbody>\n"; - if (n > max) { + if (n > n) { String boldBegin = "<b>"; String boldEnd = "</b>"; String [] columnsBalanceAmount = {"", boldBegin + _("lima-business.document.carryback") + boldEnd, @@ -597,7 +595,7 @@ } } - if (n > max && i <= n - max) { + if (n > n && i <= n - n) { String boldBegin = "<b>"; String boldEnd = "</b>"; String [] columnsBalanceAmount = {"", boldBegin + _("lima-business.document.carryforward") + boldEnd, @@ -609,7 +607,7 @@ } //final amounts - if (i >= n - max) { + if (i >= n - n) { String boldBegin = "<b>"; String boldEnd = "</b>"; String [] columnsBalanceAmount = {"", boldBegin + _("lima-business.document.amounts") + boldEnd, @@ -619,7 +617,7 @@ even = !even; balanceReport += "</tbody></table>\n"; } - i = i + max; + i = i + n; } balanceReport += "</body>\n</html>"; } catch (Exception ex) { @@ -994,6 +992,10 @@ Identity identity = identityService.getIdentity(); headerTitle += "<table>" + + "<thead> " + + "<tr><th>" + title + + "</th></tr>" + + "</thead>" + "<tr> " + "<td>" + "<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" + @@ -1002,38 +1004,40 @@ String boldItalicBegin = "<b>" + "<i>"; String boldItalicEnd = "</i>" + "</b>"; - String [] columnsNameSociety = {boldItalicBegin + identity.getName()+ boldItalicEnd}; + String [] columnsNameSociety = {boldItalicBegin + _("lima-business.document.society") + boldItalicEnd, + "<i>" + (StringUtils.isNotEmpty(identity.getName()) ? identity.getName() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsNameSociety); - String [] columnsDescription = {"<i>" + identity.getDescription()+ "</i>"}; + String [] columnsDescription = {boldItalicBegin + _("lima-business.document.description") + boldItalicEnd, + "<i>" + (StringUtils.isNotEmpty(identity.getDescription()) ? identity.getDescription() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsDescription); - String [] columnsAdressOne = {"<i>" + identity.getAddress() + "</i>"}; + String [] columnsAdressOne = {boldItalicBegin + _("lima-business.document.adress") + boldItalicEnd, + "<i>" + (StringUtils.isNotEmpty(identity.getAddress()) ? identity.getAddress() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsAdressOne); - String [] columnsAdressTwo = {"<i>" + identity.getAddress2() + "</i>"}; + + String [] columnsAdressTwo = {boldItalicBegin + _("lima-business.document.adresssuite") + boldItalicEnd, + "<i>" + (StringUtils.isNotEmpty(identity.getAddress2()) ? identity.getAddress2() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsAdressTwo); - String [] columnsZipCode = {"<i>" + identity.getZipCode() + "</i>"}; + String [] columnsZipCode = {boldItalicBegin + _("lima-business.document.zipcode") + boldItalicEnd, + "<i>" + (StringUtils.isNotEmpty(identity.getZipCode()) ? identity.getZipCode() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsZipCode); - String [] columnsCity = {"<i>" + identity.getCity()+ "</i>"}; + String [] columnsCity = {boldItalicBegin + _("lima-business.document.city") + boldItalicEnd, + "<i>" + (StringUtils.isNotEmpty(identity.getCity()) ? identity.getCity() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsCity); - headerTitle += "</table>\n" + - "</td>" + - "<td>" + - "<table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n"; - String [] columnsBusinessNumber = {boldItalicBegin + _("lima-business.document.businessnumber") + - boldItalicEnd, "<i>" + identity.getBusinessNumber()+ "</i>"}; + boldItalicEnd, "<i>" + (StringUtils.isNotEmpty(identity.getBusinessNumber()) ? identity.getBusinessNumber() : " - ") + "</i>"}; headerTitle += constructTableLine(columnsBusinessNumber); String [] columnsClassifCode = {boldItalicBegin + _("lima-business.document.classificationcode") + - boldItalicEnd, "<i>" + identity.getClassificationCode()+ "</i>"}; + boldItalicEnd, "<i>" + (StringUtils.isNotEmpty(identity.getClassificationCode()) ? identity.getClassificationCode() : " - ") + "</i>"}; headerTitle += constructTableLine(columnsClassifCode); String [] columnsVatNumber = {boldItalicBegin + _("lima-business.document.vatnumber") + boldItalicEnd, - "<i>" + identity.getVatNumber()+ "</i>", }; + "<i>" + (StringUtils.isNotEmpty(identity.getVatNumber()) ? identity.getVatNumber() : " - ") + "</i>", }; headerTitle += constructTableLine(columnsVatNumber); String [] columnsPeriodOne = {boldItalicBegin + _("lima-business.document.period1") + boldItalicEnd, "<i>"