Agenda Fakturace požadavků
• grid rozdělen na 2 záložky [Nevyřízené] a [Archive] • na formuláři přidán checkbox [Vyřízeno] closes #207
This commit is contained in:
@@ -10,9 +10,9 @@ import info.bukova.isspst.data.TripBill;
|
||||
import info.bukova.isspst.data.TripRequirement;
|
||||
import info.bukova.isspst.reporting.Report;
|
||||
import info.bukova.isspst.reporting.ReportMapping;
|
||||
import info.bukova.isspst.services.fulltext.FullTextService;
|
||||
import info.bukova.isspst.services.addressbook.AdbService;
|
||||
import info.bukova.isspst.services.buildings.BuildingService;
|
||||
import info.bukova.isspst.services.fulltext.FullTextService;
|
||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
||||
import info.bukova.isspst.services.munits.MUnitService;
|
||||
import info.bukova.isspst.services.orders.ApprovedService;
|
||||
@@ -33,7 +33,7 @@ import java.util.Map;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public final static long DB_VERSION = 2;
|
||||
public final static long DB_VERSION = 3;
|
||||
|
||||
public final static String DEF_ADMIN = "admin";
|
||||
public final static String DEF_ADMIN_PASSWD = "admin";
|
||||
|
||||
@@ -17,7 +17,8 @@ import org.hibernate.annotations.LazyCollectionOption;
|
||||
|
||||
@Entity
|
||||
@Table(name = "INVOICING")
|
||||
public class Invoicing extends BaseData {
|
||||
public class Invoicing extends BaseData implements Cloneable
|
||||
{
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "REQUIREMENT_ID")
|
||||
@@ -31,6 +32,9 @@ public class Invoicing extends BaseData {
|
||||
@Column(name = "TOTAL_INVOICED", precision = 15, scale = 4)
|
||||
private BigDecimal totalInvoiced;
|
||||
|
||||
@Column(name = "COMPLETED")
|
||||
private boolean completed;
|
||||
|
||||
public Requirement getRequirement() {
|
||||
return requirement;
|
||||
}
|
||||
@@ -55,4 +59,20 @@ public class Invoicing extends BaseData {
|
||||
this.totalInvoiced = totalInvoiced;
|
||||
}
|
||||
|
||||
public boolean isCompleted()
|
||||
{
|
||||
return completed;
|
||||
}
|
||||
|
||||
public void setCompleted(boolean completed)
|
||||
{
|
||||
this.completed = completed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException
|
||||
{
|
||||
Invoicing cloned = (Invoicing) super.clone();
|
||||
return cloned;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,29 +71,29 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
||||
{
|
||||
List<Str2Str> tables = new ArrayList<Str2Str>();
|
||||
|
||||
tables.add(new Str2Str("address", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("building", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("material", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("munit", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("order_item", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("permission", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirement", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirementtype", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirement_items", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("role", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("service", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("triprequirement", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("ADDRESS", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("BUILDING", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("MATERIAL", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("MUNIT", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("ORDERS", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("ORDER_ITEM", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("PERMISSION", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("REQUIREMENT", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("REQUIREMENTTYPE", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("REQUIREMENT_ITEMS", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("ROLE", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("SERVICE", "DESCRIPTION"));
|
||||
tables.add(new Str2Str("TRIPREQUIREMENT", "DESCRIPTION"));
|
||||
|
||||
tables.add(new Str2Str("material", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "INVOICE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "DELIVERY_DESCRIPTION"));
|
||||
tables.add(new Str2Str("orders", "SUPPLIER_DESCRIPTION"));
|
||||
tables.add(new Str2Str("order_item", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("requirement_items", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("triprequirement", "VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("trip_bill_items", "BACK_VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("trip_bill_items", "VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("MATERIAL", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("ORDERS", "INVOICE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("ORDERS", "DELIVERY_DESCRIPTION"));
|
||||
tables.add(new Str2Str("ORDERS", "SUPPLIER_DESCRIPTION"));
|
||||
tables.add(new Str2Str("ORDER_ITEM", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("REQUIREMENT_ITEMS", "MUNIT_DESCRIPTION"));
|
||||
tables.add(new Str2Str("TRIPREQUIREMENT", "VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("TRIP_BILL_ITEMS", "BACK_VEHICLE_DESCRIPTION"));
|
||||
tables.add(new Str2Str("TRIP_BILL_ITEMS", "VEHICLE_DESCRIPTION"));
|
||||
|
||||
for (Str2Str item : tables)
|
||||
{
|
||||
@@ -107,9 +107,9 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
||||
{
|
||||
List<String> tables = new ArrayList<String>();
|
||||
|
||||
tables.add("material");
|
||||
tables.add("order_item");
|
||||
tables.add("requirement_items");
|
||||
tables.add("MATERIAL");
|
||||
tables.add("ORDER_ITEM");
|
||||
tables.add("REQUIREMENT_ITEMS");
|
||||
|
||||
for (String item : tables)
|
||||
{
|
||||
@@ -119,6 +119,13 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
||||
}
|
||||
}
|
||||
|
||||
if (dbVersion < 3)
|
||||
{
|
||||
sql = "UPDATE INVOICING SET COMPLETED = false WHERE (COMPLETED Is NULL) ";
|
||||
sq = this.dao.getSession().createSQLQuery(sql);
|
||||
sq.executeUpdate();
|
||||
}
|
||||
|
||||
this.updateDatabaseVersion();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface InvoicingService extends Service<Invoicing> {
|
||||
|
||||
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup);
|
||||
@@ -16,4 +17,7 @@ public interface InvoicingService extends Service<Invoicing> {
|
||||
|
||||
public void calculate(Invoicing invoicing);
|
||||
|
||||
public List<Invoicing> getPendingList();
|
||||
|
||||
public List<Invoicing> getArchiveList();
|
||||
}
|
||||
|
||||
@@ -73,4 +73,23 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
|
||||
invoice.getRequirement().setOwnedBy(inv.getRequirement().getOwnedBy());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_READ')")
|
||||
public List<Invoicing> getPendingList()
|
||||
{
|
||||
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where (inv.completed Is Null or inv.completed = false) order by rq.numser");
|
||||
return q.list();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_READ')")
|
||||
public List<Invoicing> getArchiveList()
|
||||
{
|
||||
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy where inv.completed = true order by rq.numser");
|
||||
return q.list();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,10 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
||||
}
|
||||
dataBean = editBean;
|
||||
if (!newRec && editBean != null) {
|
||||
dataList.set(selIndex, editBean);
|
||||
if (selIndex < dataList.size())
|
||||
{
|
||||
dataList.set(selIndex, editBean);
|
||||
}
|
||||
}
|
||||
|
||||
BindUtils.postGlobalCommand(null, null, "reloadRelated", null);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package info.bukova.isspst.ui.main.invoicing;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
|
||||
public class InvoicingArchiveList extends InvoicingList
|
||||
{
|
||||
@Init(superclass = true)
|
||||
public void initInvoicingArchiveList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Invoicing> getListFromService()
|
||||
{
|
||||
try
|
||||
{
|
||||
return invoicingService.getArchiveList();
|
||||
}
|
||||
catch (AccessDeniedException e)
|
||||
{
|
||||
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
|
||||
// e.printStackTrace();
|
||||
return new ArrayList<Invoicing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import info.bukova.isspst.data.InvoicingItem;
|
||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
||||
import info.bukova.isspst.ui.FormViewModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.zkoss.bind.BindUtils;
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
@@ -13,16 +16,46 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class InvoicingForm extends FormViewModel<Invoicing> {
|
||||
|
||||
public final static String TAG = InvoicingForm.class.getSimpleName();
|
||||
private final static Logger log = LoggerFactory.getLogger(InvoicingForm.class.getSimpleName());
|
||||
|
||||
private InvoicingItem selectedItem;
|
||||
private int selectedIndex;
|
||||
@WireVariable
|
||||
private InvoicingService invoicingService;
|
||||
|
||||
protected Invoicing invoicingBeforeEdit;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
public void initInvoicingForm()
|
||||
{
|
||||
selectedIndex = -1;
|
||||
|
||||
try
|
||||
{
|
||||
this.invoicingBeforeEdit = (Invoicing) this.getDataBean().clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
log.error("Nelze provést hlubokou kopii fakturace!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSave()
|
||||
{
|
||||
// Zjisti, zda se změnil příznak Vyřízeno
|
||||
boolean competedChanged = (this.invoicingBeforeEdit.isCompleted() != this.getDataBean().isCompleted());
|
||||
|
||||
super.doSave();
|
||||
|
||||
if (competedChanged)
|
||||
{
|
||||
BindUtils.postGlobalCommand(null, null, "refreshTabs", null);
|
||||
}
|
||||
}
|
||||
|
||||
private void selectItem(InvoicingItem item) {
|
||||
if (item != null) {
|
||||
selectedItem = item;
|
||||
@@ -77,4 +110,13 @@ public class InvoicingForm extends FormViewModel<Invoicing> {
|
||||
this.selectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
public Invoicing getInvoicingBeforeEdit()
|
||||
{
|
||||
return invoicingBeforeEdit;
|
||||
}
|
||||
|
||||
public void setInvoicingBeforeEdit(Invoicing invoicingBeforeEdit)
|
||||
{
|
||||
this.invoicingBeforeEdit = invoicingBeforeEdit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package info.bukova.isspst.ui.main.invoicing;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
@@ -11,13 +9,17 @@ import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.zkoss.bind.annotation.GlobalCommand;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class InvoicingList extends ListViewModel<Invoicing> {
|
||||
|
||||
@WireVariable
|
||||
private InvoicingService invoicingService;
|
||||
protected InvoicingService invoicingService;
|
||||
@WireVariable
|
||||
private WorkgroupService workgroupService;
|
||||
@WireVariable
|
||||
@@ -53,4 +55,15 @@ public class InvoicingList extends ListViewModel<Invoicing> {
|
||||
return userService.getUsersForCombo();
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange({ "dataList", "dataBean", "ableToDelete" })
|
||||
public void refreshTabs()
|
||||
{
|
||||
// Změnou hodnoty Vyřízeno se záznam přesunul do jiné záložky
|
||||
// Aby se editovaný záznam nerefreshoval, protože tam už nebude, nastaví
|
||||
// se na null
|
||||
this.setEditBean(null);
|
||||
// Provede přenačtení všech záložek
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package info.bukova.isspst.ui.main.invoicing;
|
||||
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
|
||||
public class InvoicingPendingList extends InvoicingList
|
||||
{
|
||||
@Init(superclass = true)
|
||||
public void initInvoicingPendingList()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Invoicing> getListFromService()
|
||||
{
|
||||
try
|
||||
{
|
||||
return invoicingService.getPendingList();
|
||||
}
|
||||
catch (AccessDeniedException e)
|
||||
{
|
||||
// BindUtils.postGlobalCommand(null, null, "disableCentre", null);
|
||||
// e.printStackTrace();
|
||||
return new ArrayList<Invoicing>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user