19 package org.turro.erp.task.usage;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
23 import org.turro.elephant.context.Application;
24 import org.turro.elephant.util.DecimalFormats;
25 import org.turro.erp.entity.ReceiptItem;
26 import org.turro.erp.entity.RequiredUsage;
27 import org.turro.erp.entity.Resource;
28 import org.turro.erp.entity.Task;
29 import org.turro.erp.entity.WorkOrder;
30 import org.turro.erp.humanres.HumanResourceAptitudeCombobox;
31 import org.turro.erp.humanres.HumanResourceCombobox;
32 import org.turro.erp.resource.ResourceCombobox;
33 import org.turro.erp.task.ReceiptItemAdapter;
34 import org.turro.financials.contract.ProviderCombobox;
35 import org.turro.financials.entity.Contract;
36 import org.turro.financials.entity.LineType;
37 import org.turro.financials.linetype.BillLineTypeListbox;
38 import org.turro.financials.model.document.LineTypeDescription;
39 import org.turro.financials.product.IProduct;
40 import org.turro.financials.product.ProductExtendedCombobox;
41 import org.turro.hr.humanres.HumanResourceAptitude;
42 import org.turro.zkoss.grid.CollectionGrid;
43 import org.turro.zkoss.grid.EditableCell;
44 import org.turro.zkoss.grid.EditableColumn;
45 import org.turro.zkoss.input.Percentbox;
46 import org.turro.zkoss.label.LabelTypes;
47 import org.zkoss.zk.ui.HtmlBasedComponent;
48 import org.zkoss.zul.Row;
49 import org.zkoss.zul.Vlayout;
77 this.workOrder = workOrder;
83 throw new RuntimeException(
"Empty row on receipt!");
102 super.afterCompose();
135 bltlb.setMold(
"select");
141 if(value !=
null) pb.
setValue((Double) value);
145 return super.createEditor(editableCell);
154 return getResourceBox(ri,
false);
157 return super.createRenderer(editableCell);
165 }
else if(value instanceof
Resource) {
168 }
else if(value instanceof
Contract) {
171 }
else if(value instanceof
IProduct) {
174 }
else if(value instanceof
LineType) {
180 return super.formatCell(editableCell, value);
197 return super.getEditorValue(editableCell);
200 private void addColumns() {
206 }
catch (ClassNotFoundException ex) {
207 Logger.getLogger(UsageGrid.class.getName()).log(Level.SEVERE,
null, ex);
211 private HtmlBasedComponent getResourceBox(
final ReceiptItem ri,
boolean edit) {
212 RequiredUsage ru = ri.getOrderItem().getRequiredUsage();
213 Vlayout vbox =
new Vlayout();
214 if(edit && ri.isHumanResourceType() && ru.isCanChange()) {
215 HumanResourceCombobox hrc =
new HumanResourceCombobox();
216 hrc.setObjectValue(ri.getHumanResource());
218 vbox.appendChild(hrc);
219 }
else if(edit && ri.isProductType() && !ru.isProviderFixed()) {
220 ProviderCombobox pc =
new ProviderCombobox();
221 pc.setObjectValue(ri.getProvider());
223 vbox.appendChild(pc);
225 vbox.appendChild(LabelTypes.getCaptionLabel(ri.getOrderItem()
226 .getRequiredUsage().getName()));
228 vbox.appendChild(LabelTypes.getSoftLabel(ri.getOrderItem()
229 .getOwnerRequiredUsage().getTask().getName()));
230 vbox.appendChild(LabelTypes.getSoftLabel(ri.getOrderItem()
231 .getOwnerRequiredUsage().getTask().getOrderReference().getDescription()));
static String getString(String key)
void setContractPreferenceId(long contractPreferenceId)
long getContractPreferenceId()
void setLineTypeId(long lineTypeId)
boolean isValid(ReceiptItem v)
HtmlBasedComponent createEditor(EditableCell editableCell)
void setWorkOrder(WorkOrder workOrder)
Object getEditorValue(EditableCell editableCell)
void initiateRow(Row row, ReceiptItem value)
boolean deleteRow(Row row)
HtmlBasedComponent createRenderer(EditableCell editableCell)
String formatCell(EditableCell editableCell, Object value)
String getPartialDescription()
ContractPreference getContractPreference()
void setData(Contract contract, long lineTypeId, long contractPreferenceId)
void setContractorId(long contractorId)
void setCollection(Collection< V > collection)
EditableColumn addColumn(String label, Class javaClass, String property, String format, int scale, boolean onlyDate, boolean readOnly)
void setAllowInsertions(boolean allowInsertions)
Object getCellValue(EditableCell editableCell)
String getProductString()