diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index a7332c47..78ec2a99 100644 --- a/src/main/java/info/bukova/isspst/Constants.java +++ b/src/main/java/info/bukova/isspst/Constants.java @@ -94,7 +94,8 @@ public class Constants { public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava"; public final static ReportMapping REPORTS[] = { new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresní karty", "address")), - new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresna", "address", false, true)) + new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresa", "address", false, true)), + new ReportMapping(MOD_TRIPBILL, new Report("Žádost", "tripRequirement", false, true)) }; public final static String REQTYPE_ORDER = "ORDER"; diff --git a/src/main/java/info/bukova/isspst/data/TripRequirement.java b/src/main/java/info/bukova/isspst/data/TripRequirement.java index 54d4ffea..b82db0e7 100644 --- a/src/main/java/info/bukova/isspst/data/TripRequirement.java +++ b/src/main/java/info/bukova/isspst/data/TripRequirement.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; @@ -30,7 +29,7 @@ public class TripRequirement extends RequirementBase { private String end; @Column(name = "END_DATE") private Date endDate; - @ManyToMany(cascade = CascadeType.ALL) + @ManyToMany @LazyCollection(LazyCollectionOption.TRUE) @JoinTable(name="TRIPREQUIREMENT_PASSANGER", joinColumns={@JoinColumn(name="TRIPREQUIREMENT_ID")}, inverseJoinColumns={@JoinColumn(name="USER_ID")}) private List passengers; diff --git a/src/main/java/info/bukova/isspst/services/tripbill/TripBillService.java b/src/main/java/info/bukova/isspst/services/tripbill/TripBillService.java index 14ce763d..d73d7278 100644 --- a/src/main/java/info/bukova/isspst/services/tripbill/TripBillService.java +++ b/src/main/java/info/bukova/isspst/services/tripbill/TripBillService.java @@ -12,5 +12,7 @@ public interface TripBillService extends Service { public void loadItems(TripBill bill); public void calculate(TripBill bill); public List getMy(); + public void loadOwner(TripBill bill); + public void loadPassengers(TripBill bill); } 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 0bfa6c59..f35acb75 100644 --- a/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java @@ -61,7 +61,7 @@ public class TripBillServiceImpl extends AbstractOwnedService implemen @Override @Transactional - @LazyLoader("form") + @LazyLoader({"form", "print"}) public void loadItems(TripBill entity) { try { if (entity.getBillItems() == null) { @@ -174,4 +174,24 @@ public class TripBillServiceImpl extends AbstractOwnedService implemen return this.execQuery("from TripBill as tb join fetch tb.ownedBy"); } + @Override + @Transactional + @LazyLoader("print") + public void loadOwner(TripBill bill) { + TripBill tb = dao.getById(bill.getId()); + tb.getOwnedBy().getFirstName(); + bill.setOwnedBy(tb.getOwnedBy()); + } + + @Override + @Transactional + @LazyLoader("print") + public void loadPassengers(TripBill bill) { + Query q = dao.getQuery("from TripRequirement where id = :id"); + q.setParameter("id", bill.getRequirement().getId()); + TripRequirement tr = (TripRequirement) q.uniqueResult(); + tr.getPassengers().size(); + bill.getRequirement().setPassengers(tr.getPassengers()); + } + } diff --git a/src/main/webapp/WEB-INF/reports/tripRequirement.jasper b/src/main/webapp/WEB-INF/reports/tripRequirement.jasper new file mode 100644 index 00000000..6dbf85eb Binary files /dev/null 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 new file mode 100644 index 00000000..4b1a9ffc --- /dev/null +++ b/src/main/webapp/WEB-INF/reports/tripRequirement.jrxml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="79" splitType="Stretch"> + <staticText> + <reportElement uuid="50f96189-2183-4afd-915d-b5342375e988" x="0" y="30" width="572" height="20"/> + <textElement textAlignment="Center"> + <font size="16" isBold="true" isPdfEmbedded="true"/> + </textElement> + <text><![CDATA[Cestovní příkaz]]></text> + </staticText> + <staticText> + <reportElement uuid="5b2dc2ca-188e-4636-b617-dd5c1132246b" x="0" y="50" width="572" height="20"/> + <textElement textAlignment="Center"> + <font size="16" isBold="true"/> + </textElement> + <text><![CDATA[k tuzemské pracovní cestě]]></text> + </staticText> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +