@@ -136,7 +136,7 @@ public class Constants {
|
|||||||
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresní karty", "address")),
|
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresní karty", "address")),
|
||||||
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresa", "address", false, true)),
|
new ReportMapping(MOD_ADDRESSBOOK, new Report("Adresa", "address", false, true)),
|
||||||
new ReportMapping(MOD_TRIPBILL, new Report("Žádost", "tripRequirement", false, true)),
|
new ReportMapping(MOD_TRIPBILL, new Report("Žádost", "tripRequirement", false, true)),
|
||||||
new ReportMapping(MOD_TRIPBILL, new Report("Vyúčtování", "tripBill", false, true)),
|
new ReportMapping(MOD_TRIPBILL, new Report("Vyúčtování", "tripBill", false, true, true)),
|
||||||
new ReportMapping(MOD_ORDER, new Report("Objednávka", "order", true, true)),
|
new ReportMapping(MOD_ORDER, new Report("Objednávka", "order", true, true)),
|
||||||
new ReportMapping(MOD_REQUIREMENTS, new Report("Požadavky", "requirements"))
|
new ReportMapping(MOD_REQUIREMENTS, new Report("Požadavky", "requirements"))
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package info.bukova.isspst.dao;
|
||||||
|
|
||||||
|
import info.bukova.isspst.data.TripBillApproval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
public interface TripBillApprovalDao extends BaseDao<TripBillApproval> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package info.bukova.isspst.dao.jpa;
|
||||||
|
|
||||||
|
import info.bukova.isspst.dao.TripBillApprovalDao;
|
||||||
|
import info.bukova.isspst.data.TripBillApproval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
public class TripBillApprovalDaoJPA extends BaseDaoJPA<TripBillApproval> implements TripBillApprovalDao {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import javax.persistence.Column;
|
|||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -51,6 +52,9 @@ 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)
|
||||||
|
@JoinColumn(name = "APPROVAL_ID")
|
||||||
|
private TripBillApproval approval;
|
||||||
|
|
||||||
public TripBill() {
|
public TripBill() {
|
||||||
billItems = new ArrayList<TripBillItem>();
|
billItems = new ArrayList<TripBillItem>();
|
||||||
@@ -147,4 +151,11 @@ public class TripBill extends BaseData implements EntityWithAttachment {
|
|||||||
this.attachedFiles = attachedFiles;
|
this.attachedFiles = attachedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TripBillApproval getApproval() {
|
||||||
|
return approval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApproval(TripBillApproval approval) {
|
||||||
|
this.approval = approval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package info.bukova.isspst.data;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "TRIP_BILL_APPROVAL")
|
||||||
|
public class TripBillApproval extends RequirementBase {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,10 +8,12 @@ public class Report {
|
|||||||
private String jasperFile;
|
private String jasperFile;
|
||||||
private boolean hasSettings;
|
private boolean hasSettings;
|
||||||
private boolean singleRecord;
|
private boolean singleRecord;
|
||||||
|
private boolean hasCondition;
|
||||||
|
|
||||||
public Report() {
|
public Report() {
|
||||||
hasSettings = false;
|
hasSettings = false;
|
||||||
singleRecord = false;
|
singleRecord = false;
|
||||||
|
hasCondition = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +48,19 @@ public class Report {
|
|||||||
this.singleRecord = singleRecord;
|
this.singleRecord = singleRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param jasperFile
|
||||||
|
* @param hasSettings
|
||||||
|
* @param singleRecord
|
||||||
|
* @param hasCondition
|
||||||
|
*/
|
||||||
|
public Report(String name, String jasperFile, boolean hasSettings, boolean singleRecord, boolean hasCondition) {
|
||||||
|
this(name, jasperFile, hasSettings, singleRecord);
|
||||||
|
this.hasCondition = hasCondition;
|
||||||
|
}
|
||||||
|
|
||||||
public ReportType getType() {
|
public ReportType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -86,4 +101,11 @@ public class Report {
|
|||||||
this.singleRecord = singleRecord;
|
this.singleRecord = singleRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isHasCondition() {
|
||||||
|
return hasCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCondition(boolean hasCondition) {
|
||||||
|
this.hasCondition = hasCondition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public abstract class AbstractRequirementEvaluator extends AbstractModuleEvaluat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetDomainObject instanceof RequirementBase) {
|
||||||
RequirementBase req = (RequirementBase) targetDomainObject;
|
RequirementBase req = (RequirementBase) targetDomainObject;
|
||||||
|
|
||||||
if (permission.equals(Constants.PERM_EDIT_NEW)) {
|
if (permission.equals(Constants.PERM_EDIT_NEW)) {
|
||||||
@@ -33,6 +34,7 @@ public abstract class AbstractRequirementEvaluator extends AbstractModuleEvaluat
|
|||||||
if (permission.equals(Constants.PERM_DELETE_NEW)) {
|
if (permission.equals(Constants.PERM_DELETE_NEW)) {
|
||||||
return req.getState() == RequirementState.NEW;
|
return req.getState() == RequirementState.NEW;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,4 +296,9 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPrintRecord(T entity) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,6 @@ public interface Service<T> {
|
|||||||
public List<T> filterList(List<T> sourceList, Filter<T> filter);
|
public List<T> filterList(List<T> sourceList, Filter<T> filter);
|
||||||
public Module getModule();
|
public Module getModule();
|
||||||
public List<Report> getReports();
|
public List<Report> getReports();
|
||||||
|
public boolean canPrintRecord(T entity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-5
@@ -75,11 +75,7 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
|
|
||||||
super.add(entity);
|
super.add(entity);
|
||||||
|
|
||||||
if (canApprove(entity)) {
|
this.postAdd(entity);
|
||||||
approve(entity);
|
|
||||||
} else {
|
|
||||||
this.sendToApprovers(entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkEnable() {
|
private void checkEnable() {
|
||||||
@@ -103,6 +99,14 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void postAdd(T entity) {
|
||||||
|
if (canApprove(entity)) {
|
||||||
|
approve(entity);
|
||||||
|
} else {
|
||||||
|
this.sendToApprovers(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void addWorkflow(T entity) {
|
protected void addWorkflow(T entity) {
|
||||||
if (entity.getType() == null) {
|
if (entity.getType() == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ 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());
|
||||||
|
bill.setApproval(null);
|
||||||
tripBillService.calculate(bill);
|
tripBillService.calculate(bill);
|
||||||
tripBillService.update(bill);
|
tripBillService.update(bill);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package info.bukova.isspst.services.tripbill;
|
||||||
|
|
||||||
|
import info.bukova.isspst.data.TripBill;
|
||||||
|
import info.bukova.isspst.data.TripBillApproval;
|
||||||
|
import info.bukova.isspst.services.requirement.RequirementBaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
public interface TripBillApprovalService extends RequirementBaseService<TripBillApproval> {
|
||||||
|
|
||||||
|
public TripBillApproval createApproval(TripBill bill);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package info.bukova.isspst.services.tripbill;
|
||||||
|
|
||||||
|
import info.bukova.isspst.Constants;
|
||||||
|
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 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
|
||||||
|
*/
|
||||||
|
public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<TripBillApproval> implements TripBillApprovalService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RequirementTypeService reqTypeService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TripBillApproval createApproval(TripBill bill) {
|
||||||
|
if (bill.getApproval() != null) {
|
||||||
|
throw new IsspstException("Approval already exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
TripBillApproval approval = new TripBillApproval();
|
||||||
|
approval.setCentre(bill.getRequirement().getCentre());
|
||||||
|
approval.setWorkgroup(bill.getRequirement().getWorkgroup());
|
||||||
|
approval.setReqDate(new Date());
|
||||||
|
approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP));
|
||||||
|
approval.setState(RequirementState.NEW);
|
||||||
|
bill.setApproval(approval);
|
||||||
|
return approval;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
|
||||||
|
public void add(TripBillApproval entity) {
|
||||||
|
entity.setCreated(new Date());
|
||||||
|
entity.setOwnedBy(getLoggedInUser());
|
||||||
|
addWorkflow(entity);
|
||||||
|
dao.add(entity);
|
||||||
|
|
||||||
|
postAdd(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package info.bukova.isspst.services.tripbill;
|
package info.bukova.isspst.services.tripbill;
|
||||||
|
|
||||||
|
import info.bukova.isspst.data.RequirementState;
|
||||||
import info.bukova.isspst.data.SettingsData;
|
import info.bukova.isspst.data.SettingsData;
|
||||||
import info.bukova.isspst.data.TripBill;
|
import info.bukova.isspst.data.TripBill;
|
||||||
import info.bukova.isspst.data.TripBillItem;
|
import info.bukova.isspst.data.TripBillItem;
|
||||||
@@ -220,9 +221,19 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
|
|||||||
tb.setFreeCarfare(entity.isFreeCarfare());
|
tb.setFreeCarfare(entity.isFreeCarfare());
|
||||||
tb.setFreeHousing(entity.isFreeHousing());
|
tb.setFreeHousing(entity.isFreeHousing());
|
||||||
tb.setFreeMeals(entity.isFreeMeals());
|
tb.setFreeMeals(entity.isFreeMeals());
|
||||||
|
tb.setApproval(entity.getApproval());
|
||||||
calculate(tb);
|
calculate(tb);
|
||||||
super.update(tb);
|
super.update(tb);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPrintRecord(TripBill entity) {
|
||||||
|
if (entity.getApproval() != null && entity.getApproval().getState() == RequirementState.APPROVED) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ import info.bukova.isspst.reporting.ReportDefinition;
|
|||||||
import info.bukova.isspst.reporting.ReportType;
|
import info.bukova.isspst.reporting.ReportType;
|
||||||
import info.bukova.isspst.services.Service;
|
import info.bukova.isspst.services.Service;
|
||||||
import info.bukova.isspst.ui.DocumentViewModel;
|
import info.bukova.isspst.ui.DocumentViewModel;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.BindingParam;
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
import org.zkoss.bind.annotation.Command;
|
import org.zkoss.bind.annotation.Command;
|
||||||
import org.zkoss.bind.annotation.ExecutionArgParam;
|
import org.zkoss.bind.annotation.ExecutionArgParam;
|
||||||
@@ -17,6 +14,8 @@ import org.zkoss.zk.ui.Executions;
|
|||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
import org.zkoss.zul.Window;
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ReportDialogVM extends DocumentViewModel
|
public class ReportDialogVM extends DocumentViewModel
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -94,4 +93,12 @@ public class ReportDialogVM extends DocumentViewModel
|
|||||||
this.reportDefinition = reportDefinition;
|
this.reportDefinition = reportDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCanPrint() {
|
||||||
|
if (singleObject != null) {
|
||||||
|
return reportDefinition.getService().canPrintRecord(singleObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public class TripRequirementListAll extends RequirementSubpage<TripRequirement>
|
|||||||
TripBill tb = tripRequirementService.getTripBill(getDataBean());
|
TripBill tb = tripRequirementService.getTripBill(getDataBean());
|
||||||
tripBillService.loadLazyData(tb);
|
tripBillService.loadLazyData(tb);
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("selected", tb);
|
params.put("bill", tb);
|
||||||
Window win = (Window) Executions.createComponents("tripBill.zul", null, params);
|
Window win = (Window) Executions.createComponents("tripBillSummary.zul", null, params);
|
||||||
win.doModal();
|
win.doModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
|
|||||||
TripBill tb = tripRequirementService.getTripBill(getDataBean());
|
TripBill tb = tripRequirementService.getTripBill(getDataBean());
|
||||||
tripBillService.loadLazyData(tb);
|
tripBillService.loadLazyData(tb);
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("selected", tb);
|
params.put("bill", tb);
|
||||||
Window win = (Window) Executions.createComponents("tripBill.zul", null, params);
|
Window win = (Window) Executions.createComponents("tripBillSummary.zul", null, params);
|
||||||
win.doModal();
|
win.doModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
|
|||||||
TripBill tb = tripRequirementService.getTripBill(getDataBean());
|
TripBill tb = tripRequirementService.getTripBill(getDataBean());
|
||||||
tripBillService.loadLazyData(tb);
|
tripBillService.loadLazyData(tb);
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("selected", tb);
|
params.put("bill", tb);
|
||||||
Window win = (Window) Executions.createComponents("tripBill.zul", null, params);
|
Window win = (Window) Executions.createComponents("tripBillSummary.zul", null, params);
|
||||||
win.doModal();
|
win.doModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,22 @@
|
|||||||
package info.bukova.isspst.ui.tripbill;
|
package info.bukova.isspst.ui.tripbill;
|
||||||
|
|
||||||
|
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.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.TripBillService;
|
import info.bukova.isspst.services.tripbill.TripBillService;
|
||||||
import info.bukova.isspst.ui.FormWithUpload;
|
import info.bukova.isspst.ui.FormWithUpload;
|
||||||
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
import org.zkoss.bind.annotation.Command;
|
import org.zkoss.bind.annotation.Command;
|
||||||
import org.zkoss.bind.annotation.Init;
|
import org.zkoss.bind.annotation.Init;
|
||||||
import org.zkoss.bind.annotation.NotifyChange;
|
import org.zkoss.bind.annotation.NotifyChange;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -20,6 +28,8 @@ public class TripBillForm extends FormWithUpload<TripBill> {
|
|||||||
private List<Vehicle> vehicles;
|
private List<Vehicle> vehicles;
|
||||||
@WireVariable
|
@WireVariable
|
||||||
private GlobalSettingsService settingsService;
|
private GlobalSettingsService settingsService;
|
||||||
|
@WireVariable
|
||||||
|
private TripBillApprovalService tripBillApprovalService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init(superclass = true)
|
||||||
public void init() {
|
public void init() {
|
||||||
@@ -43,9 +53,35 @@ public class TripBillForm extends FormWithUpload<TripBill> {
|
|||||||
&& getDataBean().getRequirement().getBillForPassengers()
|
&& getDataBean().getRequirement().getBillForPassengers()
|
||||||
&& !getDataBean().getOwnedBy().equals(getDataBean().getRequirement().getOwnedBy())) {
|
&& !getDataBean().getOwnedBy().equals(getDataBean().getRequirement().getOwnedBy())) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (getDataBean().getApproval() != null) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Command
|
||||||
|
@NotifyChange("errMessages")
|
||||||
|
public void save(@BindingParam("window") Window win) {
|
||||||
|
final Window editWin = win;
|
||||||
|
if (getDataBean().getApproval() == null && !isBillDisabled()) {
|
||||||
|
Messagebox.show(StringUtils.localize("TripBillSaveApprove"), StringUtils.localize("TripBillSave"), Messagebox.YES
|
||||||
|
| Messagebox.NO, Messagebox.QUESTION, new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
if (((Integer) event.getData()).intValue() == Messagebox.YES) {
|
||||||
|
TripBillApproval approval = tripBillApprovalService.createApproval(getDataBean());
|
||||||
|
tripBillApprovalService.add(approval);
|
||||||
|
TripBillForm.super.save(editWin);
|
||||||
|
} else {
|
||||||
|
TripBillForm.super.save(editWin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
super.save(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package info.bukova.isspst.ui.tripbill;
|
||||||
|
|
||||||
|
import info.bukova.isspst.data.TripBill;
|
||||||
|
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.ui.requirement.RequirementSubpage;
|
||||||
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
|
import org.zkoss.bind.annotation.Command;
|
||||||
|
import org.zkoss.bind.annotation.ExecutionArgParam;
|
||||||
|
import org.zkoss.bind.annotation.GlobalCommand;
|
||||||
|
import org.zkoss.bind.annotation.Init;
|
||||||
|
import org.zkoss.bind.annotation.NotifyChange;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
||||||
|
|
||||||
|
@WireVariable
|
||||||
|
private TripBillApprovalService tripBillApprovalService;
|
||||||
|
@WireVariable
|
||||||
|
private TripBillService tripBillService;
|
||||||
|
@WireVariable
|
||||||
|
private TripRequirementService tripRequirementService;
|
||||||
|
private TripBill bill;
|
||||||
|
|
||||||
|
@Init(superclass = true)
|
||||||
|
public void initBillSummary(@ExecutionArgParam("bill") TripBill bill) {
|
||||||
|
service = tripBillApprovalService;
|
||||||
|
|
||||||
|
if (bill.getApproval() != null) {
|
||||||
|
setDataBean(bill.getApproval());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.bill = bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripBill getBill() {
|
||||||
|
return bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBill(TripBill bill) {
|
||||||
|
this.bill = bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TripBill> getBills() {
|
||||||
|
List<TripBill> bills = new ArrayList<TripBill>();
|
||||||
|
|
||||||
|
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
|
||||||
|
if (b.getId() != bill.getId()) {
|
||||||
|
tripBillService.loadLazyData(b);
|
||||||
|
bills.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bills;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command
|
||||||
|
public void showBill(@BindingParam("bill") TripBill bill) {
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("selected", bill);
|
||||||
|
Window win = (Window) Executions.createComponents("tripBill.zul", null, params);
|
||||||
|
win.doModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GlobalCommand
|
||||||
|
@NotifyChange("dataBean")
|
||||||
|
public void reload() {
|
||||||
|
setDataBean(tripBillApprovalService.getById(bill.getApproval().getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,5 +35,6 @@
|
|||||||
<mapping class="info.bukova.isspst.data.InvoicingItem"></mapping>
|
<mapping class="info.bukova.isspst.data.InvoicingItem"></mapping>
|
||||||
<mapping class="info.bukova.isspst.data.FileMetainfo"></mapping>
|
<mapping class="info.bukova.isspst.data.FileMetainfo"></mapping>
|
||||||
<mapping class="info.bukova.isspst.data.FileContent"></mapping>
|
<mapping class="info.bukova.isspst.data.FileContent"></mapping>
|
||||||
|
<mapping class="info.bukova.isspst.data.TripBillApproval"></mapping>
|
||||||
</session-factory>
|
</session-factory>
|
||||||
</hibernate-configuration>
|
</hibernate-configuration>
|
||||||
@@ -229,6 +229,10 @@ TripBillInKc=v Kč
|
|||||||
TripBillTo=Tam
|
TripBillTo=Tam
|
||||||
TripBillBack=Zpět
|
TripBillBack=Zpět
|
||||||
TripBillTotal=Celkem
|
TripBillTotal=Celkem
|
||||||
|
TripBillSaveApprove=Jestliže máte vše vyplněno, pošlete vyúčtování ke schválení. Vyúčtování zaslané ke schválení už nelze dále upravovat. Odeslat ke schválení?
|
||||||
|
TripBillSave=Odeslat ke schválení?
|
||||||
|
|
||||||
|
TripBillSummaryDetail=Detail
|
||||||
|
|
||||||
TripRequirement=Požadavek na služební cestu
|
TripRequirement=Požadavek na služební cestu
|
||||||
ShowTripBill=Zobrazit vyúčtování
|
ShowTripBill=Zobrazit vyúčtování
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
<bean id="evalHolder" class="info.bukova.isspst.security.EvaluatorsHolder">
|
<bean id="evalHolder" class="info.bukova.isspst.security.EvaluatorsHolder">
|
||||||
<property name="globalEvaluators">
|
<property name="globalEvaluators">
|
||||||
<map>
|
<map>
|
||||||
|
<entry key="#{T(info.bukova.isspst.services.tripbill.TripBillApprovalService)}" value-ref="tripReqEditEval"/>
|
||||||
<entry key="#{T(info.bukova.isspst.services.Service)}" value-ref="serviceEval"/>
|
<entry key="#{T(info.bukova.isspst.services.Service)}" value-ref="serviceEval"/>
|
||||||
<entry key="#{T(info.bukova.isspst.data.Requirement)}" value-ref="reqEditEval"/>
|
<entry key="#{T(info.bukova.isspst.data.Requirement)}" value-ref="reqEditEval"/>
|
||||||
<entry key="#{T(info.bukova.isspst.data.TripRequirement)}" value-ref="tripReqEditEval"/>
|
<entry key="#{T(info.bukova.isspst.data.TripRequirement)}" value-ref="tripReqEditEval"/>
|
||||||
@@ -268,6 +269,10 @@
|
|||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="tripBillApprovalDao" class="info.bukova.isspst.dao.jpa.TripBillApprovalDaoJPA">
|
||||||
|
<property name="sessionFactory" ref="sessionFactory"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- Business logic -->
|
<!-- Business logic -->
|
||||||
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
|
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
|
||||||
|
|
||||||
@@ -444,4 +449,8 @@
|
|||||||
|
|
||||||
<bean id="fulltextService" class="info.bukova.isspst.services.fulltext.FullTextServiceImpl"/>
|
<bean id="fulltextService" class="info.bukova.isspst.services.fulltext.FullTextServiceImpl"/>
|
||||||
|
|
||||||
|
<bean id="tripBillApprovalService" class="info.bukova.isspst.services.tripbill.TripBillApprovalServiceImpl">
|
||||||
|
<property name="dao" ref="tripBillApprovalDao"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<hbox>
|
<hbox>
|
||||||
<listbox model="@load(vm.reports)" width="250px" height="350px" selectedItem="@bind(vm.selected)">
|
<listbox model="@load(vm.reports)" width="250px" height="350px" selectedItem="@bind(vm.selected)">
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<listitem disabled="@load(each.singleRecord and empty vm.singleObject)">
|
<listitem disabled="@load(each.singleRecord and (empty vm.singleObject or (each.hasCondition and not vm.canPrint) ))">
|
||||||
<listcell><label value="@load(each.name)"/></listcell>
|
<listcell><label value="@load(each.name)"/></listcell>
|
||||||
</listitem>
|
</listitem>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?page title="${labels.TravelOrders}" contentType="text/html;charset=UTF-8"?>
|
<?page title="${labels.TravelOrders}" 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">
|
||||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
<window
|
<window
|
||||||
vflex="1"
|
vflex="1"
|
||||||
@@ -73,7 +75,7 @@
|
|||||||
</auxheader>
|
</auxheader>
|
||||||
</auxhead> -->
|
</auxhead> -->
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<listitem>
|
<listitem style="@load((empty each.approval ? '' : (each.approval.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.approval.state eq 'APPROVED') ? 'background-color: #afffb5' : 'background-color: #fdfbca') ))">
|
||||||
<listcell label="@load(each.requirement.numser)" />
|
<listcell label="@load(each.requirement.numser)" />
|
||||||
<listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
<listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||||
<listcell label="@load(each.requirement.from)" />
|
<listcell label="@load(each.requirement.from)" />
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?page title="${labels.TravelOrdersFormTitle}" contentType="text/html;charset=UTF-8"?>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
|
|
||||||
|
<window id="billWin"
|
||||||
|
closable="true"
|
||||||
|
width="700px"
|
||||||
|
height="450px"
|
||||||
|
border="normal"
|
||||||
|
position="center"
|
||||||
|
apply="org.zkoss.bind.BindComposer"
|
||||||
|
viewModel="@id('vm') @init('info.bukova.isspst.ui.tripbill.TripBillSummaryVM')">
|
||||||
|
<caption
|
||||||
|
src="/img/pickup-032.png"
|
||||||
|
zclass="form-caption"
|
||||||
|
label="${labels.TravelOrdersFormTitle}" />
|
||||||
|
<hbox vflex="1">
|
||||||
|
<vbox width="350px" vflex="1">
|
||||||
|
<label value="@load(vm.bill.ownedBy)" style="font-weight: bold; font-size: larger"/>
|
||||||
|
<hbox>
|
||||||
|
<label value="${labels.RequirementsFormFrom}: "/>
|
||||||
|
<label value="@load(vm.bill.requirement.from)"/>
|
||||||
|
<label value="${labels.RequirementsFormTo}: "/>
|
||||||
|
<label value="@load(vm.bill.requirement.to)"/>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<label value="${labels.RequirementsFormStartDateTime}: "/>
|
||||||
|
<label value="@load(vm.bill.requirement.tripDate) @converter('formatedDate', format=labels.DateFormat)"/>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<label value="${labels.RequirementsFormEndDate}: "/>
|
||||||
|
<label value="@load(vm.bill.requirement.endDate) @converter('formatedDate', format=labels.DateFormat)"/>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<label value="${labels.RequirementsFormPurpose}: "/>
|
||||||
|
<label value="@load(vm.bill.requirement.description)"/>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<label value="${labels.TripBillTotal}:"/> <label value="@load(vm.bill.total) @converter(vm.standardBigDecimalConverter)"/>
|
||||||
|
</hbox>
|
||||||
|
<button label="${labels.TripBillSummaryDetail}"
|
||||||
|
onClick="@command('showBill', bill=vm.bill)"
|
||||||
|
sclass="nicebutton"/>
|
||||||
|
<div visible="@load(not empty vm.bills)" vflex="1">
|
||||||
|
<separator bar="true" width="100%"/>
|
||||||
|
<label value="${labels.RequirementsFormPassengers}"/>
|
||||||
|
<grid model="@load(vm.bills)" vflex="1">
|
||||||
|
<columns>
|
||||||
|
<column />
|
||||||
|
<column width="90px"/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<template name="model">
|
||||||
|
<row>
|
||||||
|
<label value="@load(each.ownedBy)"/>
|
||||||
|
<button label="${labels.TripBillSummaryDetail}"
|
||||||
|
sclass="nicebutton"
|
||||||
|
onClick="@command('showBill', bill=each)"/>
|
||||||
|
</row>
|
||||||
|
</template>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
</div>
|
||||||
|
</vbox>
|
||||||
|
<include src="../../approveStatus.zul" vflex="1"/>
|
||||||
|
</hbox>
|
||||||
|
</window>
|
||||||
|
|
||||||
|
</zk>
|
||||||
Reference in New Issue
Block a user