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
- 542 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
r435 - in trunk: . chorem-webmotion/src/main/webapp/WEB-INF/jsp chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial chorem-webmotion/src/main/webapp/WEB-INF/jsp/projects
by ymartel@users.chorem.org 13 Aug '14
by ymartel@users.chorem.org 13 Aug '14
13 Aug '14
Author: ymartel
Date: 2014-08-13 11:03:36 +0200 (Wed, 13 Aug 2014)
New Revision: 435
Url: http://forge.chorem.org/projects/chorem/repository/revisions/435
Log:
fix boostrap css, upgrade nuitonJsWro version
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/projects/projects.jsp
trunk/pom.xml
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2014-08-12 15:17:05 UTC (rev 434)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2014-08-13 09:03:36 UTC (rev 435)
@@ -43,6 +43,7 @@
<link href="<c:url value='/css/chorem-bi.css'/>" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/css/ng-grid.min.css'/>" rel="stylesheet" type="text/css"/>
<link href="<c:url value='/css/select2/select2.css'/>" rel="stylesheet" type="text/css"/>
+ <link href="<c:url value='/nuiton-js/bootstrap.css'/>" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var webContext = "<c:url value='/'/>";
@@ -179,6 +180,9 @@
<a href="<c:url value="/wikitty/Category/search"/>"><span class="glyphicon glyphicon-th-list"></span>Categories</a>
<a href="<c:url value="/wikitty/Category/edit/new"/>"><span class="glyphicon glyphicon-plus"></span></a>
</li>
+ <li>
+ <a href="<c:url value="/financial/expenseAccounts"/>"><span class="glyphicon glyphicon-th-list"></span></a>
+ </li>
<li class="divider"></li>
<li>Report</li>
<li><a href="<c:url value="/report?report=vat"/>">TVA mensuel</a></li>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp 2014-08-12 15:17:05 UTC (rev 434)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp 2014-08-13 09:03:36 UTC (rev 435)
@@ -25,10 +25,10 @@
<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
<head>
+ <link data-require="ng-table@*" data-semver="0.3.0" rel="stylesheet" href="<c:url value='http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.css'/>" />
+
<script data-require="angular-resource(a)1.2.0-rc.3" data-semver="1.2.0-rc.3" src="<c:url value='http://code.angularjs.org/1.2.0-rc.3/angular-resource.js'/>"></script>
<script data-require="ng-table@*" data-semver="0.3.0" src="<c:url value='http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.js'/>"></script>
- <link data-require="ng-table@*" data-semver="0.3.0" rel="stylesheet" href="<c:url value='http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.css'/>" />
- <link data-require="bootstrap-css@*" data-semver="3.0.0" rel="stylesheet" href="<c:url value='http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css'/>" />
<script type="text/javascript" src="<c:url value='/js/paginationTable.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/financial/expenseAccountListCtrl.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/angular-ui-bootstrap-tpls-0.11.0.js'/>"></script>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/projects/projects.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/projects/projects.jsp 2014-08-12 15:17:05 UTC (rev 434)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/projects/projects.jsp 2014-08-13 09:03:36 UTC (rev 435)
@@ -29,7 +29,6 @@
<script data-require="angular-resource(a)1.2.0-rc.3" data-semver="1.2.0-rc.3" src="<c:url value='http://code.angularjs.org/1.2.0-rc.3/angular-resource.js'/>"></script>
<script data-require="ng-table@*" data-semver="0.3.0" src="<c:url value='http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.js'/>"></script>
<link data-require="ng-table@*" data-semver="0.3.0" rel="stylesheet" href="<c:url value='http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.css'/>" />
- <link data-require="bootstrap-css@*" data-semver="3.0.0" rel="stylesheet" href="<c:url value='http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css'/>" />
<script type="text/javascript" src="<c:url value='/js/projectPagination.js'/>"></script>
<script>
angular.module('Pagination').value('paginationInit', {
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-08-12 15:17:05 UTC (rev 434)
+++ trunk/pom.xml 2014-08-13 09:03:36 UTC (rev 435)
@@ -104,7 +104,7 @@
<nuitonWebVersion>1.16</nuitonWebVersion>
<wikittyVersion>3.11-SNAPSHOT</wikittyVersion>
- <nuitonjsWro.version>1.0.2</nuitonjsWro.version>
+ <nuitonjsWro.version>1.0.3</nuitonjsWro.version>
<nuitonjsAngularjs.version>1.2.12-1</nuitonjsAngularjs.version>
<nuitonjsJquery.version>2.1.1-1</nuitonjsJquery.version>
<nuitonjsJqueryui.version>1.10.4-1</nuitonjsJqueryui.version>
1
0
r434 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/financial webapp/WEB-INF/jsp/financial webapp/js/financial
by ymartel@users.chorem.org 12 Aug '14
by ymartel@users.chorem.org 12 Aug '14
12 Aug '14
Author: ymartel
Date: 2014-08-12 17:17:05 +0200 (Tue, 12 Aug 2014)
New Revision: 434
Url: http://forge.chorem.org/projects/chorem/repository/revisions/434
Log:
review list page of ExpenseAccounts, use a filter on dates
Added:
trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccountListCtrl.js
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-12 08:11:13 UTC (rev 433)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-12 15:17:05 UTC (rev 434)
@@ -50,7 +50,6 @@
import org.chorem.webmotion.bean.financial.ExpenseAccountEntryBean;
import org.debux.webmotion.server.WebMotionController;
import org.debux.webmotion.server.render.Render;
-import org.nuiton.util.DateUtil;
import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
@@ -72,53 +71,48 @@
* </ul>
*
* @param client
- * @param year
- * @param month
+ * @param startTime
+ * @param endTime
* @param page
* @param count
* @return
*/
- public PaginatedResult<ExpenseAccountBean> findAllExpenseAccounts(ChoremClient client, Integer year, Integer month, int page, int count) {
+ public PaginatedResult<ExpenseAccountBean> findAllExpenseAccounts(ChoremClient client, Long startTime, Long endTime, int page, int count) {
- Date refStartDate;
- Date refEndDate;
+ WikittyQueryMaker totalQueryMaker = new WikittyQueryMaker()
+ .select().count(ExpenseAccount.ELEMENT_FIELD_INTERVAL_BEGINDATE).where().and()
+ .exteq(ExpenseAccount.EXT_EXPENSEACCOUNT);
- if (month == null && year != null) {
- // only year is given : search for all year
- refStartDate = DateUtil.createDate(1, 1, year);
- refEndDate = DateUtil.createDate(31, 12, year);
-
- } else if (month == null && year == null) {
- // no month, no year, give current month ?
- Date today = new Date();
- refStartDate = DateUtil.setFirstDayOfMonth(today);
- refEndDate = DateUtil.setLastDayOfMonth(today);
-
- } else {
- // we have a month and a year : just search ones corresponding to this month
- refStartDate = DateUtil.createDate(1, month, year);
- refEndDate = DateUtil.setLastDayOfMonth(refStartDate);
-
+ if (endTime != null) {
+ Date refEndDate = new Date(endTime);
+ totalQueryMaker.le(ExpenseAccount.ELEMENT_FIELD_INTERVAL_BEGINDATE, refEndDate);
}
+ if (startTime != null) {
+ Date refStartDate = new Date(startTime);
+ totalQueryMaker.ge(ExpenseAccount.ELEMENT_FIELD_INTERVAL_ENDDATE, refStartDate);
+ }
- WikittyQuery totalQuery = new WikittyQueryMaker()
- .select().count(ExpenseAccount.ELEMENT_FIELD_INTERVAL_BEGINDATE).where().and()
- .exteq(ExpenseAccount.EXT_EXPENSEACCOUNT)
- .le(ExpenseAccount.ELEMENT_FIELD_INTERVAL_BEGINDATE, refEndDate)
- .ge(ExpenseAccount.ELEMENT_FIELD_INTERVAL_ENDDATE, refStartDate)
- .end();
+ WikittyQuery totalQuery = totalQueryMaker.end();
Integer nbExpenseAccounts = client.findByQuery(Integer.class, totalQuery);
PaginatedResult<ExpenseAccountBean> paginatedResult;
if (nbExpenseAccounts > 0) {
- WikittyQuery expAccountsQuery = new WikittyQueryMaker()
+ WikittyQueryMaker listingQueryMaker = new WikittyQueryMaker()
.where().and()
- .exteq(ExpenseAccount.EXT_EXPENSEACCOUNT)
- .le(ExpenseAccount.ELEMENT_FIELD_INTERVAL_BEGINDATE, refEndDate)
- .ge(ExpenseAccount.ELEMENT_FIELD_INTERVAL_ENDDATE, refStartDate)
- .end()
+ .exteq(ExpenseAccount.EXT_EXPENSEACCOUNT);
+
+ if (endTime != null) {
+ Date refEndDate = new Date(endTime);
+ listingQueryMaker.le(ExpenseAccount.ELEMENT_FIELD_INTERVAL_BEGINDATE, refEndDate);
+ }
+ if (startTime != null) {
+ Date refStartDate = new Date(startTime);
+ listingQueryMaker.ge(ExpenseAccount.ELEMENT_FIELD_INTERVAL_ENDDATE, refStartDate);
+ }
+
+ WikittyQuery expAccountsQuery = listingQueryMaker.end()
.setOffset((page - 1) * count)
.setLimit(page * count);
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html 2014-08-12 08:11:13 UTC (rev 433)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html 2014-08-12 15:17:05 UTC (rev 434)
@@ -21,7 +21,7 @@
<td><input type="text" ng-model="newExpenseAccountEntry.justificationNumber" name="newExpenseAccountEntry.justificationNumber" size="10" style='width:100%'></td>
<td>
- <input class="form-control" type="text" ng-model="newExpenseAccountEntry.emittedDate" datepicker-popup="dd/MM/yyyy" is-open="emittedDateOpened" ng-click="emittedDateOpened = true" size="10" maxlength="10" style='width:90%'>
+ <input class="form-control" type="text" ng-model="newExpenseAccountEntry.emittedDate" datepicker-popup="dd/MM/yyyy" is-open="emittedDateOpened" ng-click="emittedDateOpened = true" size="10" maxlength="10" style='width:90%' />
</td>
<td>
<input type="text" ng-model="newExpenseAccountEntry.projectName" name="newExpenseAccountEntry.project" size="4" style='width:100%' id="text-newExpenseAccountEntry-project" auto-complete data-source="Project" data-model="newExpenseAccountEntry" data-base-field="project">
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp 2014-08-12 08:11:13 UTC (rev 433)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccounts.jsp 2014-08-12 15:17:05 UTC (rev 434)
@@ -30,6 +30,8 @@
<link data-require="ng-table@*" data-semver="0.3.0" rel="stylesheet" href="<c:url value='http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.css'/>" />
<link data-require="bootstrap-css@*" data-semver="3.0.0" rel="stylesheet" href="<c:url value='http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css'/>" />
<script type="text/javascript" src="<c:url value='/js/paginationTable.js'/>"></script>
+ <script type="text/javascript" src="<c:url value='/js/financial/expenseAccountListCtrl.js'/>"></script>
+ <script type="text/javascript" src="<c:url value='/js/angular-ui-bootstrap-tpls-0.11.0.js'/>"></script>
<script>
angular.module('Pagination').value('paginationInit', {
url : "<c:url value="/rest/financial/expenseAccounts"/>",
@@ -38,8 +40,13 @@
</script>
</head>
-<div ng-app="Pagination" ng-controller="PageCtrl">
+<div ng-app="expenseAccountPagination" ng-controller="expenseAccountListCtrl">
+ <div>
+ From <input type="text" ng-model="startTime" datepicker-popup="dd/MM/yyyy" is-open="startDateOpened" ng-click="startDateOpened = true">
+ to <input type="text" ng-model="endTime" datepicker-popup="dd/MM/yyyy" is-open="endDateOpened" ng-click="endDateOpened = true"/>
+ </div>
+
<div loading-container="tableParams.settings().$loading">
<table ng-table="tableParams" show-filter="false" class="table">
<tbody ng-repeat="expenseAccount in elements">
Added: trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccountListCtrl.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccountListCtrl.js (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccountListCtrl.js 2014-08-12 15:17:05 UTC (rev 434)
@@ -0,0 +1,60 @@
+/*
+ * #%L
+ * Chorem :: webmotion
+ * %%
+ * 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%
+ */
+var app = angular.module('expenseAccountPagination', ['ngResource', 'ui.bootstrap', 'Pagination']);
+
+app.controller("expenseAccountListCtrl", function($scope, $resource, $timeout, $controller, ngTableParams, paginationInit) {
+
+ var date = new Date();
+ var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
+ var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
+ $scope.startTime = paginationInit.params.startTime = firstDay.getTime();
+ $scope.endTime = paginationInit.params.endTime = lastDay.getTime();
+
+ $controller("PageCtrl", {$scope : $scope, paginationInit : paginationInit, ngTableParams : ngTableParams});
+
+ console.log($scope.tableParams);
+
+ $scope.load = function() {
+
+ if ($scope.tableParams.$params.startTime instanceof Date) {
+ $scope.tableParams.$params.startTime = $scope.tableParams.$params.startTime.getTime();
+ }
+
+ if ($scope.tableParams.$params.endTime instanceof Date) {
+ $scope.tableParams.$params.endTime = $scope.tableParams.$params.endTime.getTime();
+ }
+ $scope.tableParams.reload();
+ }
+
+ $scope.$watch("startTime", function () {
+ if ($scope.startTime instanceof Date) {
+ $scope.tableParams.$params.startTime = $scope.startTime.getTime();
+ }
+ $scope.tableParams.reload();
+ });
+
+ $scope.$watch("endTime", function () {
+ if ($scope.endTime instanceof Date) {
+ $scope.tableParams.$params.endTime = $scope.endTime.getTime();
+ }
+ $scope.tableParams.reload();
+ });
+});
\ No newline at end of file
1
0
r433 - in trunk/chorem-webmotion/src/main/java/org/chorem/webmotion: actions/financial bean/financial
by ymartel@users.chorem.org 12 Aug '14
by ymartel@users.chorem.org 12 Aug '14
12 Aug '14
Author: ymartel
Date: 2014-08-12 10:11:13 +0200 (Tue, 12 Aug 2014)
New Revision: 433
Url: http://forge.chorem.org/projects/chorem/repository/revisions/433
Log:
fix some NPE with new ExpenseAccount
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountBean.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-11 12:13:23 UTC (rev 432)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-12 08:11:13 UTC (rev 433)
@@ -27,6 +27,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -150,7 +151,14 @@
expenseAccountWikitty.setBeginDate(new Date(expenseAccountBean.getStartDate()));
expenseAccountWikitty.setEndDate(new Date(expenseAccountBean.getEndDate()));
- Set<String> missingAccountEntryIds = Sets.newHashSet(expenseAccountWikitty.getExpenseAccountEntry());
+ Set<String> existingExpenseEntryIds = expenseAccountWikitty.getExpenseAccountEntry();
+ Set<String> missingAccountEntryIds;
+ if (existingExpenseEntryIds != null) {
+ missingAccountEntryIds = Sets.newHashSet(existingExpenseEntryIds);
+ } else {
+ missingAccountEntryIds = new HashSet<>();
+ }
+
expenseAccountWikitty.clearExpenseAccountEntry();
//manage each Expense Account Entry : try to find them or create new one
@@ -201,8 +209,6 @@
public Render findExpenseAccount(ChoremClient client, String expenseAccountId) {
ExpenseAccount expenseAccount = client.restore(ExpenseAccount.class, expenseAccountId);
- Set<String> expenseAccountEntryIds = expenseAccount.getExpenseAccountEntry();
- Set<ExpenseAccountEntry> expenseAccountEntries = client.restore(ExpenseAccountEntry.class, expenseAccountEntryIds);
if (expenseAccount == null) {
expenseAccount = new ExpenseAccountImpl();
@@ -226,10 +232,14 @@
expenseAccountBean.setEndDate(expenseAccount.getEndDate());
expenseAccountBean.setEndDate(expenseAccount.getEndDate());
Set<ExpenseAccountEntry> expenseAccountEntries = expenseAccount.getExpenseAccountEntry(false);
- for (ExpenseAccountEntry expenseAccountEntry : expenseAccountEntries) {
- if (expenseAccountEntry != null) {
- ExpenseAccountEntryBean expenseAccountEntryBean = TRANSFORM_EXPENSE_ACCOUNT_ENTRY_TO_BEAN.apply(expenseAccountEntry);
- expenseAccountBean.addExpenseAccountEntry(expenseAccountEntryBean);
+ if (expenseAccountEntries == null) {
+ expenseAccountBean.setExpenseAccountEntries(new HashSet<ExpenseAccountEntryBean>());
+ } else {
+ for (ExpenseAccountEntry expenseAccountEntry : expenseAccountEntries) {
+ if (expenseAccountEntry != null) {
+ ExpenseAccountEntryBean expenseAccountEntryBean = TRANSFORM_EXPENSE_ACCOUNT_ENTRY_TO_BEAN.apply(expenseAccountEntry);
+ expenseAccountBean.addExpenseAccountEntry(expenseAccountEntryBean);
+ }
}
}
return expenseAccountBean;
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountBean.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountBean.java 2014-08-11 12:13:23 UTC (rev 432)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountBean.java 2014-08-12 08:11:13 UTC (rev 433)
@@ -75,7 +75,9 @@
}
public void setStartDate(Date startDate) {
- this.startDate = startDate.getTime();
+ if (startDate != null) {
+ this.startDate = startDate.getTime();
+ }
}
public long getEndDate() {
@@ -87,7 +89,9 @@
}
public void setEndDate(Date endDate) {
- this.endDate = endDate.getTime();
+ if (endDate != null) {
+ this.endDate = endDate.getTime();
+ }
}
public Set<ExpenseAccountEntryBean> getExpenseAccountEntries() {
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java 2014-08-11 12:13:23 UTC (rev 432)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java 2014-08-12 08:11:13 UTC (rev 433)
@@ -77,7 +77,9 @@
}
public void setEmittedDate(Date emittedDate) {
- this.emittedDate = emittedDate.getTime();
+ if (emittedDate != null) {
+ this.emittedDate = emittedDate.getTime();
+ }
}
public long getPaymentDate() {
@@ -89,7 +91,9 @@
}
public void setPaymentDate(Date paymentDate) {
- this.paymentDate = paymentDate.getTime();
+ if (paymentDate != null) {
+ this.paymentDate = paymentDate.getTime();
+ }
}
public String getDescription() {
1
0
r432 - in trunk: . chorem-entities chorem-webmotion chorem-webmotion/src/main/java/org/chorem/webmotion/converters chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial chorem-webmotion/src/main/webapp/js chorem-webmotion/src/main/webapp/js/financial chorem-webmotion/src/test/java/org/chorem/webmotion/converters
by ymartel@users.chorem.org 11 Aug '14
by ymartel@users.chorem.org 11 Aug '14
11 Aug '14
Author: ymartel
Date: 2014-08-11 14:13:23 +0200 (Mon, 11 Aug 2014)
New Revision: 432
Url: http://forge.chorem.org/projects/chorem/repository/revisions/432
Log:
Clean dependencies
Add some license headers
Modified:
trunk/chorem-entities/LICENSE.txt
trunk/chorem-webmotion/LICENSE.txt
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonConverter.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonHelper.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html
trunk/chorem-webmotion/src/main/webapp/js/angular-ui-bootstrap-tpls-0.11.0.js
trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js
trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java
trunk/pom.xml
Modified: trunk/chorem-entities/LICENSE.txt
===================================================================
--- trunk/chorem-entities/LICENSE.txt 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-entities/LICENSE.txt 2014-08-11 12:13:23 UTC (rev 432)
@@ -658,4 +658,4 @@
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
-<http://www.gnu.org/licenses/>.
\ No newline at end of file
+<http://www.gnu.org/licenses/>.
Modified: trunk/chorem-webmotion/LICENSE.txt
===================================================================
--- trunk/chorem-webmotion/LICENSE.txt 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/LICENSE.txt 2014-08-11 12:13:23 UTC (rev 432)
@@ -658,4 +658,4 @@
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
-<http://www.gnu.org/licenses/>.
\ No newline at end of file
+<http://www.gnu.org/licenses/>.
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonConverter.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonConverter.java 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonConverter.java 2014-08-11 12:13:23 UTC (rev 432)
@@ -1,5 +1,26 @@
package org.chorem.webmotion.converters;
+/*
+ * #%L
+ * Chorem :: webmotion
+ * %%
+ * 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.beanutils.converters.AbstractConverter;
/**
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonHelper.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonHelper.java 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/converters/JsonHelper.java 2014-08-11 12:13:23 UTC (rev 432)
@@ -1,5 +1,26 @@
package org.chorem.webmotion.converters;
+/*
+ * #%L
+ * Chorem :: webmotion
+ * %%
+ * 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 java.lang.reflect.Type;
import java.util.Date;
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountEntryEdit.html 2014-08-11 12:13:23 UTC (rev 432)
@@ -1,3 +1,23 @@
+<!--
+ #%L
+ Chorem :: webmotion
+ %%
+ 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%
+ -->
<td><input type="text" ng-model="newExpenseAccountEntry.justificationNumber" name="newExpenseAccountEntry.justificationNumber" size="10" style='width:100%'></td>
<td>
Modified: trunk/chorem-webmotion/src/main/webapp/js/angular-ui-bootstrap-tpls-0.11.0.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/angular-ui-bootstrap-tpls-0.11.0.js 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/src/main/webapp/js/angular-ui-bootstrap-tpls-0.11.0.js 2014-08-11 12:13:23 UTC (rev 432)
@@ -1,4 +1,24 @@
/*
+ * #%L
+ * Chorem :: webmotion
+ * %%
+ * 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%
+ */
+/*
* angular-ui-bootstrap
* http://angular-ui.github.io/bootstrap/
Modified: trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js 2014-08-11 12:13:23 UTC (rev 432)
@@ -1,3 +1,23 @@
+/*
+ * #%L
+ * Chorem :: webmotion
+ * %%
+ * 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%
+ */
var app = angular.module('expenseAccountPage', ['ngResource', 'ui.bootstrap']);
app.controller("expenseAccountView", function($scope, $resource, $modal, $log, expenseAccountInit) {
Modified: trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java
===================================================================
--- trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java 2014-08-11 12:13:23 UTC (rev 432)
@@ -1,5 +1,26 @@
package org.chorem.webmotion.converters;
+/*
+ * #%L
+ * Chorem :: webmotion
+ * %%
+ * 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 java.util.Date;
import java.util.Set;
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-08-11 08:07:53 UTC (rev 431)
+++ trunk/pom.xml 2014-08-11 12:13:23 UTC (rev 432)
@@ -258,31 +258,37 @@
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-wro</artifactId>
<version>${nuitonjsWro.version}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-angularjs</artifactId>
<version>${nuitonjsAngularjs.version}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jquery</artifactId>
<version>${nuitonjsJquery.version}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jquery-ui</artifactId>
<version>${nuitonjsJqueryui.version}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jqplot</artifactId>
<version>${nuitonjsJqplot.version}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-bootstrap</artifactId>
<version>${nuitonjsBootstrap.version}</version>
+ <scope>runtime</scope>
</dependency>
<!-- <dependency>
<groupId>org.nuiton.js</groupId>
1
0
Author: ymartel
Date: 2014-08-11 10:07:53 +0200 (Mon, 11 Aug 2014)
New Revision: 431
Url: http://forge.chorem.org/projects/chorem/repository/revisions/431
Log:
review third party licenses
Modified:
trunk/chorem-webmotion/src/license/THIRD-PARTY.properties
Modified: trunk/chorem-webmotion/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/chorem-webmotion/src/license/THIRD-PARTY.properties 2014-08-08 15:53:20 UTC (rev 430)
+++ trunk/chorem-webmotion/src/license/THIRD-PARTY.properties 2014-08-11 08:07:53 UTC (rev 431)
@@ -1,39 +1,52 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
-# - Apache License
-# - Apache Software License, Version 2.0
+# - Apache 2
+# - Apache License 2.0
+# - Apache License, Version 2.0
+# - Apache Software License - Version 2.0
# - Apache Software License, version 1.1
+# - BSD
# - BSD License
# - BSD licence
# - BSD style
# - Bouncy Castle Licence
-# - CDDL
+# - CDDL + GPLv2 with classpath exception
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE, Version 1.0
# - Common Public License Version 1.0
+# - Eclipse Public License - Version 1.0
# - GNU Affero General Public License version 3
# - GNU Lesser General Public License, version 2.1
-# - GPLv2+CE
+# - GNU Library or Lesser General Public License
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - LGPL
+# - LGPL 2.1
# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
-# - Lesser General Public License (LPGL) v 2.1
# - MIT License
+# - MIT license
+# - MPL 1.1
+# - MPL 2.0, and EPL 1.0
+# - New BSD License
# - Public Domain
# - Public domain
# - TECHNOLOGY LICENSE FROM SUN MICROSYSTEMS, INC.
# - The Apache Software License, Version 2.0
-# - The H2 License, Version 1.0
+# - WTFPL
+# - lgpl
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Mon Jun 25 09:40:00 CEST 2012
+#Mon Aug 11 09:28:15 CEST 2014
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
concurrent--concurrent--1.0=TECHNOLOGY LICENSE FROM SUN MICROSYSTEMS, INC.
-jakarta-regexp--jakarta-regexp--1.4=The Apache Software License, Version 2.0
+dom4j--dom4j--1.6.1=BSD style license
javax.servlet--jsp-api--2.0=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
javax.servlet--jstl--1.2=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE, Version 1.0
-javax.servlet--servlet-api--2.5=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
javax.transaction--jta--1.1=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
org.antlr--antlr-runtime--3.3=BSD License
+org.apache.zookeeper--zookeeper--3.4.5=The Apache Software License, Version 2.0
+org.jacorb--jacorb--2.3.1.jbossorg-1=Lesser General Public License (LPGL)
+xpp3--xpp3_min--1.1.3.4.O=Indiana University Extreme\! Lab Software License, vesion 1.1.1
1
0
r430 - in trunk/chorem-webmotion/src/main/webapp: WEB-INF/jsp/financial js/financial
by ymartel@users.chorem.org 08 Aug '14
by ymartel@users.chorem.org 08 Aug '14
08 Aug '14
Author: ymartel
Date: 2014-08-08 17:53:20 +0200 (Fri, 08 Aug 2014)
New Revision: 430
Url: http://forge.chorem.org/projects/chorem/repository/revisions/430
Log:
can remove an entry in an ExpenseAccount
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp
trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp 2014-08-08 08:10:43 UTC (rev 429)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp 2014-08-08 15:53:20 UTC (rev 430)
@@ -68,42 +68,43 @@
</dd>
</dd>
- </dl>
- </div>
+ </dl>
+ </div>
- <div>
- <table>
- <tr>
- <th style='width:15%'>Justif. Nb</th>
- <th style='width:15%'>Emitted Date</th>
- <th style='width:10%'>Project</th>
- <th style='width:15%'>Description</th>
- <th style='width:15%'>Category</th>
- <th style='width:7%'>Amount</th>
- <th style='width:7%'>VAT</th>
- <th style='width:6%'>total</th>
- <th style='width:10%'>Payment Date</th>
- </tr>
- <tr ng-repeat="expenseEntry in expenseAccount.expenseAccountEntries">
- <td>{{expenseEntry.justificationNumber}}</td>
- <td>{{expenseEntry.emittedDate| date : "dd/MM/yyyy"}}</td>
- <td><a href="<c:url value="/wikitty/view/{{expenseEntry.projectId}}"/>">{{expenseEntry.projectName}}</a></td>
- <td>{{expenseEntry.description}}</td>
- <td>{{expenseEntry.categoryName}}</td>
- <td>{{expenseEntry.amount|number:2}}</td>
- <td>{{expenseEntry.VAT|number:2}}</td>
- <td>{{expenseEntry.total|number:2}}</td>
- <td><span ng-if = "expenseEntry.paymentDate"> {{expenseEntry.paymentDate|date : "dd/MM/yyyy"}}</span></td>
- </tr>
- <tr ng-if="showNewLine == true" ng-include src="'expenseAccountEntryEdit.html'"></tr>
- </table>
- </div>
- <a class="btn btn-success" ng-click="newLine()" ng-show="!showNewLine"><i class="icon-list icon-white"></i> New entry</a>
- <a class="btn btn-danger" ng-click="newLine()" ng-show="showNewLine"><i class="icon-list icon-white"></i> Cancel</a>
- <div ng-show="hasChanged">
- <a class="btn btn-success" ng-click="saveExpenseAccount()"><i class="icon-od icon-white"></i>Save</a>
- </div>
+ <div>
+ <table>
+ <tr>
+ <th style='width:15%'>Justif. Nb</th>
+ <th style='width:10%'>Emitted Date</th>
+ <th style='width:10%'>Project</th>
+ <th style='width:15%'>Description</th>
+ <th style='width:15%'>Category</th>
+ <th style='width:7%'>Amount</th>
+ <th style='width:7%'>VAT</th>
+ <th style='width:6%'>total</th>
+ <th style='width:10%'>Payment Date</th>
+ <th style='width:5%'></th>
+ </tr>
+ <tr ng-repeat="expenseEntry in expenseAccount.expenseAccountEntries" id="tr-entry-{{expenseEntry.id}}">
+ <td id="expenseEntry-justif-{{expenseEntry.id}}">{{expenseEntry.justificationNumber}}</td>
+ <td id="expenseEntry-emittedDate-{{expenseEntry.id}}">{{expenseEntry.emittedDate| date : "dd/MM/yyyy"}}</td>
+ <td id="expenseEntry-project-{{expenseEntry.id}}"><a href="<c:url value="/wikitty/view/{{expenseEntry.projectId}}"/>">{{expenseEntry.projectName}}</a></td>
+ <td id="expenseEntry-description-{{expenseEntry.id}}">{{expenseEntry.description}}</td>
+ <td id="expenseEntry-category-{{expenseEntry.id}}">{{expenseEntry.categoryName}}</td>
+ <td id="expenseEntry-amount-{{expenseEntry.id}}">{{expenseEntry.amount|number:2}}</td>
+ <td id="expenseEntry-vat-{{expenseEntry.id}}">{{expenseEntry.VAT|number:2}}</td>
+ <td id="expenseEntry-total-{{expenseEntry.id}}">{{expenseEntry.total|number:2}}</td>
+ <td id="expenseEntry-paymentDate-{{expenseEntry.id}}"><span ng-if = "expenseEntry.paymentDate"> {{expenseEntry.paymentDate|date : "dd/MM/yyyy"}}</span></td>
+ <td id="expenseEntry-edit-{{expenseEntry.id}}"><span class="glyphicon glyphicon-remove" ng-click="deleteLine(expenseEntry)"></span></td>
+ </tr>
+ <tr ng-if="showNewLine == true" ng-include src="'expenseAccountEntryEdit.html'"></tr>
+ </table>
+ </div>
-</div>
+ <div>
+ <a class="btn btn-success" ng-click="newLine()" ng-show="!showNewLine"><i class="icon-list icon-white"></i>New entry</a>
+ <a class="btn btn-danger" ng-click="newLine()" ng-show="showNewLine"><i class="icon-list icon-white"></i>Cancel</a>
+ <a class="btn btn-success" ng-click="saveExpenseAccount()" ng-show="hasChanged"><i class="icon-od icon-white"></i>Save</a>
+ </div>
</div>
Modified: trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js 2014-08-08 08:10:43 UTC (rev 429)
+++ trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js 2014-08-08 15:53:20 UTC (rev 430)
@@ -28,6 +28,17 @@
}
}
+ $scope.deleteLine = function(expenseAccountEntry) {
+ if (expenseAccountEntry) {
+ var toDelete = $scope.expenseAccount.expenseAccountEntries.indexOf(expenseAccountEntry);
+ if (toDelete != -1) {
+ $scope.expenseAccount.expenseAccountEntries.splice(toDelete, 1);
+ $scope.hasChanged = true;
+ }
+ }
+ console.log($scope.expenseAccount);
+ }
+
$scope.ac_options = {
baseURL : $scope.baseURL,
};
1
0
r429 - in trunk/chorem-webmotion/src/main/webapp: WEB-INF/jsp/financial js/financial
by ymartel@users.chorem.org 08 Aug '14
by ymartel@users.chorem.org 08 Aug '14
08 Aug '14
Author: ymartel
Date: 2014-08-08 10:10:43 +0200 (Fri, 08 Aug 2014)
New Revision: 429
Url: http://forge.chorem.org/projects/chorem/repository/revisions/429
Log:
Manage edition of Employee & Period start/end date in ExpenseAccount View
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp
trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp 2014-08-07 12:04:36 UTC (rev 428)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial/expenseAccountView.jsp 2014-08-08 08:10:43 UTC (rev 429)
@@ -39,27 +39,33 @@
<div ng-app='expenseAccountPage' ng-controller="expenseAccountView">
<div >
<dl>
- <dd ng-if="expenseAccount && expenseAccount.employeeId"><a href="<c:url value="/wikitty/view/{{expenseAccount.employeeId}}"/>">{{expenseAccount.employeeName}}</a></dd>
- <dd ng-if="!expenseAccount || !expenseAccount.employeeId">
+ <dd ng-show="editEmployee">
<input type="text" ng-model="expenseAccount.employeeName" id="text-expenseAccount-employee" auto-complete data-source="Employee" data-model="expenseAccount" data-base-field="employee" />
<input type="hidden" ng-model="expenseAccount.employeeId" id="hidden-expenseAccount-employee"/>
</dd>
- <dd ng-if="editPeriod == false">Period from {{expenseAccount.startDate |date : "dd/MM/yyyy"}} to {{expenseAccount.endDate |date : "dd/MM/yyyy"}}</dd>
- <dd ng-if="editPeriod == true">
- <label for="expenseAccountStartDate">Start Date :</label>
+ <dd ng-show="!editEmployee">
+ <a href="<c:url value="/wikitty/view/{{expenseAccount.employeeId}}"/>">{{expenseAccount.employeeName}}</a>
+ <span class="glyphicon glyphicon-pencil" ng-click="editEmployee = !editEmployee; hasChanged = true"></span>
+ </dd>
+ <dd ng-show="!editPeriod">
+ <span>Period from {{expenseAccount.startDate |date : "dd/MM/yyyy"}} to {{expenseAccount.endDate |date : "dd/MM/yyyy"}}</span>
+ <span class="glyphicon glyphicon-pencil" ng-click="editPeriod = !editPeriod; hasChanged = true"></span>
+ </dd>
+
+ <dd ng-show="editPeriod">
+ <span>From </span>
<input id="expenseAccountBeginDate" class="form-control" type="text"
datepicker-popup="dd/MM/yyyy"
ng-model="expenseAccount.startDate"
is-open="startDateOpened"
- ng-click="startDateOpened = true" />
- </dd>
- <dd ng-if="editPeriod == true">
- <label for="expenseAccountEndDate">EndDate :</label>
+ ng-click="startDateOpened = true"/>
+ <span>To :</span>
<input id="expenseAccountEndDate" class="form-control" type="text"
datepicker-popup="dd/MM/yyyy"
ng-model="expenseAccount.endDate"
is-open="endDateOpened"
ng-click="endDateOpened = true" />
+ </dd>
</dd>
</dl>
@@ -92,8 +98,9 @@
<tr ng-if="showNewLine == true" ng-include src="'expenseAccountEntryEdit.html'"></tr>
</table>
</div>
- <a class="btn btn-success" ng-click="newLine()"><i class="icon-list icon-white"></i> New entry</a>
- <div ng-if="hasChanged == true">
+ <a class="btn btn-success" ng-click="newLine()" ng-show="!showNewLine"><i class="icon-list icon-white"></i> New entry</a>
+ <a class="btn btn-danger" ng-click="newLine()" ng-show="showNewLine"><i class="icon-list icon-white"></i> Cancel</a>
+ <div ng-show="hasChanged">
<a class="btn btn-success" ng-click="saveExpenseAccount()"><i class="icon-od icon-white"></i>Save</a>
</div>
Modified: trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js 2014-08-07 12:04:36 UTC (rev 428)
+++ trunk/chorem-webmotion/src/main/webapp/js/financial/expenseAccount.js 2014-08-08 08:10:43 UTC (rev 429)
@@ -4,30 +4,28 @@
$scope.showNewLine = false;
$scope.expenseAccount = expenseAccountInit.expenseAccount;
- $scope.editPeriod = expenseAccountInit && expenseAccountInit.id ? false : true;
+ $scope.editPeriod = $scope.expenseAccount && $scope.expenseAccount.startDate && $scope.expenseAccount.endDate ? false : true;
+ $scope.editEmployee = $scope.expenseAccount && $scope.expenseAccount.employeeId ? false : true;
- console.log("expenseAccount is");
- console.log(expenseAccountInit);
-
$scope.baseURL = expenseAccountInit.baseURL;
$scope.newLine = function() {
- if ($scope.showNewLine === true) {
- $scope.showNewLine = false;
- delete $scope.newExpenseAccountEntry;
- } else {
- $scope.showNewLine = true;
- $scope.newExpenseAccountEntry = {
- justificationNumber: '',
- emittedDate : '',
- project: '',
- description: '',
- category: '',
- amount: '',
- VAT: '',
- total: ''
+ if ($scope.showNewLine === true) {
+ $scope.showNewLine = false;
+ delete $scope.newExpenseAccountEntry;
+ } else {
+ $scope.showNewLine = true;
+ $scope.newExpenseAccountEntry = {
+ justificationNumber: '',
+ emittedDate : '',
+ project: '',
+ description: '',
+ category: '',
+ amount: '',
+ VAT: '',
+ total: ''
};
- }
+ }
}
$scope.ac_options = {
@@ -36,37 +34,39 @@
$scope.addLine = function() {
- if(!$scope.expenseAccount.expenseAccountEntries) {
- $scope.expenseAccount.expenseAccountEntries = [];
- }
- $scope.newExpenseAccountEntry.total = $scope.newExpenseAccountEntry.amount + $scope.newExpenseAccountEntry.VAT;
+ if(!$scope.expenseAccount.expenseAccountEntries) {
+ $scope.expenseAccount.expenseAccountEntries = [];
+ }
+ $scope.newExpenseAccountEntry.total = $scope.newExpenseAccountEntry.amount + $scope.newExpenseAccountEntry.VAT;
- if (angular.isDate($scope.newExpenseAccountEntry.emittedDate)) {
- $scope.newExpenseAccountEntry.emittedDate = $scope.newExpenseAccountEntry.emittedDate.getTime();
- }
+ if (angular.isDate($scope.newExpenseAccountEntry.emittedDate)) {
+ $scope.newExpenseAccountEntry.emittedDate = $scope.newExpenseAccountEntry.emittedDate.getTime();
+ }
- $scope.expenseAccount.expenseAccountEntries.push($scope.newExpenseAccountEntry);
+ $scope.expenseAccount.expenseAccountEntries.push($scope.newExpenseAccountEntry);
- $scope.hasChanged = true;
- $scope.showNewLine = false;
- delete $scope.newExpenseAccountEntry;
+ $scope.hasChanged = true;
+ $scope.showNewLine = false;
+ delete $scope.newExpenseAccountEntry;
};
$scope.saveExpenseAccount = function() {
- console.log($scope.expenseAccount)
+ console.log($scope.expenseAccount)
- url = $scope.baseURL + "financial/expenseAccounts/" + $scope.expenseAccount.id;
- if (angular.isDate($scope.expenseAccount.startDate)) {
- $scope.expenseAccount.startDate = $scope.expenseAccount.startDate.getTime();
- }
- if (angular.isDate($scope.expenseAccount.endDate)) {
- $scope.expenseAccount.endDate = $scope.expenseAccount.endDate.getTime();
- }
+ url = $scope.baseURL + "financial/expenseAccounts/" + $scope.expenseAccount.id;
+ if (angular.isDate($scope.expenseAccount.startDate)) {
+ $scope.expenseAccount.startDate = $scope.expenseAccount.startDate.getTime();
+ }
+ if (angular.isDate($scope.expenseAccount.endDate)) {
+ $scope.expenseAccount.endDate = $scope.expenseAccount.endDate.getTime();
+ }
- $resource('url', { expenseAccountId : $scope.expenseAccount.id, expenseAccountBean : $scope.expenseAccount }, {'update' : {method:'PUT'}}).update(function(result) {
- console.log("saved!");
- });
+ $resource('url', { expenseAccountId : $scope.expenseAccount.id, expenseAccountBean : $scope.expenseAccount }, {'update' : {method:'PUT'}}).update(function(result) {
+ $scope.hasChanged = false;
+ $scope.editPeriod = $scope.expenseAccount && $scope.expenseAccount.startDate && $scope.expenseAccount.endDate ? false : true;
+ $scope.editEmployee = $scope.expenseAccount && $scope.expenseAccount.employeeId ? false : true;
+ });
};
});
1
0
r428 - in trunk/chorem-webmotion/src: main/java/org/chorem/webmotion/actions/financial main/java/org/chorem/webmotion/bean/financial test/java/org/chorem/webmotion/converters
by ymartel@users.chorem.org 07 Aug '14
by ymartel@users.chorem.org 07 Aug '14
07 Aug '14
Author: ymartel
Date: 2014-08-07 14:04:36 +0200 (Thu, 07 Aug 2014)
New Revision: 428
Url: http://forge.chorem.org/projects/chorem/repository/revisions/428
Log:
use timestamp in ExpenseAccountEntryBean \& fix error with update
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java
trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-06 16:34:52 UTC (rev 427)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-07 12:04:36 UTC (rev 428)
@@ -33,6 +33,7 @@
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
import org.chorem.ChoremClient;
import org.chorem.entities.Category;
@@ -41,6 +42,7 @@
import org.chorem.entities.ExpenseAccountEntry;
import org.chorem.entities.ExpenseAccountEntryImpl;
import org.chorem.entities.ExpenseAccountImpl;
+import org.chorem.entities.Project;
import org.chorem.entities.Quotation;
import org.chorem.webmotion.PaginatedResult;
import org.chorem.webmotion.bean.financial.ExpenseAccountBean;
@@ -148,7 +150,7 @@
expenseAccountWikitty.setBeginDate(new Date(expenseAccountBean.getStartDate()));
expenseAccountWikitty.setEndDate(new Date(expenseAccountBean.getEndDate()));
- Set<String> missingAccountEntryIds = expenseAccountWikitty.getExpenseAccountEntry();
+ Set<String> missingAccountEntryIds = Sets.newHashSet(expenseAccountWikitty.getExpenseAccountEntry());
expenseAccountWikitty.clearExpenseAccountEntry();
//manage each Expense Account Entry : try to find them or create new one
@@ -167,7 +169,7 @@
}
expenseAccountEntry.setReference(expenseAccountEntryBean.getJustificationNumber());
- expenseAccountEntry.setEmittedDate(new Date(expenseAccountEntryBean.getEmittedDate().getTime()));
+ expenseAccountEntry.setEmittedDate(new Date(expenseAccountEntryBean.getEmittedDate()));
expenseAccountEntry.setDescription(expenseAccountEntryBean.getDescription());
expenseAccountEntry.setAmount(expenseAccountEntryBean.getAmount());
expenseAccountEntry.setVAT(expenseAccountEntryBean.getVAT());
@@ -247,6 +249,12 @@
expenseAccountEntryBean.setCategoryName(category.getName());
}
+ Wikitty project = expenseAccountEntry.getTarget(false);
+ if (project != null) {
+ expenseAccountEntryBean.setProjectId(project.getWikittyId());
+ expenseAccountEntryBean.setProjectName(project.getFieldAsWikitty(Project.EXT_PROJECT, Project.FIELD_PROJECT_NAME));
+ }
+
Date emittedDate = expenseAccountEntry.getEmittedDate();
if (emittedDate != null) {
expenseAccountEntryBean.setEmittedDate(new Date(emittedDate.getTime()));
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java 2014-08-06 16:34:52 UTC (rev 427)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java 2014-08-07 12:04:36 UTC (rev 428)
@@ -34,8 +34,8 @@
protected String id;
protected String categoryName;
protected String categoryId;
- protected Date emittedDate;
- protected Date paymentDate;
+ protected long emittedDate;
+ protected long paymentDate;
protected String description;
protected String justificationNumber;
protected Double amount;
@@ -68,20 +68,28 @@
this.categoryId = categoryId;
}
- public Date getEmittedDate() {
+ public long getEmittedDate() {
return emittedDate;
}
+ public void setEmittedDate(long emittedDate) {
+ this.emittedDate = emittedDate;
+ }
+
public void setEmittedDate(Date emittedDate) {
- this.emittedDate = new Date(emittedDate.getTime());
+ this.emittedDate = emittedDate.getTime();
}
- public Date getPaymentDate() {
+ public long getPaymentDate() {
return paymentDate;
}
+ public void setPaymentDate(long paymentDate) {
+ this.paymentDate = paymentDate;
+ }
+
public void setPaymentDate(Date paymentDate) {
- this.paymentDate = new Date(paymentDate.getTime());
+ this.paymentDate = paymentDate.getTime();
}
public String getDescription() {
Modified: trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java
===================================================================
--- trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java 2014-08-06 16:34:52 UTC (rev 427)
+++ trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java 2014-08-07 12:04:36 UTC (rev 428)
@@ -43,7 +43,7 @@
Assert.assertNotNull(expenseAccountEntries);
Assert.assertEquals(1, expenseAccountEntries.size());
ExpenseAccountEntryBean expenseAccountEntryBean = expenseAccountEntries.iterator().next();
- Assert.assertEquals(emittedDate.getTime(), expenseAccountEntryBean.getEmittedDate().getTime());
+ Assert.assertEquals(emittedDate.getTime(), expenseAccountEntryBean.getEmittedDate());
}
1
0