Políčka s číslem faktury a fakturovanou částkou odstraněna z objednávek.
closes #163
This commit is contained in:
@@ -113,17 +113,10 @@ public class Order extends BaseData implements Cloneable
|
||||
@Column(name = "INVOICED")
|
||||
private boolean invoiced;
|
||||
|
||||
@Column(name = "INVOICE_NUMBER")
|
||||
private String invoiceNumber;
|
||||
|
||||
@Column(name = "INVOICE_TOTAL", precision = 15, scale = 4)
|
||||
private BigDecimal invoiceTotal;
|
||||
|
||||
public Order()
|
||||
{
|
||||
this.items = new ArrayList<OrderItem>();
|
||||
this.total = BigDecimal.ZERO;
|
||||
this.invoiceTotal = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public String getNumser()
|
||||
@@ -242,16 +235,6 @@ public class Order extends BaseData implements Cloneable
|
||||
this.invoiced = invoiced;
|
||||
}
|
||||
|
||||
public String getInvoiceNumber()
|
||||
{
|
||||
return invoiceNumber;
|
||||
}
|
||||
|
||||
public void setInvoiceNumber(String invoiceNumber)
|
||||
{
|
||||
this.invoiceNumber = invoiceNumber;
|
||||
}
|
||||
|
||||
public boolean isOrdered()
|
||||
{
|
||||
return ordered;
|
||||
@@ -282,16 +265,6 @@ public class Order extends BaseData implements Cloneable
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public BigDecimal getInvoiceTotal()
|
||||
{
|
||||
return invoiceTotal;
|
||||
}
|
||||
|
||||
public void setInvoiceTotal(BigDecimal invoiceTotal)
|
||||
{
|
||||
this.invoiceTotal = invoiceTotal;
|
||||
}
|
||||
|
||||
public boolean isIcludedRequirementItemFromAnotherOrder()
|
||||
{
|
||||
for (OrderItem oItem : this.getItems())
|
||||
|
||||
@@ -14,53 +14,53 @@ import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "ORDER_ITEM")
|
||||
public class OrderItem {
|
||||
|
||||
public class OrderItem
|
||||
{
|
||||
|
||||
@Id
|
||||
@Column(name="ID")
|
||||
@GeneratedValue
|
||||
@Column(name = "ID")
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
|
||||
|
||||
@Column(name = "CODE")
|
||||
private String code;
|
||||
|
||||
|
||||
@Column(name = "NAME")
|
||||
private String name;
|
||||
|
||||
@Column(name = "TEXTITEM")
|
||||
private String textItem;
|
||||
|
||||
@Column(name = "QUANTITY", precision=15, scale=4)
|
||||
@Column(name = "QUANTITY", precision = 15, scale = 4)
|
||||
private BigDecimal quantity;
|
||||
|
||||
|
||||
@Embedded
|
||||
private MUnitEmb munit;
|
||||
|
||||
@Column(name = "UNITPRICE", precision=15, scale=4)
|
||||
@Column(name = "UNITPRICE", precision = 15, scale = 4)
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@Column(name = "TOTAL", precision=15, scale=4)
|
||||
@Column(name = "TOTAL", precision = 15, scale = 4)
|
||||
private BigDecimal total;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
@Column(name = "TOTALINVOICE", precision = 15, scale = 4)
|
||||
private BigDecimal totalInvoice;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "REQUIREMENT_ITEM_ID")
|
||||
private RequirementItem reqItem;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "ORDER_ID")
|
||||
private Order order;
|
||||
|
||||
public OrderItem() {
|
||||
|
||||
public OrderItem()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public OrderItem(RequirementItem reqItem) {
|
||||
public OrderItem(RequirementItem reqItem)
|
||||
{
|
||||
super();
|
||||
this.reqItem = reqItem;
|
||||
this.code = reqItem.getCode();
|
||||
@@ -71,104 +71,115 @@ public class OrderItem {
|
||||
this.munit = reqItem.getMunit();
|
||||
this.total = reqItem.getTotal();
|
||||
this.description = reqItem.getDescription();
|
||||
this.totalInvoice = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
public void setId(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
public void setCode(String code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTextItem() {
|
||||
public String getTextItem()
|
||||
{
|
||||
return textItem;
|
||||
}
|
||||
|
||||
public void setTextItem(String textItem) {
|
||||
public void setTextItem(String textItem)
|
||||
{
|
||||
this.textItem = textItem;
|
||||
}
|
||||
|
||||
public BigDecimal getQuantity() {
|
||||
public BigDecimal getQuantity()
|
||||
{
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(BigDecimal quantity) {
|
||||
public void setQuantity(BigDecimal quantity)
|
||||
{
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public MUnitEmb getMunit() {
|
||||
public MUnitEmb getMunit()
|
||||
{
|
||||
return munit;
|
||||
}
|
||||
|
||||
public void setMunit(MUnitEmb munit) {
|
||||
public void setMunit(MUnitEmb munit)
|
||||
{
|
||||
this.munit = munit;
|
||||
}
|
||||
|
||||
public BigDecimal getUnitPrice() {
|
||||
public BigDecimal getUnitPrice()
|
||||
{
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
public void setUnitPrice(BigDecimal unitPrice) {
|
||||
public void setUnitPrice(BigDecimal unitPrice)
|
||||
{
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getTotal() {
|
||||
public BigDecimal getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(BigDecimal total) {
|
||||
public void setTotal(BigDecimal total)
|
||||
{
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalInvoice()
|
||||
public RequirementItem getReqItem()
|
||||
{
|
||||
return totalInvoice;
|
||||
}
|
||||
|
||||
public void setTotalInvoice(BigDecimal totalInvoice)
|
||||
{
|
||||
this.totalInvoice = totalInvoice;
|
||||
}
|
||||
|
||||
public RequirementItem getReqItem() {
|
||||
return reqItem;
|
||||
}
|
||||
|
||||
public void setReqItem(RequirementItem reqItem) {
|
||||
public void setReqItem(RequirementItem reqItem)
|
||||
{
|
||||
this.reqItem = reqItem;
|
||||
}
|
||||
|
||||
public Order getOrder() {
|
||||
public Order getOrder()
|
||||
{
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Order order) {
|
||||
public void setOrder(Order order)
|
||||
{
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@ public class OrderFilter implements Filter<Order>
|
||||
// condition.getTotal());
|
||||
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
|
||||
boolean foundDeliveredDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveredDate(), condition.getDeliveredDate());
|
||||
boolean foundInvoiceNumber = StringUtils.isEqualForFilter(item.getInvoiceNumber(), condition.getInvoiceNumber());
|
||||
boolean foundInvoiceTotal = true;// BigDecimalUtils.isEqualByDecimalForFilter(item.getInvoiceTotal(),
|
||||
// condition.getInvoiceTotal());
|
||||
boolean foundSupplierAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getSuplier(), condition.getSuplier());
|
||||
boolean foundDeliveryAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getDeliveryAddress(), condition.getDeliveryAddress());
|
||||
boolean foundInvoiceAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getAddress(), condition.getAddress());
|
||||
@@ -63,8 +60,6 @@ public class OrderFilter implements Filter<Order>
|
||||
&& foundTotal
|
||||
&& foundDeliveryDate
|
||||
&& foundDeliveredDate
|
||||
&& foundInvoiceNumber
|
||||
&& foundInvoiceTotal
|
||||
&& foundSupplierAddr
|
||||
&& foundDeliveryAddr
|
||||
&& foundInvoiceAddr
|
||||
|
||||
@@ -22,7 +22,5 @@ public interface OrderService extends Service<Order> {
|
||||
|
||||
public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
|
||||
|
||||
public BigDecimal calcSumTotalInvoiceFromItems(List<OrderItem> items);
|
||||
|
||||
public void updateApprovedItems(Order order, boolean orderedChanged);
|
||||
}
|
||||
|
||||
@@ -52,10 +52,13 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public BigDecimal totalOrderedForWorkgroup(Workgroup workgroup) {
|
||||
Query q = dao.getQuery("select sum(oi.totalInvoice) from OrderItem oi join oi.reqItem ri join ri.requirement rq join rq.workgroup w where (ri.orderNum is not null or ri.orderNum = '') and w = :workgroup ");
|
||||
public BigDecimal totalOrderedForWorkgroup(Workgroup workgroup)
|
||||
{
|
||||
Query q = dao.getQuery("select sum(oi.total) "
|
||||
+ "from OrderItem oi join oi.reqItem ri join ri.requirement rq join rq.workgroup w "
|
||||
+ "where (ri.orderNum is not null or ri.orderNum = '') and w = :workgroup ");
|
||||
q.setParameter("workgroup", workgroup);
|
||||
return (BigDecimal)q.uniqueResult();
|
||||
return (BigDecimal) q.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,30 +180,6 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
||||
return sumTotal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal calcSumTotalInvoiceFromItems(List<OrderItem> items)
|
||||
{
|
||||
BigDecimal sumTotal = BigDecimal.ZERO;
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
for (OrderItem item : items)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
BigDecimal total = item.getTotalInvoice();
|
||||
|
||||
if (total != null)
|
||||
{
|
||||
sumTotal = sumTotal.add(total);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sumTotal;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateApprovedItems(Order order, boolean orderedChanged)
|
||||
{
|
||||
|
||||
@@ -335,26 +335,6 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
||||
}
|
||||
}
|
||||
|
||||
// private void loadFromDb() {
|
||||
// Thread fillThread = new Thread(new Runnable() {
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
// tmpList = service.getAll();
|
||||
//
|
||||
// try {
|
||||
// Thread.sleep(200);
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// fullFill = true;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// fillThread.start();
|
||||
// }
|
||||
|
||||
@Command
|
||||
public void onPrint() {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
|
||||
@@ -278,36 +278,6 @@ public class OrderForm extends FormViewModel<Order>
|
||||
this.calcAndUpdateFormTotalPrice(form);
|
||||
}
|
||||
|
||||
protected void calcAndUpdateFormTotalInvoicePrice(SimpleForm form)
|
||||
{
|
||||
if (form != null)
|
||||
{
|
||||
BigDecimal sumTotal = orderService.calcSumTotalInvoiceFromItems(this.getDataBean().getItems());
|
||||
form.setField("invoiceTotal", sumTotal);
|
||||
BindUtils.postNotifyChange(null, null, form, "*");
|
||||
}
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({ "selectedItem", "syncOrderItems" })
|
||||
public void recalculateTotalInvoice(@BindingParam("form") SimpleForm form, @BindingParam("changed") String source)
|
||||
{
|
||||
if (this.selectedItem == null)
|
||||
{
|
||||
log.warn("Zavolat z formuláře onFocus pro nastavení vybrané položky!");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((source != null) && (source.equals("totalInvoice")))
|
||||
{
|
||||
// Calculate total price at form
|
||||
this.calcAndUpdateFormTotalInvoicePrice(form);
|
||||
return;
|
||||
}
|
||||
|
||||
log.warn("Dopracovat přepočet fakturované částky objednávky i pro další případy!");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSave()
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@ package info.bukova.isspst.ui.renderers;
|
||||
|
||||
import info.bukova.isspst.data.Order;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.zkoss.zul.Listbox;
|
||||
import org.zkoss.zul.Listitem;
|
||||
|
||||
@@ -17,19 +15,12 @@ public class OrderCreatedItemRenderer extends GenericListitemRenderer<Order>
|
||||
|
||||
boolean objednano = order.isOrdered();
|
||||
|
||||
BigDecimal invoiceTotal = order.getInvoiceTotal();
|
||||
boolean zakoupeno = ((invoiceTotal != null) && (invoiceTotal.compareTo(BigDecimal.ZERO) != 0));
|
||||
|
||||
boolean doruceno = (zakoupeno && (order.getDeliveredDate() != null));
|
||||
boolean doruceno = (order.getDeliveredDate() != null);
|
||||
|
||||
if (doruceno)
|
||||
{
|
||||
li.setSclass("order-select-delivered");
|
||||
}
|
||||
else if (zakoupeno)
|
||||
{
|
||||
li.setSclass("order-select-invoiced");
|
||||
}
|
||||
else if (objednano)
|
||||
{
|
||||
li.setSclass("order-select-ordered");
|
||||
|
||||
Reference in New Issue
Block a user