Changeset 536
- Timestamp:
- May 18, 2010, 7:23:46 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/TaskReportService.groovy
r535 r536 49 49 result.taskCount = result.taskList.size() 50 50 51 // Counts51 // Assets on Tasks Count. 52 52 result.totalAssetsOnTasksCount = 0 53 53 result.immediateCalloutCount = 0 … … 80 80 } // each() task 81 81 82 // Percentage s82 // Percentage of counts. 83 83 result.immediateCalloutPercentage = 0 84 84 result.totalPreventativePercentage = 0 … … 93 93 } 94 94 catch(ArithmeticException e) { 95 log.error "Could not calculate percentages: "+e 95 log.error "Could not calculate: Assets on Tasks Percentages: "+e 96 } 97 98 // Work Done. 99 result.immediateCalloutWorkDone = [total:0, hours:0, minutes:0, percentage:0] 100 result.unscheduledBreakinWorkDone = [total:0, hours:0, minutes:0] 101 result.preventativeMaintenanceWorkDone = [total:0, hours:0, minutes:0] 102 result.totalPreventativeWorkDone = [total:0, hours:0, minutes:0, percentage:0] 103 result.totalWorkDone = [total:0, hours:0, minutes:0] 104 105 result.taskList.each() { task -> 106 task.entries.each() { entry -> 107 // Has assets assigned and is Work Done. 108 if( (task.primaryAsset || task.associatedAssets) && entry.entryType.id == 3L ) { 109 if(task.taskType == namedParams.immediateCallout) 110 result.immediateCalloutWorkDone.total += (entry.durationHour*60) + entry.durationMinute 111 if(task.taskType == namedParams.unscheduledBreakin) 112 result.unscheduledBreakinWorkDone.total += (entry.durationHour*60) + entry.durationMinute 113 if(task.taskType == namedParams.preventativeMaintenance) 114 result.preventativeMaintenanceWorkDone.total += (entry.durationHour*60) + entry.durationMinute 115 } 116 } // each() entry 117 } // each() task 118 119 // Work Done hours and minutes. 120 result.immediateCalloutWorkDone.hours = (result.immediateCalloutWorkDone.total / 60).toInteger() 121 result.immediateCalloutWorkDone.minutes = result.immediateCalloutWorkDone.total % 60 122 123 result.unscheduledBreakinWorkDone.hours = (result.unscheduledBreakinWorkDone.total / 60).toInteger() 124 result.unscheduledBreakinWorkDone.minutes = result.unscheduledBreakinWorkDone.total % 60 125 126 result.preventativeMaintenanceWorkDone.hours = (result.preventativeMaintenanceWorkDone.total / 60).toInteger() 127 result.preventativeMaintenanceWorkDone.minutes = result.preventativeMaintenanceWorkDone.total % 60 128 129 // Work Done Totals. 130 result.totalPreventativeWorkDone.total = result.unscheduledBreakinWorkDone.total + result.preventativeMaintenanceWorkDone.total 131 result.totalPreventativeWorkDone.hours = (result.totalPreventativeWorkDone.total / 60).toInteger() 132 result.totalPreventativeWorkDone.minutes = result.totalPreventativeWorkDone.total % 60 133 134 result.totalWorkDone.total = result.immediateCalloutWorkDone.total + result.totalPreventativeWorkDone.total 135 result.totalWorkDone.hours = (result.totalWorkDone.total / 60).toInteger() 136 result.totalWorkDone.minutes = result.totalWorkDone.total % 60 137 138 // Work Done Percentages. 139 try { 140 result.immediateCalloutWorkDone.percentage = (result.immediateCalloutWorkDone.total / result.totalWorkDone.total)*100 141 result.totalPreventativeWorkDone.percentage = (result.totalPreventativeWorkDone.total / result.totalWorkDone.total)*100 142 } 143 catch(ArithmeticException e) { 144 log.error "Could not calculate: Work Done Percentages: "+e 96 145 } 97 146 -
trunk/web-app/reports/reactiveRatio.jrxml
r535 r536 5 5 <property name="ireport.zoom" value="1.0"/> 6 6 <property name="ireport.x" value="0"/> 7 <property name="ireport.y" value="4 05"/>7 <property name="ireport.y" value="432"/> 8 8 <import value="java.util.*"/> 9 9 <import value="net.sf.jasperreports.engine.*"/> … … 68 68 <field name="taskQuery" class="java.lang.String"/> 69 69 <field name="summaryOfCalculationMethod" class="java.lang.String"/> 70 <field name="immediateCalloutWorkDone" class="java.util.LinkedHashMap"/> 71 <field name="totalPreventativeWorkDone" class="java.util.LinkedHashMap"/> 72 <field name="unscheduledBreakinWorkDone" class="java.util.LinkedHashMap"/> 73 <field name="preventativeMaintenanceWorkDone" class="java.util.LinkedHashMap"/> 74 <field name="totalWorkDone" class="java.util.LinkedHashMap"/> 70 75 <background> 71 76 <band splitType="Stretch"/> … … 178 183 <keyExpression><![CDATA["Immediate"]]></keyExpression> 179 184 <valueExpression><![CDATA[$F{immediateCalloutPercentage}]]></valueExpression> 180 <labelExpression><![CDATA[$F{immediateCalloutPercentage}.setScale( 0, RoundingMode.HALF_UP)]]></labelExpression>185 <labelExpression><![CDATA[$F{immediateCalloutPercentage}.setScale(2, RoundingMode.HALF_UP)]]></labelExpression> 181 186 </pieSeries> 182 187 <pieSeries> 183 188 <keyExpression><![CDATA["Preventative"]]></keyExpression> 184 189 <valueExpression><![CDATA[$F{totalPreventativePercentage}]]></valueExpression> 185 <labelExpression><![CDATA[$F{totalPreventativePercentage}.setScale( 0, RoundingMode.HALF_UP)]]></labelExpression>190 <labelExpression><![CDATA[$F{totalPreventativePercentage}.setScale(2, RoundingMode.HALF_UP)]]></labelExpression> 186 191 </pieSeries> 187 192 </pieDataset> … … 203 208 <reportElement x="236" y="277" width="117" height="20"/> 204 209 <textElement textAlignment="Center" verticalAlignment="Middle"/> 205 <textFieldExpression ><![CDATA[$F{totalPreventativeCount}]]></textFieldExpression>210 <textFieldExpression class="java.lang.String"><![CDATA[$F{totalPreventativeCount}]]></textFieldExpression> 206 211 </textField> 207 212 <textField isBlankWhenNull="true"> … … 215 220 <reportElement x="0" y="257" width="157" height="20"/> 216 221 <textElement verticalAlignment="Middle" markup="none"/> 217 <textFieldExpression ><![CDATA["Preventative Maintenance"]]></textFieldExpression>222 <textFieldExpression class="java.lang.String"><![CDATA["Preventative Maintenance"]]></textFieldExpression> 218 223 </textField> 219 224 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> … … 231 236 <reportElement x="236" y="197" width="117" height="20"/> 232 237 <textElement verticalAlignment="Middle"/> 233 <textFieldExpression ><![CDATA["Count (Assets on Tasks)"]]></textFieldExpression>238 <textFieldExpression class="java.lang.String"><![CDATA["Count (Assets on Tasks)"]]></textFieldExpression> 234 239 </textField> 235 240 <textField isBlankWhenNull="true"> 236 241 <reportElement x="0" y="237" width="157" height="20"/> 237 242 <textElement verticalAlignment="Middle" markup="none"/> 238 <textFieldExpression class="java.lang.String"><![CDATA["Unscheduled Breakin g: "]]></textFieldExpression>243 <textFieldExpression class="java.lang.String"><![CDATA["Unscheduled Breakin: "]]></textFieldExpression> 239 244 </textField> 240 245 <line> … … 269 274 <seriesColor seriesOrder="0" color="#FF0000"/> 270 275 <seriesColor seriesOrder="1" color="#00CC00"/> 271 <seriesColor seriesOrder="2" color="#F FFF66"/>276 <seriesColor seriesOrder="2" color="#F7C240"/> 272 277 </plot> 273 278 <itemLabel color="#000000" backgroundColor="#FFFFFF"/> … … 300 305 <reportElement x="0" y="197" width="157" height="20"/> 301 306 <textElement verticalAlignment="Middle" markup="none"/> 302 <textFieldExpression ><![CDATA["Description"]]></textFieldExpression>307 <textFieldExpression class="java.lang.String"><![CDATA["Description"]]></textFieldExpression> 303 308 </textField> 304 309 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> … … 314 319 <reportElement x="157" y="0" width="79" height="20"/> 315 320 <textElement verticalAlignment="Middle"/> 316 <textFieldExpression ><![CDATA["Percentage (%)"]]></textFieldExpression>321 <textFieldExpression class="java.lang.String"><![CDATA["Percentage (%)"]]></textFieldExpression> 317 322 </textField> 318 323 <textField isBlankWhenNull="true"> 319 324 <reportElement x="0" y="0" width="157" height="20"/> 320 325 <textElement verticalAlignment="Middle" markup="none"/> 321 <textFieldExpression ><![CDATA["Description"]]></textFieldExpression>326 <textFieldExpression class="java.lang.String"><![CDATA["Description"]]></textFieldExpression> 322 327 </textField> 323 328 <textField pattern="###0.00" isBlankWhenNull="true"> 324 329 <reportElement x="236" y="0" width="117" height="20"/> 325 330 <textElement verticalAlignment="Middle"/> 326 <textFieldExpression><![CDATA["Count (Assets on Tasks)"]]></textFieldExpression> 331 <textFieldExpression class="java.lang.String"><![CDATA["Count (Assets on Tasks)"]]></textFieldExpression> 332 </textField> 333 </band> 334 <band height="394"> 335 <pie3DChart> 336 <chart> 337 <reportElement x="426" y="0" width="356" height="197"/> 338 <chartTitle/> 339 <chartSubtitle/> 340 <chartLegend/> 341 </chart> 342 <pieDataset> 343 <pieSeries> 344 <keyExpression><![CDATA["Immediate"]]></keyExpression> 345 <valueExpression><![CDATA[$F{immediateCalloutWorkDone}.percentage]]></valueExpression> 346 <labelExpression><![CDATA[$F{immediateCalloutWorkDone}.percentage.setScale(2, RoundingMode.HALF_UP)]]></labelExpression> 347 </pieSeries> 348 <pieSeries> 349 <keyExpression><![CDATA["Total Preventative"]]></keyExpression> 350 <valueExpression><![CDATA[$F{totalPreventativeWorkDone}.percentage]]></valueExpression> 351 <labelExpression><![CDATA[$F{totalPreventativeWorkDone}.percentage.setScale(2, RoundingMode.HALF_UP)]]></labelExpression> 352 </pieSeries> 353 </pieDataset> 354 <pie3DPlot depthFactor="0.1" isCircular="false"> 355 <plot> 356 <seriesColor seriesOrder="0" color="#FF0000"/> 357 <seriesColor seriesOrder="1" color="#00CC00"/> 358 <seriesColor seriesOrder="2" color="#FF9900"/> 359 </plot> 360 <itemLabel color="#000000" backgroundColor="#FFFFFF"/> 361 </pie3DPlot> 362 </pie3DChart> 363 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 364 <reportElement x="157" y="0" width="79" height="20"/> 365 <textElement verticalAlignment="Middle"/> 366 <textFieldExpression class="java.lang.String"><![CDATA["Percentage (%)"]]></textFieldExpression> 367 </textField> 368 <textField pattern="###0.00" isBlankWhenNull="true"> 369 <reportElement x="236" y="20" width="117" height="20"/> 370 <textElement verticalAlignment="Middle"/> 371 </textField> 372 <textField pattern="###0.00" isBlankWhenNull="true"> 373 <reportElement x="236" y="0" width="117" height="20"/> 374 <textElement verticalAlignment="Middle"/> 375 <textFieldExpression class="java.lang.String"><![CDATA["Work Done (hh:mm)"]]></textFieldExpression> 376 </textField> 377 <line> 378 <reportElement x="0" y="100" width="353" height="1" forecolor="#999999"/> 379 </line> 380 <line> 381 <reportElement x="0" y="20" width="353" height="1" forecolor="#999999"/> 382 </line> 383 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 384 <reportElement x="157" y="40" width="79" height="20"/> 385 <textElement textAlignment="Center" verticalAlignment="Middle"/> 386 <textFieldExpression class="java.lang.String"><![CDATA[$F{immediateCalloutWorkDone}.percentage.setScale(2, RoundingMode.HALF_UP)]]></textFieldExpression> 387 </textField> 388 <textField isBlankWhenNull="true"> 389 <reportElement x="157" y="60" width="79" height="20"/> 390 <textElement textAlignment="Center" verticalAlignment="Middle"/> 391 <textFieldExpression class="java.lang.String"><![CDATA[$F{totalPreventativeWorkDone}.percentage.setScale(2, RoundingMode.HALF_UP)]]></textFieldExpression> 392 </textField> 393 <textField isBlankWhenNull="true"> 394 <reportElement x="0" y="20" width="157" height="20"/> 395 <textElement verticalAlignment="Middle" markup="none"/> 396 </textField> 397 <textField isBlankWhenNull="true"> 398 <reportElement x="157" y="80" width="79" height="20"/> 399 <textElement textAlignment="Center" verticalAlignment="Middle"/> 400 </textField> 401 <line> 402 <reportElement x="0" y="60" width="353" height="1" forecolor="#999999"/> 403 </line> 404 <textField isBlankWhenNull="true"> 405 <reportElement x="236" y="60" width="117" height="20"/> 406 <textElement textAlignment="Center" verticalAlignment="Middle"/> 407 <textFieldExpression class="java.lang.String"><![CDATA[$F{totalPreventativeWorkDone}.hours+":"+$F{totalPreventativeWorkDone}.minutes]]></textFieldExpression> 408 </textField> 409 <textField isBlankWhenNull="true"> 410 <reportElement x="236" y="80" width="117" height="20"/> 411 <textElement textAlignment="Center" verticalAlignment="Middle"/> 412 <textFieldExpression class="java.lang.String"><![CDATA[$F{totalWorkDone}.hours+":"+$F{totalWorkDone}.minutes]]></textFieldExpression> 413 </textField> 414 <textField isBlankWhenNull="true"> 415 <reportElement x="0" y="0" width="157" height="20"/> 416 <textElement verticalAlignment="Middle" markup="none"/> 417 <textFieldExpression class="java.lang.String"><![CDATA["Description"]]></textFieldExpression> 418 </textField> 419 <line> 420 <reportElement x="0" y="79" width="353" height="1" forecolor="#999999"/> 421 </line> 422 <textField isBlankWhenNull="true"> 423 <reportElement x="0" y="40" width="157" height="20"/> 424 <textElement verticalAlignment="Middle" markup="none"/> 425 <textFieldExpression class="java.lang.String"><![CDATA["Immediate Callout: "]]></textFieldExpression> 426 </textField> 427 <textField isBlankWhenNull="true"> 428 <reportElement x="0" y="60" width="157" height="20"/> 429 <textElement verticalAlignment="Middle" markup="none"/> 430 <textFieldExpression class="java.lang.String"><![CDATA["Total Preventative: "]]></textFieldExpression> 431 </textField> 432 <line> 433 <reportElement x="0" y="39" width="353" height="1" forecolor="#999999"/> 434 </line> 435 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 436 <reportElement x="157" y="20" width="79" height="20"/> 437 <textElement verticalAlignment="Middle"/> 438 </textField> 439 <textField pattern="###0.00" isBlankWhenNull="true"> 440 <reportElement x="0" y="80" width="157" height="20"/> 441 <textElement verticalAlignment="Middle"/> 442 <textFieldExpression class="java.lang.String"><![CDATA["Total: "]]></textFieldExpression> 443 </textField> 444 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 445 <reportElement x="236" y="40" width="117" height="20"/> 446 <textElement textAlignment="Center" verticalAlignment="Middle"/> 447 <textFieldExpression class="java.lang.String"><![CDATA[$F{immediateCalloutWorkDone}.hours+":"+$F{immediateCalloutWorkDone}.minutes]]></textFieldExpression> 448 </textField> 449 <pie3DChart> 450 <chart> 451 <reportElement x="426" y="197" width="356" height="197"/> 452 <chartTitle/> 453 <chartSubtitle/> 454 <chartLegend/> 455 </chart> 456 <pieDataset> 457 <pieSeries> 458 <keyExpression><![CDATA["Immediate"]]></keyExpression> 459 <valueExpression><![CDATA[$F{immediateCalloutWorkDone}.minutes]]></valueExpression> 460 <labelExpression><![CDATA[$F{immediateCalloutWorkDone}.hours+":"+$F{immediateCalloutWorkDone}.minutes]]></labelExpression> 461 </pieSeries> 462 <pieSeries> 463 <keyExpression><![CDATA["Preventative Maintenance"]]></keyExpression> 464 <valueExpression><![CDATA[$F{preventativeMaintenanceWorkDone}.minutes]]></valueExpression> 465 <labelExpression><![CDATA[$F{preventativeMaintenanceWorkDone}.hours+":"+$F{preventativeMaintenanceWorkDone}.minutes]]></labelExpression> 466 </pieSeries> 467 <pieSeries> 468 <keyExpression><![CDATA["Unscheduled Breakin"]]></keyExpression> 469 <valueExpression><![CDATA[$F{unscheduledBreakinWorkDone}.minutes]]></valueExpression> 470 <labelExpression><![CDATA[$F{unscheduledBreakinWorkDone}.hours+":"+$F{unscheduledBreakinWorkDone}.minutes]]></labelExpression> 471 </pieSeries> 472 </pieDataset> 473 <pie3DPlot depthFactor="0.1" isCircular="false"> 474 <plot> 475 <seriesColor seriesOrder="0" color="#FF0000"/> 476 <seriesColor seriesOrder="1" color="#00CC00"/> 477 <seriesColor seriesOrder="2" color="#FF9900"/> 478 </plot> 479 <itemLabel color="#000000" backgroundColor="#FFFFFF"/> 480 </pie3DPlot> 481 </pie3DChart> 482 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 483 <reportElement x="157" y="197" width="79" height="20"/> 484 <textElement verticalAlignment="Middle"/> 485 </textField> 486 <textField isBlankWhenNull="true"> 487 <reportElement x="0" y="197" width="157" height="20"/> 488 <textElement verticalAlignment="Middle" markup="none"/> 489 <textFieldExpression class="java.lang.String"><![CDATA["Description"]]></textFieldExpression> 490 </textField> 491 <line> 492 <reportElement x="0" y="276" width="353" height="1" forecolor="#999999"/> 493 </line> 494 <textField isBlankWhenNull="true"> 495 <reportElement x="0" y="217" width="157" height="20"/> 496 <textElement verticalAlignment="Middle" markup="none"/> 497 </textField> 498 <textField isBlankWhenNull="true"> 499 <reportElement x="157" y="257" width="79" height="20"/> 500 <textElement textAlignment="Center" verticalAlignment="Middle"/> 501 </textField> 502 <textField pattern="###0.00" isBlankWhenNull="true"> 503 <reportElement x="236" y="197" width="117" height="20"/> 504 <textElement verticalAlignment="Middle"/> 505 <textFieldExpression class="java.lang.String"><![CDATA["Work Done (hh:mm)"]]></textFieldExpression> 506 </textField> 507 <textField isBlankWhenNull="true"> 508 <reportElement x="157" y="277" width="79" height="20"/> 509 <textElement textAlignment="Center" verticalAlignment="Middle"/> 510 </textField> 511 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 512 <reportElement x="157" y="237" width="79" height="20"/> 513 <textElement textAlignment="Center" verticalAlignment="Middle"/> 514 </textField> 515 <textField pattern="#,##0.00 %" isBlankWhenNull="true"> 516 <reportElement x="157" y="217" width="79" height="20"/> 517 <textElement verticalAlignment="Middle"/> 518 </textField> 519 <line> 520 <reportElement x="0" y="257" width="353" height="1" forecolor="#999999"/> 521 </line> 522 <line> 523 <reportElement x="0" y="297" width="353" height="1" forecolor="#999999"/> 524 </line> 525 <textField pattern="###0.00" isBlankWhenNull="true"> 526 <reportElement x="0" y="277" width="157" height="20"/> 527 <textElement verticalAlignment="Middle"/> 528 <textFieldExpression class="java.lang.String"><![CDATA["Total Preventative: "]]></textFieldExpression> 529 </textField> 530 <textField isBlankWhenNull="true"> 531 <reportElement x="236" y="277" width="117" height="20"/> 532 <textElement textAlignment="Center" verticalAlignment="Middle"/> 533 <textFieldExpression class="java.lang.String"><![CDATA[$F{totalPreventativeWorkDone}.hours+":"+$F{totalPreventativeWorkDone}.minutes]]></textFieldExpression> 534 </textField> 535 <line> 536 <reportElement x="0" y="236" width="353" height="1" forecolor="#999999"/> 537 </line> 538 <textField pattern="###0.00" isBlankWhenNull="true"> 539 <reportElement x="236" y="217" width="117" height="20"/> 540 <textElement verticalAlignment="Middle"/> 541 </textField> 542 <textField isBlankWhenNull="true"> 543 <reportElement x="0" y="237" width="157" height="20"/> 544 <textElement verticalAlignment="Middle" markup="none"/> 545 <textFieldExpression class="java.lang.String"><![CDATA["Unscheduled Breakin: "]]></textFieldExpression> 546 </textField> 547 <textField isBlankWhenNull="true"> 548 <reportElement x="0" y="257" width="157" height="20"/> 549 <textElement verticalAlignment="Middle" markup="none"/> 550 <textFieldExpression class="java.lang.String"><![CDATA["Preventative Maintenance"]]></textFieldExpression> 551 </textField> 552 <line> 553 <reportElement x="0" y="217" width="353" height="1" forecolor="#999999"/> 554 </line> 555 <textField isBlankWhenNull="true"> 556 <reportElement x="236" y="257" width="117" height="20"/> 557 <textElement textAlignment="Center" verticalAlignment="Middle"/> 558 <textFieldExpression class="java.lang.String"><![CDATA[$F{preventativeMaintenanceWorkDone}.hours+":"+$F{preventativeMaintenanceWorkDone}.minutes]]></textFieldExpression> 559 </textField> 560 <textField pattern="###0.00" isBlankWhenNull="true"> 561 <reportElement x="236" y="237" width="117" height="20"/> 562 <textElement textAlignment="Center" verticalAlignment="Middle"/> 563 <textFieldExpression class="java.lang.String"><![CDATA[$F{unscheduledBreakinWorkDone}.hours+":"+$F{unscheduledBreakinWorkDone}.minutes]]></textFieldExpression> 327 564 </textField> 328 565 </band>
Note: See TracChangeset
for help on using the changeset viewer.