diff --git a/src/main/java/info/bukova/isspst/data/TripRequirement.java b/src/main/java/info/bukova/isspst/data/TripRequirement.java index b82db0e7..e180571f 100644 --- a/src/main/java/info/bukova/isspst/data/TripRequirement.java +++ b/src/main/java/info/bukova/isspst/data/TripRequirement.java @@ -1,5 +1,6 @@ package info.bukova.isspst.data; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -35,6 +36,10 @@ public class TripRequirement extends RequirementBase { private List passengers; @Embedded private Vehicle vehicle; + @Column(name = "REQUIRE_DOWN_PAYMENT") + private Boolean requireDownPayment; + @Column(name = "DOWN_PAYMENT", precision = 15, scale = 4) + private BigDecimal downPayment; public TripRequirement() { this.setOwnedBy(new User()); @@ -97,4 +102,20 @@ public class TripRequirement extends RequirementBase { this.vehicle = vehicle; } + public Boolean getRequireDownPayment() { + return requireDownPayment; + } + + public void setRequireDownPayment(Boolean requireDownPayment) { + this.requireDownPayment = requireDownPayment; + } + + public BigDecimal getDownPayment() { + return downPayment; + } + + public void setDownPayment(BigDecimal downPayment) { + this.downPayment = downPayment; + } + } diff --git a/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java b/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java index 91c2e662..1c6bcca2 100644 --- a/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java @@ -92,6 +92,10 @@ public class TripBillServiceImpl extends AbstractOwnedService implemen calculateItem(item); bill.setTotal(bill.getTotal().add(item.getTotal())); } + + if (bill.getRequirement().getDownPayment() != null) { + bill.setTotal(bill.getTotal().subtract(bill.getRequirement().getDownPayment())); + } } private void calculateItem(TripBillItem item) { diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jasper b/src/main/webapp/WEB-INF/reports/tripBill.jasper index b58fe220..ddf3e513 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripBill.jasper and b/src/main/webapp/WEB-INF/reports/tripBill.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jrxml b/src/main/webapp/WEB-INF/reports/tripBill.jrxml index 70cb63c0..5c39e24a 100644 --- a/src/main/webapp/WEB-INF/reports/tripBill.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripBill.jrxml @@ -1,8 +1,8 @@ - - + + @@ -39,6 +39,7 @@ + @@ -328,8 +329,8 @@ tuzemské pracovní cesty]]> - - + + @@ -354,6 +355,11 @@ tuzemské pracovní cesty]]> + + + + + diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper index 6dbf85eb..2362b89f 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper and b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml index 4b1a9ffc..4a5d74e4 100644 --- a/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml @@ -1,8 +1,8 @@ - + - +