Merge branch 'Verze_1.0'
Conflicts: src/main/webapp/WEB-INF/locales/zk-label.properties src/main/webapp/app/mainMenu.zul
This commit is contained in:
@@ -4,6 +4,7 @@ import info.bukova.isspst.DateTimeUtils;
|
||||
import info.bukova.isspst.StringUtils;
|
||||
import info.bukova.isspst.data.Invoicing;
|
||||
import info.bukova.isspst.data.Requirement;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.Workgroup;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
@@ -48,8 +49,9 @@ public class InvoicingFilter implements Filter<Invoicing>
|
||||
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getRequirement().getReqDate(), condition.getRequirement().getReqDate());
|
||||
boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getCentre(), condition.getRequirement().getCentre());
|
||||
boolean foundWorkgroup = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getWorkgroup(), condition.getRequirement().getWorkgroup());
|
||||
boolean foundUser = User.isEqualByUserForFilter(item.getRequirement().getOwnedBy(), condition.getRequirement().getOwnedBy());
|
||||
boolean foundDescription = StringUtils.isEqualForFilter(item.getRequirement().getDescription(), condition.getRequirement().getDescription());
|
||||
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup);
|
||||
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup && foundUser);
|
||||
}
|
||||
|
||||
@Factory
|
||||
|
||||
@@ -64,5 +64,13 @@ public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implem
|
||||
Query q = dao.getQuery("select inv from Invoicing as inv join fetch inv.requirement rq join fetch rq.ownedBy order by rq.numser");
|
||||
return q.list();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@LazyLoader("form")
|
||||
public void loadOwnedBy(Invoicing invoice) {
|
||||
Invoicing inv = getById(invoice.getId());
|
||||
Hibernate.initialize(inv.getRequirement().getOwnedBy());
|
||||
invoice.getRequirement().setOwnedBy(inv.getRequirement().getOwnedBy());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,5 +22,7 @@ public interface OrderService extends Service<Order> {
|
||||
|
||||
public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
|
||||
|
||||
public void addApprovedItems(Order order, boolean orderedChanged);
|
||||
|
||||
public void updateApprovedItems(Order order, boolean orderedChanged);
|
||||
}
|
||||
|
||||
@@ -180,16 +180,14 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
||||
return sumTotal;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
|
||||
public void updateApprovedItems(Order order, boolean orderedChanged)
|
||||
protected void setApprovedItems(Order order, boolean orderedChanged)
|
||||
{
|
||||
if (orderedChanged)
|
||||
{
|
||||
for (OrderItem item : order.getItems())
|
||||
{
|
||||
RequirementItem rItem = item.getReqItem();
|
||||
|
||||
|
||||
if (rItem != null)
|
||||
{
|
||||
rItem.setOrderNum(order.isOrdered() ? order.getNumser() : null);
|
||||
@@ -197,7 +195,41 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
|
||||
public void addApprovedItems(Order order, boolean orderedChanged)
|
||||
{
|
||||
this.add(order);
|
||||
this.setApprovedItems(order, orderedChanged);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
|
||||
public void updateApprovedItems(Order order, boolean orderedChanged)
|
||||
{
|
||||
this.setApprovedItems(order, orderedChanged);
|
||||
super.update(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
|
||||
public void delete(Order order) {
|
||||
for (OrderItem item : order.getItems())
|
||||
{
|
||||
RequirementItem rItem = item.getReqItem();
|
||||
|
||||
if (rItem != null)
|
||||
{
|
||||
rItem.setOrderNum(null);
|
||||
requirementItemDao.modify(rItem);
|
||||
}
|
||||
}
|
||||
|
||||
super.delete(order);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,6 @@ public interface RequirementService extends RequirementBaseService<Requirement>
|
||||
public RequirementItem calcItemValuesFromItemTotal(RequirementItem item);
|
||||
|
||||
public BigDecimal calcSumTotalFromItems(List<RequirementItem> items);
|
||||
|
||||
public BigDecimal getInvoicedAmount(Requirement req);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Query;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -240,4 +241,15 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
|
||||
invoicingService.add(inv);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public BigDecimal getInvoicedAmount(Requirement req) {
|
||||
Query query = dao.getQuery("select invoice from Invoicing invoice join invoice.requirement rq where rq.id = :reqId");
|
||||
query.setParameter("reqId", req.getId());
|
||||
|
||||
Invoicing inv = (Invoicing) query.uniqueResult();
|
||||
|
||||
return inv != null ? inv.getTotalInvoiced() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ApprovedList extends ListViewModel<JoinedItem>
|
||||
|
||||
public List<User> getUsers()
|
||||
{
|
||||
return this.userService.getAll();
|
||||
return this.userService.getUsersForCombo();
|
||||
}
|
||||
|
||||
@Command
|
||||
|
||||
@@ -3,9 +3,11 @@ 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;
|
||||
import info.bukova.isspst.filters.InvoicingFilter;
|
||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
@@ -18,6 +20,8 @@ public class InvoicingList extends ListViewModel<Invoicing> {
|
||||
private InvoicingService invoicingService;
|
||||
@WireVariable
|
||||
private WorkgroupService workgroupService;
|
||||
@WireVariable
|
||||
private UserService userService;
|
||||
|
||||
@Init(superclass = true)
|
||||
public void initInvoicing() {
|
||||
@@ -45,4 +49,8 @@ public class InvoicingList extends ListViewModel<Invoicing> {
|
||||
return workgroupService.getWorkgroups();
|
||||
}
|
||||
|
||||
public List<User> getUsers() {
|
||||
return userService.getUsersForCombo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -297,6 +297,17 @@ public class OrderForm extends FormViewModel<Order>
|
||||
this.calcAndUpdateFormTotalPrice(form);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doAdd()
|
||||
{
|
||||
// Zjisti, zda se změnil příznak objednávky (objednáno/neobjednáno)
|
||||
boolean orderedChanged = (this.recordBeforeEdit.isOrdered() != this.getDataBean().isOrdered());
|
||||
// Aktualizovat příznak schválených položek, aby se nemohli vložit do
|
||||
// jiných objednávek
|
||||
orderService.addApprovedItems(this.getDataBean(), orderedChanged);
|
||||
BindUtils.postGlobalCommand(null, null, "reload", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSave()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,4 +65,18 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectAll", null);
|
||||
}
|
||||
|
||||
public BigDecimal getInvoicedAmount() {
|
||||
if (getDataBean() != null) {
|
||||
return requirementService.getInvoicedAmount(getDataBean());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
|
||||
public void setDataBean(Requirement data) {
|
||||
super.setDataBean(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,4 +65,18 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectCentre", null);
|
||||
}
|
||||
|
||||
public BigDecimal getInvoicedAmount() {
|
||||
if (getDataBean() != null) {
|
||||
return requirementService.getInvoicedAmount(getDataBean());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
|
||||
public void setDataBean(Requirement data) {
|
||||
super.setDataBean(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import info.bukova.isspst.services.requirement.RequirementService;
|
||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,4 +65,18 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null);
|
||||
}
|
||||
|
||||
public BigDecimal getInvoicedAmount() {
|
||||
if (getDataBean() != null) {
|
||||
return requirementService.getInvoicedAmount(getDataBean());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" })
|
||||
public void setDataBean(Requirement data) {
|
||||
super.setDataBean(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user