BrightSide Workbench Full Report + Source Code
org.turro.erp.purchase.OrdersListbox Class Reference
Inheritance diagram for org.turro.erp.purchase.OrdersListbox:
Collaboration diagram for org.turro.erp.purchase.OrdersListbox:

Public Member Functions

 OrdersListbox ()
 
void setProvider (Contract provider)
 
List< OrderItemgetOrders ()
 
- Public Member Functions inherited from org.turro.zkoss.input.CollectionListbox< V >
 CollectionListbox ()
 
 CollectionListbox (Collection< V > collection)
 
void updateCollection ()
 
void updateCollection (Collection< V > collection)
 
boolean isAllowNull ()
 
void setAllowNull (boolean allowNull)
 
Collection< V > getCollection ()
 
void setCollection (Collection< V > collection)
 
boolean isNullAtBottom ()
 
void setNullAtBottom (boolean nullAtBottom)
 
String getNullLabel ()
 
void setNullLabel (String nullLabel)
 
- Public Member Functions inherited from org.turro.zkoss.input.GenericListbox< V >
 GenericListbox ()
 
void setDisabled (boolean value)
 
void afterCompose ()
 
void clearItems ()
 
void setObjectValue (V value)
 
void setObjectValues (Collection< V > collection)
 
getObjectValue ()
 
Collection< V > getObjectValues ()
 
Collection< V > getDeselectedObjectValues ()
 
boolean isSelectFirst ()
 
void setSelectFirst (boolean selectFirst)
 
Set getDeselectedItems ()
 
void sort ()
 
Object getRelatedEntity ()
 
void setRelatedEntity (Object relatedEntity)
 

Protected Member Functions

String convertToString (Order v)
 
- Protected Member Functions inherited from org.turro.zkoss.input.CollectionListbox< V >
void populateList ()
 
boolean equals (V value, V obj)
 
abstract String convertToString (V v)
 
void beforeAppend (Listitem li)
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.zkoss.input.CollectionListbox< V >
static final String ITEM_SEPARATOR = "|||"
 
- Protected Attributes inherited from org.turro.zkoss.input.GenericListbox< V >
boolean populated = false
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 40 of file OrdersListbox.java.

Constructor & Destructor Documentation

◆ OrdersListbox()

org.turro.erp.purchase.OrdersListbox.OrdersListbox ( )

Definition at line 44 of file OrdersListbox.java.

44  {
45  addHeaders();
46  }

Member Function Documentation

◆ convertToString()

String org.turro.erp.purchase.OrdersListbox.convertToString ( Order  v)
protected

Definition at line 98 of file OrdersListbox.java.

98  {
99  return (v.getDate() == null ? "" : DateFormats.format(v.getDate(), true)) +
100  CollectionListbox.ITEM_SEPARATOR +
101  v.getNumber() +
102  CollectionListbox.ITEM_SEPARATOR +
103  DecimalFormats.format(v.getLines()) +
104  CollectionListbox.ITEM_SEPARATOR +
105  DecimalFormats.format(v.getUnits()) +
106  CollectionListbox.ITEM_SEPARATOR +
107  DecimalFormats.format(v.getCost());
108  }
Here is the call graph for this function:

◆ getOrders()

List<OrderItem> org.turro.erp.purchase.OrdersListbox.getOrders ( )

Definition at line 71 of file OrdersListbox.java.

71  {
72  Order order = getObjectValue();
73  if(order != null) {
74  WhereClause wc = new WhereClause();
75  wc.addClause("select d from OrderItem d");
76  wc.addClause("where d.providerId = :provider");
77  wc.addClause("and d.sent = TRUE");
78  wc.addNamedValue("provider", provider.getId());
79  if(order.getDate() == null) {
80  wc.addClause("and d.documentDate is null");
81  } else {
82  wc.addClause("and d.documentDate = :date");
83  wc.addNamedValue("date", order.getDate());
84  }
85  if(order.getNumber() == null) {
86  wc.addClause("and d.documentNumber is null");
87  } else {
88  wc.addClause("and d.documentNumber = :number");
89  wc.addNamedValue("number", order.getNumber());
90  }
91  wc.addClause("and not exists (select dr from ReceiptItem dr where dr.orderItem = d)");
92  return new ErpPU().getResultList(wc);
93  }
94  return null;
95  }
Here is the call graph for this function:

◆ setProvider()

void org.turro.erp.purchase.OrdersListbox.setProvider ( Contract  provider)

Definition at line 48 of file OrdersListbox.java.

48  {
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) " +
52  "from OrderItem d " +
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) {
60  Order order = new Order();
61  order.setDate((Date) o[0]);
62  order.setNumber((String) o[1]);
63  order.setLines(new Converter(o[2]).getDouble());
64  order.setUnits(new Converter(o[3]).getDouble());
65  order.setCost(new Converter(o[4]).getDouble());
66  orders.add(order);
67  }
68  updateCollection(orders);
69  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: