diff --git a/src/main/java/info/bukova/isspst/data/SettingsData.java b/src/main/java/info/bukova/isspst/data/SettingsData.java index ae1674dd..b068c08b 100644 --- a/src/main/java/info/bukova/isspst/data/SettingsData.java +++ b/src/main/java/info/bukova/isspst/data/SettingsData.java @@ -14,6 +14,7 @@ public class SettingsData { private MailMessage newReqTemplate; private MailMessage authReqTemplate; private MailMessage confReqTemplate; + private MailMessage confReqTripPassenger; private Address mainAddress; private List
shippingAddrs; private String bankName; @@ -28,6 +29,7 @@ public class SettingsData { newReqTemplate = new MailMessage(); authReqTemplate = new MailMessage(); confReqTemplate = new MailMessage(); + confReqTripPassenger = new MailMessage(); mainAddress = new Address(); shippingAddrs = new ArrayList
(); vehicles = new ArrayList(); @@ -150,4 +152,12 @@ public class SettingsData { { this.logoFile = logoFile; } + + public MailMessage getConfReqTripPassenger() { + return confReqTripPassenger; + } + + public void setConfReqTripPassenger(MailMessage confReqTripPassenger) { + this.confReqTripPassenger = confReqTripPassenger; + } } diff --git a/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java index e4b0d1f1..0a2c823c 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java @@ -7,10 +7,14 @@ import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.User; +import info.bukova.isspst.mail.MailMessage; +import info.bukova.isspst.mail.Mailer; +import info.bukova.isspst.mail.MessageBuilder; import info.bukova.isspst.services.LazyLoader; +import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.tripbill.TripBillApprovalService; import info.bukova.isspst.services.tripbill.TripBillService; -import info.bukova.isspst.services.workgroups.WorkgroupService; +import info.bukova.isspst.services.users.UserService; import org.hibernate.Hibernate; import org.hibernate.LazyInitializationException; import org.hibernate.Query; @@ -27,11 +31,17 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl { public TripBill createTripBill(TripRequirement requirement); + public TripBill createPassengersBill(TripRequirement requirement); public void loadItems(TripBill bill); public void calculate(TripBill bill); public List getMy(); 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 9c0ddd27..d0aa9d21 100644 --- a/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/tripbill/TripBillServiceImpl.java @@ -33,13 +33,26 @@ public class TripBillServiceImpl extends AbstractOwnedService implemen @Override public TripBill createTripBill(TripRequirement requirement) { + return createBill(requirement, false); + } + + @Override + public TripBill createPassengersBill(TripRequirement requirement) { + return createBill(requirement, true); + } + + private TripBill createBill(TripRequirement requirement, boolean passengers) { TripBill bill = new TripBill(); - + bill.setRequirement(requirement); - - int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(), + + if (!passengers) { + bill.setDownPayment(requirement.getDownPayment()); + } + + int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(), (new DateTime(requirement.getEndDate())).withTimeAtStartOfDay()).getDays() + 1; - + for (int i = 0 ; i < daysCount ; i++) { TripBillItem item = new TripBillItem(); if (i == 0) { @@ -50,17 +63,17 @@ public class TripBillServiceImpl extends AbstractOwnedService implemen item.setBack(requirement.getTo() + " - " + requirement.getFrom()); item.setBackVehicle(requirement.getVehicle()); } - + Calendar calTripDate = Calendar.getInstance(); calTripDate.setTime(requirement.getTripDate()); calTripDate.add(Calendar.DATE, i); item.setDate(calTripDate.getTime()); - + bill.getBillItems().add(item); } - + this.calculate(bill); - + return bill; } @@ -102,8 +115,8 @@ public class TripBillServiceImpl extends AbstractOwnedService implemen bill.setTotal(bill.getTotal().add(item.getTotal())); } - if (bill.getRequirement().getDownPayment() != null) { - bill.setTotal(bill.getTotal().subtract(bill.getRequirement().getDownPayment())); + if (bill.getDownPayment() != null) { + bill.setTotal(bill.getTotal().subtract(bill.getDownPayment())); } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index a800620e..a6754a1e 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -396,7 +396,7 @@ Pending = Nevyřízené Archive = Archiv Completed = Vyřízeno -GenerateBillingForPassengers = Generovat vyúčtování pro spolucestující +GenerateBillingForPassengers = Generovat společný požadavek a vyúčtování Passenger = Pasažér ChooseThePasseger = Vyberte pasažéra TransportMode = Způsob dopravy diff --git a/src/main/webapp/WEB-INF/reports/tripBill.jasper b/src/main/webapp/WEB-INF/reports/tripBill.jasper index d324b8cd..2d1911c6 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/tripBillItems.jasper b/src/main/webapp/WEB-INF/reports/tripBillItems.jasper index 3b13ab43..b34f6c8d 100644 Binary files a/src/main/webapp/WEB-INF/reports/tripBillItems.jasper and b/src/main/webapp/WEB-INF/reports/tripBillItems.jasper differ diff --git a/src/main/webapp/WEB-INF/reports/tripBillItems.jrxml b/src/main/webapp/WEB-INF/reports/tripBillItems.jrxml index dd856994..047466cb 100644 --- a/src/main/webapp/WEB-INF/reports/tripBillItems.jrxml +++ b/src/main/webapp/WEB-INF/reports/tripBillItems.jrxml @@ -1,7 +1,7 @@ - + @@ -381,28 +381,28 @@ výdaje]]> - + - + - + - + diff --git a/src/main/webapp/main/trips/tripBillInterior.zul b/src/main/webapp/main/trips/tripBillInterior.zul index f8193f67..676747a0 100644 --- a/src/main/webapp/main/trips/tripBillInterior.zul +++ b/src/main/webapp/main/trips/tripBillInterior.zul @@ -506,7 +506,7 @@ value="Záloha: " style="font-size: 14px;" />