Changeset 547
- Timestamp:
- May 26, 2010, 3:50:50 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/i18n/messages.properties
r546 r547 315 315 316 316 # Reports 317 report.too.many.results.warning=Warning over {0} results, please run report again. 317 318 report.stock.take.overview=Stock Take (Overview) 318 319 report.stock.take.overview.help=Use this report to manage inventory stock take. Use in conjunction with the Stock Take (By Location) report. -
trunk/grails-app/services/InventoryReportService.groovy
r546 r547 13 13 def g = new org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib() 14 14 15 // def paramsMax = 10000015 def paramsMax = 250 16 16 17 17 /** … … 61 61 result.locations = result.locations.collect {it.trim()} 62 62 63 def paginateParams = [:] 64 paginateParams.max = Math.min(params?.max?.toInteger() ?: paramsMax, paramsMax) 65 63 66 def namedParams = [:] 64 67 namedParams.locationList = [null] // null protects against HQL unexpected end of subtree exception with an empty list. … … 71 74 } 72 75 76 // Return the actual locations as a string. 77 if(namedParams.locationList.size() > 1) 78 result.locations = namedParams.locationList[1..-1].toString()[1..-2] 79 else 80 result.locations = g.message(code: 'default.none.text') 81 82 // Inventory List. 83 result.inventoryListQuery = "from InventoryItem as inventoryItem \ 84 left join inventoryItem.inventoryLocation as inventoryLocation \ 85 where (inventoryItem.isActive = true \ 86 and inventoryItem.inventoryLocation in (:locationList) \ 87 ) " 88 89 result.inventoryCountQuery = "select count(distinct inventoryItem) " + result.inventoryListQuery 90 result.inventoryItemCount = InventoryItem.executeQuery(result.inventoryCountQuery, namedParams)[0] 91 92 // Exit if too many results. 93 result.countWarning = null 94 if(result.inventoryItemCount > paramsMax) { 95 result.countWarning = g.message(code: 'report.too.many.results.warning', 96 args: [paramsMax], 97 default: "Warning over ${paramsMax} results, please run report again!") 98 result.inventoryItemList = [] 99 return result 100 } 101 102 result.inventoryListQuery = "select distinct inventoryItem " + result.inventoryListQuery 103 def inventoryList = InventoryItem.executeQuery(result.inventoryListQuery, namedParams, paginateParams) 104 105 // Reset namedParams for next query. 106 namedParams = [:] 107 namedParams.inventoryList = inventoryList 108 73 109 // Note: HQL docs advise not using fetch aliases in where clause (or any other clause). 74 110 // Access is via the parent object, however that does not work for the order by clause in this case. … … 79 115 left join fetch inventoryItem.picture as picture \ 80 116 left join fetch picture.images as Image \ 81 where (inventoryItem.isActive = true \ 82 and inventoryItem.inventoryLocation in (:locationList) \ 117 where (inventoryItem in (:inventoryList) \ 83 118 ) \ 84 119 order by inventoryStore.name, inventoryLocation.name" 85 120 86 result.query = "select distinct inventoryItem " + result.query 87 result.queryResult = InventoryLocation.executeQuery(result.query, namedParams) 88 result.inventoryItemCount = result.queryResult.size() 89 90 // Return the actual locations as a string. 91 if(namedParams.locationList.size() > 1) 92 result.locations = namedParams.locationList[1..-1].toString()[1..-2] 93 else 94 result.locations = g.message(code: 'default.none.text') 95 96 result.inventoryItemList = result.queryResult 121 result.query = "select inventoryItem " + result.query 122 result.inventoryItemList = InventoryItem.executeQuery(result.query, namedParams, paginateParams) 97 123 98 124 // Success. -
trunk/grails-app/views/inventoryItemPurchaseDetailed/edit.gsp
r518 r547 40 40 41 41 <tr class="prop"> 42 <td valign="top" class="name">Purchase Order Number:</td> 43 44 <td valign="top" class="value">${fieldValue(bean:inventoryItemPurchaseInstance, field:'purchaseOrderNumber')}</td> 45 42 <td valign="top" class="name"> 43 <label for="invoiceNumber">Purchase Order Number:</label> 44 </td> 45 <td valign="top" class="value ${hasErrors(bean:inventoryItemPurchaseInstance,field:'purchaseOrderNumber','errors')}"> 46 <input type="text" maxlength="50" id="purchaseOrderNumber" name="purchaseOrderNumber" value="${fieldValue(bean:inventoryItemPurchaseInstance,field:'purchaseOrderNumber')}"/> 47 </td> 46 48 </tr> 47 49 … … 139 141 </tr> 140 142 143 <tr class="prop"> 144 <td valign="top" class="name"> 145 <label for="comment">Comment:</label> 146 </td> 147 <td valign="top" class="value ${hasErrors(bean:inventoryItemPurchaseInstance,field:'comment','errors')}"> 148 <textarea rows="5" cols="40" name="comment">${fieldValue(bean:inventoryItemPurchaseInstance, field:'comment')}</textarea> 149 </td> 150 </tr> 151 141 152 </tbody> 142 153 </table> -
trunk/web-app/reports/stockTakeByLocation.jrxml
r546 r547 85 85 <field name="inventoryItemCount" class="java.lang.Integer"/> 86 86 <field name="locations" class="java.lang.String"/> 87 <field name="countWarning" class="java.lang.String"/> 87 88 <background> 88 89 <band splitType="Stretch"/> … … 105 106 <textElement textAlignment="Center" verticalAlignment="Middle" markup="none"/> 106 107 <textFieldExpression class="java.lang.String"><![CDATA["Inventory Items: "+$F{inventoryItemCount}+", Locations: "+$F{locations}+"."]]></textFieldExpression> 108 </textField> 109 <textField> 110 <reportElement mode="Opaque" x="400" y="4" width="382" height="46" isPrintWhenDetailOverflows="true" forecolor="#FF0000" backcolor="#FFCCCC"> 111 <printWhenExpression><![CDATA[$F{countWarning} != null ? true:false]]></printWhenExpression> 112 </reportElement> 113 <textElement textAlignment="Center" verticalAlignment="Middle"> 114 <font size="12" isBold="true"/> 115 </textElement> 116 <textFieldExpression class="java.lang.String"><![CDATA[$F{countWarning}]]></textFieldExpression> 107 117 </textField> 108 118 </band>
Note: See TracChangeset
for help on using the changeset viewer.