parent
f1ca2d11c8
commit
b2d141e52b
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
|
||||
public interface InvoicingDao extends BaseDao<Invoicing> {
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package info.bukova.isspst.dao.jpa;
|
||||
|
||||
import info.bukova.isspst.dao.InvoicingDao;
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
|
||||
public class InvoicingDaoJPA extends BaseDaoJPA<Invoicing> implements InvoicingDao {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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 = "INVOICING")
|
||||
public class Invoicing extends BaseData {
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "REQUIREMENT_ID")
|
||||
private Requirement requirement;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@LazyCollection(LazyCollectionOption.TRUE)
|
||||
@JoinColumn(name = "INVOICING_ID")
|
||||
private List<InvoicingItem> items;
|
||||
|
||||
@Column(name = "TOTAL_INVOICED", precision = 15, scale = 4)
|
||||
private BigDecimal totalInvoiced;
|
||||
|
||||
public Requirement getRequirement() {
|
||||
return requirement;
|
||||
}
|
||||
|
||||
public void setRequirement(Requirement requirement) {
|
||||
this.requirement = requirement;
|
||||
}
|
||||
|
||||
public List<InvoicingItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<InvoicingItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalInvoiced() {
|
||||
return totalInvoiced;
|
||||
}
|
||||
|
||||
public void setTotalInvoiced(BigDecimal totalInvoiced) {
|
||||
this.totalInvoiced = totalInvoiced;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "INVOICING_ITEM")
|
||||
public class InvoicingItem {
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
|
||||
@Column(name = "INVOICE_DATE")
|
||||
private Date invoiceDate;
|
||||
|
||||
@Column(name = "INVOICE_NUMBER")
|
||||
private String invoiceNumber;
|
||||
|
||||
@Column(name = "AMOUNT", precision = 15, scale = 4)
|
||||
private BigDecimal amount;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getInvoiceDate() {
|
||||
return invoiceDate;
|
||||
}
|
||||
|
||||
public void setInvoiceDate(Date invoiceDate) {
|
||||
this.invoiceDate = invoiceDate;
|
||||
}
|
||||
|
||||
public String getInvoiceNumber() {
|
||||
return invoiceNumber;
|
||||
}
|
||||
|
||||
public void setInvoiceNumber(String invoiceNumber) {
|
||||
this.invoiceNumber = invoiceNumber;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
if (obj instanceof InvoicingItem)
|
||||
{
|
||||
InvoicingItem item = (InvoicingItem)obj;
|
||||
|
||||
int thisId = this.getId();
|
||||
int itemId = item.getId();
|
||||
boolean equalsId = (thisId == itemId);
|
||||
|
||||
if (equalsId && (thisId == 0))
|
||||
{
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
return equalsId;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package info.bukova.isspst.services.invoicing;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface InvoicingService extends Service<Invoicing> {
|
||||
|
||||
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup);
|
||||
|
||||
public void loadReqItems(Invoicing invoicing);
|
||||
|
||||
public void loadItems(Invoicing invoicing);
|
||||
|
||||
public void calculate(Invoicing invoicing);
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package info.bukova.isspst.services.invoicing;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
import info.bukova.isspst.data.InvoicingItem;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
import info.bukova.isspst.services.AbstractOwnedService;
|
||||
import info.bukova.isspst.services.LazyLoader;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements
|
||||
InvoicingService {
|
||||
|
||||
@Override
|
||||
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@LazyLoader("form")
|
||||
public void loadReqItems(Invoicing invoicing) {
|
||||
Invoicing inv = getById(invoicing.getId());
|
||||
Hibernate.initialize(inv.getRequirement().getItems());
|
||||
invoicing.getRequirement().setItems(inv.getRequirement().getItems());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@LazyLoader({"form", "grid"})
|
||||
public void loadItems(Invoicing invoicing) {
|
||||
Invoicing inv = getById(invoicing.getId());
|
||||
Hibernate.initialize(inv.getItems());
|
||||
invoicing.setItems(inv.getItems());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculate(Invoicing invoicing) {
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
|
||||
for (InvoicingItem item : invoicing.getItems()) {
|
||||
total = total.add(item.getAmount());
|
||||
}
|
||||
|
||||
invoicing.setTotalInvoiced(total);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package info.bukova.isspst.services.approved;
|
||||
package info.bukova.isspst.services.orders;
|
||||
|
||||
import info.bukova.isspst.data.JoinedItem;
|
||||
import info.bukova.isspst.services.Service;
|
@ -1,4 +1,4 @@
|
||||
package info.bukova.isspst.services.approved;
|
||||
package info.bukova.isspst.services.orders;
|
||||
|
||||
import info.bukova.isspst.data.JoinedItem;
|
||||
import info.bukova.isspst.data.RequirementItem;
|
@ -1,4 +1,4 @@
|
||||
package info.bukova.isspst.services.approved;
|
||||
package info.bukova.isspst.services.orders;
|
||||
|
||||
import info.bukova.isspst.data.JoinedItem;
|
||||
import info.bukova.isspst.data.Order;
|
@ -1,4 +1,4 @@
|
||||
package info.bukova.isspst.services.approved;
|
||||
package info.bukova.isspst.services.orders;
|
||||
|
||||
import info.bukova.isspst.dao.RequirementItemDao;
|
||||
import info.bukova.isspst.data.AddressEmb;
|
@ -0,0 +1,79 @@
|
||||
package info.bukova.isspst.ui.main.invoicing;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
import info.bukova.isspst.data.InvoicingItem;
|
||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
||||
import info.bukova.isspst.ui.FormViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class InvoicingForm extends FormViewModel<Invoicing> {
|
||||
|
||||
private InvoicingItem selectedItem;
|
||||
private int selectedIndex;
|
||||
@WireVariable
|
||||
private InvoicingService invoicingService;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
private void selectItem(InvoicingItem item) {
|
||||
if (item != null) {
|
||||
selectedItem = item;
|
||||
selectedIndex = getDataBean().getItems().indexOf(item);
|
||||
} else {
|
||||
selectedItem = null;
|
||||
selectedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({"dataBean", "selectedItem", "selectedIndex"})
|
||||
public void addItem() {
|
||||
InvoicingItem item = new InvoicingItem();
|
||||
getDataBean().getItems().add(item);
|
||||
selectItem(item);
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({"dataBean", "selectedItem", "selectedIndex"})
|
||||
public void removeItem(@BindingParam("item") InvoicingItem item) {
|
||||
getDataBean().getItems().remove(item);
|
||||
selectItem(null);
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({"selectedItem", "selectedIndex"})
|
||||
public void onFocus(@BindingParam("item") InvoicingItem item) {
|
||||
selectItem(item);
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange("dataBean")
|
||||
public void calculate() {
|
||||
invoicingService.calculate(getDataBean());
|
||||
}
|
||||
|
||||
public InvoicingItem getSelectedItem() {
|
||||
return selectedItem;
|
||||
}
|
||||
|
||||
public void setSelectedItem(InvoicingItem selectedItem) {
|
||||
this.selectedItem = selectedItem;
|
||||
}
|
||||
|
||||
public int getSelectedIndex() {
|
||||
return selectedIndex;
|
||||
}
|
||||
|
||||
public void setSelectedIndex(int selectedIndex) {
|
||||
this.selectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package info.bukova.isspst.ui.main.invoicing;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class InvoicingList extends ListViewModel<Invoicing> {
|
||||
|
||||
@WireVariable
|
||||
private InvoicingService invoicingService;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void initInvoicing() {
|
||||
service = invoicingService;
|
||||
dataClass = Invoicing.class;
|
||||
formZul = "invoicingForm.zul";
|
||||
//dataFilter = new BuildingFilter(getFilterTemplate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbleToAdd() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbleToDelete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 774 B |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,10 @@
|
||||
<?page title="${labels.Invoicing}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
|
||||
<zscript>
|
||||
String gridZul = "invoicingGrid.zul";
|
||||
</zscript>
|
||||
|
||||
<include src="/app/template.zhtml"/>
|
||||
|
||||
</zk>
|
@ -0,0 +1,191 @@
|
||||
<?page title="${labels.Invoicing}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
<window
|
||||
id="editWin"
|
||||
closable="true"
|
||||
width="95%"
|
||||
height="95%"
|
||||
border="normal"
|
||||
position="center"
|
||||
apply="org.zkoss.bind.BindComposer"
|
||||
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.invoicing.InvoicingForm')">
|
||||
<caption
|
||||
src="/img/invoicing-032.png"
|
||||
zclass="form-caption"
|
||||
label="${labels.InvoicingFormTitle}" />
|
||||
<vlayout vflex="1">
|
||||
<hbox>
|
||||
|
||||
<vbox height="300px">
|
||||
<button
|
||||
image="/img/item-add.png"
|
||||
label="${labels.InvoicingAdd}"
|
||||
sclass="nicebutton"
|
||||
onClick="@command('addItem')"/>
|
||||
|
||||
<listbox
|
||||
model="@load(vm.dataBean.items)"
|
||||
vflex="1"
|
||||
selectedItem="@bind(vm.selectedItem)"
|
||||
selectedIndex="@bind(vm.selectedIndex)">
|
||||
<listhead>
|
||||
<listheader
|
||||
label="${labels.InvoicingDate}"
|
||||
width="150px"/>
|
||||
<listheader label="${labels.InvoicingInvoiceNumber}" />
|
||||
<listheader
|
||||
label="${labels.InvoicingAmount}"
|
||||
align="right"
|
||||
width="90px"/>
|
||||
<listheader/>
|
||||
</listhead>
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listcell>
|
||||
<datebox
|
||||
value="@bind(each.invoiceDate)"
|
||||
inplace="true"
|
||||
onFocus="@command('onFocus', item=each)"/>
|
||||
</listcell>
|
||||
<listcell>
|
||||
<textbox
|
||||
value="@bind(each.invoiceNumber)"
|
||||
sclass="grid-textbox-max"
|
||||
inplace="true"
|
||||
onFocus="@command('onFocus', item=each)"/>
|
||||
</listcell>
|
||||
<listcell>
|
||||
<textbox
|
||||
value="@bind(each.amount) @converter(vm.standardBigDecimalConverter)"
|
||||
sclass="grid-textbox-max"
|
||||
inplace="true"
|
||||
onFocus="@command('onFocus', item=each)"
|
||||
onChange="@command('calculate')"/>
|
||||
</listcell>
|
||||
<listcell>
|
||||
<button label="${labels.RemoveItem}" sclass="nicebutton" onClick="@command('removeItem', item=each)"/>
|
||||
</listcell>
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
</vbox>
|
||||
|
||||
<grid hflex="min">
|
||||
<columns>
|
||||
<column
|
||||
align="right"
|
||||
hflex="min" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.InvoicingRequirementNumber} :</cell>
|
||||
<cell>
|
||||
<textbox
|
||||
width="200px"
|
||||
value="@bind(vm.dataBean.requirement.numser)"
|
||||
style="font-weight: bold;"
|
||||
readonly="true"/>
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.InvoicingDescription} :</cell>
|
||||
<cell>
|
||||
<textbox
|
||||
width="350px"
|
||||
rows="5"
|
||||
value="@bind(vm.dataBean.requirement.description)"
|
||||
readonly="true" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.InvoicingRequirementPrice} :</cell>
|
||||
<cell>
|
||||
<textbox
|
||||
width="150px"
|
||||
value="@bind(vm.dataBean.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)"
|
||||
readonly="true"/>
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.InvoicingInvoicedPrice} :</cell>
|
||||
<cell>
|
||||
<textbox
|
||||
width="150px"
|
||||
value="@bind(vm.dataBean.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
||||
readonly="true"/>
|
||||
</cell>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
|
||||
|
||||
</hbox>
|
||||
|
||||
<listbox
|
||||
vflex="1"
|
||||
model="@load(vm.dataBean.requirement.items)">
|
||||
<listhead>
|
||||
<listheader
|
||||
hflex="10"
|
||||
label="${labels.RequirementItemCode}" />
|
||||
<listheader
|
||||
hflex="15"
|
||||
label="${labels.RequirementItemName}" />
|
||||
<listheader
|
||||
hflex="30"
|
||||
label="${labels.RequirementItemText}" />
|
||||
<listheader
|
||||
hflex="10"
|
||||
align="right"
|
||||
label="${labels.RequirementItemQuantity}" />
|
||||
<listheader
|
||||
hflex="10"
|
||||
label="${labels.RequirementItemMUnit}" />
|
||||
<listheader
|
||||
hflex="10"
|
||||
align="right"
|
||||
label="${labels.RequirementItemUnitPrice}" />
|
||||
<listheader
|
||||
hflex="10"
|
||||
align="right"
|
||||
label="${labels.RequirementItemTotal}" />
|
||||
<listheader
|
||||
hflex="15"
|
||||
label="${labels.RequirementItemDescription}" />
|
||||
</listhead>
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listcell>
|
||||
<label value="@load(each.code)"/>
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@load(each.name)" />
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@load(each.textItem)" />
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@bind(each.quantity) @converter(vm.standardBigDecimalConverter)" />
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@bind(each.munit.name)" />
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@bind(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@bind(each.total) @converter(vm.standardBigDecimalConverter)" />
|
||||
</listcell>
|
||||
<listcell>
|
||||
<label value="@bind(each.description)" />
|
||||
</listcell>
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
|
||||
<include src="/app/formButtons.zul" />
|
||||
</vlayout>
|
||||
</window>
|
||||
</zk>
|
@ -0,0 +1,76 @@
|
||||
<?page title="${labels.Invoicing}" 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.main.invoicing.InvoicingList')">
|
||||
<caption
|
||||
src="/img/invoicing-032.png"
|
||||
zclass="form-caption"
|
||||
label="${labels.Invoicing}" />
|
||||
<include src="/app/toolbar.zul" />
|
||||
<listbox
|
||||
vflex="1"
|
||||
model="@load(vm.dataList)"
|
||||
selectedItem="@bind(vm.dataBean)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader
|
||||
label="${labels.InvoicingRequirementNumber}"
|
||||
width="130px" />
|
||||
<listheader
|
||||
label="Popis"
|
||||
width=""/>
|
||||
<listheader
|
||||
label="${labels.InvoicingRequirementPrice}"
|
||||
align="right"
|
||||
width="130px" />
|
||||
<listheader
|
||||
label="${labels.InvoicingInvoicedPrice}"
|
||||
align="right"
|
||||
width="130px" />
|
||||
</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.description)" />
|
||||
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
|
||||
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)" />
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
</window>
|
||||
</zk>
|
Loading…
Reference in New Issue