18 package org.turro.erp.humanres;
20 import java.util.Collection;
21 import org.amic.util.date.CheckDate;
22 import org.turro.elephant.context.Application;
23 import org.turro.elephant.util.DecimalFormats;
24 import org.turro.erp.db.ErpPU;
25 import org.turro.erp.menu.ErpMenu;
26 import org.turro.erp.entity.HumanResource;
27 import org.turro.erp.entity.AptitudeDegree;
28 import org.turro.erp.entity.OwnedAptitude;
29 import org.turro.zkoss.grid.PagingGrid;
30 import org.turro.zkoss.label.LabelTypes;
31 import org.turro.elephant.zkoss.ElLabel;
32 import org.zkoss.zk.ui.event.Event;
33 import org.zkoss.zk.ui.event.EventListener;
34 import org.zkoss.zk.ui.event.Events;
35 import org.zkoss.zk.ui.ext.AfterCompose;
36 import org.zkoss.zul.A;
37 import org.zkoss.zul.Column;
38 import org.zkoss.zul.Columns;
39 import org.zkoss.zul.Hlayout;
40 import org.zkoss.zul.Image;
41 import org.zkoss.zul.Label;
42 import org.zkoss.zul.Row;
43 import org.zkoss.zul.Rows;
44 import org.zkoss.zul.Vlayout;
62 private void addRows() {
65 Collection<HumanResource> list =
new ErpPU().getResultList(
66 "select hr from HumanResource hr " +
69 Rows rows =
new Rows();
74 rows.appendChild(row);
76 row.setSclass(
"draft");
78 row.appendChild(
new Label(hr.getId() +
""));
79 Vlayout vbox =
new Vlayout();
80 row.appendChild(vbox);
81 A b =
new A(hr.getName());
82 if(app.
isInRole(
"erp-config:edit")) {
83 b.addEventListener(Events.ON_CLICK,
new EventListener() {
85 public void onEvent(Event event)
throws Exception {
86 ErpMenu.showHumanResource(hr.getId());
92 if(!hr.getOwnedAptitudes().isEmpty()) {
93 Hlayout hbox =
new Hlayout();
94 vbox.appendChild(hbox);
95 hbox.appendChild(
new Image(
"/_zul/images/aptitude.png"));
96 for(OwnedAptitude a : hr.getOwnedAptitudes()) {
97 AptitudeDegree o = a.getAptitudeDegree();
98 Label l = LabelTypes.getSoftLabel(
99 o.getFullName() +
" (" +
100 DecimalFormats.format(o.getCost()) +
" / " +
101 DecimalFormats.format(o.getPrice()) +
")"
103 if(
new CheckDate().isDateActive(a.getInitialDate(), a.getFinalDate())) {
106 l.setStyle(
"font-style:oblique");
112 row.appendChild(
new Label(DecimalFormats.format(hr.getCostHour())));
113 row.appendChild(
new Label(DecimalFormats.format(hr.getPriceHour())));
119 private void addColumns() {
120 Columns cols =
new Columns();
123 Column col =
new Column(
"#",
null,
"50px");
124 cols.appendChild(col);
126 col =
new Column(Application.getString(
"lName"));
127 cols.appendChild(col);
129 col =
new Column(Application.getString(
"lCost"),
null,
"120px");
130 col.setAlign(
"right");
131 cols.appendChild(col);
133 col =
new Column(Application.getString(
"lPrice"),
null,
"120px");
134 col.setAlign(
"right");
135 cols.appendChild(col);
boolean isInRole(String role)
static Application getApplication()
void setRowCount(int rows)