r332 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions resources webapp/WEB-INF/jsp
Author: bpoussin Date: 2013-03-22 12:58:09 +0100 (Fri, 22 Mar 2013) New Revision: 332 Url: http://chorem.org/projects/chorem/repository/revisions/332 Log: ajout possibilite de cacher les dates du filtre de recherche par defaut ajout possibilite de creer des TransactionFinancial directement a partir du tableau de budget Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java trunk/chorem-webmotion/src/main/resources/mapping trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-03-18 18:03:53 UTC (rev 331) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-03-22 11:58:09 UTC (rev 332) @@ -708,33 +708,49 @@ // //////////////////////////////////////////////////////////////////////////// + /** + * + * @param client + * @param title + * @param filter le filtre de la method dashboard appelante + * @param noUseDate indique de ne pas utiliser les dates, mais seulement filter et query + * @param start si noUseDate est false est utilise pour filtrer suivant les dates + * si start est null alors la 1 janvier de l'annee courante est pris + * @param end si noUseDate est false est utilise pour filtrer suivant les dates + * si end est null alors le 31 decembre de l'annee courante est pris + * @param query le filtre de l'utilisateur + * @return + */ protected Render invoiceFilter(ChoremClient client, String title, - String filter, Date start, Date end, String query) { - if (start == null) { - start = new Date(); - start = DateUtils.setMonths(start, Calendar.JANUARY); - } - - if (end == null) { - end = DateUtils.setMonths(start, Calendar.DECEMBER); - } - - start = DateUtil.setMinTimeOfDay(start); - end = DateUtil.setMaxTimeOfDay(end); - + String filter, boolean useDate, Date start, Date end, String query) { // recuperation des factures - WikittyQuery invoiceQuery = new WikittyQueryMaker().and() + WikittyQueryMaker maker = new WikittyQueryMaker().and() .parse(filter) .parse(query) .exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) - .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()) - .or() - .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end) - .isNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE) - .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start, end) - .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end) - .end().setLimit(WikittyQuery.MAX); + .ne(Invoice.FQ_FIELD_INVOICE_STATUS, InvoiceStatus.CANCELED.name()); + if (useDate) { + if (start == null) { + start = new Date(); + start = DateUtils.setMonths(start, Calendar.JANUARY); + } + + if (end == null) { + end = DateUtils.setMonths(start, Calendar.DECEMBER); + } + + start = DateUtil.setMinTimeOfDay(start); + end = DateUtil.setMaxTimeOfDay(end); + + maker.or() + .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end) + .isNull(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE) + .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EXPECTEDDATE, start, end) + .bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYMENTDATE, start, end); + } + WikittyQuery invoiceQuery = maker.end().setLimit(WikittyQuery.MAX); + ChoremQueryHelper.addSort(client, invoiceQuery, FinancialTransaction.EXT_FINANCIALTRANSACTION); WikittyQueryResult<FinancialTransaction> invoices = @@ -770,22 +786,22 @@ ); } - public Render invoiceDebt(ChoremClient client, + public Render invoiceDebt(ChoremClient client, boolean useDate, Date start, Date end, String query) { String title = "Factures à payer par la société"; String companyId = client.getConfiguration().getDefaultCompany(); String filter = FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_PAYER + "={SELECT id WHERE (" + Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+" OR id=" + companyId + ")}"; - return invoiceFilter(client, title, filter, start, end, query); + return invoiceFilter(client, title, filter, useDate, start, end, query); } - public Render invoiceIncome(ChoremClient client, + public Render invoiceIncome(ChoremClient client, boolean useDate, Date start, Date end, String query) { String title = "Factures émises par la société"; String companyId = client.getConfiguration().getDefaultCompany(); String filter = FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_BENEFICIARY + "={SELECT id WHERE (" + Employee.FQ_FIELD_EMPLOYEE_COMPANY + "=" + companyId+" OR id=" + companyId + ")}"; - return invoiceFilter(client, title, filter, start, end, query); + return invoiceFilter(client, title, filter, useDate, start, end, query); } public Render profitability(ChoremClient client, @@ -960,7 +976,7 @@ if (log.isDebugEnabled()) { log.debug("budget data\n\t dates: " + data.getDates() + "\n\t rootTree: " + rootCategory + "\n\t categoriesTree: " + categoriesTree); } - return renderView("dashboardBudget.jsp", + return renderView("dashboardBudget.jsp", "companyId", companyId, "data", data); } Modified: trunk/chorem-webmotion/src/main/resources/mapping =================================================================== --- trunk/chorem-webmotion/src/main/resources/mapping 2013-03-18 18:03:53 UTC (rev 331) +++ trunk/chorem-webmotion/src/main/resources/mapping 2013-03-22 11:58:09 UTC (rev 332) @@ -42,7 +42,7 @@ * /wikitty-json/search?term={query} action:GenericAction.searchJson * /wikitty-json/get/{id} action:GenericAction.getById * /wikitty-json/save action:GenericAction.saveJson -* /fragment/dashboard/{method} action:DashboardAction.{method} +* /fragment/dashboard/{method} action:DashboardAction.{method} useDate=true * /fragment/dashboardHR/{method} action:DashboardHRAction.{method} * /fragment/sales/{method} action:sales.SalesAction.{method} * /admin view:contact.jsp Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2013-03-18 18:03:53 UTC (rev 331) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2013-03-22 11:58:09 UTC (rev 332) @@ -44,13 +44,14 @@ <td class="currency"> <c:choose> <c:when test="${data.getInvoices(d, c.userObject).isEmpty()}"> - <span> + <span class="withPopover" + title='Aucune entrée <span><a href="<c:url value="/wikitty/FinancialTransaction/edit/new?FinancialTransaction.payer=${companyId}&FinancialTransaction.emittedDate=today&FinancialTransaction.expectedDate=01/${d}&FinancialTransaction.paymentDate=01/${d}&FinancialTransaction.category=${c.userObject.wikittyId}"/>"><li class="icon-plus"></li>Debt</a><span> <span><a href="<c:url value="/wikitty/FinancialTransaction/edit/new?FinancialTransaction.beneficiary=${companyId}&FinancialTransaction.emittedDate=today&FinancialTransaction.expectedDate=01/${d}&FinancialTransaction.paymentDate=01/${d}&FinancialTransaction.category=${c.userObject.wikittyId}"/>"><li class="icon-plus"></li>Income</a><span>'> <f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/> </span> </c:when> <c:otherwise> <span class="withPopover" - title='Detail pour <f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/>' + title='Detail pour <f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/> <span><a href="<c:url value="/wikitty/FinancialTransaction/edit/new?FinancialTransaction.payer=${companyId}&FinancialTransaction.emittedDate=today&FinancialTransaction.expectedDate=01/${d}&FinancialTransaction.paymentDate=01/${d}&FinancialTransaction.category=${c.userObject.wikittyId}"/>"><li class="icon-plus"></li>Debt</a><span> <span><a href="<c:url value="/wikitty/FinancialTransaction/edit/new?FinancialTransaction.beneficiary=${companyId}&FinancialTransaction.emittedDate=today&FinancialTransaction.expectedDate=01/${d}&FinancialTransaction.paymentDate=01/${d}&FinancialTransaction.category=${c.userObject.wikittyId}"/>"><li class="icon-plus"></li>Income</a><span>' data-content='<w:display wikitties="${data.getInvoices(d, c.userObject)}" toString="<span class=\"withTooltip\" title=\"%FinancialTransaction.category$s: %FinancialTransaction.payer$s -> %FinancialTransaction.beneficiary$s\">%FinancialTransaction.reference|noref$s: %FinancialTransaction.amount|0.0$,.2f</span>"/>'> <f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/> </span> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-03-18 18:03:53 UTC (rev 331) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-03-22 11:58:09 UTC (rev 332) @@ -41,7 +41,7 @@ factures à payer</a> pour un montant de <f:formatNumber type="currency" value="${invoiceDebt}"/></li> <li>Il y a ${invoiceIncomeNb} - <a href='<c:url value="/report?report=invoiceIncome&start=01/01/2000&end=01/01/2222&query=FinancialTransaction.paymentDate=null and FinancialTransaction.expectedDate<NOW"/>'> + <a href='<c:url value="/report?report=invoiceIncome&useDate=false&query=FinancialTransaction.paymentDate=null and FinancialTransaction.expectedDate<NOW"/>'> factures impayées</a> pour un montant de <f:formatNumber type="currency" value="${invoiceIncome}"/></li> <li>Il y a ${touchNb} <a href='<c:url value="/wikitty/search?query=${touchQueryString}"/>'> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-03-18 18:03:53 UTC (rev 331) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/report.jsp 2013-03-22 11:58:09 UTC (rev 332) @@ -26,8 +26,11 @@ <form class="well form-inline"> <input type="hidden" name="report" value="${report}"/> - <input class="datepicker input-small" type="text" name="start" value="${fn:escapeXml(start)}" placeholder="date from"/> - <input class="datepicker input-small" type="text" name="end" value="${fn:escapeXml(end)}" placeholder="date to"/> + <input type="hidden" name="useDate" value="${useDate}" /> + <c:if test="${useDate != 'false'}"> + <input class="datepicker input-small" type="text" name="start" value="${fn:escapeXml(start)}" placeholder="date from"/> + <input class="datepicker input-small" type="text" name="end" value="${fn:escapeXml(end)}" placeholder="date to"/> + </c:if> <input class="input-xxlarge" type="text" name="query" value="${fn:escapeXml(query)}" placeholder="filter query"/> <input type="submit" class="btn"/> </form>
participants (1)
-
bpoussin@users.chorem.org