[533] | 1 | import org.codehaus.groovy.grails.plugins.springsecurity.Secured |
---|
| 2 | import org.springframework.web.servlet.support.RequestContextUtils as RCU |
---|
| 3 | |
---|
| 4 | class ReportController extends BaseController { |
---|
| 5 | |
---|
| 6 | def authService |
---|
| 7 | def dateUtilService |
---|
| 8 | def taskReportService |
---|
| 9 | |
---|
| 10 | def index = { redirect(action:templatePortrait,params:params) } |
---|
| 11 | |
---|
| 12 | // the delete, save and update actions only accept POST requests |
---|
| 13 | //static allowedMethods = [list:'POST'] |
---|
| 14 | |
---|
| 15 | def templatePortrait = { |
---|
| 16 | params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) |
---|
| 17 | |
---|
| 18 | params.reportTitle = "Template Report (Portrait)" |
---|
| 19 | params.currentUser = authService.currentUser |
---|
| 20 | def dataModel = createTemplateData() |
---|
| 21 | |
---|
| 22 | chain(controller:'jasper', action:'index', model:[data: dataModel], params:params) |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | def templateLandscape = { |
---|
| 26 | params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) |
---|
| 27 | |
---|
| 28 | params.reportTitle = "Template Report (Landscape)" |
---|
| 29 | params.currentUser = authService.currentUser |
---|
| 30 | def dataModel = createTemplateData() |
---|
| 31 | |
---|
| 32 | chain(controller:'jasper', action:'index', model:[data: dataModel], params:params) |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | private createTemplateData() { |
---|
| 36 | def dataModel = [] |
---|
| 37 | for(i in 1..5) { |
---|
| 38 | def data = [:] |
---|
| 39 | data.description = "Data description " + i.toString() |
---|
| 40 | dataModel.add(data) |
---|
| 41 | } |
---|
| 42 | return dataModel |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | def reactiveRatio = { |
---|
| 46 | params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) |
---|
| 47 | |
---|
| 48 | params.reportTitle = "Reactive Ratio Report" |
---|
| 49 | params.currentUser = authService.currentUser |
---|
| 50 | params.startDate = dateUtilService.yesterday-14 |
---|
| 51 | params.endDate = dateUtilService.tomorrow+15 |
---|
| 52 | def dataModel = [taskReportService.getReactiveRatio(params, RCU.getLocale(request))] |
---|
| 53 | |
---|
| 54 | chain(controller:'jasper', action:'index', model:[data: dataModel], params:params) |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | def test = { |
---|
| 58 | render taskReportService.getReactiveRatio(params, RCU.getLocale(request)) |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | } // end of class. |
---|