From b2d141e52b5465a48bbb0a88613a686d90659d9e Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sun, 26 Oct 2014 22:16:14 +0100 Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1na=20agenda=20pro=20zad=C3=A1v?= =?UTF-8?q?=C3=A1n=C3=AD=20fakturace=20k=20po=C5=BEadavk=C5=AFm.=20Chyb?= =?UTF-8?q?=C3=AD=20filtrov=C3=A1n=C3=AD.=20refs=20#164?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/info/bukova/isspst/Constants.java | 9 +- .../info/bukova/isspst/dao/InvoicingDao.java | 7 + .../isspst/dao/jpa/InvoicingDaoJPA.java | 9 + .../info/bukova/isspst/data/Invoicing.java | 58 ++++++ .../bukova/isspst/data/InvoicingItem.java | 87 ++++++++ .../services/invoicing/InvoicingService.java | 19 ++ .../invoicing/InvoicingServiceImpl.java | 52 +++++ .../{approved => orders}/ApprovedService.java | 2 +- .../ApprovedServiceImpl.java | 2 +- .../{approved => orders}/OrderService.java | 2 +- .../OrderServiceImpl.java | 2 +- .../requirement/RequirementBaseService.java | 8 + .../RequirementBaseServiceImpl.java | 27 ++- .../requirement/RequirementService.java | 7 + .../requirement/RequirementServiceImpl.java | 23 ++- .../TripRequirementServiceImpl.java | 7 +- .../info/bukova/isspst/ui/ListViewModel.java | 5 + .../isspst/ui/dashboard/DashBoardVM.java | 2 +- .../isspst/ui/main/approved/ApprovedList.java | 4 +- .../ui/main/invoicing/InvoicingForm.java | 79 ++++++++ .../ui/main/invoicing/InvoicingList.java | 33 +++ .../ui/main/orders/created/OrderForm.java | 2 +- .../ui/main/orders/created/OrderList.java | 2 +- src/main/resources/hibernate.cfg.xml | 2 + .../WEB-INF/locales/zk-label.properties | 11 + .../webapp/WEB-INF/spring/root-context.xml | 13 +- src/main/webapp/app/mainMenu.zul | 8 +- src/main/webapp/app/toolbar.zul | 2 +- src/main/webapp/img/invoicing-016.png | Bin 0 -> 774 bytes src/main/webapp/img/invoicing-032.png | Bin 0 -> 2197 bytes src/main/webapp/main/invoicing/index.zul | 10 + .../webapp/main/invoicing/invoicingForm.zul | 191 ++++++++++++++++++ .../webapp/main/invoicing/invoicingGrid.zul | 76 +++++++ 33 files changed, 735 insertions(+), 26 deletions(-) create mode 100644 src/main/java/info/bukova/isspst/dao/InvoicingDao.java create mode 100644 src/main/java/info/bukova/isspst/dao/jpa/InvoicingDaoJPA.java create mode 100644 src/main/java/info/bukova/isspst/data/Invoicing.java create mode 100644 src/main/java/info/bukova/isspst/data/InvoicingItem.java create mode 100644 src/main/java/info/bukova/isspst/services/invoicing/InvoicingService.java create mode 100644 src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java rename src/main/java/info/bukova/isspst/services/{approved => orders}/ApprovedService.java (77%) rename src/main/java/info/bukova/isspst/services/{approved => orders}/ApprovedServiceImpl.java (97%) rename src/main/java/info/bukova/isspst/services/{approved => orders}/OrderService.java (94%) rename src/main/java/info/bukova/isspst/services/{approved => orders}/OrderServiceImpl.java (98%) create mode 100644 src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java create mode 100644 src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java create mode 100644 src/main/webapp/img/invoicing-016.png create mode 100644 src/main/webapp/img/invoicing-032.png create mode 100644 src/main/webapp/main/invoicing/index.zul create mode 100644 src/main/webapp/main/invoicing/invoicingForm.zul create mode 100644 src/main/webapp/main/invoicing/invoicingGrid.zul diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index 36febdb0..9578e056 100644 --- a/src/main/java/info/bukova/isspst/Constants.java +++ b/src/main/java/info/bukova/isspst/Constants.java @@ -7,10 +7,11 @@ import info.bukova.isspst.data.Role; import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.services.addressbook.AdbService; -import info.bukova.isspst.services.approved.ApprovedService; -import info.bukova.isspst.services.approved.OrderService; import info.bukova.isspst.services.buildings.BuildingService; +import info.bukova.isspst.services.invoicing.InvoicingService; import info.bukova.isspst.services.munits.MUnitService; +import info.bukova.isspst.services.orders.ApprovedService; +import info.bukova.isspst.services.orders.OrderService; import info.bukova.isspst.services.reqsubjects.MaterialService; import info.bukova.isspst.services.reqsubjects.ServiceItemService; import info.bukova.isspst.services.requirement.RequirementService; @@ -71,6 +72,7 @@ public class Constants { public final static String MOD_TRIPBILL = "TRIPBILL"; public final static String MOD_APPROVED = "APPROVED"; public final static String MOD_ORDER = "ORDER"; + public final static String MOD_INVOICING = "INVOICING"; public final static Module MODULES[] = { new Module(MOD_USERS, "Uživatelé", UserService.class), new Module(MOD_PERMISSIONS, "Práva", RoleService.class), @@ -85,7 +87,8 @@ public class Constants { new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class), new Module(MOD_TRIPBILL, "Cestovní příkazy", TripBillService.class), new Module(MOD_APPROVED, "Schválené položky požadavků", ApprovedService.class), - new Module(MOD_ORDER, "Objednávky", OrderService.class) }; + new Module(MOD_ORDER, "Objednávky", OrderService.class), + new Module(MOD_INVOICING, "Fakturace požadavků", InvoicingService.class) }; public final static String PERM_APPROVE = "PERM_APPROVE"; public final static String PERM_SHOW_WORKGROUP_REQ = "PERM_SHOW_WORKGROUP_REQ"; diff --git a/src/main/java/info/bukova/isspst/dao/InvoicingDao.java b/src/main/java/info/bukova/isspst/dao/InvoicingDao.java new file mode 100644 index 00000000..0994cddc --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/InvoicingDao.java @@ -0,0 +1,7 @@ +package info.bukova.isspst.dao; + +import info.bukova.isspst.data.Invoicing; + +public interface InvoicingDao extends BaseDao { + +} diff --git a/src/main/java/info/bukova/isspst/dao/jpa/InvoicingDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/InvoicingDaoJPA.java new file mode 100644 index 00000000..2b229e3b --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/jpa/InvoicingDaoJPA.java @@ -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 implements InvoicingDao { + + +} diff --git a/src/main/java/info/bukova/isspst/data/Invoicing.java b/src/main/java/info/bukova/isspst/data/Invoicing.java new file mode 100644 index 00000000..6f5666c1 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/Invoicing.java @@ -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 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 getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public BigDecimal getTotalInvoiced() { + return totalInvoiced; + } + + public void setTotalInvoiced(BigDecimal totalInvoiced) { + this.totalInvoiced = totalInvoiced; + } + +} diff --git a/src/main/java/info/bukova/isspst/data/InvoicingItem.java b/src/main/java/info/bukova/isspst/data/InvoicingItem.java new file mode 100644 index 00000000..2dc0d360 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/InvoicingItem.java @@ -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; + } + +} diff --git a/src/main/java/info/bukova/isspst/services/invoicing/InvoicingService.java b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingService.java new file mode 100644 index 00000000..d56dba55 --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingService.java @@ -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 { + + public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup); + + public void loadReqItems(Invoicing invoicing); + + public void loadItems(Invoicing invoicing); + + public void calculate(Invoicing invoicing); + +} diff --git a/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java new file mode 100644 index 00000000..0f1bb35e --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/invoicing/InvoicingServiceImpl.java @@ -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 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); + } + +} diff --git a/src/main/java/info/bukova/isspst/services/approved/ApprovedService.java b/src/main/java/info/bukova/isspst/services/orders/ApprovedService.java similarity index 77% rename from src/main/java/info/bukova/isspst/services/approved/ApprovedService.java rename to src/main/java/info/bukova/isspst/services/orders/ApprovedService.java index a992b985..01615a65 100644 --- a/src/main/java/info/bukova/isspst/services/approved/ApprovedService.java +++ b/src/main/java/info/bukova/isspst/services/orders/ApprovedService.java @@ -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; diff --git a/src/main/java/info/bukova/isspst/services/approved/ApprovedServiceImpl.java b/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java similarity index 97% rename from src/main/java/info/bukova/isspst/services/approved/ApprovedServiceImpl.java rename to src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java index 8234267d..ab9e21d5 100644 --- a/src/main/java/info/bukova/isspst/services/approved/ApprovedServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/orders/ApprovedServiceImpl.java @@ -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; diff --git a/src/main/java/info/bukova/isspst/services/approved/OrderService.java b/src/main/java/info/bukova/isspst/services/orders/OrderService.java similarity index 94% rename from src/main/java/info/bukova/isspst/services/approved/OrderService.java rename to src/main/java/info/bukova/isspst/services/orders/OrderService.java index 0966403c..1fe1e0c2 100644 --- a/src/main/java/info/bukova/isspst/services/approved/OrderService.java +++ b/src/main/java/info/bukova/isspst/services/orders/OrderService.java @@ -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; diff --git a/src/main/java/info/bukova/isspst/services/approved/OrderServiceImpl.java b/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java similarity index 98% rename from src/main/java/info/bukova/isspst/services/approved/OrderServiceImpl.java rename to src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java index 7d4cf2b6..52a37706 100644 --- a/src/main/java/info/bukova/isspst/services/approved/OrderServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/orders/OrderServiceImpl.java @@ -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; diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java index 61eb2a0f..02d320d5 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseService.java @@ -6,6 +6,14 @@ import info.bukova.isspst.services.Service; import java.util.List; +/** + * @author Pepa Rokos + * @author Franta Přibyl + * + * Základní rozhraní všech požadavků. + * + * @param Třída požadavku. + */ public interface RequirementBaseService extends Service { diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java index 82881c0f..7a40b444 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java @@ -30,6 +30,14 @@ import org.springframework.security.access.prepost.PostFilter; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; +/** + * @author Pepa Rokos + * @author Franta Přibyl + * + * Abstraktní bázová třída všech požadavků + * + * @param Třída požadavku + */ public abstract class RequirementBaseServiceImpl extends AbstractOwnedService implements RequirementBaseService { @@ -249,6 +257,8 @@ public abstract class RequirementBaseServiceImpl exte } } } + + postApprove(e); } @Override @@ -257,10 +267,25 @@ public abstract class RequirementBaseServiceImpl exte public void approve(T entity) { approve(entity, getLoggedInUser()); } - + + /** + * Volá se z metody approve pro automatické schválení dalším schvalovatelem v pořadí. Metoda z báze nedělá nic. + * + * @param entity Požadavek + * @return true pokud se provedlo automatické schválení. + */ protected boolean autoApprove(T entity) { return false; } + + /** + * Činnost prováděná po schválení požadavku (i dílčím schválení). + * + * @param entity Požadavek + */ + protected void postApprove(T entity) { + + } @Override @Transactional diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java index bb15c84d..770e69d1 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java @@ -6,6 +6,13 @@ import info.bukova.isspst.data.RequirementItem; import java.math.BigDecimal; import java.util.List; +/** + * @author Pepa Rokos + * @author Franta Přibyl + * + * Základní rozhraní požadavků na služby a materiál. + * + */ public interface RequirementService extends RequirementBaseService { public void loadGroups(Requirement req); diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java index 1a0df9cd..67e66537 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -1,6 +1,7 @@ package info.bukova.isspst.services.requirement; import info.bukova.isspst.Constants; +import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.RequirementItem; import info.bukova.isspst.data.RequirementState; @@ -8,7 +9,7 @@ import info.bukova.isspst.data.RequirementSubject; import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workflow; import info.bukova.isspst.services.LazyLoader; -import info.bukova.isspst.services.approved.OrderService; +import info.bukova.isspst.services.invoicing.InvoicingService; import java.math.BigDecimal; import java.util.Date; @@ -18,13 +19,20 @@ import org.hibernate.Hibernate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +/** + * @author Pepa Rokos + * @author Franta Přibyl + * + * Bázová třída požadavků na materiál a služby. + * + */ public class RequirementServiceImpl extends RequirementBaseServiceImpl implements RequirementService, RequirementBaseService { @Autowired private RequirementTypeService reqTypeService; @Autowired - private OrderService orderService; + private InvoicingService invoicingService; @Override protected Requirement createEntity() @@ -64,7 +72,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl @@ -54,11 +53,7 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl extends DocumentViewModel { return this.isRecordSelected(); } + + public boolean isAbleToAdd() + { + return true; + } } diff --git a/src/main/java/info/bukova/isspst/ui/dashboard/DashBoardVM.java b/src/main/java/info/bukova/isspst/ui/dashboard/DashBoardVM.java index 7be10133..44982a6b 100644 --- a/src/main/java/info/bukova/isspst/ui/dashboard/DashBoardVM.java +++ b/src/main/java/info/bukova/isspst/ui/dashboard/DashBoardVM.java @@ -3,7 +3,7 @@ package info.bukova.isspst.ui.dashboard; import info.bukova.isspst.data.Role; import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; -import info.bukova.isspst.services.approved.OrderService; +import info.bukova.isspst.services.orders.OrderService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.ui.DocumentViewModel; diff --git a/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java b/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java index 60369b4f..f708fab5 100644 --- a/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java +++ b/src/main/java/info/bukova/isspst/ui/main/approved/ApprovedList.java @@ -5,8 +5,8 @@ import info.bukova.isspst.data.Order; import info.bukova.isspst.data.User; import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.filters.JoinedItemFilter; -import info.bukova.isspst.services.approved.ApprovedService; -import info.bukova.isspst.services.approved.OrderService; +import info.bukova.isspst.services.orders.ApprovedService; +import info.bukova.isspst.services.orders.OrderService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.ui.BigDecimalConverter; diff --git a/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java new file mode 100644 index 00000000..09038f0b --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingForm.java @@ -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 { + + 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; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java new file mode 100644 index 00000000..6a5c97e8 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/main/invoicing/InvoicingList.java @@ -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 { + + @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; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java index 7177ed89..4d013a57 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderForm.java @@ -5,7 +5,7 @@ import info.bukova.isspst.data.AddressEmb; import info.bukova.isspst.data.Order; import info.bukova.isspst.data.OrderItem; import info.bukova.isspst.services.addressbook.AdbService; -import info.bukova.isspst.services.approved.OrderService; +import info.bukova.isspst.services.orders.OrderService; import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.ui.FormViewModel; import info.bukova.isspst.validators.OrderFormValidator; diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java index dd4b3403..547a0ec3 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java @@ -9,7 +9,7 @@ import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.User; import info.bukova.isspst.filters.OrderFilter; import info.bukova.isspst.services.addressbook.AdbService; -import info.bukova.isspst.services.approved.OrderService; +import info.bukova.isspst.services.orders.OrderService; import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.ui.ListViewModel; diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index e2aec8cd..70d8f8ef 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -30,5 +30,7 @@ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index a1fae789..85e4516a 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -330,6 +330,17 @@ OrderFormInvoiceNumber=Číslo faktury OrderFormInvoiceTotal=Částka faktury OrderPrintPrices=Tisknout ceny +Invoicing=Fakturace požadavků +InvoicingRequirementNumber=Číslo požadavku +InvoicingRequirementPrice=Cena požadavku +InvoicingInvoicedPrice=Vyfakturovaná cena +InvoicingFormTitle=Zadání fakturace +InvoicingAdd=Přidat fakturaci +InvoicingDate=Datum +InvoicingInvoiceNumber=Číslo faktury +InvoicingAmount=Částka +InvoicingDescription=Popis + HandleComboKeyFilter=#del HandleComboKey=$#del diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml index dc990d89..aa91bad8 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -251,6 +251,10 @@ + + + + @@ -317,7 +321,7 @@ - + @@ -408,10 +412,15 @@ - + + + + + + diff --git a/src/main/webapp/app/mainMenu.zul b/src/main/webapp/app/mainMenu.zul index d09878c0..d78fb2fe 100644 --- a/src/main/webapp/app/mainMenu.zul +++ b/src/main/webapp/app/mainMenu.zul @@ -9,7 +9,7 @@ autodrop="true"> + href="/app/" /> @@ -34,6 +34,12 @@ label="${labels.CreatedOrders}" href="/main/orders/created/" disabled="${not sec:isAllGranted('PERM_READ_ORDER')}" /> + + diff --git a/src/main/webapp/app/toolbar.zul b/src/main/webapp/app/toolbar.zul index 74b08ea7..fca0ddb6 100644 --- a/src/main/webapp/app/toolbar.zul +++ b/src/main/webapp/app/toolbar.zul @@ -1,7 +1,7 @@ - + diff --git a/src/main/webapp/img/invoicing-016.png b/src/main/webapp/img/invoic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N-0K1M?Xx8)|!EV0nQ43o`evz+ij}VDnf{l{O0E7kW$j=bUxMhzovfx X1MMAT(js>d00000NkvXXu0mjf*ibYP literal 0 HcmV?d00001 diff --git a/src/main/webapp/main/invoicing/index.zul b/src/main/webapp/main/invoicing/index.zul new file mode 100644 index 00000000..6a397a7b --- /dev/null +++ b/src/main/webapp/main/invoicing/index.zul @@ -0,0 +1,10 @@ + + + + + String gridZul = "invoicingGrid.zul"; + + + + + \ No newline at end of file diff --git a/src/main/webapp/main/invoicing/invoicingForm.zul b/src/main/webapp/main/invoicing/invoicingForm.zul new file mode 100644 index 00000000..5f5d546a --- /dev/null +++ b/src/main/webapp/main/invoicing/invoicingForm.zul @@ -0,0 +1,191 @@ + + + + + + + + +