Chorem-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2014
- 6 participants
- 32 discussions
r437 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/financial resources webapp/WEB-INF/jsp webapp/WEB-INF/jsp/financial webapp/WEB-INF/jsp/financial/reports
by jcouteau@users.chorem.org 17 Oct '14
by jcouteau@users.chorem.org 17 Oct '14
17 Oct '14
Author: jcouteau
Date: 2014-10-17 16:54:24 +0200 (Fri, 17 Oct 2014)
New Revision: 437
Url: http://forge.chorem.org/projects/chorem/repository/revisions/437
Log:
refs-50 #944 : [Financial] Reporting :
- Reporting on billing per year
- Reporting on billing per account
- Reporting on billing per project
Added:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerAccountReportAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerProjectReportAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportHelper.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerAccountReport.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerProjectReport.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingReport.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/menu.jsp
Modified:
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
Copied: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerAccountReportAction.java (from rev 435, trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesPerAccountReportAction.java)
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerAccountReportAction.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerAccountReportAction.java 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,121 @@
+package org.chorem.webmotion.actions.financial;
+
+/*
+ * #%L
+ * Chorem :: webmotion
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.chorem.ChoremClient;
+import org.chorem.entities.*;
+import org.chorem.webmotion.actions.sales.SalesData;
+import org.chorem.webmotion.actions.sales.SalesReportHelper;
+import org.debux.webmotion.server.WebMotionController;
+import org.debux.webmotion.server.render.Render;
+import org.nuiton.wikitty.WikittyClient;
+import org.nuiton.wikitty.query.WikittyQuery;
+import org.nuiton.wikitty.query.WikittyQueryMaker;
+
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author jcouteau <couteau(a)codelutin.com>
+ */
+public class BillingPerAccountReportAction extends WebMotionController {
+
+ /**
+ * Rend le graphe des devis envoyés par mois
+ *
+ * @param client
+ * @return
+ */
+ public Render billing(ChoremClient client, String from, String to) {
+
+ if (null == from) {
+ from = String.valueOf(BillingReportHelper.getFirstYear(client));
+ }
+
+ if (null == to) {
+ to = String.valueOf(BillingReportHelper.getLastYear());
+ }
+
+ Map<Company, SalesData> billingData = getBillingPerAccountData(from, to, client);
+
+ List<Integer> listAllYearsInChorem = BillingReportHelper.listAllYears(client);
+
+ return renderView("financial/reports/billingPerAccountReport.jsp",
+ "data", billingData,
+ "allYears", listAllYearsInChorem,
+ "fromYear", from,
+ "toYear", to);
+ }
+
+ protected Map<Company,SalesData> getBillingPerAccountData(String firstYear,
+ String lastYear,
+ WikittyClient client){
+
+ Date last = BillingReportHelper.getLastDayOfYear(Integer.valueOf(lastYear));
+ Date first = BillingReportHelper.getFirstDayOfYear(Integer.valueOf(firstYear));
+
+ Map<Company,SalesData> salesData = new LinkedHashMap<Company, SalesData>();
+
+ //a query to get all the accounts
+ //FIXME JC 2012-01-26 Really bad to find all employees and iterate on them :(
+ WikittyQuery accountsQuery = new WikittyQueryMaker().and()
+ .exteq(Company.EXT_COMPANY).end();
+
+ List<Company> accounts = client.findAllByQuery(Company.class, accountsQuery).getAll();
+
+ //iterate and two queries per account :(
+ for (Company account:accounts){
+
+ SalesData projectData = new SalesData();
+
+ WikittyQuery accountQuery = new WikittyQueryMaker()
+ .select().sum("FinancialTransaction.amount").where().and()
+ .eq(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYER, account)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .end();
+
+ Integer sales = client.findByQuery(Integer.class, accountQuery);
+
+ //TODO JC 2012-01-26 Find a way to replace two queries into one.
+ WikittyQuery quotationsQuery = new WikittyQueryMaker().and()
+ .eq(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYER, account)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .end();
+
+ List<FinancialTransaction> quotations = client.findAllByQuery(FinancialTransaction.class,
+ quotationsQuery).getAll();
+
+ //Rempli la map que si on a des valeurs
+ if (null != sales && sales != 0) {
+ projectData.setSales(sales);
+ projectData.setQuotations(quotations.size());
+ salesData.put(account, projectData);
+ }
+ }
+
+ return salesData;
+ }
+}
Copied: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerProjectReportAction.java (from rev 435, trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesPerProjectReportAction.java)
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerProjectReportAction.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingPerProjectReportAction.java 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,123 @@
+package org.chorem.webmotion.actions.financial;
+
+/*
+ * #%L
+ * Chorem :: webmotion
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.chorem.ChoremClient;
+import org.chorem.entities.Accepted;
+import org.chorem.entities.FinancialTransaction;
+import org.chorem.entities.Project;
+import org.chorem.entities.Quotation;
+import org.chorem.webmotion.actions.sales.SalesData;
+import org.chorem.webmotion.actions.sales.SalesReportHelper;
+import org.debux.webmotion.server.WebMotionController;
+import org.debux.webmotion.server.render.Render;
+import org.nuiton.wikitty.WikittyClient;
+import org.nuiton.wikitty.query.WikittyQuery;
+import org.nuiton.wikitty.query.WikittyQueryMaker;
+
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author jcouteau <couteau(a)codelutin.com>
+ */
+public class BillingPerProjectReportAction extends WebMotionController {
+
+ /**
+ * Rend le graphe des devis envoyés par mois
+ *
+ * @param client
+ * @return
+ */
+ public Render billing(ChoremClient client, String from, String to) {
+
+ if (null == from) {
+ from = String.valueOf(BillingReportHelper.getFirstYear(client));
+ }
+
+ if (null == to) {
+ to = String.valueOf(BillingReportHelper.getLastYear());
+ }
+
+ Map<Project, SalesData> billingData = getBillingPerProjectData(from, to, client);
+
+ List<Integer> listAllYearsInChorem = BillingReportHelper.listAllYears(client);
+
+ return renderView("financial/reports/billingPerProjectReport.jsp",
+ "data", billingData,
+ "allYears", listAllYearsInChorem,
+ "fromYear", from,
+ "toYear", to);
+ }
+
+ protected Map<Project,SalesData> getBillingPerProjectData(String firstYear,
+ String lastYear,
+ WikittyClient client){
+
+ Date last = BillingReportHelper.getLastDayOfYear(Integer.valueOf(lastYear));
+ Date first = BillingReportHelper.getFirstDayOfYear(Integer.valueOf(firstYear));
+
+ Map<Project,SalesData> billingData = new LinkedHashMap<Project, SalesData>();
+
+ //a query to get all the projects
+ WikittyQuery projectsQuery = new WikittyQueryMaker().and()
+ .exteq(Project.EXT_PROJECT).end();
+
+ List<Project> projects = client.findAllByQuery(Project.class, projectsQuery).getAll();
+
+ //a query per project :(
+ for (Project project:projects){
+
+ SalesData projectData = new SalesData();
+
+ WikittyQuery projectQuery = new WikittyQueryMaker()
+ .select().sum("FinancialTransaction.amount").where().and()
+ .eq(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_TARGET, project)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .end();
+
+ Integer sales = client.findByQuery(Integer.class, projectQuery);
+
+ //TODO JC 2012-01-22 Find a way to replace two queries into one.
+ WikittyQuery transactionsQuery = new WikittyQueryMaker().and()
+ .eq(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_TARGET, project)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .end();
+
+ List<FinancialTransaction> transactions = client.findAllByQuery(FinancialTransaction.class,
+ transactionsQuery).getAll();
+
+ //Rempli la map que si on a des valeurs
+ if (null != sales && sales != 0) {
+ projectData.setSales(sales);
+ projectData.setQuotations(transactions.size());
+ billingData.put(project, projectData);
+ }
+ }
+
+ return billingData;
+ }
+}
Copied: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java (from rev 435, trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesReportAction.java)
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportAction.java 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,141 @@
+package org.chorem.webmotion.actions.financial;
+
+/*
+ * #%L
+ * Chorem :: webmotion
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.apache.commons.lang3.time.DateUtils;
+import org.chorem.ChoremClient;
+import org.chorem.entities.Accepted;
+import org.chorem.entities.FinancialTransaction;
+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.query.WikittyQuery;
+import org.nuiton.wikitty.query.WikittyQueryMaker;
+
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author jcouteau <couteau(a)codelutin.com>
+ */
+public class BillingReportAction extends WebMotionController {
+
+ /**
+ * Rend le graphe des factures par mois
+ *
+ * @param client
+ * @return
+ */
+ public Render billing(ChoremClient client, String from, String to) {
+
+ if (null == from) {
+ from = String.valueOf(BillingReportHelper.getFirstYear(client));
+ }
+
+ if (null == to) {
+ to = String.valueOf(BillingReportHelper.getLastYear());
+ }
+
+ Map<Integer, QuotationYearData> data = new LinkedHashMap<Integer, QuotationYearData>();
+
+ List<Integer> listAllYears = BillingReportHelper.listAllYears(from, to);
+
+ List<Integer> listAllYearsInChorem = BillingReportHelper.listAllYears(client);
+
+ int previousYearValue = 0;
+
+ for (Integer year:listAllYears){
+ Date yearFirstDay = BillingReportHelper.getFirstDayOfYear(year);
+ Date yearLastDay = BillingReportHelper.getLastDayOfYear(year);
+
+ QuotationYearData yearData = new QuotationYearData();
+
+ //factures de l'année
+ WikittyQuery billingQuery = new WikittyQueryMaker()
+ .select().sum("FinancialTransaction.amount").where().and()
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, yearFirstDay, yearLastDay)
+ .end();
+
+ Integer billing = client.findByQuery(Integer.class, billingQuery);
+
+ //Progression facturation
+ int billingProgression = 0;
+ if (previousYearValue != 0){
+ billingProgression = 100 * (billing - previousYearValue) / previousYearValue;
+ }
+
+ previousYearValue = billing;
+
+ //Graphe factures émises
+ Map<String, Integer> billingData = getBillingData(year, client);
+
+ yearData.setBaseValue(billing);
+ yearData.setProgression(billingProgression);
+ yearData.setPlotValues(billingData);
+
+ data.put(year, yearData);
+ }
+
+ return renderView("financial/reports/billingReport.jsp",
+ "data", data,
+ "allYears", listAllYearsInChorem,
+ "fromYear", from,
+ "toYear", to);
+ }
+
+ protected Map<String,Integer> getBillingData(Integer year, WikittyClient client){
+
+ Date first = BillingReportHelper.getFirstDayOfYear(year);
+
+ Map<String,Integer> billingData = new LinkedHashMap<String, Integer>();
+
+ //a query per month :(
+ Date baseValue = first;
+ for (int i=0;i<12;i++){
+ Date lastDayOfMonth = DateUtil.setLastDayOfMonth(baseValue);
+ Date firstDayOfMonth = DateUtil.setFirstDayOfMonth(baseValue);
+ baseValue= DateUtils.addDays(lastDayOfMonth, 1);
+
+ WikittyQuery monthQuery = new WikittyQueryMaker()
+ .select().sum("FinancialTransaction.amount").where().and()
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, firstDayOfMonth, lastDayOfMonth)
+ .end();
+
+ Integer billing = client.findByQuery(Integer.class, monthQuery);
+
+ billingData.put(
+ DateUtil.getMonthLibelle(DateUtil.getMonth(lastDayOfMonth) + 1),
+ billing);
+ }
+
+ return billingData;
+ }
+
+}
Copied: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportHelper.java (from rev 435, trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesReportHelper.java)
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportHelper.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/BillingReportHelper.java 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,134 @@
+package org.chorem.webmotion.actions.financial;
+
+/*
+ * #%L
+ * Chorem :: webmotion
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 - 2014 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import org.chorem.entities.Draft;
+import org.chorem.entities.FinancialTransaction;
+import org.nuiton.util.DateUtil;
+import org.nuiton.wikitty.WikittyClient;
+import org.nuiton.wikitty.query.WikittyQuery;
+import org.nuiton.wikitty.query.WikittyQueryMaker;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author jcouteau <couteau(a)codelutin.com>
+ */
+public class BillingReportHelper {
+
+ /**
+ * This method return the first day of the year string given in parameter.
+ *
+ * @param year the year of the expected Date
+ * @return a Date object representing the first day of the year given in
+ * parameter and the minimum time on this day.
+ */
+ public static Date getFirstDayOfYear(Integer year){
+ Date today = new Date();
+
+ Calendar c = Calendar.getInstance();
+ c.setTime(today);
+ c.set(Calendar.YEAR, year);
+
+ Date result = c.getTime();
+ result = DateUtil.setFirstDayOfYear(result);
+ result = DateUtil.setMinTimeOfDay(result);
+
+ return result;
+
+ }
+
+ /**
+ * This method return the last day of the year string given in parameter.
+ *
+ * @param year the year of the expected Date
+ * @return a Date object representing the last day of the year given in
+ * parameter and the maximum time on this day.
+ */
+ public static Date getLastDayOfYear(Integer year){
+ Date today = new Date();
+
+ Calendar c = Calendar.getInstance();
+ c.setTime(today);
+ c.set(Calendar.YEAR, year);
+
+ Date result = c.getTime();
+ result = DateUtil.setLastDayOfYear(result);
+ result = DateUtil.setMaxTimeOfDay(result);
+
+ return result;
+
+ }
+
+ public static List<Integer> listAllYears(WikittyClient client) {
+
+ List<Integer> years = new LinkedList<Integer>();
+
+ for (int i=getFirstYear(client);i<=getLastYear();i++) {
+ years.add(i);
+ }
+
+ return years;
+
+ }
+
+ public static Integer getLastYear() {
+ Calendar c = Calendar.getInstance();
+ return c.get(Calendar.YEAR);
+ }
+
+ public static Integer getFirstYear(WikittyClient client) {
+
+ WikittyQuery firstYearQuery = new WikittyQueryMaker()
+ .select().min("FinancialTransaction.emittedDate").where().and()
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .end();
+
+ Date firstYear = client.findByQuery(Date.class, firstYearQuery);
+
+ Calendar c = Calendar.getInstance();
+ if (firstYear != null) { // if no FINANCIAL_TRANSACTION available
+ c.setTime(firstYear);
+ }
+ return c.get(Calendar.YEAR);
+ }
+
+ public static List<Integer> listAllYears(String begin, String end) {
+
+ int beginYear = Integer.parseInt(begin);
+ int lastYear = Integer.parseInt(end);
+
+ List<Integer> years = new LinkedList<Integer>();
+
+ for (int i = beginYear; i<= lastYear; i++) {
+ years.add(i);
+ }
+
+ return years;
+
+ }
+}
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2014-10-17 12:55:29 UTC (rev 436)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2014-10-17 14:54:24 UTC (rev 437)
@@ -106,6 +106,10 @@
GET /financial/expenseAccounts/expenseAccountEntryEdit.html view:financial/expenseAccountEntryEdit.html
GET /financial/expenseAccounts/{expenseAccountId} action:financial.ExpenseAccountAction.findExpenseAccount
PUT /financial/expenseAccounts/{expenseAccountId} action:financial.ExpenseAccountAction.saveExpenseAccount
+* /financial/report/billing action:financial.BillingReportAction.billing
+* /financial/report/billingPerProject action:financial.BillingPerProjectReportAction.billing
+* /financial/report/billingPerAccount action:financial.BillingPerAccountReportAction.billing
+* /billingMenu view:financial/reports/menu.jsp
#
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2014-10-17 12:55:29 UTC (rev 436)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2014-10-17 14:54:24 UTC (rev 437)
@@ -191,6 +191,7 @@
<li><a href="<c:url value="/report?report=profitability"/>">Profitability</a></li>
<li><a href="<c:url value="/report?report=budget"/>">Budget</a></li>
<li><a href="<c:url value="/report?report=annualProfit"/>">Annual profit</a></li>
+ <li><a href="<c:url value="/financial/report/billing"/>">Facturation</a></li>
</ul>
</li>
<li class="dropdown nav-group">
Copied: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerAccountReport.jsp (from rev 436, trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerAccountReport.jsp)
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerAccountReport.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerAccountReport.jsp 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,106 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
+<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
+
+<div class="row-fluid">
+ <div class="span2">
+ <jsp:include page="/billingMenu"/>
+ </div>
+
+ <div class="span10">
+ <!-- Javascript to display graph -->
+ <script type="text/javascript">
+ $(document).ready(function(){
+ var sales = [
+ <c:forEach var="entry" items="${data}" varStatus="counter">
+ ['${entry.key}', ${entry.value.sales}]
+ <c:if test="${!counter.last}">, </c:if>
+ </c:forEach>
+ ];
+
+ var plot1 = $.jqplot ('sales', [sales], {
+ title:'Facturation par compte client',
+ seriesDefaults:{
+ renderer:$.jqplot.PieRenderer,
+ rendererOptions: {
+ showDataLabels: true,
+ dataLabels: 'value',
+ sliceMargin: 3
+ }
+ },
+ cursor: {
+ show: false
+ },
+ legend: {show:true, location: 'e'}
+ });
+
+ });
+ </script>
+
+ <h2>Facturation par client</h2>
+
+ <form action="billingPerAccount" method="get">
+ <select name="from">
+ <c:forEach var="entry" items="${allYears}" varStatus="counter">
+ <option value="${entry}" <c:if test="${entry==fromYear}">selected</c:if>>${entry}</option>
+ </c:forEach>
+ </select>
+ <select name="to">
+ <c:forEach var="entry" items="${allYears}" varStatus="counter">
+ <option value="${entry}" ${entry == toYear ? 'selected' : ''} >${entry}</option>
+ </c:forEach>
+ </select>
+ <input type="submit" value="Rechercher">
+ </form>
+
+ <div id="sales" style="height:200px;"></div>
+
+
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Compte client</th>
+ <th>Facturation</th>
+ <th>Factures</th>
+ <th>€/facture</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach var="account" items="${data}">
+ <tr>
+ <td>${account.key}</td>
+ <td>${account.value.sales}</td>
+ <td>${account.value.quotations}</td>
+ <td>${account.value.mean} €</td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+
+ </div>
+</div>
+
+<div style="clear:both;"/>
\ No newline at end of file
Copied: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerProjectReport.jsp (from rev 436, trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerProjectReport.jsp)
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerProjectReport.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingPerProjectReport.jsp 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,106 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
+<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
+
+<div class="row-fluid">
+ <div class="span2">
+ <jsp:include page="/billingMenu"/>
+ </div>
+
+ <div class="span10">
+ <!-- Javascript to display graph -->
+ <script type="text/javascript">
+ $(document).ready(function(){
+ var sales = [
+ <c:forEach var="entry" items="${data}" varStatus="counter">
+ ['${entry.key.name}', ${entry.value.sales}]
+ <c:if test="${!counter.last}">, </c:if>
+ </c:forEach>
+ ];
+
+ var plot1 = $.jqplot ('sales', [sales], {
+ title:'Facturation par projet',
+ seriesDefaults:{
+ renderer:$.jqplot.PieRenderer,
+ rendererOptions: {
+ showDataLabels: true,
+ dataLabels: 'value',
+ sliceMargin: 3
+ }
+ },
+ cursor: {
+ show: false
+ },
+ legend: {show:true, location: 'e'}
+ });
+
+ });
+ </script>
+
+ <h2>Facturation par projet</h2>
+
+ <form action="billingPerProject" method="get">
+ <select name="from">
+ <c:forEach var="entry" items="${allYears}" varStatus="counter">
+ <option value="${entry}" <c:if test="${entry==fromYear}">selected</c:if>>${entry}</option>
+ </c:forEach>
+ </select>
+ <select name="to">
+ <c:forEach var="entry" items="${allYears}" varStatus="counter">
+ <option value="${entry}" ${entry == toYear ? 'selected' : ''} >${entry}</option>
+ </c:forEach>
+ </select>
+ <input type="submit" value="Rechercher">
+ </form>
+
+ <div id="sales" style="height:200px;"></div>
+
+
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Projet</th>
+ <th>Facturation</th>
+ <th>Factures</th>
+ <th>€/factures</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach var="project" items="${data}">
+ <tr>
+ <td>${project.key.name}</td>
+ <td>${project.value.sales}</td>
+ <td>${project.value.quotations}</td>
+ <td>${project.value.mean} €</td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+
+ </div>
+</div>
+
+<div style="clear:both;"/>
\ No newline at end of file
Copied: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingReport.jsp (from rev 435, trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesReport.jsp)
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingReport.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/billingReport.jsp 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,124 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
+<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
+
+<div class="row-fluid">
+ <div class="span2">
+ <jsp:include page="/billingMenu"/>
+ </div>
+
+ <div class="span10">
+ <!-- Javascript to display graph -->
+ <script type="text/javascript">
+ $(document).ready(function(){
+ var sales = [
+ <c:forEach var="entry" items="${data}" varStatus="counter">
+ [
+ <c:forEach var="entry2" items="${entry.value.plotValues}" varStatus="counter2">
+ ['${entry2.key}', ${entry2.value}]
+ <c:if test="${!counter2.last}">, </c:if>
+ </c:forEach>
+ ]
+ <c:if test="${!counter.last}">, </c:if>
+ </c:forEach>
+ ];
+
+ var plot1 = $.jqplot ('sales', sales, {
+ title:'Facturation par mois',
+ seriesDefaults:{
+ renderer:$.jqplot.BarRenderer,
+ rendererOptions: {fillToZero: true}
+ },
+ axes:{
+ xaxis:{
+ pad: 0,
+ tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
+ tickOptions: {
+ angle: -30,
+ fontSize: '10pt'
+ },
+ renderer: $.jqplot.CategoryAxisRenderer
+ },
+ },
+ highlighter: {
+ show: true,
+ tooltipAxes: 'y'
+ },
+ cursor: {
+ show: false
+ },
+ series:[
+ <c:forEach var="entry" items="${data}" varStatus="counter">
+ {label:${entry.key}}<c:if test="${!counter.last}">,</c:if>
+ </c:forEach>],
+ legend: {show:true, location: 'e', placement: 'outsideGrid' }
+ });
+
+ });
+ </script>
+
+ <h2>Facturation</h2>
+
+ <form action="billing" method="get">
+ <select name="from">
+ <c:forEach var="entry" items="${allYears}" varStatus="counter">
+ <option value="${entry}" <c:if test="${entry==fromYear}">selected</c:if>>${entry}</option>
+ </c:forEach>
+ </select>
+ <select name="to">
+ <c:forEach var="entry" items="${allYears}" varStatus="counter">
+ <option value="${entry}" ${entry == toYear ? 'selected' : ''} >${entry}</option>
+ </c:forEach>
+ </select>
+ <input type="submit" value="Rechercher">
+ </form>
+
+ <div id="sales" style="height:200px;"></div>
+
+
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Année</th>
+ <th>Facturation</th>
+ <th>Progression</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach var="year" items="${data}">
+ <tr>
+ <td>${year.key}</td>
+ <td class="currency">${year.value.baseValue}</td>
+ <td class="percent">${year.value.progression} %</td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+
+ </div>
+</div>
+
+<div style="clear:both;"/>
\ No newline at end of file
Copied: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/menu.jsp (from rev 436, trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/menu.jsp)
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/menu.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/reports/menu.jsp 2014-10-17 14:54:24 UTC (rev 437)
@@ -0,0 +1,27 @@
+<%--
+ #%L
+ Chorem :: webmotion
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2011 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<ul class="list-group">
+ <li class="list-group-item"><a href="billing"><i class="icon-chevron-right"></i> Facturation</a></li>
+ <li class="list-group-item"><a href="billingPerAccount"><i class="icon-chevron-right"></i> Facturation par client</a></li>
+ <li class="list-group-item"><a href="billingPerProject"><i class="icon-chevron-right"></i> Facturation par projet</a></li>
+</ul>
\ No newline at end of file
1
0
r436 - trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports
by jcouteau@users.chorem.org 17 Oct '14
by jcouteau@users.chorem.org 17 Oct '14
17 Oct '14
Author: jcouteau
Date: 2014-10-17 14:55:29 +0200 (Fri, 17 Oct 2014)
New Revision: 436
Url: http://forge.chorem.org/projects/chorem/repository/revisions/436
Log:
Finish sales reports :
- sales per project
- sales per account
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/menu.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerAccountReport.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerProjectReport.jsp
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/menu.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/menu.jsp 2014-08-13 09:03:36 UTC (rev 435)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/menu.jsp 2014-10-17 12:55:29 UTC (rev 436)
@@ -22,7 +22,7 @@
--%>
<ul class="list-group">
<li class="list-group-item"><a href="sales"><i class="icon-chevron-right"></i> Ventes</a></li>
- <li class="list-group-item"><a href="#"><i class="icon-chevron-right"></i> Ventes par client</a></li>
+ <li class="list-group-item"><a href="salesPerAccount"><i class="icon-chevron-right"></i> Ventes par client</a></li>
<li class="list-group-item"><a href="salesPerProject"><i class="icon-chevron-right"></i> Ventes par projet</a></li>
<li class="list-group-item"><a href="sentQuotation"><i class="icon-chevron-right"></i> Devis envoy�s</a></li>
<li class="list-group-item"><a href="acceptedQuotation"><i class="icon-chevron-right"></i> Devis accept�s</a></li>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerAccountReport.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerAccountReport.jsp 2014-08-13 09:03:36 UTC (rev 435)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerAccountReport.jsp 2014-10-17 12:55:29 UTC (rev 436)
@@ -62,7 +62,7 @@
<h2>Ventes</h2>
- <form action="sales" method="get">
+ <form action="salesPerAccount" method="get">
<select name="from">
<c:forEach var="entry" items="${allYears}" varStatus="counter">
<option value="${entry}" <c:if test="${entry==fromYear}">selected</c:if>>${entry}</option>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerProjectReport.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerProjectReport.jsp 2014-08-13 09:03:36 UTC (rev 435)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesPerProjectReport.jsp 2014-10-17 12:55:29 UTC (rev 436)
@@ -62,7 +62,7 @@
<h2>Ventes</h2>
- <form action="sales" method="get">
+ <form action="salesPerProject" method="get">
<select name="from">
<c:forEach var="entry" items="${allYears}" varStatus="counter">
<option value="${entry}" <c:if test="${entry==fromYear}">selected</c:if>>${entry}</option>
1
0