This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository chorem. See http://git.chorem.org/chorem.git commit e7845ddc9cc277e5053a95111b9c40c44b01e741 Author: kootox <jean.couteau@gmail.com> Date: Fri Nov 7 13:56:51 2014 +0100 fixes #1135 : Took the same query than dashboard --- .../actions/financial/BillingReportAction.java | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java index af9faaa..3ec97fb 100644 --- a/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java +++ b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java @@ -23,14 +23,18 @@ package org.chorem.webmotion.actions.financial; import org.apache.commons.lang3.time.DateUtils; import org.chorem.ChoremClient; +import org.chorem.ChoremQueryMaker; import org.chorem.entities.Accepted; import org.chorem.entities.FinancialTransaction; +import org.chorem.entities.Invoice; +import org.chorem.entities.InvoiceStatus; import org.chorem.webmotion.actions.sales.QuotationYearData; import org.chorem.webmotion.actions.sales.SalesReportHelper; import org.debux.webmotion.server.WebMotionController; import org.debux.webmotion.server.render.Render; import org.nuiton.util.DateUtil; import org.nuiton.wikitty.WikittyClient; +import org.nuiton.wikitty.entities.Element; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; @@ -52,6 +56,8 @@ public class BillingReportAction extends WebMotionController { */ public Render billing(ChoremClient client, String from, String to) { + String companyId = client.getConfiguration().getDefaultCompany(); + if (null == from) { from = String.valueOf(BillingReportHelper.getFirstYear(client)); } @@ -75,11 +81,14 @@ public class BillingReportAction extends WebMotionController { QuotationYearData yearData = new QuotationYearData(); //factures de l'année - WikittyQuery billingQuery = new WikittyQueryMaker() - .select().sum("FinancialTransaction.amount").where().and() - .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) + WikittyQuery billingQuery = new ChoremQueryMaker() + .select().sum(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT).where().and() + .exteq(Invoice.EXT_INVOICE) + .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, yearFirstDay, yearLastDay) - .end(); + .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY) + .select(Element.ID).filterOnCompanyOrEmployee(companyId) + .end().setLimit(WikittyQuery.MAX); Integer billing = client.findByQuery(Integer.class, billingQuery); @@ -108,7 +117,9 @@ public class BillingReportAction extends WebMotionController { "toYear", to); } - protected Map<String,Integer> getBillingData(Integer year, WikittyClient client){ + protected Map<String,Integer> getBillingData(Integer year, ChoremClient client){ + + String companyId = client.getConfiguration().getDefaultCompany(); Date first = BillingReportHelper.getFirstDayOfYear(year); @@ -121,10 +132,14 @@ public class BillingReportAction extends WebMotionController { Date firstDayOfMonth = DateUtil.setFirstDayOfMonth(baseValue); baseValue= DateUtils.addDays(lastDayOfMonth, 1); - WikittyQuery monthQuery = new WikittyQueryMaker() - .select().sum("FinancialTransaction.amount").where().and() + WikittyQuery monthQuery = new ChoremQueryMaker() + .select().sum(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT).where().and() + .exteq(Invoice.EXT_INVOICE) + .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, firstDayOfMonth, lastDayOfMonth) - .end(); + .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY) + .select(Element.ID).filterOnCompanyOrEmployee(companyId) + .end().setLimit(WikittyQuery.MAX); Integer billing = client.findByQuery(Integer.class, monthQuery); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.