From c2ca2e45ecd92916e0a6121240c97d7c83980565 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sat, 13 Jun 2015 00:00:00 +0200 Subject: [PATCH] Opraveno generovani vyuctovani sluzebni cesty spolucestujicich, pokud je pozadovana zaloha- zaloha se nyni neprenese. closes #229 Po schvaleni pozadavku na sluzebni cestu se spolucestujicimi se posle mail o schvaleni i spolucestujicim. closes #228 --- .../info/bukova/isspst/data/SettingsData.java | 10 +++++ .../TripRequirementServiceImpl.java | 25 +++++++++++-- .../services/tripbill/TripBillService.java | 1 + .../tripbill/TripBillServiceImpl.java | 33 ++++++++++++----- .../WEB-INF/locales/zk-label.properties | 2 +- .../webapp/WEB-INF/reports/tripBill.jasper | Bin 54254 -> 54342 bytes .../WEB-INF/reports/tripBillItems.jasper | Bin 47113 -> 47155 bytes .../WEB-INF/reports/tripBillItems.jrxml | 10 ++--- .../webapp/main/trips/tripBillInterior.zul | 2 +- src/main/webapp/settings/global/email.zul | 35 +++++++++++++++++- 10 files changed, 96 insertions(+), 22 deletions(-) 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 d324b8cdd784c93c9b127615639290ed9af1c9d0..2d1911c6815ad5018c594b7f9a72d310e387d7fc 100644 GIT binary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i9{4jC#s)N9f#Hk>VrdG zb6B2J$=^5}QdDCuqVarFq2$G&eH@2WMl?y-r6eLTiAYSs(wSt0lH^C$N|H##YyO;) zyq}c>A4TTL{H*?feF`H`c|#L{U5X$QBZ$NZES(YFpu6X-%#nOqoLa4$c>!quo9tqliM--KhH7IroB@$605yjGp`j{@Z14pA5+ux3Q&Clhs zpY2xvE-{SPLJA#w?Qi;V(7ujws9e*;VVB~F#5f``4ohd8YZT|9m)1$=CtfPbaD9y| zDz`K&c8MhtSt60e(#g67yMEFsoEgJjGm);a(&6Y;*Qw@a$x)=qy8jLb%jc*#2~=h~ zzf3b?|6wBrM2>sr^VW{23A5=~Iu2#RtYgu5tB-lj6pFlmYVJ)nw?NG; zhOdv|E#V$1G#5tSO=ugLD{YL81k0CT8&uLYZLq6pBi5MK1{>6dtWkYT`{YPSS8dct zglnV0@)a0?%5qHvb~O=VjcF0spa`81e<~7%=H!cMR$D-HTAJp7~XKtu*>Jk4sbt4+a+?JVGQMTgI z#vOsISMFan_WL`(dRNV@FvF&i*4(%wRJdc;uFC9HIr(|MTwhN1%AB0a?7aMMWoMu1 QdSzeM-FIm{aDSNhKOJ*|$N&HU diff --git a/src/main/webapp/WEB-INF/reports/tripBillItems.jasper b/src/main/webapp/WEB-INF/reports/tripBillItems.jasper index 3b13ab43b81f8ec79ad81fe1ca0b4e480ea7d48f..b34f6c8d2242132fe5abc5e1293a941c4e35e0e3 100644 GIT binary patch delta 142 zcmeDDz_j@T(+1vv$?qfNCr@bRnye7avROYMf)Po8WAoa;P`JQmgU~J6Jz{tp;Gr5peX7kcXvZ|t(DoPlP NCL6NLO#ZxG3;>uMF4+J8 delta 135 zcmdn|fvNKY(+1vv$#WbOH(LfoGJ+ZV0;3=dm*7wkLuB&4D89*O+W02#i - + @@ -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;" />