Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b0fedfa3f3 | |||
| dc0607c072 | |||
| 4d74b0a3fe | |||
| 3b3e4b38e6 | |||
| c2ca2e45ec | |||
| aaa89a2653 | |||
| fbc7a02161 | |||
| e5a8e0f0d9 | |||
| 0f169f8be9 | |||
| b6d0546b48 | |||
| a6799064f7 |
@@ -7,6 +7,7 @@ import info.bukova.isspst.data.Requirement;
|
||||
import info.bukova.isspst.data.RequirementType;
|
||||
import info.bukova.isspst.data.Role;
|
||||
import info.bukova.isspst.data.TripBill;
|
||||
import info.bukova.isspst.data.TripBillApproval;
|
||||
import info.bukova.isspst.data.TripRequirement;
|
||||
import info.bukova.isspst.reporting.Report;
|
||||
import info.bukova.isspst.reporting.ReportMapping;
|
||||
@@ -33,7 +34,7 @@ import java.util.Map;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public final static long DB_VERSION = 4;
|
||||
public final static long DB_VERSION = 5;
|
||||
|
||||
public final static String DEF_ADMIN = "admin";
|
||||
public final static String DEF_ADMIN_PASSWD = "admin";
|
||||
@@ -155,10 +156,12 @@ public class Constants {
|
||||
public final static Map<Class<?>, String> URL_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, String>() {{
|
||||
put(Requirement.class, "/main/orders/");
|
||||
put(TripRequirement.class, "/main/trips/requirements/");
|
||||
put(TripBillApproval.class, "/main/trips/requirements/");
|
||||
put(Order.class, "/main/orders/created/");
|
||||
put(TripBill.class, "/main/trips/bill/");
|
||||
}} );
|
||||
|
||||
public final static int LEN_TEXT = 255;
|
||||
public final static int LEN_DESCRIPTION = 8192;
|
||||
public final static int LEN_RESULT_MESSAGE = 8192;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package info.bukova.isspst;
|
||||
|
||||
import info.bukova.isspst.data.TripBillApproval;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author Pepa Rokos
|
||||
*/
|
||||
public class TripBillAprovalUrlResolver implements EntityUrlResolver {
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
@Override
|
||||
public String entityUrl(Object entity) {
|
||||
String defUrl = request.getRequestURL().toString();
|
||||
defUrl = defUrl.substring(0, defUrl.indexOf(request.getServletPath()));
|
||||
|
||||
if (entity instanceof TripBillApproval) {
|
||||
String url = Constants.URL_MAP.get(entity.getClass());
|
||||
|
||||
return defUrl + url + "?select=" + String.valueOf(((TripBillApproval)entity).getBill().getRequirement().getId());
|
||||
}
|
||||
|
||||
return defUrl + "/app";
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,8 @@ public class SettingsData {
|
||||
private MailMessage newReqTemplate;
|
||||
private MailMessage authReqTemplate;
|
||||
private MailMessage confReqTemplate;
|
||||
private MailMessage confReqTripPassenger;
|
||||
private MailMessage reqPassenger;
|
||||
private Address mainAddress;
|
||||
private List<Address> shippingAddrs;
|
||||
private String bankName;
|
||||
@@ -28,6 +30,8 @@ public class SettingsData {
|
||||
newReqTemplate = new MailMessage();
|
||||
authReqTemplate = new MailMessage();
|
||||
confReqTemplate = new MailMessage();
|
||||
confReqTripPassenger = new MailMessage();
|
||||
reqPassenger = new MailMessage();
|
||||
mainAddress = new Address();
|
||||
shippingAddrs = new ArrayList<Address>();
|
||||
vehicles = new ArrayList<Vehicle>();
|
||||
@@ -150,4 +154,20 @@ public class SettingsData {
|
||||
{
|
||||
this.logoFile = logoFile;
|
||||
}
|
||||
|
||||
public MailMessage getConfReqTripPassenger() {
|
||||
return confReqTripPassenger;
|
||||
}
|
||||
|
||||
public void setConfReqTripPassenger(MailMessage confReqTripPassenger) {
|
||||
this.confReqTripPassenger = confReqTripPassenger;
|
||||
}
|
||||
|
||||
public MailMessage getReqPassenger() {
|
||||
return reqPassenger;
|
||||
}
|
||||
|
||||
public void setReqPassenger(MailMessage reqPassenger) {
|
||||
this.reqPassenger = reqPassenger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.storage.EntityWithAttachment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.LazyCollection;
|
||||
import org.hibernate.annotations.LazyCollectionOption;
|
||||
import org.hibernate.search.annotations.Analyze;
|
||||
@@ -9,20 +25,6 @@ import org.hibernate.search.annotations.Index;
|
||||
import org.hibernate.search.annotations.Indexed;
|
||||
import org.hibernate.search.annotations.IndexedEmbedded;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "TRIP_BILL")
|
||||
@Indexed
|
||||
@@ -36,7 +38,7 @@ public class TripBill extends BaseData implements EntityWithAttachment {
|
||||
@Column(name = "SIGN_DATE")
|
||||
private Date signDate;
|
||||
|
||||
@Column(name = "RESULT_MESSAGE")
|
||||
@Column(name = "RESULT_MESSAGE", length = Constants.LEN_RESULT_MESSAGE)
|
||||
@Field(index = Index.YES, analyze = Analyze.YES)
|
||||
private String resultMessage;
|
||||
|
||||
@@ -60,7 +62,7 @@ public class TripBill extends BaseData implements EntityWithAttachment {
|
||||
@LazyCollection(LazyCollectionOption.TRUE)
|
||||
@IndexedEmbedded
|
||||
private List<FileMetainfo> attachedFiles;
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "APPROVAL_ID")
|
||||
private TripBillApproval approval;
|
||||
@Column(name = "SAVED")
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
@@ -11,4 +14,31 @@ import javax.persistence.Table;
|
||||
@Table(name = "TRIP_BILL_APPROVAL")
|
||||
public class TripBillApproval extends RequirementBase {
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "TRIPBILL_ID")
|
||||
private TripBill bill;
|
||||
|
||||
@Override
|
||||
public String getNumser() {
|
||||
|
||||
if (bill == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
TripRequirement tr = bill.getRequirement();
|
||||
|
||||
if (tr == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return tr.getNumser();
|
||||
}
|
||||
|
||||
public TripBill getBill() {
|
||||
return bill;
|
||||
}
|
||||
|
||||
public void setBill(TripBill bill) {
|
||||
this.bill = bill;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package info.bukova.isspst.reporting;
|
||||
|
||||
import com.mysql.jdbc.StringUtils;
|
||||
import info.bukova.isspst.data.Address;
|
||||
import info.bukova.isspst.data.AuthItem;
|
||||
import info.bukova.isspst.data.Order;
|
||||
@@ -8,16 +9,14 @@ import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.UserSettingsData;
|
||||
import info.bukova.isspst.services.requirement.TripRequirementService;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.storage.FileStorage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.mysql.jdbc.StringUtils;
|
||||
|
||||
public class ParamFiller {
|
||||
|
||||
@Autowired
|
||||
@@ -30,6 +29,8 @@ public class ParamFiller {
|
||||
private TripRequirementService tripReqService;
|
||||
@Autowired
|
||||
private GlobalSettingsService settingService;
|
||||
@Autowired
|
||||
private TripBillApprovalService tripBillApprovalService;
|
||||
|
||||
public void fill() {
|
||||
if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
|
||||
@@ -57,25 +58,31 @@ public class ParamFiller {
|
||||
TripBill tb = (TripBill)definition.getDataSet().get(0);
|
||||
tripReqService.loadAuthItems(tb.getRequirement());
|
||||
|
||||
AuthItem lastButOneAuth = tb.getRequirement().getAuthorization().get(0);
|
||||
definition.setParam("P_PREV_APPROVE_DATE", lastButOneAuth.getAuthDate());
|
||||
|
||||
User lastButOneUser = lastButOneAuth.getApprover();
|
||||
UserSettingsData prevApproverSettings = userService.getUserSettings(lastButOneUser);
|
||||
|
||||
if (prevApproverSettings != null && !StringUtils.isNullOrEmpty(prevApproverSettings.getSignatureFile())) {
|
||||
definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
|
||||
if (tb.getApproval() != null) {
|
||||
tripBillApprovalService.loadAuthItems(tb.getApproval());
|
||||
}
|
||||
|
||||
if (tb.getApproval() != null && tb.getApproval().getAuthorization() != null && !tb.getApproval().getAuthorization().isEmpty()) {
|
||||
|
||||
AuthItem lastAuth = tb.getRequirement().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
|
||||
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
|
||||
AuthItem lastButOneAuth = tb.getApproval().getAuthorization().get(0);
|
||||
definition.setParam("P_PREV_APPROVE_DATE", lastButOneAuth.getAuthDate());
|
||||
|
||||
User u = lastAuth.getApprover();
|
||||
UserSettingsData approverSettings = userService.getUserSettings(u);
|
||||
User lastButOneUser = lastButOneAuth.getApprover();
|
||||
UserSettingsData prevApproverSettings = userService.getUserSettings(lastButOneUser);
|
||||
|
||||
if (approverSettings != null && !StringUtils.isNullOrEmpty(approverSettings.getSignatureFile())) {
|
||||
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
|
||||
if (prevApproverSettings != null && !StringUtils.isNullOrEmpty(prevApproverSettings.getSignatureFile())) {
|
||||
definition.setParam("P_PREV_APPROVER_SIGNATURE", storage.serverPath(prevApproverSettings.getSignatureFile()));
|
||||
}
|
||||
|
||||
AuthItem lastAuth = tb.getApproval().getAuthorization().get(tb.getRequirement().getAuthorization().size() - 1);
|
||||
definition.setParam("P_APPROVE_DATE", lastAuth.getAuthDate());
|
||||
|
||||
User u = lastAuth.getApprover();
|
||||
UserSettingsData approverSettings = userService.getUserSettings(u);
|
||||
|
||||
if (approverSettings != null && !StringUtils.isNullOrEmpty(approverSettings.getSignatureFile())) {
|
||||
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
||||
}
|
||||
}
|
||||
|
||||
// String source = UserCountUtils.encryptUserCount(1000);
|
||||
// long users = UserCountUtils.decryptUserCount(source);
|
||||
|
||||
long dbVersion = this.getDbInfo().getVersion();
|
||||
|
||||
if (Constants.DB_VERSION > dbVersion)
|
||||
@@ -133,6 +136,12 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
||||
sq.executeUpdate();
|
||||
}
|
||||
|
||||
if (dbVersion < 5) {
|
||||
sql = "ALTER TABLE TRIP_BILL MODIFY RESULT_MESSAGE VARCHAR(" + String.valueOf(Constants.LEN_RESULT_MESSAGE) + ")";
|
||||
sq = this.dao.getSession().createSQLQuery(sql);
|
||||
sq.executeUpdate();
|
||||
}
|
||||
|
||||
this.updateDatabaseVersion();
|
||||
}
|
||||
}
|
||||
|
||||
+41
-4
@@ -4,11 +4,17 @@ import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.data.NumberSeries;
|
||||
import info.bukova.isspst.data.RequirementState;
|
||||
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;
|
||||
@@ -25,9 +31,17 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
@Autowired
|
||||
private RequirementTypeService reqTypeService;
|
||||
@Autowired
|
||||
private WorkgroupService workgroupService;
|
||||
@Autowired
|
||||
private TripBillService tripBillService;
|
||||
@Autowired
|
||||
private TripBillApprovalService tripBillApprovalService;
|
||||
@Autowired
|
||||
private Mailer mailer;
|
||||
@Autowired
|
||||
private MessageBuilder messageBuilder;
|
||||
@Autowired
|
||||
private GlobalSettingsService settingsService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Override
|
||||
protected TripRequirement createEntity() {
|
||||
@@ -50,6 +64,12 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
TripBill newBill = tripBillService.createTripBill(entity);
|
||||
bill.getBillItems().clear();
|
||||
bill.getBillItems().addAll(newBill.getBillItems());
|
||||
TripBillApproval approval = bill.getApproval();
|
||||
|
||||
if (approval != null) {
|
||||
tripBillApprovalService.delete(approval);
|
||||
}
|
||||
|
||||
bill.setApproval(null);
|
||||
tripBillService.calculate(bill);
|
||||
tripBillService.update(bill);
|
||||
@@ -57,6 +77,21 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postAdd(TripRequirement entity) {
|
||||
super.postAdd(entity);
|
||||
sendMailToPassengers(entity, settingsService.getSettings().getReqPassenger());
|
||||
}
|
||||
|
||||
private void sendMailToPassengers(TripRequirement entity, MailMessage messageTemplate) {
|
||||
if (entity.getBillForPassengers() != null && !entity.getPassengers().isEmpty() && messageTemplate != null) {
|
||||
MailMessage message = messageBuilder.buildMessage(messageTemplate, entity);
|
||||
message.setFrom(userService.getCurrent().getEmail());
|
||||
message.setTo(userService.getEmailsForSend(entity.getPassengers()));
|
||||
mailer.send(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@LazyLoader("form")
|
||||
@@ -115,12 +150,14 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
if (entity.getBillForPassengers() != null && entity.getBillForPassengers()) {
|
||||
for (User u : entity.getPassengers()) {
|
||||
if (!u.equals(entity.getOwnedBy())) {
|
||||
TripBill passBill = tripBillService.createTripBill(entity);
|
||||
TripBill passBill = tripBillService.createPassengersBill(entity);
|
||||
tripBillService.add(passBill);
|
||||
passBill.setOwnedBy(u);
|
||||
tripBillService.update(passBill);
|
||||
}
|
||||
}
|
||||
|
||||
sendMailToPassengers(entity, settingsService.getSettings().getConfReqTripPassenger());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package info.bukova.isspst.services.tripbill;
|
||||
|
||||
import info.bukova.isspst.Constants;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
import info.bukova.isspst.data.RequirementState;
|
||||
import info.bukova.isspst.data.TripBill;
|
||||
import info.bukova.isspst.data.TripBillApproval;
|
||||
import info.bukova.isspst.services.IsspstException;
|
||||
import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl;
|
||||
import info.bukova.isspst.services.requirement.RequirementTypeService;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Pepa Rokos
|
||||
*/
|
||||
@@ -33,6 +35,9 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
|
||||
approval.setReqDate(new Date());
|
||||
approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP));
|
||||
approval.setState(RequirementState.NEW);
|
||||
// approval.setNumser(bill.getRequirement().getNumser());
|
||||
approval.setDescription(StringUtils.localize("TravelOrdersFormTitle") + " \"" + bill.getOwnedBy() + "\" - " + bill.getRequirement().getDescription());
|
||||
approval.setBill(bill);
|
||||
bill.setApproval(approval);
|
||||
return approval;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
public interface TripBillService extends Service<TripBill> {
|
||||
|
||||
public TripBill createTripBill(TripRequirement requirement);
|
||||
public TripBill createPassengersBill(TripRequirement requirement);
|
||||
public void loadItems(TripBill bill);
|
||||
public void calculate(TripBill bill);
|
||||
public List<TripBill> getMy();
|
||||
|
||||
@@ -33,10 +33,23 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> 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);
|
||||
|
||||
if (!passengers) {
|
||||
bill.setDownPayment(requirement.getDownPayment());
|
||||
}
|
||||
|
||||
int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(),
|
||||
(new DateTime(requirement.getEndDate())).withTimeAtStartOfDay()).getDays() + 1;
|
||||
|
||||
@@ -102,8 +115,8 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> 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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package info.bukova.isspst.ui.tripbill;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
import info.bukova.isspst.data.TripBill;
|
||||
import info.bukova.isspst.data.TripBillApproval;
|
||||
import info.bukova.isspst.data.TripBillItem;
|
||||
import info.bukova.isspst.data.Vehicle;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
||||
@@ -19,6 +20,7 @@ import org.zkoss.zul.Messagebox;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class TripBillForm extends FormWithUpload<TripBill> {
|
||||
@@ -36,6 +38,11 @@ public class TripBillForm extends FormWithUpload<TripBill> {
|
||||
vehicles = new ArrayList<Vehicle>();
|
||||
vehicles.add(null);
|
||||
vehicles.addAll(settingsService.getSettings().getVehicles());
|
||||
TripBill bill = getDataBean();
|
||||
|
||||
if (bill.getResultMessageDate() == null) {
|
||||
bill.setResultMessageDate(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
@Command
|
||||
@@ -56,14 +63,11 @@ public class TripBillForm extends FormWithUpload<TripBill> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Command
|
||||
@NotifyChange("errMessages")
|
||||
public void save(@BindingParam("window") Window win)
|
||||
public void saveForApproval(@BindingParam("window") Window win)
|
||||
{
|
||||
if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage()))
|
||||
{
|
||||
Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
|
||||
if (!canSaveForApproval()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,6 +93,26 @@ public class TripBillForm extends FormWithUpload<TripBill> {
|
||||
|
||||
}
|
||||
|
||||
private boolean canSaveForApproval() {
|
||||
if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage())) {
|
||||
Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getDataBean().getBillItems() != null && !getDataBean().getBillItems().isEmpty()) {
|
||||
TripBillItem first = getDataBean().getBillItems().get(0);
|
||||
TripBillItem last = getDataBean().getBillItems().get(getDataBean().getBillItems().size() - 1);
|
||||
|
||||
if (first.getToArrival() == null || first.getToDeparture() == null
|
||||
|| last.getBackArrival() == null || last.getBackDeparture() == null) {
|
||||
Messagebox.show(StringUtils.localize("ErrFillTripBillResultTimes"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSave() {
|
||||
maintainAttachment();
|
||||
|
||||
@@ -6,6 +6,7 @@ import info.bukova.isspst.data.TripBillApproval;
|
||||
import info.bukova.isspst.services.requirement.TripRequirementService;
|
||||
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
||||
import info.bukova.isspst.services.tripbill.TripBillService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
@@ -33,6 +34,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
||||
private TripBillService tripBillService;
|
||||
@WireVariable
|
||||
private TripRequirementService tripRequirementService;
|
||||
@WireVariable
|
||||
private UserService userService;
|
||||
private TripBill bill;
|
||||
private Map<Integer, Boolean> selTab;
|
||||
|
||||
@@ -71,11 +74,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
||||
|
||||
bills.add(this.bill);
|
||||
|
||||
if (bill.getApproval().getState() != RequirementState.APPROVED) {
|
||||
if (selectTab(bill)) {
|
||||
isSelectedTad = true;
|
||||
selTab.put(bill.getId(), true);
|
||||
} else {
|
||||
selTab.put(bill.getId(), false);
|
||||
}
|
||||
|
||||
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
|
||||
@@ -83,11 +83,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
||||
tripBillService.loadLazyData(b);
|
||||
bills.add(b);
|
||||
|
||||
if (!isSelectedTad && b.getApproval().getState() != RequirementState.APPROVED) {
|
||||
setBill(b);
|
||||
if (!isSelectedTad && selectTab(b)) {
|
||||
isSelectedTad = true;
|
||||
} else {
|
||||
selTab.put(b.getId(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +96,19 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
||||
return bills;
|
||||
}
|
||||
|
||||
private boolean selectTab(TripBill bill) {
|
||||
if (bill.getApproval() != null
|
||||
&& bill.getApproval().getState() != RequirementState.APPROVED
|
||||
&& tripBillApprovalService.getNextApprover(bill.getApproval()).contains(userService.getCurrent())) {
|
||||
setBill(bill);
|
||||
return true;
|
||||
} else {
|
||||
selTab.put(bill.getId(), false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Command
|
||||
public void showBill(@BindingParam("bill") TripBill bill) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
|
||||
@@ -167,6 +167,8 @@ EMails=E-maily
|
||||
NewRequirement=Nový požadavek
|
||||
AuthRequirement=Dílčí schválení
|
||||
ConfirmRequirement=Schválení
|
||||
ConfirmTripPassengers=Schválení SC - spolucestující
|
||||
ReqTripPassengers=SC - spolucestujici
|
||||
InsertField=Vložit pole
|
||||
EnableRequirements=Povolit zadávání požadavků
|
||||
ShippingAddresses=Dodací adresy:
|
||||
@@ -396,10 +398,11 @@ 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
|
||||
ForeignPersons = Cizí osoby
|
||||
TripBillResultMessageText = Zpráva z pracovní cesty
|
||||
ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty.
|
||||
ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu.
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
<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="tripBill" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="10" bottomMargin="20" uuid="f59e8277-a431-4cdc-abaa-c82c1cf193af">
|
||||
<property name="ireport.zoom" value="1.5"/>
|
||||
<property name="ireport.x" value="0"/>
|
||||
<property name="ireport.y" value="378"/>
|
||||
<property name="ireport.y" value="511"/>
|
||||
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
|
||||
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
|
||||
</parameter>
|
||||
@@ -571,6 +571,20 @@ tuzemské pracovní cesty]]></text>
|
||||
<line>
|
||||
<reportElement uuid="5e5a7c99-962e-4c99-b3ba-dbed5315f5aa" x="-1" y="-2" width="1" height="195"/>
|
||||
</line>
|
||||
<textField pattern="dd. MM. yyyy">
|
||||
<reportElement uuid="7bbd89ae-f9e7-4359-b2df-5020b7a57456" x="292" y="135" width="100" height="13"/>
|
||||
<textElement>
|
||||
<font size="8"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$P{P_APPROVE_DATE}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="dd. MM. yyyy">
|
||||
<reportElement uuid="8f8ad8d2-dc49-46cc-8732-914951931569" x="440" y="135" width="100" height="15"/>
|
||||
<textElement>
|
||||
<font size="8"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$P{P_PREV_APPROVE_DATE}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</summary>
|
||||
</jasperReport>
|
||||
|
||||
Binary file not shown.
@@ -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="tripBillItems" pageWidth="572" pageHeight="752" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="0bbe694d-dbb2-4b58-b789-2587f37c94a8">
|
||||
<property name="ireport.zoom" value="2.0"/>
|
||||
<property name="ireport.x" value="496"/>
|
||||
<property name="ireport.x" value="0"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<queryString>
|
||||
<![CDATA[]]>
|
||||
@@ -381,28 +381,28 @@ výdaje]]></text>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{endWork}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="HH:mm" isBlankWhenNull="true">
|
||||
<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="034668ea-fa09-4967-bf1a-32b937c04729" x="292" y="0" width="32" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font size="8"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{distance}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="HH:mm" isBlankWhenNull="true">
|
||||
<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="d9ee1631-7830-44e2-a23d-63be94701d24" x="292" y="15" width="32" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font size="8"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{distanceAmount}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="HH:mm" isBlankWhenNull="true">
|
||||
<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="89be17a9-f8cc-4cb6-8254-2e660ab44807" x="324" y="0" width="32" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font size="8"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{fuelConsumption}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField pattern="HH:mm" isBlankWhenNull="true">
|
||||
<textField pattern="###0.00;-###0.00" isBlankWhenNull="true">
|
||||
<reportElement uuid="5aceac93-7265-4937-b23f-ec83288f6f90" x="324" y="15" width="32" height="15"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font size="8"/>
|
||||
|
||||
@@ -37,11 +37,14 @@
|
||||
|
||||
<bean id="requirementUrlResolver" class="info.bukova.isspst.RequirementUrlResolver"/>
|
||||
|
||||
<bean id="tripBillApprovalUrlResolver" class="info.bukova.isspst.TripBillAprovalUrlResolver"/>
|
||||
|
||||
<bean id="urlResolverHolder" class="info.bukova.isspst.UrlResolverHolder">
|
||||
<constructor-arg ref="commonUrlResolver"/>
|
||||
<property name="resolvers">
|
||||
<map>
|
||||
<entry key="#{T(info.bukova.isspst.data.Requirement)}" value-ref="requirementUrlResolver"/>
|
||||
<entry key="#{T(info.bukova.isspst.data.TripBillApproval)}" value-ref="tripBillApprovalUrlResolver"/>
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
@@ -19,7 +19,31 @@
|
||||
label="${labels.TravelOrdersFormTitle}" />
|
||||
<vlayout vflex="1">
|
||||
<include src="../tripBillInterior.zul" vflex="1"/>
|
||||
<include src="/app/formButtons.zul" />
|
||||
<vlayout
|
||||
vflex="min"
|
||||
hflex="max">
|
||||
<div
|
||||
hflex="max"
|
||||
align="right">
|
||||
<button
|
||||
image="~./zul/img/misc/drag-disallow.png"
|
||||
label="${labels.ButtonStorno}"
|
||||
onClick="editWin.detach()"
|
||||
sclass="nicebutton" />
|
||||
<button
|
||||
image="/img/save.png"
|
||||
label="Uložit a odeslat ke schválení"
|
||||
onClick="@command('saveForApproval', window=editWin) @global-command('refresh')"
|
||||
disabled="@load(not vm.canSave)"
|
||||
sclass="nicebutton" />
|
||||
<button
|
||||
image="/img/save.png"
|
||||
label="${labels.ButtonSave}"
|
||||
onClick="@command('save', window=editWin) @global-command('refresh')"
|
||||
disabled="@load(not vm.canSave)"
|
||||
sclass="nicebutton" />
|
||||
</div>
|
||||
</vlayout>
|
||||
</vlayout>
|
||||
</window>
|
||||
</zk>
|
||||
@@ -341,13 +341,13 @@
|
||||
<vbox hflex="max">
|
||||
<textbox
|
||||
inplace="true"
|
||||
value="@load(each.to)"
|
||||
value="@bind(each.to)"
|
||||
maxlength="@load(vm.lengthText)"
|
||||
sclass="grid-textbox-max-left"
|
||||
readonly="@load(vm.billDisabled or disabled)" />
|
||||
<textbox
|
||||
inplace="true"
|
||||
value="@load(each.back)"
|
||||
value="@bind(each.back)"
|
||||
maxlength="@load(vm.lengthText)"
|
||||
sclass="grid-textbox-max-left"
|
||||
readonly="@load(vm.billDisabled or disabled)" />
|
||||
@@ -506,7 +506,7 @@
|
||||
value="Záloha: "
|
||||
style="font-size: 14px;" />
|
||||
<label
|
||||
value="@load(vm.dataBean.requirement.downPayment) @converter(vm.standardBigDecimalConverter)"
|
||||
value="@load(vm.dataBean.downPayment) @converter(vm.standardBigDecimalConverter)"
|
||||
style="font-size: 14px;" />
|
||||
</hbox>
|
||||
<hbox>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<?page title="email" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
<zk xmlns="http://www.zkoss.org/2005/zul"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
|
||||
<tabbox>
|
||||
<tabs>
|
||||
<tab label="${labels.NewRequirement}"/>
|
||||
<tab label="${labels.AuthRequirement}"/>
|
||||
<tab label="${labels.ConfirmRequirement}"/>
|
||||
<tab label="${labels.ReqTripPassengers}"/>
|
||||
<tab label="${labels.ConfirmTripPassengers}"/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel>
|
||||
@@ -88,6 +92,56 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
<tabpanel>
|
||||
<grid>
|
||||
<columns>
|
||||
<column hflex="min"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${labels.MailSubject}" />
|
||||
<textbox
|
||||
value="@bind(vm.settings.reqPassenger.subject)"
|
||||
width="100%"
|
||||
maxlength="@load(vm.lengthText)"
|
||||
readonly="@load(not vm.canSave)" />
|
||||
</row>
|
||||
<row spans="2">
|
||||
<vbox>
|
||||
<ckeditor toolbar="Basic" value="@bind(vm.settings.reqPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
|
||||
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
|
||||
<button label="${labels.InsertField}" popup="fieldsPassenger, position=after_start" disabled="@load(not vm.canSave)"/>
|
||||
</vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
<tabpanel>
|
||||
<grid>
|
||||
<columns>
|
||||
<column hflex="min"/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${labels.MailSubject}" />
|
||||
<textbox
|
||||
value="@bind(vm.settings.confReqTripPassenger.subject)"
|
||||
width="100%"
|
||||
maxlength="@load(vm.lengthText)"
|
||||
readonly="@load(not vm.canSave)" />
|
||||
</row>
|
||||
<row spans="2">
|
||||
<vbox>
|
||||
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTripPassenger.text)" width="460px" height="180px" if="${vm.canSave}" />
|
||||
<html content="@load(vm.settings.confReqTemplate.text)" width="460px" height="180px" if="${not vm.canSave}"/>
|
||||
<button label="${labels.InsertField}" popup="fieldsConfirmPass, position=after_start" disabled="@load(not vm.canSave)"/>
|
||||
</vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
<menupopup id="fieldsNew" children="@load(vm.requirementFields)">
|
||||
@@ -105,4 +159,14 @@
|
||||
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
|
||||
</template>
|
||||
</menupopup>
|
||||
<menupopup id="fieldsConfirmPass" children="@load(vm.requirementFields)">
|
||||
<template name="children">
|
||||
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTripPassenger)"/>
|
||||
</template>
|
||||
</menupopup>
|
||||
<menupopup id="fieldsPassenger" children="@load(vm.requirementFields)">
|
||||
<template name="children">
|
||||
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.reqPassenger)"/>
|
||||
</template>
|
||||
</menupopup>
|
||||
</zk>
|
||||
Reference in New Issue
Block a user