Na formulář požadavku na služební byl přidán checkbox pro vygenerování vyúčtování služební cesty i pro spolucestující. Spolucestující nemůžou vyúčtování měnit.

closes #212
Verze_2.0
Josef Rokos 10 years ago
parent 42deec695a
commit 9b8bfe2228

@ -2,15 +2,14 @@ package info.bukova.isspst.data;
import info.bukova.isspst.Constants;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Entity
@Table(name = "TRIP_BILL_ITEMS")
@ -65,6 +64,35 @@ public class TripBillItem extends BaseData {
@Column(name = "ADJUSTED_TOTAL", precision = 15, scale = 4)
private BigDecimal adjustedTotal;
public TripBillItem() {
}
public TripBillItem(TripBillItem src) {
date = src.getDate();
to = src.getTo();
back = src.getBack();
toDeparture = src.getToDeparture();
toArrival = src.getToArrival();
backDeparture = src.getBackDeparture();
backArrival = src.getBackArrival();
toVehicle = src.getToVehicle();
backVehicle = src.getBackVehicle();
beginWork = src.getBeginWork();
endWork = src.getEndWork();
freeMealsCount = src.getFreeMealsCount();
distance = src.getDistance();
fuelConsumption = src.getFuelConsumption();
distanceAmount = src.getDistanceAmount();
fuelAmount = src.getFuelAmount();
carefare = src.getCarefare();
housing = src.getHousing();
meals = src.getMeals();
otherExpenses = src.getOtherExpenses();
total = src.getTotal();
adjustedTotal = src.getAdjustedTotal();
}
public Date getDate() {
return date;
}

@ -42,6 +42,8 @@ public class TripRequirement extends RequirementBase implements EntityWithAttach
@LazyCollection(LazyCollectionOption.TRUE)
@IndexedEmbedded
private List<FileMetainfo> attachedFiles;
@Column(name = "BILL_FOR_PASSENGERS")
private Boolean billForPassengers;
public TripRequirement() {
this.setOwnedBy(new User());
@ -140,4 +142,11 @@ public class TripRequirement extends RequirementBase implements EntityWithAttach
attachedFiles.remove(metainfo);
}
public Boolean getBillForPassengers() {
return billForPassengers;
}
public void setBillForPassengers(Boolean billForPassengers) {
this.billForPassengers = billForPassengers;
}
}

@ -111,6 +111,7 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
bill.setOwnedBy(entity.getOwnedBy());
tripBillService.update(bill);
if (entity.getBillForPassengers() != null && entity.getBillForPassengers()) {
for (User u : entity.getPassengers()) {
if (!u.equals(entity.getOwnedBy())) {
TripBill passBill = tripBillService.createTripBill(entity);
@ -121,6 +122,7 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
}
}
}
}
@Override
protected String getNumberSerie() {

@ -178,11 +178,13 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
@Override
@Transactional
@LazyLoader("print")
@LazyLoader({"print", "form"})
public void loadOwner(TripBill bill) {
TripBill tb = dao.getById(bill.getId());
tb.getOwnedBy().getFirstName();
tb.getRequirement().getOwnedBy().getFirstName();
bill.setOwnedBy(tb.getOwnedBy());
bill.getRequirement().setOwnedBy(tb.getRequirement().getOwnedBy());
}
@Override
@ -196,4 +198,31 @@ public class TripBillServiceImpl extends AbstractOwnedService<TripBill> implemen
bill.getRequirement().setPassengers(tr.getPassengers());
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void update(TripBill entity) {
super.update(entity);
TripRequirement req = entity.getRequirement();
Query q = dao.getQuery("from TripBill where requirement = :req and id != :id");
q.setParameter("req", req);
q.setParameter("id", entity.getId());
List<TripBill> bills = q.list();
for (TripBill tb : bills) {
tb.getBillItems().clear();
for (TripBillItem item : entity.getBillItems()) {
tb.getBillItems().add(new TripBillItem(item));
}
tb.setFreeCarfare(entity.isFreeCarfare());
tb.setFreeHousing(entity.isFreeHousing());
tb.setFreeMeals(entity.isFreeMeals());
calculate(tb);
super.update(tb);
}
}
}

@ -38,4 +38,14 @@ public class TripBillForm extends FormWithUpload<TripBill> {
return vehicles;
}
public boolean isBillDisabled() {
if (getDataBean().getRequirement().getBillForPassengers() != null
&& getDataBean().getRequirement().getBillForPassengers()
&& !getDataBean().getOwnedBy().equals(getDataBean().getRequirement().getOwnedBy())) {
return true;
}
return false;
}
}

@ -16,7 +16,9 @@
<hbox hflex="1" align="center">
<div align="center" hflex="1">
<vbox>
<image src="/img/lucene_logo.png"/>
<div align="center">
<image src="/img/search-072.png"/>
</div>
<hbox>
<textbox value="@bind(vm.keyWord)" instant="true" width="250px" onCreate="self.setFocus(true)"
onOK="@command('doSearch')"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

@ -147,6 +147,9 @@
sclass="nicebutton"
disabled="@load(vm.selUser eq null)"/>
</hbox>
<checkbox label="Generovat vyúčtování pro spolucestující"
checked="@bind(vm.dataBean.billForPassengers)"
disabled="@load(empty vm.passengers)"/>
<grid model="@load(vm.passengers)" width="700px">
<columns>
<column/>

@ -21,7 +21,7 @@
zclass="form-caption"
label="${labels.TravelOrdersFormTitle}" />
<vlayout vflex="1">
<include src="../tripBillInterior.zul"/>
<include src="../tripBillInterior.zul" vflex="1"/>
<vlayout
vflex="min"
hflex="max">

@ -56,21 +56,21 @@
<checkbox label="${labels.TripBillFreeMeals}"
checked="@bind(vm.dataBean.freeMeals)"
onCheck="@command('calculate')"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
</cell>
</row>
<row>
<cell colspan="2">
<checkbox label="${labels.TripBillFreeHousing}"
checked="@bind(vm.dataBean.freeHousing)"
disabled="${disabled}" />
disabled="@load(vm.billDisabled or disabled)" />
</cell>
</row>
<row>
<cell colspan="2">
<checkbox label="${labels.TripBillFreeCarfare}"
checked="@bind(vm.dataBean.freeCarfare)"
disabled="${disabled}" />
disabled="@load(vm.billDisabled or disabled)" />
</cell>
</row>
</rows>
@ -237,12 +237,12 @@
value="@load(each.to)"
maxlength="@load(vm.lengthText)"
sclass="grid-textbox-max-left"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
<textbox inplace="true"
value="@load(each.back)"
maxlength="@load(vm.lengthText)"
sclass="grid-textbox-max-left"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
</vbox>
<vbox>
<timebox inplace="true"
@ -250,13 +250,13 @@
value="@bind(each.toArrival)"
onChange="@command('calculate')"
format="short"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
<timebox inplace="true"
width="68px"
value="@bind(each.backArrival)"
onChange="@command('calculate')"
format="short"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
</vbox>
<vbox>
<timebox inplace="true"
@ -264,13 +264,13 @@
value="@bind(each.toDeparture)"
onChange="@command('calculate')"
format="short"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
<timebox inplace="true"
width="68px"
value="@bind(each.backDeparture)"
onChange="@command('calculate')"
format="short"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
</vbox>
<vbox>
<combobox inplace="true"
@ -278,7 +278,7 @@
selectedItem="@bind(each.toVehicle)"
width="67px"
readonly="true"
disabled="${disabled}">
disabled="@load(vm.billDisabled or disabled)">
<template name="model">
<comboitem label="@load(each.code)"/>
</template>
@ -289,7 +289,7 @@
selectedItem="@bind(each.backVehicle)"
width="67px"
readonly="true"
disabled="${disabled}">
disabled="@load(vm.billDisabled or disabled)">
<template name="model">
<comboitem label="@load(each.code)"/>
</template>
@ -300,12 +300,12 @@
width="68px"
value="@bind(each.beginWork)"
format="short"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
<timebox inplace="true"
width="68px"
value="@bind(each.endWork)"
format="short"
disabled="${disabled}"/>
disabled="@load(vm.billDisabled or disabled)"/>
</vbox>
<vbox>
<textbox
@ -313,14 +313,14 @@
width="68px"
maxlength="@load(vm.lengthText)"
value="@bind(each.distance) @converter(vm.standardBigDecimalConverter)"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
<textbox
inplace="true"
width="68px"
value="@bind(each.distanceAmount) @converter(vm.standardBigDecimalConverter)"
maxlength="@load(vm.lengthText)"
onChange="@command('calculate')"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
</vbox>
<vbox>
<textbox
@ -328,30 +328,30 @@
width="68px"
maxlength="@load(vm.lengthText)"
value="@bind(each.fuelConsumption) @converter(vm.standardBigDecimalConverter)"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
<textbox
inplace="true"
width="68px"
value="@bind(each.fuelAmount) @converter(vm.standardBigDecimalConverter)"
maxlength="@load(vm.lengthText)"
onChange="@command('calculate')"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
</vbox>
<textbox
inplace="true"
value="@bind(each.carefare) @converter(vm.standardBigDecimalConverter)"
maxlength="@load(vm.lengthText)"
onChange="@command('calculate')"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
<textbox
inplace="true"
value="@bind(each.housing) @converter(vm.standardBigDecimalConverter)"
maxlength="@load(vm.lengthText)"
onChange="@command('calculate')"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
<combobox inplace="true" selectedIndex="@bind(each.freeMealsCount)"
readonly="true"
disabled="${disabled}"
disabled="@load(vm.billDisabled or disabled)"
width="60px"
onBlur="@command('calculate')">
@ -366,7 +366,7 @@
value="@bind(each.otherExpenses) @converter(vm.standardBigDecimalConverter)"
maxlength="@load(vm.lengthText)"
onChange="@command('calculate')"
readonly="${disabled}"/>
readonly="@load(vm.billDisabled or disabled)"/>
<label value="@load(each.total) @converter(vm.standardBigDecimalConverter)"/>
<label value="@load(each.adjustedTotal) @converter(vm.standardBigDecimalConverter)"/>
</row>

Loading…
Cancel
Save