- Timestamp:
- May 24, 2010, 3:48:53 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/ReportController.groovy
r542 r544 48 48 params.logoUrl = grailsApplication.mainContext.getResource('images/logo.png').getURL() 49 49 params.currentUser = authService.currentUser 50 51 if(params.startDate == 'struct')52 params.startDate = dateUtilService.makeDate(params.startDate_year, params.startDate_month, params.startDate_day)53 else54 params.startDate = dateUtilService.today-755 50 params.startDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.startDate) 56 57 if(params.endDate == 'struct')58 params.endDate = dateUtilService.makeDate(params.endDate_year, params.endDate_month, params.endDate_day)59 else60 params.endDate = dateUtilService.today61 51 params.endDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.endDate) 62 52 … … 71 61 params.logoUrl = grailsApplication.mainContext.getResource('images/logo.png').getURL() 72 62 params.currentUser = authService.currentUser 73 74 if(params.startDate == 'struct')75 params.startDate = dateUtilService.makeDate(params.startDate_year, params.startDate_month, params.startDate_day)76 else77 params.startDate = dateUtilService.today-778 63 params.startDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.startDate) 79 80 if(params.endDate == 'struct')81 params.endDate = dateUtilService.makeDate(params.endDate_year, params.endDate_month, params.endDate_day)82 else83 params.endDate = dateUtilService.today84 64 params.endDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.endDate) 85 65 -
trunk/grails-app/services/TaskReportService.groovy
r542 r544 13 13 // def messageSource 14 14 15 //def g = new org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib()15 def g = new org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib() 16 16 17 17 def paramsMax = 100000 … … 174 174 175 175 result.taskQuery = "select distinct task " + result.taskQuery 176 result.task List = Task.executeQuery(result.taskQuery, namedParams)177 result.taskCount = result.task List.size()176 result.taskQueryList = Task.executeQuery(result.taskQuery, namedParams) 177 result.taskCount = result.taskQueryList.size() 178 178 179 179 // Assets on Tasks Count. 180 180 result.totalAssetsOnTasksCount = 0 181 result.totalDownTime = [total: 0, hours: 0, minutes:0] 181 182 result.assetList = [] 182 183 183 // Add or update asset details in assetList. 184 def addAssetToList = { asset, task -> 184 // Task Details 185 result.taskList = [] 186 187 // Add or update lists. 188 def addToLists = { asset, task -> 185 189 186 190 def downTime = 0 187 191 def faultEntries = Entry.findAllByTaskAndEntryType(task, EntryType.read(1)) 192 def causeEntries = Entry.findAllByTaskAndEntryType(task, EntryType.read(2)) 193 def workDoneEntries = Entry.findAllByTaskAndEntryType(task, EntryType.read(3)) 194 def taskDetails = 'Task #'+task.id+' - '+task.description+'\n' 195 faultEntries.each(){ 196 taskDetails += ' Faults: '+it.comment+' - '+it.enteredBy+', '+g.formatDate(format: "EEE, dd-MMM-yyyy", date: it.dateDone)+'.\n' 197 } 198 causeEntries.each(){ 199 taskDetails += ' Causes: '+it.comment+' - '+it.enteredBy+', '+g.formatDate(format: "EEE, dd-MMM-yyyy", date: it.dateDone)+'.\n' 200 } 201 workDoneEntries.each(){ 202 taskDetails += ' Work Done: '+it.comment+' - '+it.enteredBy+', '+g.formatDate(format: "EEE, dd-MMM-yyyy", date: it.dateDone)+'.\n' 203 } 204 188 205 faultEntries.each() { downTime += (it.durationHour*60 + it.durationMinute) } 206 result.totalDownTime.total += downTime 189 207 190 208 def assetDetails = result.assetList.find { it.id == asset.id } 191 209 if(assetDetails) { 192 210 assetDetails.immediateCalloutCount++ 193 assetDetails.immediateCalloutTaskList.add(task.toString()) 211 assetDetails.downTime += downTime 212 assetDetails.tasks += taskDetails 194 213 } 195 214 else { … … 198 217 immediateCalloutCount: 1, 199 218 downTime: downTime, 200 immediateCalloutTaskList: [task.toString()]]219 tasks: taskDetails] 201 220 202 221 result.assetList << assetDetails 203 222 } 204 } // addA ssetToList223 } // addAToLists 205 224 206 225 // Summary Of Calculations. … … 213 232 214 233 result.summaryOfCalculationMethod += 'totalAssetsOnTasksCount = A count of unique assets on each task. \n' 215 result.task List.each() { task ->234 result.taskQueryList.each() { task -> 216 235 if(task.primaryAsset) { 217 236 result.totalAssetsOnTasksCount++ 218 add AssetToList(task.primaryAsset, task)237 addToLists(task.primaryAsset, task) 219 238 } 220 239 task.associatedAssets.each() { associatedAsset -> 221 240 if(associatedAsset.id != task.primaryAsset?.id) { 222 241 result.totalAssetsOnTasksCount++ 223 add AssetToList(associatedAsset, task)242 addToLists(associatedAsset, task) 224 243 } 225 244 } … … 227 246 } // each() task 228 247 229 // Sort by callout count.248 // Sort assetList by callout count. 230 249 result.assetList.sort {a, b -> b.immediateCalloutCount.compareTo(a.immediateCalloutCount)} 250 251 // Calculate hours and minutes. 252 result.totalDownTime.hours = (result.totalDownTime.total / 60).toInteger() 253 result.totalDownTime.minutes = result.totalDownTime.total % 60 231 254 232 255 // Success. -
trunk/grails-app/views/appCore/start.gsp
r542 r544 107 107 name="Reactive Ratio" 108 108 format="PDF, XLS"> 109 <richui:dateChooser name="startDate" format="dd-MM-yyyy" value="${new Date()-7}" />109 <richui:dateChooser name="startDate" id="reactiveRatio_startDate" format="dd-MM-yyyy" value="${new Date()-7}" /> 110 110 to 111 <richui:dateChooser name="endDate" format="dd-MM-yyyy" value="${new Date()}" />111 <richui:dateChooser name="endDate" id="reactiveRatio_endDate" format="dd-MM-yyyy" value="${new Date()}" /> 112 112 </g:jasperReport> 113 113 <br /> … … 117 117 name="Immediate Callouts" 118 118 format="PDF, XLS"> 119 <richui:dateChooser name="startDate" format="dd-MM-yyyy" value="${new Date()-7}" />119 <richui:dateChooser name="startDate" id="immediateCallouts_startDate" format="dd-MM-yyyy" value="${new Date()-7}" /> 120 120 to 121 <richui:dateChooser name="endDate" format="dd-MM-yyyy" value="${new Date()}" />121 <richui:dateChooser name="endDate" id="immediateCallouts_endDate" format="dd-MM-yyyy" value="${new Date()}" /> 122 122 </g:jasperReport> 123 123 <br /> -
trunk/web-app/reports/immediateCallouts.jrxml
r542 r544 5 5 <property name="ireport.zoom" value="1.0"/> 6 6 <property name="ireport.x" value="0"/> 7 <property name="ireport.y" value="384"/> 7 <property name="ireport.y" value="218"/> 8 <import value="net.sf.jasperreports.engine.*"/> 8 9 <import value="java.util.*"/> 9 <import value="net.sf.jasperreports.engine.*"/>10 10 <import value="net.sf.jasperreports.engine.data.*"/> 11 11 <style name="Crosstab Data Text" isDefault="false" hAlign="Center"/> … … 63 63 <field name="name" class="java.lang.String"/> 64 64 <field name="immediateCalloutCount" class="java.lang.Integer"/> 65 <field name="immediateCalloutTaskList" class="java.util.List"/>66 65 <field name="downTime" class="java.lang.Integer"/> 66 <field name="tasks" class="java.lang.String"/> 67 67 <variable name="immediateCalloutSum" class="java.lang.Integer" calculation="Sum"> 68 68 <variableExpression><![CDATA[$F{immediateCalloutCount}]]></variableExpression> 69 </variable> 70 <variable name="downTimeSum" class="java.lang.Integer" calculation="Sum"> 71 <variableExpression><![CDATA[$F{downTime}]]></variableExpression> 69 72 </variable> 70 73 <group name="assetName"> … … 84 87 <field name="totalAssetsOnTasksCount" class="java.lang.String"/> 85 88 <field name="assetList" class="java.util.List"/> 89 <field name="totalDownTime" class="java.util.LinkedHashMap"/> 86 90 <background> 87 91 <band splitType="Stretch"/> … … 112 116 <detail> 113 117 <band height="394" splitType="Stretch"> 114 <componentElement>115 <reportElement key="table" style="table" x="0" y="0" width="377" height="394"/>116 <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">117 <datasetRun subDataset="dataset1">118 <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{assetList})]]></dataSourceExpression>119 </datasetRun>120 <jr:column width="160">121 <jr:columnHeader style="table_CH" height="30" rowSpan="1">122 <textField>123 <reportElement x="0" y="0" width="160" height="30"/>124 <textElement verticalAlignment="Middle">125 <font fontName="Serif" size="12" isBold="true"/>126 </textElement>127 <textFieldExpression class="java.lang.String"><![CDATA["Asset"]]></textFieldExpression>128 </textField>129 </jr:columnHeader>130 <jr:columnFooter style="table_CF" height="30" rowSpan="1">131 <textField>132 <reportElement x="0" y="0" width="160" height="30"/>133 <textElement verticalAlignment="Middle">134 <font fontName="Serif" size="12" isBold="true"/>135 </textElement>136 <textFieldExpression class="java.lang.String"><![CDATA["Total"]]></textFieldExpression>137 </textField>138 </jr:columnFooter>139 <jr:detailCell style="table_TD" height="30" rowSpan="1">140 <textField>141 <reportElement x="0" y="0" width="160" height="30"/>142 <textElement verticalAlignment="Middle">143 <font fontName="Serif" isBold="false" isItalic="false"/>144 </textElement>145 <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>146 </textField>147 </jr:detailCell>148 </jr:column>149 <jr:column width="55">150 <jr:columnHeader height="30" rowSpan="1">151 <textField>152 <reportElement x="0" y="0" width="55" height="30"/>153 <textElement textAlignment="Center" verticalAlignment="Middle">154 <font fontName="Serif" size="12" isBold="true"/>155 </textElement>156 <textFieldExpression class="java.lang.String"><![CDATA["Callouts"]]></textFieldExpression>157 </textField>158 </jr:columnHeader>159 <jr:columnFooter style="table_CF" height="30" rowSpan="1">160 <textField>161 <reportElement x="0" y="0" width="55" height="30"/>162 <textElement textAlignment="Center" verticalAlignment="Middle">163 <font fontName="Serif" size="12" isBold="true"/>164 </textElement>165 <textFieldExpression class="java.lang.Integer"><![CDATA[$V{immediateCalloutSum}]]></textFieldExpression>166 </textField>167 </jr:columnFooter>168 <jr:detailCell style="table_TD" height="30" rowSpan="1">169 <textField>170 <reportElement x="0" y="0" width="55" height="30"/>171 <textElement textAlignment="Center" verticalAlignment="Middle">172 <font fontName="Serif" isBold="false"/>173 </textElement>174 <textFieldExpression class="java.lang.Integer"><![CDATA[$F{immediateCalloutCount}]]></textFieldExpression>175 </textField>176 </jr:detailCell>177 </jr:column>178 <jr:column width="159">179 <jr:columnHeader style="table_CH" height="30" rowSpan="1">180 <textField>181 <reportElement x="0" y="0" width="159" height="30"/>182 <textElement verticalAlignment="Middle">183 <font fontName="Serif" size="12" isBold="true"/>184 </textElement>185 <textFieldExpression class="java.lang.String"><![CDATA["Tasks"]]></textFieldExpression>186 </textField>187 </jr:columnHeader>188 <jr:columnFooter style="table_CF" height="30" rowSpan="1"/>189 <jr:detailCell style="table_TD" height="30" rowSpan="1">190 <textField>191 <reportElement x="0" y="0" width="159" height="30"/>192 <textElement verticalAlignment="Middle">193 <font fontName="Serif" size="10" isBold="false"/>194 </textElement>195 <textFieldExpression class="java.lang.String"><![CDATA[$F{immediateCalloutTaskList}]]></textFieldExpression>196 </textField>197 </jr:detailCell>198 </jr:column>199 </jr:table>200 </componentElement>201 <pie3DChart>202 <chart>203 <reportElement x="416" y="0" width="366" height="301"/>204 <chartTitle/>205 <chartSubtitle/>206 <chartLegend/>207 </chart>208 <pieDataset>209 <dataset>210 <datasetRun subDataset="dataset1">211 <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{assetList})]]></dataSourceExpression>212 </datasetRun>213 </dataset>214 <keyExpression><![CDATA[$F{name}]]></keyExpression>215 <valueExpression><![CDATA[$F{immediateCalloutCount}]]></valueExpression>216 </pieDataset>217 <pie3DPlot depthFactor="0.1" isCircular="false" labelFormat="{2}">218 <plot/>219 <itemLabel color="#000000" backgroundColor="#FFFFFF"/>220 </pie3DPlot>221 </pie3DChart>222 </band>223 <band height="394">224 118 <bar3DChart> 225 119 <chart> 226 <reportElement x="0" y="0" width="782" height="212"/> 227 <chartTitle/> 120 <reportElement x="0" y="0" width="782" height="394"/> 121 <chartTitle position="Bottom"> 122 <font isUnderline="false"/> 123 <titleExpression><![CDATA["Total: "+$F{totalAssetsOnTasksCount}]]></titleExpression> 124 </chartTitle> 228 125 <chartSubtitle/> 229 126 <chartLegend/> … … 258 155 </bar3DPlot> 259 156 </bar3DChart> 157 </band> 158 <band height="394"> 260 159 <bar3DChart> 261 160 <chart> 262 <reportElement x="0" y="212" width="782" height="182"/> 263 <chartTitle/> 161 <reportElement x="0" y="0" width="782" height="394"/> 162 <chartTitle position="Bottom"> 163 <font isBold="false" isUnderline="false"/> 164 <titleExpression><![CDATA["Total: "+$F{totalDownTime}.total+"min"+" ("+$F{totalDownTime}.hours+"h:"+$F{totalDownTime}.minutes+"m)"]]></titleExpression> 165 </chartTitle> 264 166 <chartSubtitle/> 265 <chartLegend/> 167 <chartLegend position="Bottom"> 168 <font isUnderline="true"/> 169 </chartLegend> 266 170 </chart> 267 171 <categoryDataset> … … 272 176 </dataset> 273 177 <categorySeries> 274 <seriesExpression><![CDATA["Down Time "]]></seriesExpression>178 <seriesExpression><![CDATA["Down Time (min)"]]></seriesExpression> 275 179 <categoryExpression><![CDATA[$F{name}]]></categoryExpression> 276 180 <valueExpression><![CDATA[$F{downTime}]]></valueExpression> … … 297 201 </bar3DChart> 298 202 </band> 203 <band height="394"> 204 <componentElement> 205 <reportElement key="table 1" style="table" x="0" y="0" width="782" height="394"/> 206 <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> 207 <datasetRun subDataset="dataset1"> 208 <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{assetList})]]></dataSourceExpression> 209 </datasetRun> 210 <jr:column width="774"> 211 <jr:groupHeader groupName="assetName"> 212 <jr:cell height="30" rowSpan="1"> 213 <textField> 214 <reportElement x="0" y="0" width="774" height="30"/> 215 <textElement verticalAlignment="Middle"> 216 <font size="12" isBold="true"/> 217 </textElement> 218 <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression> 219 </textField> 220 </jr:cell> 221 </jr:groupHeader> 222 <jr:detailCell style="table_TD" height="40" rowSpan="1"> 223 <textField isStretchWithOverflow="true"> 224 <reportElement x="0" y="0" width="774" height="40"/> 225 <textElement verticalAlignment="Middle"/> 226 <textFieldExpression class="java.lang.String"><![CDATA[""+$F{tasks}]]></textFieldExpression> 227 </textField> 228 </jr:detailCell> 229 </jr:column> 230 </jr:table> 231 </componentElement> 232 </band> 299 233 </detail> 300 234 <columnFooter>
Note: See TracChangeset
for help on using the changeset viewer.