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
July 2013
- 3 participants
- 26 discussions
08 Jul '13
Author: meynier
Date: 2013-07-08 18:19:24 +0200 (Mon, 08 Jul 2013)
New Revision: 361
Url: http://chorem.org/projects/chorem/repository/revisions/361
Log:
+line for adding the Cancelled extension in Wikitty
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-07-08 12:03:44 UTC (rev 360)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-07-08 16:19:24 UTC (rev 361)
@@ -163,6 +163,7 @@
exts.addAll(org.chorem.entities.AcceptedAbstract.extensions);
exts.addAll(org.chorem.entities.AttachmentAbstract.extensions);
+ exts.addAll(org.chorem.entities.CancelledAbstract.extensions);
exts.addAll(org.chorem.entities.CategoryAbstract.extensions);
exts.addAll(org.chorem.entities.ChoremUserAbstract.extensions);
exts.addAll(org.chorem.entities.ClosedAbstract.extensions);
@@ -200,9 +201,9 @@
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);
@@ -211,7 +212,7 @@
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
1
0
r360 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/project webapp/WEB-INF/jsp webapp/css webapp/js
by meynier@users.chorem.org 08 Jul '13
by meynier@users.chorem.org 08 Jul '13
08 Jul '13
Author: meynier
Date: 2013-07-08 14:03:44 +0200 (Mon, 08 Jul 2013)
New Revision: 360
Url: http://chorem.org/projects/chorem/repository/revisions/360
Log:
Small changes on project dashboard for displaying alerts.
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js
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-07-03 15:30:35 UTC (rev 359)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-07-08 12:03:44 UTC (rev 360)
@@ -67,7 +67,7 @@
HashMap<Project, List<Quotation>> quotations = new HashMap<Project, List<Quotation>>();
HashMap<Quotation, List<Task>> taskMap = new HashMap<Quotation, List<Task>>();
- HashMap<Quotation, List<String>> alertsMap = new HashMap<Quotation, List<String>>();
+ HashMap<Task, String> alertsMap = new HashMap<Task, String>();
HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
HashMap<Task, TaskCalculation> taskCalc = new HashMap<Task, TaskCalculation>();
@@ -78,6 +78,7 @@
List<Task> tasks = fetchTasks(quotation, client);
taskMap.put(quotation, tasks);
+ //Make the calculations for the tasks
for(Task t : tasks) {
TaskCalculation tc = new TaskCalculation(t, client);
tc.setSrp(config.getDailyReturn());
@@ -85,7 +86,7 @@
taskCalc.put(t, tc);
}
taskMap.put(quotation, tasks);
- alertsMap.put(quotation, getAlerts(client, quotation));
+ alertsMap.putAll(getAlerts(client, quotation));
QuotationCalculation calc = new QuotationCalculation(quotation, client);
calc.setSrp(config.getDailyReturn());
calc.calculate();
@@ -120,11 +121,11 @@
WikittyQueryResult<Task> taskResult = null;
HashMap<Project, List<Quotation>> quotations = new HashMap<Project, List<Quotation>>();
HashMap<Quotation, List<Task>> taskMap = new HashMap<Quotation, List<Task>>();
- HashMap<Quotation, List<String>> alertsMap = new HashMap<Quotation, List<String>>();
+ HashMap<Task, String> alertsMap = new HashMap<Task, String>();
HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
HashMap<Task, TaskCalculation> taskCalc = new HashMap<Task, TaskCalculation>();
- //Fetch the project from the id
+ //Fetch the projects from the id or the filter
WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
if(id != null && !id.equals(""))
projectQueryMaker.ideq(id);
@@ -138,7 +139,7 @@
(new WikittyQueryMaker()).exteq(Configuration.EXT_CONFIGURATION).end()
).get(0);
- //Fetch the quotations form the project (if there is one)
+ //Fetch the quotations from the projects
if(projectResult.size() != 0) {
for(Project project : projectResult.getAll()) {
WikittyQuery quotationQuery = null;
@@ -173,19 +174,15 @@
taskCalc.put(t, tc);
}
- alertsMap.put(quote, getAlerts(client, quote));
+ alertsMap.putAll(getAlerts(client, quote));
QuotationCalculation calc = new QuotationCalculation(quote, client);
calc.setSrp(config.getDailyReturn());
calc.calculate();
calculations.put(quote, calc);
}
-
}
-
-
}
-
}
return renderView("dashboardSingleProject.jsp", "locale", client.getUserLocale(),
@@ -207,44 +204,53 @@
WikittyQuery taskQuery = new WikittyQueryMaker()
.eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
.end();
+
+ taskQuery.addSortAscending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
WikittyQueryResult taskResult = client.findAllByQuery(Task.class, taskQuery);
return taskResult.getAll();
}
- private List<String> getAlerts(ChoremClient client, Quotation q) {
+ private HashMap<Task, String> getAlerts(ChoremClient client, Quotation q) {
List<Task> tasks = fetchTasks(q, client);
Calendar now = new GregorianCalendar();
- List<String> messages = new ArrayList<String>();
+ HashMap<Task, String> messages = new HashMap<Task, String>();
for(Task t : tasks) {
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())) {
- System.out.println("should be started");
- messages.add( "Task " + t.getName() + " should be started");
+ alert = true;
+ str += "Task " + t.getName() + " should be started";
}
}
else if(t.getStatus().equalsIgnoreCase("Started")) {
if(t.getBeginDate().after(now.getTime())) {
- System.out.println("started in advance");
- messages.add( "Task " + t.getName() + " has been started in advance");
+ alert = true;
+ str += "Task " + t.getName() + " has been started in advance";
}
else if(t.getEndDate().before(now.getTime())) {
- System.out.println("should be ended");
- messages.add( "Task " + t.getName() + " should have ended by now");
+ alert = true;
+ str += "Task " + t.getName() + " should have ended by now";
}
}
else if(t.getStatus().equalsIgnoreCase("Finished")) {
if(t.getEndDate().after(now.getTime())) {
- System.out.println("finished in advance");
- messages.add( "Task " + t.getName() + " has been finished in advance");
+ alert = true;
+ str += "Task " + t.getName() + " has been finished in advance";
}
}
+ if(alert) {
+ messages.put(t,str);
+ }
+
}
}
+
return messages;
}
@@ -271,6 +277,9 @@
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);
@@ -346,14 +355,17 @@
}
Values[] v = null;
- //if(t.getReestimatedEnd() != null)
- // v= new Values[2];
- //else
- v = new Values[1];
+ if(t.getDayExtension() != 0)
+ v= new Values[2];
+ else
+ v = new Values[1];
v[0] = new Values(t.getBeginDate(), t.getEndDate(), t.getName(), customClass, t.getWikittyId());
- //if(t.getReestimatedEnd() != null)
- // v[1]= new Values(t.getEndDate(), t.getReestimatedEnd(), "Reestimated end", "ganttOrange");
-
+ if(t.getDayExtension() != 0) {
+ GregorianCalendar newEnd = new GregorianCalendar();
+ newEnd.setTime(t.getEndDate());
+ newEnd.add(Calendar.DAY_OF_YEAR, (int) t.getDayExtension());
+ v[1]= new Values(t.getEndDate(), newEnd.getTime(), "Reestimated end", "ganttOrange", t.getWikittyId());
+ }
JTask jt = new JTask(t.getName(), t.getDescription(), t.getWikittyId(),t.getPrice(), t.getEstimatedDays(), v);
lTask.add(jt);
@@ -449,12 +461,12 @@
}
- private class QuotationSorter<T> implements Comparator {
+ private class IntervalSorter<T extends Interval> implements Comparator {
@Override
public int compare(Object q1, Object q2) {
- return ((Quotation)q1).getBeginDate().compareTo(((Quotation)q2).getBeginDate());
+ return ((T)q1).getBeginDate().compareTo(((T)q2).getBeginDate());
}
}
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-03 15:30:35 UTC (rev 359)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-08 12:03:44 UTC (rev 360)
@@ -27,6 +27,7 @@
<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
<f:setLocale value="${locale}"/>
+
<link rel="stylesheet" href="<c:url value='/css/jquery.fn.gantt.css'/>" />
<h1>${title}</h1>
<form class="well form-inline" method="GET" id="projectSearch">
@@ -69,13 +70,13 @@
<td class="number"><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
<td class="number"> <f:formatNumber type="number"
- maxFractionDigits="2" value="${calculations[q].getTjm()}" /></td>
+ maxFractionDigits="2" value="${calculations[q].getAdr()}" /></td>
<td class="number"> <f:formatNumber type="number"
maxFractionDigits="2" value="${calculations[q].getRealDays()}" /></td>
<td class="number"> <f:formatNumber type="number"
maxFractionDigits="2" value="${calculations[q].getDeltaDays()}" /></td>
<td class="number"> <f:formatNumber type="number"
- maxFractionDigits="2" value="${calculations[q].getRealTjm()}" /></td>
+ maxFractionDigits="2" value="${calculations[q].getRealAdr()}" /></td>
<td class="currency"> <f:formatNumber type="currency"
maxFractionDigits="2" value="${calculations[q].getExpectedProfit()}" /></td>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-03 15:30:35 UTC (rev 359)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-08 12:03:44 UTC (rev 360)
@@ -81,7 +81,7 @@
<c:forEach var="p" items="${projects}">
<c:if test="${not empty quotations[p]}">
<h2 style="display: inline;">${p.name}</h2>
- <a href="<c:url value="/wikitty/edit/${param.project_id}"/>"><i
+ <a href="<c:url value="/wikitty/edit/${p.wikittyId}"/>"><i
class="icon-pencil icon-black"></i><small>edit</small></a>
<p>${p.description}</p>
@@ -101,7 +101,7 @@
<w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate"
label="" pattern="dd/MM/yyyy" />
au
- <w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate"
+ <w:display wikitty="${q.wikitty}" fqfield="Interval.endDate"
label="" pattern="dd/MM/yyyy" />
<br />Statut :
${q.wikitty.extensionNames.toArray()[q.wikitty.extensionNames.size()
@@ -121,8 +121,6 @@
<th>Gain/perte</th>
</tr>
</thead>
-
-
<tbody>
<tr>
@@ -133,9 +131,9 @@
<td class="number"><w:display wikitty="${q.wikitty}"
fqfield="Quotation.estimatedDays" label="" /></td>
<td class="currency"><f:formatNumber type="currency"
- maxFractionDigits="2" value="${calculations[q].getTjm()}" /></td>
+ maxFractionDigits="2" value="${calculations[q].getAdr()}" /></td>
<td class="currency"><f:formatNumber type="currency"
- maxFractionDigits="2" value="${calculations[q].getRealTjm()}" /></td>
+ maxFractionDigits="2" value="${calculations[q].getRealAdr()}" /></td>
<td class="currency"><w:display wikitty="${q.wikitty}"
fqfield="Quotation.amount" label="" /></td>
<td class="currency"><f:formatNumber type="currency"
@@ -148,66 +146,63 @@
- <c:forEach var="a" items="${alerts[q]}">
- <div class="alert-error alert">
- <div class="alert-block">${a}</div>
- </div>
-
- </c:forEach>
-
<div class="gantt gantt-${q.wikittyId}" wikittyId="${q.wikittyId}"
data=''>Pas de tâche</div>
-
-
- <table class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th>Nom</th>
- <th>Montant</th>
- <th>Jours estimés</th>
- <th>Jours réels</th>
- <th>Différence estimation/réel</th>
- <th>TJM estimé</th>
- <th>TJM réel</th>
- <th>Gain attendu</th>
- <th>Gain/perte</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="${taskMap[q]}" var="task">
+ <c:if test="${taskMap[q].size() != 0}">
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
<tr>
- <td><a href="<c:url value="/wikitty/view/${task.wikittyId}"/>">
- <w:display wikitty="${task.wikitty}" fqfield="Task.name"
- label="" /></a></td>
- <td><w:display wikitty="${task.wikitty}"
- fqfield="Task.price" label="" /></td>
- <td class="number"><w:display wikitty="${task.wikitty}"
- fqfield="Task.estimatedDays" label="" /></td>
- <td class="number"><f:formatNumber type="number"
- maxFractionDigits="2" value="${taskCalc[task].getRealDays()}" /></td>
- <td class="number"><f:formatNumber type="number"
- maxFractionDigits="2" value="${taskCalc[task].getDeltaDays()}" /></td>
- <td class="number"><f:formatNumber type="number"
- maxFractionDigits="2" value="${taskCalc[task].getTjm()}" /></td>
+ <th>Nom</th>
+ <th>Montant</th>
+ <th>Jours estimés</th>
+ <th>Jours réels</th>
+ <th>Différence estimation/réel</th>
+ <th>TJM estimé</th>
+ <th>TJM réel</th>
+ <th>Gain attendu</th>
+ <th>Gain/perte</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="${taskMap[q]}" var="task">
+ <tr id="taskrow-${task.wikittyId}">
+ <td <c:if test="${not empty alerts[task]}">class="task-alert"</c:if>><a
+ href="<c:url value="/wikitty/view/${task.wikittyId}"/>"> <w:display
+ wikitty="${task.wikitty}" fqfield="Task.name" label="" /></a>
+ <c:if test="${not empty alerts[task]}">
+ <i class="icon-warning-sign" title="${alerts[task]}"></i>
+ </c:if>
+
+
+ <td><w:display wikitty="${task.wikitty}"
+ fqfield="Task.price" label="" /></td>
+ <td class="number"><w:display wikitty="${task.wikitty}"
+ fqfield="Task.estimatedDays" label="" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getRealDays()}" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getDeltaDays()}" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getAdr()}" /></td>
- <td class="number"><f:formatNumber type="number"
- maxFractionDigits="2" value="${taskCalc[task].getRealTjm()}" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getRealAdr()}" /></td>
- <td class="currency"><f:formatNumber type="currency"
- maxFractionDigits="2"
- value="${taskCalc[task].getExpectedProfit()}" /></td>
- <td class="currency"><f:formatNumber type="currency"
- maxFractionDigits="2"
- value="${taskCalc[task].getLossOrProfit()}" /></td>
- </tr>
+ <td class="currency"><f:formatNumber type="currency"
+ maxFractionDigits="2"
+ value="${taskCalc[task].getExpectedProfit()}" /></td>
+ <td class="currency"><f:formatNumber type="currency"
+ maxFractionDigits="2"
+ value="${taskCalc[task].getLossOrProfit()}" /></td>
+ </tr>
- </c:forEach>
- </tbody>
- </table>
-
+ </c:forEach>
+ </tbody>
+ </table>
+ </c:if>
</c:forEach>
</c:if>
Modified: trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css 2013-07-03 15:30:35 UTC (rev 359)
+++ trunk/chorem-webmotion/src/main/webapp/css/jquery.fn.gantt.css 2013-07-08 12:03:44 UTC (rev 360)
@@ -28,9 +28,11 @@
width: 100%;
}
+.task-alert a {
+ color:red;
+}
-
/* === LEFT PANEL === */
.fn-gantt .leftPanel {
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-07-03 15:30:35 UTC (rev 359)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-07-08 12:03:44 UTC (rev 360)
@@ -756,6 +756,8 @@
$("#quotationFilter").change(function() {
$("#projectSearch").submit();
});
+ $(".task-alert").tooltip();
+
function initgantt(id) {
"use strict";
$.get(createUrl("/project/json/getGanttInfo/",id),
@@ -776,7 +778,9 @@
window.location ="wikitty/edit/" + data;
},
onAddClick: function(dt, rowId) {
- alert("Empty space clicked - add an item!");
+ var d = new Date(parseInt(dt,10));
+ var str = d.getDay() +"/"+ d.getMonth() +"/"+ d.getFullYear();
+ window.location ="wikitty/Task/edit/new?Interval.beginDate=" + str +"&Task.quotation=" + id;
},
onRender: function() {
if (window.console && typeof console.log === "function") {
@@ -798,6 +802,6 @@
initgantt(div.attributes.wikittyid.nodeValue);
}
+
-
});
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js 2013-07-03 15:30:35 UTC (rev 359)
+++ trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js 2013-07-08 12:03:44 UTC (rev 360)
@@ -384,8 +384,6 @@
entries.push('</div>');
}
-
-
}
});
ganttLeftPanel.append(entries.join(""));
@@ -1224,7 +1222,7 @@
day.customClass ? day.customClass : "",
entry.desc ? entry.desc : "",
day.label ? day.label : "",
- ntry.price ? entry.price : "",
+ entry.price ? entry.price : "",
entry.estimatedDays ? entry.estimatedDays : "",
day.dataObj ? day.dataObj : null
);
1
0
r359 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/project webapp/WEB-INF/jsp webapp/js
by meynier@users.chorem.org 03 Jul '13
by meynier@users.chorem.org 03 Jul '13
03 Jul '13
Author: meynier
Date: 2013-07-03 17:30:35 +0200 (Wed, 03 Jul 2013)
New Revision: 359
Url: http://chorem.org/projects/chorem/repository/revisions/359
Log:
Added task calculations and enhanced alerts
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/QuotationCalculation.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js
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-07-02 16:04:44 UTC (rev 358)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-07-03 15:30:35 UTC (rev 359)
@@ -53,11 +53,11 @@
* @return
*/
public Render singleQuotationFilter(ChoremClient client, String id, String quotationFilter) {
-
+
//Fetch the quotation from the filter
WikittyQuery quotationQuery = new WikittyQueryMaker().ideq(quotationFilter).end();
WikittyQueryResult<Quotation> quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
-
+
//If some quotation has been found
if(quotationResult != null) {
Quotation quotation = quotationResult.get(0);
@@ -68,16 +68,37 @@
HashMap<Project, List<Quotation>> quotations = new HashMap<Project, List<Quotation>>();
HashMap<Quotation, List<Task>> taskMap = new HashMap<Quotation, List<Task>>();
HashMap<Quotation, List<String>> alertsMap = new HashMap<Quotation, List<String>>();
-
+ HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
+ HashMap<Task, TaskCalculation> taskCalc = new HashMap<Task, TaskCalculation>();
+
quotations.put(projectResult.get(0), quotationResult.getAll());
-
- taskMap.put(quotation, fetchTasks(quotation, client));
+ Configuration config = client.findAllByQuery(Configuration.class,
+ (new WikittyQueryMaker()).exteq(Configuration.EXT_CONFIGURATION).end()
+ ).get(0);
+
+ List<Task> tasks = fetchTasks(quotation, client);
+ taskMap.put(quotation, tasks);
+ for(Task t : tasks) {
+ TaskCalculation tc = new TaskCalculation(t, client);
+ tc.setSrp(config.getDailyReturn());
+ tc.calculate();
+ taskCalc.put(t, tc);
+ }
+ taskMap.put(quotation, tasks);
alertsMap.put(quotation, getAlerts(client, quotation));
+ QuotationCalculation calc = new QuotationCalculation(quotation, client);
+ calc.setSrp(config.getDailyReturn());
+ calc.calculate();
+ calculations.put(quotation, calc);
- return renderView("dashboardSingleProject.jsp",
+
+
+
+ return renderView("dashboardSingleProject.jsp", "locale", client.getUserLocale(),
"title", "Tableau de bord projet", "projects", projectResult.getAll(),
"quotations", quotations, "taskMap", taskMap, "extensions",
- Extensions.extensions, "alerts", alertsMap);
+ Extensions.extensions, "alerts", alertsMap, "calculations", calculations,
+ "taskCalc", taskCalc);
}
else {
@@ -100,6 +121,9 @@
HashMap<Project, List<Quotation>> quotations = new HashMap<Project, List<Quotation>>();
HashMap<Quotation, List<Task>> taskMap = new HashMap<Quotation, List<Task>>();
HashMap<Quotation, List<String>> alertsMap = new HashMap<Quotation, List<String>>();
+ HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
+ HashMap<Task, TaskCalculation> taskCalc = new HashMap<Task, TaskCalculation>();
+
//Fetch the project from the id
WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
if(id != null && !id.equals(""))
@@ -110,6 +134,10 @@
projectResult = client.findAllByQuery(Project.class, projectQuery);
+ Configuration config = client.findAllByQuery(Configuration.class,
+ (new WikittyQueryMaker()).exteq(Configuration.EXT_CONFIGURATION).end()
+ ).get(0);
+
//Fetch the quotations form the project (if there is one)
if(projectResult.size() != 0) {
for(Project project : projectResult.getAll()) {
@@ -125,8 +153,8 @@
else if (quotationFilter.equals("all")){
wqm.eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project);
}
-
+
quotationQuery = wqm.end();
quotationQuery.setLimit(20);
quotationQuery.addSortDescending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
@@ -136,23 +164,38 @@
//Fetch the tasks form the quotations (if there are some)
if(quotationResult != null) {
for(Quotation quote : quotationResult.getAll()) {
- taskMap.put(quote, fetchTasks(quote, client));
+ List<Task> tasks = fetchTasks(quote, client);
+ taskMap.put(quote, tasks);
+ for(Task t : tasks) {
+ TaskCalculation tc = new TaskCalculation(t, client);
+ tc.setSrp(config.getDailyReturn());
+ tc.calculate();
+ taskCalc.put(t, tc);
+ }
+
alertsMap.put(quote, getAlerts(client, quote));
+
+ QuotationCalculation calc = new QuotationCalculation(quote, client);
+ calc.setSrp(config.getDailyReturn());
+ calc.calculate();
+ calculations.put(quote, calc);
}
}
+
}
}
- return renderView("dashboardSingleProject.jsp",
+ return renderView("dashboardSingleProject.jsp", "locale", client.getUserLocale(),
"title", "Tableau de bord projet", "projects", projectResult.getAll(),
"quotations", quotations, "taskMap", taskMap, "extensions",
- Extensions.extensions, "alerts", alertsMap);
+ Extensions.extensions, "alerts", alertsMap, "calculations", calculations,
+ "taskCalc", taskCalc);
}
-
+
/**
* Fetch the task from the given quotation
* Simple wikitty query
@@ -168,41 +211,39 @@
WikittyQueryResult taskResult = client.findAllByQuery(Task.class, taskQuery);
return taskResult.getAll();
}
-
+
private List<String> getAlerts(ChoremClient client, Quotation q) {
List<Task> tasks = fetchTasks(q, client);
Calendar now = new GregorianCalendar();
List<String> messages = new ArrayList<String>();
for(Task t : tasks) {
-
- System.out.println("Starting task alerts for " + t.getName());
- System.out.println("Task is " + t.getStatus());
- System.out.println(now.getTime());
- //Test if the statuses are correct
- if(t.getStatus().equals("Scheduled")) {
- if(t.getBeginDate().before(now.getTime())) {
- System.out.println("should be started");
- messages.add( "Task " + t.getName() + " should be started");
+ if(t.getBeginDate() != null && t.getEndDate() != null) {
+ //Test if the statuses are correct
+ if(t.getStatus().equalsIgnoreCase("Scheduled")) {
+ if(t.getBeginDate().before(now.getTime())) {
+ System.out.println("should be started");
+ messages.add( "Task " + t.getName() + " should be started");
+ }
}
- }
- else if(t.getStatus().equals("Started")) {
- if(t.getBeginDate().after(now.getTime())) {
- System.out.println("started in advance");
- messages.add( "Task " + t.getName() + " has been started in advance");
+ else if(t.getStatus().equalsIgnoreCase("Started")) {
+ if(t.getBeginDate().after(now.getTime())) {
+ System.out.println("started in advance");
+ messages.add( "Task " + t.getName() + " has been started in advance");
+ }
+ else if(t.getEndDate().before(now.getTime())) {
+ System.out.println("should be ended");
+ messages.add( "Task " + t.getName() + " should have ended by now");
+ }
}
- else if(t.getEndDate().before(now.getTime())) {
- System.out.println("should be ended");
- messages.add( "Task " + t.getName() + " should have ended by now");
+ else if(t.getStatus().equalsIgnoreCase("Finished")) {
+
+ if(t.getEndDate().after(now.getTime())) {
+ System.out.println("finished in advance");
+ messages.add( "Task " + t.getName() + " has been finished in advance");
+ }
}
}
- else if(t.getStatus().equals("Finished")) {
-
- if(t.getEndDate().after(now.getTime())) {
- System.out.println("fnished in advance");
- messages.add( "Task " + t.getName() + " has been finished in advance");
- }
- }
-
+
}
return messages;
}
@@ -247,6 +288,7 @@
return renderView("dashboardMultiProject.jsp",
"title", "Tableau de bord projets",
+ "locale", client.getUserLocale(),
"quotations", quotations,
"calculations", calculations);
@@ -308,7 +350,7 @@
// v= new Values[2];
//else
v = new Values[1];
- v[0] = new Values(t.getBeginDate(), t.getEndDate(), t.getName(), customClass);
+ v[0] = new Values(t.getBeginDate(), t.getEndDate(), t.getName(), customClass, t.getWikittyId());
//if(t.getReestimatedEnd() != null)
// v[1]= new Values(t.getEndDate(), t.getReestimatedEnd(), "Reestimated end", "ganttOrange");
@@ -391,11 +433,13 @@
private String to;
private String label;
private String customClass;
- public Values(Date from, Date to, String label, String customClass) {
+ private String dataObj;
+ public Values(Date from, Date to, String label, String customClass, String dataObj) {
this.from = "/Date(" + from.getTime() + ")/";
this.to = "/Date(" + to.getTime() + ")/";
this.label = label;
this.customClass = customClass;
+ this.dataObj = dataObj;
}
@Override
public int compareTo(Object o) {
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java 2013-07-02 16:04:44 UTC (rev 358)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java 2013-07-03 15:30:35 UTC (rev 359)
@@ -2,10 +2,8 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import org.chorem.ChoremClient;
-import org.chorem.entities.Interval;
import org.chorem.entities.Quotation;
import org.chorem.entities.Task;
import org.chorem.entities.Time;
@@ -13,57 +11,19 @@
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
-public class QuotationCalculation {
+public class QuotationCalculation extends Calculation<Quotation> {
- private Quotation q;
- private ChoremClient client;
- private static final int SEC_PER_HOUR = 3600;
- private static final int WORKING_HOURS_PER_DAY = 7;
- private double srp = 1;
- private Double tjm = null;
- private Double realDays = null;
- private Double deltaDays = null;
- private Double realTjm = null;
- private Double expectedProfit = null;
- private Double lossOrProfit = null;
- private Double resultPerDay = null;
-
-
-
public QuotationCalculation(Quotation q, ChoremClient client) {
- this.q = q;
- this.client = client;
+ super(q, q.getAmount(), q.getEstimatedDays(), client);
}
-
- public void calculate() {
- this.tjm = tjm();
- this.realDays = realDays();
- this.deltaDays = deltaDays();
- this.realTjm = realTjm();
- this.expectedProfit = expectedProfit();
- this.lossOrProfit = lossOrProfit();
- this.resultPerDay = resultPerDay();
- }
-
- public double tjm() {
- double amount = q.getAmount();
- double nbDays = q.getEstimatedDays();
-
- return amount/nbDays;
-
- }
-
- private double getPeriodInSeconds(Date start, Date end) {
- return (end.getTime()-start.getTime())/1000;
- }
-
+ @Override
public double realDays() {
//test if quotation is finished
- if(q.getExtensionNames().contains("Closed")) {
+ if(e.getExtensionNames().contains("Closed")) {
//Calculate the days from the times objects
WikittyQuery taskQuery = new WikittyQueryMaker()
- .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
+ .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, e)
.end();
WikittyQueryResult<Task> result =
@@ -73,7 +33,7 @@
WikittyQuery timeQuery = new WikittyQueryMaker()
.eq(Time.ELEMENT_FIELD_TIME_TASK, t)
.end();
- WikittyQueryResult timeResult = client.findAllByQuery(Time.class, timeQuery);
+ WikittyQueryResult<Time> timeResult = client.findAllByQuery(Time.class, timeQuery);
times.addAll(timeResult.getAll());
}
double totalTime = 0;
@@ -87,7 +47,7 @@
else {
//nbDays + day extensions from tasks
WikittyQuery taskQuery = new WikittyQueryMaker()
- .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
+ .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, e)
.end();
WikittyQueryResult<Task> result =
@@ -97,80 +57,9 @@
for(Task t : result.getAll()) {
totalDayExt += t.getDayExtension();
}
- return q.getEstimatedDays() + totalDayExt;
+ return nbDays + totalDayExt;
}
}
- public double deltaDays() {
- return getRealDays() - q.getEstimatedDays();
- }
-
- public double realTjm() {
- double amount = q.getAmount();
- double nbDays = getRealDays();
-
- return amount/nbDays;
- }
-
- public double expectedProfit() {
- double nbDays = q.getEstimatedDays();
- return (getTjm() - srp) * nbDays;
- }
-
- public double lossOrProfit() {
- double amount = q.getAmount();
- return amount - (getRealDays() * srp);
- }
-
- public double resultPerDay() {
- return getLossOrProfit() / getRealDays();
- }
-
- public double getTjm() {
- if(tjm == null)
- return tjm();
- else
- return tjm;
- }
- public double getRealDays() {
- if(realDays == null)
- return realDays();
- else
- return realDays;
- }
- public double getDeltaDays() {
- if(deltaDays == null)
- return deltaDays;
- else
- return deltaDays;
- }
- public double getRealTjm() {
- if(realTjm == null)
- return realTjm();
- else
- return realTjm;
- }
- public double getExpectedProfit() {
- if(expectedProfit == null)
- return expectedProfit();
- else
- return expectedProfit;
- }
- public double getLossOrProfit() {
- if(lossOrProfit == null)
- return lossOrProfit();
- else
- return lossOrProfit;
- }
- public double getResultPerDay() {
- if(resultPerDay == null)
- return resultPerDay();
- else
- return resultPerDay;
- }
- public void setSrp(double val) {
- this.srp = val;
- }
-
}
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-02 16:04:44 UTC (rev 358)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-03 15:30:35 UTC (rev 359)
@@ -26,7 +26,7 @@
<%@ 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/jquery.fn.gantt.css'/>" />
<h1>${title}</h1>
<form class="well form-inline" method="GET" id="projectSearch">
@@ -59,7 +59,7 @@
</thead>
<c:forEach var="q" items="${quotations}">
<tbody>
- <tr><f:setLocale value="fr_FR"/>
+ <tr>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/>
<a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-02 16:04:44 UTC (rev 358)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-03 15:30:35 UTC (rev 359)
@@ -26,7 +26,7 @@
<%@ 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/jquery.fn.gantt.css'/>" />
<h1>${title}</h1>
@@ -69,10 +69,10 @@
</script>
<input type="text" id="project_text" name="project_name"
- value="${param.project_name}" placeholder="project name" />
- <input type="hidden" id="project_hidden" name="project_id"
+ value="${param.project_name}" placeholder="project name" /> <input
+ type="hidden" id="project_hidden" name="project_id"
value='<c:if test='${!param.project_name.equals("") }'>${param.project_id}</c:if>' />
-
+
</div>
</div>
@@ -108,16 +108,17 @@
-1]}
</p>
-
+
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Responsable Code Lutin</th>
<th>Responsable entreprise</th>
- <th>Estimated days</th>
- <th>Conversion hope</th>
- <th>Hoped price day</th>
- <th>Amount</th>
+ <th>Jours estimés</th>
+ <th>TJM estimé</th>
+ <th>TJM réel</th>
+ <th>Montant</th>
+ <th>Gain/perte</th>
</tr>
</thead>
@@ -131,63 +132,86 @@
fqfield="Quotation.customer" label="" /></td>
<td class="number"><w:display wikitty="${q.wikitty}"
fqfield="Quotation.estimatedDays" label="" /></td>
- <td class="percent"><w:display wikitty="${q.wikitty}"
- fqfield="Quotation.conversionHope" label="" /></td>
<td class="currency"><f:formatNumber type="currency"
- value="${q.amount / q.estimatedDays}" /></td>
+ maxFractionDigits="2" value="${calculations[q].getTjm()}" /></td>
+ <td class="currency"><f:formatNumber type="currency"
+ maxFractionDigits="2" value="${calculations[q].getRealTjm()}" /></td>
<td class="currency"><w:display wikitty="${q.wikitty}"
fqfield="Quotation.amount" label="" /></td>
+ <td class="currency"><f:formatNumber type="currency"
+ maxFractionDigits="2"
+ value="${calculations[q].getLossOrProfit()}" /></td>
</tr>
</tbody>
</table>
- ${alerts[q]}
+
+
+
+ <c:forEach var="a" items="${alerts[q]}">
+
+ <div class="alert-error alert">
+ <div class="alert-block">${a}</div>
+ </div>
+
+ </c:forEach>
+
<div class="gantt gantt-${q.wikittyId}" wikittyId="${q.wikittyId}"
data=''>Pas de tâche</div>
- <!--
- <p>Liste des tâches :</p>
- <c:forEach items="${taskMap}" var="entry">
- <c:if test="${entry.key.equals(q)}">
- <ul>
- <c:forEach items="${entry.value}" var="task">
- <li><a
- href="<c:url value="/wikitty/view/${task.wikittyId}"/>">${task.name}
- : ${task.description}</a></li>
- </c:forEach>
- </ul>
- </c:if>
+ <table class="table table-striped table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th>Nom</th>
+ <th>Montant</th>
+ <th>Jours estimés</th>
+ <th>Jours réels</th>
+ <th>Différence estimation/réel</th>
+ <th>TJM estimé</th>
+ <th>TJM réel</th>
+ <th>Gain attendu</th>
+ <th>Gain/perte</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="${taskMap[q]}" var="task">
+ <tr>
+ <td><a href="<c:url value="/wikitty/view/${task.wikittyId}"/>">
+ <w:display wikitty="${task.wikitty}" fqfield="Task.name"
+ label="" /></a></td>
+ <td><w:display wikitty="${task.wikitty}"
+ fqfield="Task.price" label="" /></td>
+ <td class="number"><w:display wikitty="${task.wikitty}"
+ fqfield="Task.estimatedDays" label="" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getRealDays()}" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getDeltaDays()}" /></td>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getTjm()}" /></td>
- </c:forEach>
- <p>
- <select class="extBox" name="extList" wikittyId="${q.wikittyId}">
- <option>Transformer en...</option>
- <c:forEach items="${extensions}" var="ext">
- <c:set var="contains" value="false" />
- <c:forEach var="item" items="${q.extensionNames}">
- <c:if test="${item eq ext}">
- <c:set var="contains" value="true" />
- </c:if>
- </c:forEach>
- <c:if test="${contains == false}">
- <option>${ext}</option>
- </c:if>
+ <td class="number"><f:formatNumber type="number"
+ maxFractionDigits="2" value="${taskCalc[task].getRealTjm()}" /></td>
+
+ <td class="currency"><f:formatNumber type="currency"
+ maxFractionDigits="2"
+ value="${taskCalc[task].getExpectedProfit()}" /></td>
+ <td class="currency"><f:formatNumber type="currency"
+ maxFractionDigits="2"
+ value="${taskCalc[task].getLossOrProfit()}" /></td>
+ </tr>
+
+
</c:forEach>
- </select>
- </p>
- <div id="upgradeFields-${q.wikittyId}"></div>
--->
+ </tbody>
+ </table>
+
</c:forEach>
</c:if>
</c:forEach>
-<script src="<c:url value='/js/jquery.fn.gantt.js'/>"></script>
-
-
-
-
-
+<script src="<c:url value='/js/jquery.fn.gantt.js'/>"></script>
\ 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-07-02 16:04:44 UTC (rev 358)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-07-03 15:30:35 UTC (rev 359)
@@ -761,7 +761,6 @@
$.get(createUrl("/project/json/getGanttInfo/",id),
function(ret){
var data = ret['data'];
- console.log(data);
if(data['source'].length != 0) {
$(".gantt-"+id).gantt({
source: data['source'],
@@ -774,7 +773,7 @@
minScale: "days",
itemsPerPage: 10,
onItemClick: function(data) {
- window.location ="wikitty/edit/" + this.source[0].wikittyId;
+ window.location ="wikitty/edit/" + data;
},
onAddClick: function(dt, rowId) {
alert("Empty space clicked - add an item!");
Modified: trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js 2013-07-02 16:04:44 UTC (rev 358)
+++ trunk/chorem-webmotion/src/main/webapp/js/jquery.fn.gantt.js 2013-07-03 15:30:35 UTC (rev 359)
@@ -368,13 +368,17 @@
var entries = [];
$.each(element.data, function (i, entry) {
if (i >= element.pageNum * settings.itemsPerPage && i < (element.pageNum * settings.itemsPerPage + settings.itemsPerPage)) {
-
- entries.push('<div class="row name row' + i + (entry.desc ? '' : ' fn-wide') + '" id="rowheader' + i + '" offset="' + i % settings.itemsPerPage * tools.getCellSize() + '">');
+ entries.push('<div class="row name row' + i + (entry.desc ? '' : ' fn-wide')
+ + '" id="rowheader' + i + '" offset="'
+ + i % settings.itemsPerPage * tools.getCellSize() + '" dataObj="'
+ + entry.wikittyId + '">');
entries.push('<span class="fn-label' + (entry.cssClass ? ' ' + entry.cssClass : '') + '">' + entry.name + '</span>');
entries.push('</div>');
if (entry.desc) {
- entries.push('<div class="row desc row' + i + ' " id="RowdId_' + i + '" data-id="' + entry.id + '">');
+ entries.push('<div class="row desc row' + i + ' " id="RowdId_' + i + '" data-id="'
+ + entry.id + '" dataObj="'
+ + entry.wikittyId + '">');
entries.push('<span class="fn-label' + (entry.cssClass ? ' ' + entry.cssClass : '') + '">' + entry.desc + '</span>');
@@ -388,7 +392,12 @@
ganttLeftPanel.find('.row:not(.spacer)').mouseover(core.mover)
.mouseout(core.mout)
.mousemove(core.mmove)
- .attr('over', 'text');
+ .attr('over', 'text')
+ .click(function (e) {
+ e.stopPropagation();
+ settings.onItemClick($(this).attr("dataObj"));
+ });
+
return ganttLeftPanel;
},
1
0
r358 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/project webapp/WEB-INF/jsp webapp/js
by meynier@users.chorem.org 02 Jul '13
by meynier@users.chorem.org 02 Jul '13
02 Jul '13
Author: meynier
Date: 2013-07-02 18:04:44 +0200 (Tue, 02 Jul 2013)
New Revision: 358
Url: http://chorem.org/projects/chorem/repository/revisions/358
Log:
project dashboard filter works differently. started to manage alerts. Added fields with SRP in multi-project dashoard
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/QuotationCalculation.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
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-07-01 12:32:53 UTC (rev 357)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-07-02 16:04:44 UTC (rev 358)
@@ -21,6 +21,7 @@
import org.debux.webmotion.server.call.Call;
import org.debux.webmotion.server.render.Render;
import org.chorem.entities.Closed;
+import org.chorem.entities.Configuration;
import org.chorem.entities.Interval;
import org.chorem.entities.Quotation;
import org.chorem.entities.Project;
@@ -31,6 +32,8 @@
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
+
+import com.google.common.collect.Iterables;
import com.google.gson.*;
/**
*
@@ -42,81 +45,166 @@
/** 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) {
+
+ //Fetch the quotation from the filter
+ WikittyQuery quotationQuery = new WikittyQueryMaker().ideq(quotationFilter).end();
+ WikittyQueryResult<Quotation> quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
+
+ //If some quotation has been found
+ if(quotationResult != null) {
+ 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);
+
+ HashMap<Project, List<Quotation>> quotations = new HashMap<Project, List<Quotation>>();
+ HashMap<Quotation, List<Task>> taskMap = new HashMap<Quotation, List<Task>>();
+ HashMap<Quotation, List<String>> alertsMap = new HashMap<Quotation, List<String>>();
+
+ quotations.put(projectResult.get(0), quotationResult.getAll());
+
+ taskMap.put(quotation, fetchTasks(quotation, client));
+ alertsMap.put(quotation, getAlerts(client, quotation));
+
+ return renderView("dashboardSingleProject.jsp",
+ "title", "Tableau de bord projet", "projects", projectResult.getAll(),
+ "quotations", quotations, "taskMap", taskMap, "extensions",
+ Extensions.extensions, "alerts", alertsMap);
+
+ }
+ else {
+ return renderView("dashboardSingleProject.jsp");
+ }
+ }
+
+ /**
+ * 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;
WikittyQueryResult<Task> taskResult = null;
+ HashMap<Project, List<Quotation>> quotations = new HashMap<Project, List<Quotation>>();
HashMap<Quotation, List<Task>> taskMap = new HashMap<Quotation, List<Task>>();
+ HashMap<Quotation, List<String>> alertsMap = new HashMap<Quotation, List<String>>();
+ //Fetch the project from the id
+ WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
+ if(id != null && !id.equals(""))
+ projectQueryMaker.ideq(id);
+ else
+ projectQueryMaker.exteq("Project");
+ WikittyQuery projectQuery = projectQueryMaker.end();
- //HashMap<Quotation, String> extMap = new HashMap<Quotation, String>();
+ projectResult = client.findAllByQuery(Project.class, projectQuery);
- //Fetch the project form the name (if it has been requested)
- if(id != null) {
- WikittyQuery projectQuery = new WikittyQueryMaker()
- .ideq(id)
- .end();
+ //Fetch the quotations form the project (if there is one)
+ if(projectResult.size() != 0) {
+ for(Project project : projectResult.getAll()) {
+ WikittyQuery quotationQuery = null;
+ WikittyQueryMaker wqm = new WikittyQueryMaker();
- projectResult = client.findAllByQuery(Project.class, projectQuery);
- //Fetch the quotations form the project (if there is one)
- 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);
+ }
+
+ quotationQuery = wqm.end();
+ quotationQuery.setLimit(20);
+ quotationQuery.addSortDescending(Quotation.ELEMENT_FIELD_INTERVAL_BEGINDATE);
+ quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
+ quotations.put(project, quotationResult.getAll());
- if(quotationFilter.equals("Devis ouverts")) {
- wqm.and()
- .eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project)
- .extne(Closed.EXT_CLOSED);
+ //Fetch the tasks form the quotations (if there are some)
+ if(quotationResult != null) {
+ for(Quotation quote : quotationResult.getAll()) {
+ taskMap.put(quote, fetchTasks(quote, client));
+ alertsMap.put(quote, getAlerts(client, quote));
}
- else {
- wqm.eq(Quotation.ELEMENT_FIELD_QUOTATION_PROJECT, project);
- }
- quotationQuery = wqm.end();
-
- 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) {
- String customClass = "";
- for(Quotation quote : quotationResult.getAll()) {
- WikittyQuery taskQuery = new WikittyQueryMaker()
- .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, quote)
- .end();
+ }
- taskResult = client.findAllByQuery(Task.class, taskQuery);
- taskMap.put(quote, taskResult.getAll());
+ return renderView("dashboardSingleProject.jsp",
+ "title", "Tableau de bord projet", "projects", projectResult.getAll(),
+ "quotations", quotations, "taskMap", taskMap, "extensions",
+ Extensions.extensions, "alerts", alertsMap);
+ }
+
+ /**
+ * Fetch the task from the given quotation
+ * Simple wikitty query
+ * @param q Quotation
+ * @param client chorem client
+ * @return list of task from the quotation
+ */
+ private List<Task> fetchTasks(Quotation q, ChoremClient client) {
+ WikittyQuery taskQuery = new WikittyQueryMaker()
+ .eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
+ .end();
+
+ WikittyQueryResult taskResult = client.findAllByQuery(Task.class, taskQuery);
+ return taskResult.getAll();
+ }
+
+ private List<String> getAlerts(ChoremClient client, Quotation q) {
+ List<Task> tasks = fetchTasks(q, client);
+ Calendar now = new GregorianCalendar();
+ List<String> messages = new ArrayList<String>();
+ for(Task t : tasks) {
+
+ System.out.println("Starting task alerts for " + t.getName());
+ System.out.println("Task is " + t.getStatus());
+ System.out.println(now.getTime());
+ //Test if the statuses are correct
+ if(t.getStatus().equals("Scheduled")) {
+ if(t.getBeginDate().before(now.getTime())) {
+ System.out.println("should be started");
+ messages.add( "Task " + t.getName() + " should be started");
}
-
}
-
+ else if(t.getStatus().equals("Started")) {
+ if(t.getBeginDate().after(now.getTime())) {
+ System.out.println("started in advance");
+ messages.add( "Task " + t.getName() + " has been started in advance");
+ }
+ else if(t.getEndDate().before(now.getTime())) {
+ System.out.println("should be ended");
+ messages.add( "Task " + t.getName() + " should have ended by now");
+ }
+ }
+ else if(t.getStatus().equals("Finished")) {
+
+ if(t.getEndDate().after(now.getTime())) {
+ System.out.println("fnished in advance");
+ messages.add( "Task " + t.getName() + " has been finished in advance");
+ }
+ }
+
}
-
- if(projectResult == null) {
- return renderView("dashboardSingleProject.jsp",
- "title", "Tableau de bord projet", "projects", null,"quotations",null);
- }
- else if(quotationResult == null) {
- return renderView("dashboardSingleProject.jsp",
- "title", "Tableau de bord projet", "projects", projectResult.getAll(),
- "quotations", null);
- }
- else {
- return renderView("dashboardSingleProject.jsp",
- "title", "Tableau de bord projet", "projects", projectResult.getAll(),
- "quotations", quotationResult.getAll(), "taskMap", taskMap, "extensions",
- Extensions.extensions);
- }
+ return messages;
}
public Render multiProjectFilter(ChoremClient client, Date from, Date to) {
@@ -129,38 +217,55 @@
, now.getActualMaximum(Calendar.DAY_OF_MONTH));
from = gFrom.getTime();
to = gTo.getTime();
-
+
}
- WikittyQueryMaker quotationQueryMaker = new WikittyQueryMaker();
- WikittyQuery quotationQuery = quotationQueryMaker.or()
- .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
- .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, to)
- .end();
- WikittyQueryResult<Quotation> result =
- client.findAllByQuery(Quotation.class, quotationQuery);
- Collection<Quotation> quotations = result.getAll();
+ Configuration config = client.findAllByQuery(Configuration.class,
+ (new WikittyQueryMaker()).exteq(Configuration.EXT_CONFIGURATION).end()
+ ).get(0);
- HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
- for(Quotation q : quotations) {
- QuotationCalculation calc = new QuotationCalculation(q, client);
- calc.calculate();
- calculations.put(q, calc);
- }
-
- return renderView("dashboardMultiProject.jsp",
- "title", "Tableau de bord projets",
- "quotations", quotations,
- "calculations", calculations);
-
+ WikittyQueryMaker quotationQueryMaker = new WikittyQueryMaker();
+ WikittyQuery quotationQuery = quotationQueryMaker.or()
+ .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
+ .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, from, 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.setSrp(config.getDailyReturn());
+ calc.calculate();
+ calculations.put(q, calc);
+ }
+
+
+ return renderView("dashboardMultiProject.jsp",
+ "title", "Tableau de bord projets",
+ "quotations", quotations,
+ "calculations", calculations);
+
+
}
-
-
- public Render requestProject(ChoremClient client, String project_id, String quotationFilter) {
- return projectFilter(client, project_id, quotationFilter);
+
+
+ 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);
@@ -184,31 +289,33 @@
List<JTask> lTask = new ArrayList<JTask>();
for(Task t : taskResult.getAll()) {
- if(t.getStatus().equals("SCHEDULED")) {
- customClass = "ganttBlue";
- }
- else if(t.getStatus().equals("STARTED")) {
- customClass = "ganttGreen";
- }
- else if(t.getStatus().equals("FINISHED")) {
- customClass = "ganttRed";
- }
- else if(t.getStatus().equals("CLOSED")) {
- customClass = "ganttGrey";
- }
+ if(t.getBeginDate() != null && t.getEndDate() != null) {
+ if(t.getStatus().equals("SCHEDULED")) {
+ customClass = "ganttBlue";
+ }
+ else if(t.getStatus().equals("STARTED")) {
+ customClass = "ganttGreen";
+ }
+ else if(t.getStatus().equals("FINISHED")) {
+ customClass = "ganttRed";
+ }
+ else if(t.getStatus().equals("CLOSED")) {
+ customClass = "ganttGrey";
+ }
- Values[] v = null;
- //if(t.getReestimatedEnd() != null)
- // v= new Values[2];
- //else
+ Values[] v = null;
+ //if(t.getReestimatedEnd() != null)
+ // v= new Values[2];
+ //else
v = new Values[1];
- v[0] = new Values(t.getBeginDate(), t.getEndDate(), t.getName(), customClass);
- //if(t.getReestimatedEnd() != null)
- // v[1]= new Values(t.getEndDate(), t.getReestimatedEnd(), "Reestimated end", "ganttOrange");
+ v[0] = new Values(t.getBeginDate(), t.getEndDate(), t.getName(), customClass);
+ //if(t.getReestimatedEnd() != null)
+ // v[1]= new Values(t.getEndDate(), t.getReestimatedEnd(), "Reestimated end", "ganttOrange");
- JTask jt = new JTask(t.getName(), t.getDescription(), t.getWikittyId(),t.getPrice(), t.getEstimatedDays(), v);
+ JTask jt = new JTask(t.getName(), t.getDescription(), t.getWikittyId(),t.getPrice(), t.getEstimatedDays(), v);
- lTask.add(jt);
+ lTask.add(jt);
+ }
}
Collections.sort(lTask);
@@ -232,9 +339,9 @@
while(i.hasNext()) {
Map.Entry<String, String> me = (Map.Entry<String, String>)i.next();
if(wikitty.hasExtension(me.getValue())) {
- extDate.put(
- me.getValue() + " " + me.getKey(),
- "/Date(" + ((Date) (wikitty.getFieldAsObject(me.getValue(), me.getKey()))).getTime() +")/");
+ Date date = ((Date) (wikitty.getFieldAsObject(me.getValue(), me.getKey())));
+ if(date != null)
+ extDate.put(me.getValue() + " " + me.getKey(), "/Date(" + date.getTime() +")/");
}
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java 2013-07-01 12:32:53 UTC (rev 357)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java 2013-07-02 16:04:44 UTC (rev 358)
@@ -17,23 +17,33 @@
private Quotation q;
private ChoremClient client;
- private static final int SEC_PER_HOUR = 3600;
- private static final int WORKING_HOURS_PER_DAY = 7;
- private Double tjm = null;
- private Double realDays = null;
- private Double deltaDays = null;
- private Double realTjm = null;
+ private static final int SEC_PER_HOUR = 3600;
+ private static final int WORKING_HOURS_PER_DAY = 7;
+ private double srp = 1;
+ private Double tjm = null;
+ private Double realDays = null;
+ private Double deltaDays = null;
+ private Double realTjm = null;
+ private Double expectedProfit = null;
+ private Double lossOrProfit = null;
+ private Double resultPerDay = null;
+
+
public QuotationCalculation(Quotation q, ChoremClient client) {
this.q = q;
this.client = client;
}
+
public void calculate() {
this.tjm = tjm();
this.realDays = realDays();
this.deltaDays = deltaDays();
this.realTjm = realTjm();
+ this.expectedProfit = expectedProfit();
+ this.lossOrProfit = lossOrProfit();
+ this.resultPerDay = resultPerDay();
}
public double tjm() {
@@ -51,7 +61,7 @@
public double realDays() {
//test if quotation is finished
if(q.getExtensionNames().contains("Closed")) {
- //TODO calcul grâce aux objets Time
+ //Calculate the days from the times objects
WikittyQuery taskQuery = new WikittyQueryMaker()
.eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
.end();
@@ -75,7 +85,7 @@
return (totalTime / SEC_PER_HOUR) / WORKING_HOURS_PER_DAY;
}
else {
- //nbDays + otherdays
+ //nbDays + day extensions from tasks
WikittyQuery taskQuery = new WikittyQueryMaker()
.eq(Task.ELEMENT_FIELD_TASK_QUOTATION, q)
.end();
@@ -93,7 +103,7 @@
}
public double deltaDays() {
- return q.getEstimatedDays() - getRealDays();
+ return getRealDays() - q.getEstimatedDays();
}
public double realTjm() {
@@ -103,6 +113,20 @@
return amount/nbDays;
}
+ public double expectedProfit() {
+ double nbDays = q.getEstimatedDays();
+ return (getTjm() - srp) * nbDays;
+ }
+
+ public double lossOrProfit() {
+ double amount = q.getAmount();
+ return amount - (getRealDays() * srp);
+ }
+
+ public double resultPerDay() {
+ return getLossOrProfit() / getRealDays();
+ }
+
public double getTjm() {
if(tjm == null)
return tjm();
@@ -127,5 +151,26 @@
else
return realTjm;
}
+ public double getExpectedProfit() {
+ if(expectedProfit == null)
+ return expectedProfit();
+ else
+ return expectedProfit;
+ }
+ public double getLossOrProfit() {
+ if(lossOrProfit == null)
+ return lossOrProfit();
+ else
+ return lossOrProfit;
+ }
+ public double getResultPerDay() {
+ if(resultPerDay == null)
+ return resultPerDay();
+ else
+ return resultPerDay;
+ }
+ public void setSrp(double val) {
+ this.srp = val;
+ }
}
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-01 12:32:53 UTC (rev 357)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-02 16:04:44 UTC (rev 358)
@@ -33,28 +33,9 @@
<div class="control-group">
<div class="controls" style="display: inline">
-<!--
- <script>
- $(function() {
- $("#project_text")
- .autocompleteByExtension(
- {
- source : "/chorem/wikitty-json/search?extension=Project",
- minLength : 2,
- select : function(event, ui) {
- $("#project_text").val(
- ui.item.label);
- $("#project_hidden")
- .val(ui.item.id);
- $("#project_hidden").change()
- return false;
- }
- });
- });
- </script>
- -->
- From : <input type="text" name="from" id="from" class="datepicker" value="${fn:escapeXml(from)}" />
- to : <input type="text" name="to" id="to" class="datepicker" value="${fn:escapeXml(to)}" />
+
+ From : <input type="text" name="from" id="from" class="datepicker" value='${param.from}' />
+ to : <input type="text" name="to" id="to" class="datepicker" value="${param.to}" />
<input type="submit"/>
</div>
</div>
@@ -67,17 +48,18 @@
<th>Client</th>
<th>Projet</th>
<th>Montant</th>
- <th>NbJour</th>
- <th>TJM</th>
- <th>NbJourReel</th>
- <th>delta jour</th>
- <th>tjm reel</th>
-
+ <th>Nombre de jours estimés</th>
+ <th><abbr title="Taux journalier moyen">TJM</abbr></th>
+ <th>Nombre de jours rééls</th>
+ <th>Différence estimation/réél</th>
+ <th><abbr title="Taux journalier moyen">TJM</abbr> reel</th>
+ <th>Gain attendu</th>
+ <th>Perte/gain</th>
</tr>
</thead>
<c:forEach var="q" items="${quotations}">
<tbody>
- <tr>
+ <tr><f:setLocale value="fr_FR"/>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></td>
<td><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/>
<a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i
@@ -85,7 +67,7 @@
</td>
<td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
<td class="number"><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
- <f:setLocale value="en_US"/>
+
<td class="number"> <f:formatNumber type="number"
maxFractionDigits="2" value="${calculations[q].getTjm()}" /></td>
<td class="number"> <f:formatNumber type="number"
@@ -95,6 +77,11 @@
<td class="number"> <f:formatNumber type="number"
maxFractionDigits="2" value="${calculations[q].getRealTjm()}" /></td>
+ <td class="currency"> <f:formatNumber type="currency"
+ maxFractionDigits="2" value="${calculations[q].getExpectedProfit()}" /></td>
+ <td class="currency"> <f:formatNumber type="currency"
+ maxFractionDigits="2" value="${calculations[q].getLossOrProfit()}" /></td>
+
</tr>
</tbody>
</c:forEach>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-01 12:32:53 UTC (rev 357)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSingleProject.jsp 2013-07-02 16:04:44 UTC (rev 358)
@@ -29,12 +29,26 @@
<link rel="stylesheet" href="<c:url value='/css/jquery.fn.gantt.css'/>" />
<h1>${title}</h1>
+
<form class="well form-inline" method="GET" id="projectSearch">
<div class="control-group">
- Project Name :
<div class="controls" style="display: inline">
-
+ <select class="filterBox" name="quotationFilter" id="quotationFilter">
+ <option value="open"
+ <c:if test='${param.quotationFilter=="open"}'>selected</c:if>>Devis
+ ouverts</option>
+ <option value="all"
+ <c:if test='${param.quotationFilter=="all"}'>selected</c:if>>Tous
+ les devis</option>
+ <c:forEach var="p" items="${projects}">
+ <c:forEach var="q" items="${quotations[p]}">
+ <option value="${q.wikittyId}"
+ <c:if test='${param.quotationFilter.equals(q.wikittyId)}'>selected</c:if>>${p.name}
+ - ${q.description}</option>
+ </c:forEach>
+ </c:forEach>
+ </select>
<script>
$(function() {
$("#project_text")
@@ -55,33 +69,27 @@
</script>
<input type="text" id="project_text" name="project_name"
- value="${param.project_name}" placeholder="project name" /> <input
- type="hidden" id="project_hidden" name="project_id"
- value="${param.project_id}" /> <select class="filterBox"
- name="quotationFilter" id="quotationFilter">
- <option name="open">Devis ouverts</option>
- <option name="all"
- <c:if test='${param.quotationFilter=="Tous les devis" }'>selected</c:if>>Tous
- les devis</option>
- </select>
+ value="${param.project_name}" placeholder="project name" />
+ <input type="hidden" id="project_hidden" name="project_id"
+ value='<c:if test='${!param.project_name.equals("") }'>${param.project_id}</c:if>' />
+
</div>
</div>
</form>
-<c:choose>
- <c:when test="${projects.size() >= 1}">
- <c:forEach var="p" items="${projects}">
- <h2 style="display: inline;">${p.name}</h2>
- <a href="<c:url value="/wikitty/edit/${param.project_id}"/>"><i
- class="icon-pencil icon-black"></i><small>edit</small></a>
- <p>${p.description}</p>
- </c:forEach>
+<c:forEach var="p" items="${projects}">
+ <c:if test="${not empty quotations[p]}">
+ <h2 style="display: inline;">${p.name}</h2>
+ <a href="<c:url value="/wikitty/edit/${param.project_id}"/>"><i
+ class="icon-pencil icon-black"></i><small>edit</small></a>
+ <p>${p.description}</p>
- <c:forEach var="q" items="${quotations}">
-
+
+ <c:forEach var="q" items="${quotations[p]}">
+
<h3 style="display: inline;">
<w:display wikitty="${q.wikitty}" fqfield="Quotation.description"
label="" />
@@ -89,17 +97,18 @@
<a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i
class="icon-pencil icon-black"></i><small>edit</small></a>
<p>
- Du <w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate"
- label="" pattern="dd/MM/yyyy"/>
- au <w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate"
+ Du
+ <w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate"
label="" pattern="dd/MM/yyyy" />
+ au
+ <w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate"
+ label="" pattern="dd/MM/yyyy" />
<br />Statut :
${q.wikitty.extensionNames.toArray()[q.wikitty.extensionNames.size()
-1]}
</p>
+
-
-
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
@@ -132,12 +141,11 @@
</tbody>
</table>
-
+ ${alerts[q]}
+ <div class="gantt gantt-${q.wikittyId}" wikittyId="${q.wikittyId}"
+ data=''>Pas de tâche</div>
+ <!--
- <div class="gantt gantt-${q.wikittyId}" wikittyId = "${q.wikittyId}" data=''>
- Pas de tâche</div>
-<!--
-
<p>Liste des tâches :</p>
<c:forEach items="${taskMap}" var="entry">
<c:if test="${entry.key.equals(q)}">
@@ -173,22 +181,10 @@
-->
</c:forEach>
- </c:when>
+ </c:if>
+</c:forEach>
- <c:otherwise>
- <c:if
- test="${param.project_id != null && param.projectname.length() != 0 }">
- Projet inexistant
- </c:if>
-
- </c:otherwise>
-
-
-</c:choose>
-
-
-
<script src="<c:url value='/js/jquery.fn.gantt.js'/>"></script>
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-07-01 12:32:53 UTC (rev 357)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-07-02 16:04:44 UTC (rev 358)
@@ -754,7 +754,6 @@
$("#projectSearch").submit();
});
$("#quotationFilter").change(function() {
- if($("#project_hidden").val() != "")
$("#projectSearch").submit();
});
function initgantt(id) {
1
0
r357 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/project webapp/WEB-INF/jsp
by meynier@users.chorem.org 01 Jul '13
by meynier@users.chorem.org 01 Jul '13
01 Jul '13
Author: meynier
Date: 2013-07-01 14:32:53 +0200 (Mon, 01 Jul 2013)
New Revision: 357
Url: http://chorem.org/projects/chorem/repository/revisions/357
Log:
updated multi-project dashboard
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/QuotationCalculation.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
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-07-01 10:51:28 UTC (rev 356)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-07-01 12:32:53 UTC (rev 357)
@@ -1,10 +1,12 @@
package org.chorem.webmotion.actions.project;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -119,7 +121,16 @@
public Render multiProjectFilter(ChoremClient client, Date from, Date to) {
System.out.println(from + "," + to);
- if(from != null && to != null) {
+ 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();
+
+ }
WikittyQueryMaker quotationQueryMaker = new WikittyQueryMaker();
WikittyQuery quotationQuery = quotationQueryMaker.or()
.bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, from, to)
@@ -132,18 +143,17 @@
HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
for(Quotation q : quotations) {
- calculations.put(q, new QuotationCalculation(q, client));
+ QuotationCalculation calc = new QuotationCalculation(q, client);
+ calc.calculate();
+ calculations.put(q, calc);
}
+
return renderView("dashboardMultiProject.jsp",
"title", "Tableau de bord projets",
"quotations", quotations,
"calculations", calculations);
- }
- else {
- return renderView("dashboardMultiProject.jsp",
- "title", "Tableau de bord projets");
- }
+
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java 2013-07-01 10:51:28 UTC (rev 356)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationCalculation.java 2013-07-01 12:32:53 UTC (rev 357)
@@ -19,11 +19,23 @@
private ChoremClient client;
private static final int SEC_PER_HOUR = 3600;
private static final int WORKING_HOURS_PER_DAY = 7;
+ private Double tjm = null;
+ private Double realDays = null;
+ private Double deltaDays = null;
+ private Double realTjm = null;
public QuotationCalculation(Quotation q, ChoremClient client) {
this.q = q;
this.client = client;
}
+
+ public void calculate() {
+ this.tjm = tjm();
+ this.realDays = realDays();
+ this.deltaDays = deltaDays();
+ this.realTjm = realTjm();
+ }
+
public double tjm() {
double amount = q.getAmount();
double nbDays = q.getEstimatedDays();
@@ -32,8 +44,8 @@
}
- private double getSecondPeriod(Date start, Date end) {
- return end.getTime()-start.getTime();
+ private double getPeriodInSeconds(Date start, Date end) {
+ return (end.getTime()-start.getTime())/1000;
}
public double realDays() {
@@ -49,16 +61,16 @@
Collection<Time> times = new ArrayList<Time>();
for(Task t : result.getAll()) {
WikittyQuery timeQuery = new WikittyQueryMaker()
- .eq(Time.ELEMENT_FIELD_TIME_TASK, q)
+ .eq(Time.ELEMENT_FIELD_TIME_TASK, t)
.end();
WikittyQueryResult timeResult = client.findAllByQuery(Time.class, timeQuery);
- System.out.println("RESULT : " + timeResult);
times.addAll(timeResult.getAll());
}
- System.out.println(times);
double totalTime = 0;
for(Time t : times) {
- totalTime += getSecondPeriod(t.getBeginDate(), t.getEndDate());
+ System.out.println("HEURE TRAVAILLEES : "
+ + (getPeriodInSeconds(t.getBeginDate(), t.getEndDate())/SEC_PER_HOUR) );
+ totalTime += getPeriodInSeconds(t.getBeginDate(), t.getEndDate());
}
return (totalTime / SEC_PER_HOUR) / WORKING_HOURS_PER_DAY;
}
@@ -81,14 +93,39 @@
}
public double deltaDays() {
- return q.getEstimatedDays() - realDays();
+ return q.getEstimatedDays() - getRealDays();
}
public double realTjm() {
double amount = q.getAmount();
- double nbDays = realDays();
+ double nbDays = getRealDays();
return amount/nbDays;
}
+ public double getTjm() {
+ if(tjm == null)
+ return tjm();
+ else
+ return tjm;
+ }
+ public double getRealDays() {
+ if(realDays == null)
+ return realDays();
+ else
+ return realDays;
+ }
+ public double getDeltaDays() {
+ if(deltaDays == null)
+ return deltaDays;
+ else
+ return deltaDays;
+ }
+ public double getRealTjm() {
+ if(realTjm == null)
+ return realTjm();
+ else
+ return realTjm;
+ }
+
}
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-01 10:51:28 UTC (rev 356)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardMultiProject.jsp 2013-07-01 12:32:53 UTC (rev 357)
@@ -53,8 +53,8 @@
});
</script>
-->
- From : <input type="text" name="from" id="from" class="datepicker" />
- to : <input type="text" name="to" id="to" class="datepicker" />
+ From : <input type="text" name="from" id="from" class="datepicker" value="${fn:escapeXml(from)}" />
+ to : <input type="text" name="to" id="to" class="datepicker" value="${fn:escapeXml(to)}" />
<input type="submit"/>
</div>
</div>
@@ -85,13 +85,20 @@
</td>
<td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
<td class="number"><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
- <td class="number">${calculations[q].tjm()}</td>
- <td class="number">${calculations[q].realDays()}</td>
- <td class="number">${calculations[q].deltaDays()}</td>
- <td class="number">${calculations[q].realTjm()}</td>
+ <f:setLocale value="en_US"/>
+ <td class="number"> <f:formatNumber type="number"
+ maxFractionDigits="2" value="${calculations[q].getTjm()}" /></td>
+ <td class="number"> <f:formatNumber type="number"
+ maxFractionDigits="2" value="${calculations[q].getRealDays()}" /></td>
+ <td class="number"> <f:formatNumber type="number"
+ maxFractionDigits="2" value="${calculations[q].getDeltaDays()}" /></td>
+ <td class="number"> <f:formatNumber type="number"
+ maxFractionDigits="2" value="${calculations[q].getRealTjm()}" /></td>
+
</tr>
</tbody>
</c:forEach>
</table>
+
1
0
r356 - trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions
by bpoussin@users.chorem.org 01 Jul '13
by bpoussin@users.chorem.org 01 Jul '13
01 Jul '13
Author: bpoussin
Date: 2013-07-01 12:51:28 +0200 (Mon, 01 Jul 2013)
New Revision: 356
Url: http://chorem.org/projects/chorem/repository/revisions/356
Log:
amelioration du choix de la profondeur pour les categories de budget
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-06-29 23:56:49 UTC (rev 355)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-07-01 10:51:28 UTC (rev 356)
@@ -987,12 +987,12 @@
data.add(false, i);
}
- if (depth != null) {
+ if (depth != null && depth > 0) {
// on supprime les profondeurs non demandees
Category lastCategory = null;
for (Iterator<WikittyQueryResultTreeNode<Category>> i=data.getCategoriesTree().iterator(); i.hasNext();) {
WikittyQueryResultTreeNode<Category> c = i.next();
- if (c.getLevel() <= depth) {
+ if (c.getLevel() < depth) {
lastCategory = c.getUserObject();
} else {
i.remove();
1
0