18 package org.turro.financials.document;
20 import java.util.Collection;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import org.turro.elephant.context.ElephantContext;
24 import org.turro.financials.contract.ContractListbox;
25 import org.turro.financials.contract.logic.ContractWrapper;
26 import org.turro.financials.entity.*;
27 import org.turro.financials.linetype.LineTypePreferenceListbox;
28 import org.turro.financials.model.contract.ContractUsualSet;
29 import org.turro.financials.model.document.DocumentDefinitionWrapper;
30 import org.turro.financials.model.product.ProductWrapper;
31 import org.turro.financials.product.IProduct;
32 import org.turro.financials.product.ProductExtendedCombobox;
33 import org.turro.financials.product.ProductFactory;
34 import org.turro.i18n.I_;
35 import org.turro.math.Zero;
36 import org.turro.usual.UsualUsages;
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.zkoss.input.CollectionListbox;
41 import org.zkoss.zk.ui.HtmlBasedComponent;
42 import org.zkoss.zul.Row;
51 private Collection<Contract> stores;
54 private final boolean hasProducts;
55 private double lastTax, lastReq, lastRet;
67 this.document = document;
68 if(document ==
null || !document.
isValid())
return;
73 if(stores.isEmpty()) {
130 if(document !=
null && document.
isValid()) {
135 }
catch (ClassNotFoundException ex) {
141 super.afterCompose();
146 HtmlBasedComponent hbc = (HtmlBasedComponent) editableCell.
getEditor();
162 return super.getEditorValue(editableCell);
181 }
else if(value instanceof
LineType) {
184 }
else if(value instanceof
Contract) {
188 return super.formatCell(editableCell, value);
226 ltl.setMold(
"select");
233 slb.setMold(
"select");
242 }
else if(!hasProducts) {
261 }
else if(
"equivalenceSurcharge".equals(ec.
getProperty())) {
289 return super.createEditor(editableCell);
294 super.cellChanged(editableCell, value);
300 lastTax = (Double) value;
301 }
else if(
"equivalenceSurcharge".equals(ec.
getProperty())) {
302 lastReq = (Double) value;
304 lastRet = (Double) value;
308 private void addColumns() throws ClassNotFoundException {
309 int fractionDigits = document.
getCurrency().getDefaultFractionDigits();
325 "product",
null, 0,
false,
false).setHflex(
"10");
328 addColumn(I_.get(
"Concept"), String.class,
329 "concept",
null, 10,
false,
false).setHflex(
"10");
332 "quantity",
null, 3,
false,
false).setHflex(
"3");
335 "price",
null, fractionDigits + 2,
false,
false).setHflex(
"4");
338 "discountMoney",
null, fractionDigits,
false,
false).setHflex(
"2");
341 "discountPerCent",
"#.##", 2,
false,
false).setHflex(
"2");
344 "tax",
null, 2,
false,
false).setHflex(
"2");
347 "equivalenceSurcharge",
null, 2,
false,
false).setHflex(
"2");
350 "retention",
null, 2,
false,
false).setHflex(
"2");
353 "taxable",
null, fractionDigits,
false,
true).setHflex(
"4");
358 "store",
null, 0,
false,
false).setHflex(
"5");
362 "lineType",
null, 0,
false,
false).setHflex(
"5");
static String logMsg(String msg)
HtmlBasedComponent getReqCtrl()
HtmlBasedComponent getTaxCtrl()
HtmlBasedComponent getRetentionCtrl()
void setObjectValue(String value)
void setDocumentDefinition(DocumentDefinition documentDefinition)
Collection< Contract > getStores()
boolean isValid(DocumentLine v)
Object getEditorValue(EditableCell editableCell)
void initiateRow(Row row, DocumentLine value)
void setDocument(Document document)
String formatCell(EditableCell editableCell, Object value)
HtmlBasedComponent createEditor(EditableCell editableCell)
void cellChanged(EditableCell editableCell, Object value)
void updateDocument(Document document)
boolean deleteRow(Row row)
String getPartialDescription()
boolean isEquivalenceSurcharge()
Set< RelatedColumn > getDocumentColumns()
void setStore(Contract store)
void setLineOrder(int lineOrder)
void setContractPreference(ContractPreference contractPreference)
void setLineType(LineType lineType)
void setDocument(Document document)
void setProductByContractor(ProductByContractor productByContractor)
ProductByContractor getProductByContractor()
void setConcept(String concept)
Set< DocumentLine > getDocumentLines()
LineType getDefaultLineType()
DocumentDefinition getDocumentDefinition()
ContractPreference getContractPreference()
void setProductByContractor(ProductByContractor productByContractor)
String getProductString()
static void clearInactives(Collection< Contract > contracts)
Collection< Contract > getRelatedStores(Contract contract)
static boolean hasAvailableProducts()
void setContractorId(long contractorId)
static void setPriceTax(DocumentLine dl, IProduct prod)
static String get(String msg)
static boolean near(double value, int digits)
static String getMostUsedvalue(String path)
void setCollection(Collection< V > collection)
void setCellValue(EditableCell editableCell, Object value)
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
Object getCellValue(EditableCell editableCell)
void setReadOnly(boolean readOnly)
String getProductString()
ProductByContractor getProductByContractor()
void setProductByContractor(ProductByContractor pbc)