Kostra agendy "Cestovní příkazy" - vyúčtování služebních cest.

refs #112
multitenant
Josef Rokos 10 years ago
parent 02a514ba87
commit c48fb65949

@ -13,6 +13,7 @@ import info.bukova.isspst.services.reqsubjects.MaterialService;
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import info.bukova.isspst.services.requirement.RequirementBaseService;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
@ -63,6 +64,7 @@ public class Constants {
public final static String MOD_WORKGROUPS = "WORKGROUPS";
public final static String MOD_REQUIREMENTS = "REQUIREMENTS";
public final static String MOD_WORKFLOW = "WORKFLOW";
public final static String MOD_TRIPBILL = "TRIPBILL";
public final static Module MODULES[] = {
new Module(MOD_USERS, "Uživatelé", UserService.class),
new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
@ -73,7 +75,8 @@ public class Constants {
new Module(MOD_SERVICES, "Služby", ServiceItemService.class),
new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class),
new Module(MOD_REQUIREMENTS, "Požadavky", RequirementBaseService.class),
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class)
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class),
new Module(MOD_TRIPBILL, "Cestovní příkazy", TripBillService.class)
};
public final static String PERM_APPROVE = "PERM_APPROVE";

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.TripBill;
public interface TripBillDao extends BaseDao<TripBill> {
}

@ -0,0 +1,8 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.TripBillDao;
import info.bukova.isspst.data.TripBill;
public class TripBillDaoJPA extends BaseDaoJPA<TripBill> implements TripBillDao {
}

@ -0,0 +1,119 @@
package info.bukova.isspst.data;
import java.math.BigDecimal;
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;
@Entity
@Table(name = "TRIP_BILL")
public class TripBill extends BaseData {
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "REQUIREMENT_ID")
private TripRequirement requirement;
@Column(name = "RESULT_MESSAGE_DATE")
private Date resultMessageDate;
@Column(name = "SIGN_DATE")
private Date signDate;
@Column(name = "FREE_MEALS")
private boolean freeMeals;
@Column(name = "FREE_HOUSING")
private boolean freeHousing;
@Column(name = "FREE_CAREFARE")
private boolean freeCarfare;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.TRUE)
@JoinColumn(name = "TRIP_BILL_ID")
private List<TripBillItem> billItems;
@Column(name = "ATTACHEMENTS_COUNT")
private int attachementsCount;
@Column(name = "DOWN_PAYMENT", precision = 15, scale = 4)
private BigDecimal downPayment;
@Column(name = "TOTAL", precision = 15, scale = 4)
private BigDecimal total;
public TripRequirement getRequirement() {
return requirement;
}
public void setRequirement(TripRequirement requirement) {
this.requirement = requirement;
}
public Date getResultMessageDate() {
return resultMessageDate;
}
public void setResultMessageDate(Date resultMessageDate) {
this.resultMessageDate = resultMessageDate;
}
public Date getSignDate() {
return signDate;
}
public void setSignDate(Date signDate) {
this.signDate = signDate;
}
public boolean isFreeMeals() {
return freeMeals;
}
public void setFreeMeals(boolean freeMeals) {
this.freeMeals = freeMeals;
}
public boolean isFreeHousing() {
return freeHousing;
}
public void setFreeHousing(boolean freeHousing) {
this.freeHousing = freeHousing;
}
public boolean isFreeCarfare() {
return freeCarfare;
}
public void setFreeCarfare(boolean freeCarfare) {
this.freeCarfare = freeCarfare;
}
public List<TripBillItem> getBillItems() {
return billItems;
}
public void setBillItems(List<TripBillItem> billItems) {
this.billItems = billItems;
}
public BigDecimal getDownPayment() {
return downPayment;
}
public void setDownPayment(BigDecimal downPayment) {
this.downPayment = downPayment;
}
public BigDecimal getTotal() {
return total;
}
public void setTotal(BigDecimal total) {
this.total = total;
}
}

@ -0,0 +1,186 @@
package info.bukova.isspst.data;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "TRIP_BILL_ITEMS")
public class TripBillItem extends BaseData {
@Column(name = "DATE")
private Date date;
@Column(name = "TARGET")
private String to;
@Column(name = "BACK")
private String back;
@Column(name = "DEPARTURE")
private Date departure;
@Column(name = "ARRIVAL")
private Date arrival;
@Embedded
private Vehicle vehicle;
@Column(name = "BEGIN_WORK")
private Date beginWork;
@Column(name = "END_WORK")
private Date endWork;
@Column(name = "FREE_MEALS_COUNT")
private int freeMealsCount;
@Column(name = "DISTANCE", precision = 15, scale = 4)
private BigDecimal distance;
@Column(name = "FUEL_CONSUMPTION", precision = 15, scale = 4)
private BigDecimal fuelConsumption;
@Column(name = "CAREFARE", precision = 15, scale = 4)
private BigDecimal carefare;
@Column(name = "HOUSING", precision = 15, scale = 4)
private BigDecimal housing;
@Column(name = "MEALS", precision = 15, scale = 4)
private BigDecimal meals;
@Column(name = "OTHER_EXPENSES", precision = 15, scale = 4)
private BigDecimal otherExpenses;
@Column(name = "TOTAL", precision = 15, scale = 4)
private BigDecimal total;
@Column(name = "ADJUSTED_TOTAL", precision = 15, scale = 4)
private BigDecimal adjustedTotal;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getBack() {
return back;
}
public void setBack(String back) {
this.back = back;
}
public Date getDeparture() {
return departure;
}
public void setDeparture(Date departure) {
this.departure = departure;
}
public Date getArrival() {
return arrival;
}
public void setArrival(Date arrival) {
this.arrival = arrival;
}
public Vehicle getVehicle() {
return vehicle;
}
public void setVehicle(Vehicle vehicle) {
this.vehicle = vehicle;
}
public Date getBeginWork() {
return beginWork;
}
public void setBeginWork(Date beginWork) {
this.beginWork = beginWork;
}
public Date getEndWork() {
return endWork;
}
public void setEndWork(Date endWork) {
this.endWork = endWork;
}
public int getFreeMealsCount() {
return freeMealsCount;
}
public void setFreeMealsCount(int freeMealsCount) {
this.freeMealsCount = freeMealsCount;
}
public BigDecimal getDistance() {
return distance;
}
public void setDistance(BigDecimal distance) {
this.distance = distance;
}
public BigDecimal getFuelConsumption() {
return fuelConsumption;
}
public void setFuelConsumption(BigDecimal fuelConsumption) {
this.fuelConsumption = fuelConsumption;
}
public BigDecimal getCarefare() {
return carefare;
}
public void setCarefare(BigDecimal carefare) {
this.carefare = carefare;
}
public BigDecimal getHousing() {
return housing;
}
public void setHousing(BigDecimal housing) {
this.housing = housing;
}
public BigDecimal getMeals() {
return meals;
}
public void setMeals(BigDecimal meals) {
this.meals = meals;
}
public BigDecimal getOtherExpenses() {
return otherExpenses;
}
public void setOtherExpenses(BigDecimal otherExpenses) {
this.otherExpenses = otherExpenses;
}
public BigDecimal getTotal() {
return total;
}
public void setTotal(BigDecimal total) {
this.total = total;
}
public BigDecimal getAdjustedTotal() {
return adjustedTotal;
}
public void setAdjustedTotal(BigDecimal adjustedTotal) {
this.adjustedTotal = adjustedTotal;
}
}

@ -0,0 +1,8 @@
package info.bukova.isspst.services.tripbill;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.services.Service;
public interface TripBillService extends Service<TripBill> {
}

@ -0,0 +1,9 @@
package info.bukova.isspst.services.tripbill;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.services.AbstractOwnedService;
public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implements
TripBillService {
}

@ -0,0 +1,14 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.ui.FormViewModel;
import org.zkoss.bind.annotation.Init;
public class TripBillForm extends FormViewModel<TripBill> {
@Init(superclass = true)
public void init() {
}
}

@ -0,0 +1,22 @@
package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class TripBillList extends ListViewModel<TripBill> {
@WireVariable
private TripBillService tripBillService;
@Init
public void init() {
service = tripBillService;
dataClass = TripBill.class;
formZul = "tripBillForm.zul";
//dataFilter = new MUnitFilter(getFilterTemplate());
}
}

@ -26,5 +26,7 @@
<mapping class="info.bukova.isspst.data.RequirementType"></mapping>
<mapping class="info.bukova.isspst.data.ServiceItem"></mapping>
<mapping class="info.bukova.isspst.data.GlobalSettings"></mapping>
<mapping class="info.bukova.isspst.data.TripBill"></mapping>
<mapping class="info.bukova.isspst.data.TripBillItem"></mapping>
</session-factory>
</hibernate-configuration>

@ -161,6 +161,13 @@ GlobalSettingsRefunds=Náhrady
GlobalSettingsFreeMealsCount=Počet jídel zdarma
GlobalSettingsHours=Hodin
TravelOrdersFormTitle=Vyúčtování služební cesty
TravelOrdersGridNumser=Číslo
TravelOrdersGridReqDate=Datum požadavku
TravelOrdersGridFrom=Z
TravelOrdersGridTo=Do
TravelOrdersGridTotal=Celkem
CentresForRequirements=Střediska, pro která lze vkládat požadavky
WorkgroupMembership=Členství v komisích
LogedInUser=Přihlášený uživatel:

@ -176,6 +176,10 @@
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="tripBillDao" class="info.bukova.isspst.dao.jpa.TripBillDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Business logic -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
@ -296,4 +300,9 @@
<property name="numberSeriesService" ref="numericSeriesService"/>
</bean>
<bean id="tripBillService" class="info.bukova.isspst.services.tripbill.TripBillServiceImpl">
<property name="dao" ref="tripBillDao"/>
<property name="validator" ref="validator"/>
</bean>
</beans>

@ -31,7 +31,7 @@
<menuitem
image="/img/pickup-024.png"
label="${labels.TravelOrders}"
href="" />
href="/trips/bill" />
</menupopup>
</menu>
<menuseparator />

@ -0,0 +1,10 @@
<?page title="${labels.TravelOrders}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "tripBillGrid.zul";
</zscript>
<include src="/app/template.zhtml"/>
</zk>

@ -0,0 +1,19 @@
<?page title="${labels.TravelOrdersFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window
id="editWin"
closable="true"
border="normal"
position="center"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.tripbill.TripBillForm')">
<caption
src="/img/pickup-032.png"
zclass="form-caption"
label="${labels.TravelOrdersFormTitle}" />
<vlayout>
<include src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>

@ -0,0 +1,83 @@
<?page title="${labels.TravelOrders}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
vflex="1"
border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.tripbill.TripBillList')">
<caption
src="/img/pickup-032.png"
zclass="form-caption"
label="${labels.TravelOrders}" />
<include src="/requirements/toolbar.zul" />
<listbox
vflex="1"
model="@load(vm.dataList)"
selectedItem="@bind(vm.dataBean)">
<listhead menupopup="auto">
<listheader
label="${labels.TravelOrdersGridNumser}"
sort="czech(name)"
width="30%" />
<listheader
label="${labels.TravelOrdersGridReqDate}"
sort="czech(description)"
width="70%" />
<listheader
label="${labels.TravelOrdersGridFrom}"
sort="czech(description)"
width="70%" />
<listheader
label="${labels.TravelOrdersGridTo}"
sort="czech(description)"
width="70%" />
<listheader
label="${labels.TravelOrdersGridTotal}"
sort="czech(description)"
width="70%" />
</listhead>
<!-- <auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.name)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.description)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead> -->
<template name="model">
<listitem>
<listcell label="@load(each.requirement.numser)" />
<listcell label="@load(each.requirement.reqDate)" />
<listcell label="@load(each.requirement.from)" />
<listcell label="@load(each.requirement.to)" />
<listcell label="@load(each.total)"/>
</listitem>
</template>
</listbox>
</window>
</zk>
Loading…
Cancel
Save