Add exclamation mark in status report if hours or cost exceed the expected value
FEA: ItEr77S09WBSReport
This commit is contained in:
parent
33eb2ddcd0
commit
3681464dc9
3 changed files with 100 additions and 24 deletions
|
|
@ -33,7 +33,7 @@ import org.libreplan.business.workingday.EffortDuration;
|
|||
*/
|
||||
public class ProjectStatusReportDTO {
|
||||
|
||||
private static final String INDENT_PREFIX = " ";
|
||||
private static final String EXCLAMATION_MARK = "!";
|
||||
|
||||
private String code;
|
||||
|
||||
|
|
@ -45,6 +45,8 @@ public class ProjectStatusReportDTO {
|
|||
|
||||
private EffortDuration imputedHours;
|
||||
|
||||
private String hoursMark;
|
||||
|
||||
private BigDecimal budget;
|
||||
|
||||
private BigDecimal hoursCost;
|
||||
|
|
@ -53,6 +55,8 @@ public class ProjectStatusReportDTO {
|
|||
|
||||
private BigDecimal totalCost;
|
||||
|
||||
private String costMark;
|
||||
|
||||
public ProjectStatusReportDTO(EffortDuration estimatedHours,
|
||||
EffortDuration plannedHours, EffortDuration imputedHours,
|
||||
BigDecimal budget, BigDecimal hoursCost, BigDecimal expensesCost,
|
||||
|
|
@ -208,4 +212,58 @@ public class ProjectStatusReportDTO {
|
|||
return Util.getFractionalPart(totalCost);
|
||||
}
|
||||
|
||||
public void calculateMarks() {
|
||||
calculateHoursMark();
|
||||
calculateCostMark();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ProjectStatusReportDTO#hoursMark} will be <code>!</code> if
|
||||
* {@link ProjectStatusReportDTO#imputedHours} is bigger than
|
||||
* {@link ProjectStatusReportDTO#plannedHours}. If the task is not planned,
|
||||
* then the comparison will be done against
|
||||
* {@link ProjectStatusReportDTO#estimatedHours}, if it is zero then the
|
||||
* mark will be empty.
|
||||
*/
|
||||
private void calculateHoursMark() {
|
||||
if (imputedHours != null) {
|
||||
if (plannedHours == null || plannedHours.isZero()) {
|
||||
if (estimatedHours != null && !estimatedHours.isZero()) {
|
||||
if (imputedHours.compareTo(estimatedHours) > 0) {
|
||||
hoursMark = EXCLAMATION_MARK;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (imputedHours.compareTo(plannedHours) > 0) {
|
||||
hoursMark = EXCLAMATION_MARK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ProjectStatusReportDTO#costMark} will be <code>!</code> if
|
||||
* {@link ProjectStatusReportDTO#totalCost} is bigger than
|
||||
* {@link ProjectStatusReportDTO#budget}. If
|
||||
* {@link ProjectStatusReportDTO#budget} is zero then the mark will be
|
||||
* empty.
|
||||
*/
|
||||
private void calculateCostMark() {
|
||||
if (totalCost != null) {
|
||||
if (budget != null && (budget.compareTo(BigDecimal.ZERO) > 0)) {
|
||||
if (totalCost.compareTo(budget) > 0) {
|
||||
costMark = EXCLAMATION_MARK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getHoursMark() {
|
||||
return hoursMark;
|
||||
}
|
||||
|
||||
public String getCostMark() {
|
||||
return costMark;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="resourcesList" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="projectStatus" uuid="17a95f07-ce2e-43c0-8da8-bfe1b9d826c2">
|
||||
<property name="ireport.zoom" value="2.0"/>
|
||||
<property name="ireport.x" value="0"/>
|
||||
<property name="ireport.x" value="492"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<style name="dejavu-sans" isDefault="true" fontName="DejaVu Sans" fontSize="8"/>
|
||||
<style name="row-grey" style="dejavu-sans">
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
<field name="estimatedHours" class="java.lang.String"/>
|
||||
<field name="plannedHours" class="java.lang.String"/>
|
||||
<field name="imputedHours" class="java.lang.String"/>
|
||||
<field name="hoursMark" class="java.lang.String"/>
|
||||
<field name="budgetIntegerPart" class="java.math.BigDecimal"/>
|
||||
<field name="budgetFractionalPart" class="java.math.BigDecimal"/>
|
||||
<field name="hoursCostIntegerPart" class="java.math.BigDecimal"/>
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
<field name="expensesCostFractionalPart" class="java.math.BigDecimal"/>
|
||||
<field name="totalCostIntegerPart" class="java.math.BigDecimal"/>
|
||||
<field name="totalCostFractionalPart" class="java.math.BigDecimal"/>
|
||||
<field name="costMark" class="java.lang.String"/>
|
||||
<background>
|
||||
<band splitType="Stretch"/>
|
||||
</background>
|
||||
|
|
@ -74,7 +76,7 @@
|
|||
<textFieldExpression><![CDATA[$P{project}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement uuid="a3d6bdd8-5c6f-462b-aebd-033e0f89211d" x="0" y="15" width="60" height="12">
|
||||
<reportElement uuid="96a4cd45-df8c-4c3e-b3e5-ba1bf959025f" x="0" y="15" width="60" height="12">
|
||||
<printWhenExpression><![CDATA[$P{project} == null]]></printWhenExpression>
|
||||
</reportElement>
|
||||
<textElement>
|
||||
|
|
@ -83,7 +85,7 @@
|
|||
<textFieldExpression><![CDATA[$R{filter}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="24abd130-337a-4a7c-aa87-7f8e063487a3" x="60" y="15" width="562" height="12">
|
||||
<reportElement uuid="407b43e5-13d7-477e-a90c-34e0447610fc" x="60" y="15" width="562" height="12">
|
||||
<printWhenExpression><![CDATA[$P{project} == null]]></printWhenExpression>
|
||||
</reportElement>
|
||||
<textElement textAlignment="Left" verticalAlignment="Middle">
|
||||
|
|
@ -208,7 +210,7 @@
|
|||
<textFieldExpression><![CDATA[$R{code}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="82352929-5e6a-4feb-9f54-fd2c97eb7cea" x="100" y="0" width="332" height="15"/>
|
||||
<reportElement uuid="82352929-5e6a-4feb-9f54-fd2c97eb7cea" x="100" y="0" width="322" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -219,7 +221,7 @@
|
|||
<textFieldExpression><![CDATA[$R{name}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="432" y="0" width="50" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="422" y="0" width="50" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -230,7 +232,7 @@
|
|||
<textFieldExpression><![CDATA[$R{estimated_hours}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="482" y="0" width="50" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="472" y="0" width="50" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -241,7 +243,7 @@
|
|||
<textFieldExpression><![CDATA[$R{planned_hours}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="532" y="0" width="50" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="522" y="0" width="55" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -252,7 +254,7 @@
|
|||
<textFieldExpression><![CDATA[$R{imputed_hours}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="582" y="0" width="55" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="577" y="0" width="55" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -263,7 +265,7 @@
|
|||
<textFieldExpression><![CDATA[$R{budget}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="637" y="0" width="55" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="632" y="0" width="55" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -274,7 +276,7 @@
|
|||
<textFieldExpression><![CDATA[$R{hours_cost}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="692" y="0" width="55" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="687" y="0" width="55" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -285,7 +287,7 @@
|
|||
<textFieldExpression><![CDATA[$R{expenses_cost}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="747" y="0" width="55" height="15"/>
|
||||
<reportElement uuid="faae6657-606f-49ed-b11f-1085bc10a38a" x="742" y="0" width="58" height="15"/>
|
||||
<box>
|
||||
<pen lineWidth="0.0"/>
|
||||
<bottomPen lineWidth="0.25"/>
|
||||
|
|
@ -305,65 +307,79 @@
|
|||
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="04220d70-bab8-480f-b0db-8e3efd43965a" style="row-grey" x="100" y="0" width="332" height="15"/>
|
||||
<reportElement uuid="04220d70-bab8-480f-b0db-8e3efd43965a" style="row-grey" x="100" y="0" width="322" height="15"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="432" y="0" width="50" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="422" y="0" width="50" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{estimatedHours}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="482" y="0" width="50" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="472" y="0" width="50" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{plannedHours}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="532" y="0" width="50" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="522" y="0" width="50" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{imputedHours}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="16348737-c53b-4739-8f53-2d68cc499821" style="row-grey" x="572" y="0" width="5" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{hoursMark}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="582" y="0" width="40" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="577" y="0" width="40" height="15"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{budgetIntegerPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern=".##" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="622" y="0" width="15" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="617" y="0" width="15" height="15"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{budgetFractionalPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="637" y="0" width="40" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="632" y="0" width="40" height="15"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{hoursCostIntegerPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern=".##" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="677" y="0" width="15" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="672" y="0" width="15" height="15"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{hoursCostFractionalPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="692" y="0" width="40" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="687" y="0" width="40" height="15"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{expensesCostIntegerPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern=".##" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="732" y="0" width="15" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="727" y="0" width="15" height="15"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{expensesCostFractionalPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="#" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="747" y="0" width="40" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="742" y="0" width="40" height="15"/>
|
||||
<textElement textAlignment="Right" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{totalCostIntegerPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern=".##" isBlankWhenNull="true">
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="787" y="0" width="15" height="15"/>
|
||||
<reportElement uuid="1fe3ef4c-0cfe-45d2-96b1-c7f58d835509" style="row-grey" x="782" y="0" width="15" height="15"/>
|
||||
<textElement textAlignment="Left" verticalAlignment="Middle"/>
|
||||
<textFieldExpression><![CDATA[$F{totalCostFractionalPart}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField isBlankWhenNull="true">
|
||||
<reportElement uuid="16348737-c53b-4739-8f53-2d68cc499821" style="row-grey" x="797" y="0" width="5" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font isBold="true"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{costMark}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
<columnFooter>
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ public class ProjectStatusReportModel implements IProjectStatusReportModel {
|
|||
dto = discountChildrenWithInvalidatedCriteria(orderElement, dto);
|
||||
}
|
||||
|
||||
dto.calculateMarks();
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue