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
August 2013
- 4 participants
- 13 discussions
r389 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/sales resources webapp/WEB-INF/jsp/salesReports webapp/js
by jcouteau@users.chorem.org 30 Aug '13
by jcouteau@users.chorem.org 30 Aug '13
30 Aug '13
Author: jcouteau
Date: 2013-08-30 16:05:35 +0200 (Fri, 30 Aug 2013)
New Revision: 389
Url: http://chorem.org/projects/chorem/repository/revisions/389
Log:
Use angular to power up sales funnel
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html
trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java 2013-08-30 14:05:35 UTC (rev 389)
@@ -32,10 +32,12 @@
import org.chorem.entities.Sent;
import org.chorem.entities.Started;
import org.chorem.entities.Cancelled;
+import org.chorem.webmotion.render.RenderWikitty;
import org.chorem.webmotion.render.RenderWikittyJson;
import org.debux.webmotion.server.WebMotionController;
import org.debux.webmotion.server.render.Render;
import org.nuiton.wikitty.WikittyUtil;
+import org.nuiton.wikitty.entities.Wikitty;
import java.text.ParseException;
import java.util.Date;
@@ -85,14 +87,14 @@
getContext().addInfoMessage("message", "Warning: Could not parse date " + rejectedDate);
}
client.store(rejected);
- return new RenderWikittyJson(rejected);
+ return new RenderWikitty().setModelWikitty((Wikitty) rejected);
}
public Render start(ChoremClient client, String id) {
Started started = client.restore(Started.class, id);
started.setStartedDate(new Date());
client.store(started);
- return new RenderWikittyJson(started);
+ return new RenderWikitty().setModelWikitty((Wikitty)started);
}
public Render answer(ChoremClient client, String id, String sendingDate,
@@ -106,7 +108,8 @@
}
draft.setReference(reference);
draft = client.store(draft);
- return new RenderWikittyJson(draft);
+ Wikitty w = client.castTo(Wikitty.class, draft);
+ return new RenderWikitty().setModelWikitty(w);
}
public Render cancel(ChoremClient client, String id, String cancelledDate,
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2013-08-30 14:05:35 UTC (rev 389)
@@ -10,6 +10,7 @@
* /wikitty-json/* DecoratorFilter.decorate wmDecoratorNo=true
* /fragment/* DecoratorFilter.decorate wmDecoratorNo=true
* /sales/funnel/json/* DecoratorFilter.decorate wmDecoratorNo=true
+* /sales/funnel/partial/* DecoratorFilter.decorate wmDecoratorNo=true
* /project/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /hr/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /ascii/* DecoratorFilter.decorate wmDecoratorNo=true
@@ -74,6 +75,11 @@
* /sales/report/salesPerAccount action:sales.SalesPerAccountReportAction.sales
* /sales/report/salesPerAccount/{account} action:sales.AccountSalesReportAction.sales
* /sales/funnel action:sales.FunnelAction.funnel
+* /sales/funnel/partial/dialog-leadToDraft.html view:salesReports/dialog-leadToDraft.html
+* /sales/funnel/partial/dialog-draftToSent.html view:salesReports/dialog-draftToSent.html
+* /sales/funnel/partial/dialog-sentToAccepted.html view:salesReports/dialog-sentToAccepted.html
+* /sales/funnel/partial/dialog-sentToRejected.html view:salesReports/dialog-sentToRejected.html
+* /sales/funnel/partial/dialog-cancel.html view:salesReports/dialog-cancel.html
* /sales/funnel/json/{method} action:sales.SalesAction.{method}
* /sales/funnel/json/{method}/{id} action:sales.SalesAction.{method}
* /project action:project.DashboardProjectAction.requestProject
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,17 @@
+<div class="modal-header" title="Proposition commerciale annulée">
+ <h3>Proposition commerciale annulée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="cancelledDate">Date d'annulation</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="lead.cancelledDate" id="cancelledDate" class="datepicker" />
+ <label for="cancelledReason">Raison</label>
+ <input type="text" ng-model="lead.cancelledReason" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Valider</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,15 @@
+<div class="modal-header" title="Proposition commerciale envoyée">
+ <h3>Proposition commerciale envoyée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="sendDate">Date d'envoirrrrrrrrrrrr</label>
+ <input type="text" ui-date ng-model="draft.sendingDate" id="sendDate" class="datepicker" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Envoyer</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,17 @@
+<div class="modal-header" title="Proposition commerciale à envoyer">
+ <h3>Proposition commerciale à envoyer</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="sendingDate">Date d'envoi</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="lead.sendingDate" id="sendingDate" class="datepicker" />
+ <label for="reference">Référence</label>
+ <input type="text" ng-model="lead.reference" id="reference" class="text ui-widget-content ui-corner-all" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Envoyer</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,15 @@
+<div class="modal-header" title="Proposition commerciale acceptée">
+ <h3>Proposition commerciale acceptée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="acceptedDate">Date d'acceptation</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="sent.acceptedDate" id="acceptedDate" class="datepicker" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Accepter</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,15 @@
+<div class="modal-header" title="Proposition commerciale rejetée">
+ <h3>Proposition commerciale rejetée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="rejectedDate">Date de rejet</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="sent.rejectedDate" id="rejectedDate" class="datepicker" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Rejeter</button>
+</div>
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-08-30 14:05:35 UTC (rev 389)
@@ -27,11 +27,17 @@
<head>
<link rel="stylesheet/less" href="<c:url value='/css/chorem-sales.css'/>">
+ <script type="text/javascript" src="<c:url value='/js/salesFunnel.js'/>"></script>
+ <script type="text/javascript" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js"></script>
+ <script type="text/javascript" src="https://raw.github.com/angular-ui/ui-date/master/src/date.js"></script>
</head>
<body>
-<div class="row-fluid">
+<div ng-app="salesFunnel">
+
+<div class="row-fluid" ng-controller="salesFunnelController">
+
<ul id="funnelTabs" class="nav nav-tabs" data-tabs="funnelTabs">
<li class="active" >
<a href="#lead" data-toggle="tab">Leads</a>
@@ -48,150 +54,87 @@
<!-- LEADS TAB -->
<div class="tab-pane active" id="lead">
- <h4> Total : ${leadAmount}€ - Total espéré : ${leadAmountHope}€</h4>
+ <h4> Total : {{leadsAmount}}€ - Total espéré : {{leadsAmountHope}}€</h4>
<ul class="unstyled leads">
- <c:forEach var="q" items="${leads}">
- <li class="salesFunnelItem">
- <div class="pull-left">
- <a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>">
- <i class="icon-edit"></i>
- </a>
- <small>
- <a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>">
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/>
- </a>
- </small>
- <p>
- <span class="salesFunnelItemTitle">
- <a class="name-link" href="<c:url value="/wikitty/Project/view/${q.project}"/>">
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/>
- </a>
- </span> - <small>
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.description" label=""/>
- </small>
- </p>
- </div>
- <a class="btn btn-success pull-right salesFunnelItemButton lead" wikittyId="${q.wikittyId}">Répondre</a>
- <a class="btn btn-warning pull-right salesFunnelItemButton toCancelled" wikittyId="${q.wikittyId}">Annuler</a>
- <div class="pull-right salesFunnelItemPrice">
- <p class="salesFunnelItemTitle">
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/>
- </p>
- <small>
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/> -
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/>j
- </small>
- </div>
- <div style="clear:both;"/>
- </li>
- </c:forEach>
+ <li ng-repeat="lead in leads" class="salesFunnelItem">
+ <div class="pull-left">
+ <a href="../wikitty/edit/{{lead.meta.id}}"/>
+ <i class="icon-edit"></i>
+ </a>
+ <small>
+ <a href="/wikitty/Employee/view/{{lead.getField('Quotation', 'customer')}}">{{lead.getField('Quotation','customer')}}</a>
+ </small>
+ <p>
+ <span class="salesFunnelItemTitle">
+ <a class="name-link" href="/wikitty/Project/view/{{lead.getField('Quotation','project')}}"/>{{lead.getField('Quotation','projet')}}</a>
+ </span> - <small>{{lead.getField('Quotation','description')}}</small>
+ </p>
+ </div>
+ <a class="btn btn-success pull-right" ng-click="leadToDraft(lead)">Envoyer</a>
+ <a class="btn btn-warning pull-right" ng-click="cancel(lead)">Annuler</a>
+ <div class="pull-right">
+ <p class="salesFunnelItemTitle">{{lead.getField('Quotation','amount')}} €</p>
+ <small>{{lead.getField('Quotation','category')}} - {{lead.getField('Quotation','estimatedDays')}}j - {{lead.getField('Quotation','conversionHope')}} %</small>
+ </div>
+ <div style="clear:both;"/>
+ </li>
</ul>
</div>
<!-- DRAFT TAB -->
<div class="tab-pane" id="draft">
- <h4>Total : <span id="draftAmount">${draftAmount}</span>€ - Total espéré : <span id="draftAmountHope">${draftAmountHope}</span>€</h4>
+ <h4>Total : {{draftsAmount}}€ - Total espéré : {{draftsAmountHope}}€</h4>
<ul class="unstyled drafts">
- <c:forEach var="q" items="${drafts}">
- <li class="salesFunnelItem draft">
- <div class="pull-left">
- <a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i class="icon-edit"></i></a>
- <small><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></a></small>
- <p><span class="salesFunnelItemTitle"><a class="name-link" href="<c:url value="/wikitty/Project/view/${q.project}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></a></span> - <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.description" label=""/></small></p>
- </div>
- <a class="btn btn-success pull-right salesFunnelItemButton draft" wikittyId="${q.wikittyId}">Envoyer</a>
- <a class="btn btn-warning pull-right salesFunnelItemButton toCancelled" wikittyId="${q.wikittyId}">Annuler</a>
- <div class="pull-right salesFunnelItemPrice">
- <p class="salesFunnelItemTitle"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></p>
- <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/> - <w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/>j - <w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></small>
- </div>
- <div style="clear:both;"/>
- </li>
- </c:forEach>
+ <li ng-repeat="draft in drafts" class="salesFunnelItem">
+ <div class="pull-left">
+ <a href="../wikitty/edit/{{draft.meta.id}}"/><i class="icon-edit"></i></a>
+ <small><a href="/wikitty/Employee/view/{{draft.getField('Quotation', 'customer')}}">{{draft.getField('Quotation','customer')}}</a></small>
+ <p>
+ <span class="salesFunnelItemTitle">
+ <a class="name-link" href="/wikitty/Project/view/{{draft.getField('Quotation','project')}}"/>{{draft.getField('Quotation','projet')}}</a>
+ </span> - <small>{{draft.getField('Quotation','description')}}</small>
+ </p>
+ </div>
+ <a class="btn btn-success pull-right" ng-click="draftToSent(draft)">Envoyer</a>
+ <a class="btn btn-warning pull-right" ng-click="cancel(draft)">Annuler</a>
+ <div class="pull-right">
+ <p class="salesFunnelItemTitle">{{draft.getField('Quotation','amount')}} €</p>
+ <small>{{draft.getField('Quotation','category')}} - {{draft.getField('Quotation','estimatedDays')}}j - {{draft.getField('Quotation','conversionHope')}} %</small>
+ </div>
+ <div style="clear:both;"/>
+ </li>
</ul>
</div>
<!-- SENT TAB -->
<div class="tab-pane" id="sent">
- <h4> Total : <span id="sentAmount">${sentAmount}</span>€ - Total espéré : <span id="sentAmountHope">${sentAmountHope}</span>€</h4>
+ <h4> Total : {{sentsAmount}}€ - Total espéré : {{sentsAmountHope}}€</h4>
<ul class="unstyled sents">
- <c:forEach var="q" items="${sents}">
- <li class="salesFunnelItem sent">
- <div class="pull-left">
- <a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i class="icon-edit"></i></a>
- <small><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></a></small>
- <p><span class="salesFunnelItemTitle"><a class="name-link" href="<c:url value="/wikitty/Project/view/${q.project}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></a></span> - <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.description" label=""/></small></p>
- </div>
- <a class="btn btn-success pull-right salesFunnelItemButton sent toAccepted" wikittyId="${q.wikittyId}">Accepté</a>
- <a class="btn btn-danger pull-right salesFunnelItemButton sent toRejected" wikittyId="${q.wikittyId}">Rejeté</a>
- <a class="btn btn-warning pull-right salesFunnelItemButton toCancelled" wikittyId="${q.wikittyId}">Annuler</a>
- <div class="pull-right salesFunnelItemPrice">
- <p class="salesFunnelItemTitle"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></p>
- <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/> - <w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/>j - <w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></small>
- </div>
- <div style="clear:both;"/>
- </li>
- </c:forEach>
+ <li ng-repeat="sent in sents" class="salesFunnelItem">
+ <div class="pull-left">
+ <a href="wikitty/edit/{{sent.meta.id}}"/><i class="icon-edit"></i></a>
+ <small><a href="/wikitty/Employee/view/{{sent.getField('Quotation', 'customer')}}">{{sent.getField('Quotation','customer')}}</a></small>
+ <p>
+ <span>
+ <a class="name-link" href="/wikitty/Project/view/{{sent.getField('Quotation','project')}}"/>{{sent.getField('Quotation','projet')}}</a>
+ </span> - <small>{{sent.getField('Quotation','description')}}</small>
+ </p>
+ </div>
+ <a class="btn btn-success pull-right" ng-click="sentToAccepted(sent)">Accepté</a>
+ <a class="btn btn-danger pull-right" ng-click="sentToRejected(sent)">Rejeté</a>
+ <a class="btn btn-warning pull-right" ng-click="cancel(sent)">Annuler</a>
+ <div class="pull-right">
+ <p class="salesFunnelItemTitle">{{sent.getField('Quotation','amount')}} €</p>
+ <small>{{sent.getField('Quotation','category')}} - {{sent.getField('Quotation','estimatedDays')}}j - {{sent.getField('Quotation','conversionHope')}} %</small>
+ </div>
+ <div style="clear:both;"/>
+ </li>
</ul>
</div>
-
- <div id="dialog-form-leadToDraft" title="Proposition commerciale à envoyer">
- <form>
- <fieldset>
- <label for="sendingDate">Date d'envoi</label>
- <input type="text" name="sendingDate" id="sendingDate" class="datepicker" />
- <label for="reference">Référence</label>
- <input type="text" name="reference" id="reference" value="" class="text ui-widget-content ui-corner-all" />
- <input type="hidden" name="id" id="lead-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-draftToSent" title="Proposition commerciale envoyée">
- <form>
- <fieldset>
- <label for="sendDate">Date d'envoi</label>
- <input type="text" name="sendDate" id="sendDate" class="datepicker" />
- <input type="hidden" name="id" id="draft-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-sentToAccepted" title="Proposition commerciale acceptée">
- <form>
- <fieldset>
- <label for="acceptedDate">Date d'acceptation</label>
- <input type="text" name="acceptedDate" id="acceptedDate" class="datepicker" />
- <input type="hidden" name="id" id="sent-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-sentToRejected" title="Proposition commerciale refusée">
- <form>
- <fieldset>
- <label for="rejectedDate">Date de refus</label>
- <input type="text" name="rejectedDate" id="rejectedDate" class="datepicker" />
- <input type="hidden" name="id" id="rejected-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-toCancelled" title="Proposition commerciale annulée">
- <form>
- <fieldset>
- <label for="cancelledDate">Date d'annulation</label>
- <input type="text" name="cancelledDate" id="cancelledDate" class="datepicker" />
- <label for="cancelledReason">Raison</label>
- <input type="text" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" />
- <input type="hidden" name="id" id="cancelled-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
</div>
</div>
+</div>
<div style="clear:both;"/>
</body>
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-08-30 14:05:35 UTC (rev 389)
@@ -96,41 +96,6 @@
/*********** SALES FUNNEL FUNCTIONS**********************/
-function leadToDraft(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#lead-wikittyId").val(id);
- $("#dialog-form-leadToDraft" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function draftToSent(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#draft-wikittyId").val(id);
- $("#dialog-form-draftToSent" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function sentToAccepted(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#sent-wikittyId").val(id);
- $("#dialog-form-sentToAccepted" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function sentToRejected(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#rejected-wikittyId").val(id);
- $("#dialog-form-sentToRejected" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function toCancelled(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#cancelled-wikittyId").val(id);
- $("#dialog-form-toCancelled" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
//ajout ble
//clic sur les cases à cocher half-day d'une vacation (VacationRequest)
@@ -266,451 +231,7 @@
return false;
});
- // ********************************************************************
- // * SALES FUNNEL *
- // ********************************************************************
-
- //Passage d'un lead -> draft
- $("a.lead").click(leadToDraft);
-
- $( "#dialog-form-leadToDraft" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var reference = $("#reference").val();
- var sendingDate = $("#sendingDate").val();
- var id = $("#lead-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#reference")).add($("#sendingDate")).add($("#lead-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/answer/", id,"?sendingDate=", sendingDate, "&reference=",reference),
- function(data){
- //success
- var wikittyId = data.meta.id;
- var wikitty = data.data;
-
- var li = $("<li></li>").addClass("salesFunnelItem draft");
-
- //leftDiv
- var leftDiv = $("<div></div>").addClass("pull-left");
- var aIconEdit = $("<a></a>")
- .attr("href", createUrl("/wikitty/edit/", wikittyId));
- var iconEdit = $("<i></i>").addClass("icon-edit");
- aIconEdit.append(iconEdit);
- leftDiv.append(aIconEdit);
- var smallAccount = $("<small></small>");
- if (wikitty["Quotation.customer"]!=null){
- var customer = data.preloaded[wikitty["Quotation.customer"]];
- var firstName = customer.preloaded[customer.data["Employee.person"]].data["Person.firstName"];
- var lastName = customer.preloaded[customer.data["Employee.person"]].data["Person.lastName"];
- var company = customer.preloaded[customer.data["Employee.company"]].data["Company.name"];
- }
- var aAccount = $("<a></a>")
- .text(firstName + " " + lastName + " (" + company + ")")
- .attr("href",createUrl("/wikitty/Employee/view/", wikitty["Quotation.customer"]));
- smallAccount.append(aAccount);
- leftDiv.append(smallAccount);
- var leftP = $("<p> - </p>");
- var itemTitleSpan = $('<span></span>').addClass('salesFunnelItemTitle');
-
- if (wikitty["Quotation.project"]!=null) {
- var aProject = $("<a/>")
- .addClass("nameLink")
- .attr("href" , createUrl("/wikitty/Project/view/", wikitty["Quotation.project"]))
- .text(data.preloaded[wikitty["Quotation.project"]].data["Project.name"]);
- }
- itemTitleSpan.append(aProject);
- var descriptionSmall = $('<small/>').text(wikitty["Quotation.description"]);
- leftP.append(descriptionSmall);
- leftP.prepend(itemTitleSpan);
- leftDiv.append(leftP);
-
- //button
- var aSend = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-success pull-right salesFunnelItemButton draft")
- .text("Envoyer")
- .click(draftToSent);
-
- var aCancelled = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-warning pull-right salesFunnelItemButton toCancelled")
- .text("Annuler")
- .click(toCancelled);
-
- //rightDiv
- var rightDiv = $("<div>").addClass("pull-right");
- var rightP = $("<p>").addClass("salesFunnelItemTitle").text(wikitty["Quotation.amount"] +" €");
- if (wikitty["Quotation.category"] != null) {
- var smallInfo = $("<small>")
- .text(data.preloaded[wikitty["Quotation.category"]].data["WikittyTreeNode.name"]
- + ' - ' + wikitty["Quotation.estimatedDays"] + 'j - ' +
- wikitty["Quotation.conversionHope"] + "%");
- }
- rightDiv.append(rightP);
- rightDiv.append(smallInfo);
-
- //clear:both
- var clearBoth=$("<div style='clear:both;'/>")
-
- li.append(leftDiv);
- li.append(aSend);
- li.append(aCancelled);
- li.append(rightDiv);
- li.append(clearBoth);
-
- var drafts = $(".drafts");
- drafts.append(li);
- oldQuotation.slideUp();
-
- //update draftAmount and draftAmountHope
- var draftAmount = parseInt($("#draftAmount").text()) + wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var draftAmountHope = parseInt($("#draftAmountHope").text()) + amountHope;
- $("#draftAmount").text(draftAmount);
- $("#draftAmountHope").text(draftAmountHope);
-
- //update leadAmount and leadAmountHope
- var leadAmount = parseInt($("#leadAmount").text()) - wikitty["Quotation.amount"];
- var leadAmountHope = parseInt($("#leadAmountHope").text()) - amountHope;
- $("#leadAmount").text(leadAmount);
- $("#leadAmountHope").text(leadAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#sendingDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage d'un draft -> sent
- $("a.draft").click(draftToSent);
-
- $( "#dialog-form-draftToSent" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var sendingDate = $("#sendDate").val();
- var id = $("#draft-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#sendDate")).add($("#draft-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/send/", id,"?sendingDate=", sendingDate),
- function(data){
- //success
-
- var wikittyId = data.meta.id;
- var wikitty = data.data;
-
- var li = $("<li></li>").addClass("salesFunnelItem draft");
-
- //leftDiv
- var leftDiv = $("<div></div>").addClass("pull-left");
- var aIconEdit = $("<a></a>")
- .attr("href",createUrl("/wikitty/edit/", wikittyId));
- var iconEdit = $("<i></i>").addClass("icon-edit");
- aIconEdit.append(iconEdit);
- leftDiv.append(aIconEdit);
- var smallAccount = $("<small></small>");
- if (wikitty["Quotation.customer"]!=null){
- var customer = data.preloaded[wikitty["Quotation.customer"]];
- var firstName = customer.preloaded[customer.data["Employee.person"]].data["Person.firstName"];
- var lastName = customer.preloaded[customer.data["Employee.person"]].data["Person.lastName"];
- var company = customer.preloaded[customer.data["Employee.company"]].data["Company.name"];
- }
- var aAccount = $("<a></a>")
- .text(firstName + " " + lastName + " (" + company + ")")
- .attr("href", createUrl("/wikitty/Employee/view/", wikitty["Quotation.customer"]));
- smallAccount.append(aAccount);
- leftDiv.append(smallAccount);
- var leftP = $("<p> - </p>");
- var itemTitleSpan = $('<span></span>').addClass('salesFunnelItemTitle');
-
- if (wikitty["Quotation.project"]!=null) {
- var aProject = $("<a/>")
- .addClass("nameLink")
- .attr("href" , createUrl("/wikitty/Project/view/", wikitty["Quotation.project"]))
- .text(data.preloaded[wikitty["Quotation.project"]].data["Project.name"]);
- }
- itemTitleSpan.append(aProject);
- var descriptionSmall = $('<small/>').text(wikitty["Quotation.description"]);
- leftP.append(descriptionSmall);
- leftP.prepend(itemTitleSpan);
- leftDiv.append(leftP);
-
- //button
- var aAccepted = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-success pull-right salesFunnelItemButton sent toAccepted")
- .text("Accepté")
- .click(sentToAccepted);
- var aRejected = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-danger pull-right salesFunnelItemButton sent toRejected")
- .text("Rejeté")
- .click(sentToRejected);
- var aCancelled = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-warning pull-right salesFunnelItemButton sent toCancelled")
- .text("Annuler")
- .click(toCancelled);
-
- //rightDiv
- var rightDiv = $("<div>").addClass("pull-right");
- var rightP = $("<p>").addClass("salesFunnelItemTitle").text(wikitty["Quotation.amount"] +" €");
- if (wikitty["Quotation.category"] != null) {
- var smallInfo = $("<small>")
- .text(data.preloaded[wikitty["Quotation.category"]].data["WikittyTreeNode.name"]
- + ' - ' + wikitty["Quotation.estimatedDays"] + 'j - ' +
- wikitty["Quotation.conversionHope"] + "%");
- }
- rightDiv.append(rightP);
- rightDiv.append(smallInfo);
-
- //clear:both
- var clearBoth=$("<div style='clear:both;'/>")
-
- li.append(leftDiv);
- li.append(aAccepted);
- li.append(aRejected);
- li.append(aCancelled);
- li.append(rightDiv);
- li.append(clearBoth);
-
- var sents = $(".sents");
- sents.append(li);
- oldQuotation.slideUp();
-
- //update draftAmount and draftAmountHope
- var draftAmount = parseInt($("#draftAmount").text()) - wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var draftAmountHope = parseInt($("#draftAmountHope").text()) - amountHope;
- $("#draftAmount").text(draftAmount);
- $("#draftAmountHope").text(draftAmountHope);
-
- //update sentAmount and sentAmountHope
- var sentAmount = parseInt($("#sentAmount").text()) + wikitty["Quotation.amount"];
- var sentAmountHope = parseInt($("#sentAmountHope").text()) + amountHope;
- $("#sentAmount").text(sentAmount);
- $("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#sendDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage d'un sent vers accepted
- $("a.toAccepted").click(sentToAccepted);
-
- $( "#dialog-form-sentToAccepted" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var acceptedDate = $("#acceptedDate").val();
- var id = $("#sent-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#acceptedDate")).add($("#sent-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/accept/", id,"?acceptedDate=", acceptedDate),
- function(data){
- //success
- oldQuotation.slideUp();
-
- var wikitty = data.data;
-
- //update sentAmount and sentAmountHope
- var sentAmount = parseInt($("#sentAmount").text()) - wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var sentAmountHope = parseInt($("#sentAmountHope").text()) - amountHope;
- $("#sentAmount").text(sentAmount);
- $("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#acceptedDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage d'un sent vers rejected
- $("a.toRejected").click(sentToRejected);
-
- $( "#dialog-form-sentToRejected" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var rejectedDate = $("#rejectedDate").val();
- var id = $("#rejected-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#rejectedDate")).add($("#rejected-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/reject/", id,"?rejectedDate=", rejectedDate),
- function(data){
- //success
- oldQuotation.slideUp();
-
- var wikitty = data.data;
-
- //update sentAmount and sentAmountHope
- var sentAmount = parseInt($("#sentAmount").text()) - wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var sentAmountHope = parseInt($("#sentAmountHope").text()) - amountHope;
- $("#sentAmount").text(sentAmount);
- $("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#rejectedDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage vers cancelled
- $("a.toCancelled").click(toCancelled);
-
- $( "#dialog-form-toCancelled" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var cancelledDate = $("#cancelledDate").val();
- var reason = $("#cancelledReason").val();
- var id = $("#cancelled-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#cancelledDate")).add($("#cancelled-wikittyId")).add($("#cancelledReason"));
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/cancel/", id,"?cancelledDate=", cancelledDate,"&reason=",reason),
- function(data){
- //success
- oldQuotation.slideUp();
-
- var wikitty = data.data;
-
- //TODO JC20130527 update amounts
- //update sentAmount and sentAmountHope
- //var sentAmount = parseInt($("#sentAmount").text()) - wikitty["Quotation.amount"];
- //var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- //var sentAmountHope = parseInt($("#sentAmountHope").text()) - amountHope;
- //$("#sentAmount").text(sentAmount);
- //$("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#cancelledDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
// ********************************************************************
// * PROJECT DASHBOARD *
// ********************************************************************
Added: trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,242 @@
+var salesFunnel = angular.module('salesFunnel', ['wikitty', 'ui.bootstrap', 'ui.date']);
+
+salesFunnel.directive('datepicker', function() {
+ return {
+ restrict: 'A',
+ require : 'ngModel',
+ link : function (scope, element, attrs, ngModelCtrl) {
+ $(function(){
+ element.datepicker({
+ dateFormat:'dd/mm/yy',
+ onSelect:function (date) {
+ ngModelCtrl.$setViewValue(date);
+ scope.$apply();
+ }
+ });
+ });
+ }
+ }
+});
+
+
+var salesFunnelController = ['$scope', '$dialog', 'Wikitty', function ($scope, $dialog, Wikitty) {
+ $scope.wikittyId = '';
+ $scope.wikitty = {};
+
+ $scope.leads = {};
+ $scope.leadsAmount=0;
+ $scope.leadsAmountHope=0;
+ $scope.drafts={};
+ $scope.draftsAmount=0;
+ $scope.draftsAmountHope=0;
+ $scope.sents={};
+ $scope.sentsAmount=0;
+ $scope.sentsAmountHope=0;
+
+ Wikitty.query("extension = Quotation AND extension != Draft AND extension != Cancelled", function(w) {
+ $scope.leads= w;
+ });
+
+ Wikitty.query("extension = Draft AND extension != Sent AND extension != Cancelled", function(w) {
+ $scope.drafts= w;
+ });
+
+ Wikitty.query("extension = Sent AND extension != Accepted AND extension != Rejected AND extension != Cancelled", function(w) {
+ $scope.sents= w;
+ });
+
+ $scope.leadToDraft = function(lead){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-leadToDraft.html',
+ controller: 'LeadToDraftDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {lead:lead, leads:$scope.leads, drafts:$scope.drafts};
+ }
+ }
+ });
+ d.open();
+ //initFields();
+ };
+
+ $scope.draftToSent = function(draft){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-draftToSent.html',
+ controller: 'DraftToSentDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {draft:draft, drafts:$scope.drafts, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+
+ $scope.sentToAccepted = function(sent){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-sentToAccepted.html',
+ controller: 'SentToAcceptedDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {sent:sent, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+
+ $scope.sentToRejected = function(sent){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-sentToRejected.html',
+ controller: 'SentToRejectedDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {sent:sent, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+
+ $scope.cancel = function(toCancel){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-cancel.html',
+ controller: 'CancelDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {toCancel:toCancel, leads:$scope.leads, drafts:$scope.drafts, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+}];
+
+
+
+// Controller for the Lead To Draft Dialog
+var LeadToDraftDialogController = ['$scope', '$http', 'dialog', 'dialogModel', 'Wikitty', function ($scope, $http, dialog, dialogModel, Wikitty) {
+ $scope.lead = dialogModel.lead;
+ $scope.drafts = dialogModel.drafts;
+ $scope.leads = dialogModel.leads;
+ $scope.lead.sendingDate = new Date().toString("dd/mm/yy");
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/answer/'+$scope.lead.meta.id),
+ {params: {sendingDate:$scope.lead.sendingDate,reference:$scope.lead.reference}}).success(
+ function(data,status){
+ scope.drafts.push(new Wikitty(data));
+ scope.leads.splice(scope.leads.indexOf(scope.lead),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Draft To Sent Dialog
+var DraftToSentDialogController = ['$scope', '$http', 'dialog', 'dialogModel', 'Wikitty', function ($scope, $http, dialog, dialogModel, Wikitty) {
+ $scope.draft = dialogModel.draft;
+ $scope.drafts = dialogModel.drafts;
+ $scope.sents = dialogModel.sents;
+ //$scope.draft.sendingDate = new Date().toString("dd/mm/yy");
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/send/'+$scope.draft.meta.id),
+ {params: {sendingDate:$scope.draft.sendingDate}}).success(
+ function(data,status){
+ scope.sents.push(new Wikitty(data));
+ scope.drafts.splice(scope.drafts.indexOf(scope.draft),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Sent to Accepted Dialog
+var SentToAcceptedDialogController = ['$scope', '$http', 'dialog', 'dialogModel', function ($scope, $http, dialog, dialogModel) {
+ $scope.sent = dialogModel.sent;
+ $scope.sents = dialogModel.sents;
+ $scope.sent.acceptedDate = new Date();
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/accept/'+$scope.sent.meta.id),
+ {params: {acceptedDate:$scope.sent.acceptedDate}}).success(
+ function(data,status){
+ $scope.sents.splice($scope.sents.indexOf(sent),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Sent to Rejected Dialog
+var SentToRejectedDialogController = ['$scope', '$http', 'dialog', 'dialogModel', function ($scope, $http, dialog, dialogModel) {
+ $scope.sent = dialogModel.sent;
+ $scope.sents = dialogModel.sents;
+ $scope.sent.rejectedDate = new Date();
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/reject/'+$scope.sent.meta.id),{params: {rejectedDate:$scope.sent.rejectedDate}}).success(
+ function(data,status){
+ $scope.sents.splice($scope.sents.indexOf(sent),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Cancel Dialog
+var CancelDialogController = ['$scope', '$http', 'dialog', 'dialogModel', function ($scope, $http, dialog, dialogModel) {
+ $scope.toCancel = dialogModel.toCancel;
+ $scope.sents = dialogModel.sents;
+ $scope.leads = dialogModel.leads;
+ $scope.drafts = dialogModel.drafts;
+ $scope.toCancel.cancelledDate = new Date();
+ $scope.toCancel.cancelledReason = "";
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/cancel/'+$scope.sent.meta.id),{params: {rejectedDate:$scope.sent.rejectedDate}}).success(
+ function(data,status){
+ dialog.close();
+ }
+ );
+ }
+}];
\ No newline at end of file
1
0
Author: meynier
Date: 2013-08-16 11:51:45 +0200 (Fri, 16 Aug 2013)
New Revision: 388
Url: http://chorem.org/projects/chorem/repository/revisions/388
Log:
Update the documentation
Modified:
trunk/src/site/rst/calculations.rst
Modified: trunk/src/site/rst/calculations.rst
===================================================================
--- trunk/src/site/rst/calculations.rst 2013-08-16 09:07:56 UTC (rev 387)
+++ trunk/src/site/rst/calculations.rst 2013-08-16 09:51:45 UTC (rev 388)
@@ -146,16 +146,19 @@
-----------------
La classe **AdcCalculation** dans le package *org.chorem.project* gère le calcul du CJM [2]_ (ou ADC).
-Il existe deux types de CJM : le CJM réel est le CJM estimé. Une seule variable du calcul change : le temps productif sur l'année.
+Il existe deux types de CJM : le CJM réel et le CJM estimé. Une seule variable du calcul change : le temps productif sur l'année.
+
Dans le cas du CJM estimé, ce temps est calculé à partir du temps journalier et du taux de productivité.
-Dans le cas du CJM réel, il est calculé à partir des objets Time de l'année concernée.::
+Dans le cas du CJM réel, il est calculé à partir des objets Time de l'année concernée.
- adc = ( (expenses * employeeCost) / totalCompanyCost ) / productiveDays;
+Les dépenses sont calculées à partir de l'année concernée. Pour le CJM estimé, c'est l'année précédente qui est prise en compte.::
+ adc = ( (totalExpenses * employeeCost) / totalEmployeesCost ) / productiveDays;
+
2.1.1 Dépenses totales
~~~~~~~~~~~~~~~~~~~~~~
-Les dépenses totales sont la somme des paiements (FinancialTransaction) effectués par l'entreprise sur l'année. Une simple requête Wikitty est effectué afin de récupérer ces objets FinancialTransaction afin d'effectuer la somme des montants HT::
+Les dépenses totales sont la somme des paiements (FinancialTransaction) effectués par l'entreprise sur l'année. Une requête Wikitty est effectuée afin de récupérer ces objets FinancialTransaction afin d'effectuer la somme des montants HT::
totalExpenses = Σ expense
@@ -164,7 +167,7 @@
Le coût annuel de l'employé est le salaire à temps plein multiplié par le nombre de jours travaillé durant l'année::
- employeeCost = ( employee.salary + employee.otherPayments) * employee.partialTime * productiveDays
+ employeeCost = ( ( employee.salary + employee.otherPayments) / employee.partialTime) * productiveDays
2.1.3 Nombre de jours travaillés
@@ -186,12 +189,12 @@
productiveDays = ( Σ(times(employee)) / dailyHoursWorked ) * productivityRate
-2.1.4 Coût annuel de l'entreprise
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2.1.4 Coût annuel des employés
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Le coût annuel de l'entreprise est la somme des coûts annuels des employés productifs.::
- totalCompanyCost = Σ employeeCost(company.employees)
+ totalEmployeesCost = Σ employeeCost(company.employees)
.. [1] Taux Journalier Moyen (ADR : Average Daily Rate)
1
0
r387 - in trunk: chorem-entities/src/main/java/org/chorem/entities chorem-entities/src/main/java/org/chorem/project chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project
by meynier@users.chorem.org 16 Aug '13
by meynier@users.chorem.org 16 Aug '13
16 Aug '13
Author: meynier
Date: 2013-08-16 11:07:56 +0200 (Fri, 16 Aug 2013)
New Revision: 387
Url: http://chorem.org/projects/chorem/repository/revisions/387
Log:
Cleaned the code
Removed:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java
Modified:
trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java
trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
Modified: trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -41,6 +41,19 @@
DELIVERED, // developpement fini et livre (on peut envoyer la facture de fin)
RSV, // l'application est en verification en service regulier chez le client (~1 mois)
WARRANTY, // fin de la vsr, on passe en garantie et on peut facture le reste (s'il reste encore des choses)
- CLOSED // tout est fini et clos, plus rien a faire
+ CLOSED; // tout est fini et clos, plus rien a faire
+ String[] extensions = {
+ "Quotation",
+ "Draft",
+ "Sent",
+ "Rejected",
+ "Accepted",
+ "Started",
+ "Delivered",
+ "RSV",
+ "Warranty",
+ "Closed",
+ "Cancelled"
+ };
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -18,6 +18,7 @@
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
+import org.nuiton.wikitty.query.conditions.Aggregate;
/**
* Makes the calculation for the adc.
@@ -72,7 +73,7 @@
/**
* Initiate the start and end date to the beginning and end of the year
- * TODO : Manage this in the configuration of chorem
+ * TODO : Manage this in the admin configuration of chorem
*/
protected void initDate() {
Calendar cstart = new GregorianCalendar();
@@ -110,6 +111,8 @@
//Construct the query
WikittyQuery expenseQuery = new WikittyQueryMaker()
+ .select()
+ .sum(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_AMOUNT)
.and()
.exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) //of type financial transaction
.or()
@@ -120,34 +123,42 @@
//The payment hapened during the year
.bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end)
.end();
+ System.out.println("QUERY = " + expenseQuery);
- WikittyQueryResult<FinancialTransaction> result = client.findAllByQuery(FinancialTransaction.class, expenseQuery);
-
+ //WikittyQueryResult<FinancialTransaction> result = client.findAllByQuery(FinancialTransaction.class, expenseQuery);
+ Double result = client.findByQuery(Double.class, expenseQuery);
//Calculates the total
- double total = 0;
- for(FinancialTransaction ft : result.getAll()) {
+ double total = result;
+ System.out.println("RESULT = " + result);
+ /*for(FinancialTransaction ft : result.getAll()) {
total += ft.getAmount();
- }
+ }*/
return total;
}
/**
- * Calculates the employee cost at full time
- * @return
+ * Calculates the employee cost at full time.
+ *
+ * @param e employee concerned
+ * @return employee cost at full time
*/
public double getMonthlyFullTimeCost(EmployeeHR e) {
double salary = e.getSalary();
double otherPayments = e.getOtherPayments();
double partialTime = e.getPartialTime();
- return ( ( salary + otherPayments) * (partialTime/100) );
+ return ( ( salary + otherPayments) * 100 ) / partialTime;
}
/**
- * calculates the estimated number of prodctive days when the employee will work
- * @return
+ * calculates the estimated number of productive days when the employee will work
+ *
+ * It takes the average number of days in a year (218) and multiplicates it by the partial time
+ * and the productivity rate
+ * @param e employee concerned
+ * @return estimated number of productive days
*/
public double getEstimatedNumberOfProductiveDays(EmployeeHR e) {
int daysInYear = 218; //It would be *much* better to calculate this or at least get it from input
@@ -159,7 +170,7 @@
/**
* Returns the real number of procuctive days in year, which is the sum of all the time object by the employee
- * @param e
+ * @param e employee concerned
* @return
*/
public double getRealNumberOfProductiveDays(EmployeeHR e) {
@@ -213,6 +224,7 @@
double total = 0;
for(EmployeeHR e : getEmployeesHR()) {
total += getYearCost(e, real);
+ System.out.println("total = " + total);
}
return total;
}
@@ -267,8 +279,9 @@
}
/**
- * Returns the employee's adc
- * @return
+ * Returns the employee's adc.
+ * See the documentation for a complete description of the operations made during this calculation.
+ * @return the employee's adc
*/
public double getAdc(boolean real) {
@@ -285,47 +298,23 @@
double cost = getYearCost(employee, real);
double totalCost = getTotalYearCost(real);
- System.out.println("EXPENSES : " + expenses);
- System.out.println("PROD DAYS : " + productiveDays);
- System.out.println("COST : " + expenses);
- System.out.println("TOTAL COST : " + expenses);
-
double adc = ( (expenses * cost) / totalCost ) / productiveDays;
return adc;
}
- public double getAdc() {
- return getAdc(false);
- }
- public Map<String, Double> getMultipleAdc() {
- return getMultipleAdc(false);
- }
/**
* Returns multiple adc form the given employee list.
* @param client
* @param employees
- * @return
+ * @return adc of the employees
*/
public Map<String, Double> getMultipleAdc(boolean real) {
if(employees.size() == 0)
return null;
- Calendar cend = new GregorianCalendar();
- cend.add(Calendar.YEAR, -1);
- cend.set(Calendar.MONTH, Calendar.DECEMBER);
- cend.set(Calendar.DAY_OF_MONTH, 31);
-
- Calendar cstart = new GregorianCalendar();
- cstart.add(Calendar.YEAR, -1);
- cstart.set(Calendar.MONTH, Calendar.JANUARY);
- cstart.set(Calendar.DAY_OF_MONTH, 1);
-
- Date start = cstart.getTime();
- Date end = cend.getTime();
-
//Calculate all the "static" values before
double expenses = getTotalExpenses();
@@ -359,10 +348,4 @@
}
-
-
-
-
-
-
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -1,6 +1,7 @@
package org.chorem.project;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import org.chorem.ChoremClient;
@@ -72,26 +73,30 @@
/**
* Calculates the real number of days from the Time objects.
- * @return
+ * @return real number of days needed for the project/task
*/
public abstract double realDays();
/**
* Return the times (in hour) per employee for the current object
- * @return
+ * @return time spent on the project/task (per Employee)
*/
- protected abstract HashMap<Employee, Double> getTimes();
+ protected abstract Map<Employee, Double> getTimes();
/**
* Return the percentages for the current object
- * @return
+ * @return estimated time spent on the project/task (per Employee, in percentage)
*/
- protected abstract HashMap<Employee, Double> getPercentages();
+ protected abstract Map<Employee, Double> getPercentages();
- public HashMap<Employee, Double> getTimePercentages() {
- HashMap<Employee, Double> times = getTimes();
- HashMap<Employee, Double> timePercentages = new HashMap<Employee, Double>();
+ /**
+ * Calculates the percentage of time spent on the project/task
+ * @return time spent on the project/task (per Employee, in percentage)
+ */
+ public Map<Employee, Double> getTimePercentages() {
+ Map<Employee, Double> times = getTimes();
+ Map<Employee, Double> timePercentages = new HashMap<Employee, Double>();
double sum = 0;
Set<Employee> keySet = times.keySet();
for (Employee key : keySet) {
@@ -106,12 +111,12 @@
}
/**
* Return the average Return for all the employees, ponderated by the percentages
- * @return
+ * @return average estimated return
*/
public double avgReturn() {
//Fetch the percentages per employee
- HashMap<Employee, Double> percentages = getPercentages();
+ Map<Employee, Double> percentages = getPercentages();
if(percentages.size() == 0) {
return client.getConfiguration().getDailyReturn();
}
@@ -126,10 +131,10 @@
/**
* Calculates the real daily return from the different times object and the daily return of the employees.
- * @return
+ * @return real average return
*/
public double realReturn() {
- HashMap<Employee, Double> times = getTimes();
+ Map<Employee, Double> times = getTimes();
if(times.size() == 0) {
return client.getConfiguration().getDailyReturn();
}
@@ -139,9 +144,6 @@
double srp = client.getDailyReturn(key);
double hoursPerDay = client.getDailyHoursWorked(key);
- //TODO :Find a way to use the different work hours
-
- //}
realReturn += srp* ( times.get(key) / hoursPerDay ) ;
}
realReturn = realReturn/getRealDays();
@@ -160,8 +162,8 @@
/**
- * Gives the difference between the real number of days and the estimated value
- * @return
+ * Gives the difference between the real number of days and the estimated value of days spent
+ * @return difference between estimation and real time
*/
public double deltaDays() {
return getRealDays() - nbDays;
@@ -169,7 +171,7 @@
/**
* Calculates the real ADR from the real number of days.
- * @return
+ * @return real adr
*/
public double realAdr() {
double realDays = getRealDays();
@@ -179,7 +181,7 @@
/**
* Profit calculated from the estimated ADR and the estimated numer of days
- * @return
+ * @return expected profit
*/
public double expectedProfit() {
return amount - (nbDays*getAvgReturn());
@@ -187,15 +189,16 @@
/**
* Real profit (or loss) done when the quotation is closed.
- * @return
+ * @return real profit (or loss)
*/
public double lossOrProfit() {
return amount - (getRealDays() * getRealReturn());
}
/**
- * Average profit/loss per day
- * @return
+ * Average profit/loss per day.
+ * It is not currently used in the dashboards.
+ * @return average profit (or loss) per day
*/
public double resultPerDay() {
return getLossOrProfit() / getRealDays();
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -2,6 +2,7 @@
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.chorem.ChoremClient;
import org.chorem.entities.Employee;
@@ -11,8 +12,13 @@
public class QuotationCalculation extends Calculation<Quotation> {
- private List<Task> tasks = null;
+ protected List<Task> tasks = null;
+ /**
+ * Initiate the calculation class
+ * @param q quotation
+ * @param client chorem client
+ */
public QuotationCalculation(Quotation q, ChoremClient client) {
super(q, q.getAmount(), q.getEstimatedDays(), client);
}
@@ -30,8 +36,8 @@
}
@Override
- public HashMap<Employee, Double> getPercentages() {
- HashMap<Employee, Double> percentages = new HashMap<Employee, Double>();
+ public Map<Employee, Double> getPercentages() {
+ Map<Employee, Double> percentages = new HashMap<Employee, Double>();
double totalDays = 0;
for(Task t : getTasks())
totalDays += t.getEstimatedDays();
@@ -39,7 +45,7 @@
List<Task> tasks = getTasks();
for(Task t : tasks) {
- HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getPercentages();
+ Map<Employee, Double> taskPercentages = new TaskCalculation(t, client).getPercentages();
for(Employee emp : taskPercentages.keySet()) {
double rate = (t.getEstimatedDays()/totalDays);
if(percentages.containsKey(emp)) {
@@ -53,22 +59,18 @@
}
}
- //Caluculate the average for each employee
- /*Set<Employee> keySet = percentages.keySet();
- for(Employee emp : keySet) {
- percentages.put(emp, percentages.get(emp)/tasks.size());
- }*/
+
return percentages;
}
@Override
- public HashMap<Employee, Double> getTimes() {
+ public Map<Employee, Double> getTimes() {
HashMap<Employee, Double> times = new HashMap<Employee, Double>();
for(Task t : getTasks()) {
- HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getTimes();
+ Map<Employee, Double> taskPercentages = new TaskCalculation(t, client).getTimes();
for(Employee emp : taskPercentages.keySet()) {
if(times.containsKey(emp)) {
times.put(emp, times.get(emp) + taskPercentages.get(emp));
@@ -85,8 +87,8 @@
}
/**
- * Fetch the tasks of the quotation keep a reference
- * @return
+ * Fetch the tasks of the quotation and keep a reference
+ * @return lits of the quotation's task
*/
public List<Task> getTasks() {
if(tasks == null)
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Map;
import org.chorem.ChoremClient;
import org.chorem.ChoremUtil;
@@ -53,8 +54,8 @@
}
@Override
- protected HashMap<Employee, Double> getPercentages() {
- HashMap<Employee, Double> pct = new HashMap<Employee, Double>();
+ protected Map<Employee, Double> getPercentages() {
+ Map<Employee, Double> pct = new HashMap<Employee, Double>();
//get all the Worker objects
WikittyQuery workerQuery = new WikittyQueryMaker()
.eq(Worker.ELEMENT_FIELD_WORKER_TASK, e)
@@ -72,8 +73,8 @@
}
@Override
- protected HashMap<Employee, Double> getTimes() {
- HashMap<Employee, Double> times = new HashMap<Employee, Double>();
+ protected Map<Employee, Double> getTimes() {
+ Map<Employee, Double> times = new HashMap<Employee, Double>();
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -1,7 +1,7 @@
package org.chorem.project;
-import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.chorem.entities.Employee;
import org.chorem.entities.Quotation;
@@ -9,7 +9,9 @@
/**
* Calculates the total values of the quotation calculations
* Usage : construct the cobject by sending the list of quotation in parameter, then you can get the totals
- * by using the total* methdds.
+ * by using the total methods.
+ * Fore the totalAmount and the total estimated days, juste call the getAmount and getEstimatedDays functions,
+ * as it is calculated during the object's initialisation.
* @author gwenn
*
*/
@@ -18,20 +20,20 @@
/**
* List of quotation calculation
*/
- private List<QuotationCalculation> calculations;
+ protected List<QuotationCalculation> calculations;
/**
- *
- * @param calculations list of calculation used to calculate the total.
+ * Initiates the calculation object by calculating the total amount and the total estimated days
+ * @param calculations list of QuotationCalculation objects used to calculate the total.
*/
public TotalQuotationCalculation(List<QuotationCalculation> calculations) {
super(null, totalAmount(calculations), totalEstimatedDays(calculations), null);
- //super(q, q.getAmount(), q.getEstimatedDays(), client);
this.calculations = calculations;
}
/**
- *
+ * Calculates the total amount of all the quotations
+ * This is a method called on initialisation. It shouldn't be called in any other context.
* @param calculations
* @return total amount
*/
@@ -45,9 +47,10 @@
}
/**
- *
+ * Calculates the total estimatedDays
+ * This is a method called on initialisation. It shouldn't be called in any other context.
* @param calculations
- * @return
+ * @return estimated days.
*/
private static double totalEstimatedDays(List<QuotationCalculation> calculations) {
double total = 0;
@@ -121,22 +124,24 @@
+ /*
+ * Those following methods should'nt be called
+ */
-
@Override
- public HashMap<Employee, Double> getPercentages() {
+ public Map<Employee, Double> getPercentages() {
return null;
}
@Override
- public HashMap<Employee, Double> getTimePercentages() {
+ public Map<Employee, Double> getTimePercentages() {
return null;
}
@Override
- public HashMap<Employee, Double> getTimes() {
+ public Map<Employee, Double> getTimes() {
return null;
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -68,7 +68,6 @@
- // simply return them
return renderView("dashboardAdc.jsp",
"employees", employees,
"from", from,
@@ -117,7 +116,7 @@
/**
- * Structure used to store information about an employee Used for the AJAX
+ * Structure used to store information about an employee. Used for the AJAX
* request
*
* @author gwenn
@@ -145,7 +144,7 @@
}
/**
- * Structure used to store information about an employee used for the
+ * Structure used to store information about an employee. used for the
* standard http request
*
* @author gwenn
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -2,7 +2,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -16,6 +15,7 @@
import org.chorem.entities.ADC;
import org.chorem.entities.ADCImpl;
import org.chorem.entities.Company;
+import org.chorem.entities.CompanyHR;
import org.chorem.entities.CompanyImpl;
import org.chorem.entities.Employee;
import org.chorem.entities.EmployeeHR;
@@ -93,8 +93,8 @@
Map<String, Object> params = call.getExtractParameters();
for(String key : params.keySet()) {
//Prevent false data
- if((key.equals("CompanyHR.dailyReturn")
- || key.equals("CompanyHR.dailyHoursWorked"))) {
+ if((key.equals(CompanyHR.FQ_FIELD_COMPANYHR_DAILYRETURN)
+ || key.equals(CompanyHR.FQ_FIELD_COMPANYHR_DAILYHOURSWORKED))) {
try {
double value = Double.parseDouble(((String[])params.get(key))[0]);
w.setFqField(key, value);
@@ -111,7 +111,7 @@
if(addExtension != null && addExtension.equals("true")) {
Wikitty w = client.restore(company.getWikittyId());
- w.addExtension(client.restoreExtensionLastVersion("CompanyHR"));
+ w.addExtension(client.restoreExtensionLastVersion(CompanyHR.EXT_COMPANYHR));
client.store(w);
}
@@ -221,8 +221,8 @@
*/
public Render editEmployeeValues(ChoremClient client, String employeeId, String salaryStr
, String productivityRateStr, String partialTimeStr, String dailyReturnStr, String otherPaymentsStr) {
+ Render render = null;
Wikitty employeeWikitty = client.restore(employeeId);
- Employee employee = new EmployeeImpl(employeeWikitty);
if(!employeeWikitty.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) {
employeeWikitty.addExtension(client.restoreExtensionLastVersion(EmployeeHR.EXT_EMPLOYEEHR));
}
@@ -273,32 +273,37 @@
if(partialTime > 100 || partialTime < 0) {
errors.add(new ErrorJson("partialTime", "Partial time must be between 0 and 100"));
}
- if(errors.size() != 0)
- return renderJSON("data", "error", "errors", errors);
+
+
+
+ if(errors.size() != 0) {
+ render = renderJSON("data", "error", "errors", errors);
+ }
+ else {
+ if(salary != 0)
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_SALARY, salary);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PRODUCTIVITYRATE, productivityRate);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PARTIALTIME, partialTime);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_DAILYRETURN, dailyReturn);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_OTHERPAYMENTS, otherPayments);
+ client.store(employeeWikitty);
- if(salary != 0)
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_SALARY, salary);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PRODUCTIVITYRATE, productivityRate);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PARTIALTIME, partialTime);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_DAILYRETURN, dailyReturn);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_OTHERPAYMENTS, otherPayments);
- client.store(employeeWikitty);
+ EmployeeData data = new EmployeeData(new EmployeeImpl(employeeWikitty), client);
- EmployeeData data = new EmployeeData(new EmployeeImpl(employeeWikitty), client);
+ EmployeeJson json = new EmployeeJson(
+ data.getSalary() + "",
+ data.getProductivityRate(),
+ data.getPartialTime(),
+ data.getDailyReturn(),
+ data.getDailyHoursWorked(),
+ data.getOtherPayments()
+ );
+ render = renderJSON("data", json);
+ }
+ return render;
- EmployeeJson json = new EmployeeJson(
- data.getSalary() + "",
- data.getProductivityRate(),
- data.getPartialTime(),
- data.getDailyReturn(),
- data.getDailyHoursWorked(),
- data.getOtherPayments()
- );
-
- return renderJSON("data", json);
-
}
/**
@@ -349,7 +354,7 @@
* @author gwenn
*
*/
- public class EmployeeData implements Comparable{
+ public class EmployeeData implements Comparable<EmployeeData>{
private Employee e;
private String salary;
@@ -413,8 +418,7 @@
}
@Override
- public int compareTo(Object o) {
- EmployeeData e = (EmployeeData)o;
+ public int compareTo(EmployeeData e) {
return this.getObject().getPerson(false).getLastName().compareTo(e.getObject().getPerson(false).getLastName());
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -10,6 +10,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -25,10 +26,8 @@
import org.chorem.entities.Project;
import org.chorem.entities.Task;
import org.chorem.entities.Time;
-import org.chorem.entities.Worker;
import org.chorem.project.QuotationCalculation;
import org.chorem.project.TotalQuotationCalculation;
-import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
@@ -56,7 +55,7 @@
WikittyQuery quotationQuery = new WikittyQueryMaker().ideq(quotationFilter).end();
WikittyQueryResult<Quotation> quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
- HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
+ Map<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
//If some quotation has been found
if(quotationResult != null && quotationResult.size() != 0) {
@@ -95,7 +94,7 @@
WikittyQueryResult<Quotation> quotationResult = null;
- HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
+ Map<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
//Fetch the projects from the id or the filter
WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
@@ -184,7 +183,7 @@
Collection<Quotation> quotations = result.getAll();
- HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
+ Map<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
for(Quotation q : quotations) {
QuotationCalculation calc = new QuotationCalculation(q, client);
calc.calculate();
@@ -207,7 +206,7 @@
}
/**
- *
+ * Generate the employee page
* @param client
* @param id
* @param from
@@ -358,12 +357,12 @@
}
/**
- *
- * @param client
- * @param project_name
- * @param project_id
- * @param quotationFilter
- * @return
+ * Request the generation of the single-projetc page
+ * @param client chorem client
+ * @param project_name project name
+ * @param project_id project id
+ * @param quotationFilter quotation filter
+ * @return the project page
*/
public Render requestProject(ChoremClient client, String project_name, String project_id, String quotationFilter) {
if(quotationFilter == null)
@@ -380,24 +379,24 @@
return render;
}
/**
- *
- * @param client
- * @param from
- * @param to
- * @return
+ * Request the generation of the multi project page
+ * @param client chorem client
+ * @param from start date
+ * @param to end date
+ * @return the multi project page
*/
public Render requestMultiProject(ChoremClient client, Date from, Date to) {
return multiProjectFilter(client, from, to);
}
/**
- *
- * @param client
- * @param id
- * @param from
- * @param to
- * @param quotations
- * @return
+ * request the generation of the employee page
+ * @param client chorem client
+ * @param id employee id
+ * @param from start date
+ * @param to end date
+ * @param quotations quotation filter
+ * @return the employee page
*/
public Render requestEmployee(ChoremClient client, String id, Date from, Date to, String[] quotations) {
System.out.println("QUOTATIONS : " + Arrays.toString(quotations));
Deleted: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -1,17 +0,0 @@
-package org.chorem.webmotion.actions.project;
-
-public interface Extensions {
- public static final String[] extensions = {
- "Quotation",
- "Draft",
- "Sent",
- "Rejected",
- "Accepted",
- "Started",
- "Delivered",
- "RSV",
- "Warranty",
- "Closed",
- "Cancelled"
- };
-}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -45,7 +45,6 @@
protected Wikitty upgradeInternal(ChoremClient client, String id, String[] extensionStr, Call call) {
log.debug("save: " + id);
- System.out.println("EXTENSIONS §§§§ : ");
System.out.println(Arrays.toString(extensionStr));
System.out.println(ChoremUtil.asList(null, extensionStr));
Wikitty w = client.restore(id);
@@ -59,7 +58,6 @@
return w;
Collection<WikittyExtension> exts = client.restoreExtensionLastVersion(extList);
- System.out.println("EXTENSION : " + exts);
w.addExtension(exts);
Map<String, Object> params = call.getExtractParameters();
String error = setWikittyField(w, "", params);
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -6,7 +6,8 @@
import org.chorem.project.TaskCalculation;
/**
- *
+ * Represents a task withe the alert and the info linked to it.
+ * Used in a jsp page.
* @author gwenn
*
*/
1
0
r386 - in trunk: chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project src/site/rst
by meynier@users.chorem.org 14 Aug '13
by meynier@users.chorem.org 14 Aug '13
14 Aug '13
Author: meynier
Date: 2013-08-14 17:57:01 +0200 (Wed, 14 Aug 2013)
New Revision: 386
Url: http://chorem.org/projects/chorem/repository/revisions/386
Log:
Updated doc and src for the alert\/info managment
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
trunk/src/site/rst/calculations.rst
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java 2013-08-14 15:19:41 UTC (rev 385)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java 2013-08-14 15:57:01 UTC (rev 386)
@@ -46,13 +46,13 @@
boolean alert = false;
boolean info = false;
//Test if the statuses are correct
- if(t.getStatus().equalsIgnoreCase("Scheduled")) {
+ if("scheduled".equalsIgnoreCase(t.getStatus())) {
if(t.getBeginDate().before(now.getTime())) {
alert = true;
alertStr += "Task " + t.getName() + " should be started";
}
}
- else if(t.getStatus().equalsIgnoreCase("Started")) {
+ else if("started".equalsIgnoreCase(t.getStatus())) {
if(t.getEndDate().before(now.getTime())) {
alert = true;
@@ -60,8 +60,12 @@
}
}
- for(Time time : client.getTimes(t)) {
- if(time.getBeginDate().before(t.getBeginDate()) || time.getEndDate().before(t.getBeginDate())) {
+ List<Time> times = client.getTimes(t);
+
+
+ for(Time time : times) {
+ if((time.getBeginDate().before(t.getBeginDate()) || time.getEndDate().before(t.getBeginDate()))
+ || (times.size() != 0 && "scheduled".equalsIgnoreCase(t.getStatus()))) {
info=true;
infoStr = "Times have been added to the task but is is not started";
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 15:19:41 UTC (rev 385)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 15:57:01 UTC (rev 386)
@@ -5,6 +5,11 @@
import org.chorem.entities.Task;
import org.chorem.project.TaskCalculation;
+/**
+ *
+ * @author gwenn
+ *
+ */
public class TaskData extends TaskCalculation {
Modified: trunk/src/site/rst/calculations.rst
===================================================================
--- trunk/src/site/rst/calculations.rst 2013-08-14 15:19:41 UTC (rev 385)
+++ trunk/src/site/rst/calculations.rst 2013-08-14 15:57:01 UTC (rev 386)
@@ -132,10 +132,13 @@
En cas de dépassement des délais ou autre déroulement non prévu, des alertes sont affichées sur le tableau de bord. Voici la liste des évenements déclenchant, pour l'instant, des alertes :
* La tâche devrait avoir commencé (statut "SCHEDULED" alors que la date de début est passée)
- * La tâche a été commencé en avance (statut "STARTED" alors que la date de début n'est pas passée)
* La tâche devrait être finie (statut "STARTED" alors que la date de fin est passée)
- * La tâche a été finie en avance (statut "FINISHED" alors que la date de début n'est pas passée)
+Des informations d'une importance inférieure sont également reportées sous forme d'informations pour les évenements suivants :
+
+ * Un temps a été ajouté alors que la tâche n'est pas commencée
+ * Un temps a été ajouté après la date de fin de la tâche
+
2. Gestion des employés
=======================
1
0
Author: meynier
Date: 2013-08-14 17:19:41 +0200 (Wed, 14 Aug 2013)
New Revision: 385
Url: http://chorem.org/projects/chorem/repository/revisions/385
Log:
Added the calculation documentation
Added:
trunk/src/site/rst/calculations.rst
Modified:
trunk/src/site/site_fr.xml
Added: trunk/src/site/rst/calculations.rst
===================================================================
--- trunk/src/site/rst/calculations.rst (rev 0)
+++ trunk/src/site/rst/calculations.rst 2013-08-14 15:19:41 UTC (rev 385)
@@ -0,0 +1,199 @@
+========================
+Gestion de projet Chorem
+========================
+--------------------------------------------------
+Outil de gestion et de suivi de projet dans Chorem
+--------------------------------------------------
+
+.. contents::
+
+1. Bilan projet
+===============
+
+Le bilan de projet présente divers calculs financiers liés aux projets.
+
+Un certain nombre d'éléments sont à saisir manuellement, les champs en italique sont nécéssaires pour les calculs présent dans le bilan/tableau de bord :
+
+1.1. Quotation
+--------------
+
+:*Interval*: l'intervalle de temps sur lequel se déroule le devis
+:description: description du devis
+:*estimatedDays*: nombre de jours-homme estimés
+:*amount*: montant facturé au client
+:VAT: taxe à appliquer au montant
+:conversionHope: pourcentage de réussite du projet
+:supplier: personne chargée du dossier dans l'entreprise
+:customer: personne chargée du dossier coté client
+:project: projet lié au devis
+:category: catégorie du devis
+
+Pour chaque devis, un ensemble de tâche est associé. Les calculs effectués sur les tâches sont les mêmes que ceux des devis, seul le calcul de certains éléments diffèrent.
+Les champs à saisir manuellement des tâches est :
+
+1.2. Task
+---------
+
+:*Interval*: l'intervalle de temps sur lequel se déroule la tâche
+:description: description de la tâche
+:*dayExtension*: jours supplémentaire nécéssaires pour finir la tâche
+:*price*: prix facturé pour la tâche
+:*estimatedDays*: nombre de jours-homme estimés
+:name: nom de la tâche
+:*status*: statut de la tâche, devant être actualisé à chaque modification de statut
+:*quotation*: devis lié à la tâche
+
+1.3. Calculs
+------------
+
+Les calculs sont effectués grâce à la classe **Calculation** présente dans le package *org.chorem.project*. C'est une classe abstraite qui factorise les calculs des Task et des Quotation. Les classes **QuotationCalculation** et **TaskCalculation** définissent les méthodes spécifiques au type d'objet.
+
+1.3.1. TJM [1]_ estimé
+~~~~~~~~~~~~~~~~~~~~~~
+
+Le TJM (ou ADR) est ce qui facturé au client par jour::
+
+ adr = amount / estimatedDays
+
+1.3.2. TJM réel
+~~~~~~~~~~~~~~~
+
+Le TJM réel est calculé en fonction du nombre de `jours réels`_ ::
+
+ adr = amount / realDays
+
+.. _`jours réels`:
+
+1.3.3. Jours réels
+~~~~~~~~~~~~~~~~~~
+La méthode realDays() permet de calculer le nombre de jours réels qu'a pris le projet. Cette méthode est abstraite dans **Calculation**. La durée réelle d'un devis est la somme de la durée de ses tâches.
+Le calcul de la durée réelle est effectuée de deux manières différentes, si le devis est terminé ou non.
+
+a. Devis non terminé
+____________________
+
+Si le devis n'est pas terminé, le nombre de jours réels est égal au nombre de jours éstimé plus le nombre de jours supplémentaire::
+
+ realDays = estimatedDays + dayExtension
+
+b. Devis terminé
+________________
+
+Si le devis est terminé, le nombre de jours réels est égal à la somme des temps passés sur la tâche (objets Time)::
+
+ realDays = Σ time
+
+Le temps est divisé en jours, en prenant comme diviseur l'horaire journalier de l'employé concerné.::
+
+ time = hours / employee.dailyHoursWorked
+
+1.3.4. Différence estimation/réel
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Simple soustraction entre le nombre de jours estimés et `jours réels`_::
+
+ deltaDays = realDays - estimatedDays
+
+.. _`CJM estimé`:
+
+1.3.5. CJM [2]_ estimé
+~~~~~~~~~~~~~~~~~~~~~~
+
+Moyenne des CJM (ou ADC) des employés en fonction du pourcentage estimé (pour un devis, un calcul du pourcentage moyen par employé est effectué au préalable)::
+
+ estimatedAdc = Σ (employee.adc*task.estimatedPercentage(employee))
+
+.. _`CJM réel`:
+
+1.3.6. CJM réel
+~~~~~~~~~~~~~~~
+
+Moyenne des CJM (ou ADC) des employés en fonction du temps réel passé::
+
+ estimatedAdc = Σ (employee.adc*employee.timeSpent)
+
+1.3.7. Gain attendu
+~~~~~~~~~~~~~~~~~~~
+
+Le gain attendu est calculé à partir du montant, du nombre de jours estimés et du `CJM estimé`_ ::
+
+ expectedProfit = amount - (estimatedDays * estimatedAdc)
+
+1.3.7. Gain ou perte réelle
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Gain ou perte réalisée à la fin du projet, calculée à partir du nombre de `jours réels`_ et du `CJM réel`_ ::
+
+ lossOrProfit = amount - (realDays * realAdc)
+
+1.4. Alertes des tâches
+-----------------------
+
+En cas de dépassement des délais ou autre déroulement non prévu, des alertes sont affichées sur le tableau de bord. Voici la liste des évenements déclenchant, pour l'instant, des alertes :
+
+ * La tâche devrait avoir commencé (statut "SCHEDULED" alors que la date de début est passée)
+ * La tâche a été commencé en avance (statut "STARTED" alors que la date de début n'est pas passée)
+ * La tâche devrait être finie (statut "STARTED" alors que la date de fin est passée)
+ * La tâche a été finie en avance (statut "FINISHED" alors que la date de début n'est pas passée)
+
+2. Gestion des employés
+=======================
+
+2.1 Calcul du CJM
+-----------------
+
+La classe **AdcCalculation** dans le package *org.chorem.project* gère le calcul du CJM [2]_ (ou ADC).
+Il existe deux types de CJM : le CJM réel est le CJM estimé. Une seule variable du calcul change : le temps productif sur l'année.
+Dans le cas du CJM estimé, ce temps est calculé à partir du temps journalier et du taux de productivité.
+Dans le cas du CJM réel, il est calculé à partir des objets Time de l'année concernée.::
+
+ adc = ( (expenses * employeeCost) / totalCompanyCost ) / productiveDays;
+
+2.1.1 Dépenses totales
+~~~~~~~~~~~~~~~~~~~~~~
+
+Les dépenses totales sont la somme des paiements (FinancialTransaction) effectués par l'entreprise sur l'année. Une simple requête Wikitty est effectué afin de récupérer ces objets FinancialTransaction afin d'effectuer la somme des montants HT::
+
+ totalExpenses = Σ expense
+
+2.1.2 Coût annuel de l'employé
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Le coût annuel de l'employé est le salaire à temps plein multiplié par le nombre de jours travaillé durant l'année::
+
+ employeeCost = ( employee.salary + employee.otherPayments) * employee.partialTime * productiveDays
+
+
+2.1.3 Nombre de jours travaillés
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+En fonction du CJM souhaité, la méthode de calcul du nombre de jours productifs dans l'année est différente.
+
+CJM estimé
+__________
+
+Dans le cas du CJM estimé, on prend le nombre de jours ouvrés dans une année, puis on le multiplie par le taux de travail et de productivité de l'employé.::
+
+ productiveDays = workingDaysInAYear * partialTime * productivityRate
+
+CJM réel
+________
+
+Dans le cas du CJM réel, on additionne tous les temps réalisés par l'employé avant de diviser par son horaire journalier et son taux de productivité.::
+
+ productiveDays = ( Σ(times(employee)) / dailyHoursWorked ) * productivityRate
+
+2.1.4 Coût annuel de l'entreprise
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Le coût annuel de l'entreprise est la somme des coûts annuels des employés productifs.::
+
+ totalCompanyCost = Σ employeeCost(company.employees)
+
+
+.. [1] Taux Journalier Moyen (ADR : Average Daily Rate)
+.. [2] Coût Journalier Moyen (ADC : Average Daily Cost)
+
+
+
+
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2013-08-14 14:17:38 UTC (rev 384)
+++ trunk/src/site/site_fr.xml 2013-08-14 15:19:41 UTC (rev 385)
@@ -84,6 +84,7 @@
<item name="Accueil" href="index.html"/>
<item name="CDC" href="chorem-cdc.html"/>
<item name="requisite" href="requisite.html"/>
+ <item name="calculs" href="calculations.html"/>
</menu>
<menu ref="reports"/>
1
0
See <http://ci.nuiton.org/jenkins/job/chorem/185/changes>
Changes:
[meynier] Updated model for the new page. Added ADC extension and a method in CHoremClient
------------------------------------------
[...truncated 911 lines...]
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] index.jsp~:6:50: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 6; columnNumber: 50; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 6; columnNumber: 50; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardProfitability.jsp~:21:46: The prefix "c" for element "c:forEach" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 21; columnNumber: 46; The prefix "c" for element "c:forEach" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 21; columnNumber: 46; The prefix "c" for element "c:forEach" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] sentQuotation.jsp~:4:37: The prefix "jsp" for element "jsp:include" is not bound.
[Fatal Error] salesPerProjectReport.jsp~:4:37: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardMultiProject.jsp~:2:33: The prefix "f" for element "f:setLocale" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 2; columnNumber: 33; The prefix "f" for element "f:setLocale" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 2; columnNumber: 33; The prefix "f" for element "f:setLocale" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] report.jsp~:5:40: The prefix "c" for element "c:if" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 5; columnNumber: 40; The prefix "c" for element "c:if" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 5; columnNumber: 40; The prefix "c" for element "c:if" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] editQuotation.jsp~:4:1: Element type "link" must be followed by either attribute specifications, ">" or "/>".
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…> Error] hr.jsp~:9:71: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 1; Element type "link" must be followed by either attribute specifications, ">" or "/>".
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 4; columnNumber: 1; Element type "link" must be followed by either attribute specifications, ">" or "/>".
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 9; columnNumber: 71; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 9; columnNumber: 71; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardSingleProject.jsp~:2:34: The prefix "f" for element "f:setLocale" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 2; columnNumber: 34; The prefix "f" for element "f:setLocale" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…;> lineNumber: 2; columnNumber: 34; The prefix "f" for element "f:setLocale" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:get (get) @ chorem-webmotion ---
[INFO] Copying chorem-webmotion.properties to <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/ge…>
[INFO] Copying chorem-webmotion.properties to <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/ge…>
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:gen (gen-and-make-bundle) @ chorem-webmotion ---
[INFO] Copying chorem-webmotion_fr_FR.properties to <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
[INFO] Copying chorem-webmotion_en_GB.properties to <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/src/main/…>
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:collect-i18n-artifacts (collect-i18n-artifacts) @ chorem-webmotion ---
Downloading: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/3.1…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/3.1… (1018 B at 33.1 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/wik…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/wik… (3 KB at 67.5 KB/sec)
[INFO] collected 2 i18n artifacts for locale fr_FR stored in <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…>
[INFO] collected 2 i18n artifacts for locale en_GB stored in <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/i1…>
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:bundle (gen-and-make-bundle) @ chorem-webmotion ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ chorem-webmotion ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ chorem-webmotion ---
[INFO] Compiling 41 source files to <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/cl…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[WARNING] <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/pr…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/pr…>: Recompile with -Xlint:unchecked for details.
[INFO] 3 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/pr…>:[129,44] no suitable method found for getAdc(org.chorem.ChoremClient,org.chorem.entities.EmployeeHR)
method org.chorem.project.AdcCalculation.getAdc() is not applicable
(actual and formal argument lists differ in length)
method org.chorem.project.AdcCalculation.getAdc(boolean) is not applicable
(actual and formal argument lists differ in length)
[ERROR] <http://ci.nuiton.org/jenkins/job/chorem/ws/trunk/chorem-webmotion/target/pr…>:[153,62] no suitable method found for getMultipleAdc(org.chorem.ChoremClient,java.util.List<org.chorem.entities.EmployeeHR>)
method org.chorem.project.AdcCalculation.getMultipleAdc(boolean) is not applicable
(actual and formal argument lists differ in length)
method org.chorem.project.AdcCalculation.getMultipleAdc() is not applicable
(actual and formal argument lists differ in length)
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Chorem ............................................ SUCCESS [2.161s]
[INFO] Chorem :: entities ................................ SUCCESS [10.990s]
[INFO] Chorem :: webmotion ............................... FAILURE [5.234s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.928s
[INFO] Finished at: Wed Aug 14 14:16:27 CEST 2013
[INFO] Final Memory: 40M/280M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project chorem-webmotion: Compilation failure
cause : Compilation failure
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project chorem-webmotion: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:174)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 27 more
Sending e-mails to: chorem-commits(a)list.chorem.org
channel stopped
1
1
14 Aug '13
See <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
------------------------------------------
[...truncated 409 lines...]
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] projectSalesReport.jsp~:4:37: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] sales.jsp~:2:43: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 2; columnNumber: 43; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 2; columnNumber: 43; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardVacationByEmployee.jsp~:5:63: The prefix "c" for element "c:forEach" is not bound.
[ERROR] [Fatal Error] acceptedQuotation.jsp~:4:37: The prefix "jsp" for element "jsp:include" is not bound.
could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 5; columnNumber: 63; The prefix "c" for element "c:forEach" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 5; columnNumber: 63; The prefix "c" for element "c:forEach" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] decorator.jsp~:7:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 7; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 7; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] index.jsp~:6:50: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 6; columnNumber: 50; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 6; columnNumber: 50; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardProfitability.jsp~:21:46: The prefix "c" for element "c:forEach" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 21; columnNumber: 46; The prefix "c" for element "c:forEach" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 21; columnNumber: 46; The prefix "c" for element "c:forEach" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] sentQuotation.jsp~:4:37: The prefix "jsp" for element "jsp:include" is not bound.
[Fatal Error] salesPerProjectReport.jsp~:4:37: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardMultiProject.jsp~:2:33: The prefix "f" for element "f:setLocale" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 2; columnNumber: 33; The prefix "f" for element "f:setLocale" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 2; columnNumber: 33; The prefix "f" for element "f:setLocale" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 37; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] report.jsp~:5:40: The prefix "c" for element "c:if" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 5; columnNumber: 40; The prefix "c" for element "c:if" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 5; columnNumber: 40; The prefix "c" for element "c:if" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] editQuotation.jsp~:4:1: Element type "link" must be followed by either attribute specifications, ">" or "/>".
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…> Error] hr.jsp~:9:71: The prefix "jsp" for element "jsp:include" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 1; Element type "link" must be followed by either attribute specifications, ">" or "/>".
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 4; columnNumber: 1; Element type "link" must be followed by either attribute specifications, ">" or "/>".
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 9; columnNumber: 71; The prefix "jsp" for element "jsp:include" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 9; columnNumber: 71; The prefix "jsp" for element "jsp:include" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[Fatal Error] dashboardSingleProject.jsp~:2:34: The prefix "f" for element "f:setLocale" is not bound.
[ERROR] could not parse file <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
org.nuiton.i18n.plugin.parser.ParserException: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 2; columnNumber: 34; The prefix "f" for element "f:setLocale" is not bound.
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:400)
at org.nuiton.i18n.plugin.parser.ParserExecutor$ParserTask.run(ParserExecutor.java:219)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file://<http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…;> lineNumber: 2; columnNumber: 34; The prefix "f" for element "f:setLocale" is not bound.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:177)
at org.nuiton.i18n.plugin.parser.impl.AbstractParserXmlMojo$XmlFileParser.parseFile(AbstractParserXmlMojo.java:387)
... 4 more
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:get (get) @ chorem-webmotion ---
[INFO] Copying chorem-webmotion.properties to <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO] Copying chorem-webmotion.properties to <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:gen (gen-and-make-bundle) @ chorem-webmotion ---
[INFO] Copying chorem-webmotion_fr_FR.properties to <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO] Copying chorem-webmotion_en_GB.properties to <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:collect-i18n-artifacts (collect-i18n-artifacts) @ chorem-webmotion ---
Downloading: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/3.1…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/3.1… (1018 B at 33.1 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/wik…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/wikitty/org/nuiton/wikitty/wik… (3 KB at 67.5 KB/sec)
[INFO] collected 2 i18n artifacts for locale fr_FR stored in <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO] collected 2 i18n artifacts for locale en_GB stored in <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO]
[INFO] --- maven-i18n-plugin:2.3.1:bundle (gen-and-make-bundle) @ chorem-webmotion ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ chorem-webmotion ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ chorem-webmotion ---
[INFO] Compiling 41 source files to <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[WARNING] <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>: Recompile with -Xlint:unchecked for details.
[INFO] 3 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>:[129,44] no suitable method found for getAdc(org.chorem.ChoremClient,org.chorem.entities.EmployeeHR)
method org.chorem.project.AdcCalculation.getAdc() is not applicable
(actual and formal argument lists differ in length)
method org.chorem.project.AdcCalculation.getAdc(boolean) is not applicable
(actual and formal argument lists differ in length)
[ERROR] <http://ci.nuiton.org/jenkins/job/chorem/org.chorem.chorem$chorem-webmotion/…>:[153,62] no suitable method found for getMultipleAdc(org.chorem.ChoremClient,java.util.List<org.chorem.entities.EmployeeHR>)
method org.chorem.project.AdcCalculation.getMultipleAdc(boolean) is not applicable
(actual and formal argument lists differ in length)
method org.chorem.project.AdcCalculation.getMultipleAdc() is not applicable
(actual and formal argument lists differ in length)
[INFO] 2 errors
[INFO] -------------------------------------------------------------
1
1
r384 - in trunk: chorem-entities/src/main/java/org/chorem chorem-entities/src/main/java/org/chorem/project chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project chorem-webmotion/src/main/resources chorem-webmotion/src/main/webapp/WEB-INF/jsp chorem-webmotion/src/main/webapp/js
by meynier@users.chorem.org 14 Aug '13
by meynier@users.chorem.org 14 Aug '13
14 Aug '13
Author: meynier
Date: 2013-08-14 16:17:38 +0200 (Wed, 14 Aug 2013)
New Revision: 384
Url: http://chorem.org/projects/chorem/repository/revisions/384
Log:
Changed tabulation into spaces and added the adc dashboard page. Added a level of alert \(info\).
Added:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAdc.jsp
trunk/chorem-webmotion/src/main/webapp/js/dashboardAdc.js
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java
trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
trunk/chorem-webmotion/src/main/webapp/js/employeeEdit.js
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -389,7 +389,7 @@
WikittyQueryResult<Task> taskResult = findAllByQuery(Task.class, taskQuery);
return taskResult.getAll();
}
-
+
/**
* Fetch the times from the given task
* @param t Task
@@ -400,17 +400,17 @@
WikittyQuery timeQuery = new WikittyQueryMaker()
.eq(Time.ELEMENT_FIELD_TIME_TASK, t)
.end();
-
+
timeQuery.addSortAscending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
-
+
WikittyQueryResult<Time> timeResult = findAllByQuery(Time.class, timeQuery);
-
+
return timeResult.getAll();
}
/**
* Returns the daily return of the given empoyee
- * @param e
- * @return
+ * @param e employee
+ * @return daily return of employee
*/
public double getDailyReturn(Employee e) {
@@ -419,17 +419,21 @@
if(e.getCompany(false) != null)
companyW = restore(e.getCompany(false).getWikittyId());
+ double dailyReturn = 0;
+
if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR) &&
w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN) != 0) {
- return w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
+ dailyReturn = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
}
else if(companyW != null && companyW.hasExtension(CompanyHR.EXT_COMPANYHR)
&& companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN) != 0) {
- return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
+ dailyReturn = companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
}
else {
- return this.getConfiguration().getDailyReturn();
+ dailyReturn = this.getConfiguration().getDailyReturn();
}
+
+ return dailyReturn;
}
/**
* Returns the daily hours worked of the given empoyee
@@ -443,20 +447,24 @@
if(e.getCompany(false) != null)
companyW = restore(e.getCompany(false).getWikittyId());
+ double dailyHoursWorked = 0;
+
if(companyW.hasExtension(CompanyHR.EXT_COMPANYHR) &&
companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR,CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) != 0) {
if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR) && w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME) != 0) {
- return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) *
+ dailyHoursWorked = companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) *
(w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME)/100);
}
else {
- return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED);
+ dailyHoursWorked = companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED);
}
}
else {
- return this.getConfiguration().getDailyHoursWorked();
+ dailyHoursWorked = this.getConfiguration().getDailyHoursWorked();
}
+
+ return dailyHoursWorked;
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremUtil.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -69,6 +69,12 @@
return getPeriodInSeconds(start, end)/3600;
}
+ /**
+ * Calculates the number of working days between two dates
+ * @param begin start date
+ * @param end end date
+ * @return number of working days
+ */
public static int getWorkingDays(Date begin, Date end) {
GregorianCalendar gBegin = new GregorianCalendar();
GregorianCalendar gEnd = new GregorianCalendar();
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -19,17 +19,36 @@
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
-
+/**
+ * Makes the calculation for the adc.
+ * It can calculate the adc of one or more employee by using the method getAdc or getMultipleAdc
+ * Usage : construct the object with an employee or a list of employees and call the method
+ * getAdc() or getMultipleAdc()
+ *
+ * @author gwenn
+ *
+ */
public class AdcCalculation {
+ /** Chorme Client*/
protected ChoremClient client;
+ /** Company of the employee(s) */
protected Company company;
+ /** Employee */
protected EmployeeHR employee;
+ /** List of employees */
protected List<EmployeeHR> employees;
-
+
+ /** start date of the year*/
protected Date start;
+ /** end date of the year*/
protected Date end;
-
+
+ /**
+ * Construct the object for calculating the adc of an employee
+ * @param client chorem client
+ * @param employee employee withthe adc to calculate
+ */
public AdcCalculation(ChoremClient client, EmployeeHR employee) {
this.employee = employee;
this.company = employee.getCompany(false);
@@ -37,7 +56,12 @@
this.employees = null;
initDate();
}
-
+
+ /**
+ * Construct the object for calculating the adc of a list of employees
+ * @param client chorem client
+ * @param employees employees with the adc to calculate
+ */
public AdcCalculation(ChoremClient client, List<EmployeeHR> employees) {
this.employees = employees;
this.company = employees.get(0).getCompany(false);
@@ -45,31 +69,46 @@
this.employee = null;
initDate();
}
-
- private void initDate() {
+
+ /**
+ * Initiate the start and end date to the beginning and end of the year
+ * TODO : Manage this in the configuration of chorem
+ */
+ protected void initDate() {
+ Calendar cstart = new GregorianCalendar();
+ cstart.add(Calendar.YEAR, -1);
+ cstart.set(Calendar.MONTH, Calendar.JANUARY);
+ cstart.set(Calendar.DAY_OF_MONTH, 1);
+ cstart.set(Calendar.HOUR_OF_DAY, 0);
+ cstart.set(Calendar.MINUTE, 0);
+ cstart.set(Calendar.SECOND, 0);
+ cstart.set(Calendar.MILLISECOND, 0);
+
Calendar cend = new GregorianCalendar();
cend.add(Calendar.YEAR, -1);
cend.set(Calendar.MONTH, Calendar.DECEMBER);
cend.set(Calendar.DAY_OF_MONTH, 31);
+ cend.set(Calendar.HOUR_OF_DAY, 23);
+ cend.set(Calendar.MINUTE, 59);
+ cend.set(Calendar.SECOND, 59);
+ cend.set(Calendar.MILLISECOND, 999);
+
- Calendar cstart = new GregorianCalendar();
- cstart.add(Calendar.YEAR, -1);
- cstart.set(Calendar.MONTH, Calendar.JANUARY);
- cstart.set(Calendar.DAY_OF_MONTH, 1);
-
+
start = cstart.getTime();
end = cend.getTime();
}
-
-
+
+
/**
* Calculates the total gains made by the company in one year
- * @return
+ * TODO : Use wikitty function for sum.
+ * @return total expenses
*/
public double getTotalExpenses() {
//Construct the query
- //TODO : Use wikitty function for sum.
+
WikittyQuery expenseQuery = new WikittyQueryMaker()
.and()
.exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) //of type financial transaction
@@ -117,9 +156,14 @@
return (daysInYear * (partialTime/100) * (productivityRate/100));
}
-
+
+ /**
+ * Returns the real number of procuctive days in year, which is the sum of all the time object by the employee
+ * @param e
+ * @return
+ */
public double getRealNumberOfProductiveDays(EmployeeHR e) {
-
+
//fetch the times of all the employees of the company that have worked between $start an $end
WikittyQuery timeQuery = new WikittyQueryMaker()
.and()
@@ -135,15 +179,17 @@
double total = 0;
for(Time t : result.getAll()) {
total += ChoremUtil.getPeriodInHours(t.getBeginDate(), t.getEndDate());
-
+
}
return (total/ client.getDailyHoursWorked(e) )
- * (e.getProductivityRate()/100);
+ * (e.getProductivityRate()/100);
}
/**
- *
+ * calculates the full time cost in a year
+ * @param e
+ * @param real true if the real time is needed
* @return
*/
public double getYearCost(EmployeeHR e, boolean real) {
@@ -157,6 +203,11 @@
return result;
}
+ /**
+ * calculates the full time cost in a year for all the employees in the company
+ * @param real true if the real time is needed
+ * @return
+ */
public double getTotalYearCost(boolean real) {
double total = 0;
@@ -220,8 +271,8 @@
* @return
*/
public double getAdc(boolean real) {
-
+
double expenses = getTotalExpenses();
double productiveDays = 0;
if(real) {
@@ -230,7 +281,7 @@
else {
productiveDays = getEstimatedNumberOfProductiveDays(employee);
}
-
+
double cost = getYearCost(employee, real);
double totalCost = getTotalYearCost(real);
@@ -238,13 +289,13 @@
System.out.println("PROD DAYS : " + productiveDays);
System.out.println("COST : " + expenses);
System.out.println("TOTAL COST : " + expenses);
-
+
double adc = ( (expenses * cost) / totalCost ) / productiveDays;
return adc;
}
-
+
public double getAdc() {
return getAdc(false);
}
@@ -257,56 +308,55 @@
* @param client
* @param employees
* @return
- */
- public Map<String, Double> getMultipleAdc(boolean real) {
- if(employees.size() == 0)
- return null;
-
- Calendar cend = new GregorianCalendar();
+ */
+ public Map<String, Double> getMultipleAdc(boolean real) {
+ if(employees.size() == 0)
+ return null;
+
+ Calendar cend = new GregorianCalendar();
cend.add(Calendar.YEAR, -1);
cend.set(Calendar.MONTH, Calendar.DECEMBER);
cend.set(Calendar.DAY_OF_MONTH, 31);
-
+
Calendar cstart = new GregorianCalendar();
cstart.add(Calendar.YEAR, -1);
cstart.set(Calendar.MONTH, Calendar.JANUARY);
cstart.set(Calendar.DAY_OF_MONTH, 1);
-
+
Date start = cstart.getTime();
Date end = cend.getTime();
- //Calculate all the "static" values before
+ //Calculate all the "static" values before
- double expenses = getTotalExpenses();
+ double expenses = getTotalExpenses();
double totalCost = getTotalYearCost(real);
- //Then, for each employee
+ //Then, for each employee
- HashMap<String, Double> adcs = new HashMap<String, Double>();
- for(EmployeeHR e : employees) {
- this.employee = e;
-
- double productiveDays = 0;
- if(real) {
- productiveDays = getRealNumberOfProductiveDays(e);
- }
- else {
- productiveDays = getEstimatedNumberOfProductiveDays(e);
- }
- double cost = getYearCost(e, real);
+ HashMap<String, Double> adcs = new HashMap<String, Double>();
+ for(EmployeeHR e : employees) {
+ this.employee = e;
- Double adc = ( ( (expenses * cost) / totalCost ) / productiveDays);
- if(adc.isNaN()) {
- adc = 0.0;
- }
- adcs.put(e.getWikittyId(),adc);
- }
+ double productiveDays = 0;
+ if(real) {
+ productiveDays = getRealNumberOfProductiveDays(e);
+ }
+ else {
+ productiveDays = getEstimatedNumberOfProductiveDays(e);
+ }
+ double cost = getYearCost(e, real);
- return adcs;
+ Double adc = ( ( (expenses * cost) / totalCost ) / productiveDays);
+ if(adc.isNaN()) {
+ adc = 0.0;
+ }
+ adcs.put(e.getWikittyId(),adc);
+ }
- }
+ return adcs;
+ }
@@ -314,4 +364,5 @@
+
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -10,84 +10,88 @@
public class QuotationCalculation extends Calculation<Quotation> {
-
- private List<Task> tasks = null;
-
- public QuotationCalculation(Quotation q, ChoremClient client) {
- super(q, q.getAmount(), q.getEstimatedDays(), client);
- }
- @Override
- public double realDays() {
- double totalTime = 0;
- //For each task
- for(Task t : client.getTasks(e)) {
- //Sum the real days of the tasks objects
- totalTime+=new TaskCalculation(t, client).getRealDays();
- }
- return totalTime;
+ private List<Task> tasks = null;
- }
+ public QuotationCalculation(Quotation q, ChoremClient client) {
+ super(q, q.getAmount(), q.getEstimatedDays(), client);
+ }
- @Override
- public HashMap<Employee, Double> getPercentages() {
- HashMap<Employee, Double> percentages = new HashMap<Employee, Double>();
- double totalDays = 0;
- for(Task t : getTasks())
- totalDays += t.getEstimatedDays();
-
- List<Task> tasks = getTasks();
- for(Task t : tasks) {
+ @Override
+ public double realDays() {
+ double totalTime = 0;
+ //For each task
+ for(Task t : client.getTasks(e)) {
+ //Sum the real days of the tasks objects
+ totalTime+=new TaskCalculation(t, client).getRealDays();
+ }
+ return totalTime;
- HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getPercentages();
- for(Employee emp : taskPercentages.keySet()) {
- double rate = (t.getEstimatedDays()/totalDays);
- if(percentages.containsKey(emp)) {
- //We temporaly put the sum in the map.
- percentages.put(emp, percentages.get(emp) + taskPercentages.get(emp)*rate);
- }
- else {
- percentages.put(emp, taskPercentages.get(emp)*rate);
- }
+ }
- }
- }
+ @Override
+ public HashMap<Employee, Double> getPercentages() {
+ HashMap<Employee, Double> percentages = new HashMap<Employee, Double>();
+ double totalDays = 0;
+ for(Task t : getTasks())
+ totalDays += t.getEstimatedDays();
- //Caluculate the average for each employee
- /*Set<Employee> keySet = percentages.keySet();
+ List<Task> tasks = getTasks();
+ for(Task t : tasks) {
+
+ HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getPercentages();
+ for(Employee emp : taskPercentages.keySet()) {
+ double rate = (t.getEstimatedDays()/totalDays);
+ if(percentages.containsKey(emp)) {
+ //We temporaly put the sum in the map.
+ percentages.put(emp, percentages.get(emp) + taskPercentages.get(emp)*rate);
+ }
+ else {
+ percentages.put(emp, taskPercentages.get(emp)*rate);
+ }
+
+ }
+ }
+
+ //Caluculate the average for each employee
+ /*Set<Employee> keySet = percentages.keySet();
for(Employee emp : keySet) {
percentages.put(emp, percentages.get(emp)/tasks.size());
}*/
- return percentages;
- }
+ return percentages;
+ }
- @Override
- public HashMap<Employee, Double> getTimes() {
- HashMap<Employee, Double> times = new HashMap<Employee, Double>();
+ @Override
+ public HashMap<Employee, Double> getTimes() {
+ HashMap<Employee, Double> times = new HashMap<Employee, Double>();
- for(Task t : getTasks()) {
+ for(Task t : getTasks()) {
- HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getTimes();
- for(Employee emp : taskPercentages.keySet()) {
- if(times.containsKey(emp)) {
- times.put(emp, times.get(emp) + taskPercentages.get(emp));
- }
- else {
- times.put(emp, taskPercentages.get(emp));
- }
+ HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getTimes();
+ for(Employee emp : taskPercentages.keySet()) {
+ if(times.containsKey(emp)) {
+ times.put(emp, times.get(emp) + taskPercentages.get(emp));
+ }
+ else {
+ times.put(emp, taskPercentages.get(emp));
+ }
- }
+ }
- }
+ }
- return times;
- }
-
- public List<Task> getTasks() {
- if(tasks == null)
- tasks = client.getTasks(e);
- return tasks;
-
- }
+ return times;
+ }
+
+ /**
+ * Fetch the tasks of the quotation keep a reference
+ * @return
+ */
+ public List<Task> getTasks() {
+ if(tasks == null)
+ tasks = client.getTasks(e);
+ return tasks;
+
+ }
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -3,22 +3,38 @@
import java.util.HashMap;
import java.util.List;
-import org.chorem.ChoremClient;
import org.chorem.entities.Employee;
import org.chorem.entities.Quotation;
-import org.chorem.entities.Task;
+/**
+ * Calculates the total values of the quotation calculations
+ * Usage : construct the cobject by sending the list of quotation in parameter, then you can get the totals
+ * by using the total* methdds.
+ * @author gwenn
+ *
+ */
public class TotalQuotationCalculation extends Calculation<Quotation> {
-
+ /**
+ * List of quotation calculation
+ */
private List<QuotationCalculation> calculations;
+ /**
+ *
+ * @param calculations list of calculation used to calculate the total.
+ */
public TotalQuotationCalculation(List<QuotationCalculation> calculations) {
super(null, totalAmount(calculations), totalEstimatedDays(calculations), null);
//super(q, q.getAmount(), q.getEstimatedDays(), client);
this.calculations = calculations;
}
+ /**
+ *
+ * @param calculations
+ * @return total amount
+ */
private static double totalAmount(List<QuotationCalculation> calculations) {
double total = 0;
for(QuotationCalculation q : calculations) {
@@ -28,6 +44,11 @@
return total;
}
+ /**
+ *
+ * @param calculations
+ * @return
+ */
private static double totalEstimatedDays(List<QuotationCalculation> calculations) {
double total = 0;
for(QuotationCalculation q : calculations) {
Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -0,0 +1,210 @@
+package org.chorem.webmotion.actions;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+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.debux.webmotion.server.WebMotionController;
+import org.chorem.ChoremClient;
+import org.debux.webmotion.server.render.Render;
+import org.chorem.entities.ADC;
+import org.chorem.entities.Company;
+import org.chorem.entities.CompanyImpl;
+import org.chorem.entities.Employee;
+import org.nuiton.wikitty.entities.Wikitty;
+import org.nuiton.wikitty.query.WikittyQuery;
+import org.nuiton.wikitty.query.WikittyQueryMaker;
+import org.nuiton.wikitty.query.WikittyQueryResult;
+
+/**
+ *
+ * @author meynier
+ *
+ */
+public class AdcDashboardAction extends WebMotionController {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(AdcDashboardAction.class);
+
+ /**
+ * Return a page with an array with the employees of the specified company
+ *
+ * @param client
+ * chorem client
+ * @param company
+ * employees will be fetched from this company
+ * @return
+ */
+ public Render employeeFilter(ChoremClient client, Company company, int from, int to) {
+ // get all the empoyees from the default company
+
+ List<Company> companies = client.findAllByQuery(Company.class,
+ new WikittyQueryMaker().exteq("Company").end()).getAll();
+
+ // Order by name
+ WikittyQuery employeeQuery = new WikittyQueryMaker().eq(
+ Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company).end();
+
+ WikittyQueryResult<Employee> employeeResult = client.findAllByQuery(
+ Employee.class, employeeQuery);
+
+ List<EmployeeData> employees = new ArrayList<EmployeeData>();
+ Set<Integer> years = new HashSet<Integer>();
+ for (Employee e : employeeResult.getAll()) {
+ EmployeeData eData = new EmployeeData(e, client, from, to);
+ employees.add(eData);
+ years.addAll(eData.getAdcPerYear().keySet());
+ }
+
+ Collections.sort(employees);
+
+
+
+ // simply return them
+ return renderView("dashboardAdc.jsp",
+ "employees", employees,
+ "from", from,
+ "to", to,
+ "lastYear", (new GregorianCalendar()).get(Calendar.YEAR) +1,
+ "companies", companies,
+ "company",
+ new CompanyImpl(client.restore(company.getWikittyId())),
+ "years", years,
+ "title", "ADC Dashboard");
+ }
+
+ /**
+ * generate a page to manage the adcs
+ *
+ * @param client chorem client
+ * @param companyId
+ * @param addExtension
+ * @param call
+ * @return
+ */
+ public Render requestDashboardAdc(ChoremClient client, String companyId, Integer from, Integer to) {
+ Company company = null;
+
+ if(from == null) {
+ from = (new GregorianCalendar()).get(Calendar.YEAR);
+ from--;
+ }
+ if(to == null) {
+ to = (new GregorianCalendar()).get(Calendar.YEAR);
+ }
+
+ if (companyId == null)
+ company = client.getDefaultCompany();
+ else {
+ company = new CompanyImpl(client.restore(companyId));
+ }
+
+
+
+ return employeeFilter(client, company, from , to);
+ }
+
+
+
+
+
+ /**
+ * Structure used to store information about an employee Used for the AJAX
+ * request
+ *
+ * @author gwenn
+ *
+ */
+ public class EmployeeJson {
+
+ private String salary;
+ private double productivityRate;
+ private double partialTime;
+ private double dailyReturn;
+ private double dailyHoursWorked;
+ private double otherPayments;
+
+ public EmployeeJson(String salary, double productivityRate,
+ double partialTime, double dailyReturn,
+ double dailyHoursWorked, double otherPayments) {
+ this.salary = salary;
+ this.productivityRate = productivityRate;
+ this.partialTime = partialTime;
+ this.dailyReturn = dailyReturn;
+ this.dailyHoursWorked = dailyHoursWorked;
+ this.otherPayments = otherPayments;
+ }
+ }
+
+ /**
+ * Structure used to store information about an employee used for the
+ * standard http request
+ *
+ * @author gwenn
+ *
+ */
+ public class EmployeeData implements Comparable {
+
+ private Employee e;
+ private double estimatedAdc;
+ private Map<Integer, Double> adcPerYear;
+
+ public EmployeeData(Employee e, ChoremClient client, int from, int to) {
+ Wikitty w = client.restore(e.getWikittyId());
+
+ this.estimatedAdc = client.getDailyReturn(e);
+ //Simple trick to limit to 2 numbers after digit
+ int x = (int)(client.getDailyHoursWorked(e)*100);
+ double y = x/100.0;
+
+ x = (int)(this.estimatedAdc*100);
+ y = x/100.0;
+ this.estimatedAdc = y;
+
+
+ WikittyQuery adcQuery = new WikittyQueryMaker().and()
+ .eq(ADC.ELEMENT_FIELD_ADC_EMPLOYEEHR, e)
+ .bw(ADC.ELEMENT_FIELD_ADC_YEAR, from, to)
+ .end();
+ adcPerYear = new HashMap<Integer, Double>();
+
+ WikittyQueryResult<ADC> adcResult = client.findAllByQuery(
+ ADC.class, adcQuery);
+
+ for(ADC a : adcResult.getAll()) {
+ adcPerYear.put(a.getYear(), a.getValue());
+ }
+ System.out.println("ADC FOR " + e.getPerson(false) + " : " + adcPerYear);
+ this.e = e;
+ }
+
+ public Employee getObject() {
+ return e;
+ }
+
+ public double getEstimatedAdc() {
+ return estimatedAdc;
+ }
+
+ public Map<Integer, Double> getAdcPerYear() {
+ return adcPerYear;
+ }
+
+ @Override
+ public int compareTo(Object o) {
+ EmployeeData e = (EmployeeData) o;
+ return this.getObject().getPerson(false).getLastName()
+ .compareTo(e.getObject().getPerson(false).getLastName());
+ }
+
+ }
+
+}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -13,6 +13,8 @@
import org.chorem.ChoremUtil;
import org.debux.webmotion.server.call.Call;
import org.debux.webmotion.server.render.Render;
+import org.chorem.entities.ADC;
+import org.chorem.entities.ADCImpl;
import org.chorem.entities.Company;
import org.chorem.entities.CompanyImpl;
import org.chorem.entities.Employee;
@@ -26,356 +28,398 @@
import org.nuiton.wikitty.query.WikittyQueryResult;
/**
- *
+ * Generate a page to edit the calues of the employees
+ * Also manages ajax requests for calculating the adc or
* @author meynier
*
*/
public class EmployeeEditAction extends WebMotionController {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(EmployeeEditAction.class);
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(EmployeeEditAction.class);
- /**
- * Return a page with an array with the employees of the specified company
- * @param client chorem client
- * @param company employees will be fetched from this company
- * @return
- */
- public Render employeeFilter(ChoremClient client, Company company) {
- //get all the empoyees from the default company
+ /**
+ * Return a page with an array with the employees of the specified company
+ * @param client chorem client
+ * @param company employees will be fetched from this company
+ * @return
+ */
+ public Render employeeFilter(ChoremClient client, Company company) {
+ //get all the empoyees from the default company
- List<Company> companies = client.findAllByQuery(Company.class,
- new WikittyQueryMaker().exteq("Company").end()).getAll();
+ List<Company> companies = client.findAllByQuery(Company.class,
+ new WikittyQueryMaker().exteq("Company").end()).getAll();
- //Order by name
- WikittyQuery employeeQuery = new WikittyQueryMaker().eq(Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company).end();
+ //Order by name
+ WikittyQuery employeeQuery = new WikittyQueryMaker().eq(Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company).end();
- WikittyQueryResult<Employee> employeeResult = client.findAllByQuery(Employee.class, employeeQuery);
+ WikittyQueryResult<Employee> employeeResult = client.findAllByQuery(Employee.class, employeeQuery);
- List<EmployeeData> employees = new ArrayList<EmployeeData>();
- for(Employee e : employeeResult.getAll()) {
- employees.add(new EmployeeData(e, client));
- }
-
- Collections.sort(employees);
- //simply return them
- return renderView("employeeEdit.jsp",
- "employees",employees,
- "companies", companies,
- "company", new CompanyImpl(client.restore(company.getWikittyId())),
- "title", "Employee edit");
- }
+ List<EmployeeData> employees = new ArrayList<EmployeeData>();
+ for(Employee e : employeeResult.getAll()) {
+ employees.add(new EmployeeData(e, client));
+ }
+ Collections.sort(employees);
+ //simply return them
+ return renderView("employeeEdit.jsp",
+ "employees",employees,
+ "companies", companies,
+ "company", new CompanyImpl(client.restore(company.getWikittyId())),
+ "title", "Employee edit");
+ }
- /**
- * generate a page to edit the employees
- *
- * @param client choorem client
- * @param companyId
- * @param addExtension
- * @param call
- * @return
- */
- public Render requestEmployeeEdit(ChoremClient client, String companyId, String addExtension, Call call) {
- Company company = null;
- if(companyId == null)
- company = client.getDefaultCompany();
- else {
- company = new CompanyImpl(client.restore(companyId));
- }
+ /**
+ * generate a page to edit the employees
+ *
+ * @param client choorem client
+ * @param companyId
+ * @param addExtension
+ * @param call
+ * @return
+ */
+ public Render requestEmployeeEdit(ChoremClient client, String companyId, String addExtension, Call call) {
+ Company company = null;
- if(call != null) {
- Wikitty w = client.restore(company.getWikittyId());
- Map<String, Object> params = call.getExtractParameters();
- for(String key : params.keySet()) {
- //Prevent false data
- if((key.equals("CompanyHR.dailyReturn")
- || key.equals("CompanyHR.dailyHoursWorked"))) {
- try {
- double value = Double.parseDouble(((String[])params.get(key))[0]);
- w.setFqField(key, value);
- }
- catch(java.lang.NumberFormatException e) {
- System.err.println(e.getMessage());//TODO : user output
- }
-
- }
- }
+ if(companyId == null)
+ company = client.getDefaultCompany();
+ else {
+ company = new CompanyImpl(client.restore(companyId));
+ }
- client.store(w);
- }
-
- if(addExtension != null && addExtension.equals("true")) {
- Wikitty w = client.restore(company.getWikittyId());
- w.addExtension(client.restoreExtensionLastVersion("CompanyHR"));
- client.store(w);
- }
+ if(call != null) {
+ Wikitty w = client.restore(company.getWikittyId());
+ Map<String, Object> params = call.getExtractParameters();
+ for(String key : params.keySet()) {
+ //Prevent false data
+ if((key.equals("CompanyHR.dailyReturn")
+ || key.equals("CompanyHR.dailyHoursWorked"))) {
+ try {
+ double value = Double.parseDouble(((String[])params.get(key))[0]);
+ w.setFqField(key, value);
+ }
+ catch(java.lang.NumberFormatException e) {
+ System.err.println(e.getMessage());//TODO : user output
+ }
- return employeeFilter(client, company);
- }
+ }
+ }
- /**
- * Ajax request for the adc calculation
- *
- * @param client chorme client
- * @param employeeId id of the employee that needs an adc calculation
- * @return adc
- */
- public Render requestAdc(ChoremClient client, String employeeId) {
- Wikitty w = client.restore(employeeId);
- EmployeeHR e = new EmployeeHRImpl(w);
-
- double adc = AdcCalculation.getAdc(client, e);
-
- w.setField("EmployeeHR", "dailyReturn", adc);
- client.store(w);
-
- int iadc = (int)(adc*100);
- return renderJSON("adc", (double)(iadc/100.0));
-
-
- }
- /**
- * Ajax request for the adc calculation of multiple employees of the same company
- *
- * @param client chorme client
- * @param employeeId id of the employees that needs an adc calculation
- * @return adc
- */
- public Render requestMultipleAdc(ChoremClient client, String employeeId) {
- List<Wikitty> w = client.restore(ChoremUtil.asList(",", employeeId));
- List<EmployeeHR> employees = new ArrayList<EmployeeHR>();
- for(int i = 0; i< w.size(); i++) {
- employees.add(new EmployeeHRImpl(w.get(i)));
- }
-
- HashMap<String, Double> adcs = AdcCalculation.getMultipleAdc(client, employees);
- for(int i = 0; i< w.size(); i++) {
- Wikitty wi = w.get(i);
- wi.setField("EmployeeHR", "dailyReturn", adcs.get(wi.getWikittyId()));
- client.store(wi);
- }
- for(String s : adcs.keySet()) {
- int iadc = (int)(adcs.get(s)*100);
- adcs.put(s, (double)(iadc/100.0));
- }
- return renderJSON("adcs", adcs);
- }
-
-
- /**
- * Ajax requets to modify the employee values
- *
- * @param client chorme client
- * @param employeeId id of the employee to modify
- * @param salaryStr new salary in String format
- * @param productivityRateStr new prod rate in String format
- * @param partialTimeStr new partial time in String format
- * @param dailyReturnStr new daily return in String format
- * @return
- */
- public Render editEmployeeValues(ChoremClient client, String employeeId, String salaryStr
- , String productivityRateStr, String partialTimeStr, String dailyReturnStr, String otherPaymentsStr) {
- Wikitty employeeWikitty = client.restore(employeeId);
- Employee employee = new EmployeeImpl(employeeWikitty);
- if(!employeeWikitty.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) {
- employeeWikitty.addExtension(client.restoreExtensionLastVersion(EmployeeHR.EXT_EMPLOYEEHR));
- }
+ client.store(w);
+ }
- double salary = 0, productivityRate = 0, partialTime = 0, dailyReturn = 0, otherPayments = 0;
-
- //Try to parse the strings and generates if errors if it fails
- List<ErrorJson> errors = new ArrayList<ErrorJson>();
- try {
- salary = Double.parseDouble(salaryStr);
- }
- catch (java.lang.NumberFormatException e) {
- errors.add(new ErrorJson("salary", "Salary must be a real number"));
- }
+ if(addExtension != null && addExtension.equals("true")) {
+ Wikitty w = client.restore(company.getWikittyId());
+ w.addExtension(client.restoreExtensionLastVersion("CompanyHR"));
+ client.store(w);
+ }
- try{
- productivityRate = Double.parseDouble(productivityRateStr);
- }
- catch (java.lang.NumberFormatException e) {
- errors.add(new ErrorJson("productivityRate", "Productivity rate must be a real number"));
- }
+ return employeeFilter(client, company);
+ }
- try {
- partialTime = Double.parseDouble(partialTimeStr);
- }
- catch (java.lang.NumberFormatException e) {
- errors.add(new ErrorJson("partialTime", "Partial time must be a real number"));
- }
-
- try {
- dailyReturn = Double.parseDouble(dailyReturnStr);
- }
- catch (java.lang.NumberFormatException e) {
- errors.add(new ErrorJson("dailyReturn", "Daily return must be a real number"));
- }
-
- try {
- otherPayments = Double.parseDouble(otherPaymentsStr);
- }
- catch (java.lang.NumberFormatException e) {
- errors.add(new ErrorJson("dailyReturn", "Other payments must be a real number"));
- }
-
- //Verify that the percentages are between 0 and 100
- if(productivityRate > 100 || productivityRate < 0) {
- errors.add(new ErrorJson("productivityRate", "Productivity rate must be between 0 and 100"));
- }
- if(partialTime > 100 || partialTime < 0) {
- errors.add(new ErrorJson("partialTime", "Partial time must be between 0 and 100"));
- }
- if(errors.size() != 0)
- return renderJSON("data", "error", "errors", errors);
+ /**
+ * Ajax request for the adc calculation
+ *
+ * @param client chorme client
+ * @param employeeId id of the employee that needs an adc calculation
+ * @return adc
+ */
+ public Render requestAdc(ChoremClient client, String employeeId, boolean real) {
+ Wikitty w = client.restore(employeeId);
+ EmployeeHR e = new EmployeeHRImpl(w);
+ double adc = (new AdcCalculation(client, e)).getAdc(real);
- if(salary != 0)
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_SALARY, salary);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PRODUCTIVITYRATE, productivityRate);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PARTIALTIME, partialTime);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_DAILYRETURN, dailyReturn);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_OTHERPAYMENTS, otherPayments);
- client.store(employeeWikitty);
+ w.setField(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN, adc);
+ client.store(w);
+ int iadc = (int)(adc*100);
+ return renderJSON("adc", (double)(iadc/100.0));
- EmployeeData data = new EmployeeData(new EmployeeImpl(employeeWikitty), client);
- EmployeeJson json = new EmployeeJson(
- data.getSalary() + "",
- data.getProductivityRate(),
- data.getPartialTime(),
- data.getDailyReturn(),
- data.getDailyHoursWorked(),
- data.getOtherPayments()
- );
+ }
- return renderJSON("data", json);
- }
-
- /**
- * Class used to store an error
- * @author gwenn
- *
- */
- public class ErrorJson {
- private String errorMessage;
- private String field;
-
- public ErrorJson (String field, String message) {
- this.field = field;
- this.errorMessage = message;
- }
- }
+ /**
+ * Ajax request for the adc calculation of multiple employees of the same company
+ *
+ * @param client chorme client
+ * @param employeeId id of the employees that needs an adc calculation
+ * @param real You must specify this parameter is true if you want the real values from the last year.
+ * The value will be stored in a new ADC object.
+ * @param year Year of the adc if it's the real one that needs to be calculated
+ * @return adc
+ */
+ public Render requestMultipleAdc(ChoremClient client, String employeeId, boolean real, int year) {
+ List<Wikitty> wemployees = client.restore(ChoremUtil.asList(",", employeeId));
+ List<EmployeeHR> employees = new ArrayList<EmployeeHR>();
+ System.out.println("real = " + real + ", year = " + year);
+ for(int i = 0; i< wemployees.size(); i++) {
+ employees.add(new EmployeeHRImpl(wemployees.get(i)));
+ }
- /**
- * Structure used to store information about an employee
- * Used for the AJAX request
- *
- * @author gwenn
- *
- */
- public class EmployeeJson {
+ Map<String, Double> adcs = (new AdcCalculation(client, employees)).getMultipleAdc(real);
+ if(real) {
+ for(int i = 0; i< wemployees.size(); i++) {
+ Wikitty wi = wemployees.get(i);
- private String salary;
- private double productivityRate;
- private double partialTime;
- private double dailyReturn;
- private double dailyHoursWorked;
- private double otherPayments;
+ //Check if the ADC object already exists
+ WikittyQuery adcQuery = new WikittyQueryMaker().and()
+ .eq(ADC.ELEMENT_FIELD_ADC_EMPLOYEEHR, employees.get(i))
+ .eq(ADC.ELEMENT_FIELD_ADC_YEAR, year)
+ .end();
- public EmployeeJson(String salary, double productivityRate, double partialTime,
- double dailyReturn, double dailyHoursWorked, double otherPayments) {
- this.salary = salary;
- this.productivityRate = productivityRate;
- this.partialTime = partialTime;
- this.dailyReturn = dailyReturn;
- this.dailyHoursWorked = dailyHoursWorked;
- this.otherPayments = otherPayments;
- }
- }
-
- /**
- * Structure used to store information about an employee
- * used for the standard http request
- * @author gwenn
- *
- */
- public class EmployeeData implements Comparable{
- private Employee e;
- private String salary;
- private double productivityRate;
- private double partialTime;
- private double dailyReturn;
- private double dailyHoursWorked;
- private double otherPayments;
+ WikittyQueryResult<ADC> adcResult = client.findAllByQuery(
+ ADC.class, adcQuery);
+ if(adcResult.size() == 0) {
+ ADC adc = new ADCImpl();
+ adc.setEmployeeHR(wi.getWikittyId());
+ adc.setYear(year);
+ adc.setValue(adcs.get(wi.getWikittyId()));
+ client.store(adc);
+ }
+ else {
+ ADC adc = adcResult.get(0); //There is only one (in theory)
+ Wikitty wadc =client.restore(adc.getWikittyId());
+ wadc.setField(ADC.EXT_ADC, ADC.FIELD_ADC_VALUE, adcs.get(wi.getWikittyId()));
+ client.store(wadc);
- public EmployeeData(Employee e, ChoremClient client) {
- Wikitty w = client.restore(e.getWikittyId());
- if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) {
- this.salary = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_SALARY) + "";
- this.productivityRate = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PRODUCTIVITYRATE);
- this.partialTime = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME);
- this.otherPayments = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_OTHERPAYMENTS);
- }
- else {
- this.salary = "Non renseigné";
- this.productivityRate = 100;
- this.partialTime = 100;
- this.otherPayments = 0;
- }
- this.dailyReturn = client.getDailyReturn(e);
- //Simple trick to limit to 2 numbers after digit
- int x = (int)(client.getDailyHoursWorked(e)*100);
- double y = x/100.0;
- this.dailyHoursWorked = y;
-
- x = (int)(this.dailyReturn*100);
- y = x/100.0;
- this.dailyReturn = y;
+ }
+ }
+ }
+ else {
+ for(int i = 0; i< wemployees.size(); i++) {
+ Wikitty wi = wemployees.get(i);
+ wi.setField(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN, adcs.get(wi.getWikittyId()));
+ client.store(wi);
+ }
+ }
+ for(String s : adcs.keySet()) {
+ int iadc = (int)(adcs.get(s)*100);
+ adcs.put(s, (double)(iadc/100.0));
+ }
- this.e = e;
- }
- public Employee getObject() {
- return e;
- }
+ return renderJSON("adcs", adcs);
+ }
- public String getSalary() {
- return salary;
- }
- public double getDailyReturn() {
- return dailyReturn;
- }
- public double getDailyHoursWorked() {
- return dailyHoursWorked;
- }
- public double getProductivityRate() {
- return productivityRate;
- }
- public double getPartialTime() {
- return partialTime;
- }
- public double getOtherPayments() {
- return otherPayments;
- }
+ /**
+ * Ajax requets to modify the employee values
+ *
+ * @param client chorme client
+ * @param employeeId id of the employee to modify
+ * @param salaryStr new salary in String format
+ * @param productivityRateStr new prod rate in String format
+ * @param partialTimeStr new partial time in String format
+ * @param dailyReturnStr new daily return in String format
+ * @return
+ */
+ public Render editEmployeeValues(ChoremClient client, String employeeId, String salaryStr
+ , String productivityRateStr, String partialTimeStr, String dailyReturnStr, String otherPaymentsStr) {
+ Wikitty employeeWikitty = client.restore(employeeId);
+ Employee employee = new EmployeeImpl(employeeWikitty);
+ if(!employeeWikitty.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) {
+ employeeWikitty.addExtension(client.restoreExtensionLastVersion(EmployeeHR.EXT_EMPLOYEEHR));
+ }
- @Override
- public int compareTo(Object o) {
- EmployeeData e = (EmployeeData)o;
- return this.getObject().getPerson(false).getLastName().compareTo(e.getObject().getPerson(false).getLastName());
- }
+ double salary = 0, productivityRate = 0, partialTime = 0, dailyReturn = 0, otherPayments = 0;
+ //Try to parse the strings and generates if errors if it fails
+ List<ErrorJson> errors = new ArrayList<ErrorJson>();
+ try {
+ salary = Double.parseDouble(salaryStr);
+ }
+ catch (java.lang.NumberFormatException e) {
+ errors.add(new ErrorJson("salary", "Salary must be a real number"));
+ }
+ try{
+ productivityRate = Double.parseDouble(productivityRateStr);
+ }
+ catch (java.lang.NumberFormatException e) {
+ errors.add(new ErrorJson("productivityRate", "Productivity rate must be a real number"));
+ }
- }
+ try {
+ partialTime = Double.parseDouble(partialTimeStr);
+ }
+ catch (java.lang.NumberFormatException e) {
+ errors.add(new ErrorJson("partialTime", "Partial time must be a real number"));
+ }
+ try {
+ dailyReturn = Double.parseDouble(dailyReturnStr);
+ }
+ catch (java.lang.NumberFormatException e) {
+ errors.add(new ErrorJson("dailyReturn", "Daily return must be a real number"));
+ }
+
+ try {
+ otherPayments = Double.parseDouble(otherPaymentsStr);
+ }
+ catch (java.lang.NumberFormatException e) {
+ errors.add(new ErrorJson("dailyReturn", "Other payments must be a real number"));
+ }
+
+ //Verify that the percentages are between 0 and 100
+ if(productivityRate > 100 || productivityRate < 0) {
+ errors.add(new ErrorJson("productivityRate", "Productivity rate must be between 0 and 100"));
+ }
+ if(partialTime > 100 || partialTime < 0) {
+ errors.add(new ErrorJson("partialTime", "Partial time must be between 0 and 100"));
+ }
+ if(errors.size() != 0)
+ return renderJSON("data", "error", "errors", errors);
+
+
+ if(salary != 0)
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_SALARY, salary);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PRODUCTIVITYRATE, productivityRate);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PARTIALTIME, partialTime);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_DAILYRETURN, dailyReturn);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_OTHERPAYMENTS, otherPayments);
+ client.store(employeeWikitty);
+
+
+ EmployeeData data = new EmployeeData(new EmployeeImpl(employeeWikitty), client);
+
+ EmployeeJson json = new EmployeeJson(
+ data.getSalary() + "",
+ data.getProductivityRate(),
+ data.getPartialTime(),
+ data.getDailyReturn(),
+ data.getDailyHoursWorked(),
+ data.getOtherPayments()
+ );
+
+ return renderJSON("data", json);
+
+ }
+
+ /**
+ * Class used to store an error
+ * @author gwenn
+ *
+ */
+ public class ErrorJson {
+ private String errorMessage;
+ private String field;
+
+ public ErrorJson (String field, String message) {
+ this.field = field;
+ this.errorMessage = message;
+ }
+ }
+
+ /**
+ * Structure used to store information about an employee
+ * Used for the AJAX request
+ *
+ * @author gwenn
+ *
+ */
+ public class EmployeeJson {
+
+ private String salary;
+ private double productivityRate;
+ private double partialTime;
+ private double dailyReturn;
+ private double dailyHoursWorked;
+ private double otherPayments;
+
+ public EmployeeJson(String salary, double productivityRate, double partialTime,
+ double dailyReturn, double dailyHoursWorked, double otherPayments) {
+ this.salary = salary;
+ this.productivityRate = productivityRate;
+ this.partialTime = partialTime;
+ this.dailyReturn = dailyReturn;
+ this.dailyHoursWorked = dailyHoursWorked;
+ this.otherPayments = otherPayments;
+ }
+ }
+
+ /**
+ * Structure used to store information about an employee
+ * used for the standard http request
+ * @author gwenn
+ *
+ */
+ public class EmployeeData implements Comparable{
+
+ private Employee e;
+ private String salary;
+ private double productivityRate;
+ private double partialTime;
+ private double dailyReturn;
+ private double dailyHoursWorked;
+ private double otherPayments;
+
+
+ public EmployeeData(Employee e, ChoremClient client) {
+ Wikitty w = client.restore(e.getWikittyId());
+ if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) {
+ this.salary = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_SALARY) + "";
+ this.productivityRate = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PRODUCTIVITYRATE);
+ this.partialTime = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME);
+ this.otherPayments = w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_OTHERPAYMENTS);
+ }
+ else {
+ this.salary = "Non renseigné";
+ this.productivityRate = 100;
+ this.partialTime = 100;
+ this.otherPayments = 0;
+ }
+ this.dailyReturn = client.getDailyReturn(e);
+ //Simple trick to limit to 2 numbers after digit
+ int x = (int)(client.getDailyHoursWorked(e)*100);
+ double y = x/100.0;
+ this.dailyHoursWorked = y;
+
+ x = (int)(this.dailyReturn*100);
+ y = x/100.0;
+ this.dailyReturn = y;
+
+ this.e = e;
+ }
+
+ public Employee getObject() {
+ return e;
+ }
+
+ public String getSalary() {
+ return salary;
+ }
+
+ public double getDailyReturn() {
+ return dailyReturn;
+ }
+
+ public double getDailyHoursWorked() {
+ return dailyHoursWorked;
+ }
+ public double getProductivityRate() {
+ return productivityRate;
+ }
+ public double getPartialTime() {
+ return partialTime;
+ }
+ public double getOtherPayments() {
+ return otherPayments;
+ }
+
+ @Override
+ public int compareTo(Object o) {
+ EmployeeData e = (EmployeeData)o;
+ return this.getObject().getPerson(false).getLastName().compareTo(e.getObject().getPerson(false).getLastName());
+ }
+
+
+
+ }
+
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -34,344 +34,386 @@
import org.nuiton.wikitty.query.WikittyQueryResult;
/**
- *
+ * Displays a page that shows one or many quotations, with financial tables and a gantt diagram.
* @author meynier
*
*/
public class DashboardProjectAction extends WebMotionController {
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(DashboardProjectAction.class);
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(DashboardProjectAction.class);
- /**
- * Return the view for a single quotation
- * @param client Chorem client
- * @param id Project ID (useless here)
- * @param quotationFilter Quotation id
- * @return
- */
- public Render singleQuotationFilter(ChoremClient client, String id, String quotationFilter) {
+ /**
+ * Return the view for a single quotation
+ * @param client Chorem client
+ * @param id Project ID (useless here)
+ * @param quotationFilter Quotation id
+ * @return
+ */
+ public Render singleQuotationFilter(ChoremClient client, String id, String quotationFilter) {
+ Render render = null;
+ //Fetch the quotation from the filter
+ WikittyQuery quotationQuery = new WikittyQueryMaker().ideq(quotationFilter).end();
+ WikittyQueryResult<Quotation> quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
- //Fetch the quotation from the filter
- WikittyQuery quotationQuery = new WikittyQueryMaker().ideq(quotationFilter).end();
- WikittyQueryResult<Quotation> quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
-
- HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
+ HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
- //If some quotation has been found
- if(quotationResult != null && quotationResult.size() != 0) {
- Quotation quotation = quotationResult.get(0);
-
- //Fetch the quotation's project
- WikittyQuery projectQuery = new WikittyQueryMaker().ideq(quotation.getProject()).end();
- WikittyQueryResult<Project> projectResult = client.findAllByQuery(Project.class, projectQuery);
-
- List<QuotationData> q = new ArrayList<QuotationData>();
- q.add(new QuotationData(quotation, client));
- projectData.put(projectResult.get(0), q);
+ //If some quotation has been found
+ if(quotationResult != null && quotationResult.size() != 0) {
+ Quotation quotation = quotationResult.get(0);
- return renderView("dashboardSingleProject.jsp",
- "locale", client.getUserLocale(),
- "title", "Tableau de bord projet",
- "projects", projectData);
+ //Fetch the quotation's project
+ WikittyQuery projectQuery = new WikittyQueryMaker().ideq(quotation.getProject()).end();
+ WikittyQueryResult<Project> projectResult = client.findAllByQuery(Project.class, projectQuery);
- }
- else {
- return renderView("dashboardSingleProject.jsp");
- }
- }
+ List<QuotationData> q = new ArrayList<QuotationData>();
+ q.add(new QuotationData(quotation, client));
+ projectData.put(projectResult.get(0), q);
- /**
- * Display multiple quotation for one or more projects
- * @param client chorem client
- * @param id Project id
- * @param quotationFilter filter (open quotation or all)
- * @return
- */
- public Render projectFilter(ChoremClient client, String id, String quotationFilter) {
-
- WikittyQueryResult<Project> projectResult = null;
- WikittyQueryResult<Quotation> quotationResult = null;
+ render = renderView("dashboardSingleProject.jsp",
+ "locale", client.getUserLocale(),
+ "title", "Tableau de bord projet",
+ "projects", projectData);
-
- HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
-
- //Fetch the projects from the id or the filter
- WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
- if(id != null && !id.equals(""))
- projectQueryMaker.ideq(id);
- else
- projectQueryMaker.exteq(Project.EXT_PROJECT);
- WikittyQuery projectQuery = projectQueryMaker.end();
+ }
+ else {
+ render = renderView("dashboardSingleProject.jsp");
+ }
+ return render;
+ }
- projectResult = client.findAllByQuery(Project.class, projectQuery);
-
- //Fetch the quotations from the projects
- if(projectResult.size() != 0) {
- for(Project project : projectResult.getAll()) {
- WikittyQuery quotationQuery = null;
- WikittyQueryMaker wqm = new WikittyQueryMaker();
+ /**
+ * Display multiple quotation for one or more projects
+ * @param client chorem client
+ * @param id Project id
+ * @param quotationFilter filter (open quotation or all)
+ * @return
+ */
+ public Render projectFilter(ChoremClient client, String id, String quotationFilter) {
+ WikittyQueryResult<Project> projectResult = null;
+ WikittyQueryResult<Quotation> quotationResult = null;
- if(quotationFilter.equals("open")) {
- wqm.and()
- .eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project)
- .extne(Closed.EXT_CLOSED);
- }
- else if (quotationFilter.equals("all")){
- wqm.eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project);
- }
+ HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
- quotationQuery = wqm.end();
- quotationQuery.setLimit(20);
- quotationQuery.addSortDescending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
- quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
+ //Fetch the projects from the id or the filter
+ WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
+ if(id != null && !id.equals(""))
+ projectQueryMaker.ideq(id);
+ else
+ projectQueryMaker.exteq(Project.EXT_PROJECT);
+ WikittyQuery projectQuery = projectQueryMaker.end();
- //Fetch the tasks form the quotations (if there are some)
- if(quotationResult != null && quotationResult.size() != 0) {
- List<QuotationData> quotation = new ArrayList<QuotationData>();
- for(Quotation quote : quotationResult.getAll()) {
- quotation.add(new QuotationData(quote, client));
- }
- projectData.put(project, quotation);
- }
- }
- }
+ projectResult = client.findAllByQuery(Project.class, projectQuery);
- return renderView("dashboardSingleProject.jsp",
- "locale", client.getUserLocale(),
- "title", "Tableau de bord projet",
- "projects", projectData);
+ //Fetch the quotations from the projects
+ if(projectResult.size() != 0) {
+ for(Project project : projectResult.getAll()) {
+ WikittyQuery quotationQuery = null;
+ WikittyQueryMaker wqm = new WikittyQueryMaker();
- }
+ if(quotationFilter.equals("open")) {
+ wqm.and()
+ .eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project)
+ .extne(Closed.EXT_CLOSED);
+ }
+ else if (quotationFilter.equals("all")){
+ wqm.eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project);
+ }
-
- public Render multiProjectFilter(ChoremClient client, Date from, Date to) {
- System.out.println(from + "," + to);
- if(from == null || to == null) {
- Calendar now = new GregorianCalendar();
- Calendar gFrom = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
- , now.getActualMinimum(Calendar.DAY_OF_MONTH));
- Calendar gTo = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
- , now.getActualMaximum(Calendar.DAY_OF_MONTH));
- from = gFrom.getTime();
- to = gTo.getTime();
+ quotationQuery = wqm.end();
+ quotationQuery.setLimit(20);
+ quotationQuery.addSortDescending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
+ quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
- }
+ //Fetch the tasks form the quotations (if there are some)
+ if(quotationResult != null && quotationResult.size() != 0) {
+ List<QuotationData> quotation = new ArrayList<QuotationData>();
+ for(Quotation quote : quotationResult.getAll()) {
+ quotation.add(new QuotationData(quote, client));
+ }
+ projectData.put(project, quotation);
+ }
+ }
+ }
+ return renderView("dashboardSingleProject.jsp",
+ "locale", client.getUserLocale(),
+ "title", "Tableau de bord projet",
+ "projects", projectData);
- WikittyQueryMaker quotationQueryMaker = new WikittyQueryMaker();
- WikittyQuery quotationQuery = quotationQueryMaker.or()
- .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
- .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
- .and()
- .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from)
- .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to)
- .end();
- WikittyQueryResult<Quotation> result =
- client.findAllByQuery(Quotation.class, quotationQuery);
+ }
- Collection<Quotation> quotations = result.getAll();
- HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
- for(Quotation q : quotations) {
- QuotationCalculation calc = new QuotationCalculation(q, client);
- calc.calculate();
- calculations.put(q, calc);
- }
-
- TotalQuotationCalculation total = new TotalQuotationCalculation(
- new ArrayList<QuotationCalculation>(calculations.values()));
-
- return renderView("dashboardMultiProject.jsp",
- "title", "Tableau de bord projets",
- "locale", client.getUserLocale(),
- "quotations", quotations,
- "calculations", calculations,
- "total", total);
+ /**
+ * Generates the multi-project page
+ * @param client chorem client
+ * @param from begin date for the interval
+ * @param to end date for the interval
+ * @return
+ */
+ public Render multiProjectFilter(ChoremClient client, Date from, Date to) {
+ System.out.println(from + "," + to);
+ if(from == null || to == null) {
+ Calendar now = new GregorianCalendar();
+ Calendar gFrom = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
+ , now.getActualMinimum(Calendar.DAY_OF_MONTH));
+ Calendar gTo = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
+ , now.getActualMaximum(Calendar.DAY_OF_MONTH));
+ from = gFrom.getTime();
+ to = gTo.getTime();
+ }
- }
- public Render employeeFilter(ChoremClient client, String id, Date from, Date to, String[] quotationFilters) {
-
- //If no field has been set, sets the date to the actual month
- if(from == null || to == null) {
- Calendar now = new GregorianCalendar();
- Calendar gFrom = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
- , now.getActualMinimum(Calendar.DAY_OF_MONTH));
- Calendar gTo = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
- , now.getActualMaximum(Calendar.DAY_OF_MONTH));
- from = gFrom.getTime();
- to = gTo.getTime();
- }
-
- //Fetch the total list of employee (or just the chosen one
- WikittyQueryMaker employeeQueryMaker = new WikittyQueryMaker();
- if(id != null && !id.equals(""))
- employeeQueryMaker.ideq(id);
- else {
- employeeQueryMaker.exteq(Employee.EXT_EMPLOYEE);
- }
- WikittyQueryResult<Employee> employeeResult = client.findAllByQuery(Employee.class,employeeQueryMaker.end());
- List<Employee> employeeList = employeeResult.getAll();
-
- //Fetch all the tasks on the interval
- WikittyQueryMaker taskQueryMaker = new WikittyQueryMaker()
- .and()
- .exteq(Task.EXT_TASK);
-
- if(quotationFilters!=null) {
- taskQueryMaker.or();
- for(String q : quotationFilters) {
- taskQueryMaker .eq(Task.FQ_FIELD_TASK_QUOTATION,q);
- System.out.println(client.restore(q));}
- taskQueryMaker.close();
- }
-
- taskQueryMaker .or()
- .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
- .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
- .and()
- .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from)
- .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to);
-
- WikittyQuery taskQuery = taskQueryMaker.end();
- System.out.println(taskQuery);
- List<Task> taskList = client.findAllByQuery(Task.class,taskQuery).getAll();
- System.out.println("RESULT : " + taskList);
- //Fetch the employee's workers on those tasks
-
-
-
- //----------------------------------------
- //Fetch the real time spent on each project/quotation
- HashMap<Employee, Double> timeTotals = new HashMap<Employee, Double>();
- HashMap<Employee, HashMap<Quotation, Double>> timePerQuotation = new HashMap<Employee, HashMap<Quotation, Double>>();
- for(Task task : taskList) {
-
- WikittyQueryMaker timeQueryMaker = new WikittyQueryMaker().and()
- .eq(Time.ELEMENT_FIELD_TIME_TASK, task);
- if(employeeList.size() == 1)
- timeQueryMaker.eq(Time.ELEMENT_FIELD_TIME_EMPLOYEE, employeeList.get(0));
- WikittyQuery timeQuery = timeQueryMaker.end();
- WikittyQueryResult<Time> timeResult = client.findAllByQuery(Time.class, timeQuery);
-
-
-
- for(Time time : timeResult.getAll()) {
- Employee emp = time.getEmployee(false);
-
- //TOTAL TIMES
- if(timeTotals.containsKey(emp))
- timeTotals.put(emp, timeTotals.get(emp) + ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
- else
- timeTotals.put(emp, ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
-
- HashMap<Quotation, Double> timeQ = null;
- //TIME PER QUOTATION
- if(timePerQuotation.containsKey(emp)) {
- timeQ = timePerQuotation.get(emp);
- }
- else {
- timeQ = new HashMap<Quotation, Double>();
- timePerQuotation.put(emp, timeQ);
- }
- Quotation qKey = task.getQuotation(false);
- if(timeQ.containsKey(qKey)) {
- timeQ.put(qKey, timeQ.get(qKey) +
- ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
- }
- else {
- timeQ.put(qKey,
- ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
- }
-
- }
- }
- Set<Employee> kSet = timePerQuotation.keySet();
- Set<Quotation> quotations = new HashSet<Quotation>();
- for(Employee e : kSet) {
- quotations.addAll(timePerQuotation.get(e).keySet());
- }
- List<Quotation> allQuotations = new ArrayList<Quotation>();
- WikittyQuery quotationQuery = new WikittyQueryMaker().or()
- .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
- .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
- .and()
- .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from)
- .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to).end();
- allQuotations = client.findAllByQuery(Quotation.class, quotationQuery).getAll();
-
- HashMap<Employee, HashMap<Quotation, Double>> percentages = new HashMap<Employee, HashMap<Quotation, Double>>();
-
- for(Employee e : kSet) {
- Set<Quotation> qSet = timePerQuotation.get(e).keySet();
- HashMap<Quotation, Double> p = new HashMap<Quotation, Double>();
- for(Quotation q : qSet) {
-
- p.put(q, ( timePerQuotation.get(e).get(q) / timeTotals.get(e) ) *100 );
-
- }
- percentages.put(e, p);
- }
-
-
- //Calculates the average working time
-
- Calendar gFrom = new GregorianCalendar();
- Calendar gTo = new GregorianCalendar();
- gFrom.setTime(from);
- gTo.setTime(to);
-
- return renderView("dashboardEmployee.jsp",
- "title", "Tableau de bord employé",
- "locale", client.getUserLocale(),
- "timePerQuotation", timePerQuotation,
- "quotations", quotations,
- "percentages", percentages,
- "timeTotals", timeTotals,
- "allQuotations", allQuotations);
-
- }
+ WikittyQueryMaker quotationQueryMaker = new WikittyQueryMaker();
+ WikittyQuery quotationQuery = quotationQueryMaker.or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
+ .and()
+ .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from)
+ .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to)
+ .end();
+ WikittyQueryResult<Quotation> result =
+ client.findAllByQuery(Quotation.class, quotationQuery);
+ Collection<Quotation> quotations = result.getAll();
- public Render requestProject(ChoremClient client, String project_name, String project_id, String quotationFilter) {
- if(quotationFilter == null)
- quotationFilter = "open";
- if(project_name == null || project_name.equals(""))
- project_id = "";
- if(quotationFilter.equals("open") || quotationFilter.equals("all")) {
- return projectFilter(client, project_id, quotationFilter);
- }
- else {
- return singleQuotationFilter(client, project_id, quotationFilter);
- }
- }
- public Render requestMultiProject(ChoremClient client, Date from, Date to) {
- return multiProjectFilter(client, from, to);
- }
-
- public Render requestEmployee(ChoremClient client, String id, Date from, Date to, String[] quotations) {
- System.out.println("QUOTATIONS : " + Arrays.toString(quotations));
- return employeeFilter(client, id, from, to, quotations);
- }
+ HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
+ for(Quotation q : quotations) {
+ QuotationCalculation calc = new QuotationCalculation(q, client);
+ calc.calculate();
+ calculations.put(q, calc);
+ }
+ TotalQuotationCalculation total = new TotalQuotationCalculation(
+ new ArrayList<QuotationCalculation>(calculations.values()));
- private class IntervalSorter<T extends Interval> implements Comparator {
- @Override
- public int compare(Object q1, Object q2) {
- return ((T)q1).getBeginDate().compareTo(((T)q2).getBeginDate());
- }
+ return renderView("dashboardMultiProject.jsp",
+ "title", "Tableau de bord projets",
+ "locale", client.getUserLocale(),
+ "quotations", quotations,
+ "calculations", calculations,
+ "total", total);
- }
-
-
+
+ }
+
+ /**
+ *
+ * @param client
+ * @param id
+ * @param from
+ * @param to
+ * @param quotationFilters
+ * @return
+ */
+ public Render employeeFilter(ChoremClient client, String id, Date from, Date to, String[] quotationFilters) {
+
+ //If no field has been set, sets the date to the actual month
+ if(from == null || to == null) {
+ Calendar now = new GregorianCalendar();
+ Calendar gFrom = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
+ , now.getActualMinimum(Calendar.DAY_OF_MONTH));
+ Calendar gTo = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH)
+ , now.getActualMaximum(Calendar.DAY_OF_MONTH));
+ from = gFrom.getTime();
+ to = gTo.getTime();
+ }
+
+ //Fetch the total list of employee (or just the chosen one
+ WikittyQueryMaker employeeQueryMaker = new WikittyQueryMaker();
+ if(id != null && !id.equals(""))
+ employeeQueryMaker.ideq(id);
+ else {
+ employeeQueryMaker.exteq(Employee.EXT_EMPLOYEE);
+ }
+ WikittyQueryResult<Employee> employeeResult = client.findAllByQuery(Employee.class,employeeQueryMaker.end());
+ List<Employee> employeeList = employeeResult.getAll();
+
+ //Fetch all the tasks on the interval
+ WikittyQueryMaker taskQueryMaker = new WikittyQueryMaker()
+ .and()
+ .exteq(Task.EXT_TASK);
+
+ if(quotationFilters!=null) {
+ taskQueryMaker.or();
+ for(String q : quotationFilters) {
+ taskQueryMaker .eq(Task.FQ_FIELD_TASK_QUOTATION,q);
+ System.out.println(client.restore(q));}
+ taskQueryMaker.close();
+ }
+
+ taskQueryMaker .or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
+ .and()
+ .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from)
+ .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to);
+
+ WikittyQuery taskQuery = taskQueryMaker.end();
+ System.out.println(taskQuery);
+ List<Task> taskList = client.findAllByQuery(Task.class,taskQuery).getAll();
+ System.out.println("RESULT : " + taskList);
+ //Fetch the employee's workers on those tasks
+
+
+
+ //----------------------------------------
+ //Fetch the real time spent on each project/quotation
+ HashMap<Employee, Double> timeTotals = new HashMap<Employee, Double>();
+ HashMap<Employee, HashMap<Quotation, Double>> timePerQuotation = new HashMap<Employee, HashMap<Quotation, Double>>();
+ for(Task task : taskList) {
+
+ WikittyQueryMaker timeQueryMaker = new WikittyQueryMaker().and()
+ .eq(Time.ELEMENT_FIELD_TIME_TASK, task);
+ if(employeeList.size() == 1)
+ timeQueryMaker.eq(Time.ELEMENT_FIELD_TIME_EMPLOYEE, employeeList.get(0));
+ WikittyQuery timeQuery = timeQueryMaker.end();
+ WikittyQueryResult<Time> timeResult = client.findAllByQuery(Time.class, timeQuery);
+
+
+
+ for(Time time : timeResult.getAll()) {
+ Employee emp = time.getEmployee(false);
+
+ //TOTAL TIMES
+ if(timeTotals.containsKey(emp))
+ timeTotals.put(emp, timeTotals.get(emp) + ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
+ else
+ timeTotals.put(emp, ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
+
+ HashMap<Quotation, Double> timeQ = null;
+ //TIME PER QUOTATION
+ if(timePerQuotation.containsKey(emp)) {
+ timeQ = timePerQuotation.get(emp);
+ }
+ else {
+ timeQ = new HashMap<Quotation, Double>();
+ timePerQuotation.put(emp, timeQ);
+ }
+ Quotation qKey = task.getQuotation(false);
+ if(timeQ.containsKey(qKey)) {
+ timeQ.put(qKey, timeQ.get(qKey) +
+ ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
+ }
+ else {
+ timeQ.put(qKey,
+ ChoremUtil.getPeriodInHours(time.getBeginDate(), time.getEndDate()));
+ }
+
+ }
+ }
+ Set<Employee> kSet = timePerQuotation.keySet();
+ Set<Quotation> quotations = new HashSet<Quotation>();
+ for(Employee e : kSet) {
+ quotations.addAll(timePerQuotation.get(e).keySet());
+ }
+ List<Quotation> allQuotations = new ArrayList<Quotation>();
+ WikittyQuery quotationQuery = new WikittyQueryMaker().or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
+ .and()
+ .le(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from)
+ .ge(Interval.FQ_FIELD_INTERVAL_ENDDATE, to).end();
+ allQuotations = client.findAllByQuery(Quotation.class, quotationQuery).getAll();
+
+ HashMap<Employee, HashMap<Quotation, Double>> percentages = new HashMap<Employee, HashMap<Quotation, Double>>();
+
+ for(Employee e : kSet) {
+ Set<Quotation> qSet = timePerQuotation.get(e).keySet();
+ HashMap<Quotation, Double> p = new HashMap<Quotation, Double>();
+ for(Quotation q : qSet) {
+
+ p.put(q, ( timePerQuotation.get(e).get(q) / timeTotals.get(e) ) *100 );
+
+ }
+ percentages.put(e, p);
+ }
+
+
+ //Calculates the average working time
+
+ Calendar gFrom = new GregorianCalendar();
+ Calendar gTo = new GregorianCalendar();
+ gFrom.setTime(from);
+ gTo.setTime(to);
+
+ return renderView("dashboardEmployee.jsp",
+ "title", "Tableau de bord employé",
+ "locale", client.getUserLocale(),
+ "timePerQuotation", timePerQuotation,
+ "quotations", quotations,
+ "percentages", percentages,
+ "timeTotals", timeTotals,
+ "allQuotations", allQuotations);
+
+ }
+
+ /**
+ *
+ * @param client
+ * @param project_name
+ * @param project_id
+ * @param quotationFilter
+ * @return
+ */
+ public Render requestProject(ChoremClient client, String project_name, String project_id, String quotationFilter) {
+ if(quotationFilter == null)
+ quotationFilter = "open";
+ if(project_name == null || project_name.equals(""))
+ project_id = "";
+ Render render = null;
+ if(quotationFilter.equals("open") || quotationFilter.equals("all")) {
+ render = projectFilter(client, project_id, quotationFilter);
+ }
+ else {
+ render = singleQuotationFilter(client, project_id, quotationFilter);
+ }
+ return render;
+ }
+ /**
+ *
+ * @param client
+ * @param from
+ * @param to
+ * @return
+ */
+ public Render requestMultiProject(ChoremClient client, Date from, Date to) {
+ return multiProjectFilter(client, from, to);
+ }
+
+ /**
+ *
+ * @param client
+ * @param id
+ * @param from
+ * @param to
+ * @param quotations
+ * @return
+ */
+ public Render requestEmployee(ChoremClient client, String id, Date from, Date to, String[] quotations) {
+ System.out.println("QUOTATIONS : " + Arrays.toString(quotations));
+ return employeeFilter(client, id, from, to, quotations);
+ }
+
+
+ private class IntervalSorter<T extends Interval> implements Comparator {
+
+ @Override
+ public int compare(Object q1, Object q2) {
+
+ return ((T)q1).getBeginDate().compareTo(((T)q2).getBeginDate());
+ }
+
+ }
+
+
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/GanttAction.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -23,12 +23,23 @@
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
+/**
+ * Manage the ajax actions for the gantt diagram on the single-project dashboard
+ * @author gwenn
+ *
+ */
public class GanttAction extends WebMotionController {
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(GanttAction.class);
+ /**
+ * Return gantt data under json format
+ * @param client
+ * @param id
+ * @return
+ */
public Render getGanttInfo(ChoremClient client, String id) {
Wikitty wikitty = client.restore(id);
WikittyQuery quotationQuery = new WikittyQueryMaker()
@@ -48,18 +59,7 @@
for(Task t : taskResult.getAll()) {
if(t.getBeginDate() != null && t.getEndDate() != null) {
- if(t.getStatus().equalsIgnoreCase("scheduled")) {
- customClass = "ganttBlue";
- }
- else if(t.getStatus().equalsIgnoreCase("started")) {
- customClass = "ganttGreen";
- }
- else if(t.getStatus().equalsIgnoreCase("finished")) {
- customClass = "ganttRed";
- }
- else if(t.getStatus().equalsIgnoreCase("closed")) {
- customClass = "ganttGrey";
- }
+ customClass= "gantt-" + t.getStatus().toLowerCase();
Values[] v = null;
if(t.getDayExtension() != 0)
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -8,79 +8,97 @@
import org.chorem.ChoremClient;
import org.chorem.entities.Task;
import org.chorem.entities.Quotation;
+import org.chorem.entities.Time;
import org.chorem.project.QuotationCalculation;
+/**
+ * Represent a quotation to use it in a jsp page
+ * @author gwenn
+ *
+ */
public class QuotationData extends QuotationCalculation {
- private List<TaskData> tasksData;
-
- public QuotationData(Quotation q, ChoremClient client) {
- super(q, client);
- tasksData = new ArrayList<TaskData>();
-
- for(Task t : this.getTasks()) {
- tasksData.add(new TaskData(t, client));
- }
- this.calculate();
- getAlerts();
- }
-
- private void getAlerts() {
- Calendar now = new GregorianCalendar();
- for(TaskData td : tasksData) {
- Task t = td.getObject();
- if(t.getBeginDate() != null && t.getEndDate() != null) {
- String str = "<h4>Warning</h4>";
- boolean alert = false;
- //Test if the statuses are correct
- if(t.getStatus().equalsIgnoreCase("Scheduled")) {
- if(t.getBeginDate().before(now.getTime())) {
- alert = true;
- str += "Task " + t.getName() + " should be started";
- }
- }
- else if(t.getStatus().equalsIgnoreCase("Started")) {
- if(t.getBeginDate().after(now.getTime())) {
- alert = true;
- str += "Task " + t.getName() + " has been started in advance";
- }
- else if(t.getEndDate().before(now.getTime())) {
- alert = true;
- str += "Task " + t.getName() + " should have ended by now";
- }
- }
- else if(t.getStatus().equalsIgnoreCase("Finished")) {
-
- if(t.getEndDate().after(now.getTime())) {
- alert = true;
- str += "Task " + t.getName() + " has been finished in advance";
- }
- }
- if(alert) {
- td.setAlert(str);
- }
-
- }
+ protected List<TaskData> tasksData;
- }
-
- }
-
- public TaskData getTaskData(Task t) {
- for(TaskData td : tasksData) {
- if(td.getObject() == t) {
- return td;
- }
- }
- return null;
- }
-
-
-
- public List<TaskData> getTasksData() {
- return tasksData;
- }
-
-
+ public QuotationData(Quotation q, ChoremClient client) {
+ super(q, client);
+ tasksData = new ArrayList<TaskData>();
+
+ for(Task t : this.getTasks()) {
+ tasksData.add(new TaskData(t, client));
+ }
+ this.calculate();
+ addAlerts(tasksData);
+ }
+
+ /**
+ * fetch the alerts of each task and stor it in the linked TaskData object
+ * @param tasksData
+ */
+ protected void addAlerts(List<TaskData> tasksData) {
+ Calendar now = new GregorianCalendar();
+ for(TaskData td : tasksData) {
+ Task t = td.getObject();
+ if(t.getBeginDate() != null && t.getEndDate() != null) {
+ String alertStr = "<h4>Warning</h4>";
+ String infoStr = "<h4>Info</h4>";
+ boolean alert = false;
+ boolean info = false;
+ //Test if the statuses are correct
+ if(t.getStatus().equalsIgnoreCase("Scheduled")) {
+ if(t.getBeginDate().before(now.getTime())) {
+ alert = true;
+ alertStr += "Task " + t.getName() + " should be started";
+ }
+ }
+ else if(t.getStatus().equalsIgnoreCase("Started")) {
+
+ if(t.getEndDate().before(now.getTime())) {
+ alert = true;
+ alertStr += "Task " + t.getName() + " should have ended by now";
+ }
+ }
+
+ for(Time time : client.getTimes(t)) {
+ if(time.getBeginDate().before(t.getBeginDate()) || time.getEndDate().before(t.getBeginDate())) {
+ info=true;
+ infoStr = "Times have been added to the task but is is not started";
+ }
+ else if(time.getBeginDate().after(t.getEndDate()) || time.getEndDate().after(t.getEndDate())) {
+ info=true;
+ infoStr = "Times have been added to the task but it should be ended";
+ }
+ }
+
+
+ if(alert) {
+ td.setAlert(alertStr);
+ }
+ if(info) {
+ td.setInfo(infoStr);
+ }
+
+ }
+
+ }
+
+ }
+
+ public TaskData getTaskData(Task t) {
+ for(TaskData td : tasksData) {
+ if(td.getObject() == t) {
+ return td;
+ }
+ }
+ return null;
+ }
+
+
+
+ public List<TaskData> getTasksData() {
+ return tasksData;
+ }
+
+
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -11,13 +11,18 @@
import org.chorem.ChoremClient;
import org.chorem.ChoremUtil;
import org.chorem.webmotion.actions.GenericAction;
-import org.debux.webmotion.server.WebMotionController;
import org.debux.webmotion.server.call.Call;
import org.debux.webmotion.server.render.Render;
import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.entities.WikittyExtension;
import org.nuiton.wikitty.entities.WikittyImpl;
+/**
+ * Currently unsused class managing the ajax request for the quotation status changed.
+ * May be deprecated with the completion of the transaction funnel.
+ * @author gwenn
+ *
+ */
public class QuotationStatusAction extends GenericAction{
/** to use log facility, just put in your code: log.info(\"...\"); */
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 14:17:38 UTC (rev 384)
@@ -7,19 +7,28 @@
public class TaskData extends TaskCalculation {
-
- private String alert;
-
- public TaskData(Task t, ChoremClient client) {
- super(t, client);
- this.calculate();
- }
-
- public void setAlert(String a) {
- alert = a;
- }
-
- public String getAlert() {
- return alert;
- }
+
+ private String alert;
+ private String info;
+
+ public TaskData(Task t, ChoremClient client) {
+ super(t, client);
+ this.calculate();
+ }
+
+ public void setAlert(String a) {
+ alert = a;
+ }
+
+ public String getAlert() {
+ return alert;
+ }
+
+ public void setInfo(String a) {
+ info = a;
+ }
+
+ public String getInfo() {
+ return info;
+ }
}
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2013-08-14 14:17:38 UTC (rev 384)
@@ -11,7 +11,7 @@
* /fragment/* DecoratorFilter.decorate wmDecoratorNo=true
* /sales/funnel/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /project/json/* DecoratorFilter.decorate wmDecoratorNo=true
-* /admin/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true
+* /hr/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /ascii/* DecoratorFilter.decorate wmDecoratorNo=true
* /rest/* DecoratorFilter.decorate wmDecoratorNo=true
GET /* DecoratorFilter.decorate
@@ -52,8 +52,6 @@
* /fragment/sales/{method} action:sales.SalesAction.{method}
* /admin view:contact.jsp
* /admin/importExport view:admin/importExport.jsp
-* /admin/employeeEdit action:EmployeeEditAction.requestEmployeeEdit
-* /admin/employeeEdit/json/{method}/{employeeId} action:EmployeeEditAction.{method}
* /admin/{method} action:AdminAction.{method}
* /contact view:contact.jsp
* /report view:report.jsp
@@ -64,6 +62,9 @@
* /hr/vacationDiv/{ids} action:HrAction.editVacationDiv
* /hr/vacationRequest/save action:HrAction.saveVacationRequest
* /hr/vacationRequest/delete/{id} action:HrAction.deleteVacationRequest
+* /hr/employeeEdit action:EmployeeEditAction.requestEmployeeEdit
+* /hr/dashboardAdc action:AdcDashboardAction.requestDashboardAdc
+* /hr/employeeEdit/json/{method}/{employeeId} action:EmployeeEditAction.{method}
* /salesMenu view:salesReports/menu.jsp
* /sales/report/sentQuotation action:sales.SentQuotationsReportAction.sentQuotationPerMonth
* /sales/report/acceptedQuotation action:sales.AcceptedQuotationsReportAction.acceptedQuotationPerMonth
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAdc.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAdc.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardAdc.jsp 2013-08-14 14:17:38 UTC (rev 384)
@@ -0,0 +1,92 @@
+<%--
+ #%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="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
+
+<f:setLocale value="${locale}" />
+
+<link rel="stylesheet" href="<c:url value='/css/employeeEdit.css'/>" />
+
+<h1>${title}</h1>
+
+<form method="GET" id="companyForm">
+
+<select class="filterBox" name="companyId" id="companySelect">
+ <option>Choisir une entreprise</option>
+ <c:forEach var="c" items="${companies}">
+ <option value="${c.wikittyId}"
+ <c:if test="${company.equals(c)}">selected</c:if>
+ >${c.name}</option>
+ </c:forEach>
+ </select>
+</form>
+
+<form class="well form-inline" method="POST" id="company">
+<h4><a href="<c:url value="/wikitty/view/${company.wikittyId}"/>">${company.wikitty}</a></h4>
+<input type="hidden" name="companyId" value="${company.wikittyId}"/>
+
+from :
+<input type="text" value="${from}">
+to :
+<input type="text" value="${to}">
+</form>
+<form style='display:inline;' id='searchForm'>Recherche : <input type="text" id="searchInput"/></form>
+<p><button class="btn btn-success" id="calculateBtn" year = "${lastYear}">
+ <i class="icon-refresh icon-white"></i>
+ Calculer les CJMs pour ${lastYear}
+</button></p>
+<table class="table table-striped table-bordered table-condensed tableEdit">
+ <thead>
+ <th class="headEmployee">Employé</th>
+ <c:forEach items="${years}" var="year">
+ <th class="${year}">${year}</th>
+ </c:forEach>
+ <th>CJM estimé</th>
+ </thead>
+ <tbody>
+ <c:set var="count" value="0"/>
+ <c:forEach items="${employees}" var="employee">
+ <tr class="bodyRow row${count}" id="${employee.object.wikittyId}">
+ <td class="person bodyEmployee"><w:display wikitty="${employee.object.wikitty}"
+ fqfield="Employee.person" label="" />
+ </td>
+ <c:forEach items="${years}" var="year">
+ <td class="year${year}">
+ <c:if test="${not empty employee.adcPerYear[year]}">
+ ${employee.adcPerYear[year]}
+ </c:if>
+ </td>
+ </c:forEach>
+ <td class="estimatedAdc">${employee.estimatedAdc}</td>
+
+ </tr>
+ <c:set var="count" value="${count + 1}"/>
+ </c:forEach>
+ </tbody>
+</table>
+<script src="<c:url value='/js/employeeEdit.js'/>"></script>
+<script src="<c:url value='/js/dashboardAdc.js'/>"></script>
+
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-08-14 14:17:38 UTC (rev 384)
@@ -177,7 +177,10 @@
wikitty="${task.object.wikitty}" fqfield="Task.name" label="" /></a>
<c:if test="${not empty task.alert}">
<i class="icon-warning-sign" title="${task.alert}"></i>
- </c:if>
+ </c:if>
+ <c:if test="${not empty task.info}">
+ <i class="icon-info-sign" title="${task.info}"></i>
+ </c:if>
<td><w:display wikitty="${task.object.wikitty}"
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-08-14 14:17:38 UTC (rev 384)
@@ -193,6 +193,8 @@
<li>Employee HR</li>
<li><a href="<c:url value="/wikitty/EmployeeHR/search"/>"><i class="icon-th-list icon-black"></i> All employees HR</a></li>
<li><a href="<c:url value="/wikitty/EmployeeHR/edit/new"/>"><i class="icon-plus icon-black"></i> Add employee HR</a>
+ <li><a href="<c:url value="/hr/employeeEdit"/>">Employee edit</a></li>
+ <li><a href="<c:url value="/hr/dashboardAdc"/>">Adc Dashboard</a></li>
<li>Vacation</li>
<li><a href="<c:url value="/wikitty/Vacation/search"/>"><i class="icon-th-list icon-black"></i> All vacations</a></li>
<li><a href="<c:url value="/wikitty/Vacation/edit/new"/>"><i class="icon-plus icon-black"></i> Add vacation</a></li>
@@ -221,7 +223,7 @@
<li class="divider"></li>
<li><a href="<c:url value="/admin/reindex"/>">Reindex</a></li>
<li class="divider"></li>
- <li><a href="<c:url value="/admin/employeeEdit"/>">Employee edit</a></li>
+
</ul>
</li>
</ul>
Added: trunk/chorem-webmotion/src/main/webapp/js/dashboardAdc.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/dashboardAdc.js (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/js/dashboardAdc.js 2013-08-14 14:17:38 UTC (rev 384)
@@ -0,0 +1,47 @@
+
+
+$(document).ready(function() {
+
+
+
+
+ $('#calculateBtn').click(function() {
+
+ var rows = $('.bodyRow');
+ var str = "";
+ var year = $(this).attr('year');
+ for(var i = 0; i < rows.length; i++) {
+ str = str + $(rows[i]).attr('id');
+ if(i != (rows.length -1)) {
+ str= str + ',';
+ }
+
+ }
+ $(this).attr('disabled', 'disabled');
+ $.get(createUrl("/hr/employeeEdit/json/requestMultipleAdc/",str,'?real=true&year=2012'),
+ function(ret){
+ $('#calculateBtn').removeAttr('disabled');
+ var adcs = ret['adcs'];
+ if($('.' + year).size() != 0) {
+ for(var i in adcs) {
+ var row = $('#'+i);
+ row.find('.year' + year).text(adcs[i]);
+ }
+ }else {
+ $('.headEmployee').after("<th class='"+year+"'>"+year+"</th>");
+ for(var i in adcs) {
+
+ var row = $('#'+i);
+ row.find('.bodyEmployee').after('<td class="year'+year+'">'+adcs[i]+'</td>');
+
+ }
+ }
+ });
+
+
+ });
+
+
+
+
+});
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/js/employeeEdit.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/employeeEdit.js 2013-08-14 12:14:58 UTC (rev 383)
+++ trunk/chorem-webmotion/src/main/webapp/js/employeeEdit.js 2013-08-14 14:17:38 UTC (rev 384)
@@ -124,7 +124,7 @@
$('#editAllBtn').attr('disabled', 'disabled');
$('.spinner').show();
}
- $.get(createUrl("/admin/employeeEdit/json/editEmployeeValues/",row.attr("id"), "?salaryStr=",
+ $.get(createUrl("/hr/employeeEdit/json/editEmployeeValues/",row.attr("id"), "?salaryStr=",
salaryVal, "&productivityRateStr=", prodVal, "&partialTimeStr=", timeVal,
"&dailyReturnStr=", cjmVal, "&otherPaymentsStr=", otherVal),
function(ret){
@@ -182,7 +182,7 @@
var cjm = row.find(".dailyReturn");
blockDailyReturn(row);
blockEdit(row);
- $.get(createUrl("/admin/employeeEdit/json/requestAdc/",row.attr("id")),
+ $.get(createUrl("/hr/employeeEdit/json/requestAdc/",row.attr("id"),"?real=false"),
function(ret){
var adc = ret['adc'];
displayDailyReturn(row, adc, true);
@@ -205,8 +205,7 @@
}
}
- console.log(str);
- $.get(createUrl("/admin/employeeEdit/json/requestMultipleAdc/",str),
+ $.get(createUrl("/hr/employeeEdit/json/requestMultipleAdc/",str, "?real=false&year=0"),
function(ret){
var adcs = ret['adcs'];
for(var i in adcs) {
1
0
r383 - in trunk/chorem-entities/src/main: java/org/chorem java/org/chorem/project xmi
by meynier@users.chorem.org 14 Aug '13
by meynier@users.chorem.org 14 Aug '13
14 Aug '13
Author: meynier
Date: 2013-08-14 14:14:58 +0200 (Wed, 14 Aug 2013)
New Revision: 383
Url: http://chorem.org/projects/chorem/repository/revisions/383
Log:
Updated model for the new page. Added ADC extension and a method in CHoremClient
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java
trunk/chorem-entities/src/main/xmi/chorem-model.properties
trunk/chorem-entities/src/main/xmi/chorem-model.zargo
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-08-09 10:06:59 UTC (rev 382)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-08-14 12:14:58 UTC (rev 383)
@@ -39,6 +39,7 @@
import org.chorem.entities.Quotation18Migration;
import org.chorem.entities.QuotationMigration;
import org.chorem.entities.Task;
+import org.chorem.entities.Time;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.wikitty.WikittyClient;
import org.nuiton.wikitty.WikittyService;
@@ -55,6 +56,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+
import org.parboiled.common.StringUtils;
/**
@@ -64,7 +66,7 @@
public class ChoremClient extends WikittyClient {
static protected Map<String, WikittyService> ws = new HashMap<String, WikittyService>();
-
+
protected ChoremClient(ApplicationConfig config, WikittyService ws) {
super(config, ws);
this.getMigrationRegistry().put(Invoice.EXT_INVOICE, new InvoiceMigration());
@@ -100,53 +102,53 @@
return result;
}
-// /**
-// * Returns new ChoremClient instance with specified security token
-// *
-// * @param token can be null, if no authorisation token already exist (no login done)
-// * @return
-// */
-// static public ChoremClient getClient(String token) {
-// ApplicationConfig config = ChoremConfig.getConfig();
-// WikittyService ws = getWikittyService(config);
-// ChoremClient result = new ChoremClient(config, ws);
-// result.setSecurityToken(token);
-//
-// return result;
-// }
-//
-// /**
-// * Return new ChoremClient instance with authentication done with login and
-// * password found in application configuration. If no login found
-// * ChoremClient returned doesn't have authentication.
-// *
-// * @return
-// */
-// static public ChoremClient getClient() {
-// ApplicationConfig config = ChoremConfig.getConfig();
-// String login = config.getOption(ChoremConfigOption.CHOREM_LOGIN.key);
-// String password = config.getOption(ChoremConfigOption.CHOREM_PASSWORD.key);
-//
-// ChoremClient result = getClient(login, password);
-//
-// return result;
-// }
-//
-// /**
-// * return new ChoremClient instance with authentication done with
-// * login and password in argument, only if login is not null and not blank
-// *
-// * @param login login used for authentication
-// * @param password password used for authentication
-// */
-// static public ChoremClient getClient(String login, String password) {
-// ChoremClient result = getClient(null);
-//
-// if (StringUtils.isNotBlank(login)) {
-// result.login(login, password);
-// }
-// return result;
-// }
+ // /**
+ // * Returns new ChoremClient instance with specified security token
+ // *
+ // * @param token can be null, if no authorisation token already exist (no login done)
+ // * @return
+ // */
+ // static public ChoremClient getClient(String token) {
+ // ApplicationConfig config = ChoremConfig.getConfig();
+ // WikittyService ws = getWikittyService(config);
+ // ChoremClient result = new ChoremClient(config, ws);
+ // result.setSecurityToken(token);
+ //
+ // return result;
+ // }
+ //
+ // /**
+ // * Return new ChoremClient instance with authentication done with login and
+ // * password found in application configuration. If no login found
+ // * ChoremClient returned doesn't have authentication.
+ // *
+ // * @return
+ // */
+ // static public ChoremClient getClient() {
+ // ApplicationConfig config = ChoremConfig.getConfig();
+ // String login = config.getOption(ChoremConfigOption.CHOREM_LOGIN.key);
+ // String password = config.getOption(ChoremConfigOption.CHOREM_PASSWORD.key);
+ //
+ // ChoremClient result = getClient(login, password);
+ //
+ // return result;
+ // }
+ //
+ // /**
+ // * return new ChoremClient instance with authentication done with
+ // * login and password in argument, only if login is not null and not blank
+ // *
+ // * @param login login used for authentication
+ // * @param password password used for authentication
+ // */
+ // static public ChoremClient getClient(String login, String password) {
+ // ChoremClient result = getClient(null);
+ //
+ // if (StringUtils.isNotBlank(login)) {
+ // result.login(login, password);
+ // }
+ // return result;
+ // }
/**
* Returns WikittyService to use. This WikittyService is singleton.
@@ -186,7 +188,7 @@
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);
@@ -207,39 +209,39 @@
exts.addAll(org.chorem.entities.VacationRequestAbstract.extensions);
exts.addAll(org.chorem.entities.WarrantyAbstract.extensions);
exts.addAll(org.chorem.entities.WorkerAbstract.extensions);
-
-
+
+
exts.addAll(org.nuiton.wikitty.entities.WikittyAuthorisationAbstract.extensions);
exts.addAll(org.nuiton.wikitty.entities.WikittyGroupAbstract.extensions);
exts.addAll(org.nuiton.wikitty.entities.WikittyHookAbstract.extensions);
exts.addAll(org.nuiton.wikitty.entities.WikittyLabelAbstract.extensions);
exts.addAll(org.nuiton.wikitty.entities.WikittyTreeNodeAbstract.extensions);
exts.addAll(org.nuiton.wikitty.entities.WikittyUserAbstract.extensions);
-
+
// Ajout de TAG value specifique au objet deja genere dans Wikitty
-//org.chorem.entities.WikittyTreeNode.attribute.name.tagvalue.help=Le nom pour cette catégorie (ex: dépense, Salaire, ...)
-//org.chorem.entities.WikittyTreeNode.attribute.attachment.tagvalue.visible=false
-//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
+ //org.chorem.entities.WikittyTreeNode.attribute.name.tagvalue.help=Le nom pour cette catégorie (ex: dépense, Salaire, ...)
+ //org.chorem.entities.WikittyTreeNode.attribute.attachment.tagvalue.visible=false
+ //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.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)");
e.getFieldType("parent").addTagValue("allowed", "Category");
-
+
result.storeExtension(null, exts);
ws.put(domain, result);
}
}
}
-
+
return result;
}
-
+
/**
* Returns the attachments linked with a wikitty id ordered by date
*
@@ -248,13 +250,13 @@
*/
public List<Attachment> getAttachments(String wikittyId) {
WikittyQuery criteria = new WikittyQueryMaker()
- .eq(Attachment.FQ_FIELD_ATTACHMENT_TARGET, wikittyId).end();
+ .eq(Attachment.FQ_FIELD_ATTACHMENT_TARGET, wikittyId).end();
WikittyQueryResult<Attachment> result =
findAllByQuery(Attachment.class, criteria);
List<Attachment> attachments = result.getAll();
return attachments;
}
-
+
/**
* Returns the contact details linked with a wikitty id
*
@@ -263,7 +265,7 @@
*/
public List<ContactDetails> getContactDetails(String wikittyId) {
WikittyQuery criteria = new WikittyQueryMaker()
- .eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, wikittyId).end();
+ .eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, wikittyId).end();
WikittyQueryResult<ContactDetails> result =
findAllByQuery(ContactDetails.class, criteria);
List<ContactDetails> contactDetails = result.getAll();
@@ -316,9 +318,9 @@
// on regarde si l'utilateur a une societe (au moins, on la prend au hasard :))
WikittyQuery q = new WikittyQueryMaker()
- .select(Employee.FQ_FIELD_EMPLOYEE_COMPANY)
- .eq(Employee.FQ_FIELD_EMPLOYEE_PERSON, user)
- .end();
+ .select(Employee.FQ_FIELD_EMPLOYEE_COMPANY)
+ .eq(Employee.FQ_FIELD_EMPLOYEE_PERSON, user)
+ .end();
companyId = findByQuery(q);
// on a toujours pas de societe, on utilise celle de la config de l'application
@@ -346,9 +348,9 @@
String userId = getUser().getWikittyId();
// on recupere toutes les companies pour lequel le user est salarie
WikittyQuery q = new WikittyQueryMaker()
- .select(Employee.FQ_FIELD_EMPLOYEE_COMPANY)
- .eq(Employee.FQ_FIELD_EMPLOYEE_PERSON, userId)
- .end();
+ .select(Employee.FQ_FIELD_EMPLOYEE_COMPANY)
+ .eq(Employee.FQ_FIELD_EMPLOYEE_PERSON, userId)
+ .end();
WikittyQueryResult<Company> result = findAllByQuery(Company.class, q);
return result.getAll();
}
@@ -369,77 +371,93 @@
return result;
}
+
+
+ /**
+ * Fetch the task from the given quotation
+ * Simple wikitty query
+ * @param q Quotation
+ * @return unmodifiable list of task from the quotation
+ */
+ public List<Task> getTasks(Quotation q) {
+ WikittyQuery taskQuery = new WikittyQueryMaker()
+ .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
+ .end();
+
+ taskQuery.addSortAscending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
+
+ WikittyQueryResult<Task> taskResult = findAllByQuery(Task.class, taskQuery);
+ return taskResult.getAll();
+ }
+ /**
+ * Fetch the times from the given task
+ * @param t Task
+ * @return unmodifiable list of times from the task
+ */
+ public List<Time> getTimes(Task t) {
+ //Fetch the time objects from the task
+ WikittyQuery timeQuery = new WikittyQueryMaker()
+ .eq(Time.ELEMENT_FIELD_TIME_TASK, t)
+ .end();
+
+ timeQuery.addSortAscending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
+
+ WikittyQueryResult<Time> timeResult = findAllByQuery(Time.class, timeQuery);
+
+ return timeResult.getAll();
+ }
+ /**
+ * Returns the daily return of the given empoyee
+ * @param e
+ * @return
+ */
+ public double getDailyReturn(Employee e) {
- /**
- * Fetch the task from the given quotation
- * Simple wikitty query
- * @param q Quotation
- * @param client chorem client
- * @return unmodifiable list of task from the quotation
- */
- public List<Task> getTasks(Quotation q) {
- WikittyQuery taskQuery = new WikittyQueryMaker()
- .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
- .end();
-
- taskQuery.addSortAscending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
+ Wikitty w = this.restore(e.getWikittyId());
+ Wikitty companyW = null;
+ if(e.getCompany(false) != null)
+ companyW = restore(e.getCompany(false).getWikittyId());
- WikittyQueryResult<Task> taskResult = findAllByQuery(Task.class, taskQuery);
- return taskResult.getAll();
- }
-
- /**
- * Returns the daily return of the given empoyee
- * @param e
- * @return
- */
- public double getDailyReturn(Employee e) {
-
- Wikitty w = this.restore(e.getWikittyId());
- Wikitty companyW = null;
- if(e.getCompany(false) != null)
- companyW = restore(e.getCompany(false).getWikittyId());
-
- if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR) &&
- w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN) != 0) {
- return w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
- }
- else if(companyW != null && companyW.hasExtension(CompanyHR.EXT_COMPANYHR)
- && companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN) != 0) {
- return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
- }
- else {
- return this.getConfiguration().getDailyReturn();
- }
- }
- /**
- * Returns the daily hours worked of the given empoyee
- * @param e
- * @return
- */
- public double getDailyHoursWorked(Employee e) {
-
- Wikitty w = this.restore(e.getWikittyId());
- Wikitty companyW = null;
- if(e.getCompany(false) != null)
- companyW = restore(e.getCompany(false).getWikittyId());
-
- if(companyW.hasExtension(CompanyHR.EXT_COMPANYHR) &&
- companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR,CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) != 0) {
- if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR) && w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME) != 0) {
- return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) *
- (w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME)/100);
- }
- else {
- return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED);
- }
-
- }
- else {
- return this.getConfiguration().getDailyHoursWorked();
- }
- }
-
-
+ if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR) &&
+ w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN) != 0) {
+ return w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
+ }
+ else if(companyW != null && companyW.hasExtension(CompanyHR.EXT_COMPANYHR)
+ && companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN) != 0) {
+ return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, EmployeeHR.FIELD_EMPLOYEEHR_DAILYRETURN);
+ }
+ else {
+ return this.getConfiguration().getDailyReturn();
+ }
+ }
+ /**
+ * Returns the daily hours worked of the given empoyee
+ * @param e
+ * @return
+ */
+ public double getDailyHoursWorked(Employee e) {
+
+ Wikitty w = this.restore(e.getWikittyId());
+ Wikitty companyW = null;
+ if(e.getCompany(false) != null)
+ companyW = restore(e.getCompany(false).getWikittyId());
+
+ if(companyW.hasExtension(CompanyHR.EXT_COMPANYHR) &&
+ companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR,CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) != 0) {
+ if(w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR) && w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME) != 0) {
+ return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED) *
+ (w.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PARTIALTIME)/100);
+ }
+ else {
+ return companyW.getFieldAsDouble(CompanyHR.EXT_COMPANYHR, CompanyHR.FIELD_COMPANYHR_DAILYHOURSWORKED);
+ }
+
+ }
+ else {
+ return this.getConfiguration().getDailyHoursWorked();
+ }
+ }
+
+
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-09 10:06:59 UTC (rev 382)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-14 12:14:58 UTC (rev 383)
@@ -5,6 +5,7 @@
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.chorem.ChoremClient;
import org.chorem.ChoremUtil;
@@ -12,168 +13,305 @@
import org.chorem.entities.EmployeeHR;
import org.chorem.entities.FinancialTransaction;
import org.chorem.entities.Interval;
-import org.chorem.entities.Quotation;
import org.chorem.entities.Time;
import org.chorem.entities.Company;
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
-import com.arjuna.ats.jta.transaction.Transaction;
public class AdcCalculation {
-
- /**
- * Calculates the total gains made by the company in one year
- * @return
- */
- public static double getTotalExpenses(ChoremClient client, Company company, Date start, Date end) {
-
- WikittyQuery expenseQuery = new WikittyQueryMaker()
- .and()
- .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION)
- .or()
- .containsOne(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_PAYER, getEmployeesHR(client, company))
- .eq(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_PAYER, company)
- .close()
- .bw(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end)
- .end();
-
- WikittyQueryResult<FinancialTransaction> result = client.findAllByQuery(FinancialTransaction.class, expenseQuery);
-
- double total = 0;
- for(FinancialTransaction ft : result.getAll()) {
- total += ft.getAmount();
- }
-
- return total;
- }
-
-
-
- /**
- * calculates all the salaries of the employees ponderated by the productivity rate
- * @return
- */
- public static double getTotalSalaries(ChoremClient client, Company company) {
- //pondéré par pct de productivité
-
-
- double total = 0;
- for(EmployeeHR e : getEmployeesHR(client, company)) {
- total += e.getSalary() * (e.getProductivityRate()/100);
- }
- return total;
- }
-
- private static List<EmployeeHR> getEmployeesHR(ChoremClient client, Company company) {
- WikittyQuery employeeQuery = new WikittyQueryMaker().and()
- .exteq(EmployeeHR.EXT_EMPLOYEEHR)
- .eq(Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company)
- .end();
- WikittyQueryResult<EmployeeHR> result = client.findAllByQuery(EmployeeHR.class, employeeQuery);
- return result.getAll();
-
- }
-
- /**
- * Calculates the sum of all the times object linked to the company
- * @return
- */
- public static double getTotalTimes(ChoremClient client, Company company, Date start, Date end) {
- WikittyQuery empQuery = new WikittyQueryMaker()
- .eq(Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company).end();
- WikittyQueryResult<Employee> empResult = client.findAllByQuery(Employee.class, empQuery);
-
- WikittyQuery timeQuery = new WikittyQueryMaker()
- .and()
- .exteq(Time.EXT_TIME)
- .containsOne(Time.ELEMENT_FIELD_TIME_EMPLOYEE, empResult.getAll())
- .or()
- .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, start, end)
- .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, start, end)
- .end();
- WikittyQueryResult<Time> result = client.findAllByQuery(Time.class, timeQuery);
+ protected ChoremClient client;
+ protected Company company;
+ protected EmployeeHR employee;
+ protected List<EmployeeHR> employees;
+
+ protected Date start;
+ protected Date end;
+
+ public AdcCalculation(ChoremClient client, EmployeeHR employee) {
+ this.employee = employee;
+ this.company = employee.getCompany(false);
+ this.client = client;
+ this.employees = null;
+ initDate();
+ }
+
+ public AdcCalculation(ChoremClient client, List<EmployeeHR> employees) {
+ this.employees = employees;
+ this.company = employees.get(0).getCompany(false);
+ this.client = client;
+ this.employee = null;
+ initDate();
+ }
+
+ private void initDate() {
+ Calendar cend = new GregorianCalendar();
+ cend.add(Calendar.YEAR, -1);
+ cend.set(Calendar.MONTH, Calendar.DECEMBER);
+ cend.set(Calendar.DAY_OF_MONTH, 31);
+
+ Calendar cstart = new GregorianCalendar();
+ cstart.add(Calendar.YEAR, -1);
+ cstart.set(Calendar.MONTH, Calendar.JANUARY);
+ cstart.set(Calendar.DAY_OF_MONTH, 1);
+
+ start = cstart.getTime();
+ end = cend.getTime();
+ }
+
+
+ /**
+ * Calculates the total gains made by the company in one year
+ * @return
+ */
+ public double getTotalExpenses() {
- double total = 0;
- for(Time t : result.getAll()) {
- total += ChoremUtil.getPeriodInHours(t.getBeginDate(), t.getEndDate());
- }
+ //Construct the query
+ //TODO : Use wikitty function for sum.
+ WikittyQuery expenseQuery = new WikittyQueryMaker()
+ .and()
+ .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) //of type financial transaction
+ .or()
+ //The payer is an employee of the company or the company itself
+ .containsOne(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_PAYER, getEmployeesHR())
+ .eq(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_PAYER, company)
+ .close()
+ //The payment hapened during the year
+ .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end)
+ .end();
- return total;
- }
-
- /**
- * Returns the employee's adc
- * @return
- */
- public static double getAdc(ChoremClient client, EmployeeHR e) {
- Company company = e.getCompany(false);
- Date end = new GregorianCalendar().getTime();
- Calendar cstart = new GregorianCalendar();
- cstart.add(Calendar.YEAR, -1);
- Date start = cstart.getTime();
-
- double expenses = getTotalExpenses(client, company, start, end);
- double salaries = getTotalSalaries(client, company);
- double times = getTotalTimes(client, company, start, end);
-
- double dailyHoursWorked = client.getDailyHoursWorked(e);
- double dailySalary = client.restore(e.getWikittyId())
- .getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR,EmployeeHR.FIELD_EMPLOYEEHR_SALARY)/21.5;
-
- System.out.println("EXPENSES : " + expenses);
- System.out.println("SALARIES : " + salaries);
- System.out.println("TIMES : " + times);
- System.out.println("DHW : " + dailyHoursWorked);
- System.out.println("SALARY : " + dailySalary);
-
-
- double adc = ( (expenses/salaries)/times ) * dailyHoursWorked * dailySalary;
- //dailySalary = dailySalary *1.6; //charges patronales
- //double adc = dailySalary;
-
- return adc;
- }
-
- public static HashMap<String, Double> getMultipleAdc(ChoremClient client, List<EmployeeHR> employees) {
+ WikittyQueryResult<FinancialTransaction> result = client.findAllByQuery(FinancialTransaction.class, expenseQuery);
+
+ //Calculates the total
+ double total = 0;
+ for(FinancialTransaction ft : result.getAll()) {
+ total += ft.getAmount();
+ }
+
+ return total;
+ }
+
+ /**
+ * Calculates the employee cost at full time
+ * @return
+ */
+ public double getMonthlyFullTimeCost(EmployeeHR e) {
+ double salary = e.getSalary();
+ double otherPayments = e.getOtherPayments();
+ double partialTime = e.getPartialTime();
+
+ return ( ( salary + otherPayments) * (partialTime/100) );
+ }
+
+
+ /**
+ * calculates the estimated number of prodctive days when the employee will work
+ * @return
+ */
+ public double getEstimatedNumberOfProductiveDays(EmployeeHR e) {
+ int daysInYear = 218; //It would be *much* better to calculate this or at least get it from input
+ double partialTime = e.getPartialTime();
+ double productivityRate = e.getProductivityRate();
+
+ return (daysInYear * (partialTime/100) * (productivityRate/100));
+ }
+
+ public double getRealNumberOfProductiveDays(EmployeeHR e) {
+
+ //fetch the times of all the employees of the company that have worked between $start an $end
+ WikittyQuery timeQuery = new WikittyQueryMaker()
+ .and()
+ .exteq(Time.EXT_TIME)
+ .eq(Time.ELEMENT_FIELD_TIME_EMPLOYEE, e)
+ .or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, start, end)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, start, end)
+ .end();
+ WikittyQueryResult<Time> result = client.findAllByQuery(Time.class, timeQuery);
+
+ //Calculates the total
+ double total = 0;
+ for(Time t : result.getAll()) {
+ total += ChoremUtil.getPeriodInHours(t.getBeginDate(), t.getEndDate());
+
+ }
+
+ return (total/ client.getDailyHoursWorked(e) )
+ * (e.getProductivityRate()/100);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public double getYearCost(EmployeeHR e, boolean real) {
+ double result = 0;
+ if(real) {
+ result = getMonthlyFullTimeCost(e) * getRealNumberOfProductiveDays(e);
+ }
+ else {
+ result = getMonthlyFullTimeCost(e) * getEstimatedNumberOfProductiveDays(e);
+ }
+ return result;
+ }
+
+ public double getTotalYearCost(boolean real) {
+
+ double total = 0;
+ for(EmployeeHR e : getEmployeesHR()) {
+ total += getYearCost(e, real);
+ }
+ return total;
+ }
+
+
+
+ /**
+ * Get all the employees of the company having the EmployeeHR extension
+ * @param client
+ * @param company
+ * @return
+ */
+ protected List<EmployeeHR> getEmployeesHR() {
+
+ WikittyQuery employeeQuery = new WikittyQueryMaker().and()
+ .exteq(EmployeeHR.EXT_EMPLOYEEHR)
+ .eq(Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company)
+ .end();
+ WikittyQueryResult<EmployeeHR> result = client.findAllByQuery(EmployeeHR.class, employeeQuery);
+ return result.getAll();
+
+ }
+
+ /**
+ * Calculates the sum of all the times object linked to the company
+ * @return
+ */
+ public double getTotalTimes() {
+
+ WikittyQuery empQuery = new WikittyQueryMaker()
+ .eq(Employee.ELEMENT_FIELD_EMPLOYEE_COMPANY, company).end();
+ WikittyQueryResult<Employee> empResult = client.findAllByQuery(Employee.class, empQuery);
+
+ //fetch the times of all the employees of the company that have worked between $start an $end
+ WikittyQuery timeQuery = new WikittyQueryMaker()
+ .and()
+ .exteq(Time.EXT_TIME)
+ .containsOne(Time.ELEMENT_FIELD_TIME_EMPLOYEE, empResult.getAll())
+ .or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, start, end)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, start, end)
+ .end();
+ WikittyQueryResult<Time> result = client.findAllByQuery(Time.class, timeQuery);
+
+ //Calculates the total
+ double total = 0;
+ for(Time t : result.getAll()) {
+ total += ChoremUtil.getPeriodInHours(t.getBeginDate(), t.getEndDate());
+ }
+
+ return total;
+ }
+
+ /**
+ * Returns the employee's adc
+ * @return
+ */
+ public double getAdc(boolean real) {
+
+
+ double expenses = getTotalExpenses();
+ double productiveDays = 0;
+ if(real) {
+ productiveDays = getRealNumberOfProductiveDays(employee);
+ }
+ else {
+ productiveDays = getEstimatedNumberOfProductiveDays(employee);
+ }
+
+ double cost = getYearCost(employee, real);
+ double totalCost = getTotalYearCost(real);
+
+ System.out.println("EXPENSES : " + expenses);
+ System.out.println("PROD DAYS : " + productiveDays);
+ System.out.println("COST : " + expenses);
+ System.out.println("TOTAL COST : " + expenses);
+
+ double adc = ( (expenses * cost) / totalCost ) / productiveDays;
+
+
+ return adc;
+ }
+
+ public double getAdc() {
+ return getAdc(false);
+ }
+ public Map<String, Double> getMultipleAdc() {
+ return getMultipleAdc(false);
+ }
+
+ /**
+ * Returns multiple adc form the given employee list.
+ * @param client
+ * @param employees
+ * @return
+ */
+ public Map<String, Double> getMultipleAdc(boolean real) {
if(employees.size() == 0)
return null;
- Company company = employees.get(0).getCompany(false);
- Date end = new GregorianCalendar().getTime();
- Calendar cstart = new GregorianCalendar();
- cstart.add(Calendar.YEAR, -1);
- Date start = cstart.getTime();
- double expenses = getTotalExpenses(client, company, start, end);
- double salaries = getTotalSalaries(client, company);
- double times = getTotalTimes(client, company, start, end);
-
+ Calendar cend = new GregorianCalendar();
+ cend.add(Calendar.YEAR, -1);
+ cend.set(Calendar.MONTH, Calendar.DECEMBER);
+ cend.set(Calendar.DAY_OF_MONTH, 31);
+
+ Calendar cstart = new GregorianCalendar();
+ cstart.add(Calendar.YEAR, -1);
+ cstart.set(Calendar.MONTH, Calendar.JANUARY);
+ cstart.set(Calendar.DAY_OF_MONTH, 1);
+
+ Date start = cstart.getTime();
+ Date end = cend.getTime();
+
+ //Calculate all the "static" values before
+
+ double expenses = getTotalExpenses();
+
+ double totalCost = getTotalYearCost(real);
+
+ //Then, for each employee
+
HashMap<String, Double> adcs = new HashMap<String, Double>();
for(EmployeeHR e : employees) {
- double dailyHoursWorked = client.getDailyHoursWorked(e);
- double dailySalary = client.restore(e.getWikittyId())
- .getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_SALARY)/21.5;
- System.out.println("EXPENSES : " + expenses);
- System.out.println("SALAIRES : " + salaries);
- System.out.println("TIMES : " + times);
- System.out.println("DAILY HW : " + dailyHoursWorked);
- System.out.println("DAILY SALARY : " + dailySalary);
- adcs.put(e.getWikittyId(),( (expenses/salaries)/times ) * dailyHoursWorked * dailySalary);
+ this.employee = e;
+
+ double productiveDays = 0;
+ if(real) {
+ productiveDays = getRealNumberOfProductiveDays(e);
+ }
+ else {
+ productiveDays = getEstimatedNumberOfProductiveDays(e);
+ }
+ double cost = getYearCost(e, real);
+
+ Double adc = ( ( (expenses * cost) / totalCost ) / productiveDays);
+ if(adc.isNaN()) {
+ adc = 0.0;
+ }
+ adcs.put(e.getWikittyId(),adc);
}
- //dailySalary = dailySalary *1.6; //charges patronales
- //double adc = dailySalary;
-
+
return adcs;
-
- }
-
-
-
-
-
-
+ }
+
+
+
+
+
+
+
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java 2013-08-09 10:06:59 UTC (rev 382)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java 2013-08-14 12:14:58 UTC (rev 383)
@@ -15,249 +15,249 @@
*/
public abstract class Calculation<T> {
- /**Main object (Task or Quotation)*/
- protected T e;
- /** Chorme client */
- protected ChoremClient client;
- /** Total price of the object */
- protected double amount;
- /** Estimated number of days */
- protected double nbDays;
+ /**Main object (Task or Quotation)*/
+ protected T e;
+ /** Chorme client */
+ protected ChoremClient client;
+ /** Total price of the object */
+ protected double amount;
+ /** Estimated number of days */
+ protected double nbDays;
- protected static final int SEC_PER_HOUR = 3600;
- protected static final int WORKING_HOURS_PER_DAY = 7;
- /* Seuil de rentabilite productif */
+ protected static final int SEC_PER_HOUR = 3600;
+ protected static final int WORKING_HOURS_PER_DAY = 7;
+ /* Seuil de rentabilite productif */
- //attributes to store the calculations
- private Double adr = null;
- private Double realDays = null;
- private Double deltaDays = null;
- private Double realAdr = null;
- private Double expectedProfit = null;
- private Double lossOrProfit = null;
- private Double resultPerDay = null;
- private Double avgReturn = null;
- private Double realReturn = null;
+ //attributes to store the calculations
+ private Double adr = null;
+ private Double realDays = null;
+ private Double deltaDays = null;
+ private Double realAdr = null;
+ private Double expectedProfit = null;
+ private Double lossOrProfit = null;
+ private Double resultPerDay = null;
+ private Double avgReturn = null;
+ private Double realReturn = null;
- /**
- *
- * @param e Element that will serve for the calculations
- * @param amount Amount of this element
- * @param nbDays Estimated number of days for this element
- * @param client Instance of ChoremClient
- */
- public Calculation(T e, double amount, double nbDays, ChoremClient client) {
- this.e = e;
- this.client = client;
- this.amount = amount;
- this.nbDays = nbDays;
- }
+ /**
+ *
+ * @param e Element that will serve for the calculations
+ * @param amount Amount of this element
+ * @param nbDays Estimated number of days for this element
+ * @param client Instance of ChoremClient
+ */
+ public Calculation(T e, double amount, double nbDays, ChoremClient client) {
+ this.e = e;
+ this.client = client;
+ this.amount = amount;
+ this.nbDays = nbDays;
+ }
- /**
- * Makes all the calcuations and store them into the attributes
- */
- public void calculate() {
+ /**
+ * Makes all the calcuations and store them into the attributes
+ */
+ public void calculate() {
- this.adr = adr();
- this.realDays = realDays();
- this.deltaDays = deltaDays();
- this.realAdr = realAdr();
- this.expectedProfit = expectedProfit();
- this.lossOrProfit = lossOrProfit();
- this.resultPerDay = resultPerDay();
- this.avgReturn = avgReturn();
- this.realReturn = realReturn();
- }
-
- /**
- * Calculates the real number of days from the Time objects.
- * @return
- */
- public abstract double realDays();
-
-
- /**
- * Return the times (in hour) per employee for the current object
- * @return
- */
- protected abstract HashMap<Employee, Double> getTimes();
-
- /**
- * Return the percentages for the current object
- * @return
- */
- protected abstract HashMap<Employee, Double> getPercentages();
-
- public HashMap<Employee, Double> getTimePercentages() {
- HashMap<Employee, Double> times = getTimes();
- HashMap<Employee, Double> timePercentages = new HashMap<Employee, Double>();
- double sum = 0;
- Set<Employee> keySet = times.keySet();
- for (Employee key : keySet) {
- sum+= times.get(key);
- }
- for (Employee key : keySet) {
- timePercentages.put(key, (times.get(key)/sum)*100);
- }
-
-
- return timePercentages;
- }
- /**
- * Return the average Return for all the employees, ponderated by the percentages
- * @return
- */
- public double avgReturn() {
-
- //Fetch the percentages per employee
- HashMap<Employee, Double> percentages = getPercentages();
- if(percentages.size() == 0) {
- return client.getConfiguration().getDailyReturn();
- }
- Set<Employee> keySet = percentages.keySet();
- double avgReturn = 0;
- for(Employee key : keySet) {
- avgReturn += client.getDailyReturn(key)*(percentages.get(key)/100);
- }
-
- return avgReturn;
- }
-
- /**
- * Calculates the real daily return from the different times object and the daily return of the employees.
- * @return
- */
- public double realReturn() {
- HashMap<Employee, Double> times = getTimes();
- if(times.size() == 0) {
- return client.getConfiguration().getDailyReturn();
- }
- double realReturn = 0;
- Set<Employee> keySet = times.keySet();
- for(Employee key : keySet) {
- double srp = client.getDailyReturn(key);
- double hoursPerDay = client.getDailyHoursWorked(key);
-
- //TODO :Find a way to use the different work hours
-
- //}
- realReturn += srp* ( times.get(key) / hoursPerDay ) ;
- }
- realReturn = realReturn/getRealDays();
-
- return realReturn;
- }
-
- /**
- * Returns the average daily rate, which is the amount divided by the estimated number of days.
- * @return the ADR
- */
- public double adr() {
- return amount/nbDays;
- }
+ this.adr = adr();
+ this.realDays = realDays();
+ this.deltaDays = deltaDays();
+ this.realAdr = realAdr();
+ this.expectedProfit = expectedProfit();
+ this.lossOrProfit = lossOrProfit();
+ this.resultPerDay = resultPerDay();
+ this.avgReturn = avgReturn();
+ this.realReturn = realReturn();
+ }
-
+ /**
+ * Calculates the real number of days from the Time objects.
+ * @return
+ */
+ public abstract double realDays();
- /**
- * Gives the difference between the real number of days and the estimated value
- * @return
- */
- public double deltaDays() {
- return getRealDays() - nbDays;
- }
- /**
- * Calculates the real ADR from the real number of days.
- * @return
- */
- public double realAdr() {
- double realDays = getRealDays();
+ /**
+ * Return the times (in hour) per employee for the current object
+ * @return
+ */
+ protected abstract HashMap<Employee, Double> getTimes();
- return amount/realDays;
- }
+ /**
+ * Return the percentages for the current object
+ * @return
+ */
+ protected abstract HashMap<Employee, Double> getPercentages();
- /**
- * Profit calculated from the estimated ADR and the estimated numer of days
- * @return
- */
- public double expectedProfit() {
- return amount - (nbDays*getAvgReturn());
- }
+ public HashMap<Employee, Double> getTimePercentages() {
+ HashMap<Employee, Double> times = getTimes();
+ HashMap<Employee, Double> timePercentages = new HashMap<Employee, Double>();
+ double sum = 0;
+ Set<Employee> keySet = times.keySet();
+ for (Employee key : keySet) {
+ sum+= times.get(key);
+ }
+ for (Employee key : keySet) {
+ timePercentages.put(key, (times.get(key)/sum)*100);
+ }
- /**
- * Real profit (or loss) done when the quotation is closed.
- * @return
- */
- public double lossOrProfit() {
- return amount - (getRealDays() * getRealReturn());
- }
- /**
- * Average profit/loss per day
- * @return
- */
- public double resultPerDay() {
- return getLossOrProfit() / getRealDays();
- }
-
-
-
- /* ##########################################################################################
- * ######################### GETTERS #######################################################
- * ##########################################################################################
- *
- * The getters returns the attributes if it has been calculated and calculates directly the value otherwise
- */
+ return timePercentages;
+ }
+ /**
+ * Return the average Return for all the employees, ponderated by the percentages
+ * @return
+ */
+ public double avgReturn() {
- public double getAdr() {
- if(adr == null)
- adr = adr();
- return adr;
- }
- public double getRealDays() {
- if(realDays == null)
- realDays = realDays();
- return realDays;
- }
- public double getDeltaDays() {
- if(deltaDays == null)
- deltaDays = deltaDays();
- return deltaDays;
- }
- public double getRealAdr() {
- if(realAdr == null)
- realAdr = realAdr();
- return realAdr;
- }
- public double getExpectedProfit() {
- if(expectedProfit == null)
- expectedProfit = expectedProfit();
- return expectedProfit;
- }
- public double getLossOrProfit() {
- if(lossOrProfit == null)
- lossOrProfit = lossOrProfit();
- return lossOrProfit;
- }
- public double getResultPerDay() {
- if(resultPerDay == null)
- resultPerDay = resultPerDay();
- return resultPerDay;
- }
-
- public double getAvgReturn() {
- if(avgReturn == null)
- avgReturn = avgReturn();
- return avgReturn;
- }
- public double getRealReturn() {
- if(realReturn == null)
- realReturn = realReturn();
- return realReturn;
- }
-
- public T getObject() {
- return e;
- }
+ //Fetch the percentages per employee
+ HashMap<Employee, Double> percentages = getPercentages();
+ if(percentages.size() == 0) {
+ return client.getConfiguration().getDailyReturn();
+ }
+ Set<Employee> keySet = percentages.keySet();
+ double avgReturn = 0;
+ for(Employee key : keySet) {
+ avgReturn += client.getDailyReturn(key)*(percentages.get(key)/100);
+ }
+
+ return avgReturn;
+ }
+
+ /**
+ * Calculates the real daily return from the different times object and the daily return of the employees.
+ * @return
+ */
+ public double realReturn() {
+ HashMap<Employee, Double> times = getTimes();
+ if(times.size() == 0) {
+ return client.getConfiguration().getDailyReturn();
+ }
+ double realReturn = 0;
+ Set<Employee> keySet = times.keySet();
+ for(Employee key : keySet) {
+ double srp = client.getDailyReturn(key);
+ double hoursPerDay = client.getDailyHoursWorked(key);
+
+ //TODO :Find a way to use the different work hours
+
+ //}
+ realReturn += srp* ( times.get(key) / hoursPerDay ) ;
+ }
+ realReturn = realReturn/getRealDays();
+
+ return realReturn;
+ }
+
+ /**
+ * Returns the average daily rate, which is the amount divided by the estimated number of days.
+ * @return the ADR
+ */
+ public double adr() {
+ return amount/nbDays;
+ }
+
+
+
+ /**
+ * Gives the difference between the real number of days and the estimated value
+ * @return
+ */
+ public double deltaDays() {
+ return getRealDays() - nbDays;
+ }
+
+ /**
+ * Calculates the real ADR from the real number of days.
+ * @return
+ */
+ public double realAdr() {
+ double realDays = getRealDays();
+
+ return amount/realDays;
+ }
+
+ /**
+ * Profit calculated from the estimated ADR and the estimated numer of days
+ * @return
+ */
+ public double expectedProfit() {
+ return amount - (nbDays*getAvgReturn());
+ }
+
+ /**
+ * Real profit (or loss) done when the quotation is closed.
+ * @return
+ */
+ public double lossOrProfit() {
+ return amount - (getRealDays() * getRealReturn());
+ }
+
+ /**
+ * Average profit/loss per day
+ * @return
+ */
+ public double resultPerDay() {
+ return getLossOrProfit() / getRealDays();
+ }
+
+
+
+ /* ##########################################################################################
+ * ######################### GETTERS #######################################################
+ * ##########################################################################################
+ *
+ * The getters returns the attributes if it has been calculated and calculates directly the value otherwise
+ */
+
+ public double getAdr() {
+ if(adr == null)
+ adr = adr();
+ return adr;
+ }
+ public double getRealDays() {
+ if(realDays == null)
+ realDays = realDays();
+ return realDays;
+ }
+ public double getDeltaDays() {
+ if(deltaDays == null)
+ deltaDays = deltaDays();
+ return deltaDays;
+ }
+ public double getRealAdr() {
+ if(realAdr == null)
+ realAdr = realAdr();
+ return realAdr;
+ }
+ public double getExpectedProfit() {
+ if(expectedProfit == null)
+ expectedProfit = expectedProfit();
+ return expectedProfit;
+ }
+ public double getLossOrProfit() {
+ if(lossOrProfit == null)
+ lossOrProfit = lossOrProfit();
+ return lossOrProfit;
+ }
+ public double getResultPerDay() {
+ if(resultPerDay == null)
+ resultPerDay = resultPerDay();
+ return resultPerDay;
+ }
+
+ public double getAvgReturn() {
+ if(avgReturn == null)
+ avgReturn = avgReturn();
+ return avgReturn;
+ }
+ public double getRealReturn() {
+ if(realReturn == null)
+ realReturn = realReturn();
+ return realReturn;
+ }
+
+ public T getObject() {
+ return e;
+ }
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java 2013-08-09 10:06:59 UTC (rev 382)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java 2013-08-14 12:14:58 UTC (rev 383)
@@ -75,13 +75,9 @@
protected HashMap<Employee, Double> getTimes() {
HashMap<Employee, Double> times = new HashMap<Employee, Double>();
- //Feth the time objects from the task
- WikittyQuery timeQuery = new WikittyQueryMaker()
- .eq(Time.ELEMENT_FIELD_TIME_TASK, e)
- .end();
- WikittyQueryResult<Time> timeResult = client.findAllByQuery(Time.class, timeQuery);
- for(Time t : timeResult.getAll()) {
+
+ for(Time t : client.getTimes(e)) {
Employee emp = t.getEmployee(false);
if(emp != null) {
if(times.containsKey(emp)) {
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2013-08-09 10:06:59 UTC (rev 382)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2013-08-14 12:14:58 UTC (rev 383)
@@ -34,7 +34,15 @@
org.chorem.entities.Attachment.attribute.mimetype.tagvalue.choiceQuery=SELECT Attachment.mimetype WHERE extension=Attachment
org.chorem.entities.Attachment.attribute.content.tagvalue.help=Le fichier \u00e0 importer
org.chorem.entities.Attachment.attribute.contentUrl.tagvalue.help=Si on ne souhaite pas importer le fichier, on peut indiquer ici sont URL (ex: http://commun.codelutin.home/Clients/...)
+
#
+# ADC
+#
+org.chorem.entities.ADC.class.tagvalue.version=1.0
+org.chorem.entities.Cancelled.class.tagvalue.toString=%ADC.employeeHR|noemployee%s %ADC.year|noyear%s %ADC.value|novalue$s
+
+
+#
# Cancelled
#
org.chorem.entities.Cancelled.class.tagvalue.version=1.0
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.zargo
===================================================================
(Binary files differ)
1
0
09 Aug '13
Author: tchemit
Date: 2013-08-09 12:06:59 +0200 (Fri, 09 Aug 2013)
New Revision: 382
Url: http://chorem.org/projects/chorem/repository/revisions/382
Log:
- updates mavenpom to 4.0
- reformat poms
Modified:
trunk/chorem-entities/pom.xml
trunk/chorem-webmotion/pom.xml
trunk/pom.xml
Modified: trunk/chorem-entities/pom.xml
===================================================================
--- trunk/chorem-entities/pom.xml 2013-08-07 13:35:46 UTC (rev 381)
+++ trunk/chorem-entities/pom.xml 2013-08-09 10:06:59 UTC (rev 382)
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.chorem</groupId>
<artifactId>chorem</artifactId>
@@ -16,7 +11,7 @@
<groupId>org.chorem.chorem</groupId>
<artifactId>chorem-entities</artifactId>
- <name>Chorem entities</name>
+ <name>Chorem :: entities</name>
<description>Chorem entities</description>
<dependencies>
@@ -119,7 +114,6 @@
<filtering>true</filtering>
</resource>
</resources>-->
-
<plugins>
<plugin>
<groupId>org.nuiton.eugene</groupId>
@@ -160,4 +154,5 @@
</plugins>
</build>
+
</project>
Modified: trunk/chorem-webmotion/pom.xml
===================================================================
--- trunk/chorem-webmotion/pom.xml 2013-08-07 13:35:46 UTC (rev 381)
+++ trunk/chorem-webmotion/pom.xml 2013-08-09 10:06:59 UTC (rev 382)
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.chorem</groupId>
<artifactId>chorem</artifactId>
@@ -15,12 +10,11 @@
<groupId>org.chorem.chorem</groupId>
<artifactId>chorem-webmotion</artifactId>
+ <packaging>war</packaging>
- <name>Chorem webmotion</name>
+ <name>Chorem :: webmotion</name>
<description>Chorem webmotion</description>
- <packaging>war</packaging>
-
<properties>
<i18n.bundleOutputName>chorem-i18n</i18n.bundleOutputName>
<i18n.bundleOutputDir>${basedir}/target/generated-sources/resources
@@ -35,6 +29,9 @@
target/${project.build.finalName}.war,
</redmine.releaseFiles>
+ <!-- Post Release configuration -->
+ <skipPostRelease>false</skipPostRelease>
+
</properties>
<dependencies>
@@ -195,7 +192,41 @@
<filtering>true</filtering>
</resource>
</resources>-->
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <configuration>
+ <stopKey>A</stopKey>
+ <stopPort>1269</stopPort>
+ <!--<contextXml>${basedir}/src/jetty/jetty-context.xml</contextXml>-->
+ <webAppConfig>
+ <contextPath>/chorem</contextPath>
+ </webAppConfig>
+ <systemProperties>
+ <systemProperty>
+ <name>chorem.log.dir</name>
+ <value>${basedir}/target</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <configuration>
+ <path>/chorem</path>
+ <uriEncoding>UTF-8</uriEncoding>
+ <systemProperties>
+ <chorem.log.dir>${basedir}/target</chorem.log.dir>
+ </systemProperties>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
<plugins>
<!-- processor plugin -->
<plugin>
@@ -258,55 +289,6 @@
</executions>
</plugin>
</plugins>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <configuration>
- <stopKey>A</stopKey>
- <stopPort>1269</stopPort>
- <!--<contextXml>${basedir}/src/jetty/jetty-context.xml</contextXml>-->
- <webAppConfig>
- <contextPath>/chorem</contextPath>
- </webAppConfig>
- <systemProperties>
- <systemProperty>
- <name>chorem.log.dir</name>
- <value>${basedir}/target</value>
- </systemProperty>
- </systemProperties>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <configuration>
- <path>/chorem</path>
- <uriEncoding>UTF-8</uriEncoding>
- <systemProperties>
- <chorem.log.dir>${basedir}/target</chorem.log.dir>
- </systemProperties>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat6-maven-plugin</artifactId>
- <configuration>
- <path>/chorem</path>
- <uriEncoding>UTF-8</uriEncoding>
- <systemProperties>
- <chorem.log.dir>${basedir}/target</chorem.log.dir>
- </systemProperties>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
-
</build>
-
</project>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-08-07 13:35:46 UTC (rev 381)
+++ trunk/pom.xml 2013-08-09 10:06:59 UTC (rev 382)
@@ -1,34 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.4.11</version>
+ <version>4.0</version>
</parent>
<groupId>org.chorem</groupId>
<artifactId>chorem</artifactId>
<version>0.3-SNAPSHOT</version>
+ <packaging>pom</packaging>
- <modules>
- <module>chorem-entities</module>
- <module>chorem-webmotion</module>
- </modules>
-
- <name>chorem</name>
+ <name>Chorem</name>
<description>Project management</description>
- <inceptionYear>2011</inceptionYear>
-
<url>http://maven-site.chorem.org/chorem</url>
- <packaging>pom</packaging>
-
+ <inceptionYear>2011</inceptionYear>
<licenses>
<license>
<name>GNU Affero General Public License version 3</name>
@@ -73,6 +61,11 @@
</developer>
</developers>
+ <modules>
+ <module>chorem-entities</module>
+ <module>chorem-webmotion</module>
+ </modules>
+
<scm>
<connection>scm:svn:http://svn.chorem.org/svn/chorem/trunk</connection>
<developerConnection>
@@ -80,7 +73,6 @@
</developerConnection>
<url>http://www.chorem.org/repositories/browse/chorem/trunk</url>
</scm>
-
<distributionManagement>
<site>
<id>${platform}</id>
@@ -115,6 +107,19 @@
<i18n.silent>true</i18n.silent>
</properties>
+ <repositories>
+
+ <repository>
+ <id>chorem-group</id>
+ <name>Chorem Group</name>
+ <url>http://nexus.nuiton.org/nexus/content/groups/chorem-group</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+
+ </repositories>
+
<dependencyManagement>
<dependencies>
@@ -266,7 +271,6 @@
<filtering>true</filtering>
</resource>
</resources>-->
-
<pluginManagement>
<plugins>
@@ -302,22 +306,8 @@
</plugins>
</pluginManagement>
-
</build>
- <repositories>
-
- <repository>
- <id>chorem-group</id>
- <name>Chorem Group</name>
- <url>http://nexus.nuiton.org/nexus/content/groups/chorem-group</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
-
- </repositories>
-
<profiles>
<profile>
@@ -361,5 +351,4 @@
</profile>
</profiles>
-
</project>
1
0