Changeset 708
- Timestamp:
- Nov 15, 2010, 11:48:34 AM (14 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/ReportController.groovy
r706 r708 91 91 params.endDateString = g.formatDate(format: "EEE, dd-MMM-yyyy", date: params.endDate) 92 92 93 def dataModel = taskReportService.getReactiveRatio(params, RCU.getLocale(request)) 94 95 // Jasper plugin controller expects data to be a Collection. 96 chain(controller:'jasper', action:'index', model:[data: [dataModel]], params:params) 93 def result = taskReportService.getReactiveRatio(params, RCU.getLocale(request)) 94 95 if(!result.error) { 96 // Jasper plugin controller expects data to be a Collection. 97 chain(controller:'jasper', action:'index', model:[data: [result]], params:params) 98 return 99 } 100 101 flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 102 redirect(controller: 'appCore', action: 'start', params: [showTab:'showReportsTab']) 97 103 98 104 } // reactiveRatio -
trunk/grails-app/i18n/messages.properties
r701 r708 264 264 default.file.no.header=The supplied file does not have the correct header lines, please see the template file. 265 265 default.not.development.environment.failure=Could not complete operation, dev environment not detected. 266 default.end.date.before.start.date=The end date must be equal to or greater than \ 267 the start date. 266 268 267 269 default.doesnt.match.message=Property [{0}] of class [{1}] with value [{2}] does not match the required pattern [{3}] -
trunk/grails-app/services/TaskReportService.groovy
r651 r708 24 24 def result = [:] 25 25 26 def fail = { Map m -> 27 result.error = [ code: m.code, args: [] ] 28 return result 29 } 30 26 31 def namedParams = [:] 27 32 namedParams.startDate = params.startDate ?: dateUtilService.today 28 33 namedParams.endDate = params.endDate ?: dateUtilService.today 34 35 if(namedParams.endDate < namedParams.startDate) 36 return fail(code: "default.end.date.before.start.date") 37 29 38 namedParams.endDate++ // Start of next day required. 39 30 40 namedParams.immediateCallout = TaskType.read(1) 31 41 namedParams.unscheduledBreakin = TaskType.read(2) … … 94 104 } 95 105 catch(ArithmeticException e) { 96 log. error"Could not calculate: Assets on Tasks Percentages: "+e106 log.info "Could not calculate: Assets on Tasks Percentages: "+e 97 107 } 98 108 99 109 // Work Done. 100 result.immediateCalloutWorkDone = [total:0, hours:0, minutes:0, percentage: 0]110 result.immediateCalloutWorkDone = [total:0, hours:0, minutes:0, percentage: new BigDecimal(0)] 101 111 result.unscheduledBreakinWorkDone = [total:0, hours:0, minutes:0] 102 112 result.preventativeMaintenanceWorkDone = [total:0, hours:0, minutes:0] 103 result.totalPreventativeWorkDone = [total:0, hours:0, minutes:0, percentage: 0]113 result.totalPreventativeWorkDone = [total:0, hours:0, minutes:0, percentage: new BigDecimal(0)] 104 114 result.totalWorkDone = [total:0, hours:0, minutes:0] 105 115 … … 139 149 // Work Done Percentages. 140 150 try { 141 result.immediateCalloutWorkDone.percentage = ( result.immediateCalloutWorkDone.total / result.totalWorkDone.total)*100142 result.totalPreventativeWorkDone.percentage = ( result.totalPreventativeWorkDone.total / result.totalWorkDone.total)*100151 result.immediateCalloutWorkDone.percentage = (BigDecimal)(result.immediateCalloutWorkDone.total / result.totalWorkDone.total)*100 152 result.totalPreventativeWorkDone.percentage = (BigDecimal)(result.totalPreventativeWorkDone.total / result.totalWorkDone.total)*100 143 153 } 144 154 catch(ArithmeticException e) { 145 log. error"Could not calculate: Work Done Percentages: "+e155 log.info "Could not calculate: Work Done Percentages: "+e 146 156 } 147 157
Note: See TracChangeset
for help on using the changeset viewer.