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
r246 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 22 Aug '12
by bpoussin@users.chorem.org 22 Aug '12
22 Aug '12
Author: bpoussin
Date: 2012-08-22 08:57:42 +0200 (Wed, 22 Aug 2012)
New Revision: 246
Url: http://chorem.org/repositories/revision/chorem/246
Log:
utilisation du tag jsp wikitty pour l'affichage des listes d'Attachment
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-21 16:42:04 UTC (rev 245)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-22 06:57:42 UTC (rev 246)
@@ -217,44 +217,7 @@
}
}
-
-// static public class TaskInfoMap extends HashMap<String, TaskInfo> {
-// // on surcharge le get pour creer automatiquement les objets
-// @Override
-// public TaskInfo get(Object key) {
-// TaskInfo result = super.get(key);
-// if (result == null) {
-// result = new TaskInfo();
-// result.id = (String)key;
-// put(result.id, result);
-// }
-// return result;
-// }
-// };
-
- public final class AttachmentLink {
- protected String contextPath;
- protected Attachment attachment;
-
- public AttachmentLink(String contextPath, Attachment attachment) {
- this.contextPath = contextPath;
- this.attachment = attachment;
- }
-
- @Override
- public String toString() {
- String id = attachment.getWikittyId();
- String name = attachment.getName();
- String url = attachment.getContentUrl();
- if (StringUtils.isBlank(url)) {
- url = contextPath + "/wikitty/view/" + id + "/Attachment/content";
- }
- return String.format("<a href='%s'>%s</a>", url, name);
- }
-
- }
-
- protected <E> Map<String, List<AttachmentLink>> prepareAttachment(ChoremClient client, Collection<E> ids) {
+ protected <E> Map<String, List<Attachment>> prepareAttachment(ChoremClient client, Collection<E> ids) {
// recherche des attachments de chaque quotation trouvee
WikittyQuery attachmentQuery = new WikittyQueryMaker().and()
.exteq(Attachment.EXT_ATTACHMENT)
@@ -265,19 +228,14 @@
client.findAllByQuery(Attachment.class, attachmentQuery);
// preparation des attachements pour chaque quotation
- ServletContext servletContext = getContext().getServletContext();
- String contextPath = servletContext.getContextPath();
- Map<String, List<AttachmentLink>> attachments = new HashMap<String, List<AttachmentLink>>();
+ Map<String, List<Attachment>> attachments =
+ new MapWithDefault<String, List<Attachment>>(
+ new HashMap<String, List<Attachment>>(), new LinkedList<Attachment>());
for (Attachment a : attachmentResult) {
String id = a.getTarget();
- List<AttachmentLink> l = attachments.get(id);
- if (l == null) {
- l = new LinkedList<AttachmentLink>();
- attachments.put(id, l);
- }
- l.add(new AttachmentLink(contextPath, a));
+ attachments.get(id).add(a);
}
-
+
return attachments;
}
@@ -488,15 +446,20 @@
.parse(query)
.containsOne(Quotation.FQ_FIELD_QUOTATION_STATUS, status)
.or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, start, end)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, start, end)
.bw(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE, start, end)
- .isNull(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE)
+ .and()
+ .isNull(Interval.FQ_FIELD_INTERVAL_BEGINDATE)
+ .isNull(Interval.FQ_FIELD_INTERVAL_ENDDATE)
+ .isNull(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE)
.end();
WikittyQueryResult<Quotation> result =
client.findAllByQuery(Quotation.class, quotationQuery);
// recherche des attachments de chaque quotation trouvee
- Map<String, List<AttachmentLink>> attachments =
+ Map<String, List<Attachment>> attachments =
prepareAttachment(client, result.getAll());
// TODO poussin 20120523 ajouer la recherche des note sur la quotation
@@ -739,7 +702,7 @@
}
// recherche des attachments de chaque quotation trouvee
- Map<String, List<AttachmentLink>> attachments =
+ Map<String, List<Attachment>> attachments =
prepareAttachment(client, invoices.getAll());
return renderView("dashboardInvoice.jsp",
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-21 16:42:04 UTC (rev 245)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-22 06:57:42 UTC (rev 246)
@@ -54,7 +54,7 @@
<td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.postedDate" label=""/></td>
<td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.expectedDate" label=""/></td>
<td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.paymentDate" label=""/></td>
- <td>${attachments.get(q.wikittyId)}</td>
+ <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td>
</tr>
</tbody>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-21 16:42:04 UTC (rev 245)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-22 06:57:42 UTC (rev 246)
@@ -58,7 +58,7 @@
<td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).hopedProfit}"/></td>
<td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).realProfit}"/></td>
<td class="nowrap"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
- <td>${attachments.get(q.wikittyId)}</td>
+ <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td>
</tr>
</tbody>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-21 16:42:04 UTC (rev 245)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-22 06:57:42 UTC (rev 246)
@@ -58,7 +58,7 @@
<td class="number"><f:formatNumber type="number" value="${taskInfos.get(q.wikittyId).closed}"/></td>
<td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
<td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
- <td>${attachments.get(q.wikittyId)}</td>
+ <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td>
</tr>
</tbody>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-21 16:42:04 UTC (rev 245)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-22 06:57:42 UTC (rev 246)
@@ -56,7 +56,7 @@
<td class="currency"><f:formatNumber type="currency" value="${q.amount / q.estimatedDays}"/></td>
<td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
<td class="nowrap"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
- <td>${attachments.get(q.wikittyId)}</td>
+ <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td>
</tr>
</tbody>
</c:forEach>
1
0
r245 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions webapp/WEB-INF/jsp webapp/css webapp/js
by bpoussin@users.chorem.org 21 Aug '12
by bpoussin@users.chorem.org 21 Aug '12
21 Aug '12
Author: bpoussin
Date: 2012-08-21 18:42:04 +0200 (Tue, 21 Aug 2012)
New Revision: 245
Url: http://chorem.org/repositories/revision/chorem/245
Log:
creation d'un dashboard pour la page d'accueil
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/index.jsp
trunk/chorem-webmotion/src/main/webapp/css/chorem.less
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-20 23:28:09 UTC (rev 244)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-21 16:42:04 UTC (rev 245)
@@ -66,8 +66,12 @@
import java.util.Set;
import javax.servlet.ServletContext;
import org.apache.commons.lang3.StringUtils;
+import org.chorem.entities.Interval;
+import org.chorem.entities.Touch;
import org.nuiton.util.DateUtil;
import org.nuiton.wikitty.entities.Element;
+import org.nuiton.wikitty.entities.Wikitty;
+import org.nuiton.wikitty.query.conditions.Select;
/**
*
@@ -83,6 +87,7 @@
static private Log log = LogFactory.getLog(DashboardAction.class);
static final public String budgetDateFormat = "MM/yyyy";
+ static final public String summaryDateFormat = "dd/MM/yyyy hh:mm";
/**
* Permet de decore une map dont toutes les valeurs manquant lorsqu'on les
@@ -313,6 +318,139 @@
////////////////////////////////////////////////////////////////////////////
//
+ // C O N T A C T
+ //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public Render summary(ChoremClient client) {
+ Date now = new Date();
+ Date inOneWeek = DateUtils.addDays(now, 7);
+ Date firstDayYear = DateUtil.setFirstDayOfYear(now);
+ Date lastYearNow = DateUtils.addYears(now, -1);
+ Date lastYearFirstDay = DateUtil.setFirstDayOfYear(lastYearNow);
+
+ String companyId = client.getConfiguration().getDefaultCompany();
+
+ // toutes les depenses depuis le debut de l'annee
+ WikittyQuery annualDebtQuery = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
+ .and()
+ .exteq(Invoice.EXT_INVOICE)
+ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, firstDayYear, now)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .end().setLimit(WikittyQuery.MAX);
+
+ // toutes les factures emises depuis le debut de l'annee
+ WikittyQuery annualIncomeQuery = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
+ .and()
+ .exteq(Invoice.EXT_INVOICE)
+ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, firstDayYear, now)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .end();
+
+ // toutes les depenses depuis le debut de l'annee
+ WikittyQuery lastYearAnnualDebtQuery = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
+ .and()
+ .exteq(Invoice.EXT_INVOICE)
+ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, lastYearFirstDay, lastYearNow)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .end().setLimit(WikittyQuery.MAX);
+
+ // toutes les factures emises depuis le debut de l'annee
+ WikittyQuery lastYearAnnualIncomeQuery = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
+ .and()
+ .exteq(Invoice.EXT_INVOICE)
+ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, lastYearFirstDay, lastYearNow)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .end();
+
+
+ // les factures que notre societe doit payer au plus tard dans 7 jours
+ WikittyQuery invoiceDebtQuery = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
+ .and()
+ .exteq(Invoice.EXT_INVOICE)
+ .lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, inOneWeek)
+ .isNull(Invoice.FQ_FIELD_INVOICE_PAYMENTDATE)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .end().setLimit(WikittyQuery.MAX);
+
+ // les factures qu'auraient du payer nos clients (ils sont en retard)
+ WikittyQuery invoiceIncomeQuery = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
+ .and()
+ .exteq(Invoice.EXT_INVOICE)
+ .lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, now)
+ .isNull(Invoice.FQ_FIELD_INVOICE_PAYMENTDATE)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .end();
+
+ // les contacts qui doivnet etre pris dans les 7 prochains jours
+ WikittyQuery touchQuery = new WikittyQueryMaker().and()
+ .exteq(Touch.EXT_TOUCH)
+ .lt(Interval.FQ_FIELD_INTERVAL_BEGINDATE, inOneWeek)
+ .isNull(Interval.FQ_FIELD_INTERVAL_ENDDATE)
+ .end().setLimit(0);
+
+ WikittyQueryResult<Double>[] invoices =
+ client.findAllByQuery(Double.class,
+ invoiceDebtQuery, invoiceIncomeQuery,
+ annualDebtQuery, annualIncomeQuery,
+ lastYearAnnualDebtQuery, lastYearAnnualIncomeQuery);
+
+ WikittyQueryResult<String> touchs =
+ client.findAllByQuery(touchQuery);
+
+ // nombre de facture
+ int invoiceDebtNb = invoices[0].getTotalResult();
+ // montant total de toutes les factures
+ double invoiceDebt = invoices[0].peek();
+
+ // nombre de facture
+ int invoiceIncomeNb = invoices[1].getTotalResult();
+ // montant total de toutes les factures
+ double invoiceIncome = invoices[1].peek();
+
+ // montant total de toutes les factures
+ double annualDebt = invoices[2].peek();
+ double annualIncome = invoices[3].peek();
+
+ // montant total de toutes les factures
+ double lastYearAnnualDebt = invoices[4].peek();
+ double lastYearAnnualIncome = invoices[5].peek();
+
+ int touchNb = touchs.getTotalResult();
+
+ String touchQueryString = touchQuery.getCondition().toString();
+
+ return renderView("dashboardSummary.jsp",
+ "date", now,
+ "now", DateFormatUtils.format(now, summaryDateFormat),
+ "inOneWeek", DateFormatUtils.format(inOneWeek, summaryDateFormat),
+ "invoiceDebtNb", invoiceDebtNb,
+ "invoiceDebt", invoiceDebt,
+ "invoiceIncomeNb", invoiceIncomeNb,
+ "invoiceIncome", invoiceIncome,
+ "annualDebt", annualDebt,
+ "annualIncome", annualIncome,
+ "lastYearAnnualDebt", lastYearAnnualDebt,
+ "lastYearAnnualIncome", lastYearAnnualIncome,
+ "touchNb", touchNb,
+ "touchQueryString", touchQueryString
+ );
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ //
// P R O J E C T
//
////////////////////////////////////////////////////////////////////////////
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2012-08-21 16:42:04 UTC (rev 245)
@@ -0,0 +1,56 @@
+<%--
+ #%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">
+ <div class="span1">
+ <p class="calendar">
+ <f:formatDate value="${date}" pattern="dd"/>
+ <span class="week">semaine <f:formatDate value="${date}" pattern="w"/></span>
+ <em><f:formatDate value="${date}" pattern="MMM"/></em>
+ </p>
+ </div>
+ <div class="span24">
+ <ul>
+ <li>Il y a ${invoiceDebtNb}
+ <a href='<c:url value="/report?report=invoiceDebt&end=${inOneWeek}&query=Invoice.paymentDate=null"/>'>
+ factures à payer</a> pour un montant de
+ <f:formatNumber type="currency" value="${invoiceDebt}"/></li>
+ <li>Il y a ${invoiceIncomeNb}
+ <a href='<c:url value="/report?report=invoiceIncome&end=${now}&query=Invoice.paymentDate=null"/>'>
+ factures impayées</a> pour un montant de
+ <f:formatNumber type="currency" value="${invoiceIncome}"/></li>
+ <li>Il y a ${touchNb} <a href='<c:url value="/wikitty/search?query=${touchQueryString}"/>'>
+ contact à prendre</a></li>
+ </ul>
+
+ <ul>
+ <li>Chiffre d'affaire: <strong><f:formatNumber type="currency" value="${annualIncome}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome}"/></strong>)
+ <li>Dépenses: <strong><f:formatNumber type="currency" value="${annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualDebt}"/></strong>)
+ <li>Bénéfice/perte: <strong><f:formatNumber type="currency" value="${annualIncome-annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome-lastYearAnnualDebt}"/></strong>)
+ </ul>
+ </div>
+</div>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/index.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/index.jsp 2012-08-20 23:28:09 UTC (rev 244)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/index.jsp 2012-08-21 16:42:04 UTC (rev 245)
@@ -25,3 +25,5 @@
<h1>Chorem</h1>
Bienvenue sur Chorem, l'outil de gestion d'entreprise.
+
+<jsp:include page="/fragment/dashboard/summary"/>
Modified: trunk/chorem-webmotion/src/main/webapp/css/chorem.less
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-20 23:28:09 UTC (rev 244)
+++ trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-21 16:42:04 UTC (rev 245)
@@ -38,6 +38,89 @@
text-align: right;
}
+
+/* L'affiche du calendrier sur la page d'accueil */
+.calendar{
+ margin:.25em 10px 10px 0;
+ padding-top:5px;
+ float:left;
+ width:80px;
+ background:#ededef;
+ background: -webkit-gradient(linear, left top, left bottom, from(#ededef), to(#ccc));
+ background: -moz-linear-gradient(top, #ededef, #ccc);
+ font:bold 30px/60px Arial Black, Arial, Helvetica, sans-serif;
+ text-align:center;
+ color:#000;
+ text-shadow:#fff 0 1px 0;
+ -moz-border-radius:3px;
+ -webkit-border-radius:3px;
+ border-radius:3px;
+ position:relative;
+ -moz-box-shadow:0 2px 2px #888;
+ -webkit-box-shadow:0 2px 2px #888;
+ box-shadow:0 2px 2px #888;
+}
+
+.calendar span.week {
+ display:block;
+ font: 10px/20px Arial Black, Arial, Helvetica, sans-serif;
+}
+
+.calendar:before, .calendar:after{
+ content:'';
+ float:left;
+ position:absolute;
+ top:5px;
+ width:8px;
+ height:8px;
+ background:#111;
+ z-index:1;
+ -moz-border-radius:10px;
+ -webkit-border-radius:10px;
+ border-radius:10px;
+ -moz-box-shadow:0 1px 1px #fff;
+ -webkit-box-shadow:0 1px 1px #fff;
+ box-shadow:0 1px 1px #fff;
+}
+.calendar:before{left:11px;}
+.calendar:after{right:11px;}
+
+.calendar em{
+ display:block;
+ font:normal bold 11px/30px Arial, Helvetica, sans-serif;
+ color:#fff;
+ text-shadow:#00365a 0 -1px 0;
+ background:#04599a;
+ background:-webkit-gradient(linear, left top, left bottom, from(#04599a), to(#00365a));
+ background:-moz-linear-gradient(top, #04599a, #00365a);
+ -moz-border-radius-bottomright:3px;
+ -webkit-border-bottom-right-radius:3px;
+ border-bottom-right-radius:3px;
+ -moz-border-radius-bottomleft:3px;
+ -webkit-border-bottom-left-radius:3px;
+ border-bottom-left-radius:3px;
+ border-top:1px solid #00365a;
+}
+
+.calendar em:before, .calendar em:after{
+ content:'';
+ float:left;
+ position:absolute;
+ top:-5px;
+ width:4px;
+ height:14px;
+ background:#dadada;
+ background:-webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#aaa));
+ background:-moz-linear-gradient(top, #f1f1f1, #aaa);
+ z-index:2;
+ -moz-border-radius:2px;
+ -webkit-border-radius:2px;
+ border-radius:2px;
+}
+.calendar em:before{left:13px;}
+.calendar em:after{right:13px;}
+
+/* Les differents niveaux pour le tableau de budget*/
.categorylevel (@level) {
margin-left: @level * 10px;
}
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2012-08-20 23:28:09 UTC (rev 244)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2012-08-21 16:42:04 UTC (rev 245)
@@ -21,13 +21,20 @@
* #L%
*/
+// tooltips utiliser pour le tableau budget, mais pas tres bien, car oblige
+// de mettre hide a 1000. Le mieux serait d'avoir un tooltips (html) qui reste
+// visible (et donc permet de cliquer sur les liens) si on va dessus'
$(function() {
$('.withTooltip').tooltip({trigger: 'hover', delay: { show: 0, hide: 1000 }});
});
+$(function () {
+ $.datepicker.setDefaults($.datepicker.regional['fr']);
+ $.timepicker.setDefaults($.timepicker.regional['fr']);
+});
+
// tout ce qui aura la classe datepicker servira a editer une date
$(function() {
- $( ".datepicker" ).datepicker($.datepicker.regional['fr']);
$( ".datepicker" ).datepicker({
showWeek: true,
firstDay: 1,
@@ -37,7 +44,6 @@
// "option", "gotoCurrent", true );
});
$(function() {
- $( ".timepicker" ).timepicker($.timepicker.regional['fr']);
$( ".timepicker" ).timepicker({
showWeek: true,
firstDay: 1,
@@ -48,7 +54,6 @@
});
// tout ce qui aura la classe datetimepicker servira a editer une date avec heure
$(function() {
- $( ".datetimepicker" ).datetimepicker($.timepicker.regional['fr']);
$( ".datetimepicker" ).datetimepicker({
showWeek: true,
firstDay: 1,
1
0
r244 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions resources webapp/WEB-INF/jsp webapp/js
by bpoussin@users.chorem.org 20 Aug '12
by bpoussin@users.chorem.org 20 Aug '12
20 Aug '12
Author: bpoussin
Date: 2012-08-21 01:28:09 +0200 (Tue, 21 Aug 2012)
New Revision: 244
Url: http://chorem.org/repositories/revision/chorem/244
Log:
- changement pour les rapports, ils sont tous gere par report.jsp
- ajout des rapports individuels dans les menus
- finalisation de budget
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp
Removed:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/project.jsp
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-20 23:28:09 UTC (rev 244)
@@ -58,6 +58,7 @@
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@@ -81,6 +82,8 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(DashboardAction.class);
+ static final public String budgetDateFormat = "MM/yyyy";
+
/**
* Permet de decore une map dont toutes les valeurs manquant lorsqu'on les
* demandent sont initialise avec l'objet passe dans le constructeur.
@@ -99,6 +102,8 @@
@Override
public Object clone() throws CloneNotSupportedException {
MapWithDefault result = (MapWithDefault)super.clone();
+ // class cast exception if map is not cloneable
+ result.map = (Map)ObjectUtil.clone((Cloneable)map);
return result;
}
@@ -638,11 +643,11 @@
/**
* Prévisionnel entre deux dates en fonction des factures
*/
- public Render budget(ChoremClient client, Date start, Date end, String filter) {
+ public Render budget(ChoremClient client, Date start, Date end, String query) {
if (log.isDebugEnabled()) {
log.debug(String.format(
"budget for period '%s' to '%s' with filter '%s'",
- start, end, filter));
+ start, end, query));
}
String companyId = client.getConfiguration().getDefaultCompany();
@@ -687,7 +692,7 @@
// La liste des factures entre les deux dates que l'on doit payer
WikittyQuery invoiceDebt = new WikittyQueryMaker().and()
- .parse(filter)
+ .parse(query)
.containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
.select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
.close()
@@ -697,7 +702,7 @@
// La liste des factures entre les deux dates que l'on doit payer
WikittyQuery invoiceIncome = new WikittyQueryMaker().and()
- .parse(filter)
+ .parse(query)
.containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
.select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
.close()
@@ -705,145 +710,207 @@
.end()
.setLimit(WikittyQuery.MAX);
+ // total des factures avant les dates selectionnes
Double[] amounts = client.findByQuery(Double.class, debt, income);
- if (log.isDebugEnabled()) {
- WikittyQuery debugDebt = new WikittyQueryMaker()
- .select(Invoice.FQ_FIELD_INVOICE_AMOUNT)
- .and()
- .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
- .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
- .close()
- .lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start)
- .end()
- .setLimit(WikittyQuery.MAX);
- // La somme des factures que la company doit percevoir jusqu'a la date demandee
- WikittyQuery debugIncome = new WikittyQueryMaker()
- .select(Invoice.FQ_FIELD_INVOICE_AMOUNT)
- .and()
- .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
- .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
- .close()
- .lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start)
- .end()
- .setLimit(WikittyQuery.MAX);
-
- WikittyQueryResult[] debugResult = client.findAllByQuery(debugDebt, debugIncome);
- log.debug(String.format("\n\tDebt: %s [%s]\n\t\t(%s)\n\tIncome: %s [%s]\n\t\t(%s)",
- amounts[0], debugResult[0].getAll(), debugResult[0].getQueryString(),
- amounts[1], debugResult[1].getAll(), debugResult[1].getQueryString()));
- }
-
+ // toutes les factures des mois selectionnes
WikittyQueryResult<Invoice>[] invoices =
client.findAllByQuery(Invoice.class, invoiceDebt, invoiceIncome);
- WikittyQuery categoriesQuery = new WikittyQueryMaker()
- .exteq(Category.EXT_CATEGORY)
- .end();
+ // recuperation des noeuds root des categories
WikittyQuery rootCategoriesQuery = new WikittyQueryMaker().and()
.exteq(Category.EXT_CATEGORY)
.isNull(Category.FQ_FIELD_WIKITTYTREENODE_PARENT)
.end()
.addSortAscending(new ElementField(Category.FQ_FIELD_CATEGORY_INDEX));
- WikittyQueryResult<Category>[] categories =
- client.findAllByQuery(Category.class, categoriesQuery, rootCategoriesQuery);
+ WikittyQueryResult<Category> rootCategory =
+ client.findAllByQuery(Category.class, rootCategoriesQuery);
+ // les arbres de toutes les categories
+ List<WikittyQueryResultTreeNode<Category>> categoriesTree =
+ new LinkedList<WikittyQueryResultTreeNode<Category>>();
+ for (Category c : rootCategory) {
+ WikittyQueryResultTreeNode<Category> treeResults =
+ client.findTreeNode(Category.class, c.getWikittyId(), Integer.MAX_VALUE, false, null);
+ if (treeResults != null) {
+ CollectionUtils.addAll(categoriesTree, treeResults.preorderEnumeration());
+ }
+ }
- String dateFormat = "MM/yyyy";
+ // beginningFinances contient l'etat du compte, au depart beginningFinances vaut "recette passee" - "depense passee"
+ double finances = amounts[1] - amounts[0];
- List<String> dates = new LinkedList<String>();
- do {
- dates.add(DateFormatUtils.format(start, dateFormat));
- start = DateUtils.addMonths(start, 1);
- } while (!start.after(end));
+ BudgetData data = new BudgetData(start, end, categoriesTree, finances);
+ // Debt
+ for (Invoice i : invoices[0]) {
+ data.add(true, i);
+ }
- // key: date as MM/yyyy
- Map<String, Map<Object, Double>> values = new HashMap<String, Map<Object, Double>>();
+ // Income
+ for (Invoice i : invoices[1]) {
+ data.add(false, i);
+ }
- String DEBT_KEY = "debt"; // cle pour les depenses sur le mois
- String INCOME_KEY = "income"; // cle pour les revenus sur le mois
- String TOTAL_KEY = "total"; // cle pour la diffence entre revenus et depenses sur le mois
- String FINANCES_KEY = "finances"; // cle pour la tréso disponible
+ if (log.isDebugEnabled()) {
+ log.debug("budget data\n\t dates: " + data.getDates() + "\n\t rootTree: " + rootCategory + "\n\t categoriesTree: " + categoriesTree);
+ }
+ return renderView("dashboardBudget.jsp",
+ "data", data);
+ }
- for (String d : dates) {
- Map<Object, Double> catMap = new HashMap<Object, Double>();
- values.put(d, catMap);
- for (Category c: categories[0]) {
- catMap.put(c, 0.0);
- }
- catMap.put(DEBT_KEY, 0.0);
- catMap.put(INCOME_KEY, 0.0);
- catMap.put(TOTAL_KEY, 0.0);
- catMap.put(FINANCES_KEY, 0.0);
+ /**
+ * Permet de collecter et representer les donnees pour le budget
+ */
+ public static class BudgetData {
+ final static private String DEBT_KEY = "debt"; // cle pour les depenses sur le mois
+ final static private String INCOME_KEY = "income"; // cle pour les revenus sur le mois
+ final static private String TOTAL_KEY = "total"; // cle pour la diffence entre revenus et depenses sur le mois
+
+ protected List<String> dates;
+ protected List<WikittyQueryResultTreeNode<Category>> categoriesTree;
+ protected double beginningFinances;
+ protected Map<String, Double> finances;
+ protected Map<String, Map<Object, Double>> values;
+ protected Map<String, Map<Category, List<Invoice>>> invoices;
+
+ /**
+ *
+ * @param start la date de debut du budget
+ * @param end la date de fin du budget
+ * @param categoriesTree toutes les categories
+ * @param beginningFinances l'etat des beginningFinances avant la periode a afficher
+ */
+ public BudgetData(Date start, Date end,
+ List<WikittyQueryResultTreeNode<Category>> categoriesTree,
+ double beginningFinances) {
+ this.categoriesTree = categoriesTree;
+ this.beginningFinances = beginningFinances;
+
+ finances = new HashMap<String, Double>();
+
+ // La liste de toutes les dates que l'on souhaite
+ dates = new LinkedList<String>();
+ do {
+ dates.add(DateFormatUtils.format(start, budgetDateFormat));
+ start = DateUtils.addMonths(start, 1);
+ } while (!start.after(end));
+
+
+ Map<Object, Double> capMap = new MapWithDefault<Object, Double>(
+ new HashMap<Object, Double>(), 0.0);
+ values = new MapWithDefault<String, Map<Object, Double>>(
+ new HashMap<String, Map<Object, Double>>(), capMap);
+
+ Map<Category, List<Invoice>> capMapInvoice = new MapWithDefault<Category, List<Invoice>>(
+ new HashMap<Category, List<Invoice>>(), new LinkedList<Invoice>());
+ invoices = new MapWithDefault<String, Map<Category, List<Invoice>>>(
+ new HashMap<String, Map<Category, List<Invoice>>>(), capMapInvoice);
+
}
- // Debt
- for (Invoice i : invoices[0]) {
- String date = DateFormatUtils.format(i.getExpectedDate(), dateFormat);
- Map<Object, Double> catMap = values.get(date);
- Category c = i.getCategory(true);
- if (catMap.containsKey(c)) {
- double v = catMap.get(c);
- v += i.getAmount();
- catMap.put(c, v);
+ public List<String> getDates() {
+ return dates;
+ }
- v = catMap.get(DEBT_KEY);
- v += i.getAmount();
- catMap.put(DEBT_KEY, v);
+ public List<WikittyQueryResultTreeNode<Category>> getCategoriesTree() {
+ return categoriesTree;
+ }
+
+ public void add(boolean debt, Invoice invoice) {
+ // on modifie les invoices, donc on vide le cache de finances
+ finances.clear();
- v = catMap.get(TOTAL_KEY);
- v -= i.getAmount();
- catMap.put(TOTAL_KEY, v);
+ Date d = getDate(invoice);
+ String date = DateFormatUtils.format(d, budgetDateFormat);
+ Category c = invoice.getCategory(true);
+ double amount = invoice.getAmount();
+
+ addAmount(date, c, amount);
+ addInvoice(date, c, invoice);
+
+ if (debt) {
+ addDebt(date, amount);
+ addTotal(date, -amount);
+ } else {
+ addIncome(date, amount);
+ addTotal(date, amount);
}
+
}
- // Income
- for (Invoice i : invoices[1]) {
- String date = DateFormatUtils.format(i.getExpectedDate(), dateFormat);
- Map<Object, Double> catMap = values.get(date);
- Category c = i.getCategory(true);
- if (catMap.containsKey(c)) {
- double v = catMap.get(c);
- v += i.getAmount();
- catMap.put(c, v);
+ protected Date getDate(Invoice invoice) {
+ Date result;
+ if (invoice.getPaymentDate() != null) {
+ result = invoice.getPaymentDate();
+ } else {
+ result = invoice.getExpectedDate();
+ }
+ return result;
+ }
- v = catMap.get(INCOME_KEY);
- v += i.getAmount();
- catMap.put(INCOME_KEY, v);
+ protected void addAmount(String month, Category c, double amount) {
+ double v = getAmount(month, c);
+ v += amount;
+ values.get(month).put(c, v);
+ }
- v = catMap.get(TOTAL_KEY);
- v += i.getAmount();
- catMap.put(TOTAL_KEY, v);
- }
+ protected void addInvoice(String month, Category c, Invoice invoice) {
+ invoices.get(month).get(c).add(invoice);
}
- // finances contient l'etat du compte, au depart finances vaut "recette passee" - "depense passee"
- double finances = amounts[1] - amounts[0];
- for (String date : dates) {
- double v = values.get(date).get(TOTAL_KEY);
- finances += v;
- values.get(date).put(FINANCES_KEY, finances);
+ public void addDebt(String month, double amount) {
+ double v = values.get(month).get(DEBT_KEY);
+ v += amount;
+ values.get(month).put(DEBT_KEY, v);
}
+ public void addIncome(String month, double amount) {
+ double v = values.get(month).get(INCOME_KEY);
+ v += amount;
+ values.get(month).put(INCOME_KEY, v);
+ }
+ public void addTotal(String month, double amount) {
+ double v = values.get(month).get(TOTAL_KEY);
+ v += amount;
+ values.get(month).put(TOTAL_KEY, v);
+ }
- List<WikittyQueryResultTreeNode<Category>> categoriesTree =
- new LinkedList<WikittyQueryResultTreeNode<Category>>();
- for (Category c : categories[1]) {
- WikittyQueryResultTreeNode<Category> treeResults =
- client.findTreeNode(Category.class, c.getWikittyId(), Integer.MAX_VALUE, false, null);
- if (treeResults != null) {
- CollectionUtils.addAll(categoriesTree, treeResults.preorderEnumeration());
- }
+ public double getAmount(String month, Category c) {
+ double result = values.get(month).get(c);
+ return result;
}
- if (log.isDebugEnabled()) {
- log.debug("budget data\n\t dates: " + dates + "\n\t rootTree: " + categories[1] + "\n\t categoriesTree: " + categoriesTree + "\n\t values: " + values);
+ public List<Invoice> getInvoices(String month, Category c) {
+ List<Invoice> result = invoices.get(month).get(c);
+ return result;
}
- return renderView("dashboardBudget.jsp",
- "dates", dates,
- "categoriesTree", categoriesTree,
- "values", values);
+
+ public double getDebt(String month) {
+ double result = values.get(month).get(DEBT_KEY);
+ return result;
+ }
+ public double getIncome(String month) {
+ double result = values.get(month).get(INCOME_KEY);
+ return result;
+ }
+ public double getTotal(String month) {
+ double result = values.get(month).get(TOTAL_KEY);
+ return result;
+ }
+ public double getFinances(String month) {
+ Double result = finances.get(month);
+ if (result == null) {
+ double value = beginningFinances;
+ for (String d : getDates()) {
+ double total = getTotal(d);
+ value += total;
+ finances.put(d, value);
+ }
+ result = finances.get(month);
+ }
+ return result;
+ }
}
////////////////////////////////////////////////////////////////////////////
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2012-08-20 23:28:09 UTC (rev 244)
@@ -32,6 +32,5 @@
* /admin view:contact.jsp
* /admin/{method} action:AdminAction.{method}
* /contact view:contact.jsp
-* /project view:project.jsp
-* /financial view:financial.jsp
+* /report view:report.jsp
* /hr view:hr.jsp
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2012-08-20 23:28:09 UTC (rev 244)
@@ -31,42 +31,42 @@
<thead>
<tr>
<th>Category</th>
- <c:forEach var="d" items="${dates}">
+ <c:forEach var="d" items="${data.dates}">
<th>${d}</th>
</c:forEach>
</tr>
</thead>
<tbody>
- <c:forEach var="c" items="${categoriesTree}">
+ <c:forEach var="c" items="${data.categoriesTree}">
<tr>
<td><span class="level level${c.level}" level="${c.level}">${c.userObject}</span></td>
- <c:forEach var="d" items="${dates}">
- <td class="currency"><span><f:formatNumber type="currency" value="${values.get(d).get(c.userObject)}"/></span></td>
+ <c:forEach var="d" items="${data.dates}">
+ <td class="currency"><span class="withTooltip" title='<w:display wikitties="${data.getInvoices(d, c.userObject)}" toString="%Invoice.reference|noref$s: %Invoice.amount|0.0$,.2f"/>'><f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/></span></td>
</c:forEach>
</tr>
</c:forEach>
<tr>
<th><span>Sorties</span></th>
- <c:forEach var="d" items="${dates}">
- <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("debt")}'/></span></td>
+ <c:forEach var="d" items="${data.dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${data.getDebt(d)}'/></span></td>
</c:forEach>
</tr>
<tr>
<th><span>Entrées</span></th>
- <c:forEach var="d" items="${dates}">
- <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("income")}'/></span></td>
+ <c:forEach var="d" items="${data.dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${data.getIncome(d)}'/></span></td>
</c:forEach>
</tr>
<tr>
<th><span>Total</span></th>
- <c:forEach var="d" items="${dates}">
- <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("total")}'/></span></td>
+ <c:forEach var="d" items="${data.dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${data.getTotal(d)}'/></span></td>
</c:forEach>
</tr>
<tr>
<th><span>Total cumulé</span></th>
- <c:forEach var="d" items="${dates}">
- <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("finances")}'/></span></td>
+ <c:forEach var="d" items="${data.dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${data.getFinances(d)}'/></span></td>
</c:forEach>
</tr>
</tbody>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2012-08-20 23:28:09 UTC (rev 244)
@@ -96,7 +96,7 @@
</li>
<li class="dropdown nav-group">
<!-- around projects -->
- <a href="<c:url value="/project"/>">Project</a>
+ <a href="<c:url value="/report?report=quotation,projectOpen,projectClosed"/>">Project</a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<b class="caret"></b>
</a>
@@ -120,11 +120,16 @@
<li>Time</li>
<li><a href="<c:url value="/wikitty/Time/search"/>"><i class="icon-th-list icon-black"></i> All times</a></li>
<li><a href="<c:url value="/wikitty/Time/edit/new"/>"><i class="icon-plus icon-black"></i> Add time</a></li>
+ <li class="divider"></li>
+ <li>Report</li>
+ <li><a href="<c:url value="/report?report=quotation"/>">Quotation</a></li>
+ <li><a href="<c:url value="/report?report=projectOpen"/>">Project Open</a></li>
+ <li><a href="<c:url value="/report?report=projectClosed"/>">Project Closed</a></li>
</ul>
</li>
<li class="dropdown nav-group">
<!-- around financial -->
- <a href="<c:url value="/financial"/>">Financial</a>
+ <a href="<c:url value="/report?report=invoiceDebt,invoiceIncome,profitability,budget"/>">Financial</a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<b class="caret"></b>
</a>
@@ -141,8 +146,11 @@
<li><a href="<c:url value="/wikitty/Category/search"/>"><i class="icon-th-list icon-black"></i> All categories</a></li>
<li><a href="<c:url value="/wikitty/Category/edit/new"/>"><i class="icon-plus icon-black"></i> Add category</a></li>
<li class="divider"></li>
- <li>Other</li>
- <li><a href="<c:url value="wikitty/search?query=extension=Accounting"/>">Accounting</a></li>
+ <li>Report</li>
+ <li><a href="<c:url value="/report?report=invoiceDebt"/>">Debt</a></li>
+ <li><a href="<c:url value="/report?report=invoiceIncome"/>">Income</a></li>
+ <li><a href="<c:url value="/report?report=profitability"/>">Profitability</a></li>
+ <li><a href="<c:url value="/report?report=budget"/>">Budget</a></li>
</ul>
</li>
<li class="dropdown nav-group">
Deleted: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp 2012-08-20 23:28:09 UTC (rev 244)
@@ -1,37 +0,0 @@
-<%--
- #%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"%>
-
-<h1>Financial</h1>
-
-<form>
- date start: <input class="datepicker" type="text" name="start" value="${start}"/>
- end: <input class="datepicker" type="text" name="end" value="${end}"/>
- filtre: <input type="text" name="query"/>
- <input type="submit"/>
-</form>
-
-<jsp:include page="/fragment/dashboard/invoiceDebt"/>
-<jsp:include page="/fragment/dashboard/invoiceIncome"/>
-<jsp:include page="/fragment/dashboard/profitability"/>
-<jsp:include page="/fragment/dashboard/budget"/>
Deleted: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/project.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/project.jsp 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/project.jsp 2012-08-20 23:28:09 UTC (rev 244)
@@ -1,34 +0,0 @@
-<%--
- #%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"%>
-
-<h1>Project</h1>
-
-<form>
- <input type="text" name="query"/>
- <input type="submit"/>
-</form>
-
-<jsp:include page="/fragment/dashboard/quotation?query=${query}"/>
-<jsp:include page="/fragment/dashboard/projectOpen?query=${query}"/>
-<jsp:include page="/fragment/dashboard/projectClosed?query=${query}"/>
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2012-08-20 23:28:09 UTC (rev 244)
@@ -0,0 +1,59 @@
+<%--
+ #%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" %>
+
+<h1>Financial</h1>
+
+<form class="well form-inline">
+ <input type="hidden" name="report" value="${report}"/>
+ <input class="datepicker input-small" type="text" name="start" value="${start}" placeholder="date from"/>
+ <input class="datepicker input-small" type="text" name="end" value="${end}" placeholder="date to"/>
+ <input class="input-xxlarge" type="text" name="query" value="${query}" placeholder="filter query"/>
+ <input type="submit" class="btn"/>
+</form>
+
+ <%-- Rapport de projet --%>
+ <c:if test="${report == null || report == '' || report.contains('quotation')}">
+ <jsp:include page="/fragment/dashboard/quotation"/>
+ </c:if>
+ <c:if test="${report == null || report == '' || report.contains('projectOpen')}">
+ <jsp:include page="/fragment/dashboard/projectOpen"/>
+ </c:if>
+ <c:if test="${report == null || report == '' || report.contains('projectClosed')}">
+ <jsp:include page="/fragment/dashboard/projectClosed"/>
+ </c:if>
+
+ <%-- Rapport financier --%>
+ <c:if test="${report == null || report == '' || report.contains('invoiceDebt')}">
+ <jsp:include page="/fragment/dashboard/invoiceDebt"/>
+ </c:if>
+ <c:if test="${report == null || report == '' || report.contains('invoiceIncome')}">
+ <jsp:include page="/fragment/dashboard/invoiceIncome"/>
+ </c:if>
+ <c:if test="${report == null || report == '' || report.contains('profitability')}">
+ <jsp:include page="/fragment/dashboard/profitability"/>
+ </c:if>
+ <c:if test="${report == null || report == '' || report.contains('budget')}">
+ <jsp:include page="/fragment/dashboard/budget"/>
+ </c:if>
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2012-08-20 23:26:27 UTC (rev 243)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2012-08-20 23:28:09 UTC (rev 244)
@@ -20,6 +20,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+
+$(function() {
+ $('.withTooltip').tooltip({trigger: 'hover', delay: { show: 0, hide: 1000 }});
+});
+
// tout ce qui aura la classe datepicker servira a editer une date
$(function() {
$( ".datepicker" ).datepicker($.datepicker.regional['fr']);
@@ -67,3 +72,4 @@
});
}
});
+
1
0
r243 - in trunk/chorem-webmotion/src/main: java/org/wikitty/web/jsptag webapp/WEB-INF
by bpoussin@users.chorem.org 20 Aug '12
by bpoussin@users.chorem.org 20 Aug '12
20 Aug '12
Author: bpoussin
Date: 2012-08-21 01:26:27 +0200 (Tue, 21 Aug 2012)
New Revision: 243
Url: http://chorem.org/repositories/revision/chorem/243
Log:
ajout du support de la presentation d'une collection de wikitty
Modified:
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/wikitty.tld
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-20 21:01:48 UTC (rev 242)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-20 23:26:27 UTC (rev 243)
@@ -37,14 +37,18 @@
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
import java.util.List;
+import org.nuiton.wikitty.entities.BusinessEntityImpl;
/**
* Tag Support to display Wikitty fields.
*
* attribute:
- * <li>wikitty: wikitty object
+ * <li>wikitty: wikitty object or BusinessEntityImpl
+ * <li>wikitties: Collection of wikitty object or BusinessEntityImpl (used if wikitty is null)
* <li>fqfield: fully qualified field to display
* <li>label: if not presente use field name, if empty or blank don't show label
* <li>toString: String used to transforme Wikitty to string representation (overwrite default toString)
@@ -57,16 +61,46 @@
public class WikittyDisplay extends SimpleTagSupport {
protected Wikitty wikitty;
+
+ protected Collection<Wikitty> wikitties;
+ protected String listStart = "<ul>";
+ protected String listEnd = "</ul>";
+ protected String listItemStart = "<li>";
+ protected String listItemEnd = "</li>";
+
protected String fqfield = "";
protected String label = null;
protected String toString = null;
protected String pattern = null;
protected String subtype = null;
- public void setWikitty(Wikitty wikitty) {
- this.wikitty = wikitty;
+ public void setWikitty(Object o) {
+ this.wikitty = WikittyUtil.getWikitty(o);
}
+ public void setWikitties(Collection<Object> os) {
+ wikitties = new ArrayList<Wikitty>(os.size());
+ for (Object o : os) {
+ wikitties.add(WikittyUtil.getWikitty(o));
+ }
+ }
+
+ public void setListStart(String listStart) {
+ this.listStart = listStart;
+ }
+
+ public void setListEnd(String listEnd) {
+ this.listEnd = listEnd;
+ }
+
+ public void setListItemStart(String listItemStart) {
+ this.listItemStart = listItemStart;
+ }
+
+ public void setListItemEnd(String listItemEnd) {
+ this.listItemEnd = listItemEnd;
+ }
+
public void setFqfield(String fqfield) {
this.fqfield = fqfield;
}
@@ -89,16 +123,27 @@
@Override
public void doTag() throws JspException, IOException {
- if (wikitty == null) {
- // si pas de wikitty, on a rien a faire
- return;
- }
JspWriter output = getJspContext().getOut();
PageContext pageContext = (PageContext)getJspContext();
ServletContext servletContext = pageContext.getServletContext();
String contextPath = servletContext.getContextPath();
+ if (wikitty != null) {
+ renderOneWikitty(output, contextPath, wikitty);
+ } else if (wikitties != null) {
+ /*{<%=listStart%>}*/
+ for (Wikitty wikitty : wikitties) {
+ /*{<%=listItemStart%>}*/
+ renderOneWikitty(output, contextPath, wikitty);
+ /*{<%=listItemEnd%>}*/
+ }
+ /*{<%=listEnd%>}*/
+ }
+ // si pas de wikitty, on a rien a faire
+ }
+
+ protected void renderOneWikitty(JspWriter output, String contextPath, Wikitty wikitty) throws JspException, IOException {
if (StringUtils.isBlank(fqfield)) {
// pas de champs precisse, on doit afficher le wikitty lui meme
if (StringUtils.isNotBlank(label)) {
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/wikitty.tld
===================================================================
(Binary files differ)
1
0
r242 - trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector
by bpoussin@users.chorem.org 20 Aug '12
by bpoussin@users.chorem.org 20 Aug '12
20 Aug '12
Author: bpoussin
Date: 2012-08-20 23:01:48 +0200 (Mon, 20 Aug 2012)
New Revision: 242
Url: http://chorem.org/repositories/revision/chorem/242
Log:
conversion d'une chaine vide en null pour une date
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java 2012-08-20 20:35:04 UTC (rev 241)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java 2012-08-20 21:01:48 UTC (rev 242)
@@ -89,11 +89,11 @@
Object result = null;
if (value != null) {
if (String.class.isAssignableFrom(type)) {
- if (StringUtils.isNotBlank((String)value)) {
result = WikittyUtil.toString(value);
+ } else if (Date.class.isAssignableFrom(type)) {
+ if (!(value instanceof String) || StringUtils.isNotBlank((String)value)) {
+ result = WikittyUtil.toDate(value);
}
- } else if (Date.class.isAssignableFrom(type)) {
- result = WikittyUtil.toDate(value);
} else {
throw new ConversionException(String.format(
"Chorem date converter can't convert '%s' to '%s'",
1
0
20 Aug '12
Author: bpoussin
Date: 2012-08-20 22:35:04 +0200 (Mon, 20 Aug 2012)
New Revision: 241
Url: http://chorem.org/repositories/revision/chorem/241
Log:
meilleurs presentation des formulaires
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/edit.jsp
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/edit.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/edit.jsp 2012-08-15 21:37:19 UTC (rev 240)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/edit.jsp 2012-08-20 20:35:04 UTC (rev 241)
@@ -25,8 +25,7 @@
<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
<c:if test="${not empty wikitty}">
- <%//FIXME ymartel 2012/07/02 fix the need of iso accept charset ? %>
- <form class="form-inline" method="post" accept-charset="ISO-8859-15" action="<c:url value="/wikitty/save"/>" enctype="multipart/form-data">
+ <form class="form-horizontal" method="post" action="<c:url value="/wikitty/save"/>" enctype="multipart/form-data">
<input type="hidden" name="id" value="${wikitty.id}"/>
<p>
<button class="btn btn-success" type="submit"><i class="icon-ok icon-white"></i> Save</button>
@@ -34,12 +33,18 @@
</p>
<c:forEach var="ext" items="${extensions}">
- <input type="hidden" name="extension" value="${ext.name}">
- <dl><dt>${ext.name}</dt>
+ <fieldset>
+ <legend>${ext.name}</legend>
+ <input type="hidden" name="extension" value="${ext.name}">
<c:forEach var="fieldName" items="${ext.fieldNames}">
- <dd>${fieldName}: <w:input wikitty="${wikitty}" fqfield="${ext.name}.${fieldName}"/><%--@ include file="wikittyFieldEdit.jsp"--%></dd>
+ <div class="control-group">
+ <label class="control-label">${fieldName}</label>
+ <div class="controls">
+ <w:input wikitty="${wikitty}" fqfield="${ext.name}.${fieldName}"/>
+ </div>
+ </div>
</c:forEach>
- </dl>
+ </fieldset>
</c:forEach>
</form>
</c:if>
1
0
r240 - in trunk: chorem-entities/src/main/xmi chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/java/org/chorem/webmotion/injector chorem-webmotion/src/main/java/org/wikitty/web/jsptag chorem-webmotion/src/main/webapp/WEB-INF/jsp chorem-webmotion/src/main/webapp/css
by bpoussin@users.chorem.org 15 Aug '12
by bpoussin@users.chorem.org 15 Aug '12
15 Aug '12
Author: bpoussin
Date: 2012-08-15 23:37:19 +0200 (Wed, 15 Aug 2012)
New Revision: 240
Url: http://chorem.org/repositories/revision/chorem/240
Log:
modification pour faire fonctionner le rapport budget.
Il reste une erreur sur l'affichage des categories :(
Modified:
trunk/chorem-entities/src/main/xmi/chorem-model.properties
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp
trunk/chorem-webmotion/src/main/webapp/css/chorem.less
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-15 21:37:19 UTC (rev 240)
@@ -89,7 +89,7 @@
#
# Invoice
#
-org.chorem.entities.Invoice.class.tagvalue.version=12.0
+org.chorem.entities.Invoice.class.tagvalue.version=14.0
org.chorem.entities.Invoice.class.tagvalue.preload=Invoice.customer;Invoice.supplier
org.chorem.entities.Invoice.class.tagvalue.toString=%Invoice.reference|noref$s %Invoice.amount|noamount$s %Invoice.postedDate$tF %Invoice.expectedDate$tF %Invoice.paymentDate$tF
org.chorem.entities.Invoice.class.tagvalue.sortOrder=Invoice.postedDate desc,Invoice.expectedDate,Invoice.paymentDate,Invoice.reference,Invoice.amount
@@ -103,7 +103,6 @@
org.chorem.entities.Invoice.attribute.expectedDate.tagvalue.help=La date souhait\u00e9e de paiement
org.chorem.entities.Invoice.attribute.paymentDate.tagvalue.help=La date de paiement r\u00e9elle
org.chorem.entities.Invoice.attribute.supplier.tagvalue.help=La personne chez Code Lutin qui g\u00e8re la facturation
-org.chorem.entities.Invoice.attribute.supplier.tagvalue.allowedQuery=SELECT id WHERE Employee.company="1628bcf9-82ea-440d-ab8d-ea93498af2d9"
org.chorem.entities.Invoice.attribute.customer.tagvalue.help=La personne chez le client \u00e0 qui ont a envoyer la facture
#
# Invoiceable
@@ -161,7 +160,7 @@
#
# Quotation
#
-org.chorem.entities.Quotation.class.tagvalue.version=16.0
+org.chorem.entities.Quotation.class.tagvalue.version=17.0
org.chorem.entities.Quotation.class.tagvalue.preload=Quotation.project;Quotation.customer;Quotation.supplier;Quotation.category
org.chorem.entities.Quotation.class.tagvalue.toString=%Interval.beginDate$tF-%Interval.endDate$tF %Quotation.reference|noref$s(%Quotation.category|noCategory$s) %Quotation.description|nodescription$s
org.chorem.entities.Quotation.class.tagvalue.sortOrder=Interval.beginDate desc,Interval.endDate,Quotation.reference,Quotation.type,Quotation.description
@@ -187,7 +186,7 @@
org.chorem.entities.Quotation.attribute.vrsStart.tagvalue.help=Date de d\u00e9but de la VSR (Validation en Service R\u00e9gulier)
org.chorem.entities.Quotation.attribute.warrantyStart.tagvalue.help=Date de d\u00e9but de la garantie
org.chorem.entities.Quotation.attribute.supplier.tagvalue.help=La personne en charge du dossier chez Code Lutin
-org.chorem.entities.Quotation.attribute.supplier.tagvalue.allowedQuery=SELECT id WHERE Employee.company="1628bcf9-82ea-440d-ab8d-ea93498af2d9"
+org.chorem.entities.Quotation.attribute.supplier.tagvalue.allowedQuery=Employee.company="1628bcf9-82ea-440d-ab8d-ea93498af2d9"
org.chorem.entities.Quotation.attribute.customer.tagvalue.help=La personne en charge du dossier chez le client
org.chorem.entities.Quotation.attribute.project.tagvalue.help=Le projet auquel se rapport ce devis
org.chorem.entities.Quotation.attribute.category.tagvalue.help=La cat\u00e9gorie de ce devis
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2012-08-15 21:37:19 UTC (rev 240)
@@ -46,15 +46,18 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(AdminAction.class);
- /**
- * Bilan du nombre de jour travaille sur des projets client depuis le 01/01 par employer de la
- * societe par defaut (Configuration.defaultCompany)
+ /**
+ * affiche les valeurs de configuration d'administration
*/
public Render variables(ChoremClient client) {
Configuration conf = client.getConfiguration();
GenericAction g = new GenericAction();
+ g.setContextable(contextable);
return g.view(client, conf.getWikittyId(), null);
+ // la ligne suivante ne fonctionne pas (probleme de nombre d'argument)
+// return renderAction("GenericAction.view",
+// "client", client, "id", conf.getWikittyId(), "extension", null );
}
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-15 21:37:19 UTC (rev 240)
@@ -58,12 +58,15 @@
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletContext;
import org.apache.commons.lang3.StringUtils;
+import org.nuiton.util.DateUtil;
+import org.nuiton.wikitty.entities.Element;
/**
*
@@ -320,9 +323,20 @@
* (task info not needed for not stated project)
* @return
*/
- protected Render quotationFilter(ChoremClient client, String query,
+ protected Render quotationFilter(ChoremClient client,
+ Date start, Date end, String query,
EnumSet<QuotationStatus> status, String jspRender,
String title, boolean computeTask) {
+
+ if (start == null) {
+ start = new Date();
+ start = DateUtils.setMonths(start, Calendar.JANUARY);
+ }
+
+ if (end == null) {
+ end = DateUtils.setMonths(start, Calendar.DECEMBER);
+ }
+
// recherche de la configuration pour les calcules
Configuration config = client.getConfiguration();
@@ -330,6 +344,9 @@
WikittyQuery quotationQuery = new WikittyQueryMaker().and()
.parse(query)
.containsOne(Quotation.FQ_FIELD_QUOTATION_STATUS, status)
+ .or()
+ .bw(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE, start, end)
+ .isNull(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE)
.end();
WikittyQueryResult<Quotation> result =
@@ -419,25 +436,28 @@
"taskInfos", taskInfos);
}
- public Render quotation(ChoremClient client, String query) {
+ public Render quotation(ChoremClient client,
+ Date start, Date end, String query) {
EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.LEAD, QuotationStatus.SENT);
String jsp = "dashboardQuotation.jsp";
String title = "Les propositions en attente de réponse";
- return quotationFilter(client, query, status, jsp, title, false);
+ return quotationFilter(client, start, end, query, status, jsp, title, false);
}
- public Render projectOpen(ChoremClient client, String query) {
+ public Render projectOpen(ChoremClient client,
+ Date start, Date end, String query) {
EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.ACCEPTED, QuotationStatus.RSV);
String jsp = "dashboardProject.jsp";
String title = "Les projets en cours";
- return quotationFilter(client, query, status, jsp, title, true);
+ return quotationFilter(client, start, end, query, status, jsp, title, true);
}
- public Render projectClosed(ChoremClient client, String query) {
+ public Render projectClosed(ChoremClient client,
+ Date start, Date end, String query) {
EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.WARRANTY, QuotationStatus.CLOSED);
String jsp = "dashboardProject.jsp";
String title = "Les projets clos";
- return quotationFilter(client, query, status, jsp, title, true);
+ return quotationFilter(client, start, end, query, status, jsp, title, true);
}
static public class TaskInfo implements Cloneable {
@@ -535,11 +555,27 @@
//
////////////////////////////////////////////////////////////////////////////
- public Render invoice(ChoremClient client, String query) {
+ protected Render invoiceFilter(ChoremClient client, String title,
+ String filter, Date start, Date end, String query) {
+ if (start == null) {
+ start = new Date();
+ start = DateUtils.setMonths(start, Calendar.JANUARY);
+ }
+
+ if (end == null) {
+ end = DateUtils.setMonths(start, Calendar.DECEMBER);
+ }
+
// recuperation des factures
WikittyQuery invoiceQuery = new WikittyQueryMaker().and()
+ .parse(filter)
.parse(query)
.exteq(Invoice.EXT_INVOICE)
+ .or()
+ .bw(Invoice.FQ_FIELD_INVOICE_POSTEDDATE, start, end)
+ .isNull(Invoice.FQ_FIELD_INVOICE_POSTEDDATE)
+ .bw(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start, end)
+ .bw(Invoice.FQ_FIELD_INVOICE_PAYMENTDATE, start, end)
.end();
WikittyQueryResult<Invoice> invoices =
@@ -564,6 +600,7 @@
prepareAttachment(client, invoices.getAll());
return renderView("dashboardInvoice.jsp",
+ "title", title,
"invoices", invoices.getAll(),
"amount", amount,
"amountPaid", amountPaid,
@@ -572,112 +609,33 @@
);
}
- public Render profitability(ChoremClient client, String query) {
- EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.STARTED, QuotationStatus.CLOSED);
- String jsp = "dashboardProfitability.jsp";
- String title = "Profitability";
- return quotationFilter(client, query, status, jsp, title, true);
+ public Render invoiceDebt(ChoremClient client,
+ Date start, Date end, String query) {
+ String title = "Factures à payer par la société";
+ String companyId = client.getConfiguration().getDefaultCompany();
+ String filter = Invoice.FQ_FIELD_INVOICE_CUSTOMER + "={SELECT id WHERE (" +
+ Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+")}";
+ return invoiceFilter(client, title, filter, start, end, query);
}
- ////////////////////////////////////////////////////////////////////////////
- //
- // H R
- //
- ////////////////////////////////////////////////////////////////////////////
-
- public Render vacationFilter(ChoremClient client, String query, String jspRender, EnumSet<VacationStatus> status) {
- // recuperation des vacances en fonction de leur status
- WikittyQuery vacationQuery = new WikittyQueryMaker().and()
- .parse(query)
- .containsOne(Vacation.FQ_FIELD_VACATION_STATUS, status)
- .end();
-
- WikittyQueryResult<Vacation> vacations =
- client.findAllByQuery(Vacation.class, vacationQuery);
-
- Map<String, Double> days = new HashMap<String, Double>();
- for (Vacation v : vacations) {
- double d = computeVacationDays(v);
- days.put(v.getWikittyId(), d);
- }
-
- return renderView(jspRender,
- "vacations", vacations.getAll(),
- "days", days
- );
-
+ public Render invoiceIncome(ChoremClient client,
+ Date start, Date end, String query) {
+ String title = "Factures émises par la société";
+ String companyId = client.getConfiguration().getDefaultCompany();
+ String filter = Invoice.FQ_FIELD_INVOICE_SUPPLIER + "={SELECT id WHERE (" +
+ Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+")}";
+ return invoiceFilter(client, title, filter, start, end, query);
}
- /**
- * Les vacances demandees par des employes non encore validee.
- * @param client
- * @param query
- * @return
- */
- public Render vacationAsked(ChoremClient client, String query) {
- return vacationFilter(client, query, "dashboardVacationAsked.jsp",
- EnumSet.of(VacationStatus.ASKED));
+ public Render profitability(ChoremClient client,
+ Date start, Date end, String query) {
+ EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.STARTED, QuotationStatus.CLOSED);
+ String jsp = "dashboardProfitability.jsp";
+ String title = "Profitability";
+ return quotationFilter(client, start, end, query, status, jsp, title, true);
}
/**
- * Les vacances validees
- * @param client
- * @param query
- * @return
- */
- public Render vacation(ChoremClient client, String query) {
- return vacationFilter(client, query, "dashboardVacation.jsp",
- EnumSet.of(VacationStatus.ACCEPTED));
- }
-
- public Render vacationByEmployee(ChoremClient client, String query) {
- WikittyQuery vacationQuery = new WikittyQueryMaker().and()
- .parse(query)
- .eq(Vacation.FQ_FIELD_VACATION_STATUS, VacationStatus.ACCEPTED)
- .end();
-
- WikittyQueryResult<Vacation> vacations =
- client.findAllByQuery(Vacation.class, vacationQuery);
-
- Map<Employee, Double> days = new MapWithDefault<Employee, Double>(
- new HashMap<Employee, Double>(), Double.valueOf(0));
- for(Vacation v : vacations) {
- Employee e = v.getEmployee(false);
- double d = days.get(e) + computeVacationDays(v);
- days.put(e, d);
- }
-
- return renderView("dashboardVacationByEmployee.jsp",
- "vacationByEmployee", days
- );
- }
- /**
- * Bilan du nombre de jour travaille sur des projets client depuis le 01/01 par employer de la
- * societe par defaut (Configuration.defaultCompany)
- */
- public Render workingProjectDaysByEmployee(ChoremClient client, String query) {
- WikittyQuery vacationQuery = new WikittyQueryMaker().and()
- .parse(query)
- .exteq(Time.EXT_TIME)
- .end();
-
- WikittyQueryResult<Time> times =
- client.findAllByQuery(Time.class, vacationQuery);
-
- Map<Employee, Double> days = new MapWithDefault<Employee, Double>(
- new HashMap<Employee, Double>(), Double.valueOf(0));
- for(Time t : times) {
- Employee e = t.getEmployee(false);
- double d = days.get(e) + computeWorkingDays(client, t);
- days.put(e, d);
- }
-
- return renderView("dashboardWorkingProjectDaysByEmployee.jsp",
- "workingProjectDaysByEmployee", days
- );
- }
-
- /**
* Prévisionnel entre deux dates en fonction des factures
*/
public Render budget(ChoremClient client, Date start, Date end, String filter) {
@@ -687,8 +645,12 @@
start, end, filter));
}
String companyId = client.getConfiguration().getDefaultCompany();
- //TODO ymartel 2012/06/07 : manage when companyId is not defined.
+ if (StringUtils.isBlank(companyId)) {
+ getContext().addInfoMessage("message", "Vous devez définir une société par défaut");
+ return renderURL("/admin/variables");
+ }
+
if (start == null) {
start = new Date();
start = DateUtils.addMonths(start, -1);
@@ -698,11 +660,16 @@
end = DateUtils.addMonths(start, 6);
}
+ start = DateUtil.setFirstDayOfMonth(start);
+ end = DateUtil.setLastDayOfMonth(end);
+
// La somme des factures que la company doit payer jusqu'a la date demandee
WikittyQuery debt = new WikittyQueryMaker()
.select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
.and()
- .eq(Invoice.FQ_FIELD_INVOICE_CUSTOMER, companyId)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .close()
.lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start)
.end()
.setLimit(WikittyQuery.MAX);
@@ -711,21 +678,65 @@
WikittyQuery income = new WikittyQueryMaker()
.select(Invoice.FQ_FIELD_INVOICE_AMOUNT, Aggregate.SUM)
.and()
- .eq(Invoice.FQ_FIELD_INVOICE_SUPPLIER, companyId)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .close()
.lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start)
.end()
.setLimit(WikittyQuery.MAX);
- // La liste des factures entre les deux dates
- WikittyQuery q = new WikittyQueryMaker().and()
+ // La liste des factures entre les deux dates que l'on doit payer
+ WikittyQuery invoiceDebt = new WikittyQueryMaker().and()
.parse(filter)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .close()
.bw(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start, end)
.end()
.setLimit(WikittyQuery.MAX);
+ // La liste des factures entre les deux dates que l'on doit payer
+ WikittyQuery invoiceIncome = new WikittyQueryMaker().and()
+ .parse(filter)
+ .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .close()
+ .bw(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start, end)
+ .end()
+ .setLimit(WikittyQuery.MAX);
+
Double[] amounts = client.findByQuery(Double.class, debt, income);
- WikittyQueryResult<Invoice> invoices = client.findAllByQuery(Invoice.class, q);
+ if (log.isDebugEnabled()) {
+ WikittyQuery debugDebt = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT)
+ .and()
+ .containsOne(Invoice.FQ_FIELD_INVOICE_CUSTOMER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .close()
+ .lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start)
+ .end()
+ .setLimit(WikittyQuery.MAX);
+ // La somme des factures que la company doit percevoir jusqu'a la date demandee
+ WikittyQuery debugIncome = new WikittyQueryMaker()
+ .select(Invoice.FQ_FIELD_INVOICE_AMOUNT)
+ .and()
+ .containsOne(Invoice.FQ_FIELD_INVOICE_SUPPLIER)
+ .select(Element.ID).eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId)
+ .close()
+ .lt(Invoice.FQ_FIELD_INVOICE_EXPECTEDDATE, start)
+ .end()
+ .setLimit(WikittyQuery.MAX);
+
+ WikittyQueryResult[] debugResult = client.findAllByQuery(debugDebt, debugIncome);
+ log.debug(String.format("\n\tDebt: %s [%s]\n\t\t(%s)\n\tIncome: %s [%s]\n\t\t(%s)",
+ amounts[0], debugResult[0].getAll(), debugResult[0].getQueryString(),
+ amounts[1], debugResult[1].getAll(), debugResult[1].getQueryString()));
+ }
+
+ WikittyQueryResult<Invoice>[] invoices =
+ client.findAllByQuery(Invoice.class, invoiceDebt, invoiceIncome);
+
WikittyQuery categoriesQuery = new WikittyQueryMaker()
.exteq(Category.EXT_CATEGORY)
.end();
@@ -749,29 +760,73 @@
// key: date as MM/yyyy
- Map<String, Map<Category, Double>> values = new HashMap<String, Map<Category, Double>>();
+ Map<String, Map<Object, Double>> values = new HashMap<String, Map<Object, Double>>();
+ String DEBT_KEY = "debt"; // cle pour les depenses sur le mois
+ String INCOME_KEY = "income"; // cle pour les revenus sur le mois
+ String TOTAL_KEY = "total"; // cle pour la diffence entre revenus et depenses sur le mois
+ String FINANCES_KEY = "finances"; // cle pour la tréso disponible
+
for (String d : dates) {
- Map<Category, Double> catMap = new HashMap<Category, Double>();
+ Map<Object, Double> catMap = new HashMap<Object, Double>();
values.put(d, catMap);
for (Category c: categories[0]) {
catMap.put(c, 0.0);
}
+ catMap.put(DEBT_KEY, 0.0);
+ catMap.put(INCOME_KEY, 0.0);
+ catMap.put(TOTAL_KEY, 0.0);
+ catMap.put(FINANCES_KEY, 0.0);
}
- for (Invoice i : invoices) {
+ // Debt
+ for (Invoice i : invoices[0]) {
String date = DateFormatUtils.format(i.getExpectedDate(), dateFormat);
- Map<Category, Double> catMap = values.get(date);
- System.out.println(String.format("*** date '%s' %s map %s", date, dates, values));
+ Map<Object, Double> catMap = values.get(date);
Category c = i.getCategory(true);
- System.out.println("c: " + c + " catMap: " + catMap);
if (catMap.containsKey(c)) {
double v = catMap.get(c);
v += i.getAmount();
catMap.put(c, v);
+
+ v = catMap.get(DEBT_KEY);
+ v += i.getAmount();
+ catMap.put(DEBT_KEY, v);
+
+ v = catMap.get(TOTAL_KEY);
+ v -= i.getAmount();
+ catMap.put(TOTAL_KEY, v);
}
}
+ // Income
+ for (Invoice i : invoices[1]) {
+ String date = DateFormatUtils.format(i.getExpectedDate(), dateFormat);
+ Map<Object, Double> catMap = values.get(date);
+ Category c = i.getCategory(true);
+ if (catMap.containsKey(c)) {
+ double v = catMap.get(c);
+ v += i.getAmount();
+ catMap.put(c, v);
+
+ v = catMap.get(INCOME_KEY);
+ v += i.getAmount();
+ catMap.put(INCOME_KEY, v);
+
+ v = catMap.get(TOTAL_KEY);
+ v += i.getAmount();
+ catMap.put(TOTAL_KEY, v);
+ }
+ }
+
+ // finances contient l'etat du compte, au depart finances vaut "recette passee" - "depense passee"
+ double finances = amounts[1] - amounts[0];
+ for (String date : dates) {
+ double v = values.get(date).get(TOTAL_KEY);
+ finances += v;
+ values.get(date).put(FINANCES_KEY, finances);
+ }
+
List<WikittyQueryResultTreeNode<Category>> categoriesTree =
new LinkedList<WikittyQueryResultTreeNode<Category>>();
for (Category c : categories[1]) {
@@ -782,11 +837,111 @@
}
}
- System.out.println("DDDD dates: " + dates + " categoriesTree: " + categoriesTree + " values: " + values);
+ if (log.isDebugEnabled()) {
+ log.debug("budget data\n\t dates: " + dates + "\n\t rootTree: " + categories[1] + "\n\t categoriesTree: " + categoriesTree + "\n\t values: " + values);
+ }
return renderView("dashboardBudget.jsp",
"dates", dates,
"categoriesTree", categoriesTree,
"values", values);
}
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // H R
+ //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public Render vacationFilter(ChoremClient client, String query, String jspRender, EnumSet<VacationStatus> status) {
+ // recuperation des vacances en fonction de leur status
+ WikittyQuery vacationQuery = new WikittyQueryMaker().and()
+ .parse(query)
+ .containsOne(Vacation.FQ_FIELD_VACATION_STATUS, status)
+ .end();
+
+ WikittyQueryResult<Vacation> vacations =
+ client.findAllByQuery(Vacation.class, vacationQuery);
+
+ Map<String, Double> days = new HashMap<String, Double>();
+ for (Vacation v : vacations) {
+ double d = computeVacationDays(v);
+ days.put(v.getWikittyId(), d);
+ }
+
+ return renderView(jspRender,
+ "vacations", vacations.getAll(),
+ "days", days
+ );
+
+ }
+
+ /**
+ * Les vacances demandees par des employes non encore validee.
+ * @param client
+ * @param query
+ * @return
+ */
+ public Render vacationAsked(ChoremClient client, String query) {
+ return vacationFilter(client, query, "dashboardVacationAsked.jsp",
+ EnumSet.of(VacationStatus.ASKED));
+ }
+
+ /**
+ * Les vacances validees
+ * @param client
+ * @param query
+ * @return
+ */
+ public Render vacation(ChoremClient client, String query) {
+ return vacationFilter(client, query, "dashboardVacation.jsp",
+ EnumSet.of(VacationStatus.ACCEPTED));
+ }
+
+ public Render vacationByEmployee(ChoremClient client, String query) {
+ WikittyQuery vacationQuery = new WikittyQueryMaker().and()
+ .parse(query)
+ .eq(Vacation.FQ_FIELD_VACATION_STATUS, VacationStatus.ACCEPTED)
+ .end();
+
+ WikittyQueryResult<Vacation> vacations =
+ client.findAllByQuery(Vacation.class, vacationQuery);
+
+ Map<Employee, Double> days = new MapWithDefault<Employee, Double>(
+ new HashMap<Employee, Double>(), Double.valueOf(0));
+ for(Vacation v : vacations) {
+ Employee e = v.getEmployee(false);
+ double d = days.get(e) + computeVacationDays(v);
+ days.put(e, d);
+ }
+
+ return renderView("dashboardVacationByEmployee.jsp",
+ "vacationByEmployee", days
+ );
+ }
+ /**
+ * Bilan du nombre de jour travaille sur des projets client depuis le 01/01 par employer de la
+ * societe par defaut (Configuration.defaultCompany)
+ */
+ public Render workingProjectDaysByEmployee(ChoremClient client, String query) {
+ WikittyQuery vacationQuery = new WikittyQueryMaker().and()
+ .parse(query)
+ .exteq(Time.EXT_TIME)
+ .end();
+
+ WikittyQueryResult<Time> times =
+ client.findAllByQuery(Time.class, vacationQuery);
+
+ Map<Employee, Double> days = new MapWithDefault<Employee, Double>(
+ new HashMap<Employee, Double>(), Double.valueOf(0));
+ for(Time t : times) {
+ Employee e = t.getEmployee(false);
+ double d = days.get(e) + computeWorkingDays(client, t);
+ days.put(e, d);
+ }
+
+ return renderView("dashboardWorkingProjectDaysByEmployee.jsp",
+ "workingProjectDaysByEmployee", days
+ );
+ }
+
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/injector/InjectorListener.java 2012-08-15 21:37:19 UTC (rev 240)
@@ -22,6 +22,7 @@
*/
package org.chorem.webmotion.injector;
+import java.lang.reflect.Array;
import org.chorem.ChoremClient;
import org.debux.webmotion.server.WebMotionServerListener;
import org.debux.webmotion.server.call.Call;
@@ -30,6 +31,12 @@
import org.debux.webmotion.server.mapping.Mapping;
import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Date;
+import org.apache.commons.beanutils.ConversionException;
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.wikitty.WikittyUtil;
/**
* @author ymartel <martel(a)codelutin.com>
@@ -38,6 +45,11 @@
@Override
public void onStart(ServerContext context) {
+
+ // FIXME poussin 20120815 il y a un probleme avec l'injection du ChoremClient.
+ // a terme, il doit y avoir un ChoremClient instancier pour chaque requete,
+ // car chaque requete est faite par un utilisateur different (token different)
+
// Get Client
String token = "";
final ChoremClient client = ChoremClient.getClient(null);
@@ -52,6 +64,45 @@
return null;
}
});
+
+
+ // ajout d'un converter pour support tous les formats de date (comme wikitty)
+ context.addConverter(new Converter() {
+ @Override
+ public Object convert(Class type, Object value) {
+ if (value.getClass().isArray()) {
+ if (Array.getLength(value) > 0) {
+ value = Array.get(value, 0);
+ } else {
+ value = null;
+ }
+ }
+ if (value instanceof Collection) {
+ Collection collection = (Collection)value;
+ if (collection.size() > 0) {
+ value = collection.iterator().next();
+ } else {
+ value = null;
+ }
+ }
+
+ Object result = null;
+ if (value != null) {
+ if (String.class.isAssignableFrom(type)) {
+ if (StringUtils.isNotBlank((String)value)) {
+ result = WikittyUtil.toString(value);
+ }
+ } else if (Date.class.isAssignableFrom(type)) {
+ result = WikittyUtil.toDate(value);
+ } else {
+ throw new ConversionException(String.format(
+ "Chorem date converter can't convert '%s' to '%s'",
+ value, type));
+ }
+ }
+ return result;
+ }
+ }, Date.class);
}
@Override
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-15 21:37:19 UTC (rev 240)
@@ -320,17 +320,19 @@
protected void renderWikitty(JspWriter output, String contextPath,
String id, Wikitty wikittyValue, String toString)
throws JspException, IOException {
- String url = contextPath + "/wikitty/view/" + id;
- String value = id; // par defaut, si on a pas mieux on met l'id de l'objet
+ if (StringUtils.isNotBlank(id)) {
+ String url = contextPath + "/wikitty/view/" + id;
+ String value = id; // par defaut, si on a pas mieux on met l'id de l'objet
- if (wikittyValue != null) {
- if (StringUtils.isNotBlank(toString)) {
- value = WikittyUtil.format(toString, wikittyValue);
- } else {
- value = wikittyValue.toString();
+ if (wikittyValue != null) {
+ if (StringUtils.isNotBlank(toString)) {
+ value = WikittyUtil.format(toString, wikittyValue);
+ } else {
+ value = wikittyValue.toString();
+ }
}
+ /*{<a href="<%=url%>"><%=value%></a>}*/
}
- /*{<a href="<%=url%>"><%=value%></a>}*/
}
/**
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java 2012-08-15 21:37:19 UTC (rev 240)
@@ -185,7 +185,7 @@
if (date != null) {
value = DateFormatUtils.format(date, "MM/yyyy");
}
- /*{<input class="monthpicker" type="date" name="<%=name%>" value="<%=value%>" <%=getDynamicAttribute()%>/>}*/
+ /*{<input class="monthpicker" type="text" name="<%=name%>" value="<%=value%>" <%=getDynamicAttribute()%>/>}*/
} else if ("time".equals(field.getTagValue("subtype"))) {
if (date != null) {
value = DateFormatUtils.format(date, "HH:mm");
@@ -306,6 +306,8 @@
String url = "";
if (field.hasAllowed()) {
url = contextPath + "/wikitty-json/search?extension=" + field.getAllowed();
+ } else if (field.hasAllowedQuery()) {
+ url = contextPath + "/wikitty-json/search?query=" + field.getAllowedQuery();
} else {
url = contextPath + "/wikitty-json/search?query=";
}
@@ -336,7 +338,15 @@
String id = wikitty.getWikittyId() + "-" + extName + "-" + fieldName;
List<Wikitty> values = wikitty.getFieldAsWikittyList(extName, fieldName, false);
- String url = contextPath + "/wikitty-json/search?extension=" + field.getAllowed();
+// String url = contextPath + "/wikitty-json/search?extension=" + field.getAllowed();
+ String url = "";
+ if (field.hasAllowed()) {
+ url = contextPath + "/wikitty-json/search?extension=" + field.getAllowed();
+ } else if (field.hasAllowedQuery()) {
+ url = contextPath + "/wikitty-json/search?query=" + field.getAllowedQuery();
+ } else {
+ url = contextPath + "/wikitty-json/search?query=";
+ }
String sep = "";
String prePopulate = "[";
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2012-08-15 21:37:19 UTC (rev 240)
@@ -27,12 +27,6 @@
<h1>Budget</h1>
-<form>
- date start: <input type="date" name="start"/>
- end: <input type="date" name="end"/>
- <input type="submit"/>
-</form>
-
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
@@ -51,5 +45,29 @@
</c:forEach>
</tr>
</c:forEach>
+ <tr>
+ <th><span>Sorties</span></th>
+ <c:forEach var="d" items="${dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("debt")}'/></span></td>
+ </c:forEach>
+ </tr>
+ <tr>
+ <th><span>Entrées</span></th>
+ <c:forEach var="d" items="${dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("income")}'/></span></td>
+ </c:forEach>
+ </tr>
+ <tr>
+ <th><span>Total</span></th>
+ <c:forEach var="d" items="${dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("total")}'/></span></td>
+ </c:forEach>
+ </tr>
+ <tr>
+ <th><span>Total cumulé</span></th>
+ <c:forEach var="d" items="${dates}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${values.get(d).get("finances")}'/></span></td>
+ </c:forEach>
+ </tr>
</tbody>
</table>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-15 21:37:19 UTC (rev 240)
@@ -25,7 +25,7 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
-<h1>Invoices</h1>
+<h1>${title}</h1>
<table class="table table-striped table-bordered table-condensed">
<thead>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp 2012-08-15 21:37:19 UTC (rev 240)
@@ -25,10 +25,13 @@
<h1>Financial</h1>
<form>
- <input type="text" name="query"/>
+ date start: <input class="datepicker" type="text" name="start" value="${start}"/>
+ end: <input class="datepicker" type="text" name="end" value="${end}"/>
+ filtre: <input type="text" name="query"/>
<input type="submit"/>
</form>
-<jsp:include page="/fragment/dashboard/invoice?query=${query}"/>
-<jsp:include page="/fragment/dashboard/profitability?query=${query}"/>
-<jsp:include page="/fragment/dashboard/budget?query=${query}"/>
+<jsp:include page="/fragment/dashboard/invoiceDebt"/>
+<jsp:include page="/fragment/dashboard/invoiceIncome"/>
+<jsp:include page="/fragment/dashboard/profitability"/>
+<jsp:include page="/fragment/dashboard/budget"/>
Modified: trunk/chorem-webmotion/src/main/webapp/css/chorem.less
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-13 10:51:21 UTC (rev 239)
+++ trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-15 21:37:19 UTC (rev 240)
@@ -28,9 +28,16 @@
font-weight: bolder;
}
+/* les colonnes de tableau pour certain type ne doivent pas revenir a la ligne*/
td.number, td.currency, td.percent, td.date, td.nowrap {
white-space: nowrap;
}
+
+/* les colonnes de tableau pour certain type doivent etre aligne sur le separateur */
+td.number, td.currency, td.percent {
+ text-align: right;
+}
+
.categorylevel (@level) {
margin-left: @level * 10px;
}
1
0
13 Aug '12
Author: bpoussin
Date: 2012-08-13 12:51:21 +0200 (Mon, 13 Aug 2012)
New Revision: 239
Url: http://chorem.org/repositories/revision/chorem/239
Log:
- correction de champs dans la table des vacances
- amelioration des affichages
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationByEmployee.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardWorkingProjectDaysByEmployee.jsp
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp 2012-08-13 10:20:44 UTC (rev 238)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp 2012-08-13 10:51:21 UTC (rev 239)
@@ -44,8 +44,8 @@
<tbody>
<tr>
<td><w:display wikitty="${q.wikitty}" fqfield="Vacation.employee" label=""/></td>
- <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.beginDate" label=""/></td>
- <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.endDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.endDate" label=""/></td>
<td class="number"><w:display wikitty="${q.wikitty}" toString="${days.get(q.wikittyId)}" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Vacation.type" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Vacation.description" label=""/></td>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp 2012-08-13 10:20:44 UTC (rev 238)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp 2012-08-13 10:51:21 UTC (rev 239)
@@ -42,8 +42,8 @@
<tbody>
<tr>
<td><w:display wikitty="${q.wikitty}" fqfield="Vacation.employee" label=""/></td>
- <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.beginDate" label=""/></td>
- <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.endDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.endDate" label=""/></td>
<td class="number"><w:display wikitty="${q.wikitty}" toString="${days.get(q.wikittyId)}" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Vacation.type" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Vacation.description" label=""/></td>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationByEmployee.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationByEmployee.jsp 2012-08-13 10:20:44 UTC (rev 238)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationByEmployee.jsp 2012-08-13 10:51:21 UTC (rev 239)
@@ -22,13 +22,14 @@
--%>
<%@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" %>
<h1>Vacances par employé</h1>
<ul>
<c:forEach var="q" items="${vacationByEmployee.keySet()}">
- <li><strong>${q}:</strong> <span>${vacationByEmployee.get(q)}</span></li>
+ <li><strong>${q}:</strong> <span><f:formatNumber type="number" value="${vacationByEmployee.get(q)}"/></span></li>
</c:forEach>
</ul>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardWorkingProjectDaysByEmployee.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardWorkingProjectDaysByEmployee.jsp 2012-08-13 10:20:44 UTC (rev 238)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardWorkingProjectDaysByEmployee.jsp 2012-08-13 10:51:21 UTC (rev 239)
@@ -22,11 +22,12 @@
--%>
<%@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" %>
<h1>Jour de travail sur des projets client par employé</h1>
<ul>
<c:forEach var="q" items="${workingProjectDaysByEmployee.keySet()}">
- <li><strong>${q}:</strong> <span>${workingProjectDaysByEmployee.get(q)}</span></li>
+ <li><strong>${q}:</strong> <span><f:formatNumber type="number" value="${workingProjectDaysByEmployee.get(q)}"/></span></li>
</c:forEach>
</ul>
1
0
r238 - in trunk/chorem-webmotion/src/main/webapp: WEB-INF/jsp css
by bpoussin@users.chorem.org 13 Aug '12
by bpoussin@users.chorem.org 13 Aug '12
13 Aug '12
Author: bpoussin
Date: 2012-08-13 12:20:44 +0200 (Mon, 13 Aug 2012)
New Revision: 238
Url: http://chorem.org/repositories/revision/chorem/238
Log:
- formattage de toutes les colonnes des dashboards
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp
trunk/chorem-webmotion/src/main/webapp/css/chorem.less
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,7 @@
--%>
<%@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"%>
<h1>Budget</h1>
@@ -46,7 +47,7 @@
<tr>
<td><span class="level level${c.level}" level="${c.level}">${c.userObject}</span></td>
<c:forEach var="d" items="${dates}">
- <td><span>${values.get(d).get(c.userObject)}</span></td>
+ <td class="currency"><span><f:formatNumber type="currency" value="${values.get(d).get(c.userObject)}"/></span></td>
</c:forEach>
</tr>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,7 @@
--%>
<%@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"%>
<h1>Invoices</h1>
@@ -49,10 +50,10 @@
<td><w:display wikitty="${q.wikitty}" fqfield="Invoice.description" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Invoice.customer" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Invoice.supplier" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.amount" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.postedDate" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.expectedDate" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.paymentDate" label=""/></td>
+ <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Invoice.amount" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.postedDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.expectedDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.paymentDate" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
@@ -61,7 +62,7 @@
<dl class="dl-horizontal">
- <dt>Total</dt><dd>${amount}</dd>
- <dt>Total paid</dt><dd>${amountPaid}</dd>
- <dt>Total expected</dt><dd>${amountExpected}</dd>
+ <dt>Total</dt><dd><f:formatNumber type="currency" value="${amount}"/></dd>
+ <dt>Total paid</dt><dd><f:formatNumber type="currency" value="${amountPaid}"/></dd>
+ <dt>Total expected</dt><dd><f:formatNumber type="currency" value="${amountExpected}"/></dd>
</dl>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,8 @@
--%>
<%@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"%>
<h1>${title}</h1>
@@ -48,14 +50,14 @@
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/></td>
<td><w:display wikitty="${q.wikitty}" toString="%Quotation.description$s" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
- <td>${taskInfos.get(q.wikittyId).workingDays}</td>
- <td>${taskInfos.get(q.wikittyId).hopedPriceDay}</td>
- <td>${taskInfos.get(q.wikittyId).realPriceDay}</td>
- <td>${taskInfos.get(q.wikittyId).hopedProfit}</td>
- <td>${taskInfos.get(q.wikittyId).realProfit}</td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
+ <td class="number"><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
+ <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
+ <td class="number"><f:formatNumber type="number" value="${taskInfos.get(q.wikittyId).workingDays}"/></td>
+ <td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).hopedPriceDay}"/></td>
+ <td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).realPriceDay}"/></td>
+ <td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).hopedProfit}"/></td>
+ <td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).realProfit}"/></td>
+ <td class="nowrap"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
@@ -63,8 +65,8 @@
</table>
<dl class="dl-horizontal">
- <dt>Total amount</dt><dd>${amount}</dd>
- <dt>Total hoped profit</dt><dd>${hopedProfit}</dd>
- <dt>Total real profit</dt><dd>${realProfit}</dd>
- <dt>Profit discordance</dt><dd>${realProfit - hopedProfit}</dd>
+ <dt>Total amount</dt><dd><f:formatNumber type="currency" value="${amount}"/></dd>
+ <dt>Total hoped profit</dt><dd><f:formatNumber type="currency" value="${hopedProfit}"/></dd>
+ <dt>Total real profit</dt><dd><f:formatNumber type="currency" value="${realProfit}"/></dd>
+ <dt>Profit discordance</dt><dd><f:formatNumber type="currency" value="${realProfit - hopedProfit}"/></dd>
</dl>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,7 @@
--%>
<%@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"%>
<h1>${title}</h1>
@@ -51,12 +52,12 @@
<td><w:display wikitty="${q.wikitty}" toString="%Quotation.description$s" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.supplier" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
- <td>${taskInfos.get(q.wikittyId).workingDays}</td>
- <td>${taskInfos.get(q.wikittyId).opened}</td>
- <td>${taskInfos.get(q.wikittyId).closed}</td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
+ <td class="number"><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
+ <td class="number"><f:formatNumber type="number" value="${taskInfos.get(q.wikittyId).workingDays}"/></td>
+ <td class="number"><f:formatNumber type="number" value="${taskInfos.get(q.wikittyId).opened}"/></td>
+ <td class="number"><f:formatNumber type="number" value="${taskInfos.get(q.wikittyId).closed}"/></td>
+ <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
+ <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
@@ -65,7 +66,7 @@
<dl class="dl-horizontal">
- <dt>Total amount</dt><dd>${amount}</dd>
- <dt>Total task opened</dt><dd>${opened}</dd>
- <dt>Total task closed</dt><dd>${closed}</dd>
+ <dt>Total amount</dt><dd><f:formatNumber type="currency" value="${amount}"/></dd>
+ <dt>Total task opened</dt><dd><f:formatNumber type="number" value="${opened}"/></dd>
+ <dt>Total task closed</dt><dd><f:formatNumber type="number" value="${closed}"/></dd>
</dl>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,7 @@
--%>
<%@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"%>
<h1>${title}</h1>
@@ -50,11 +51,11 @@
<td><w:display wikitty="${q.wikitty}" toString="%Quotation.description$s" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.supplier" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></td>
- <td>${q.amount / q.estimatedDays}</td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
- <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
+ <td class="number"><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
+ <td class="percent"><w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></td>
+ <td class="currency"><f:formatNumber type="currency" value="${q.amount / q.estimatedDays}"/></td>
+ <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
+ <td class="nowrap"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
@@ -63,6 +64,6 @@
<dl class="dl-horizontal">
- <dt>Total</dt><dd>${amount}</dd>
- <dt>Hope</dt><dd>${amountHope}</dd>
+ <dt>Total</dt><dd><f:formatNumber type="currency" value="${amount}"/></dd>
+ <dt>Hope</dt><dd><f:formatNumber type="currency" value="${amountHope}"/></dd>
</dl>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacation.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,8 @@
--%>
<%@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"%>
<h1>Vacances</h1>
@@ -41,12 +43,12 @@
<c:forEach var="q" items="${vacations}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.employee}"/>">${q.getEmployee(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Vacation/view/${q.wikittyId}"/>">${q.beginDate}</a></td>
- <td>${q.endDate}</td>
- <td>${days.get(q.wikittyId)}</td>
- <td>${q.type}</td>
- <td>${q.description}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.employee" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.beginDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.endDate" label=""/></td>
+ <td class="number"><w:display wikitty="${q.wikitty}" toString="${days.get(q.wikittyId)}" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.type" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.description" label=""/></td>
</tr>
</tbody>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationAsked.jsp 2012-08-13 10:20:44 UTC (rev 238)
@@ -22,6 +22,8 @@
--%>
<%@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"%>
<h1>Vacances en attente d'agrément</h1>
@@ -39,12 +41,12 @@
<c:forEach var="q" items="${vacations}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.employee}"/>">${q.getEmployee(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Vacation/view/${q.wikittyId}"/>">${q.beginDate}</a></td>
- <td>${q.endDate}</td>
- <td>${days.get(q.wikittyId)}</td>
- <td>${q.type}</td>
- <td>${q.description}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.employee" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.beginDate" label=""/></td>
+ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Vacation.endDate" label=""/></td>
+ <td class="number"><w:display wikitty="${q.wikitty}" toString="${days.get(q.wikittyId)}" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.type" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.description" label=""/></td>
</tr>
</tbody>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/css/chorem.less
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-12 11:39:19 UTC (rev 237)
+++ trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-13 10:20:44 UTC (rev 238)
@@ -28,6 +28,9 @@
font-weight: bolder;
}
+td.number, td.currency, td.percent, td.date, td.nowrap {
+ white-space: nowrap;
+}
.categorylevel (@level) {
margin-left: @level * 10px;
}
@@ -47,4 +50,3 @@
span.level5 {
.categorylevel (5);
}
-
1
0
r237 - in trunk: chorem-entities/src/main/xmi chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/java/org/wikitty/web/jsptag chorem-webmotion/src/main/webapp/css
by bpoussin@users.chorem.org 12 Aug '12
by bpoussin@users.chorem.org 12 Aug '12
12 Aug '12
Author: bpoussin
Date: 2012-08-12 13:39:19 +0200 (Sun, 12 Aug 2012)
New Revision: 237
Url: http://chorem.org/repositories/revision/chorem/237
Log:
- formatage des nombres pour l'edition
- on laisse les % tel que l'utilisateur les ecrits (pas de conversion pour le stockage)
Modified:
trunk/chorem-entities/src/main/xmi/chorem-model.properties
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java
trunk/chorem-webmotion/src/main/webapp/css/chorem.less
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-08 17:45:19 UTC (rev 236)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-12 11:39:19 UTC (rev 237)
@@ -161,7 +161,7 @@
#
# Quotation
#
-org.chorem.entities.Quotation.class.tagvalue.version=15.0
+org.chorem.entities.Quotation.class.tagvalue.version=16.0
org.chorem.entities.Quotation.class.tagvalue.preload=Quotation.project;Quotation.customer;Quotation.supplier;Quotation.category
org.chorem.entities.Quotation.class.tagvalue.toString=%Interval.beginDate$tF-%Interval.endDate$tF %Quotation.reference|noref$s(%Quotation.category|noCategory$s) %Quotation.description|nodescription$s
org.chorem.entities.Quotation.class.tagvalue.sortOrder=Interval.beginDate desc,Interval.endDate,Quotation.reference,Quotation.type,Quotation.description
@@ -178,7 +178,7 @@
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.help=Pourcentage de r\u00e9ussite du projet
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.subtype=percent
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.min=0
-org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.max=1
+org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.max=100
org.chorem.entities.Quotation.attribute.status.tagvalue.help=\u00c9tat d'avancement de ce devis
org.chorem.entities.Quotation.attribute.vrsPeriod.tagvalue.help=Nombre de jour de VSR (Validation en Service R\u00e9gulier)
org.chorem.entities.Quotation.attribute.vrsPeriod.tagvalue.subtype=integer
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2012-08-08 17:45:19 UTC (rev 236)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2012-08-12 11:39:19 UTC (rev 237)
@@ -23,6 +23,7 @@
package org.chorem.webmotion.actions;
+import java.text.NumberFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.ChoremClient;
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-08 17:45:19 UTC (rev 236)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-12 11:39:19 UTC (rev 237)
@@ -225,7 +225,10 @@
if ("currency".equalsIgnoreCase(subtype)) {
formatter = NumberFormat.getCurrencyInstance();
} else if ("percent".equalsIgnoreCase(subtype)) {
- formatter = NumberFormat.getPercentInstance();
+ // on utilise pas NumberFormat.getPercentInstance();
+ // car il divise tout seul par 100, ce qu'on ne souhaite pas
+ // on veut affichage=stockage
+ formatter = new DecimalFormat("#,##0 '%'");
} else if ("integer".equalsIgnoreCase(subtype)) {
formatter = NumberFormat.getIntegerInstance();
} else {
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java 2012-08-08 17:45:19 UTC (rev 236)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java 2012-08-12 11:39:19 UTC (rev 237)
@@ -40,6 +40,7 @@
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.math.BigDecimal;
+import java.text.NumberFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -207,7 +208,9 @@
Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
BigDecimal value = wikitty.getFieldAsBigDecimal(extName, fieldName);
- /*{<input type="text" name="<%=name%>" value="<%=value%>"<%=getDynamicAttribute()%>/>}*/
+ NumberFormat formatter = NumberFormat.getNumberInstance();
+ String formattedValue = formatter.format(value);
+ /*{<input type="text" name="<%=name%>" value="<%=formattedValue%>"<%=getDynamicAttribute()%>/>}*/
}
protected void inputString(JspWriter output, String contextPath, String name,
Modified: trunk/chorem-webmotion/src/main/webapp/css/chorem.less
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-08 17:45:19 UTC (rev 236)
+++ trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2012-08-12 11:39:19 UTC (rev 237)
@@ -13,6 +13,16 @@
padding: 0px;
}
+.ui-autocomplete {
+ max-height: 250px;
+ max-width: 500px;
+ overflow-y: auto;
+ /* prevent horizontal scrollbar */
+ overflow-x: hidden;
+ /* add padding to account for vertical scrollbar */
+ padding-right: 20px;
+}
+
.ui-autocomplete-category {
color: rgba(82, 168, 236, 0.796875);
font-weight: bolder;
1
0