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
Verze_2.0
František Přibyl 10 years ago
parent 5d9e6226d3
commit ceac59c8d3

@ -10,9 +10,9 @@ import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping; 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.addressbook.AdbService;
import info.bukova.isspst.services.buildings.BuildingService; 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.invoicing.InvoicingService;
import info.bukova.isspst.services.munits.MUnitService; import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.orders.ApprovedService; import info.bukova.isspst.services.orders.ApprovedService;
@ -33,7 +33,7 @@ import java.util.Map;
public class Constants { 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 = "admin";
public final static String DEF_ADMIN_PASSWD = "admin"; public final static String DEF_ADMIN_PASSWD = "admin";

@ -17,7 +17,8 @@ import org.hibernate.annotations.LazyCollectionOption;
@Entity @Entity
@Table(name = "INVOICING") @Table(name = "INVOICING")
public class Invoicing extends BaseData { public class Invoicing extends BaseData implements Cloneable
{
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "REQUIREMENT_ID") @JoinColumn(name = "REQUIREMENT_ID")
@ -31,6 +32,9 @@ public class Invoicing extends BaseData {
@Column(name = "TOTAL_INVOICED", precision = 15, scale = 4) @Column(name = "TOTAL_INVOICED", precision = 15, scale = 4)
private BigDecimal totalInvoiced; private BigDecimal totalInvoiced;
@Column(name = "COMPLETED")
private boolean completed;
public Requirement getRequirement() { public Requirement getRequirement() {
return requirement; return requirement;
} }
@ -55,4 +59,20 @@ public class Invoicing extends BaseData {
this.totalInvoiced = totalInvoiced; 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>(); List<Str2Str> tables = new ArrayList<Str2Str>();
tables.add(new Str2Str("address", "DESCRIPTION")); tables.add(new Str2Str("ADDRESS", "DESCRIPTION"));
tables.add(new Str2Str("building", "DESCRIPTION")); tables.add(new Str2Str("BUILDING", "DESCRIPTION"));
tables.add(new Str2Str("material", "DESCRIPTION")); tables.add(new Str2Str("MATERIAL", "DESCRIPTION"));
tables.add(new Str2Str("munit", "DESCRIPTION")); tables.add(new Str2Str("MUNIT", "DESCRIPTION"));
tables.add(new Str2Str("orders", "DESCRIPTION")); tables.add(new Str2Str("ORDERS", "DESCRIPTION"));
tables.add(new Str2Str("order_item", "DESCRIPTION")); tables.add(new Str2Str("ORDER_ITEM", "DESCRIPTION"));
tables.add(new Str2Str("permission", "DESCRIPTION")); tables.add(new Str2Str("PERMISSION", "DESCRIPTION"));
tables.add(new Str2Str("requirement", "DESCRIPTION")); tables.add(new Str2Str("REQUIREMENT", "DESCRIPTION"));
tables.add(new Str2Str("requirementtype", "DESCRIPTION")); tables.add(new Str2Str("REQUIREMENTTYPE", "DESCRIPTION"));
tables.add(new Str2Str("requirement_items", "DESCRIPTION")); tables.add(new Str2Str("REQUIREMENT_ITEMS", "DESCRIPTION"));
tables.add(new Str2Str("role", "DESCRIPTION")); tables.add(new Str2Str("ROLE", "DESCRIPTION"));
tables.add(new Str2Str("service", "DESCRIPTION")); tables.add(new Str2Str("SERVICE", "DESCRIPTION"));
tables.add(new Str2Str("triprequirement", "DESCRIPTION")); tables.add(new Str2Str("TRIPREQUIREMENT", "DESCRIPTION"));
tables.add(new Str2Str("material", "MUNIT_DESCRIPTION")); tables.add(new Str2Str("MATERIAL", "MUNIT_DESCRIPTION"));
tables.add(new Str2Str("orders", "INVOICE_DESCRIPTION")); tables.add(new Str2Str("ORDERS", "INVOICE_DESCRIPTION"));
tables.add(new Str2Str("orders", "DELIVERY_DESCRIPTION")); tables.add(new Str2Str("ORDERS", "DELIVERY_DESCRIPTION"));
tables.add(new Str2Str("orders", "SUPPLIER_DESCRIPTION")); tables.add(new Str2Str("ORDERS", "SUPPLIER_DESCRIPTION"));
tables.add(new Str2Str("order_item", "MUNIT_DESCRIPTION")); tables.add(new Str2Str("ORDER_ITEM", "MUNIT_DESCRIPTION"));
tables.add(new Str2Str("requirement_items", "MUNIT_DESCRIPTION")); tables.add(new Str2Str("REQUIREMENT_ITEMS", "MUNIT_DESCRIPTION"));
tables.add(new Str2Str("triprequirement", "VEHICLE_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", "BACK_VEHICLE_DESCRIPTION"));
tables.add(new Str2Str("trip_bill_items", "VEHICLE_DESCRIPTION")); tables.add(new Str2Str("TRIP_BILL_ITEMS", "VEHICLE_DESCRIPTION"));
for (Str2Str item : tables) for (Str2Str item : tables)
{ {
@ -107,9 +107,9 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
{ {
List<String> tables = new ArrayList<String>(); List<String> tables = new ArrayList<String>();
tables.add("material"); tables.add("MATERIAL");
tables.add("order_item"); tables.add("ORDER_ITEM");
tables.add("requirement_items"); tables.add("REQUIREMENT_ITEMS");
for (String item : tables) 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(); this.updateDatabaseVersion();
} }
} }

@ -1,11 +1,12 @@
package info.bukova.isspst.services.invoicing; package info.bukova.isspst.services.invoicing;
import java.math.BigDecimal;
import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Invoicing;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import java.math.BigDecimal;
import java.util.List;
public interface InvoicingService extends Service<Invoicing> { public interface InvoicingService extends Service<Invoicing> {
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup); public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup);
@ -16,4 +17,7 @@ public interface InvoicingService extends Service<Invoicing> {
public void calculate(Invoicing 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()); 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,8 +258,11 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
} }
dataBean = editBean; dataBean = editBean;
if (!newRec && editBean != null) { if (!newRec && editBean != null) {
if (selIndex < dataList.size())
{
dataList.set(selIndex, editBean); dataList.set(selIndex, editBean);
} }
}
BindUtils.postGlobalCommand(null, null, "reloadRelated", null); 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.services.invoicing.InvoicingService;
import info.bukova.isspst.ui.FormViewModel; 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.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@ -13,14 +16,44 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
public class InvoicingForm extends FormViewModel<Invoicing> { 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 InvoicingItem selectedItem;
private int selectedIndex; private int selectedIndex;
@WireVariable @WireVariable
private InvoicingService invoicingService; private InvoicingService invoicingService;
protected Invoicing invoicingBeforeEdit;
@Init(superclass = true) @Init(superclass = true)
public void init() { public void initInvoicingForm()
{
selectedIndex = -1; 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) { private void selectItem(InvoicingItem item) {
@ -77,4 +110,13 @@ public class InvoicingForm extends FormViewModel<Invoicing> {
this.selectedIndex = selectedIndex; 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; package info.bukova.isspst.ui.main.invoicing;
import java.util.List;
import info.bukova.isspst.data.Invoicing; import info.bukova.isspst.data.Invoicing;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup; 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.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel; 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.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
public class InvoicingList extends ListViewModel<Invoicing> { public class InvoicingList extends ListViewModel<Invoicing> {
@WireVariable @WireVariable
private InvoicingService invoicingService; protected InvoicingService invoicingService;
@WireVariable @WireVariable
private WorkgroupService workgroupService; private WorkgroupService workgroupService;
@WireVariable @WireVariable
@ -53,4 +55,15 @@ public class InvoicingList extends ListViewModel<Invoicing> {
return userService.getUsersForCombo(); 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>();
}
}
}

@ -386,3 +386,6 @@ ModuleNotActive=Modul není aktivovaný
AgendaSearch=Vyhledávání AgendaSearch=Vyhledávání
Search=Hledat Search=Hledat
Pending = Nevyřízené
Archive = Archiv
Completed = Vyřízeno

@ -2,7 +2,7 @@
<zk> <zk>
<zscript> <zscript>
String gridZul = "invoicingGrid.zul"; String gridZul = "setup.zul";
</zscript> </zscript>
<include src="/app/template.zhtml"/> <include src="/app/template.zhtml"/>

@ -0,0 +1,13 @@
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
vflex="1"
border="none"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.invoicing.InvoicingArchiveList')">
<include src="/app/toolbar.zul" />
<include
vflex="1"
src="/main/invoicing/invoicingGrid.zul" />
</window>
</zk>

@ -0,0 +1,13 @@
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
vflex="1"
border="none"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.invoicing.InvoicingPendingList')">
<include src="/app/toolbar.zul" />
<include
vflex="1"
src="/main/invoicing/invoicingGrid.zul" />
</window>
</zk>

@ -17,11 +17,21 @@
<hbox <hbox
vflex="min" vflex="min"
hflex="1"> hflex="1">
<div hflex="1">
<button <button
image="/img/item-add.png" image="/img/item-add.png"
label="${labels.InvoicingAdd}" label="${labels.InvoicingAdd}"
sclass="nicebutton" sclass="nicebutton"
onClick="@command('addItem')" /> onClick="@command('addItem')" />
</div>
<div hflex="1"></div>
<div
hflex="1"
align="right">
<checkbox
label="${labels.Completed}"
checked="@bind(vm.dataBean.completed)" />
</div>
</hbox> </hbox>
<hbox vflex="1"> <hbox vflex="1">
<vbox vflex="1"> <vbox vflex="1">

@ -1,17 +1,5 @@
<?page title="${labels.Invoicing}" contentType="text/html;charset=UTF-8"?> <?page contentType="text/html;charset=UTF-8"?>
<zk> <listbox
<?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" vflex="1"
model="@load(vm.dataList)" model="@load(vm.dataList)"
selectedItem="@bind(vm.dataBean)"> selectedItem="@bind(vm.dataBean)">
@ -19,7 +7,7 @@
<listheader <listheader
label="${labels.InvoicingRequirementNumber}" label="${labels.InvoicingRequirementNumber}"
sort="czech(requirement.numser)" sort="czech(requirement.numser)"
onCreate="self.sort(true)" onCreate="self.sort(false)"
width="130px" /> width="130px" />
<listheader <listheader
label="${labels.RequirementsGridReqDate}" label="${labels.RequirementsGridReqDate}"
@ -204,6 +192,4 @@
style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )" /> style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )" />
</listitem> </listitem>
</template> </template>
</listbox> </listbox>
</window>
</zk>

@ -0,0 +1,19 @@
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<zscript>
String gridPending = "/main/invoicing/invHeadListPending.zul";
String gridArchive = "/main/invoicing/invHeadListArchive.zul";
</zscript>
<window
vflex="1"
border="normal">
<caption
src="/img/invoicing-032.png"
zclass="form-caption"
label="${labels.Invoicing}" />
<include
vflex="1"
src="/main/invoicing/tabPanels.zul" />
</window>
</zk>

@ -0,0 +1,16 @@
<tabbox
apply="org.zkoss.bind.BindComposer"
vflex="1">
<tabs>
<tab label="${labels.Pending}" />
<tab label="${labels.Archive}" />
</tabs>
<tabpanels>
<tabpanel>
<include src="${gridPending}" />
</tabpanel>
<tabpanel>
<include src="${gridArchive}" />
</tabpanel>
</tabpanels>
</tabbox>

@ -2,7 +2,7 @@
<zk> <zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window <window
vflex=" 1" vflex="1"
border="normal" border="normal"
apply="org.zkoss.bind.BindComposer" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.created.OrderList')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.created.OrderList')">

Loading…
Cancel
Save