18 package org.turro.erp.reference;
20 import java.util.logging.Level;
21 import java.util.logging.Logger;
22 import org.turro.command.Command;
23 import org.turro.command.Context;
24 import org.turro.elephant.context.Application;
25 import org.turro.elephant.util.Images;
26 import org.turro.erp.entity.CustomerOrder;
27 import org.turro.erp.entity.OrderReference;
28 import org.turro.erp.entity.WorkOrder;
29 import org.turro.erp.clone.EntityCloneGrid;
30 import org.turro.erp.sales.PendingCustomerOrderListbox;
31 import org.turro.financials.contract.ServiceStoreListbox;
32 import org.turro.financials.entity.Contract;
33 import org.turro.financials.entity.Product;
34 import org.turro.financials.product.ProductCombobox;
35 import org.turro.jpa.entity.EntityCollectionUtil;
36 import org.turro.zkoss.dialog.SelectionDialog;
37 import org.turro.zkoss.grid.CollectionGrid;
38 import org.turro.zkoss.grid.EditableCell;
39 import org.turro.zkoss.grid.EditableColumn;
40 import org.turro.zul.frame.Framework;
41 import org.zkoss.zk.ui.HtmlBasedComponent;
42 import org.zkoss.zk.ui.event.Event;
43 import org.zkoss.zk.ui.event.EventListener;
44 import org.zkoss.zk.ui.event.Events;
45 import org.zkoss.zul.Button;
46 import org.zkoss.zul.Image;
47 import org.zkoss.zul.Row;
62 this.workOrder = workOrder;
67 this.workOrder = workOrder;
74 pcolb.setMultiple(
true);
75 pcolb.setCheckmark(
true);
83 "80%",
"80%",
new Command() {
85 public Object execute(Context context) {
135 }
else if(value instanceof
Product) {
139 return super.formatCell(editableCell, value);
150 sslb.setMold(
"select");
159 return super.createEditor(editableCell);
196 edit.addEventListener(Events.ON_CLICK,
new EventListener() {
198 public void onEvent(Event event)
throws Exception {
199 event.stopPropagation();
206 return super.createRenderer(editableCell);
210 if(!orderReference.
isEmpty()) {
217 private void addColumns() {
219 int fractionDigits = workOrder.
getContract() !=
null ?
223 addColumn(
"#",
"int",
"orderRef",
null, 0,
false,
false).setWidth(
"40px");
224 addColumn(Application.getString(
"lQuantity"),
"double",
"quantity",
null, 3,
false,
false).setWidth(
"90px");
225 addColumn(Application.getString(
"lProduct"), Product.class,
"product",
null, 0,
false, workOrder.
isProductOrder()).setHflex(
"2");
226 addColumn(Application.getString(
"lDescription"), String.class,
"description",
null, 20,
false,
false).setHflex(
"3");
227 addColumn(Application.getString(
"lPrice"),
"double",
"price",
null, fractionDigits,
false,
false).setWidth(
"120px");
228 addColumn(Application.getString(
"lService"), Contract.class,
"service",
null, 0,
false,
false).setHflex(
"1");
229 addColumn(
"", String.class,
null,
null, 2,
false,
true).setWidth(
"50px");
230 }
catch (ClassNotFoundException ex) {
235 private void addDetail(Row row) {
236 row.getChildren().clear();
237 OrderReferenceDetail detail =
new OrderReferenceDetail(row,
this);
238 row.appendChild(detail);
static String getString(String key)
static String getImage(String image)
void setOrderReference(OrderReference orderReference)
void initFrom(CustomerOrder cu)
boolean hasBugdetStopper()
void setWorkOrder(WorkOrder workOrder)
void setProductId(long productId)
void setOrderRef(int orderRef)
Set< OrderReference > getOrderReferences()
void setWorkOrder(WorkOrder workOrder)
void initiateRow(Row row, OrderReference value)
boolean canDeleteRow(Row row)
boolean isValid(OrderReference v)
void importFromCustomerOrder()
boolean deleteRow(Row row)
OrderReferenceGrid(WorkOrder workOrder)
boolean canEditRow(Row row)
String formatCell(EditableCell editableCell, Object value)
HtmlBasedComponent createRenderer(EditableCell editableCell)
HtmlBasedComponent createEditor(EditableCell editableCell)
void setContract(Contract contract)
String getPartialDescription()
static void showComponent(Page page, String title, Component component, String width, String height, final Command command)
void setCollection(Collection< V > collection)
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
boolean isAllowInsertions()
Object getCellValue(EditableCell editableCell)
static Framework getCurrent()