BrightSide Workbench Full Report + Source Code
ReceiptGroupEdit.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2012 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.erp.purchase;
20 
21 import org.turro.erp.db.ErpPU;
22 import org.turro.erp.entity.ReceiptItem;
23 import org.turro.jpa.Dao;
24 import org.zkoss.zk.ui.event.Event;
25 import org.zkoss.zk.ui.util.GenericForwardComposer;
26 import org.zkoss.zul.Checkbox;
27 import org.zkoss.zul.Datebox;
28 import org.zkoss.zul.Textbox;
29 import org.zkoss.zul.Window;
30 
35 public class ReceiptGroupEdit extends GenericForwardComposer {
36 
37  private ReceiptItemModel.ReceiptItemSummary draftReceiptSummary;
38  private Window draftcoGroupForm;
39  private Textbox docnumber;
40  private Datebox docdate;
41  private Checkbox sent;
42 
43  public void onUser(Event event) {
44  draftReceiptSummary = (ReceiptItemModel.ReceiptItemSummary) event.getData();
45  docdate.setValue(draftReceiptSummary.getReceipt(0).getDocumentDate());
46  docnumber.setValue(draftReceiptSummary.getReceipt(0).getDocumentNumber());
47  }
48 
49  public void onOK() {
50  onSave();
51  }
52 
53  public void onSave() {
54  Dao dao = new ErpPU();
55  for(Object o : draftReceiptSummary.orders) {
56  ReceiptItem dro = (ReceiptItem) o;
57  dro.setDocumentDate(docdate.getValue());
58  dro.setDocumentNumber(docnumber.getValue());
59  dao.saveObject(dro);
60  }
61  draftcoGroupForm.detach();
62  }
63 
64  public void onCancel() {
65  draftcoGroupForm.detach();
66  }
67 
68 }
void setDocumentNumber(String documentNumber)
void setDocumentDate(Date documentDate)