Changeset 542
- Timestamp:
- May 23, 2010, 4:43:44 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/ReportController.groovy
r538 r542 66 66 } 67 67 68 def test = { 69 render taskReportService.getReactiveRatio(params, RCU.getLocale(request)) 68 def immediateCallouts = { 69 70 params.reportTitle = "Immediate Callouts" 71 params.logoUrl = grailsApplication.mainContext.getResource('images/logo.png').getURL() 72 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 else 77 params.startDate = dateUtilService.today-7 78 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 else 83 params.endDate = dateUtilService.today 84 params.endDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.endDate) 85 86 def dataModel = [taskReportService.getImmediateCallouts(params, RCU.getLocale(request))] 87 88 // render dataModel 89 chain(controller:'jasper', action:'index', model:[data: dataModel], params:params) 90 70 91 } 71 92 -
trunk/grails-app/services/TaskReportService.groovy
r536 r542 10 10 def authService 11 11 def dateUtilService 12 def sessionFactory 12 13 // def messageSource 13 14 … … 18 19 /** 19 20 * Selects and returns the reactive ratio. 20 * @param params The request params, may contain param to specify the search.21 * @param params The request params, may contain params to specify the search. 21 22 * @param locale The locale to use when generating result.message. 22 23 */ … … 34 35 35 36 result.taskQuery = "from Task as task \ 36 where (task.trash = false \37 and task.taskStatus != :notStarted \38 and task.targetStartDate < :endDate \39 and task.targetStartDate >= :startDate \40 and ( \41 task.taskType = :immediateCallout \42 or task.taskType = :unscheduledBreakin \43 or task.taskType = :preventativeMaintenance \44 ) \45 )"37 where (task.trash = false \ 38 and task.taskStatus != :notStarted \ 39 and task.targetStartDate < :endDate \ 40 and task.targetStartDate >= :startDate \ 41 and ( \ 42 task.taskType = :immediateCallout \ 43 or task.taskType = :unscheduledBreakin \ 44 or task.taskType = :preventativeMaintenance \ 45 ) \ 46 )" 46 47 47 48 result.taskQuery = "select distinct task " + result.taskQuery … … 55 56 result.preventativeMaintenanceCount = 0 56 57 58 // Summary Of Calculations. 57 59 result.summaryOfCalculationMethod = 'HQL query: \n\n' 58 60 def tempStringArray = result.taskQuery.split(' ') … … 148 150 return result 149 151 150 } // getQuickSearch 152 } // getReactiveRatio 153 154 /** 155 * Selects and returns Immediate Callouts, grouped by Asset. 156 * @param params The request params, may contain params to specify the search. 157 * @param locale The locale to use when generating result.message. 158 */ 159 def getImmediateCallouts(params, locale) { 160 def result = [:] 161 162 def namedParams = [:] 163 namedParams.startDate = params.startDate ?: dateUtilService.today 164 namedParams.endDatePlusOne = (params.endDate ?: dateUtilService.today)+1 165 namedParams.immediateCallout = TaskType.read(1) 166 167 result.taskQuery = "from Task as task \ 168 where (task.trash = false \ 169 and task.targetStartDate < :endDatePlusOne \ 170 and task.targetStartDate >= :startDate \ 171 and task.taskType = :immediateCallout \ 172 ) \ 173 )" 174 175 result.taskQuery = "select distinct task " + result.taskQuery 176 result.taskList = Task.executeQuery(result.taskQuery, namedParams) 177 result.taskCount = result.taskList.size() 178 179 // Assets on Tasks Count. 180 result.totalAssetsOnTasksCount = 0 181 result.assetList = [] 182 183 // Add or update asset details in assetList. 184 def addAssetToList = { asset, task -> 185 186 def downTime = 0 187 def faultEntries = Entry.findAllByTaskAndEntryType(task, EntryType.read(1)) 188 faultEntries.each() { downTime += (it.durationHour*60 + it.durationMinute) } 189 190 def assetDetails = result.assetList.find { it.id == asset.id } 191 if(assetDetails) { 192 assetDetails.immediateCalloutCount++ 193 assetDetails.immediateCalloutTaskList.add(task.toString()) 194 } 195 else { 196 assetDetails = [id: asset.id, 197 name: asset.name, 198 immediateCalloutCount: 1, 199 downTime: downTime, 200 immediateCalloutTaskList: [task.toString()]] 201 202 result.assetList << assetDetails 203 } 204 } // addAssetToList 205 206 // Summary Of Calculations. 207 result.summaryOfCalculationMethod = 'HQL query: \n\n' 208 def tempStringArray = result.taskQuery.split(' ') 209 tempStringArray.each() { 210 if(it != '') result.summaryOfCalculationMethod += it +'\n' 211 } 212 result.summaryOfCalculationMethod += '\n'+'Calculations: '+'\n\n' 213 214 result.summaryOfCalculationMethod += 'totalAssetsOnTasksCount = A count of unique assets on each task. \n' 215 result.taskList.each() { task -> 216 if(task.primaryAsset) { 217 result.totalAssetsOnTasksCount++ 218 addAssetToList(task.primaryAsset, task) 219 } 220 task.associatedAssets.each() { associatedAsset -> 221 if(associatedAsset.id != task.primaryAsset?.id) { 222 result.totalAssetsOnTasksCount++ 223 addAssetToList(associatedAsset, task) 224 } 225 } 226 227 } // each() task 228 229 // Sort by callout count. 230 result.assetList.sort {a, b -> b.immediateCalloutCount.compareTo(a.immediateCalloutCount)} 231 232 // Success. 233 return result 234 235 } // getImmediateCallouts() 151 236 152 237 -
trunk/grails-app/views/appCore/start.gsp
r535 r542 113 113 <br /> 114 114 <g:jasperReport controller="report" 115 action="immediateCallouts" 116 jasper="immediateCallouts" 117 name="Immediate Callouts" 118 format="PDF, XLS"> 119 <richui:dateChooser name="startDate" format="dd-MM-yyyy" value="${new Date()-7}" /> 120 to 121 <richui:dateChooser name="endDate" format="dd-MM-yyyy" value="${new Date()}" /> 122 </g:jasperReport> 123 <br /> 124 <g:jasperReport controller="report" 115 125 action="templatePortrait" 116 126 jasper="templatePortrait" -
trunk/web-app/css/main.css
r539 r542 17 17 * #666666 - Dark Grey (Nav Text). 18 18 * #333333 - Very Dark Grey (TH, Menu Button). 19 * #555555 - Total Row Grey. 19 * #FFFFFF - Table Row (Even). 20 * #F7F7F7 - Table Row (Odd). 21 * #EDEDED - Total Row Grey (Bg). 22 * #555555 - Total Row Grey (Fg). 20 23 */ 21 24
Note: See TracChangeset
for help on using the changeset viewer.