Changeset 544 for trunk/grails-app
- Timestamp:
- May 24, 2010, 3:48:53 AM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 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 />
Note: See TracChangeset
for help on using the changeset viewer.