Implementováno vyúčtování služební cesty.

closes #112
multitenant
Josef Rokos 10 years ago
parent f26e5e12c9
commit 8c26d3e430

@ -1,6 +1,7 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -43,6 +44,10 @@ public class TripBill extends BaseData {
private BigDecimal downPayment; private BigDecimal downPayment;
@Column(name = "TOTAL", precision = 15, scale = 4) @Column(name = "TOTAL", precision = 15, scale = 4)
private BigDecimal total; private BigDecimal total;
public TripBill() {
billItems = new ArrayList<TripBillItem>();
}
public TripRequirement getRequirement() { public TripRequirement getRequirement() {
return requirement; return requirement;

@ -3,6 +3,8 @@ package info.bukova.isspst.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embedded; import javax.persistence.Embedded;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -19,11 +21,21 @@ public class TripBillItem extends BaseData {
@Column(name = "BACK") @Column(name = "BACK")
private String back; private String back;
@Column(name = "DEPARTURE") @Column(name = "DEPARTURE")
private Date departure; private Date toDeparture;
@Column(name = "ARRIVAL") @Column(name = "ARRIVAL")
private Date arrival; private Date toArrival;
@Column(name = "BACK_DEPARTURE")
private Date backDeparture;
@Column(name = "BACK_ARRIVAL")
private Date backArrival;
@Embedded @Embedded
private Vehicle vehicle; private Vehicle toVehicle;
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "code", column = @Column(name = "BACK_VEHICLE_CODE")),
@AttributeOverride(name = "description", column = @Column(name = "BACK_VEHICLE_DESCRIPTION"))
})
private Vehicle backVehicle;
@Column(name = "BEGIN_WORK") @Column(name = "BEGIN_WORK")
private Date beginWork; private Date beginWork;
@Column(name = "END_WORK") @Column(name = "END_WORK")
@ -34,6 +46,10 @@ public class TripBillItem extends BaseData {
private BigDecimal distance; private BigDecimal distance;
@Column(name = "FUEL_CONSUMPTION", precision = 15, scale = 4) @Column(name = "FUEL_CONSUMPTION", precision = 15, scale = 4)
private BigDecimal fuelConsumption; private BigDecimal fuelConsumption;
@Column(name = "DISTANCE_AMOUNT", precision = 15, scale = 4)
private BigDecimal distanceAmount;
@Column(name = "FUEL_AMOUNT", precision = 15, scale = 4)
private BigDecimal fuelAmount;
@Column(name = "CAREFARE", precision = 15, scale = 4) @Column(name = "CAREFARE", precision = 15, scale = 4)
private BigDecimal carefare; private BigDecimal carefare;
@Column(name = "HOUSING", precision = 15, scale = 4) @Column(name = "HOUSING", precision = 15, scale = 4)
@ -71,30 +87,6 @@ public class TripBillItem extends BaseData {
this.back = 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() { public Date getBeginWork() {
return beginWork; return beginWork;
} }
@ -183,4 +175,68 @@ public class TripBillItem extends BaseData {
this.adjustedTotal = adjustedTotal; this.adjustedTotal = adjustedTotal;
} }
public Date getToDeparture() {
return toDeparture;
}
public void setToDeparture(Date toDeparture) {
this.toDeparture = toDeparture;
}
public Date getToArrival() {
return toArrival;
}
public void setToArrival(Date toArrival) {
this.toArrival = toArrival;
}
public Date getBackDeparture() {
return backDeparture;
}
public void setBackDeparture(Date backDeparture) {
this.backDeparture = backDeparture;
}
public Date getBackArrival() {
return backArrival;
}
public void setBackArrival(Date backArrival) {
this.backArrival = backArrival;
}
public Vehicle getToVehicle() {
return toVehicle;
}
public void setToVehicle(Vehicle toVhicle) {
this.toVehicle = toVhicle;
}
public Vehicle getBackVehicle() {
return backVehicle;
}
public void setBackVehicle(Vehicle backVehicle) {
this.backVehicle = backVehicle;
}
public BigDecimal getDistanceAmount() {
return distanceAmount;
}
public void setDistanceAmount(BigDecimal distanceAmount) {
this.distanceAmount = distanceAmount;
}
public BigDecimal getFuelAmount() {
return fuelAmount;
}
public void setFuelAmount(BigDecimal fuelAmount) {
this.fuelAmount = fuelAmount;
}
} }

@ -2,8 +2,10 @@ package info.bukova.isspst.services.requirement;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.Date; import java.util.Date;
@ -20,6 +22,8 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
private RequirementTypeService reqTypeService; private RequirementTypeService reqTypeService;
@Autowired @Autowired
private WorkgroupService workgroupService; private WorkgroupService workgroupService;
@Autowired
private TripBillService tripBillService;
@Override @Override
protected TripRequirement createEntity() { protected TripRequirement createEntity() {
@ -55,4 +59,18 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
} }
} }
@Override
@Transactional
@PreAuthorize("this.canApprove(#entity)")
public void approve(TripRequirement entity) {
super.approve(entity);
if (entity.getState() == RequirementState.APPROVED) {
TripBill bill = tripBillService.createTripBill(entity);
tripBillService.add(bill);
bill.setOwnedBy(entity.getOwnedBy());
tripBillService.update(bill);
}
}
} }

@ -1,8 +1,16 @@
package info.bukova.isspst.services.tripbill; package info.bukova.isspst.services.tripbill;
import java.util.List;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
public interface TripBillService extends Service<TripBill> { public interface TripBillService extends Service<TripBill> {
public TripBill createTripBill(TripRequirement requirement);
public void loadItems(TripBill bill);
public void calculate(TripBill bill);
public List<TripBill> getMy();
} }

@ -1,9 +1,177 @@
package info.bukova.isspst.services.tripbill; package info.bukova.isspst.services.tripbill;
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.TripRequirement;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.hibernate.LazyInitializationException;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implements public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implements
TripBillService { TripBillService {
@Autowired
private GlobalSettingsService globalSettings;
@Override
public TripBill createTripBill(TripRequirement requirement) {
TripBill bill = new TripBill();
bill.setRequirement(requirement);
long daysCount = TimeUnit.DAYS.convert(requirement.getEndDate().getTime() - requirement.getTripDate().getTime(), TimeUnit.MILLISECONDS) + 1;
for (int i = 0 ; i < daysCount ; i++) {
TripBillItem item = new TripBillItem();
if (i == 0) {
item.setTo(requirement.getFrom() + " - " + requirement.getTo());
item.setToVehicle(requirement.getVehicle());
}
if (i == daysCount - 1) {
item.setBack(requirement.getTo() + " - " + requirement.getFrom());
item.setBackVehicle(requirement.getVehicle());
}
Calendar calTripDate = Calendar.getInstance();
calTripDate.setTime(requirement.getTripDate());
calTripDate.add(Calendar.DATE, i);
item.setDate(calTripDate.getTime());
bill.getBillItems().add(item);
}
this.calculate(bill);
return bill;
}
@Override
@Transactional
@LazyLoader("form")
public void loadItems(TripBill entity) {
try {
if (entity.getBillItems() == null) {
throw new LazyInitializationException("");
}
entity.getBillItems().size();
} catch (LazyInitializationException ex) {
TripBill e = dao.getById(entity.getId());
e.getBillItems().size();
entity.setBillItems(e.getBillItems());
}
}
@Override
public void calculate(TripBill bill) {
bill.setTotal(BigDecimal.ZERO);
for (TripBillItem item : bill.getBillItems()) {
if (!bill.isFreeMeals()) {
item.setFreeMealsCount(0);
}
calculateItem(item);
bill.setTotal(bill.getTotal().add(item.getTotal()));
}
}
private void calculateItem(TripBillItem item) {
Calendar cal = Calendar.getInstance();
Date to = item.getToArrival();
if (to == null) {
to = new Date();
cal.setTime(to);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
} else {
cal.setTime(to);
}
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.MONTH, 1);
cal.set(Calendar.YEAR, 2000);
to.setTime(cal.getTimeInMillis());
Date back = item.getBackDeparture();
if (back == null) {
back = new Date(to.getTime());
}
cal.setTime(back);
if (back.equals(to)) {
cal.set(Calendar.HOUR, 23);
cal.set(Calendar.MINUTE, 59);
}
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.MONTH, 1);
cal.set(Calendar.YEAR, 2000);
back.setTime(cal.getTimeInMillis());
if (to.getTime() > back.getTime()) {
item.setTotal(BigDecimal.ZERO);
return;
}
SettingsData settings = globalSettings.getSettings();
long hours = TimeUnit.HOURS.convert(back.getTime() - to.getTime(), TimeUnit.MILLISECONDS);
int refundHour = 0;
List<Integer> refundHours = new ArrayList<Integer>(settings.getRefunds().keySet());
Collections.sort(refundHours);
for (int key : refundHours) {
if (refundHour <= hours && key > hours) {
break;
}
refundHour = key;
}
item.setMeals(settings.getRefunds().get(refundHour)[item.getFreeMealsCount()]);
BigDecimal carefare = item.getCarefare() == null ? BigDecimal.ZERO : item.getCarefare();
BigDecimal housing = item.getHousing() == null ? BigDecimal.ZERO : item.getHousing();
BigDecimal otherExp = item.getOtherExpenses() == null ? BigDecimal.ZERO : item.getOtherExpenses();
BigDecimal distanceAmount = item.getDistanceAmount() == null ? BigDecimal.ZERO : item.getDistanceAmount();
BigDecimal fuelAmount = item.getFuelAmount() == null ? BigDecimal.ZERO : item.getFuelAmount();
item.setTotal(carefare.add(housing).add(item.getMeals()).add(otherExp).add(distanceAmount).add(fuelAmount));
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<TripBill> getMy() {
Query q = dao.getQuery("from TripBill where ownedBy = :owner");
q.setParameter("owner", getLoggedInUser());
return q.list();
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_SHOW_ALL_BILL')")
public List<TripBill> getAll() {
return this.execQuery("from TripBill as tb join fetch tb.ownedBy");
}
} }

@ -70,6 +70,8 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
@Override @Override
@Transactional @Transactional
public boolean isMember(Workgroup workgroup, Member member) { public boolean isMember(Workgroup workgroup, Member member) {
loadParents(member);
if (member.equals(getLoggedInUser()) && sessionData.getCurrentUser() != null) { if (member.equals(getLoggedInUser()) && sessionData.getCurrentUser() != null) {
return member.getParents().contains(workgroup); return member.getParents().contains(workgroup);
} }

@ -1,14 +1,48 @@
package info.bukova.isspst.ui.tripbill; package info.bukova.isspst.ui.tripbill;
import java.util.ArrayList;
import java.util.List;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.Vehicle;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.FormViewModel; import info.bukova.isspst.ui.FormViewModel;
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.zk.ui.select.annotation.WireVariable;
public class TripBillForm extends FormViewModel<TripBill> { public class TripBillForm extends FormViewModel<TripBill> {
private BigDecimalConverter bigDecimalConverter;
@WireVariable
private TripBillService tripBillService;
private List<Vehicle> vehicles;
@WireVariable
private GlobalSettingsService settingsService;
@Init(superclass = true) @Init(superclass = true)
public void init() { public void init() {
bigDecimalConverter = new BigDecimalConverter();
vehicles = new ArrayList<Vehicle>();
vehicles.add(null);
vehicles.addAll(settingsService.getSettings().getVehicles());
}
public BigDecimalConverter getBigDecimalConverter() {
return bigDecimalConverter;
}
@Command
@NotifyChange("dataBean")
public void calculate() {
tripBillService.calculate(getDataBean());
}
public List<Vehicle> getVehicles() {
return vehicles;
} }
} }

@ -1,7 +1,10 @@
package info.bukova.isspst.ui.tripbill; package info.bukova.isspst.ui.tripbill;
import java.util.List;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.services.tripbill.TripBillService; import info.bukova.isspst.services.tripbill.TripBillService;
import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@ -11,6 +14,7 @@ public class TripBillList extends ListViewModel<TripBill> {
@WireVariable @WireVariable
private TripBillService tripBillService; private TripBillService tripBillService;
private BigDecimalConverter converter;
@Init @Init
public void init() { public void init() {
@ -18,5 +22,15 @@ public class TripBillList extends ListViewModel<TripBill> {
dataClass = TripBill.class; dataClass = TripBill.class;
formZul = "tripBillForm.zul"; formZul = "tripBillForm.zul";
//dataFilter = new MUnitFilter(getFilterTemplate()); //dataFilter = new MUnitFilter(getFilterTemplate());
converter = new BigDecimalConverter();
}
@Override
protected List<TripBill> getListFromService() {
return tripBillService.getMy();
}
public BigDecimalConverter getConverter() {
return converter;
} }
} }

@ -168,6 +168,42 @@ TravelOrdersGridFrom=Z
TravelOrdersGridTo=Do TravelOrdersGridTo=Do
TravelOrdersGridTotal=Celkem TravelOrdersGridTotal=Celkem
TripBillTravelBegin=Počátek cesty
TripBillDate=Datum
TripBillTravelTarget=Místo jednání
TripBillPurpose=Účel cesty
TripBillTravelEnd=Konec cesty
TripBillResultMessage=Zpráva o výsledku pracovní cesty byla podána dne:
TripBillFreeMeals=Stravování bezplatně
TripBillFreeHousing=Ubytování bezplatně
TripBillFreeCarfare=Volná jízdenka
TripBillDepartureArrival=Odjezd - příjezd
TripBillUsed=Použitý dopravní
TripBillVehicle=prostředek
TripBillBeginEnd=Počátek a konec
TripBillWork=pracovního výkonu
TripBillTraveled=Ujeté
TripBillKm=Km
TripBillConsumption=Spotřeba
TripBillPHM=PHM
TripBillCarfare=Jízdné a
TripBillLocal=místní
TripBillTransportation=přeprava
TripBillHousing=Nocležné
TripBillNumber=Počet
TripBillMeals=jídel
TripBillFree=zdarma
TripBillMealExpenses=Stravné
TripBillNecessary=Nutné
TripBillOther=vedlejší
TripBillExpenses=výdaje
TripBillAdjusted=Upraveno
TripBillHourMin=hod:min
TripBillInKc=v Kč
TripBillTo=Tam
TripBillBack=Zpět
TripBillTotal=Celkem
CentresForRequirements=Střediska, pro která lze vkládat požadavky CentresForRequirements=Střediska, pro která lze vkládat požadavky
WorkgroupMembership=Členství v komisích WorkgroupMembership=Členství v komisích
LogedInUser=Přihlášený uživatel: LogedInUser=Přihlášený uživatel:

@ -52,4 +52,19 @@ background: #ebebeb;
.bold { .bold {
font-weight: bold; font-weight: bold;
}
.vertikaal {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
} }

@ -1,4 +1,5 @@
<?page title="${labels.TravelOrdersFormTitle}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.TravelOrdersFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<window <window
id="editWin" id="editWin"
@ -12,7 +13,295 @@
zclass="form-caption" zclass="form-caption"
label="${labels.TravelOrdersFormTitle}" /> label="${labels.TravelOrdersFormTitle}" />
<vlayout> <vlayout>
<grid>
<columns visible="false">
<column hflex="min"/>
<column hflex="min"/>
<column hflex="2"/>
<column hflex="2"/>
<column hflex="2"/>
</columns>
<auxhead>
<auxheader label="${labels.TripBillTravelBegin}" colspan="2"/>
<auxheader label="${labels.TripBillTravelTarget}"/>
<auxheader label="${labels.TripBillPurpose}"/>
<auxheader label="${labels.TripBillTravelEnd}"/>
</auxhead>
<rows>
<row>
<cell colspan="2">
<label value="@load(vm.dataBean.requirement.from)"/>
</cell>
<cell>
<label value="@load(vm.dataBean.requirement.to)"/>
</cell>
<cell>
<label value="@load(vm.dataBean.requirement.description)"/>
</cell>
<cell>
<label value="@load(vm.dataBean.requirement.end)"/>
</cell>
</row>
<row>
<label value="@load(vm.dataBean.requirement.tripDate) @converter('formatedDate', format=labels.DateFormat)"/>
<label value="@load(vm.dataBean.requirement.tripDate) @converter('formatedDate', format='hh:mm')"/>
<cell/>
<cell/>
<label value="@load(vm.dataBean.requirement.endDate) @converter('formatedDate', format=labels.DateFormat)"/>
</row>
</rows>
</grid>
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.TripBillResultMessage}"/>
<datebox value="@bind(vm.dataBean.resultMessageDate)"/>
</row>
<row>
<cell colspan="2">
<checkbox label="${labels.TripBillFreeMeals}" checked="@bind(vm.dataBean.freeMeals)" onCheck="@command('calculate')"/>
</cell>
</row>
<row>
<cell colspan="2">
<checkbox label="${labels.TripBillFreeHousing}" checked="@bind(vm.dataBean.freeHousing)"/>
</cell>
</row>
<row>
<cell colspan="2">
<checkbox label="${labels.TripBillFreeCarfare}" checked="@bind(vm.dataBean.freeCarfare)"/>
</cell>
</row>
</rows>
</grid>
<grid model="@load(vm.dataBean.billItems)">
<auxhead>
<auxheader rowspan="2">
<div sclass="vertikaal" height="50px">
<label value="${labels.TripBillDate}" sclass="bold"/>
</div>
</auxheader>
<auxheader colspan="2">
<label value=""/>
</auxheader>
<!-- <auxheader >
<label value=""/>
</auxheader> -->
<auxheader colspan="2" align="center">
<label value="${labels.TripBillDepartureArrival}" sclass="bold"/>
</auxheader>
<!-- <auxheader>
<label value=""/>
</auxheader> -->
<auxheader rowspan="2" valign="bottom" height="110px">
<div sclass="vertikaal" height="88px" width="88px">
<vbox>
<label value="${labels.TripBillUsed}" sclass="bold"/>
<label value="${labels.TripBillVehicle}" sclass="bold"/>
</vbox>
</div>
</auxheader>
<auxheader rowspan="2" valign="bottom" height="112px">
<div sclass="vertikaal" height="101px" width="90px">
<vbox>
<label value="${labels.TripBillBeginEnd}" sclass="bold"/>
<label value="${labels.TripBillWork}" sclass="bold"/>
</vbox>
</div>
</auxheader>
<auxheader>
<html>
<![CDATA[${labels.TripBillTraveled} <br /> ${labels.TripBillKm} ]]>
</html>
</auxheader>
<auxheader>
<html>
<![CDATA[${labels.TripBillConsumption} <br /> ${labels.TripBillPHM} ]]>
</html>
</auxheader>
<auxheader rowspan="2">
<html>
<![CDATA[${labels.TripBillCarfare} <br /> ${labels.TripBillLocal} <br /> ${labels.TripBillTransportation} ]]>
</html>
</auxheader>
<auxheader rowspan="2">
<label value="${labels.TripBillHousing}" sclass="bold"/>
</auxheader>
<auxheader rowspan="2">
<html>
<![CDATA[${labels.TripBillNumber} <br /> ${labels.TripBillMeals} <br /> ${labels.TripBillFree} ]]>
</html>
</auxheader>
<auxheader rowspan="2">
<label value="${labels.TripBillMealExpenses}" sclass="bold"/>
</auxheader>
<auxheader rowspan="2">
<html>
<![CDATA[${labels.TripBillNecessary} <br /> ${labels.TripBillOther} <br /> ${labels.TripBillExpenses} ]]>
</html>
</auxheader>
<auxheader rowspan="2">
<label value="${labels.TripBillTotal}" sclass="bold"/>
</auxheader>
<auxheader rowspan="2">
<label value="${labels.TripBillAdjusted}" sclass="bold"/>
</auxheader>
</auxhead>
<auxhead>
<!-- <auxheader>
<label value=""/>
</auxheader> -->
<auxheader colspan="2" align="center">
<label value="${labels.TripBillTravelTarget}" sclass="bold"/>
</auxheader>
<!-- <auxheader >
<label value=""/>
</auxheader> -->
<auxheader>
<label value="${labels.TripBillHourMin}" sclass="bold"/>
</auxheader>
<auxheader>
<label value="${labels.TripBillHourMin}" sclass="bold"/>
</auxheader>
<!-- <auxheader>
<label value=""/>
</auxheader>-->
<!-- <auxheader>
<label value=""/>
</auxheader> -->
<auxheader>
<html>
<![CDATA[<div> ${labels.TripBillTraveled} <br /> ${labels.TripBillKm} <br /> ${labels.TripBillInKc}</div> ]]>
</html>
</auxheader>
<auxheader>
<html>
<![CDATA[${labels.TripBillConsumption} <br /> ${labels.TripBillPHM} <br /> ${labels.TripBillInKc}]]>
</html>
</auxheader>
<!-- <auxheader>
<label value=""/>
</auxheader>
<auxheader>
<label value=""/>
</auxheader>
<auxheader>
<label value=""/>
</auxheader>
<auxheader>
<label value=""/>
</auxheader>
<auxheader>
<label value=""/>
</auxheader>
<auxheader>
<label value=""/>
</auxheader>-->
</auxhead>
<columns visible="false">
<column width="60px"/>
<column width="60px"/>
<column hflex="max"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
<column width="70px"/>
</columns>
<rows>
<template name="model">
<row>
<label value="@load(each.date) @converter('formatedDate', format='dd.MM')"/>
<vbox>
<label value="${labels.TripBillTo}"/>
<label value="${labels.TripBillBack}"/>
</vbox>
<vbox hflex="max">
<textbox inplace="true"
value="@load(each.to)"
sclass="grid-textbox-max-left"/>
<textbox inplace="true"
value="@load(each.back)"
sclass="grid-textbox-max-left"/>
</vbox>
<vbox>
<timebox inplace="true" width="68px" value="@bind(each.toArrival)" onChange="@command('calculate')" format="short"/>
<timebox inplace="true" width="68px" value="@bind(each.backArrival)" onChange="@command('calculate')" format="short"/>
</vbox>
<vbox>
<timebox inplace="true" width="68px" value="@bind(each.toDeparture)" onChange="@command('calculate')" format="short"/>
<timebox inplace="true" width="68px" value="@bind(each.backDeparture)" onChange="@command('calculate')" format="short"/>
</vbox>
<vbox>
<combobox inplace="true"
model="@load(vm.vehicles)"
selectedItem="@bind(each.toVehicle)"
width="67px"
readonly="true">
<template name="model">
<comboitem label="@load(each.code)"/>
</template>
</combobox>
<combobox inplace="true"
model="@load(vm.vehicles)"
selectedItem="@bind(each.backVehicle)"
width="67px"
readonly="true">
<template name="model">
<comboitem label="@load(each.code)"/>
</template>
</combobox>
</vbox>
<vbox>
<timebox inplace="true" width="68px" value="@bind(each.beginWork)" format="short"/>
<timebox inplace="true" width="68px" value="@bind(each.endWork)" format="short"/>
</vbox>
<vbox>
<textbox inplace="true" width="68px" value="@bind(each.distance) @converter(vm.bigDecimalConverter)"/>
<textbox inplace="true" width="68px" value="@bind(each.distanceAmount) @converter(vm.bigDecimalConverter)" onChange="@command('calculate')"/>
</vbox>
<vbox>
<textbox inplace="true" width="68px" value="@bind(each.fuelConsumption) @converter(vm.bigDecimalConverter)"/>
<textbox inplace="true" width="68px" value="@bind(each.fuelAmount) @converter(vm.bigDecimalConverter)" onChange="@command('calculate')"/>
</vbox>
<textbox inplace="true" value="@bind(each.carefare) @converter(vm.bigDecimalConverter)" onChange="@command('calculate')"/>
<textbox inplace="true" value="@bind(each.housing) @converter(vm.bigDecimalConverter)" onChange="@command('calculate')"/>
<combobox inplace="true" selectedIndex="@bind(each.freeMealsCount)"
readonly="true"
width="60px"
disabled="@load(not vm.dataBean.freeMeals)"
onBlur="@command('calculate')">
<comboitem value="0" label="0"/>
<comboitem value="1" label="1"/>
<comboitem value="2" label="2"/>
<comboitem value="3" label="3"/>
</combobox>
<label value="@load(each.meals) @converter(vm.bigDecimalConverter)"/>
<textbox inplace="true" value="@bind(each.otherExpenses) @converter(vm.bigDecimalConverter)" onChange="@command('calculate')"/>
<label value="@load(each.total) @converter(vm.bigDecimalConverter)"/>
<label value="@load(each.adjustedTotal) @converter(vm.bigDecimalConverter)"/>
</row>
</template>
</rows>
</grid>
<div hflex="1" align="end" >
<label value="${labels.TripBillTotal}: " style="font-size: 14px; font-weight: bold;"/>
<label value="@load(vm.dataBean.total) @converter(vm.bigDecimalConverter)" style="font-size: 14px; font-weight: bold;"/>
</div>
<include src="/app/formButtons.zul" /> <include src="/app/formButtons.zul" />
</vlayout> </vlayout>
</window> </window>

@ -10,7 +10,7 @@
src="/img/pickup-032.png" src="/img/pickup-032.png"
zclass="form-caption" zclass="form-caption"
label="${labels.TravelOrders}" /> label="${labels.TravelOrders}" />
<include src="/requirements/toolbar.zul" /> <include src="/app/toolbar.zul" />
<listbox <listbox
vflex="1" vflex="1"
model="@load(vm.dataList)" model="@load(vm.dataList)"
@ -72,10 +72,10 @@
<template name="model"> <template name="model">
<listitem> <listitem>
<listcell label="@load(each.requirement.numser)" /> <listcell label="@load(each.requirement.numser)" />
<listcell label="@load(each.requirement.reqDate)" /> <listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)"/>
<listcell label="@load(each.requirement.from)" /> <listcell label="@load(each.requirement.from)" />
<listcell label="@load(each.requirement.to)" /> <listcell label="@load(each.requirement.to)" />
<listcell label="@load(each.total)"/> <listcell label="@load(each.total) @converter(vm.converter)"/>
</listitem> </listitem>
</template> </template>
</listbox> </listbox>

Loading…
Cancel
Save