19 package org.turro.erp.purchase;
21 import java.util.ArrayList;
22 import java.util.Date;
23 import java.util.List;
24 import org.amic.util.db.Converter;
25 import org.turro.elephant.context.Application;
26 import org.turro.elephant.db.WhereClause;
27 import org.turro.elephant.util.DateFormats;
28 import org.turro.elephant.util.DecimalFormats;
29 import org.turro.erp.db.ErpPU;
30 import org.turro.erp.entity.OrderItem;
31 import org.turro.financials.entity.Contract;
32 import org.turro.zkoss.input.CollectionListbox;
33 import org.zkoss.zul.Listhead;
34 import org.zkoss.zul.Listheader;
49 this.provider = provider;
50 List l =
new ErpPU().getResultList(
51 "select d.documentDate, d.documentNumber, count(d.id), sum(d.units), sum(d.units*d.cost) " +
53 "where providerId = ? " +
54 "and d.sent = TRUE " +
55 "and not exists (select dr from ReceiptItem dr where dr.orderItem = d) " +
56 "group by d.documentDate, d.documentNumber",
57 new Object[] { provider.
getId() });
58 List<Order> orders =
new ArrayList<Order>();
59 for(Object[] o : (List<Object[]>) l) {
63 order.
setLines(
new Converter(o[2]).getDouble());
64 order.
setUnits(
new Converter(o[3]).getDouble());
65 order.
setCost(
new Converter(o[4]).getDouble());
75 wc.
addClause(
"select d from OrderItem d");
76 wc.
addClause(
"where d.providerId = :provider");
80 wc.
addClause(
"and d.documentDate is null");
82 wc.
addClause(
"and d.documentDate = :date");
86 wc.
addClause(
"and d.documentNumber is null");
88 wc.
addClause(
"and d.documentNumber = :number");
91 wc.
addClause(
"and not exists (select dr from ReceiptItem dr where dr.orderItem = d)");
92 return new ErpPU().getResultList(wc);
110 private void addHeaders() {
111 if(getListhead() !=
null)
return;
112 Listhead lh =
new Listhead();
static String getString(String key)
void addClause(String clause)
void addNamedValue(String name, Object value)
void setUnits(double units)
void setNumber(String number)
void setLines(double lines)
void setCost(double cost)
List< OrderItem > getOrders()
String convertToString(Order v)
void setProvider(Contract provider)