Author: bpoussin Date: 2012-09-13 18:27:19 +0200 (Thu, 13 Sep 2012) New Revision: 266 Url: http://chorem.org/repositories/revision/chorem/266 Log: - prise en compte du supplier/customer qui peuvent etre des companies - CA en TTC car il y a la TVA dans les depenses (19.6 dans la jsp) - import cost chorem-topia, tag aussi dans la description Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2012-09-13 10:16:43 UTC (rev 265) +++ trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2012-09-13 16:27:19 UTC (rev 266) @@ -639,6 +639,7 @@ InvoiceImpl invoice = new InvoiceImpl(); invoice.setName(tag); + invoice.setDescription(tag); invoice.setCategory(categoryNameId.get(category)); invoice.setCustomer(codeLutinId); invoice.setAmount(amount); Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-09-13 10:16:43 UTC (rev 265) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-09-13 16:27:19 UTC (rev 266) @@ -57,6 +57,7 @@ import org.nuiton.util.DateUtil; import org.nuiton.wikitty.entities.Element; import org.nuiton.wikitty.entities.ElementField; +import org.nuiton.wikitty.entities.WikittyExtension; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; import org.nuiton.wikitty.query.WikittyQueryResult; @@ -169,7 +170,7 @@ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, firstDayYear, now) .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER) .select(Element.ID).or().ideq(companyId).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).close() - .end(); + .end().setLimit(WikittyQuery.MAX); // toutes les depenses depuis le debut de l'annee WikittyQuery lastYearAnnualDebtQuery = new WikittyQueryMaker() @@ -189,7 +190,7 @@ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, lastYearFirstDay, lastYearNow) .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER) .select(Element.ID).or().ideq(companyId).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).close() - .end(); + .end().setLimit(WikittyQuery.MAX); // les factures que notre societe doit payer au plus tard dans 7 jours @@ -212,7 +213,7 @@ .isNull(Invoice.FQ_FIELD_INVOICE_PAYMENTDATE) .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER) .select(Element.ID).or().ideq(companyId).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).close() - .end(); + .end().setLimit(WikittyQuery.MAX); // les contacts qui doivnet etre pris dans les 7 prochains jours WikittyQuery touchQuery = new WikittyQueryMaker().and() @@ -315,7 +316,7 @@ .isNull(Interval.FQ_FIELD_INTERVAL_BEGINDATE) .isNull(Interval.FQ_FIELD_INTERVAL_ENDDATE) .isNull(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE) - .end(); + .end().setLimit(WikittyQuery.MAX); WikittyQueryResult<Quotation> result = client.findAllByQuery(Quotation.class, quotationQuery); @@ -544,8 +545,14 @@ .isNull(Invoice.FQ_FIELD_INVOICE_POSTEDDATE) .bw(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start, end) .bw(Invoice.FQ_FIELD_INVOICE_PAYMENTDATE, start, end) - .end(); + .end().setLimit(WikittyQuery.MAX); + WikittyExtension ext = client.restoreExtensionLastVersion(Invoice.EXT_INVOICE); + + invoiceQuery.addSortAscending(ext.getSortAscending().toArray(new ElementField[0])); + invoiceQuery.addSortDescending(ext.getSortDescending().toArray(new ElementField[0])); + + WikittyQueryResult<Invoice> invoices = client.findAllByQuery(Invoice.class, invoiceQuery); @@ -582,7 +589,7 @@ String title = "Factures à payer par la société"; String companyId = client.getConfiguration().getDefaultCompany(); String filter = Invoice.FQ_FIELD_INVOICE_CUSTOMER + "={SELECT id WHERE (" + - Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+" OR " + companyId + ")}"; + Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+" OR id=" + companyId + ")}"; return invoiceFilter(client, title, filter, start, end, query); } @@ -591,7 +598,7 @@ String title = "Factures émises par la société"; String companyId = client.getConfiguration().getDefaultCompany(); String filter = Invoice.FQ_FIELD_INVOICE_SUPPLIER + "={SELECT id WHERE (" + - Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+" OR " + companyId + ")}"; + Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+" OR id=" + companyId + ")}"; return invoiceFilter(client, title, filter, start, end, query); } Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-09-13 10:16:43 UTC (rev 265) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-09-13 16:27:19 UTC (rev 266) @@ -46,8 +46,8 @@ <tbody> <tr> <td><w:display wikitty="${q.wikitty}" fqfield="Invoiceable.target" label=""/></td> - <td><w:display wikitty="${q.wikitty}" toString="%Invoice.reference$s" label=""/></td> - <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.description" label=""/></td> + <td><w:display wikitty="${q.wikitty}" toString="%Invoice.reference|no reference$s" label=""/></td> + <td><w:display wikitty="${q.wikitty}" toString="%Invoice.description|no description$s" label=""/></td> <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.customer" label=""/></td> <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.supplier" label=""/></td> <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Invoice.amount" label=""/></td> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2012-09-13 10:16:43 UTC (rev 265) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2012-09-13 16:27:19 UTC (rev 266) @@ -49,9 +49,9 @@ </ul> <ul> - <li>Chiffre d'affaire: <strong><f:formatNumber type="currency" value="${annualIncome}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome}"/></strong>) + <li>Chiffre d'affaire TTC: <strong><f:formatNumber type="currency" value="${annualIncome*1.196}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome*1.196}"/></strong>) <li>Dépenses: <strong><f:formatNumber type="currency" value="${annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualDebt}"/></strong>) - <li>Bénéfice/perte: <strong><f:formatNumber type="currency" value="${annualIncome-annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome-lastYearAnnualDebt}"/></strong>) + <li>Bénéfice/perte: <strong><f:formatNumber type="currency" value="${annualIncome*1.196-annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome*1.196-lastYearAnnualDebt}"/></strong>) </ul> </div> </div>