Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed performance issue with transaction report (#155) #156

Merged
merged 2 commits into from
Jun 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ app.grails.version=1.3.7
app.name=openboxes
app.revisionNumber=11160
app.servlet.version=2.4
app.version=0.7.10
app.version=0.7.11
plugins.barcode4j=0.2.1
plugins.bubbling=2.1.4
plugins.clickstream=0.2.0
Expand Down
272 changes: 137 additions & 135 deletions grails-app/views/report/showTransactionReport.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</td>
</tr>
<tr>
<td>
<td>
<format:product product="${command?.product }"/>
<g:hiddenField name="product.id" value="${command?.product?.id }"/>
</td>
Expand All @@ -62,8 +62,9 @@
</td>
</tr>
<tr>
<td>
<g:selectLocation class="filter" name="location.id" noSelection="['null':'']" maxChars="75" groupBy="locationType" value="${command?.location?.id}"/>
<td>
<g:selectLocation class="chzn-select-deselect" name="location.id"
noSelection="['null':'']" maxChars="75" groupBy="locationType" value="${command?.location?.id}"/>
</td>
</tr>
<tr>
Expand All @@ -74,11 +75,10 @@
</td>
</tr>
<tr>
<td>
<select id="category.id" name="category.id" class="filter">
<option value=""></option>
<g:render template="../category/selectOptions" model="[category:command.rootCategory, selected:command.category, level: 0]"/>
</select>
<td>
<g:selectCategory id="category.id" name="category.id"
class="chzn-select-deselect" value="${command?.category?.id}" noSelection="['':'']"/>

</td>
</tr>
<tr>
Expand All @@ -91,7 +91,7 @@
<tr>
<td>
<g:jqueryDatePicker class="filter" id="startDate" name="startDate" value="${command?.startDate }" format="MM/dd/yyyy"/>
-
-
<g:jqueryDatePicker class="filter" id="endDate" name="endDate" value="${command?.endDate }" format="MM/dd/yyyy"/>

</td>
Expand Down Expand Up @@ -149,7 +149,7 @@
</td>
</g:if>

<%--

<g:else>
<div class="title">
<warehouse:message code="report.transactionReport.title"/>
Expand Down Expand Up @@ -187,7 +187,7 @@
</tr>
</table>
</g:else>
--%>



<td>
Expand All @@ -203,137 +203,139 @@
<g:set var="i" value='${0 }'/>
<g:each var="entry" in="${command?.entries }">
<g:if test="${command?.product == entry?.value?.product}">
<div class="box">
<table>
<tr>
<td>
<h1 style="display:inline;">
${entry.key }&nbsp;
<span class="circle">${entry.value.entries*.value.quantityRunning.sum() }</span>
</h1>
<g:link controller="report" action="generateTransactionReport" params="['location.id':command?.location?.id,'category.id':command?.category.id,'startDate':format.date(obj:command.startDate,format:'MM/dd/yyyy'),'endDate':format.date(obj:command.endDate,format:'MM/dd/yyyy'),'includeChildren':params.includeChildren]" style="display: inline">
<warehouse:message code="report.backToInventoryReport.label"/>
</g:link>
&nbsp;|&nbsp;
<g:link controller="report" action="generateTransactionReport" params="['product.id':command?.product?.id,'category.id':command?.category?.id,'location.id':command?.location?.id,startDate:params.startDate,endDate:params.endDate,showEntireHistory:true,'includeChildren':params.includeChildren]">
<warehouse:message code="report.showEntireHistory.label"/>
</g:link>
&nbsp;|&nbsp;
<g:link controller="inventoryItem" action="showStockCard" params="['product.id':product?.id]" fragment="inventory">
<warehouse:message code="report.showStockCard.label"/>
</g:link>
</td>
</tr>
</table>


</div>
<br/>
<g:each var="itemEntry" in="${entry.value.entries}">
<h2>
${itemEntry.key.lotNumber ?: 'EMPTY'}&nbsp;
<span class="circle">${itemEntry?.value?.quantityRunning}</span>
</h2>

<table style="border: 1px solid lightgrey" class="report">
<thead>
<tr class="${i++%2?'odd':'even' }">
<th>
<warehouse:message code="report.transactionDate.label"/>
</th>
<th>
<warehouse:message code="report.transactionType.label"/>
</th>
<th class="center">
<warehouse:message code="report.quantityChange.label"/>
</th>
<th class="center">
<warehouse:message code="report.quantityBalance.label"/>
</th>
</tr>
</thead>
<g:if test="${itemEntry.value.transactionEntries}">
<tbody>
<tr>
<td><format:date obj="${command?.startDate}"/></td>
<td><warehouse:message code="report.initialQuantity.label"/></td>
<td></td>
<td class="center">${itemEntry?.value?.quantityInitial }</td>
</tr>
<g:each var="row" in="${itemEntry.value.transactionEntries}">
<g:set var="transactionTypeCode" value="${row?.transactionEntry?.transaction?.transactionType?.transactionCode?.toString()?.toLowerCase()}"/>
<tr class="${i++%2?'odd':'even' }">
<td>
<format:date obj="${row.transactionEntry?.transaction?.transactionDate}"/>
</td>
<td>
<g:link controller="inventory" action="showTransaction" id="${row?.transactionEntry?.transaction?.id }">
<format:metadata obj="${row.transactionEntry?.transaction?.transactionType}"/>
</g:link>
</td>
<td class="center">
<span class="${transactionTypeCode}">${row.transactionEntry?.quantity }</span>
</td>
<td class="center">${row.balance }</td>
</tr>
</g:each>

</tbody>
<tfoot>
<tr>
<td><format:date obj="${command?.endDate}"/></td>
<td><warehouse:message code="report.finalQuantity.label"/></td>
<td></td>
<td class="center">${itemEntry?.value?.quantityFinal }</td>
</tr>
</tfoot>
</g:if>
<g:else>
<tbody>
<tr>
<td colspan="5">
<warehouse:message code="transaction.noTransactions.label"/>
</td>
</tr>
</tbody>
</g:else>
</table>
<br/>
</g:each>

<div class="box">

<div class="header">
<table>
<tr>
<td>
<h1 style="display:inline;">
${entry.key }&nbsp;
<span class="circle">${entry.value.entries*.value.quantityRunning.sum() }</span>
</h1>
<g:link controller="report" action="generateTransactionReport" params="['location.id':command?.location?.id,'category.id':command?.category.id,'startDate':format.date(obj:command.startDate,format:'MM/dd/yyyy'),'endDate':format.date(obj:command.endDate,format:'MM/dd/yyyy'),'includeChildren':params.includeChildren]" style="display: inline">
<warehouse:message code="report.backToInventoryReport.label"/>
</g:link>
&nbsp;|&nbsp;
<g:link controller="report" action="generateTransactionReport" params="['product.id':command?.product?.id,'category.id':command?.category?.id,'location.id':command?.location?.id,startDate:params.startDate,endDate:params.endDate,showEntireHistory:true,'includeChildren':params.includeChildren]">
<warehouse:message code="report.showEntireHistory.label"/>
</g:link>
&nbsp;|&nbsp;
<g:link controller="inventoryItem" action="showStockCard" params="['product.id':product?.id]" fragment="inventory">
<warehouse:message code="report.showStockCard.label"/>
</g:link>
</td>
</tr>
</table>


</div>
<br/>
<g:each var="itemEntry" in="${entry.value.entries}">
<h2>
${itemEntry.key.lotNumber ?: 'EMPTY'}&nbsp;
<span class="circle">${itemEntry?.value?.quantityRunning}</span>
</h2>

<table style="border: 1px solid lightgrey" class="report">
<thead>
<tr class="${i++%2?'odd':'even' }">
<th>
<warehouse:message code="report.transactionDate.label"/>
</th>
<th>
<warehouse:message code="report.transactionType.label"/>
</th>
<th class="center">
<warehouse:message code="report.quantityChange.label"/>
</th>
<th class="center">
<warehouse:message code="report.quantityBalance.label"/>
</th>
</tr>
</thead>
<g:if test="${itemEntry.value.transactionEntries}">
<tbody>
<tr>
<td><format:date obj="${command?.startDate}"/></td>
<td><warehouse:message code="report.initialQuantity.label"/></td>
<td></td>
<td class="center">${itemEntry?.value?.quantityInitial }</td>
</tr>
<g:each var="row" in="${itemEntry.value.transactionEntries}">
<g:set var="transactionTypeCode" value="${row?.transactionEntry?.transaction?.transactionType?.transactionCode?.toString()?.toLowerCase()}"/>
<tr class="${i++%2?'odd':'even' }">
<td>
<format:date obj="${row.transactionEntry?.transaction?.transactionDate}"/>
</td>
<td>
<g:link controller="inventory" action="showTransaction" id="${row?.transactionEntry?.transaction?.id }">
<format:metadata obj="${row.transactionEntry?.transaction?.transactionType}"/>
</g:link>
</td>
<td class="center">
<span class="${transactionTypeCode}">${row.transactionEntry?.quantity }</span>
</td>
<td class="center">${row.balance }</td>
</tr>
</g:each>

</tbody>
<tfoot>
<tr>
<td><format:date obj="${command?.endDate}"/></td>
<td><warehouse:message code="report.finalQuantity.label"/></td>
<td></td>
<td class="center">${itemEntry?.value?.quantityFinal }</td>
</tr>
</tfoot>
</g:if>
<g:else>
<tbody>
<tr>
<td colspan="5">
<warehouse:message code="transaction.noTransactions.label"/>
</td>
</tr>
</tbody>
</g:else>
</table>
<br/>
</g:each>
</div>
</g:if>
</g:each>
</g:if>
<g:else>
<div>
<div class="box">
<g:set var="status" value="${0 }"/>
<g:each var="productEntry" in="${command?.productsByCategory }" status="i">
<g:set var="category" value="${productEntry.key }"/>

<div class="box">

<table>
<tr>
<td class="left">

<h1 style="display:inline;">
<format:category category="${category}"/>
</h1>
<g:if test="${!params.print}">
&nbsp;
<g:link controller="report" action="generateTransactionReport" params="['location.id':command?.location?.id,'category.id':category?.id,'startDate':format.date(obj:command.startDate,format:'MM/dd/yyyy'),'endDate':format.date(obj:command.endDate,format:'MM/dd/yyyy'),'includeChildren':false,'insertPageBreakBetweenCategories':command?.insertPageBreakBetweenCategories,'showTransferBreakdown':command?.showTransferBreakdown,'hideInactiveProducts':command?.hideInactiveProducts]" style="display: inline">
<warehouse:message code="report.showThisCategoryOnly.label"/>
</g:link>
</g:if>
</td>
<td class="right">
<span class="fade">
${format.date(obj:command?.startDate, format: 'MMM dd, yyyy')} - ${format.date(obj:command?.endDate, format: 'MMM dd, yyyy')}
</span>
</td>
</tr>
</table>
</div>

<h2 class="middle">
<table>
<tr>
<td class="left">

<h1 style="display:inline;">
<format:category category="${category}"/>
</h1>
<g:if test="${!params.print}">
&nbsp;
<g:link controller="report" action="generateTransactionReport" params="['location.id':command?.location?.id,'category.id':category?.id,'startDate':format.date(obj:command.startDate,format:'MM/dd/yyyy'),'endDate':format.date(obj:command.endDate,format:'MM/dd/yyyy'),'includeChildren':false,'insertPageBreakBetweenCategories':command?.insertPageBreakBetweenCategories,'showTransferBreakdown':command?.showTransferBreakdown,'hideInactiveProducts':command?.hideInactiveProducts]" style="display: inline">
<warehouse:message code="report.showThisCategoryOnly.label"/>
</g:link>
</g:if>
</td>
<td class="right">
<span class="fade">
${format.date(obj:command?.startDate, format: 'MMM dd, yyyy')} - ${format.date(obj:command?.endDate, format: 'MMM dd, yyyy')}
</span>
</td>
</tr>
</table>
</h2>

<div class="list">
<table class="report">
<thead>
Expand Down