";
if (indexEntry =3D=3D 0) {
- ledgerReport +=3D "\n" +
- "\n";
- String [] columnsEntry =3D {boldBegin + _("l=
ima-business.document.date")+ boldEnd,
- boldBegin + _("lima-business.documen=
t.entrybook") + boldEnd, boldBegin + _("lima-business.document.voucher") + bo=
ldEnd,
- boldBegin + _("lima-business.documen=
t.description") + boldEnd, boldBegin + _("lima-business.document.debit") + bo=
ldEnd,
- boldBegin + _("lima-business.documen=
t.credit") + boldEnd, boldBegin + _("lima-business.document.solde") + boldEnd=
};
- ledgerReport +=3D constructColumnsHtml(colum=
nsEntry, "");
+ ledgerReport +=3D "\n";
+ String [] columnsEntry =3D {_("lima-business=
.document.date"),
+ _("lima-business.document.entrybook"=
), _("lima-business.document.voucher"),
+ _("lima-business.document.descriptio=
n"), _("lima-business.document.debit"),
+ _("lima-business.document.credit"), =
_("lima-business.document.solde")};
+ ledgerReport +=3D constructTableHeader(colum=
nsEntry);
+ ledgerReport +=3D "";
}
=20
String [] columnsTable =3D {_("lima-business.doc=
ument.dateformat",entry.getFinancialTransaction().getTransactionDate()),
entryBookCode, entry.getVoucher(), entry=
.getDescription(),
amountDebit.toString(), amountCredit.toS=
tring(), amountDebit.subtract(amountCredit).toString()};
- ledgerReport +=3D constructColumnsHtml(columnsTa=
ble, "");
- ledgerReport +=3D "";
+ ledgerReport +=3D constructTableLine(columnsTabl=
e, even);
+ even =3D !even;
}
}
=20
@@ -427,18 +420,20 @@
String [] columnsTable =3D {"", boldBegin + _("l=
ima-business.document.carryforward") + boldEnd,
boldBegin + currentAmountDebit.toString(=
) + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentAmountDebit.subtract(=
currentAmountCredit).toString() + boldEnd};
- ledgerReport +=3D constructColumnsHtml(columnsTa=
ble, "");
+ ledgerReport +=3D constructTableLine(columnsTabl=
e, even);
+ even =3D !even;
}
//final amounts
if (i >=3D n - max) {
String [] columnsTable =3D { boldBegin + _("lima=
-business.document.amounts") + boldEnd,
boldBegin + currentAmountDebit.toString(=
) + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentAmountDebit.subtract(=
currentAmountCredit).toString() + boldEnd};
- ledgerReport +=3D constructColumnsHtml(columnsTa=
ble, "");
+ ledgerReport +=3D constructTableLine(columnsTabl=
e, even);
+ even =3D !even;
}
i =3D i + max;
}
- ledgerReport +=3D " \n";
+ ledgerReport +=3D " | \n";
}catch (Exception ex) {
log.error("Can't create document", ex);
}
@@ -452,12 +447,8 @@
String entryBookReport;
SimpleDateFormat simpleDateFormat =3D new SimpleDateFormat("MMMMM yy=
yy");
try {
- entryBookReport =3D "\n" +
- "\n";
+ entryBookReport =3D constructHtmlHeader(_("lima-business.documen=
t.entrybooks"));
=20
- String titre =3D _("lima-business.document.entrybooks");
- entryBookReport +=3D constructHeadHtml(titre);
-
if (beginDate !=3D null && endDate !=3D null) {
=20
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =3D
@@ -468,7 +459,6 @@
List closedPeriodicEntryBookList =3D
closedPeriodicEntryBookDAO.findAllByDates(beginDate,=
endDate);
=20
- entryBookReport +=3D "\n";
String journal =3D "";
for (ClosedPeriodicEntryBook closedPeriodicEntryBook : close=
dPeriodicEntryBookList) {
=20
@@ -508,7 +498,7 @@
entryBookReport +=3D constructSubTitleHtml("", s=
ubTitleSecPart);
}
=20
- entryBookReport +=3D "\n" +
+ entryBookReport +=3D "\n" +
"\n";
=20
String [] columnNames =3D {_("lima-business.document=
.date"), _("lima-business.document.accountnumber"),
@@ -516,7 +506,7 @@
_("lima-business.document.debit"),
_("lima-business.document.credit")};
=20
- entryBookReport +=3D constructColumnsHtml(columnName=
s, "");
+ entryBookReport +=3D constructTableHeader(columnName=
s);
=20
for (Entry entry : entries) {
String numaccount =3D null;
@@ -529,10 +519,10 @@
(entry.getDebit() ? entry.getAmount() : =
BigDecimal.ZERO).toString(),
(entry.getDebit() ? BigDecimal.ZERO : en=
try.getAmount()).toString()};
=20
- entryBookReport +=3D constructColumnsHtml(column=
Data, "");
+ entryBookReport +=3D constructTableHeader(column=
Data);
}
String [] columnDataTotal =3D {"", "", "", _("lima-b=
usiness.document.amounts"), debit.toString(), credit.toString()};
- entryBookReport +=3D constructColumnsHtml(columnData=
Total, "");
+ entryBookReport +=3D constructTableHeader(columnData=
Total);
entryBookReport +=3D " \n";
}
}
@@ -556,9 +546,7 @@
=20
List list =3D (List) balanceTrial.getRep=
ortsDatas();
=20
- String balanceReport =3D "";
- balanceReport +=3D "\n" +
- "\n";
+ String balanceReport =3D constructHtmlHeader(_("lima-business.docume=
nt.balance"));
=20
if (beginDate !=3D null && endDate !=3D null) {
try{
@@ -581,85 +569,15 @@
}
List subList =3D list.subList(i, j);
=20
- balanceReport +=3D "\n";
balanceReport +=3D constructHeaderTitle(_("lima-business=
.document.balance"), beginDate, endDate);
=20
- /*balanceReport +=3D "" +
- " " +
- "" +
- "\n" +
- "\n";
+ balanceReport +=3D "\n";
=20
- String boldItalicBegin =3D "" + "";
- String boldItalicEnd =3D "" + "";
-
- String [] columnsNameSociety =3D {boldItalicBegin + iden=
tity.getName()+ boldItalicEnd};
- balanceReport +=3D constructColumnsHtml(columnsNameSocie=
ty, "");
-
- balanceReport +=3D "\n";
- String [] columnsDescription =3D {"" + identity.getDe=
scription()+ ""};
- balanceReport +=3D constructColumnsHtml(columnsDescripti=
on, "");
-
- balanceReport +=3D " \n";
- String [] columnsAdressOne =3D {"" + identity.getAddr=
ess() + ""};
- balanceReport +=3D constructColumnsHtml(columnsAdressOne=
, "");
-
- balanceReport +=3D " \n";
- String [] columnsAdressTwo =3D {"" + identity.getAddr=
ess2() + ""};
- balanceReport +=3D constructColumnsHtml(columnsAdressTwo=
, "");
-
- balanceReport +=3D " \n";
- String [] columnsZipCode =3D {"" + identity.getZipCod=
e() + ""};
- balanceReport +=3D constructColumnsHtml(columnsZipCode, =
"");
-
- balanceReport +=3D " \n";
- String [] columnsCity =3D {"" + identity.getCity()+ "=
"};
- balanceReport +=3D constructColumnsHtml(columnsCity, "");
-
- balanceReport +=3D " \n" +
- "" +
- "" +
- " " + _("lima-=
business.document.balance") + " " +
- " | " +
- "" +
- "\n";
-
- balanceReport +=3D "\n";
- String [] columnsBusinessNumber =3D {boldItalicBegin + _=
("lima-business.document.businessnumber") +
- boldItalicEnd, "" + identity.getBusinessNumbe=
r()+ ""};
- balanceReport +=3D constructColumnsHtml(columnsBusinessN=
umber, "");
-
- balanceReport +=3D " \n";
- String [] columnsClassifCode =3D {boldItalicBegin + _("l=
ima-business.document.classificationcode") +
- boldItalicEnd, "" + identity.getClassificatio=
nCode()+ ""};
- balanceReport +=3D constructColumnsHtml(columnsClassifCo=
de, "");
-
- balanceReport +=3D " \n";
- String [] columnsVatNumber =3D {boldItalicBegin + _("lim=
a-business.document.vatnumber") + boldItalicEnd,
- "" + identity.getVatNumber()+ "", };
- balanceReport +=3D constructColumnsHtml(columnsVatNumber=
, "");
-
- balanceReport +=3D " \n";
- String [] columnsPeriodOne =3D {boldItalicBegin + _("lim=
a-business.document.period1") + boldItalicEnd, ""
- + _("lima-business.document.period1format", begi=
nDate)+ ""};
- balanceReport +=3D constructColumnsHtml(columnsPeriodOne=
, "");
-
- balanceReport +=3D " \n";
- String [] columnsPeriodTwo =3D {boldItalicBegin + _("lim=
a-business.document.period2") + boldItalicEnd, ""
- + _("lima-business.document.period2format", endD=
ate)+ ""};
- balanceReport +=3D constructColumnsHtml(columnsPeriodTwo=
, "");
-
- balanceReport +=3D " " +
- " | " +
- " "*/
-
- balanceReport +=3D "\n" +
- "\n";
-
String [] columnsNames =3D {_("lima-business.document.ac=
countnumber"), _("lima-business.document.description"),
_("lima-business.document.movementdebit"), _("li=
ma-business.document.movementcredit"),
_("lima-business.document.soldedebit"), _("lima-=
business.document.soldecredit")};
- balanceReport +=3D constructColumnsHtml(columnsNames, ""=
);
+ balanceReport +=3D constructTableHeader(columnsNames);
+ balanceReport +=3D "\t\t \n";
=20
if (n > max) {
String boldBegin =3D "";
@@ -667,10 +585,11 @@
String [] columnsBalanceAmount =3D {"", boldBegin + =
_("lima-business.document.carryback") + boldEnd,
boldBegin + currentAmountDebit.toString() + =
boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentSoldeDebit.toString() + b=
oldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd};
- balanceReport +=3D constructColumnsHtml(columnsBalan=
ceAmount, "");
- balanceReport +=3D " \n";
+ balanceReport +=3D constructTableLine(columnsBalance=
Amount);
+ balanceReport +=3D " | \n";
}
=20
+ boolean even =3D true;
for (ReportsDatas reportsDatas : subList) {
String soldeDebit =3D String.valueOf(reportsDatas.ge=
tSoldeDebit() ? reportsDatas.getAmountSolde() : 0);
String soldeCredit =3D String.valueOf(reportsDatas.g=
etSoldeDebit() ? 0 : reportsDatas.getAmountSolde());
@@ -678,7 +597,8 @@
String [] columnsBalanceAmount =3D {reportsDatas.get=
Account().getAccountNumber(), reportsDatas.getAccount().getLabel(),
reportsDatas.getAmountDebit().toString(), re=
portsDatas.getAmountCredit().toString(),
soldeDebit, soldeCredit};
- balanceReport +=3D constructColumnsHtml(columnsBalan=
ceAmount, "");
+ balanceReport +=3D constructTableLine(columnsBalance=
Amount, even);
+ even =3D !even;
}
=20
for (ReportsDatas reportsDatas : subList) {
@@ -697,8 +617,9 @@
String [] columnsBalanceAmount =3D {"", boldBegin + =
_("lima-business.document.carryforward") + boldEnd,
boldBegin + currentAmountDebit.toString() + =
boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentSoldeDebit.toString() + b=
oldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd};
- balanceReport +=3D constructColumnsHtml(columnsBalan=
ceAmount, "");
- balanceReport +=3D " \n";
+ balanceReport +=3D constructTableLine(columnsBalance=
Amount, even);
+ even =3D !even;
+ balanceReport +=3D "\n";
}
=20
//final amounts
@@ -708,8 +629,9 @@
String [] columnsBalanceAmount =3D {"", boldBegin + =
_("lima-business.document.amounts") + boldEnd,
boldBegin + currentAmountDebit.toString() + =
boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentSoldeDebit.toString() + b=
oldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd};
- balanceReport +=3D constructColumnsHtml(columnsBalan=
ceAmount, "");
- balanceReport +=3D "\n";
+ balanceReport +=3D constructTableLine(columnsBalance=
Amount, even);
+ even =3D !even;
+ balanceReport +=3D "\n";
}
i =3D i + max;
}
@@ -731,13 +653,15 @@
=20
String entryBookReport;
try {
- entryBookReport =3D "\n" +
- "\n";
+ entryBookReport =3D constructHtmlHeader(_("lima-business.documen=
t.entrybook"));
+ SimpleDateFormat simpleDateFormat =3D new SimpleDateFormat("dd M=
MMMM yyyy");
=20
- String titre =3D _("lima-business.document.entrybook");
- entryBookReport +=3D constructHeadHtml(titre);
-
if (beginDate !=3D null && endDate !=3D null) {
+ String subTitle =3D _("lima-business.document.period1") +
+ simpleDateFormat.format(beginDate) + " " +
+ _("lima-business.document.period2") +
+ simpleDateFormat.format(endDate);
+ entryBookReport +=3D constructSubTitleHtml(subTitle);
=20
FinancialPeriodDAO financialPeriodDAO =3D
getDaoHelper().getFinancialPeriodDAO();
@@ -815,16 +739,16 @@
generalEntryBooksDatas.setDebit(amountDebit);
list.add(generalEntryBooksDatas);
=20
- entryBookReport +=3D "\n" +
- "\n" +
- "\n";
+ entryBookReport +=3D "\n";
=20
String[] columnNames =3D {_("lima-business.document.entryboo=
k"), _("lima-business.document.label"),
_("lima-business.document.date"), _("lima-business.d=
ocument.debit"),
_("lima-business.document.credit")};
=20
- entryBookReport +=3D constructColumnsHtml(columnNames, "");
+ entryBookReport +=3D constructTableHeader(columnNames);
+ entryBookReport +=3D "\t\t\n";
String entryBookCode =3D "";
+ boolean even =3D true;
=20
for (GeneralEntryBooksDatas generalEntryBooksDataInList : li=
st) {
if (!generalEntryBooksDataInList.getDebit().equals(BigDe=
cimal.ZERO) && !generalEntryBooksDataInList.getCredit().equals(BigDecimal.ZER=
O)) {
@@ -843,7 +767,8 @@
_("lima-business.document.monthformat", =
generalEntryBooksDataInList.getPeriod()),
generalEntryBooksDataInList.getDebit().t=
oString(),
generalEntryBooksDataInList.getCredit().=
toString()};
- entryBookReport +=3D constructColumnsHtml(column=
Data, "");
+ entryBookReport +=3D constructTableLine(columnDa=
ta, even);
+ even =3D !even;
} else {
String amount;
if (generalEntryBooksDataInList.getAmount()) {
@@ -851,14 +776,18 @@
} else {
amount =3D _("lima-business.document.amounts=
period", generalEntryBooksDataInList.getPeriod());
}
- String[] columnDataTotal =3D {"", "", ""+ (St=
ringUtils.isBlank(amount)?"":amount) + "",
+ String[] columnDataTotal =3D {"", "", (StringUti=
ls.isBlank(amount)?"":amount),
generalEntryBooksDataInList.getDebit().t=
oString(),
generalEntryBooksDataInList.getCredit().=
toString()};
- entryBookReport +=3D constructColumnsHtml(column=
DataTotal, "");
+ entryBookReport +=3D constructTableLine(columnDa=
taTotal, even);
+ even =3D !even;
entryBookCode =3D "";
}
}
}
+ entryBookReport +=3D "\t\t\n" +
+ "\t \n" +
+ "\n";
}
} catch (Exception ex) {
throw new LimaException("Can't generate document", ex);
@@ -954,10 +883,7 @@
Account accountFormat =3D accountDAO.findByTopiaId(account);
SimpleDateFormat simpleDateFormat =3D new SimpleDateFormat("dd M=
MMMM yyyy");
=20
- accountReport +=3D "\n" +
- "\n";
- String title =3D _("lima.reports.accounts");
- accountReport =3D constructHeadHtml(title);
+ accountReport =3D constructHtmlHeader(_("lima.reports.accounts")=
);
=20
ReportsDatas results;
=20
@@ -975,12 +901,12 @@
_("lima.table.voucher"), _("lima.tab=
le.description"), _("lima.table.letter"),
_("lima.table.debit"), _("lima.table=
.credit")};
=20
- accountReport +=3D "\n" +
- "\n" +
- "\n";
+ accountReport +=3D "\t\n";
=20
- accountReport +=3D constructColumnsHtml(columnNames, "");
-
+ accountReport +=3D constructTableHeader(columnNames);
+ accountReport +=3D "\t\t\n";
+ =20
+ boolean even =3D true;
for(Entry entry : entries) {
=20
String accountNumber =3D entry.getAccount().getAccountNu=
mber();
@@ -1000,11 +926,12 @@
(entry.getDebit() ? entry.getAmo=
unt() : BigDecimal.ZERO).toString(),
(entry.getDebit() ? BigDecimal.Z=
ERO : entry.getAmount()).toString()};
=20
- accountReport +=3D constructColumnsHtml(columnData, "");
+ accountReport +=3D constructTableLine(columnData, even);
+ even =3D !even;
}
=20
- accountReport +=3D " \n" +
- "\n";
+ accountReport +=3D "\t\t\n\t \n" +
+ "\n";
=20
} else {
JOptionPane.showMessageDialog(null, _("lima.reports.account.=
noaccount"), _("lima.reports.account.noaccounttitle"), JOptionPane.INFORMATIO=
N_MESSAGE);
@@ -1022,45 +949,59 @@
return accountReport;
}
=20
- protected String constructHeadHtml(String title) {
- String head =3D
- "\n" +
- ""+title+"\n" +
- "\n" +
- "" +
- "\n" +
- title +
- "\n" +
- " \n" +
- "";
-
+ protected String constructHtmlHeader(String title) {
+ String head =3D "\n" +
+ "\n" +
+ " \n" +
+ "\t\n" +
+ "\t" + title + "\n" +
+ "\n" +
+ "\n" +
+ "\t" + title + "\n";
return head;
}
=20
+ protected String constructSubTitleHtml(String subTitle) {
+ return "\t" + subTitle + "\n";
+ }
+
protected String constructSubTitleHtml(String subTitleFirstpart, String =
subTitleSecPart) {
- String subTitle =3D "\n" +
+ String subTitle =3D "\t\n" +
subTitleFirstpart +
- "\n" +
- "" +
+ " \n" +
subTitleSecPart +
- " "+
- "";
+ "\n";
=20
return subTitle;
}
=20
- protected String constructColumnsHtml(String[] columnsNames, String font=
Color) {
-
- String columns =3D "";
-
+ protected String constructTableHeader(String[] columnsNames) {
+ String header =3D "\t\t\n\t\t\t\n";
for (String name : columnsNames) {
- columns +=3D "| " =
+ name + " | \n";
+ header +=3D "\t\t\t\t" + name + " | \n";
}
- columns +=3D " \n";
+ header +=3D "\t\t\t \t\t\n\n";
+ return header;
+ }
=20
-
- return columns;
+ protected String constructTableLine(String[] cells, boolean even) {
+ String style =3D even ? "line_even" : "line_odd";
+ String line =3D "\t\t \n";
+ for (String cell : cells) {
+ line +=3D "\t\t\t| " + cell + " | \n";
+ }
+ line +=3D "\t\t \n";
+ return line;
}
+ =20
+ protected String constructTableLine(String[] cells) {
+ String line =3D "\t\t\n";
+ for (String cell : cells) {
+ line +=3D "\t\t\t| " + cell + " | \n";
+ }
+ line +=3D "\t\t \n";
+ return line;
+ }
=20
protected String constructHeaderTitle(String title, Date beginDate, Date=
endDate) {
String headerTitle =3D "";
@@ -1076,59 +1017,47 @@
String boldItalicEnd =3D "" + "";
=20
String [] columnsNameSociety =3D {boldItalicBegin + identity.getName=
()+ boldItalicEnd};
- headerTitle +=3D constructColumnsHtml(columnsNameSociety, "");
+ headerTitle +=3D constructTableLine(columnsNameSociety);
=20
- headerTitle +=3D "\n";
String [] columnsDescription =3D {"" + identity.getDescription()+=
""};
- headerTitle +=3D constructColumnsHtml(columnsDescription, "");
+ headerTitle +=3D constructTableLine(columnsDescription);
=20
- headerTitle +=3D " \n";
String [] columnsAdressOne =3D {"" + identity.getAddress() + ""};
- headerTitle +=3D constructColumnsHtml(columnsAdressOne, "");
- headerTitle +=3D " \n";
+ headerTitle +=3D constructTableLine(columnsAdressOne);
String [] columnsAdressTwo =3D {"" + identity.getAddress2() + "=
i>"};
- headerTitle +=3D constructColumnsHtml(columnsAdressTwo, "");
+ headerTitle +=3D constructTableLine(columnsAdressTwo);
=20
- headerTitle +=3D "\n";
String [] columnsZipCode =3D {"" + identity.getZipCode() + ""=
};
- headerTitle +=3D constructColumnsHtml(columnsZipCode, "");
+ headerTitle +=3D constructTableLine(columnsZipCode);
=20
- headerTitle +=3D " \n";
String [] columnsCity =3D {"" + identity.getCity()+ ""};
- headerTitle +=3D constructColumnsHtml(columnsCity, "");
+ headerTitle +=3D constructTableLine(columnsCity);
=20
headerTitle +=3D " \n" +
" | " +
- "" +
- " " + title + " " +
- " | " +
"" +
"\n";
=20
- headerTitle +=3D "\n";
String [] columnsBusinessNumber =3D {boldItalicBegin + _("lima-busin=
ess.document.businessnumber") +
boldItalicEnd, "" + identity.getBusinessNumber()+ ""};
- headerTitle +=3D constructColumnsHtml(columnsBusinessNumber, "");
+ headerTitle +=3D constructTableLine(columnsBusinessNumber);
=20
- headerTitle +=3D " \n";
String [] columnsClassifCode =3D {boldItalicBegin + _("lima-business=
.document.classificationcode") +
boldItalicEnd, "" + identity.getClassificationCode()+ "=
i>"};
- headerTitle +=3D constructColumnsHtml(columnsClassifCode, "");
+ headerTitle +=3D constructTableLine(columnsClassifCode);
=20
- headerTitle +=3D "\n";
String [] columnsVatNumber =3D {boldItalicBegin + _("lima-business.d=
ocument.vatnumber") + boldItalicEnd,
"" + identity.getVatNumber()+ "", };
- headerTitle +=3D constructColumnsHtml(columnsVatNumber, "");
+ headerTitle +=3D constructTableLine(columnsVatNumber);
=20
- headerTitle +=3D " \n";
String [] columnsPeriodOne =3D {boldItalicBegin + _("lima-business.d=
ocument.period1") + boldItalicEnd, ""
+ _("lima-business.document.period1format", beginDate)+ ""};
- headerTitle +=3D constructColumnsHtml(columnsPeriodOne, "");
+ headerTitle +=3D constructTableLine(columnsPeriodOne);
=20
headerTitle +=3D " \n";
String [] columnsPeriodTwo =3D {boldItalicBegin + _("lima-business.d=
ocument.period2") + boldItalicEnd, ""
+ _("lima-business.document.period2format", endDate)+ ""=
};
- headerTitle +=3D constructColumnsHtml(columnsPeriodTwo, "");
+ headerTitle +=3D constructTableLine(columnsPeriodTwo);
=20
headerTitle +=3D " " +
" | " +
--===============6234992900313849061==--