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
February 2013
- 2 participants
- 22 discussions
24 Feb '13
Author: bpoussin
Date: 2013-02-24 04:00:17 +0100 (Sun, 24 Feb 2013)
New Revision: 317
Url: http://chorem.org/projects/chorem/repository/revisions/317
Log:
certain client on change de nom, il faut supporter les deux
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java
Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-23 18:22:33 UTC (rev 316)
+++ trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-24 03:00:17 UTC (rev 317)
@@ -455,6 +455,13 @@
System.out.println(String.format("%s contracts loaded", count));
}
+ protected String getPayerId(String proposed, String codelutin) {
+ if (StringUtils.equals(codelutin, proposed)) {
+ return null;
+ }
+ return proposed;
+ }
+
@Step(4)
public void importInvoices(String filename) {
System.out.println(String.format("Try to import invoices '%s'", filename));
@@ -497,6 +504,18 @@
Set<String> unknowCustomers = new HashSet<String>();
for (Company c : customerResult) {
customers.put(c.getName(), c.getWikittyId());
+ // ajout d'alias pour certain client qui ont change de nom
+ if ("Ecole des Mines Nantes - EMN".equals(c.getName())) {
+ customers.put("Ecole des Mines Nantes", c.getWikittyId());
+ } else if ("IRSTEA".equals(c.getName())) {
+ customers.put("Cemagref", c.getWikittyId());
+ } else if ("IRSTEA".equals(c.getName())) {
+ customers.put("Cemagref", c.getWikittyId());
+ } else if ("Herboristerie Cailleau".equals(c.getName())) {
+ customers.put("Cailleau Herboristerie", c.getWikittyId());
+ } else if ("XWiki SAS".equals(c.getName())) {
+ customers.put("XPertNet", c.getWikittyId());
+ }
}
// Pour les supplier
@@ -537,7 +556,8 @@
InvoiceImpl invoice = new InvoiceImpl();
invoice.setCategory(categories.get(category));
invoice.setBeneficiary(codeLutinId);
- invoice.setPayer(customers.get(company));
+ // code lutin, ne peut pas etre le beneficiaire et le payer en meme temps
+ invoice.setPayer(getPayerId(customers.get(company), codeLutinId));
invoice.setReference(number);
invoice.setAmount(amount);
invoice.setVAT(19.6);
1
0
r316 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 23 Feb '13
by bpoussin@users.chorem.org 23 Feb '13
23 Feb '13
Author: bpoussin
Date: 2013-02-23 19:22:33 +0100 (Sat, 23 Feb 2013)
New Revision: 316
Url: http://chorem.org/projects/chorem/repository/revisions/316
Log:
petites amelioration
Modified:
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/webapp/WEB-INF/jsp/dashboardSummary.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp
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 2013-02-23 02:47:03 UTC (rev 315)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2013-02-23 18:22:33 UTC (rev 316)
@@ -70,21 +70,20 @@
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 );
}
public Render reindex(ChoremClient client) {
client.syncSearchEngine();
- return renderSuccess();
+ getContext().addInfoMessage("message", "Database reindexed");
+
+ return renderRedirect("/");
}
public Render doImport(ChoremClient client, UploadFile file) throws FileNotFoundException {
WikittyImportExportService ies = new WikittyImportExportService(client);
Reader in = new BufferedReader(new FileReader(file.getFile()));
ies.syncImport(WikittyImportExportService.FORMAT.CSV, in);
- return renderSuccess();
+ return renderRedirect("/admin/importExport");
}
public Render doExport(ChoremClient client, String query) {
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 2013-02-23 02:47:03 UTC (rev 315)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-02-23 18:22:33 UTC (rev 316)
@@ -327,12 +327,16 @@
Date firstDay = DateUtil.setFirstDayOfYear(dates.get("firstDate"));
Date lastDay = DateUtil.setLastDayOfYear(dates.get("lastDate"));
+ firstDay = DateUtil.setMinTimeOfDay(firstDay);
+ lastDay = DateUtil.setMaxTimeOfDay(lastDay);
+
log.debug(String.format("date: %s", dates));
Map<Date, Map<String, Object>> result = new TreeMap<Date, Map<String, Object>>();
Date currentFirst = firstDay;
Date currentLast = DateUtil.setLastDayOfYear(firstDay);
+ currentLast = DateUtil.setMaxTimeOfDay(currentLast);
while (currentLast.compareTo(lastDay) <= 0) {
Map<String, Object> values = getDebtIncome(client,
currentFirst, currentLast, companyId);
@@ -355,7 +359,10 @@
Date firstDayYear = DateUtil.setFirstDayOfYear(now);
Date lastYearNow = DateUtils.addYears(now, -1);
Date lastYearFirstDay = DateUtil.setFirstDayOfYear(lastYearNow);
-
+
+ firstDayYear = DateUtil.setMinTimeOfDay(firstDayYear);
+ lastYearFirstDay = DateUtil.setMinTimeOfDay(lastYearFirstDay);
+
String companyId = client.getConfiguration().getDefaultCompany();
// toutes les depenses depuis le debut de l'annee
@@ -372,7 +379,7 @@
.select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
.and()
.exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
- .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
+ .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
.lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, inOneWeek)
.isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
.containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
@@ -384,7 +391,7 @@
.select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
.and()
.exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
- .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
+ .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
.lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, now)
.isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
.containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
@@ -706,15 +713,16 @@
WikittyQuery invoiceQuery = new WikittyQueryMaker().and()
.parse(filter)
.parse(query)
- .exteq(Invoice.EXT_INVOICE)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
.or()
- .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end)
- .isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE)
- .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start, end)
- .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end)
+ .isNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start, end)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end)
.end().setLimit(WikittyQuery.MAX);
- ChoremQueryHelper.addSort(client, invoiceQuery, Invoice.EXT_INVOICE);
+ ChoremQueryHelper.addSort(client, invoiceQuery, FinancialTransaction.EXT_FINANCIALTRANSACTION);
WikittyQueryResult<Invoice> invoices =
client.findAllByQuery(Invoice.class, invoiceQuery);
@@ -800,6 +808,9 @@
start = DateUtil.setFirstDayOfMonth(start);
end = DateUtil.setLastDayOfMonth(end);
+ start = DateUtil.setMinTimeOfDay(start);
+ end = DateUtil.setMaxTimeOfDay(end);
+
// La somme des factures que la company doit payer jusqu'a la date demandee
WikittyQuery debt = new ChoremQueryMaker()
.select()
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-02-23 02:47:03 UTC (rev 315)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-02-23 18:22:33 UTC (rev 316)
@@ -41,7 +41,7 @@
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&query=FinancialTransaction.paymentDate=null and FinancialTransaction.expectedDate<${now}"/>'>
+ <a href='<c:url value="/report?report=invoiceIncome&start=01/01/2000&end=01/01/2222&query=FinancialTransaction.paymentDate=null and FinancialTransaction.expectedDate<${now}"/>'>
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}"/>'>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-02-23 02:47:03 UTC (rev 315)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-02-23 18:22:33 UTC (rev 316)
@@ -26,9 +26,9 @@
<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 class="datepicker input-small" type="text" name="start" value="${fn:escapeXml(start)}" placeholder="date from"/>
+ <input class="datepicker input-small" type="text" name="end" value="${fn:escapeXml(end)}" placeholder="date to"/>
+ <input class="input-xxlarge" type="text" name="query" value="${fn:escapeXml(query)}" placeholder="filter query"/>
<input type="submit" class="btn"/>
</form>
1
0
r315 - in trunk: chorem-entities/src/main/java/org/chorem chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/resources chorem-webmotion/src/main/webapp/WEB-INF/jsp chorem-webmotion/src/main/webapp/WEB-INF/jsp/admin
by bpoussin@users.chorem.org 23 Feb '13
by bpoussin@users.chorem.org 23 Feb '13
23 Feb '13
Author: bpoussin
Date: 2013-02-23 03:47:03 +0100 (Sat, 23 Feb 2013)
New Revision: 315
Url: http://chorem.org/projects/chorem/repository/revisions/315
Log:
ajout de nouvelle fonction d'admin (reindexation, import/export)
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/admin/
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/admin/importExport.jsp
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java
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/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-02-22 22:40:22 UTC (rev 314)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-02-23 02:47:03 UTC (rev 315)
@@ -216,7 +216,7 @@
//org.chorem.entities.WikittyTreeNode.attribute.parent.tagvalue.help=La catégorie Parente de celle-ci (ex: dépense pour Loyer)
//org.chorem.entities.WikittyTreeNode.attribute.parent.tagvalue.allowed=Category
WikittyExtension e = org.nuiton.wikitty.entities.WikittyTreeNodeAbstract.extensionWikittyTreeNode;
- e.setVersion(WikittyUtil.incrementMajorRevision(e.getVersion())); // toujours faire attention d'etre a +1 par rapport a l'objet genere
+ e.setVersion(WikittyUtil.incrementMajorRevision(e.getTagValue("version"))); // toujours faire attention d'etre a +1 par rapport a l'objet genere
e.getFieldType("name").addTagValue("help", "Le nom pour cette catégorie (ex: dépense, Salaire, ...)");
e.getFieldType("attachment").addTagValue("visible", "false");
e.getFieldType("parent").addTagValue("help", "La catégorie Parente de celle-ci (ex: dépense pour Loyer)");
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java 2013-02-22 22:40:22 UTC (rev 314)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java 2013-02-23 02:47:03 UTC (rev 315)
@@ -44,7 +44,7 @@
// args = "--clear -ic /tmp/chorem-company.csv -ip /tmp/chorem-person.csv -ie /tmp/chorem-employee.csv --import-contract-type /tmp/chorem-contracttype.csv --import-contract /tmp/chorem-contract.csv --commit".split(" ");
// args = "-ic /tmp/chorem-company.csv --commit".split(" ");
// args = "--removeObject Invoice".split(" ");
- args = "-ii /tmp/bill.csv --import-costs /tmp/cost.csv --commit".split(" ");
+// args = "--removeObject Invoice -ii /tmp/bill.csv --import-costs /tmp/cost.csv --commit".split(" ");
// args = "--reindex".split(" ");
System.out.println(String.format("Launching ChoremMain ... (args: %s)", Arrays.toString(args)));
// getConfig do all: parse and doAllAction
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 2013-02-22 22:40:22 UTC (rev 314)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdminAction.java 2013-02-23 02:47:03 UTC (rev 315)
@@ -23,15 +23,30 @@
package org.chorem.webmotion.actions;
+import com.kenai.jaffl.annotations.Pinned;
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.InputStreamReader;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.Reader;
import java.text.NumberFormat;
+import javassist.bytecode.ByteArray;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.ChoremClient;
import org.chorem.entities.Configuration;
import org.debux.webmotion.server.WebMotionController;
+import org.debux.webmotion.server.call.UploadFile;
import org.debux.webmotion.server.render.Render;
+import org.nuiton.wikitty.addons.WikittyImportExportService;
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
+import org.nuiton.wikitty.query.WikittyQueryParser;
/**
*
@@ -60,4 +75,24 @@
// "client", client, "id", conf.getWikittyId(), "extension", null );
}
+ public Render reindex(ChoremClient client) {
+ client.syncSearchEngine();
+ return renderSuccess();
+ }
+
+ public Render doImport(ChoremClient client, UploadFile file) throws FileNotFoundException {
+ WikittyImportExportService ies = new WikittyImportExportService(client);
+ Reader in = new BufferedReader(new FileReader(file.getFile()));
+ ies.syncImport(WikittyImportExportService.FORMAT.CSV, in);
+ return renderSuccess();
+ }
+
+ public Render doExport(ChoremClient client, String query) {
+ WikittyImportExportService ies = new WikittyImportExportService(client);
+ WikittyQuery q = new WikittyQueryParser().parseQuery(query);
+ String result = ies.syncExportAllByQuery(WikittyImportExportService.FORMAT.CSV, q);
+ ByteArrayInputStream in = new ByteArrayInputStream(result.getBytes());
+ return renderStream(in, "text/csv", "UTF-8");
+ }
+
}
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 2013-02-22 22:40:22 UTC (rev 314)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-02-23 02:47:03 UTC (rev 315)
@@ -414,14 +414,6 @@
int invoiceIncomeNb = invoices[1].getTotalResult();
// montant total de toutes les factures
double invoiceIncome = invoices[1].peek();
-// TODO a garder en Map pour permettre l'ajout de lien sur la requete
-// // montant total de toutes les factures
-// double annualDebt = (Double)annualDebtIncome.get("debts");
-// double annualIncome = (Double)annualDebtIncome.get("incomes");
-//
-// // montant total de toutes les factures
-// double lastYearAnnualDebt = (Double)pastAnnualDebtIncome.get("debts");
-// double lastYearAnnualIncome = (Double)pastAnnualDebtIncome.get("incomes");
int touchNb = touchs.getTotalResult();
@@ -437,10 +429,6 @@
"invoiceIncome", invoiceIncome,
"annualDebtIncome", annualDebtIncome,
"pastAnnualDebtIncome", pastAnnualDebtIncome,
-// "annualDebt", annualDebt,
-// "annualIncome", annualIncome,
-// "lastYearAnnualDebt", lastYearAnnualDebt,
-// "lastYearAnnualIncome", lastYearAnnualIncome,
"touchNb", touchNb,
"touchQueryString", touchQueryString
);
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2013-02-22 22:40:22 UTC (rev 314)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2013-02-23 02:47:03 UTC (rev 315)
@@ -46,6 +46,7 @@
* /fragment/dashboardHR/{method} action:DashboardHRAction.{method}
* /fragment/sales/{method} action:sales.SalesAction.{method}
* /admin view:contact.jsp
+* /admin/importExport view:admin/importExport.jsp
* /admin/{method} action:AdminAction.{method}
* /contact view:contact.jsp
* /report view:report.jsp
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/admin/importExport.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/admin/importExport.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/admin/importExport.jsp 2013-02-23 02:47:03 UTC (rev 315)
@@ -0,0 +1,15 @@
+<%@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>Import</h1>
+<form action="<c:url value="/admin/doImport"/>" method="POST" enctype="multipart/form-data">
+ <input type="file" name="file"/>
+ <input type="submit" value="Import"/>
+</form>
+
+<h1>Export</h1>
+<form action="<c:url value="/admin/doExport"/>" method="POST">
+ <input type="text" name="query"/>
+ <input type="submit" value="Export"/>
+</form>
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-02-22 22:40:22 UTC (rev 314)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-02-23 02:47:03 UTC (rev 315)
@@ -197,6 +197,10 @@
<li><a href="<c:url value="/wikitty/WikittyUser/edit/new"/>"><i class="icon-plus icon-black"></i> Add user</a></li>
<li class="divider"></li>
<li><a href="<c:url value="/admin/variables"/>">Variables</a></li>
+ <li class="divider"></li>
+ <li><a href="<c:url value="/admin/importExport"/>">Import/Export</a></li>
+ <li class="divider"></li>
+ <li><a href="<c:url value="/admin/reindex"/>">Reindex</a></li>
</ul>
</li>
</ul>
1
0
r314 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 22 Feb '13
by bpoussin@users.chorem.org 22 Feb '13
22 Feb '13
Author: bpoussin
Date: 2013-02-22 23:40:22 +0100 (Fri, 22 Feb 2013)
New Revision: 314
Url: http://chorem.org/projects/chorem/repository/revisions/314
Log:
on peut cliquer sur les chiffres pour voir la liste des objets
utilise pour le calcul
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.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 2013-02-22 22:14:26 UTC (rev 313)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-02-22 22:40:22 UTC (rev 314)
@@ -69,6 +69,8 @@
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
import org.nuiton.wikitty.query.WikittyQueryResultTreeNode;
+import org.nuiton.wikitty.query.conditions.Condition;
+import org.nuiton.wikitty.query.conditions.Select;
/**
*
@@ -166,7 +168,8 @@
// toutes les depenses depuis le debut de l'annee
WikittyQuery debtQuery = new ChoremQueryMaker()
.select()
- .sum((String)null, "debts")
+ .sum(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT, "debts")
+ .sum((String)null, "debtsTTC")
.function("#amountTTC")
.fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
.fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
@@ -253,31 +256,52 @@
/**
* Retourne le total des entree et sortie entre deux dates, les valeurs retournees sont:
*
- * <li>debts: le montant TTC
+ * <li>debts: le montant HT (ne veut pas forcement dire grand chose, ex declaration TVA)
+ * <li>debtsTTC: le montant TTC
* <li>incomes: le montant total HT des factures
* <li>incomesTTC: le montant total TTC des factures
* <li>extraIncomes: le montant total HT des revenus hors facture
* <li>extraIncomesTTC: le montant total TTC des revenus hors factures
*
+ * <li>debtsQuery: la condition sous forme texte qui a permit de calculer les depenses
+ * <li>incomesQuery: la condition sous forme texte qui a permit de calculer les entrees
+ * <li>extraIncomesQuery: la condition sous forme texte qui a permit de calculer les entrees supplementaire
+ *
* @param client
* @param first
* @param last
* @param companyId
* @return
*/
- protected Map<String, Double> getDebtIncome(ChoremClient client,
+ protected Map<String, Object> getDebtIncome(ChoremClient client,
Date first, Date last, String companyId) {
+ WikittyQuery debt = getDebtQuery(first, last, companyId);
+ WikittyQuery income = getIncomeInvoiceQuery(first, last, companyId);
+ WikittyQuery extraIncome = getExtraIncomeQuery(first, last, companyId);
+
+ // on recupere les condition qui ont permit de faire le calcule
+ Condition[] cond = new Condition[3];
+ cond[0] = ((Select)debt.getCondition()).getSubCondition();
+ cond[1] = ((Select)income.getCondition()).getSubCondition();
+ cond[2] = ((Select)extraIncome.getCondition()).getSubCondition();
+
+
List<WikittyQuery> queries = new ArrayList<WikittyQuery>(3);
- queries.add(getDebtQuery(first, last, companyId));
- queries.add(getIncomeInvoiceQuery(first, last, companyId));
- queries.add(getExtraIncomeQuery(first, last, companyId));
+ queries.add(debt);
+ queries.add(income);
+ queries.add(extraIncome);
List<Map<String, Double>> values = client.findByQueryAsMap(
Double.class, queries);
- Map<String, Double> aggregate = new HashMap<String, Double>();
- for (Map<String, Double> m : values) {
+ Map aggregate = new HashMap<String, Object>();
+ for (Map m : values) {
aggregate.putAll(m);
}
+
+ aggregate.put("debtsQuery", ((Select)debt.getCondition()).getSubCondition().toString());
+ aggregate.put("incomesQuery", ((Select)income.getCondition()).getSubCondition().toString());
+ aggregate.put("extraIncomesQuery", ((Select)extraIncome.getCondition()).getSubCondition().toString());
+
return aggregate;
}
@@ -305,12 +329,12 @@
log.debug(String.format("date: %s", dates));
- Map<Date, Map<String, Double>> result = new TreeMap<Date, Map<String, Double>>();
+ Map<Date, Map<String, Object>> result = new TreeMap<Date, Map<String, Object>>();
Date currentFirst = firstDay;
Date currentLast = DateUtil.setLastDayOfYear(firstDay);
while (currentLast.compareTo(lastDay) <= 0) {
- Map<String, Double> values = getDebtIncome(client,
+ Map<String, Object> values = getDebtIncome(client,
currentFirst, currentLast, companyId);
result.put(currentFirst, values);
currentFirst = DateUtils.addYears(currentFirst, 1);
@@ -335,9 +359,9 @@
String companyId = client.getConfiguration().getDefaultCompany();
// toutes les depenses depuis le debut de l'annee
- Map<String, Double> annualDebtIncome = getDebtIncome(client,
+ Map<String, Object> annualDebtIncome = getDebtIncome(client,
firstDayYear, now, companyId);
- Map<String, Double> pastAnnualDebtIncome = getDebtIncome(client,
+ Map<String, Object> pastAnnualDebtIncome = getDebtIncome(client,
lastYearFirstDay, lastYearNow, companyId);
// WikittyQuery[] annualDebtIncomeQuery = getDebtIncomeQuery(firstDayYear, now, companyId);
@@ -390,15 +414,15 @@
int invoiceIncomeNb = invoices[1].getTotalResult();
// montant total de toutes les factures
double invoiceIncome = invoices[1].peek();
+// TODO a garder en Map pour permettre l'ajout de lien sur la requete
+// // montant total de toutes les factures
+// double annualDebt = (Double)annualDebtIncome.get("debts");
+// double annualIncome = (Double)annualDebtIncome.get("incomes");
+//
+// // montant total de toutes les factures
+// double lastYearAnnualDebt = (Double)pastAnnualDebtIncome.get("debts");
+// double lastYearAnnualIncome = (Double)pastAnnualDebtIncome.get("incomes");
- // montant total de toutes les factures
- double annualDebt = annualDebtIncome.get("debts");
- double annualIncome = annualDebtIncome.get("incomes");
-
- // montant total de toutes les factures
- double lastYearAnnualDebt = pastAnnualDebtIncome.get("debts");
- double lastYearAnnualIncome = pastAnnualDebtIncome.get("incomes");
-
int touchNb = touchs.getTotalResult();
String touchQueryString = touchQuery.getCondition().toString();
@@ -411,10 +435,12 @@
"invoiceDebt", invoiceDebt,
"invoiceIncomeNb", invoiceIncomeNb,
"invoiceIncome", invoiceIncome,
- "annualDebt", annualDebt,
- "annualIncome", annualIncome,
- "lastYearAnnualDebt", lastYearAnnualDebt,
- "lastYearAnnualIncome", lastYearAnnualIncome,
+ "annualDebtIncome", annualDebtIncome,
+ "pastAnnualDebtIncome", pastAnnualDebtIncome,
+// "annualDebt", annualDebt,
+// "annualIncome", annualIncome,
+// "lastYearAnnualDebt", lastYearAnnualDebt,
+// "lastYearAnnualIncome", lastYearAnnualIncome,
"touchNb", touchNb,
"touchQueryString", touchQueryString
);
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp 2013-02-22 22:14:26 UTC (rev 313)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp 2013-02-22 22:40:22 UTC (rev 314)
@@ -39,14 +39,43 @@
</tr>
<c:forEach var="q" items="${annualProfit.keySet()}">
<tr>
- <th><f:formatDate pattern="yyyy" value="${q}"/></th>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomes')}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC')}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('extraIncomes')}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('extraIncomesTTC')}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('debts')}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC') - annualProfit.get(q).get('debts')}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC') + annualProfit.get(q).get('extraIncomesTTC') - annualProfit.get(q).get('debts')}"/></td>
+ <th>
+ <c:set var="year"><f:formatDate pattern="yyyy" value="${q}"/></c:set>
+ <a href='<c:url value="/report?report=budget&start=01/01/${year}&end=31/12/${year}"/>'>
+ ${year}
+ </a>
+ </th>
+ <td>
+ <a href='<c:url value="/wikitty/search?query=${annualProfit.get(q).get('incomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('incomes')}"/>
+ </a>
+ </td>
+ <td>
+ <a href='<c:url value="/wikitty/search?query=${annualProfit.get(q).get('incomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC')}"/>
+ </a>
+ </td>
+ <td>
+ <a href='<c:url value="/wikitty/search?query=${annualProfit.get(q).get('extraIncomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('extraIncomes')}"/>
+ </a>
+ </td>
+ <td>
+ <a href='<c:url value="/wikitty/search?query=${annualProfit.get(q).get('extraIncomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('extraIncomesTTC')}"/>
+ </a>
+ </td>
+ <td>
+ <a href='<c:url value="/wikitty/search?query=${annualProfit.get(q).get('debtsQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('debtsTTC')}"/>
+ </a>
+ </td>
+ <td>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC') - annualProfit.get(q).get('debtsTTC')}"/>
+ </td>
+ <td>
+ <f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC') + annualProfit.get(q).get('extraIncomesTTC') - annualProfit.get(q).get('debtsTTC')}"/>
+ </td>
</tr>
</c:forEach>
</table>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-02-22 22:14:26 UTC (rev 313)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-02-22 22:40:22 UTC (rev 314)
@@ -49,9 +49,31 @@
</ul>
<ul>
- <li>Chiffre d'affaire TTC: <strong><f:formatNumber type="currency" value="${annualIncome*1.196}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome*1.196}"/></strong>)
- <li>Dépenses: <strong><f:formatNumber type="currency" value="${annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualDebt}"/></strong>)
- <li>Bénéfice/perte: <strong><f:formatNumber type="currency" value="${annualIncome*1.196-annualDebt}"/></strong> (N-1: <strong><f:formatNumber type="currency" value="${lastYearAnnualIncome*1.196-lastYearAnnualDebt}"/></strong>)
+ <li>Chiffre d'affaire TTC:
+ <strong>
+ <a href='<c:url value="/wikitty/search?query=${annualDebtIncome.get('incomesQuery')} or ${annualDebtIncome.get('extraIncomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualDebtIncome.get('incomes') + annualDebtIncome.get('extraIncomes')}"/>
+ </a>
+ </strong>
+ (N-1: <strong>
+ <a href='<c:url value="/wikitty/search?query=${pastAnnualDebtIncome.get('incomesQuery')} or ${pastAnnualDebtIncome.get('extraIncomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${pastAnnualDebtIncome.get('incomes') + pastAnnualDebtIncome.get('extraIncomes')}"/>
+ </a>
+ </strong>)
+ <li>Dépenses:
+ <strong>
+ <a href='<c:url value="/wikitty/search?query=${annualDebtIncome.get('debtsQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${annualDebtIncome.get('debtsTTC')}"/>
+ </a>
+ </strong>
+ (N-1: <strong>
+ <a href='<c:url value="/wikitty/search?query=${pastAnnualDebtIncome.get('debtsQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${pastAnnualDebtIncome.get('debtsTTC')}"/>
+ </a>
+ </strong>)
+ <li>Bénéfice/perte:
+ <strong><f:formatNumber type="currency" value="${annualDebtIncome.get('incomesTTC') + annualDebtIncome.get('extraIncomes') - annualDebtIncome.get('debtsTTC')}"/></strong>
+ (N-1: <strong><f:formatNumber type="currency" value="${pastAnnualDebtIncome.get('incomesTTC') + pastAnnualDebtIncome.get('extraIncomes') - pastAnnualDebtIncome.get('debtsTTC')}"/></strong>)
</ul>
</div>
</div>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp 2013-02-22 22:14:26 UTC (rev 313)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp 2013-02-22 22:40:22 UTC (rev 314)
@@ -41,7 +41,7 @@
<th><span>TVA payer</span></th>
<c:forEach var="d" items="${data.values()}">
<td class="currency">
- <a href='<c:url value="/wikitty/search?query=${d.get('vatDebtQuery')}"/>'>
+ <a href='<c:url value="/wikitty/search?query=${d.get('vatDebtQuery')} %23limit=2147483647"/>'>
<span><f:formatNumber type="currency" value='${d.get("vatDebt")}'/></span>
</a>
</td>
@@ -51,7 +51,7 @@
<th><span>TVA encaissé</span></th>
<c:forEach var="d" items="${data.values()}">
<td class="currency">
- <a href='<c:url value="/wikitty/search?query=${d.get('vatIncomeQuery')}"/>'>
+ <a href='<c:url value="/wikitty/search?query=${d.get('vatIncomeQuery')} %23limit=2147483647"/>'>
<span><f:formatNumber type="currency" value='${d.get("vatIncome")}'/></span>
</a>
</td>
1
0
22 Feb '13
Author: bpoussin
Date: 2013-02-22 23:14:26 +0100 (Fri, 22 Feb 2013)
New Revision: 313
Url: http://chorem.org/projects/chorem/repository/revisions/313
Log:
modif pour reellement supporter le multi-domain sur la meme
instance
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremConfig.java
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-02-22 22:13:13 UTC (rev 312)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-02-22 22:14:26 UTC (rev 313)
@@ -46,7 +46,9 @@
import org.nuiton.wikitty.query.WikittyQueryResult;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* Proxy pour l'application. Certaines methodes specifiques pour l'application
@@ -54,7 +56,7 @@
*/
public class ChoremClient extends WikittyClient {
- static protected WikittyService ws = null;
+ static protected Map<String, WikittyService> ws = new HashMap<String, WikittyService>();
protected ChoremClient(ApplicationConfig config, WikittyService ws) {
super(config, ws);
@@ -146,10 +148,13 @@
* @return WikittyService instance
*/
static protected WikittyService getWikittyService(ApplicationConfig config) {
- if (ws == null) {
- synchronized(ChoremClient.class) {
- if (ws == null) {
- ws = WikittyServiceFactory.buildWikittyService(config);
+ String domain = config.getOption(ChoremConfigOption.CHOREM_DOMAIN.getKey());
+ WikittyService result = ws.get(domain);
+ if (result == null) {
+ synchronized(ws) {
+ result = ws.get(domain);
+ if (result == null) {
+ result = WikittyServiceFactory.buildWikittyService(config);
// register last entity versions in database
List<WikittyExtension> exts = new ArrayList<WikittyExtension>();
@@ -217,12 +222,13 @@
e.getFieldType("parent").addTagValue("help", "La catégorie Parente de celle-ci (ex: dépense pour Loyer)");
e.getFieldType("parent").addTagValue("allowed", "Category");
- ws.storeExtension(null, exts);
+ result.storeExtension(null, exts);
+ ws.put(domain, result);
}
}
}
- return ws;
+ return result;
}
/**
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremConfig.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremConfig.java 2013-02-22 22:13:13 UTC (rev 312)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremConfig.java 2013-02-22 22:14:26 UTC (rev 313)
@@ -22,6 +22,8 @@
*/
package org.chorem;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.commons.lang.UnhandledException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -37,7 +39,7 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(ChoremConfig.class);
- static protected ApplicationConfig config = null;
+ static protected Map<String, ApplicationConfig> config = new HashMap<String, ApplicationConfig>();
/**
* constructeur public seulement pour pouvoir mettre une variable de ce
@@ -55,34 +57,37 @@
* @return
*/
public static ApplicationConfig getConfig(String domain, String... args) {
- if (config == null) {
- synchronized (ChoremConfig.class) {
- if (config == null) {
+ ApplicationConfig result = config.get(domain);
+ if (result == null) {
+ synchronized (config) {
+ result = config.get(domain);
+ if (result == null) {
try {
- config = new ApplicationConfig(
+ result = new ApplicationConfig(
ChoremConfigOption.CONFIG_FILE.getDefaultValue());
// Load wikitty options
- config.loadDefaultOptions(WikittyConfigOption.values());
+ result.loadDefaultOptions(WikittyConfigOption.values());
// Load chorem options
- config.loadDefaultOptions(ChoremConfigOption.values());
+ result.loadDefaultOptions(ChoremConfigOption.values());
// Load chorem action
- config.loadActions(ChoremConfigAction.values());
+ result.loadActions(ChoremConfigAction.values());
// set domain before parse command line but after load default
if (StringUtils.isNotBlank(domain)) {
- config.setOption(
+ result.setOption(
ChoremConfigOption.CHOREM_DOMAIN.getKey(),
domain);
}
// Parse args
- config.parse(args);
+ result.parse(args);
// on fait toutes les actions
- config.doAllAction();
+ result.doAllAction();
+ config.put(domain, result);
} catch (Exception eee) {
log.error("Can't create chorem configuration", eee);
throw new UnhandledException(eee);
@@ -90,7 +95,7 @@
}
}
}
- return config;
+ return result;
}
}
1
0
22 Feb '13
Author: bpoussin
Date: 2013-02-22 23:13:13 +0100 (Fri, 22 Feb 2013)
New Revision: 312
Url: http://chorem.org/projects/chorem/repository/revisions/312
Log:
correction: on mettait dans l'id du payer, le nom de la societe au lieu de l'id
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java
Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-22 22:09:45 UTC (rev 311)
+++ trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-22 22:13:13 UTC (rev 312)
@@ -537,7 +537,7 @@
InvoiceImpl invoice = new InvoiceImpl();
invoice.setCategory(categories.get(category));
invoice.setBeneficiary(codeLutinId);
- invoice.setPayer(company);
+ invoice.setPayer(customers.get(company));
invoice.setReference(number);
invoice.setAmount(amount);
invoice.setVAT(19.6);
1
0
r311 - in trunk/chorem-webmotion/src/main/webapp: WEB-INF/jsp css
by bpoussin@users.chorem.org 22 Feb '13
by bpoussin@users.chorem.org 22 Feb '13
22 Feb '13
Author: bpoussin
Date: 2013-02-22 23:09:45 +0100 (Fri, 22 Feb 2013)
New Revision: 311
Url: http://chorem.org/projects/chorem/repository/revisions/311
Log:
on ne permet pas les retours a la ligne dans les noms des categories
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.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 2013-02-22 22:08:37 UTC (rev 310)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2013-02-22 22:09:45 UTC (rev 311)
@@ -39,7 +39,7 @@
<tbody>
<c:forEach var="c" items="${data.categoriesTree}">
<tr>
- <td><span class="level level${c.level}" level="${c.level}">${c.userObject}</span></td>
+ <td class="header"><span class="level level${c.level}" level="${c.level}">${c.userObject}</span></td>
<c:forEach var="d" items="${data.dates}">
<td class="currency">
<c:choose>
Modified: trunk/chorem-webmotion/src/main/webapp/css/chorem.less
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2013-02-22 22:08:37 UTC (rev 310)
+++ trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2013-02-22 22:09:45 UTC (rev 311)
@@ -38,6 +38,9 @@
text-align: right;
}
+td.header {
+ white-space: nowrap;
+}
/* L'affiche du calendrier sur la page d'accueil */
.calendar{
1
0
22 Feb '13
Author: bpoussin
Date: 2013-02-22 23:08:37 +0100 (Fri, 22 Feb 2013)
New Revision: 310
Url: http://chorem.org/projects/chorem/repository/revisions/310
Log:
on escape le texte de la zone de recherche pour que ca ne
casse pas le HTML
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-02-21 19:19:48 UTC (rev 309)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-02-22 22:08:37 UTC (rev 310)
@@ -22,6 +22,7 @@
--%>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
<?xml version="1.0" encoding="UTF-8" ?>
@@ -201,7 +202,7 @@
</ul>
<form class="navbar-search pull-left" action="<c:url value="/wikitty/search"/>">
- <input type="text" class="search-query" placeholder="Search" name="query" value="${param.query}"/>
+ <input type="text" class="search-query" placeholder="Search" name="query" value="${fn:escapeXml(param.query)}"/>
</form>
</div>
1
0
r309 - in trunk: . chorem-entities/src/main/java/org/chorem chorem-entities/src/test/java/org/chorem chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/resources chorem-webmotion/src/main/webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 21 Feb '13
by bpoussin@users.chorem.org 21 Feb '13
21 Feb '13
Author: bpoussin
Date: 2013-02-21 20:19:48 +0100 (Thu, 21 Feb 2013)
New Revision: 309
Url: http://chorem.org/projects/chorem/repository/revisions/309
Log:
budget, annualProfit fonctionne
ajout d'un rapport pour aider a la declaration de la TVA mensuel
mise a jour des menus
Added:
trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java
trunk/chorem-entities/src/test/java/org/chorem/ChoremUtilTest.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremQueryMaker.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp
trunk/pom.xml
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremQueryMaker.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremQueryMaker.java 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremQueryMaker.java 2013-02-21 19:19:48 UTC (rev 309)
@@ -84,4 +84,36 @@
return this;
}
+ //
+ // Des methodes utilisables en function dans les select
+ //
+
+ /**
+ * Applique la vat sur le montant et retourne le total.
+ * ex: amount = 100 et vat = 19.6 le resultat sera 119.6
+ *
+ *
+ * @param amount
+ * @param vat
+ * @return
+ */
+ static public double amountTTC(double amount, double vat) {
+ double result = amount * (1+vat/100);
+ return result;
+ }
+
+ /**
+ * Calcul la TVA du par rapport au montant.
+ * ex: amount = 100 et vat = 19.6 le resultat sera 19.6
+ *
+ *
+ * @param amount
+ * @param vat
+ * @return
+ */
+ static public double amountVAT(double amount, double vat) {
+ double result = amount * vat / 100;
+ return result;
+ }
+
}
Added: trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java (rev 0)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java 2013-02-21 19:19:48 UTC (rev 309)
@@ -0,0 +1,48 @@
+package org.chorem;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class ChoremUtil {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(ChoremUtil.class);
+
+ final static public String DEFAULT_SEPARATOR_LIST = ",";
+
+ /**
+ * Transforme un tableau en une liste, si un element du tableau utilise
+ * le separateur alors, il est lui meme decoupe pour que chaque element
+ * finisse dans la liste retournee
+ *
+ * @param separator le separateur a utiliser (si null, alors DEFAULT_SEPARATOR_LIST est utilise)
+ * @param s
+ * @return
+ */
+ static public List<String> asList(String separator, String ... array) {
+ if (separator == null) {
+ separator = DEFAULT_SEPARATOR_LIST;
+ }
+ List<String> result = new ArrayList<String>();
+ for (String s : array) {
+ String[] tmp = StringUtils.split(s, separator);
+ for (String t : tmp) {
+ result.add(t);
+ }
+ }
+ return result;
+ }
+}
Added: trunk/chorem-entities/src/test/java/org/chorem/ChoremUtilTest.java
===================================================================
--- trunk/chorem-entities/src/test/java/org/chorem/ChoremUtilTest.java (rev 0)
+++ trunk/chorem-entities/src/test/java/org/chorem/ChoremUtilTest.java 2013-02-21 19:19:48 UTC (rev 309)
@@ -0,0 +1,30 @@
+package org.chorem;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class ChoremUtilTest {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(ChoremUtilTest.class);
+
+ @Test
+ public void testAsList() {
+ String ext = "Company,Employee,Person";
+ String[] tab = new String[]{"Company","Employee,Person"};
+
+ Assert.assertEquals(ChoremUtil.asList(null, ext), ChoremUtil.asList(null, tab));
+ }
+
+}
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 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-02-21 19:19:48 UTC (rev 309)
@@ -23,10 +23,12 @@
package org.chorem.webmotion.actions;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -67,7 +69,6 @@
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
import org.nuiton.wikitty.query.WikittyQueryResultTreeNode;
-import org.nuiton.wikitty.query.conditions.Aggregate;
/**
*
@@ -149,68 +150,168 @@
//
////////////////////////////////////////////////////////////////////////////
- protected WikittyQuery[] getDebtIncomeQuery(Date first, Date last, String companyId) {
+ /**
+ * Cette requete comporte un select retournant un nombre nomme:
+ * <li>debts: le montant TTC
+ *
+ * Le calcul se fait sur toutes les FinancialTransaction non annulee
+ *
+ * @param first
+ * @param last
+ * @param companyId l'identifiant de la company dont elle ou un de ses employers
+ * doit etre en Payer
+ * @return
+ */
+ protected WikittyQuery getDebtQuery(Date first, Date last, String companyId) {
// toutes les depenses depuis le debut de l'annee
WikittyQuery debtQuery = new ChoremQueryMaker()
- .select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .select()
+ .sum((String)null, "debts")
+ .function("#amountTTC")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
.and()
- .exteq(Invoice.EXT_FINANCIALTRANSACTION)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
.not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
- .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
- .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.end().setLimit(WikittyQuery.MAX);
+ return debtQuery;
+ }
+
+ /**
+ * Cette requete comporte un select retournant deux nombre nomme:
+ * <li>incomes: le montant total HT des factures
+ * <li>incomesTTC: le montant total TTC des factures
+ *
+ * Le calcul se fait uniquement sur les Invoices
+ *
+ * @param first
+ * @param last
+ * @param companyId l'identifiant de la company dont elle ou un de ses employers
+ * doit etre en Beneficiary
+ * @return
+ */
+ protected WikittyQuery getIncomeInvoiceQuery(Date first, Date last, String companyId) {
// toutes les factures emises depuis le debut de l'annee
WikittyQuery incomeQuery = new ChoremQueryMaker()
- .select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .select()
+ .sum(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT, "incomes")
+ .sum((String)null, "incomesTTC")
+ .function("#amountTTC")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
.and()
- .exteq(Invoice.EXT_FINANCIALTRANSACTION)
+ .exteq(Invoice.EXT_INVOICE)
.not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
- .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
- .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.end().setLimit(WikittyQuery.MAX);
-
- WikittyQuery[] result = new WikittyQuery[]{
- debtQuery, incomeQuery
- };
- return result;
+
+ return incomeQuery;
}
/**
+ * Cette requete comporte un select retournant deux nombre nomme:
+ * <li>extraIncomes: le montant total HT des factures
+ * <li>extraIncomesTTC: le montant total TTC des factures
+ *
+ * Le calcul se fait sur toutes les FinancialTransaction qui ne sont pas aussi Invoice
+ *
+ * @param first
+ * @param last
+ * @param companyId l'identifiant de la company dont elle ou un de ses employers
+ * doit etre en Beneficiary
+ * @return
+ */
+ protected WikittyQuery getExtraIncomeQuery(Date first, Date last, String companyId) {
+ // toutes les factures emises depuis le debut de l'annee
+ WikittyQuery incomeQuery = new ChoremQueryMaker()
+ .select()
+ .sum(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT, "extraIncomes")
+ .sum((String)null, "extraIncomesTTC")
+ .function("#amountTTC")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
+ .and()
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .extne(Invoice.EXT_INVOICE)
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, first, last)
+ .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
+ .select(Element.ID).filterOnCompanyOrEmployee(companyId)
+ .end().setLimit(WikittyQuery.MAX);
+
+ return incomeQuery;
+ }
+
+ /**
+ * Retourne le total des entree et sortie entre deux dates, les valeurs retournees sont:
+ *
+ * <li>debts: le montant TTC
+ * <li>incomes: le montant total HT des factures
+ * <li>incomesTTC: le montant total TTC des factures
+ * <li>extraIncomes: le montant total HT des revenus hors facture
+ * <li>extraIncomesTTC: le montant total TTC des revenus hors factures
+ *
+ * @param client
+ * @param first
+ * @param last
+ * @param companyId
+ * @return
+ */
+ protected Map<String, Double> getDebtIncome(ChoremClient client,
+ Date first, Date last, String companyId) {
+ List<WikittyQuery> queries = new ArrayList<WikittyQuery>(3);
+ queries.add(getDebtQuery(first, last, companyId));
+ queries.add(getIncomeInvoiceQuery(first, last, companyId));
+ queries.add(getExtraIncomeQuery(first, last, companyId));
+
+ List<Map<String, Double>> values = client.findByQueryAsMap(
+ Double.class, queries);
+ Map<String, Double> aggregate = new HashMap<String, Double>();
+ for (Map<String, Double> m : values) {
+ aggregate.putAll(m);
+ }
+ return aggregate;
+ }
+
+ /**
* Dashbord qui indique pour toutes les annees du systeme le CA et les depenses
* @param client
* @return
*/
public Render annualProfit(ChoremClient client) {
- Map<Date, Double[]> result = new TreeMap<Date, Double[]>();
String companyId = client.getConfiguration().getDefaultCompany();
// La premiere annee
- WikittyQuery firstDateQuery = new WikittyQueryMaker()
- .select().min(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE)
- .exteq(Invoice.EXT_INVOICE)
+ WikittyQuery dateQuery = new WikittyQueryMaker()
+ .select()
+ .min(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, "firstDate")
+ .max(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, "lastDate")
+ .where()
+ .exteq(Invoice.EXT_INVOICE)
.end().setLimit(WikittyQuery.MAX);
- // La derniere annee
- WikittyQuery lastDateQuery = new WikittyQueryMaker()
- .select().max(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE)
- .exteq(Invoice.EXT_INVOICE)
- .end().setLimit(WikittyQuery.MAX);
- Date[] dates = client.findByQuery(Date.class, firstDateQuery, lastDateQuery);
- Date firstDay = DateUtil.setFirstDayOfYear(dates[0]);
- Date lastDay = DateUtil.setLastDayOfYear(dates[1]);
- log.debug(String.format("first date: %s last date: %s", dates[0], dates[1]));
-
+ Map<String, Date> dates = client.findByQueryAsMap(Date.class, dateQuery);
+ Date firstDay = DateUtil.setFirstDayOfYear(dates.get("firstDate"));
+ Date lastDay = DateUtil.setLastDayOfYear(dates.get("lastDate"));
+
+ log.debug(String.format("date: %s", dates));
+
+ Map<Date, Map<String, Double>> result = new TreeMap<Date, Map<String, Double>>();
+
Date currentFirst = firstDay;
Date currentLast = DateUtil.setLastDayOfYear(firstDay);
while (currentLast.compareTo(lastDay) <= 0) {
- WikittyQuery[] annualDebtIncomeQuery =
- getDebtIncomeQuery(currentFirst, currentLast, companyId);
- Double[] values = client.findByQuery(Double.class,
- annualDebtIncomeQuery[0], annualDebtIncomeQuery[1]);
+ Map<String, Double> values = getDebtIncome(client,
+ currentFirst, currentLast, companyId);
result.put(currentFirst, values);
currentFirst = DateUtils.addYears(currentFirst, 1);
currentLast = DateUtils.addYears(currentLast, 1);
@@ -234,14 +335,20 @@
String companyId = client.getConfiguration().getDefaultCompany();
// toutes les depenses depuis le debut de l'annee
- WikittyQuery[] annualDebtIncomeQuery = getDebtIncomeQuery(firstDayYear, now, companyId);
- WikittyQuery[] pastAnnualDebtIncomeQuery = getDebtIncomeQuery(lastYearFirstDay, lastYearNow, companyId);
+ Map<String, Double> annualDebtIncome = getDebtIncome(client,
+ firstDayYear, now, companyId);
+ Map<String, Double> pastAnnualDebtIncome = getDebtIncome(client,
+ lastYearFirstDay, lastYearNow, companyId);
+// WikittyQuery[] annualDebtIncomeQuery = getDebtIncomeQuery(firstDayYear, now, companyId);
+// WikittyQuery[] pastAnnualDebtIncomeQuery = getDebtIncomeQuery(lastYearFirstDay, lastYearNow, companyId);
+
// les factures que notre societe doit payer au plus tard dans 7 jours
WikittyQuery invoiceDebtQuery = new ChoremQueryMaker()
.select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
.and()
- .exteq(Invoice.EXT_INVOICE)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
.lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, inOneWeek)
.isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
.containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
@@ -252,14 +359,15 @@
WikittyQuery invoiceIncomeQuery = new ChoremQueryMaker()
.select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
.and()
- .exteq(Invoice.EXT_INVOICE)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name())
.lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, now)
.isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
.containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.end().setLimit(WikittyQuery.MAX);
- // les contacts qui doivnet etre pris dans les 7 prochains jours
+ // les contacts qui doivent etre pris dans les 7 prochains jours
WikittyQuery touchQuery = new WikittyQueryMaker().and()
.exteq(Touch.EXT_TOUCH)
.lt(Interval.FQ_FIELD_INTERVAL_BEGINDATE, inOneWeek)
@@ -268,9 +376,7 @@
WikittyQueryResult<Double>[] invoices =
client.findAllByQuery(Double.class,
- invoiceDebtQuery, invoiceIncomeQuery,
- annualDebtIncomeQuery[0], annualDebtIncomeQuery[1],
- pastAnnualDebtIncomeQuery[0], pastAnnualDebtIncomeQuery[1]);
+ invoiceDebtQuery, invoiceIncomeQuery);
WikittyQueryResult<String> touchs =
client.findAllByQuery(touchQuery);
@@ -286,12 +392,12 @@
double invoiceIncome = invoices[1].peek();
// montant total de toutes les factures
- double annualDebt = invoices[2].peek();
- double annualIncome = invoices[3].peek();
+ double annualDebt = annualDebtIncome.get("debts");
+ double annualIncome = annualDebtIncome.get("incomes");
// montant total de toutes les factures
- double lastYearAnnualDebt = invoices[4].peek();
- double lastYearAnnualIncome = invoices[5].peek();
+ double lastYearAnnualDebt = pastAnnualDebtIncome.get("debts");
+ double lastYearAnnualIncome = pastAnnualDebtIncome.get("incomes");
int touchNb = touchs.getTotalResult();
@@ -682,45 +788,58 @@
// La somme des factures que la company doit payer jusqu'a la date demandee
WikittyQuery debt = new ChoremQueryMaker()
- .select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .select()
+ .sum((String)null, "debts")
+ .function("#amountTTC")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
.and()
- .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.close()
.not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED)
.or()
.and()
- .isNotNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
- .lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start)
+ .isNotNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
+ .lt(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start)
.close()
.and()
- .isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
- .lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start)
+ .isNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
+ .lt(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start)
.end()
.setLimit(WikittyQuery.MAX);
// La somme des factures que la company doit percevoir jusqu'a la date demandee
WikittyQuery income = new ChoremQueryMaker()
- .select().sum(Invoice.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .select()
+ .sum((String)null, "incomes")
+ .function("#amountTTC")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
.and()
- .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .containsOne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.close()
.not().eq(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED)
.or()
.and()
- .isNotNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
- .lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start)
+ .isNotNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
+ .lt(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start)
.close()
.and()
- .isNull(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
- .lt(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start)
+ .isNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE)
+ .lt(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start)
.end()
.setLimit(WikittyQuery.MAX);
// La liste des factures entre les deux dates que l'on doit payer
WikittyQuery invoiceDebt = new ChoremQueryMaker().and()
.parse(query)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
.containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.close()
@@ -739,6 +858,7 @@
// La liste des factures entre les deux dates que l'on doit payer
WikittyQuery invoiceIncome = new ChoremQueryMaker().and()
.parse(query)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
.containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
.select(Element.ID).filterOnCompanyOrEmployee(companyId)
.close()
@@ -870,16 +990,19 @@
String date = DateFormatUtils.format(d, budgetDateFormat);
Category c = invoice.getCategory(false);
double amount = invoice.getAmount();
+ double vat = invoice.getVAT();
- addAmount(date, c, amount);
+ double ttc = ChoremQueryMaker.amountTTC(amount, vat);
+
+ addAmount(date, c, ttc);
addInvoice(date, c, invoice);
if (debt) {
- addDebt(date, amount);
- addTotal(date, -amount);
+ addDebt(date, ttc);
+ addTotal(date, -ttc);
} else {
- addIncome(date, amount);
- addTotal(date, amount);
+ addIncome(date, ttc);
+ addTotal(date, ttc);
}
}
@@ -957,6 +1080,142 @@
}
}
+
+ /**
+ * Retourne le total de la tva entree et sortie entre deux dates, les valeurs retournees sont:
+ *
+ * <li>(Double)vatDebt: le montant de la tva sur les depenses
+ * <li>(Double)vatIncome: le montant de la tva sur les entrees
+ * <li>(String)vatDebtQuery: la query permettant de retrouve les factures utilise
+ * <li>(String)vatIncomeQuery: la query permettant de retrouve les factures utilise
+ *
+ * @param client
+ * @param start
+ * @param end
+ * @param companyId
+ * @return
+ */
+ protected Map<String, Object> getVAT(ChoremClient client,
+ Date start, Date end, String query, String companyId) {
+
+ // La liste des factures entre les deux dates que l'on doit payer
+ WikittyQuery vatDebtQuery = new ChoremQueryMaker()
+ .and()
+ .parse(query)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYER)
+ .select(Element.ID).filterOnCompanyOrEmployee(companyId)
+ .close()
+ .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED)
+ .isNotNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .ne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT, 0)
+ .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end)
+ .end()
+ .setLimit(WikittyQuery.MAX);
+
+ WikittyQuery vatDebt = new ChoremQueryMaker()
+ .select()
+ .sum((String)null, "vatDebt")
+ .function("#amountVAT")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
+ .condition(vatDebtQuery.getCondition())
+ .end()
+ .setLimit(WikittyQuery.MAX);
+
+ // La liste des factures entre les deux dates que l'on doit payer
+ WikittyQuery vatIncomeQuery = new ChoremQueryMaker()
+ .and()
+ .parse(query)
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
+ .containsOne(Invoice.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY)
+ .select(Element.ID).filterOnCompanyOrEmployee(companyId)
+ .close()
+ .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED)
+ .isNotNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .ne(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT, 0)
+ .bw(Invoice.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end)
+ .end()
+ .setLimit(WikittyQuery.MAX);
+
+ // La liste des factures entre les deux dates que l'on doit payer
+ WikittyQuery vatIncome = new ChoremQueryMaker()
+ .select()
+ .sum((String)null, "vatIncome")
+ .function("#amountVAT")
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT)
+ .fieldValue(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT)
+ .where()
+ .condition(vatIncomeQuery.getCondition())
+ .end()
+ .setLimit(WikittyQuery.MAX);
+
+
+ Double[] values = client.findByQuery(Double.class, vatDebt, vatIncome);
+ Map<String, Object> aggregate = new HashMap<String, Object>();
+ aggregate.put("vatDebt", values[0]);
+ aggregate.put("vatIncome", values[1]);
+
+ aggregate.put("vatDebtQuery", vatDebtQuery.getCondition().toString());
+ aggregate.put("vatIncomeQuery", vatIncomeQuery.getCondition().toString());
+
+ return aggregate;
+ }
+
+ /**
+ * Prévisionnel entre deux dates en fonction des factures
+ */
+ public Render vat(ChoremClient client, Date start, Date end, String query) {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format(
+ "vat for period '%s' to '%s' with filter '%s'",
+ start, end, query));
+ }
+ String companyId = client.getConfiguration().getDefaultCompany();
+
+ 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, -6);
+ }
+
+ if (end == null) {
+ end = DateUtils.addMonths(start, 6);
+ }
+
+ start = DateUtil.setFirstDayOfMonth(start);
+ end = DateUtil.setLastDayOfMonth(end);
+
+ start = DateUtil.setMinTimeOfDay(start);
+ end = DateUtil.setMaxTimeOfDay(end);
+
+
+ Map<Date, Map<String, Object>> data = new LinkedHashMap<Date, Map<String, Object>>();
+
+ Date currentFirst = start;
+ Date currentLast = DateUtil.setLastDayOfMonth(start);
+ while (currentLast.compareTo(end) <= 0) {
+ Map<String, Object> vat = getVAT(client, currentFirst, currentLast, query, companyId);
+ data.put(currentFirst, vat);
+ currentFirst = DateUtils.addMonths(currentFirst, 1);
+ currentLast = DateUtils.addMonths(currentLast, 1);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format(
+ "vat for period '%s' to '%s' with filter '%s = %s'",
+ start, end, query, data));
+ }
+
+ return renderView("dashboardVAT.jsp", "data", data);
+ }
+
+
////////////////////////////////////////////////////////////////////////////
//
// H R
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2013-02-21 19:19:48 UTC (rev 309)
@@ -62,6 +62,8 @@
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import org.chorem.ChoremUtil;
+import org.nuiton.wikitty.WikittyUtil;
/**
*
@@ -161,7 +163,7 @@
// S'il y a des extensions on force la requete sur ces types d'extension
if (extension != null) {
maker = new WikittyQueryMaker().and()
- .extContainsOne(Arrays.asList(extension));
+ .extContainsOne(ChoremUtil.asList(null, extension));
} else {
maker = new WikittyQueryMaker();
}
@@ -199,7 +201,7 @@
Set<String> exts = null;
if (extension != null && extension.length > 0) {
- exts = new HashSet<String>(Arrays.asList(extension));
+ exts = new HashSet<String>(ChoremUtil.asList(null, extension));
}
Set<String> extExcluded = new HashSet<String>(client.getConfig().getOptionAsList(
@@ -313,7 +315,7 @@
}
} else {
// utilisation des extensions demande en parametre
- extNames = Arrays.asList(extension);
+ extNames = ChoremUtil.asList(null, extension);
expliciteExtension = true;
}
@@ -416,7 +418,7 @@
exts.addAll(w.getExtensions());
} else {
// Display the extensions and required ones for them
- List<String> extensionNames = Arrays.asList(extension);
+ List<String> extensionNames = ChoremUtil.asList(null, extension);
List<WikittyExtension> wikittyExtensions = client.restoreExtensionAndDependenciesLastVesion(extensionNames);
exts.addAll(wikittyExtensions);
}
@@ -447,7 +449,8 @@
return renderView("view.jsp", "wikitty", w, "extensions", exts, "viewActions", viewActions);
}
- public Render edit(ChoremClient client, String id, String[] extension, Call call) {
+ public Render edit(ChoremClient client, String id, Boolean copy,
+ String[] extension, Call call) {
log.debug("edit: " + id);
// on preload rien, le preload sera fait a la fin
Wikitty w = client.restore(id, "");
@@ -455,6 +458,11 @@
// si on ne retrouve pas l'objet demande, on en edit un nouveau
if (w == null) {
w = new WikittyImpl();
+ } else if (copy != null && copy) {
+ // on copie le wikitty trouve pour qu'a la sauvegarde ce soit un nouveau qui soit creer
+ WikittyImpl newW = new WikittyImpl();
+ newW.replaceWith(w, true);
+ w = newW;
}
LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
@@ -464,7 +472,7 @@
exts.addAll(w.getExtensions());
} else {
// Be sure that the wikitty has good extension if wanted and their requirements
- List<String> extensionNames = Arrays.asList(extension);
+ List<String> extensionNames = ChoremUtil.asList(null, extension);
List<WikittyExtension> newExts =
client.restoreExtensionAndDependenciesLastVesion(extensionNames);
w.addExtension(newExts);
@@ -495,13 +503,12 @@
if (extension != null) {
// Be sure that the wikitty has good extension if wanted and their requirements
- List<String> extensionNames = Arrays.asList(extension);
+ List<String> extensionNames = ChoremUtil.asList(null, extension);
newExts = client.restoreExtensionAndDependenciesLastVesion(extensionNames);
exts.addAll(newExts);
}
- String[] idArrays = StringUtils.split(ids, ",");
- List<Wikitty> ws = client.restore(Arrays.asList(idArrays));
+ List<Wikitty> ws = client.restore(ChoremUtil.asList(null, ids));
ArrayList<Integer> newW = new ArrayList<Integer>();
int index = 0;
@@ -575,7 +582,7 @@
w = new WikittyImpl();
}
List<WikittyExtension> exts =
- client.restoreExtensionAndDependenciesLastVesion(Arrays.asList(extension));
+ client.restoreExtensionAndDependenciesLastVesion(ChoremUtil.asList(null, extension));
w.addExtension(exts);
Map<String, Object> params = call.getExtractParameters();
String error = setWikittyField(w, "", params);
@@ -601,7 +608,7 @@
String[] extension = (String[]) params.get(id + ".extension");
List<WikittyExtension> exts =
- client.restoreExtensionAndDependenciesLastVesion(Arrays.asList(extension));
+ client.restoreExtensionAndDependenciesLastVesion(ChoremUtil.asList(null, extension));
w.addExtension(exts);
String error = setWikittyField(w, id + ".", params);
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2013-02-21 19:19:48 UTC (rev 309)
@@ -31,6 +31,7 @@
* /wikitty/searchRelated?id={query} action:GenericAction.search
* /wikitty/view/{id} action:GenericAction.view
* /wikitty/edit/{id} action:GenericAction.edit
+* /wikitty/copy/{id} action:GenericAction.edit copy=true
* /wikitty/editMulti/{ids} action:GenericAction.editMulti
* /wikitty/delete/{id} action:GenericAction.delete
* /wikitty/save action:GenericAction.save
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAnnualProfit.jsp 2013-02-21 19:19:48 UTC (rev 309)
@@ -31,16 +31,22 @@
<th>Année</th>
<th>CA HT</th>
<th>CA TTC</th>
+ <th>Autre revenu HT</th>
+ <th>Autre revenu TTC</th>
<th>Dépense</th>
+ <th>CA TTC - Dépense</th>
<th>Bénéfice/perte</th>
</tr>
<c:forEach var="q" items="${annualProfit.keySet()}">
<tr>
<th><f:formatDate pattern="yyyy" value="${q}"/></th>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q)[1]}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q)[1]*1.196}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q)[0]}"/></td>
- <td><f:formatNumber type="currency" value="${annualProfit.get(q)[1]*1.196 - annualProfit.get(q)[0]}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomes')}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC')}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('extraIncomes')}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('extraIncomesTTC')}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('debts')}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC') - annualProfit.get(q).get('debts')}"/></td>
+ <td><f:formatNumber type="currency" value="${annualProfit.get(q).get('incomesTTC') + annualProfit.get(q).get('extraIncomesTTC') - annualProfit.get(q).get('debts')}"/></td>
</tr>
</c:forEach>
</table>
Copied: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp (from rev 307, trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp)
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVAT.jsp 2013-02-21 19:19:48 UTC (rev 309)
@@ -0,0 +1,67 @@
+<%--
+ #%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"%>
+
+<h1>Budget</h1>
+
+<table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Mois</th>
+ <c:forEach var="d" items="${data.keySet()}">
+ <th><f:formatDate pattern="MM/yyyy" value="${d}"/></th>
+ </c:forEach>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th><span>TVA payer</span></th>
+ <c:forEach var="d" items="${data.values()}">
+ <td class="currency">
+ <a href='<c:url value="/wikitty/search?query=${d.get('vatDebtQuery')}"/>'>
+ <span><f:formatNumber type="currency" value='${d.get("vatDebt")}'/></span>
+ </a>
+ </td>
+ </c:forEach>
+ </tr>
+ <tr>
+ <th><span>TVA encaissé</span></th>
+ <c:forEach var="d" items="${data.values()}">
+ <td class="currency">
+ <a href='<c:url value="/wikitty/search?query=${d.get('vatIncomeQuery')}"/>'>
+ <span><f:formatNumber type="currency" value='${d.get("vatIncome")}'/></span>
+ </a>
+ </td>
+ </c:forEach>
+ </tr>
+ <tr>
+ <th><span>TVA à déclarer</span></th>
+ <c:forEach var="d" items="${data.values()}">
+ <td class="currency"><span><f:formatNumber type="currency" value='${d.get("vatIncome") - d.get("vatDebt")}'/></span></td>
+ </c:forEach>
+ </tr>
+ </tbody>
+</table>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-02-21 19:19:48 UTC (rev 309)
@@ -138,6 +138,10 @@
<li><a href="<c:url value="/wikitty/Quotation/search"/>"><i class="icon-th-list icon-black"></i> All quotations</a></li>
<li><a href="<c:url value="/wikitty/Quotation/edit/new"/>"><i class="icon-plus icon-black"></i> Add quotation</a></li>
<li class="divider"></li>
+ <li>FinancialTransaction</li>
+ <li><a href="<c:url value="/wikitty/FinancialTransaction/search"/>"><i class="icon-th-list icon-black"></i> All financial transactions</a></li>
+ <li><a href="<c:url value="/wikitty/FinancialTransaction/edit/new"/>"><i class="icon-plus icon-black"></i> Add financial transactions</a></li>
+ <li class="divider"></li>
<li>Invoice</li>
<li><a href="<c:url value="/wikitty/Invoice/search"/>"><i class="icon-th-list icon-black"></i> All invoices</a></li>
<li><a href="<c:url value="/wikitty/Invoice/edit/new"/>"><i class="icon-plus icon-black"></i> Add invoice</a></li>
@@ -147,6 +151,7 @@
<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>Report</li>
+ <li><a href="<c:url value="/report?report=vat"/>">TVA mensuel</a></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>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-02-21 19:19:48 UTC (rev 309)
@@ -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/functions" prefix="fn" %>
<form class="well form-inline">
<input type="hidden" name="report" value="${report}"/>
@@ -31,35 +32,7 @@
<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>
- <c:if test="${report == null || report == '' || report.contains('annualProfit')}">
- <jsp:include page="/fragment/dashboard/annualProfit"/>
- </c:if>
-
- <%-- Tableau des congés --%>
- <c:if test="${report == null || report == '' || report.contains('requestVacation')}">
- <jsp:include page="/fragment/dashboardHR/requestVacation"/>
- </c:if>
+ <%-- affichage de tous les rapports demandes --%>
+ <c:forEach var="r" items="${fn:split(report, ',')}">
+ <jsp:include page="/fragment/dashboard/${r}"/>
+ </c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2013-02-21 19:19:48 UTC (rev 309)
@@ -28,6 +28,7 @@
<c:if test="${not empty wikitty}">
<a class="btn btn-success" href="<c:url value="/wikitty/view/${wikitty.id}"/>"><i class="icon-list icon-white"></i> View all extension</a>
<a class="btn btn-success" href="<c:url value="/wikitty/edit/${wikitty.id}"/>"><i class="icon-pencil icon-white"></i> Edit object</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/copy/${wikitty.id}"/>"><i class="icon-random icon-white"></i> Copy object</a>
<a class="btn btn-danger" href="<c:url value="/wikitty/delete/${wikitty.id}?wmDecoratorNo=true"/>"><i class="icon-trash icon-white"></i> Delete object</a>
</c:if>
</p>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-20 11:45:41 UTC (rev 308)
+++ trunk/pom.xml 2013-02-21 19:19:48 UTC (rev 309)
@@ -95,7 +95,7 @@
<opencsvVersion>2.3</opencsvVersion>
<processPluginVersion>1.1</processPluginVersion>
<eugenePluginVersion>2.6</eugenePluginVersion>
- <nuitonUtilsVersion>2.6.5</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6.9-SNAPSHOT</nuitonUtilsVersion>
<nuitonWebVersion>1.7</nuitonWebVersion>
<nuitonI18nVersion>2.3.1</nuitonI18nVersion>
<wikittyVersion>3.9-SNAPSHOT</wikittyVersion>
1
0
r308 - in trunk: . chorem-entities/src/main/java/org/chorem chorem-entities/src/main/java/org/chorem/entities chorem-entities/src/main/resources chorem-entities/src/main/xmi chorem-entities/src/test/java/org/chorem/entities
by bpoussin@users.chorem.org 20 Feb '13
by bpoussin@users.chorem.org 20 Feb '13
20 Feb '13
Author: bpoussin
Date: 2013-02-20 12:45:41 +0100 (Wed, 20 Feb 2013)
New Revision: 308
Url: http://chorem.org/projects/chorem/repository/revisions/308
Log:
fixes #884: Remove Invoiceable extension and replace it by FinancialTransaction
Added:
trunk/chorem-entities/src/main/java/org/chorem/entities/ExpenseClaimStatus.java
trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceStatus.java
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremAction.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigAction.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigOption.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java
trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java
trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java
trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceableUtil.java
trunk/chorem-entities/src/main/resources/chorem.properties
trunk/chorem-entities/src/main/xmi/chorem-model.properties
trunk/chorem-entities/src/main/xmi/chorem-model.zargo
trunk/chorem-entities/src/test/java/org/chorem/entities/InvoiceableUtilTest.java
trunk/pom.xml
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremAction.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremAction.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremAction.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -88,6 +88,21 @@
System.out.println("... reindexation done");
}
+ /**
+ * Vide tous les objets
+ */
+ @ApplicationConfig.Action.Step(0)
+ public void removeObject(String extName) {
+ System.out.println("##### EFFACEMENT TOTAL DES OBJECT AVEC L'EXTENSION '"+extName+"' #####");
+ ChoremClient proxy = ChoremClient.getClient(config);
+ WikittyQuery query = new WikittyQueryMaker()
+ .exteq(extName).end()
+ .setLimit(WikittyQuery.MAX);
+ WikittyQueryResult<String> ids = proxy.findAllByQuery(query);
+ proxy.delete(ids.getAll());
+ System.out.println("... delete of " + ids.size() + " objects done");
+ }
+
public void configInfo() {
config.printConfig();
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -167,10 +167,12 @@
exts.addAll(org.chorem.entities.EmployeeAbstract.extensions);
exts.addAll(org.chorem.entities.EmployeeHRAbstract.extensions);
exts.addAll(org.chorem.entities.EvaluationAbstract.extensions);
+ exts.addAll(org.chorem.entities.ExpenseClaimAbstract.extensions);
+ exts.addAll(org.chorem.entities.FinancialTransactionAbstract.extensions);
exts.addAll(org.chorem.entities.GoalAbstract.extensions);
exts.addAll(org.chorem.entities.IntervalAbstract.extensions);
exts.addAll(org.chorem.entities.InterviewAbstract.extensions);
- exts.addAll(org.chorem.entities.InvoiceableAbstract.extensions);
+// exts.addAll(org.chorem.entities.InvoiceableAbstract.extensions);
exts.addAll(org.chorem.entities.InvoiceAbstract.extensions);
exts.addAll(org.chorem.entities.MissionAbstract.extensions);
exts.addAll(org.chorem.entities.NoteAbstract.extensions);
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigAction.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigAction.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigAction.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -38,6 +38,7 @@
INFO(ChoremAction.class.getName() + "#configInfo", "-i", "--config-info" , "--configInfo"),
CLEAN(ChoremAction.class.getName() + "#clean", "--clean"),
CLEAR(ChoremAction.class.getName() + "#clear", "--clear"),
+ REMOVE_OBJECT(ChoremAction.class.getName() + "#removeObject", "--removeObject"),
REINDEX(ChoremAction.class.getName() + "#reindex", "--reindex"),
IMPORT_PERSON(ImportChoremTopia.class.getName() + "#importPerson",
"-ip", "--import-person", "--importPerson"),
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigOption.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigOption.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremConfigOption.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -23,6 +23,7 @@
package org.chorem;
import org.nuiton.util.ApplicationConfig;
+
import static org.nuiton.i18n.I18n._;
/**
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremMain.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -42,8 +42,10 @@
static public void main(String[] args) throws Exception {
// args = "--clear -ic /tmp/chorem-company.csv -ip /tmp/chorem-person.csv -ie /tmp/chorem-employee.csv --import-contract-type /tmp/chorem-contracttype.csv --import-contract /tmp/chorem-contract.csv --commit".split(" ");
-// args = "-ii /tmp/bill.csv --import-costs /tmp/cost.csv --commit".split(" ");
- args = "--reindex".split(" ");
+// args = "-ic /tmp/chorem-company.csv --commit".split(" ");
+// args = "--removeObject Invoice".split(" ");
+ args = "-ii /tmp/bill.csv --import-costs /tmp/cost.csv --commit".split(" ");
+// args = "--reindex".split(" ");
System.out.println(String.format("Launching ChoremMain ... (args: %s)", Arrays.toString(args)));
// getConfig do all: parse and doAllAction
ApplicationConfig config = ChoremConfig.getConfig(null, args);
Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -34,6 +34,7 @@
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
+import org.apache.commons.lang3.time.FastDateFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.entities.Category;
@@ -43,6 +44,8 @@
import org.chorem.entities.ContactDetailsImpl;
import org.chorem.entities.Employee;
import org.chorem.entities.EmployeeImpl;
+import org.chorem.entities.FinancialTransaction;
+import org.chorem.entities.FinancialTransactionImpl;
import org.chorem.entities.Invoice;
import org.chorem.entities.InvoiceImpl;
import org.chorem.entities.Person;
@@ -121,7 +124,7 @@
protected Map<String, PersonImpl> persons = new HashMap<String, PersonImpl>();
protected Map<String, EmployeeImpl> employees = new HashMap<String, EmployeeImpl>();
protected Map<String, InvoiceImpl> invoices = new HashMap<String, InvoiceImpl>();
- protected Map<String, InvoiceImpl> costs = new HashMap<String, InvoiceImpl>();
+ protected Map<String, FinancialTransactionImpl> costs = new HashMap<String, FinancialTransactionImpl>();
protected Map<String, CategoryImpl> categories = new HashMap<String, CategoryImpl>();
// a ne pas stocker dans wikitty
@@ -533,11 +536,12 @@
InvoiceImpl invoice = new InvoiceImpl();
invoice.setCategory(categories.get(category));
- invoice.setSupplier(codeLutinId);
- invoice.setCustomer(company);
+ invoice.setBeneficiary(codeLutinId);
+ invoice.setPayer(company);
invoice.setReference(number);
invoice.setAmount(amount);
- invoice.setPostedDate(issuedate);
+ invoice.setVAT(19.6);
+ invoice.setEmittedDate(issuedate);
invoice.setExpectedDate(hopedate);
invoice.setPaymentDate(realdate);
@@ -568,8 +572,8 @@
System.out.println(String.format("%s invoices loaded", invoices.size()));
}
- protected String invoiceToKey(Invoice c) {
- String result = c.getCategory() + ";" + c.getPaymentDate() + ";" + c.getName() + ";" + c.getAmount();
+ protected String invoiceToKey(FinancialTransaction c) {
+ String result = c.getCategory() + ";" + c.getPaymentDate() + ";" + c.getReference() + ";" + c.getAmount();
return result;
}
@@ -581,14 +585,14 @@
// Pour les invoices existantes
WikittyQuery invoicesQuery = new WikittyQueryMaker()
- .exteq(Invoice.EXT_INVOICE).end().setLimit(WikittyQuery.MAX);
- WikittyQueryResult<Invoice> invoicesResult =
- proxy.findAllByQuery(Invoice.class, invoicesQuery);
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION).end().setLimit(WikittyQuery.MAX);
+ WikittyQueryResult<FinancialTransaction> invoicesResult =
+ proxy.findAllByQuery(FinancialTransaction.class, invoicesQuery);
Set<String> knowInvoices = new HashSet<String>();
Set<String> passedInvoices = new HashSet<String>();
Set<String> rejectedInvoices = new HashSet<String>();
Set<String> treatedInvoices = new HashSet<String>();
- for (Invoice c : invoicesResult) {
+ for (FinancialTransaction c : invoicesResult) {
// on fait une concatenation pour optimiser les futurs recherche
knowInvoices.add(invoiceToKey(c));
}
@@ -622,6 +626,8 @@
frais = c.getWikittyId();
}
+ FastDateFormat formatDate = FastDateFormat.getInstance("yyyy-MM-dd");
+
FileReader in = new FileReader(filename);
// separateur ';' String delimiter '"', skip first line (header)
CSVReader reader = new CSVReader(in, ';', '"', 1);
@@ -640,13 +646,13 @@
unknowCategories.add(category);
}
- InvoiceImpl invoice = new InvoiceImpl();
- invoice.setName(tag);
+ FinancialTransactionImpl invoice = new FinancialTransactionImpl();
+ invoice.setReference(tag + " " + (date==null?"":formatDate.format(date)));
invoice.setDescription(tag);
invoice.setCategory(categoryNameId.get(category));
- invoice.setCustomer(codeLutinId);
+ invoice.setPayer(codeLutinId);
invoice.setAmount(amount);
- invoice.setPostedDate(date);
+ invoice.setEmittedDate(date);
invoice.setExpectedDate(date);
invoice.setPaymentDate(date);
Copied: trunk/chorem-entities/src/main/java/org/chorem/entities/ExpenseClaimStatus.java (from rev 305, trunk/chorem-entities/src/main/java/org/chorem/entities/TaskStatus.java)
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/ExpenseClaimStatus.java (rev 0)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/ExpenseClaimStatus.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -0,0 +1,39 @@
+/*
+ * #%L
+ * Chorem entities
+ * $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%
+ */
+package org.chorem.entities;
+
+/**
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public enum ExpenseClaimStatus {
+
+ UNCHARGEABLE, // non refacturable (valeur par defaut)
+ CHARGEABLE, // refacturable
+ CHARGED // refacturee
+
+}
Modified: trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceMigration.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -28,20 +28,11 @@
*/
-import java.beans.PropertyChangeListener;
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.ChoremClient;
import org.nuiton.util.VersionUtil;
import org.nuiton.wikitty.WikittyService;
import org.nuiton.wikitty.WikittyUtil;
-import org.nuiton.wikitty.entities.FieldType;
import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.entities.WikittyExtension;
import org.nuiton.wikitty.services.WikittyExtensionMigrationRename;
@@ -59,22 +50,56 @@
*/
protected void migrateFieldVTA(Wikitty old, Wikitty result) {
+ FinancialTransactionHelper.addExtension(result);
String oldFieldName = WikittyUtil.getFQFieldName(
Invoice.EXT_INVOICE, "VTA");
String newFieldName = WikittyUtil.getFQFieldName(
- Invoice.EXT_INVOICE, Invoice.FIELD_INVOICE_VAT);
+ FinancialTransaction.EXT_FINANCIALTRANSACTION, "VAT");
Object v = old.getFqField(oldFieldName);
result.setFqField(newFieldName, v);
}
-
+
+ protected void migrateToFinancialTransactional(Wikitty old, Wikitty result) {
+ result.removeExtension("Invoiceable");
+
+ FinancialTransactionHelper.addExtension(result);
+
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_REFERENCE,
+ old.getFieldAsObject("Invoice", "reference"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_DESCRIPTION,
+ old.getFieldAsObject("Invoice", "description"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_AMOUNT,
+ old.getFieldAsObject("Invoice", "amount"));
+
+ // VAT peut etre null si on avait un tres vieux objet avec 'VTA'
+ if (null != old.getFieldAsObject("Invoice", "VAT")) {
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_VAT,
+ old.getFieldAsObject("Invoice", "VAT"));
+ }
+
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE,
+ old.getFieldAsObject("Invoice", "postedDate"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE,
+ old.getFieldAsObject("Invoice", "expectedDate"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE,
+ old.getFieldAsObject("Invoice", "paymentDate"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYER,
+ old.getFieldAsObject("Invoice", "customer"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY,
+ old.getFieldAsObject("Invoice", "supplier"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_CATEGORY,
+ old.getFieldAsObject("Invoice", "category"));
+ result.setFqField(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_TARGET,
+ old.getFieldAsObject("Invoiceable", "target"));
+ }
@Override
public Wikitty migrate(WikittyService service, Wikitty wikitty,
WikittyExtension oldExt, WikittyExtension newExt) {
Wikitty result = super.migrate(service, wikitty, oldExt, newExt);
-
+
if (Invoice.EXT_INVOICE.equals(newExt.getName())) {
String oldVersion = oldExt.getVersion();
String newVersion = newExt.getVersion();
@@ -82,6 +107,10 @@
&& !VersionUtil.smallerThan(newVersion, "15.0")) {
migrateFieldVTA(wikitty, result);
+ } else if (!VersionUtil.greaterThan("15.0", oldVersion)
+ && !VersionUtil.smallerThan(newVersion, "16.0")) {
+
+ migrateToFinancialTransactional(wikitty, result);
}
}
Copied: trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceStatus.java (from rev 305, trunk/chorem-entities/src/main/java/org/chorem/entities/TaskStatus.java)
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceStatus.java (rev 0)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceStatus.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -0,0 +1,38 @@
+/*
+ * #%L
+ * Chorem entities
+ * $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%
+ */
+package org.chorem.entities;
+
+/**
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public enum InvoiceStatus {
+
+ ACCEPTED, // valeur par defaut
+ CANCELED // facture annulee
+
+}
Modified: trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceableUtil.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceableUtil.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/InvoiceableUtil.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -28,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.wikitty.ScriptEvaluator;
import org.nuiton.wikitty.WikittyClient;
-import org.nuiton.wikitty.WikittyProxy;
/**
* Classe permettant de rassembler les methodes utils pour l'evaluation des
@@ -42,32 +41,32 @@
*/
public class InvoiceableUtil {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(InvoiceableUtil.class);
-
- static public boolean evalCondition(WikittyClient client, Invoiceable invoiceable) {
- Map<String, Object> bindings = new HashMap<String, Object>();
- bindings.put("wikittyClient", client);
- bindings.put("invoiceable", invoiceable);
- Object resultEval = ScriptEvaluator.eval(null,
- invoiceable.getName(), invoiceable.getCondition(),
- invoiceable.getMimetype(), bindings);
- boolean result= Boolean.TRUE.equals(resultEval);
- return result;
- }
-
- static public double evalValue(WikittyClient client, Invoiceable invoiceable) {
- Map<String, Object> bindings = new HashMap<String, Object>();
- bindings.put("wikittyClient", client);
- bindings.put("invoiceable", invoiceable);
- Object resultEval = ScriptEvaluator.eval(null,
- invoiceable.getName(), invoiceable.getValue(),
- invoiceable.getMimetype(), bindings);
-
- double result = 0;
- if (resultEval instanceof Number) {
- result = ((Number) resultEval).doubleValue();
- }
- return result;
- }
+// /** to use log facility, just put in your code: log.info(\"...\"); */
+// static private Log log = LogFactory.getLog(InvoiceableUtil.class);
+//
+// static public boolean evalCondition(WikittyClient client, Invoiceable invoiceable) {
+// Map<String, Object> bindings = new HashMap<String, Object>();
+// bindings.put("wikittyClient", client);
+// bindings.put("invoiceable", invoiceable);
+// Object resultEval = ScriptEvaluator.eval(null,
+// invoiceable.getName(), invoiceable.getCondition(),
+// invoiceable.getMimetype(), bindings);
+// boolean result= Boolean.TRUE.equals(resultEval);
+// return result;
+// }
+//
+// static public double evalValue(WikittyClient client, Invoiceable invoiceable) {
+// Map<String, Object> bindings = new HashMap<String, Object>();
+// bindings.put("wikittyClient", client);
+// bindings.put("invoiceable", invoiceable);
+// Object resultEval = ScriptEvaluator.eval(null,
+// invoiceable.getName(), invoiceable.getValue(),
+// invoiceable.getMimetype(), bindings);
+//
+// double result = 0;
+// if (resultEval instanceof Number) {
+// result = ((Number) resultEval).doubleValue();
+// }
+// return result;
+// }
}
Modified: trunk/chorem-entities/src/main/resources/chorem.properties
===================================================================
--- trunk/chorem-entities/src/main/resources/chorem.properties 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/resources/chorem.properties 2013-02-20 11:45:41 UTC (rev 308)
@@ -35,7 +35,8 @@
wikitty.WikittyService.components=org.nuiton.wikitty.services.WikittyServiceStorage,\
org.nuiton.wikitty.services.WikittyServiceNotifier,\
org.nuiton.wikitty.services.WikittyServiceCached,\
-org.nuiton.wikitty.services.WikittyServiceSecurity
+org.nuiton.wikitty.services.WikittyServiceAuthentication,\
+org.nuiton.wikitty.services.WikittyServiceAuthorisation
wikitty.WikittyServiceStorage.components=org.nuiton.wikitty.jdbc.WikittyExtensionStorageJDBC,\
org.nuiton.wikitty.jdbc.WikittyStorageJDBC,\
org.nuiton.wikitty.storage.solr.WikittySearchEngineSolr
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2013-02-20 11:45:41 UTC (rev 308)
@@ -115,42 +115,51 @@
#
# Interview (a mettre ici)
#
+
#
+# FinancialTransaction
+#
+org.chorem.entities.FinancialTransaction.class.tagvalue.version=3.0
+org.chorem.entities.FinancialTransaction.class.tagvalue.preload=FinancialTransaction.payer;FinancialTransaction.beneficiary;FinancialTransaction.target;FinancialTransaction.category
+org.chorem.entities.FinancialTransaction.class.tagvalue.toString=%FinancialTransaction.reference|noref$s - %FinancialTransaction.description|nodescription$s - %FinancialTransaction.amount|noamount$s
+org.chorem.entities.FinancialTransaction.class.tagvalue.sortOrder=FinancialTransaction.emittedDate desc,FinancialTransaction.expectedDate,FinancialTransaction.paymentDate,FinancialTransaction.reference,FinancialTransaction.amount
+org.chorem.entities.FinancialTransaction.attribute.reference.tagvalue.help=La r\u00e9f\u00e9rence
+org.chorem.entities.FinancialTransaction.attribute.reference.tagvalue.notNull=true
+org.chorem.entities.FinancialTransaction.attribute.description.tagvalue.help=la description de la facture (ce sur quoi elle porte)
+org.chorem.entities.FinancialTransaction.attribute.description.tagvalue.subtype=text/rst
+org.chorem.entities.FinancialTransaction.attribute.amount.tagvalue.help=Le montant HT de la facture
+org.chorem.entities.FinancialTransaction.attribute.amount.tagvalue.subtype=currency
+org.chorem.entities.FinancialTransaction.attribute.VAT.tagvalue.help=La TVA \u00e0 appliquer \u00e0 la facture
+org.chorem.entities.FinancialTransaction.attribute.emittedDate.tagvalue.help=La date de prise en compte (l'année fiscale)
+org.chorem.entities.FinancialTransaction.attribute.expectedDate.tagvalue.help=La date souhait\u00e9e de paiement
+org.chorem.entities.FinancialTransaction.attribute.paymentDate.tagvalue.help=La date de paiement r\u00e9elle
+org.chorem.entities.FinancialTransaction.attribute.beneficiary.tagvalue.help=La société ou la personne qui recoit l'argent
+org.chorem.entities.FinancialTransaction.attribute.beneficiary.tagvalue.allowed=Company,Person,Employee
+org.chorem.entities.FinancialTransaction.attribute.payer.tagvalue.help=La société ou la personne qui paie
+org.chorem.entities.FinancialTransaction.attribute.payer.tagvalue.allowed=Company,Person,Employee
+org.chorem.entities.FinancialTransaction.attribute.category.tagvalue.help=La cat\u00e9gorie de cette facture
+org.chorem.entities.FinancialTransaction.attribute.target.tagvalue.help=L'objet sur lequel la facture s'appliquera
+org.chorem.entities.FinancialTransaction.attribute.target.tagvalue.allowed=Accepted,Project
+
+#
# Invoice
#
-org.chorem.entities.Invoice.class.tagvalue.version=15.0
-org.chorem.entities.Invoice.class.tagvalue.preload=Invoice.customer;Invoice.supplier
-org.chorem.entities.Invoice.class.tagvalue.toString=%Invoice.reference|noref$s - %Invoice.description|nodescription$s - %Invoice.amount|noamount$s
-org.chorem.entities.Invoice.class.tagvalue.sortOrder=Invoice.postedDate desc,Invoice.expectedDate,Invoice.paymentDate,Invoice.reference,Invoice.amount
-org.chorem.entities.Invoice.attribute.reference.tagvalue.help=La r\u00e9f\u00e9rence de la facture
-org.chorem.entities.Invoice.attribute.description.tagvalue.help=la description de la facture (ce sur quoi elle porte)
-org.chorem.entities.Invoice.attribute.description.tagvalue.subtype=text/rst
-org.chorem.entities.Invoice.attribute.amount.tagvalue.help=Le montant HT de la facture
-org.chorem.entities.Invoice.attribute.amount.tagvalue.subtype=currency
-org.chorem.entities.Invoice.attribute.VAT.tagvalue.help=La TVA \u00e0 appliquer \u00e0 la facture
-org.chorem.entities.Invoice.attribute.postedDate.tagvalue.help=La date d'envoi au client
-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.parent.tagvalue.allowed=Company,Person,Employee
-org.chorem.entities.Invoice.attribute.customer.tagvalue.help=La personne chez le client \u00e0 qui ont a envoyer la facture
+org.chorem.entities.Invoice.class.tagvalue.version=17.0
+org.chorem.entities.Invoice.class.tagvalue.toString=%FinancialTransaction.reference|noref$s (%Invoice.status$s) - %FinancialTransaction.description|nodescription$s - %FinancialTransaction.amount|noamount$s
+org.chorem.entities.Invoice.attribute.status.tagvalue.help=Le statut de la facture
+org.chorem.entities.Invoice.attribute.status.tagvalue.allowed=ACCEPTED,CANCELED
+org.chorem.entities.Invoice.attribute.status.tagvalue.default=ACCEPTED
+
#
-# Invoiceable
+# ExpenseClaim
#
-org.chorem.entities.Invoiceable.class.tagvalue.version=12.0
-org.chorem.entities.Invoiceable.class.tagvalue.preload=Invoiceable.target;Invoiceable.category
-org.chorem.entities.Invoiceable.class.tagvalue.toString=%Invoiceable.name|noname$s
-org.chorem.entities.Invoiceable.class.tagvalue.sortOrder=Invoiceable.name
-org.chorem.entities.Invoiceable.attribute.name.tagvalue.help=Nom de ce facturable (si n\u00e9cessaire) ex: "facture VSR"
-org.chorem.entities.Invoiceable.attribute.target.tagvalue.help=L'objet sur lequel la facture s'appliquera
-org.chorem.entities.Invoiceable.attribute.condition.tagvalue.help=Script qui lorsqu'il est \u00e9valu\u00e9 \u00e0 TRUE cr\u00e9e la facture
-org.chorem.entities.Invoiceable.attribute.condition.tagvalue.subtype=application/javascript
-org.chorem.entities.Invoiceable.attribute.value.tagvalue.help=Script qui permet de calculer le montant de la facture
-org.chorem.entities.Invoiceable.attribute.value.tagvalue.subtype=application/javascript
-org.chorem.entities.Invoiceable.attribute.recurrence.tagvalue.help=Script qui permet de calculer la r\u00e9currence de cette facture
-org.chorem.entities.Invoiceable.attribute.recurrence.tagvalue.subtype=application/javascript
-org.chorem.entities.Invoiceable.attribute.mimetype.tagvalue.help=Langage utilis\u00e9 pour les scripts (ex: application/javascript)
-org.chorem.entities.Invoiceable.attribute.category.tagvalue.help=La cat\u00e9gorie de cette facture
+org.chorem.entities.ExpenseClaim.class.tagvalue.version=1.0
+org.chorem.entities.ExpenseClaim.attribute.kind.tagvalue.help=Le type de dépense
+org.chorem.entities.ExpenseClaim.attribute.kind.tagvalue.choiceQuery=SELECT ExpenseClaim.kind WHERE extension=ExpenseClaim
+org.chorem.entities.ExpenseClaim.attribute.status.tagvalue.help=Le statut de la note de frais
+org.chorem.entities.ExpenseClaim.attribute.status.tagvalue.allowed=UNCHARGEABLE,CHARGEABLE,CHARGED
+org.chorem.entities.ExpenseClaim.attribute.status.tagvalue.default=UNCHARGEABLE
+
#
# Mission (a mettre ici)
#
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.zargo
===================================================================
(Binary files differ)
Modified: trunk/chorem-entities/src/test/java/org/chorem/entities/InvoiceableUtilTest.java
===================================================================
--- trunk/chorem-entities/src/test/java/org/chorem/entities/InvoiceableUtilTest.java 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/chorem-entities/src/test/java/org/chorem/entities/InvoiceableUtilTest.java 2013-02-20 11:45:41 UTC (rev 308)
@@ -24,6 +24,7 @@
import org.junit.Test;
import org.nuiton.wikitty.WikittyClient;
+
import static org.junit.Assert.*;
/**
@@ -32,46 +33,46 @@
*/
public class InvoiceableUtilTest {
- /**
- * Test of evalCondition method, of class InvoiceableUtil.
- */
- @Test
- public void testEvalCondition() {
- System.out.println("evalCondition");
-
- WikittyClient proxy = null;
- Invoiceable invoiceable = new InvoiceableImpl();
- invoiceable.setMimetype("application/javascript");
- invoiceable.setCondition("'coucou'.equals(invoiceable.getName())");
-
- {
- invoiceable.setName("coucou");
- boolean expResult = true;
- boolean result = InvoiceableUtil.evalCondition(proxy, invoiceable);
- assertEquals(expResult, result);
- }
- {
- invoiceable.setName("not coucou");
- boolean expResult = false;
- boolean result = InvoiceableUtil.evalCondition(proxy, invoiceable);
- assertEquals(expResult, result);
- }
- }
-
- /**
- * Test of evalValue method, of class InvoiceableUtil.
- */
- @Test
- public void testEvalValue() {
- System.out.println("evalValue");
-
- WikittyClient proxy = null;
- Invoiceable invoiceable = new InvoiceableImpl();
- invoiceable.setMimetype("application/javascript");
- invoiceable.setValue("10*10");
-
- double expResult = 100;
- double result = InvoiceableUtil.evalValue(proxy, invoiceable);
- assertEquals(expResult, result, 0.0);
- }
+// /**
+// * Test of evalCondition method, of class InvoiceableUtil.
+// */
+// @Test
+// public void testEvalCondition() {
+// System.out.println("evalCondition");
+//
+// WikittyClient proxy = null;
+// Invoiceable invoiceable = new InvoiceableImpl();
+// invoiceable.setMimetype("application/javascript");
+// invoiceable.setCondition("'coucou'.equals(invoiceable.getName())");
+//
+// {
+// invoiceable.setName("coucou");
+// boolean expResult = true;
+// boolean result = InvoiceableUtil.evalCondition(proxy, invoiceable);
+// assertEquals(expResult, result);
+// }
+// {
+// invoiceable.setName("not coucou");
+// boolean expResult = false;
+// boolean result = InvoiceableUtil.evalCondition(proxy, invoiceable);
+// assertEquals(expResult, result);
+// }
+// }
+//
+// /**
+// * Test of evalValue method, of class InvoiceableUtil.
+// */
+// @Test
+// public void testEvalValue() {
+// System.out.println("evalValue");
+//
+// WikittyClient proxy = null;
+// Invoiceable invoiceable = new InvoiceableImpl();
+// invoiceable.setMimetype("application/javascript");
+// invoiceable.setValue("10*10");
+//
+// double expResult = 100;
+// double result = InvoiceableUtil.evalValue(proxy, invoiceable);
+// assertEquals(expResult, result, 0.0);
+// }
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-20 11:38:15 UTC (rev 307)
+++ trunk/pom.xml 2013-02-20 11:45:41 UTC (rev 308)
@@ -104,9 +104,8 @@
<servletApiVersion>2.5</servletApiVersion>
<jspApiVersion>2.0</jspApiVersion>
<h2Version>1.2.134</h2Version>
- <webmotionVersion>2.3.3</webmotionVersion>
+ <webmotionVersion>2.3.4-SNAPSHOT</webmotionVersion>
<jstlVersion>1.2</jstlVersion>
- <nuitonJsVersion>0.1-SNAPSHOT</nuitonJsVersion>
<!-- license to use -->
<license.licenseName>agpl_v3</license.licenseName>
@@ -119,20 +118,7 @@
<dependencyManagement>
<dependencies>
-
<dependency>
- <groupId>org.debux.webmotion</groupId>
- <artifactId>webmotion</artifactId>
- <version>${webmotionVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.debux.webmotion</groupId>
- <artifactId>webmotion-extra-sitemesh</artifactId>
- <version>2.3.3</version>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstlVersion}</version>
@@ -221,29 +207,46 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-wro</artifactId>
- <version>${nuitonJsVersion}</version>
- </dependency>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jquery</artifactId>
<version>1.8.3-1-SNAPSHOT</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jquery-ui</artifactId>
<version>1.9.2-1-SNAPSHOT</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jqplot</artifactId>
<version>1.0.4r1121-1-SNAPSHOT</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-bootstrap</artifactId>
<version>2.2.2-1-SNAPSHOT</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-jquery-tokeninput</artifactId>
+ <version>1.6.0.0-1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.debux.webmotion</groupId>
+ <artifactId>webmotion</artifactId>
+ <version>${webmotionVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.debux.webmotion</groupId>
+ <artifactId>webmotion-extra-sitemesh</artifactId>
+ <version>${webmotionVersion}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
1
0