9 Commits

Author SHA1 Message Date
pepa 4d74b0a3fe Opraven binding formuláře vyúčtování služební cesty.
closes #231
2015-06-15 21:17:17 +02:00
pepa 3b3e4b38e6 Vyúčtování služební cesty nelze odeslat ke schválení, pokud nejsou vyplněné časy odjezdu a příjezdu.
closes #230
2015-06-14 20:45:36 +02:00
pepa c2ca2e45ec 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
2015-06-13 00:00:00 +02:00
franta aaa89a2653 Workaround pro zápis číselné řady.
Vznikaly duplicity nad unikátním indexem.
Nyní se číslo nezapisuje a načítá se z vazby na požadavku na cesťák.

closes #221
2015-05-22 12:10:00 +02:00
franta fbc7a02161 Zpráva z pracovní cesty prodloužena na 8kB
closes #220
2015-05-20 07:51:47 +02:00
pepa e5a8e0f0d9 Po otevření dialogu pro zobrazení vyúčtování SC se přepne na první záložku, kterou může schválit aktuálně přihlášený uživatel.
closes #217
2015-05-17 21:52:46 +02:00
pepa 0f169f8be9 Na formuláři vyúčtování služební cesty se automaticky předvyplní datum v poli "Zpráva z pracovní cesty podána dne", pokud je pole prázdné.
closes #216
2015-05-17 21:06:26 +02:00
pepa b6d0546b48 Na formulář vyúčtování služební cesty bylo přidáno tlačítko "Uložit a odeslat ke schválení"
closes #218
2015-05-17 20:52:38 +02:00
pepa a6799064f7 Opraveno generování e-mailu po odeslání vyúčtování služební cesty ke schválení. Text a URL se nyní vygeneruje správně.
closes #219
2015-05-13 13:36:51 +02:00
20 changed files with 282 additions and 57 deletions
@@ -7,6 +7,7 @@ import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementType; import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.reporting.ReportMapping;
@@ -33,7 +34,7 @@ import java.util.Map;
public class Constants { 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 = "admin";
public final static String DEF_ADMIN_PASSWD = "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>() {{ public final static Map<Class<?>, String> URL_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, String>() {{
put(Requirement.class, "/main/orders/"); put(Requirement.class, "/main/orders/");
put(TripRequirement.class, "/main/trips/requirements/"); put(TripRequirement.class, "/main/trips/requirements/");
put(TripBillApproval.class, "/main/trips/requirements/");
put(Order.class, "/main/orders/created/"); put(Order.class, "/main/orders/created/");
put(TripBill.class, "/main/trips/bill/"); put(TripBill.class, "/main/trips/bill/");
}} ); }} );
public final static int LEN_TEXT = 255; public final static int LEN_TEXT = 255;
public final static int LEN_DESCRIPTION = 8192; 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,7 @@ public class SettingsData {
private MailMessage newReqTemplate; private MailMessage newReqTemplate;
private MailMessage authReqTemplate; private MailMessage authReqTemplate;
private MailMessage confReqTemplate; private MailMessage confReqTemplate;
private MailMessage confReqTripPassenger;
private Address mainAddress; private Address mainAddress;
private List<Address> shippingAddrs; private List<Address> shippingAddrs;
private String bankName; private String bankName;
@@ -28,6 +29,7 @@ public class SettingsData {
newReqTemplate = new MailMessage(); newReqTemplate = new MailMessage();
authReqTemplate = new MailMessage(); authReqTemplate = new MailMessage();
confReqTemplate = new MailMessage(); confReqTemplate = new MailMessage();
confReqTripPassenger = new MailMessage();
mainAddress = new Address(); mainAddress = new Address();
shippingAddrs = new ArrayList<Address>(); shippingAddrs = new ArrayList<Address>();
vehicles = new ArrayList<Vehicle>(); vehicles = new ArrayList<Vehicle>();
@@ -150,4 +152,12 @@ public class SettingsData {
{ {
this.logoFile = logoFile; this.logoFile = logoFile;
} }
public MailMessage getConfReqTripPassenger() {
return confReqTripPassenger;
}
public void setConfReqTripPassenger(MailMessage confReqTripPassenger) {
this.confReqTripPassenger = confReqTripPassenger;
}
} }
@@ -1,6 +1,22 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import info.bukova.isspst.storage.EntityWithAttachment; 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.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption; import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.Analyze; 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.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded; 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 @Entity
@Table(name = "TRIP_BILL") @Table(name = "TRIP_BILL")
@Indexed @Indexed
@@ -36,7 +38,7 @@ public class TripBill extends BaseData implements EntityWithAttachment {
@Column(name = "SIGN_DATE") @Column(name = "SIGN_DATE")
private Date signDate; private Date signDate;
@Column(name = "RESULT_MESSAGE") @Column(name = "RESULT_MESSAGE", length = Constants.LEN_RESULT_MESSAGE)
@Field(index = Index.YES, analyze = Analyze.YES) @Field(index = Index.YES, analyze = Analyze.YES)
private String resultMessage; private String resultMessage;
@@ -60,7 +62,7 @@ public class TripBill extends BaseData implements EntityWithAttachment {
@LazyCollection(LazyCollectionOption.TRUE) @LazyCollection(LazyCollectionOption.TRUE)
@IndexedEmbedded @IndexedEmbedded
private List<FileMetainfo> attachedFiles; private List<FileMetainfo> attachedFiles;
@ManyToOne(fetch = FetchType.EAGER) @OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "APPROVAL_ID") @JoinColumn(name = "APPROVAL_ID")
private TripBillApproval approval; private TripBillApproval approval;
@Column(name = "SAVED") @Column(name = "SAVED")
@@ -1,6 +1,9 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
/** /**
@@ -11,4 +14,31 @@ import javax.persistence.Table;
@Table(name = "TRIP_BILL_APPROVAL") @Table(name = "TRIP_BILL_APPROVAL")
public class TripBillApproval extends RequirementBase { 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;
}
} }
@@ -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(); long dbVersion = this.getDbInfo().getVersion();
if (Constants.DB_VERSION > dbVersion) if (Constants.DB_VERSION > dbVersion)
@@ -133,6 +136,12 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
sq.executeUpdate(); 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(); this.updateDatabaseVersion();
} }
} }
@@ -4,11 +4,17 @@ import info.bukova.isspst.Constants;
import info.bukova.isspst.data.NumberSeries; import info.bukova.isspst.data.NumberSeries;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.User; 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.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.tripbill.TripBillService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.users.UserService;
import org.hibernate.Hibernate; import org.hibernate.Hibernate;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
import org.hibernate.Query; import org.hibernate.Query;
@@ -25,9 +31,17 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
@Autowired @Autowired
private RequirementTypeService reqTypeService; private RequirementTypeService reqTypeService;
@Autowired @Autowired
private WorkgroupService workgroupService;
@Autowired
private TripBillService tripBillService; private TripBillService tripBillService;
@Autowired
private TripBillApprovalService tripBillApprovalService;
@Autowired
private Mailer mailer;
@Autowired
private MessageBuilder messageBuilder;
@Autowired
private GlobalSettingsService settingsService;
@Autowired
private UserService userService;
@Override @Override
protected TripRequirement createEntity() { protected TripRequirement createEntity() {
@@ -50,6 +64,12 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
TripBill newBill = tripBillService.createTripBill(entity); TripBill newBill = tripBillService.createTripBill(entity);
bill.getBillItems().clear(); bill.getBillItems().clear();
bill.getBillItems().addAll(newBill.getBillItems()); bill.getBillItems().addAll(newBill.getBillItems());
TripBillApproval approval = bill.getApproval();
if (approval != null) {
tripBillApprovalService.delete(approval);
}
bill.setApproval(null); bill.setApproval(null);
tripBillService.calculate(bill); tripBillService.calculate(bill);
tripBillService.update(bill); tripBillService.update(bill);
@@ -115,12 +135,19 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
if (entity.getBillForPassengers() != null && entity.getBillForPassengers()) { if (entity.getBillForPassengers() != null && entity.getBillForPassengers()) {
for (User u : entity.getPassengers()) { for (User u : entity.getPassengers()) {
if (!u.equals(entity.getOwnedBy())) { if (!u.equals(entity.getOwnedBy())) {
TripBill passBill = tripBillService.createTripBill(entity); TripBill passBill = tripBillService.createPassengersBill(entity);
tripBillService.add(passBill); tripBillService.add(passBill);
passBill.setOwnedBy(u); passBill.setOwnedBy(u);
tripBillService.update(passBill); tripBillService.update(passBill);
} }
} }
if (!entity.getPassengers().isEmpty() && settingsService.getSettings().getConfReqTripPassenger() != null) {
MailMessage message = messageBuilder.buildMessage(settingsService.getSettings().getConfReqTripPassenger(), entity);
message.setFrom(userService.getCurrent().getEmail());
message.setTo(userService.getEmailsForSend(entity.getPassengers()));
mailer.send(message);
}
} }
} }
} }
@@ -1,18 +1,20 @@
package info.bukova.isspst.services.tripbill; package info.bukova.isspst.services.tripbill;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.IsspstException; import info.bukova.isspst.services.IsspstException;
import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl; import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/** /**
* @author Pepa Rokos * @author Pepa Rokos
*/ */
@@ -33,6 +35,9 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
approval.setReqDate(new Date()); approval.setReqDate(new Date());
approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP)); approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP));
approval.setState(RequirementState.NEW); 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); bill.setApproval(approval);
return approval; return approval;
} }
@@ -9,6 +9,7 @@ import java.util.List;
public interface TripBillService extends Service<TripBill> { public interface TripBillService extends Service<TripBill> {
public TripBill createTripBill(TripRequirement requirement); public TripBill createTripBill(TripRequirement requirement);
public TripBill createPassengersBill(TripRequirement requirement);
public void loadItems(TripBill bill); public void loadItems(TripBill bill);
public void calculate(TripBill bill); public void calculate(TripBill bill);
public List<TripBill> getMy(); public List<TripBill> getMy();
@@ -33,10 +33,23 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
@Override @Override
public TripBill createTripBill(TripRequirement requirement) { 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(); TripBill bill = new TripBill();
bill.setRequirement(requirement); bill.setRequirement(requirement);
if (!passengers) {
bill.setDownPayment(requirement.getDownPayment());
}
int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(), int daysCount = Days.daysBetween((new DateTime(requirement.getTripDate())).withTimeAtStartOfDay(),
(new DateTime(requirement.getEndDate())).withTimeAtStartOfDay()).getDays() + 1; (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())); bill.setTotal(bill.getTotal().add(item.getTotal()));
} }
if (bill.getRequirement().getDownPayment() != null) { if (bill.getDownPayment() != null) {
bill.setTotal(bill.getTotal().subtract(bill.getRequirement().getDownPayment())); 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.StringUtils;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.data.TripBillItem;
import info.bukova.isspst.data.Vehicle; import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService; import info.bukova.isspst.services.tripbill.TripBillApprovalService;
@@ -19,6 +20,7 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
public class TripBillForm extends FormWithUpload<TripBill> { public class TripBillForm extends FormWithUpload<TripBill> {
@@ -36,6 +38,11 @@ public class TripBillForm extends FormWithUpload<TripBill> {
vehicles = new ArrayList<Vehicle>(); vehicles = new ArrayList<Vehicle>();
vehicles.add(null); vehicles.add(null);
vehicles.addAll(settingsService.getSettings().getVehicles()); vehicles.addAll(settingsService.getSettings().getVehicles());
TripBill bill = getDataBean();
if (bill.getResultMessageDate() == null) {
bill.setResultMessageDate(new Date());
}
} }
@Command @Command
@@ -56,14 +63,11 @@ public class TripBillForm extends FormWithUpload<TripBill> {
return false; return false;
} }
@Override
@Command @Command
@NotifyChange("errMessages") @NotifyChange("errMessages")
public void save(@BindingParam("window") Window win) public void saveForApproval(@BindingParam("window") Window win)
{ {
if (StringUtils.isNullOrTrimmedEmpty(this.getDataBean().getResultMessage())) if (!canSaveForApproval()) {
{
Messagebox.show(StringUtils.localize("ErrFillTripBillResultMessageText"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
return; 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 @Override
protected void doSave() { protected void doSave() {
maintainAttachment(); maintainAttachment();
@@ -6,6 +6,7 @@ import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.tripbill.TripBillApprovalService; import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.requirement.RequirementSubpage; import info.bukova.isspst.ui.requirement.RequirementSubpage;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
@@ -33,6 +34,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
private TripBillService tripBillService; private TripBillService tripBillService;
@WireVariable @WireVariable
private TripRequirementService tripRequirementService; private TripRequirementService tripRequirementService;
@WireVariable
private UserService userService;
private TripBill bill; private TripBill bill;
private Map<Integer, Boolean> selTab; private Map<Integer, Boolean> selTab;
@@ -71,11 +74,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
bills.add(this.bill); bills.add(this.bill);
if (bill.getApproval().getState() != RequirementState.APPROVED) { if (selectTab(bill)) {
isSelectedTad = true; isSelectedTad = true;
selTab.put(bill.getId(), true);
} else {
selTab.put(bill.getId(), false);
} }
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) { for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
@@ -83,11 +83,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
tripBillService.loadLazyData(b); tripBillService.loadLazyData(b);
bills.add(b); bills.add(b);
if (!isSelectedTad && b.getApproval().getState() != RequirementState.APPROVED) { if (!isSelectedTad && selectTab(b)) {
setBill(b);
isSelectedTad = true; isSelectedTad = true;
} else {
selTab.put(b.getId(), false);
} }
} }
} }
@@ -99,6 +96,19 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
return bills; 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 @Command
public void showBill(@BindingParam("bill") TripBill bill) { public void showBill(@BindingParam("bill") TripBill bill) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
@@ -167,6 +167,7 @@ EMails=E-maily
NewRequirement=Nový požadavek NewRequirement=Nový požadavek
AuthRequirement=Dílčí schválení AuthRequirement=Dílčí schválení
ConfirmRequirement=Schválení ConfirmRequirement=Schválení
ConfirmTripPassengers=Schválení SC - spolucestující
InsertField=Vložit pole InsertField=Vložit pole
EnableRequirements=Povolit zadávání požadavků EnableRequirements=Povolit zadávání požadavků
ShippingAddresses=Dodací adresy: ShippingAddresses=Dodací adresy:
@@ -396,10 +397,11 @@ Pending = Nevyřízené
Archive = Archiv Archive = Archiv
Completed = Vyřízeno Completed = Vyřízeno
GenerateBillingForPassengers = Generovat vyúčtování pro spolucestující GenerateBillingForPassengers = Generovat společný požadavek a vyúčtování
Passenger = Pasažér Passenger = Pasažér
ChooseThePasseger = Vyberte pasažéra ChooseThePasseger = Vyberte pasažéra
TransportMode = Způsob dopravy TransportMode = Způsob dopravy
ForeignPersons = Cizí osoby ForeignPersons = Cizí osoby
TripBillResultMessageText = Zpráva z pracovní cesty TripBillResultMessageText = Zpráva z pracovní cesty
ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty. ErrFillTripBillResultMessageText = Vyplňte zprávu z pracovní cesty.
ErrFillTripBillResultTimes = Zadejte časy odjezdu a příjezdu.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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.zoom" value="2.0"/>
<property name="ireport.x" value="496"/> <property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/> <property name="ireport.y" value="0"/>
<queryString> <queryString>
<![CDATA[]]> <![CDATA[]]>
@@ -381,28 +381,28 @@ výdaje]]></text>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{endWork}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{endWork}]]></textFieldExpression>
</textField> </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"/> <reportElement uuid="034668ea-fa09-4967-bf1a-32b937c04729" x="292" y="0" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{distance}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{distance}]]></textFieldExpression>
</textField> </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"/> <reportElement uuid="d9ee1631-7830-44e2-a23d-63be94701d24" x="292" y="15" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{distanceAmount}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{distanceAmount}]]></textFieldExpression>
</textField> </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"/> <reportElement uuid="89be17a9-f8cc-4cb6-8254-2e660ab44807" x="324" y="0" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
</textElement> </textElement>
<textFieldExpression><![CDATA[$F{fuelConsumption}]]></textFieldExpression> <textFieldExpression><![CDATA[$F{fuelConsumption}]]></textFieldExpression>
</textField> </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"/> <reportElement uuid="5aceac93-7265-4937-b23f-ec83288f6f90" x="324" y="15" width="32" height="15"/>
<textElement textAlignment="Center" verticalAlignment="Middle"> <textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8"/> <font size="8"/>
@@ -37,11 +37,14 @@
<bean id="requirementUrlResolver" class="info.bukova.isspst.RequirementUrlResolver"/> <bean id="requirementUrlResolver" class="info.bukova.isspst.RequirementUrlResolver"/>
<bean id="tripBillApprovalUrlResolver" class="info.bukova.isspst.TripBillAprovalUrlResolver"/>
<bean id="urlResolverHolder" class="info.bukova.isspst.UrlResolverHolder"> <bean id="urlResolverHolder" class="info.bukova.isspst.UrlResolverHolder">
<constructor-arg ref="commonUrlResolver"/> <constructor-arg ref="commonUrlResolver"/>
<property name="resolvers"> <property name="resolvers">
<map> <map>
<entry key="#{T(info.bukova.isspst.data.Requirement)}" value-ref="requirementUrlResolver"/> <entry key="#{T(info.bukova.isspst.data.Requirement)}" value-ref="requirementUrlResolver"/>
<entry key="#{T(info.bukova.isspst.data.TripBillApproval)}" value-ref="tripBillApprovalUrlResolver"/>
</map> </map>
</property> </property>
</bean> </bean>
@@ -19,7 +19,31 @@
label="${labels.TravelOrdersFormTitle}" /> label="${labels.TravelOrdersFormTitle}" />
<vlayout vflex="1"> <vlayout vflex="1">
<include src="../tripBillInterior.zul" 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> </vlayout>
</window> </window>
</zk> </zk>
@@ -341,13 +341,13 @@
<vbox hflex="max"> <vbox hflex="max">
<textbox <textbox
inplace="true" inplace="true"
value="@load(each.to)" value="@bind(each.to)"
maxlength="@load(vm.lengthText)" maxlength="@load(vm.lengthText)"
sclass="grid-textbox-max-left" sclass="grid-textbox-max-left"
readonly="@load(vm.billDisabled or disabled)" /> readonly="@load(vm.billDisabled or disabled)" />
<textbox <textbox
inplace="true" inplace="true"
value="@load(each.back)" value="@bind(each.back)"
maxlength="@load(vm.lengthText)" maxlength="@load(vm.lengthText)"
sclass="grid-textbox-max-left" sclass="grid-textbox-max-left"
readonly="@load(vm.billDisabled or disabled)" /> readonly="@load(vm.billDisabled or disabled)" />
@@ -506,7 +506,7 @@
value="Záloha: " value="Záloha: "
style="font-size: 14px;" /> style="font-size: 14px;" />
<label <label
value="@load(vm.dataBean.requirement.downPayment) @converter(vm.standardBigDecimalConverter)" value="@load(vm.dataBean.downPayment) @converter(vm.standardBigDecimalConverter)"
style="font-size: 14px;" /> style="font-size: 14px;" />
</hbox> </hbox>
<hbox> <hbox>
+34 -1
View File
@@ -1,10 +1,13 @@
<?page title="email" contentType="text/html;charset=UTF-8"?> <?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> <tabbox>
<tabs> <tabs>
<tab label="${labels.NewRequirement}"/> <tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/> <tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/> <tab label="${labels.ConfirmRequirement}"/>
<tab label="${labels.ConfirmTripPassengers}"/>
</tabs> </tabs>
<tabpanels> <tabpanels>
<tabpanel> <tabpanel>
@@ -88,6 +91,31 @@
</rows> </rows>
</grid> </grid>
</tabpanel> </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> </tabpanels>
</tabbox> </tabbox>
<menupopup id="fieldsNew" children="@load(vm.requirementFields)"> <menupopup id="fieldsNew" children="@load(vm.requirementFields)">
@@ -105,4 +133,9 @@
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/> <menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
</template> </template>
</menupopup> </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>
</zk> </zk>