Políčka s číslem faktury a fakturovanou částkou odstraněna z objednávek.

closes #163
Verze_1.0
František Přibyl 10 years ago
parent 3558d1bd50
commit f1ca2d11c8

@ -113,17 +113,10 @@ public class Order extends BaseData implements Cloneable
@Column(name = "INVOICED") @Column(name = "INVOICED")
private boolean invoiced; private boolean invoiced;
@Column(name = "INVOICE_NUMBER")
private String invoiceNumber;
@Column(name = "INVOICE_TOTAL", precision = 15, scale = 4)
private BigDecimal invoiceTotal;
public Order() public Order()
{ {
this.items = new ArrayList<OrderItem>(); this.items = new ArrayList<OrderItem>();
this.total = BigDecimal.ZERO; this.total = BigDecimal.ZERO;
this.invoiceTotal = BigDecimal.ZERO;
} }
public String getNumser() public String getNumser()
@ -242,16 +235,6 @@ public class Order extends BaseData implements Cloneable
this.invoiced = invoiced; this.invoiced = invoiced;
} }
public String getInvoiceNumber()
{
return invoiceNumber;
}
public void setInvoiceNumber(String invoiceNumber)
{
this.invoiceNumber = invoiceNumber;
}
public boolean isOrdered() public boolean isOrdered()
{ {
return ordered; return ordered;
@ -282,16 +265,6 @@ public class Order extends BaseData implements Cloneable
this.total = total; this.total = total;
} }
public BigDecimal getInvoiceTotal()
{
return invoiceTotal;
}
public void setInvoiceTotal(BigDecimal invoiceTotal)
{
this.invoiceTotal = invoiceTotal;
}
public boolean isIcludedRequirementItemFromAnotherOrder() public boolean isIcludedRequirementItemFromAnotherOrder()
{ {
for (OrderItem oItem : this.getItems()) for (OrderItem oItem : this.getItems())

@ -14,53 +14,53 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "ORDER_ITEM") @Table(name = "ORDER_ITEM")
public class OrderItem { public class OrderItem
{
@Id @Id
@Column(name="ID") @Column(name = "ID")
@GeneratedValue @GeneratedValue
private int id; private int id;
@Column(name = "CODE") @Column(name = "CODE")
private String code; private String code;
@Column(name = "NAME") @Column(name = "NAME")
private String name; private String name;
@Column(name = "TEXTITEM") @Column(name = "TEXTITEM")
private String textItem; private String textItem;
@Column(name = "QUANTITY", precision=15, scale=4) @Column(name = "QUANTITY", precision = 15, scale = 4)
private BigDecimal quantity; private BigDecimal quantity;
@Embedded @Embedded
private MUnitEmb munit; private MUnitEmb munit;
@Column(name = "UNITPRICE", precision=15, scale=4) @Column(name = "UNITPRICE", precision = 15, scale = 4)
private BigDecimal unitPrice; private BigDecimal unitPrice;
@Column(name = "TOTAL", precision=15, scale=4) @Column(name = "TOTAL", precision = 15, scale = 4)
private BigDecimal total; private BigDecimal total;
@Column(name = "DESCRIPTION") @Column(name = "DESCRIPTION")
private String description; private String description;
@Column(name = "TOTALINVOICE", precision = 15, scale = 4)
private BigDecimal totalInvoice;
@ManyToOne(fetch = FetchType.EAGER) @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "REQUIREMENT_ITEM_ID") @JoinColumn(name = "REQUIREMENT_ITEM_ID")
private RequirementItem reqItem; private RequirementItem reqItem;
@ManyToOne @ManyToOne
@JoinColumn(name = "ORDER_ID") @JoinColumn(name = "ORDER_ID")
private Order order; private Order order;
public OrderItem() { public OrderItem()
{
super(); super();
} }
public OrderItem(RequirementItem reqItem) { public OrderItem(RequirementItem reqItem)
{
super(); super();
this.reqItem = reqItem; this.reqItem = reqItem;
this.code = reqItem.getCode(); this.code = reqItem.getCode();
@ -71,104 +71,115 @@ public class OrderItem {
this.munit = reqItem.getMunit(); this.munit = reqItem.getMunit();
this.total = reqItem.getTotal(); this.total = reqItem.getTotal();
this.description = reqItem.getDescription(); this.description = reqItem.getDescription();
this.totalInvoice = BigDecimal.ZERO;
} }
public int getId() { public int getId()
{
return id; return id;
} }
public void setId(int id) { public void setId(int id)
{
this.id = id; this.id = id;
} }
public String getCode() { public String getCode()
{
return code; return code;
} }
public void setCode(String code) { public void setCode(String code)
{
this.code = code; this.code = code;
} }
public String getName() { public String getName()
{
return name; return name;
} }
public void setName(String name) { public void setName(String name)
{
this.name = name; this.name = name;
} }
public String getTextItem() { public String getTextItem()
{
return textItem; return textItem;
} }
public void setTextItem(String textItem) { public void setTextItem(String textItem)
{
this.textItem = textItem; this.textItem = textItem;
} }
public BigDecimal getQuantity() { public BigDecimal getQuantity()
{
return quantity; return quantity;
} }
public void setQuantity(BigDecimal quantity) { public void setQuantity(BigDecimal quantity)
{
this.quantity = quantity; this.quantity = quantity;
} }
public MUnitEmb getMunit() { public MUnitEmb getMunit()
{
return munit; return munit;
} }
public void setMunit(MUnitEmb munit) { public void setMunit(MUnitEmb munit)
{
this.munit = munit; this.munit = munit;
} }
public BigDecimal getUnitPrice() { public BigDecimal getUnitPrice()
{
return unitPrice; return unitPrice;
} }
public void setUnitPrice(BigDecimal unitPrice) { public void setUnitPrice(BigDecimal unitPrice)
{
this.unitPrice = unitPrice; this.unitPrice = unitPrice;
} }
public BigDecimal getTotal() { public BigDecimal getTotal()
{
return total; return total;
} }
public void setTotal(BigDecimal total) { public void setTotal(BigDecimal total)
{
this.total = total; this.total = total;
} }
public String getDescription() { public String getDescription()
{
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description)
this.description = description;
}
public BigDecimal getTotalInvoice()
{ {
return totalInvoice; this.description = description;
} }
public void setTotalInvoice(BigDecimal totalInvoice) public RequirementItem getReqItem()
{ {
this.totalInvoice = totalInvoice;
}
public RequirementItem getReqItem() {
return reqItem; return reqItem;
} }
public void setReqItem(RequirementItem reqItem) { public void setReqItem(RequirementItem reqItem)
{
this.reqItem = reqItem; this.reqItem = reqItem;
} }
public Order getOrder() { public Order getOrder()
{
return order; return order;
} }
public void setOrder(Order order) { public void setOrder(Order order)
{
this.order = order; this.order = order;
} }

@ -49,9 +49,6 @@ public class OrderFilter implements Filter<Order>
// condition.getTotal()); // condition.getTotal());
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate()); boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
boolean foundDeliveredDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveredDate(), condition.getDeliveredDate()); 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 foundSupplierAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getSuplier(), condition.getSuplier());
boolean foundDeliveryAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getDeliveryAddress(), condition.getDeliveryAddress()); boolean foundDeliveryAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getDeliveryAddress(), condition.getDeliveryAddress());
boolean foundInvoiceAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getAddress(), condition.getAddress()); boolean foundInvoiceAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getAddress(), condition.getAddress());
@ -63,8 +60,6 @@ public class OrderFilter implements Filter<Order>
&& foundTotal && foundTotal
&& foundDeliveryDate && foundDeliveryDate
&& foundDeliveredDate && foundDeliveredDate
&& foundInvoiceNumber
&& foundInvoiceTotal
&& foundSupplierAddr && foundSupplierAddr
&& foundDeliveryAddr && foundDeliveryAddr
&& foundInvoiceAddr && foundInvoiceAddr

@ -22,7 +22,5 @@ public interface OrderService extends Service<Order> {
public BigDecimal calcSumTotalFromItems(List<OrderItem> items); public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
public BigDecimal calcSumTotalInvoiceFromItems(List<OrderItem> items);
public void updateApprovedItems(Order order, boolean orderedChanged); public void updateApprovedItems(Order order, boolean orderedChanged);
} }

@ -52,10 +52,13 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
@Override @Override
@Transactional @Transactional
public BigDecimal totalOrderedForWorkgroup(Workgroup workgroup) { 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 "); {
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); q.setParameter("workgroup", workgroup);
return (BigDecimal)q.uniqueResult(); return (BigDecimal) q.uniqueResult();
} }
@Override @Override
@ -177,30 +180,6 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
return sumTotal; 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 @Transactional
public void updateApprovedItems(Order order, boolean orderedChanged) 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 @Command
public void onPrint() { public void onPrint() {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();

@ -278,36 +278,6 @@ public class OrderForm extends FormViewModel<Order>
this.calcAndUpdateFormTotalPrice(form); 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 @Override
protected void doSave() protected void doSave()
{ {

@ -2,8 +2,6 @@ package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.Order; import info.bukova.isspst.data.Order;
import java.math.BigDecimal;
import org.zkoss.zul.Listbox; import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
@ -17,19 +15,12 @@ public class OrderCreatedItemRenderer extends GenericListitemRenderer<Order>
boolean objednano = order.isOrdered(); boolean objednano = order.isOrdered();
BigDecimal invoiceTotal = order.getInvoiceTotal(); boolean doruceno = (order.getDeliveredDate() != null);
boolean zakoupeno = ((invoiceTotal != null) && (invoiceTotal.compareTo(BigDecimal.ZERO) != 0));
boolean doruceno = (zakoupeno && (order.getDeliveredDate() != null));
if (doruceno) if (doruceno)
{ {
li.setSclass("order-select-delivered"); li.setSclass("order-select-delivered");
} }
else if (zakoupeno)
{
li.setSclass("order-select-invoiced");
}
else if (objednano) else if (objednano)
{ {
li.setSclass("order-select-ordered"); li.setSclass("order-select-ordered");

@ -52,15 +52,6 @@
hflex="10" hflex="10"
sort="auto(deliveredDate))" sort="auto(deliveredDate))"
label="${labels.OrderFormDeliveredDate}" /> label="${labels.OrderFormDeliveredDate}" />
<listheader
hflex="10"
sort="auto(invoiceNumber)"
label="${labels.OrderFormInvoiceNumber}" />
<listheader
hflex="7"
align="right"
sort="auto(invoiceTotal)"
label="${labels.OrderFormInvoiceTotal}" />
<listheader <listheader
hflex="15" hflex="15"
sort="auto(suplier.company)" sort="auto(suplier.company)"
@ -160,21 +151,6 @@
</div> </div>
</div> </div>
</auxheader> </auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.invoiceNumber)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader></auxheader>
<auxheader> <auxheader>
<div zclass="find-grid-cell"> <div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox"> <div sclass="find-grid-divtextbox">
@ -275,8 +251,6 @@
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" /> <listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" /> <listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.deliveredDate) @converter('formatedDate', format=labels.DateFormat)" /> <listcell label="@load(each.deliveredDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.invoiceNumber)" />
<listcell label="@load(each.invoiceTotal) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.suplier)" /> <listcell label="@load(each.suplier)" />
<listcell label="@load(each.deliveryAddress)" /> <listcell label="@load(each.deliveryAddress)" />
<listcell label="@load(each.address)" /> <listcell label="@load(each.address)" />
@ -327,11 +301,6 @@
hflex="15" hflex="15"
sort="czech(description)" sort="czech(description)"
label="${labels.RequirementItemDescription}" /> label="${labels.RequirementItemDescription}" />
<listheader
hflex="7"
align="right"
sort="auto(totalInvoice)"
label="${labels.OrderFormInvoiceTotal}" />
<listheader <listheader
hflex="5" hflex="5"
sort="auto(reqItem.orderNum)" sort="auto(reqItem.orderNum)"
@ -347,7 +316,6 @@
<listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" /> <listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" /> <listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.description)" /> <listcell label="@load(each.description)" />
<listcell label="@load(each.totalInvoice) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.reqItem.orderNum)" /> <listcell label="@load(each.reqItem.orderNum)" />
</listitem> </listitem>
</template> </template>

@ -104,27 +104,6 @@
format="${labels.DateFormat}" /> format="${labels.DateFormat}" />
</cell> </cell>
</row> </row>
<row>
<cell sclass="row-title">${labels.OrderFormInvoiceNumber} :</cell>
<cell>
<textbox
id="idInvoiceNumber"
width="150px"
value="@bind(fx.invoiceNumber)"
placeholder="${labels.NotYetFilled}..."
readonly="@load(empty fx.created)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.OrderFormInvoiceTotal} :</cell>
<cell>
<textbox
id="idOrderInvoiceTotal"
readonly="true"
width="150px"
value="@bind(fx.invoiceTotal) @converter(vm.standardBigDecimalConverter)" />
</cell>
</row>
<row> <row>
<cell sclass="row-title">${labels.OrderFormDescription} :</cell> <cell sclass="row-title">${labels.OrderFormDescription} :</cell>
<cell> <cell>
@ -543,11 +522,6 @@
hflex="15" hflex="15"
sort="czech(description)" sort="czech(description)"
label="${labels.RequirementItemDescription}" /> label="${labels.RequirementItemDescription}" />
<listheader
hflex="7"
align="right"
sort="auto(totalInvoice)"
label="${labels.OrderFormInvoiceTotal}" />
<listheader <listheader
hflex="5" hflex="5"
sort="auto(reqItem.orderNum)" sort="auto(reqItem.orderNum)"
@ -587,15 +561,6 @@
value="@bind(each.total) @converter(vm.standardBigDecimalConverter)" /> value="@bind(each.total) @converter(vm.standardBigDecimalConverter)" />
</listcell> </listcell>
<listcell label="@load(each.description)" /> <listcell label="@load(each.description)" />
<listcell>
<textbox
inplace="true"
sclass="grid-textbox-max-right"
readonly="false"
onFocus="@command('onFocusItem', item=each, ctrl=self)"
onChange="@command('recalculateTotalInvoice', form=fx, changed='totalInvoice')"
value="@bind(each.totalInvoice) @converter(vm.standardBigDecimalConverter)" />
</listcell>
<listcell label="@load(each.reqItem.orderNum)" /> <listcell label="@load(each.reqItem.orderNum)" />
</listitem> </listitem>
</template> </template>

Loading…
Cancel
Save