BrightSide Workbench Full Report + Source Code
org.turro.financials.document.QuickDocument Class Reference
Inheritance diagram for org.turro.financials.document.QuickDocument:
Collaboration diagram for org.turro.financials.document.QuickDocument:

Public Member Functions

void onChangeContract ()
 
void onSelectCtcDef ()
 
void onSelectDocFlow ()
 
void onChangeDocDate ()
 
void onClickClose ()
 
void onClickCreate ()
 
 QuickDocument (Date date, Double amount, String concept)
 
void afterCompose ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 51 of file QuickDocument.java.

Constructor & Destructor Documentation

◆ QuickDocument()

org.turro.financials.document.QuickDocument.QuickDocument ( Date  date,
Double  amount,
String  concept 
)

Definition at line 197 of file QuickDocument.java.

197  {
198  this.date = date;
199  this.amount = amount;
200  this.concept = concept;
201  Executions.createComponents("/WEB-INF/_zul/bs/comps/document/quickDocument.zul", this, null);
202  Selectors.wireComponents(this, this, false);
203  Selectors.wireEventListeners(this, this);
204  }

Member Function Documentation

◆ afterCompose()

void org.turro.financials.document.QuickDocument.afterCompose ( )

Definition at line 207 of file QuickDocument.java.

207  {
208  setClosable(true);
209  setBorder(true);
210  setWidth("600px");
211  ctcDef.setDisabled(true);
212  lineType1.setDisabled(true);
213  lineType2.setDisabled(true);
214  docFlow.setDisabled(true);
215  store1.setDisabled(true);
216  store2.setDisabled(true);
217  docDate.setValue(date);
218  docReceipt.setValue(date);
219  docTax.setValue((Double) Framework.getAttribute(this, "docTax"));
220  docAmount.setValue(amount);
221  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onChangeContract()

void org.turro.financials.document.QuickDocument.onChangeContract ( )

Definition at line 83 of file QuickDocument.java.

83  {
84  if(contract.getObjectValue() != null) {
85  ctcDef.updateContractDefinition(contract.getObjectValue().getContractDefinition());
86  ctcDef.setDisabled(false);
87  } else {
88  ctcDef.setDisabled(true);
89  }
90  }
void updateContractDefinition(ContractDefinition contractDefinition)
Here is the call graph for this function:

◆ onChangeDocDate()

void org.turro.financials.document.QuickDocument.onChangeDocDate ( )

Definition at line 133 of file QuickDocument.java.

133  {
134  docReceipt.setValue(docDate.getValue());
135  }
Here is the call graph for this function:

◆ onClickClose()

void org.turro.financials.document.QuickDocument.onClickClose ( )

Definition at line 138 of file QuickDocument.java.

138  {
139  Events.postEvent(new Event(Events.ON_CLOSE, this));
140  }

◆ onClickCreate()

void org.turro.financials.document.QuickDocument.onClickCreate ( )

Definition at line 143 of file QuickDocument.java.

143  {
144  Framework.setAttribute(this, "docTax", docTax.getNumber());
145  if(contract.getObjectValue() != null &&
146  ctcDef.getObjectValue() != null &&
147  lineType1.getObjectValue() != null &&
148  store1.getObjectValue() != null) {
149  Document doc = new Document();
150  doc.setContract(contract.getObjectValue());
151  doc.setCurrency(doc.getContract().getCurrency());
152  doc.setDocumentDate(docDate.getValue());
153  doc.setDocumentNumber(docNumber.getValue());
154  doc.setReceiptDate(docReceipt.getValue());
155  doc.setDocumentDefinition(ctcDef.getObjectValue());
156  doc.setDraft(false);
157  DocumentLine nl = new DocumentLine();
158  nl.setConcept(concept);
159  nl.setDiscountMoney(0);
160  nl.setDiscountPerCent(0);
161  nl.setDocument(doc);
162  nl.setLineOrder(1);
163  nl.setLineType(lineType1.getObjectValue());
164  nl.setContractPreference(nl.getLineType().getContractPreference());
165  nl.setPrice(docAmount.getDoubleValue() / (1.0 + (docTax.getDoubleValue() / 100.0)));
166  nl.setProduct(null);
167  nl.setProductByContractor(null);
168  nl.setQuantity(0);
169  nl.setStore(store1.getObjectValue());
170  nl.setTax(docTax.getDoubleValue());
171  nl.setEquivalenceSurcharge(0);
172  nl.setRetention(0);
173  doc.getDocumentLines().add(nl);
174  doc = new DocumentWrapper(doc).save(new ArrayList(doc.getDocumentLines()), null);
175  if(docFlow.getObjectValue() != null &&
176  lineType2.getObjectValue() != null &&
177  store2.getObjectValue() != null) {
178  Document expiry = new Document();
179  expiry.setDocumentDefinition(docFlow.getObjectValue());
180  DocumentWorkflow dw = new DocumentWorkflow();
181  dw.setAncestor(doc.getDocumentDefinition());
182  dw.setDescendant(expiry.getDocumentDefinition());
183  expiry.flowFrom(doc, new DocumentWrapper(doc).getDocDescription(), dw);
184  expiry.setDocumentNumber(doc.getDocumentNumber() + "/1");
185  expiry.setDocumentDate(doc.getDocumentDate());
186  expiry.setReceiptDate(doc.getReceiptDate());
187  DocumentLine dl = expiry.getDocumentLines().iterator().next();
188  dl.setStore(store2.getObjectValue());
189  dl.setLineType(lineType2.getObjectValue());
190  new DocumentWrapper(expiry).save(new ArrayList(expiry.getDocumentLines()), null);
191  }
192  FinancialsMenu.showDocument(doc);
193  Events.postEvent(new Event(Events.ON_CLOSE, this));
194  }
195  }
Here is the call graph for this function:

◆ onSelectCtcDef()

void org.turro.financials.document.QuickDocument.onSelectCtcDef ( )

Definition at line 93 of file QuickDocument.java.

93  {
94  if(ctcDef.getObjectValue() != null) {
95  Document doc = new Document();
96  doc.setContract(contract.getObjectValue());
97  doc.setDocumentDefinition(ctcDef.getObjectValue());
98  contract.getObjectValue().getFlowFor(doc);
99  docFlow.updateCollection(ContractWrapper.getExpiryDefinitions(
100  contract.getObjectValue().getContractDefinition(),
101  ctcDef.getObjectValue()));
102  docFlow.setDisabled(false);
103  lineType1.setDocument(doc);
104  lineType1.setDisabled(false);
105  store1.updateCollection(new DocumentDefinitionWrapper(
106  doc.getDocumentDefinition()).getRelatedStores());
107  store1.setDisabled(false);
108  } else {
109  docFlow.setDisabled(true);
110  lineType1.setDisabled(true);
111  store1.setDisabled(true);
112  }
113  }
Here is the call graph for this function:

◆ onSelectDocFlow()

void org.turro.financials.document.QuickDocument.onSelectDocFlow ( )

Definition at line 116 of file QuickDocument.java.

116  {
117  if(docFlow.getObjectValue() != null) {
118  Document doc = new Document();
119  doc.setContract(contract.getObjectValue());
120  doc.setDocumentDefinition(docFlow.getObjectValue());
121  lineType2.setDocument(doc);
122  lineType2.setDisabled(false);
123  store2.updateCollection(new DocumentDefinitionWrapper(
124  doc.getDocumentDefinition()).getRelatedStores());
125  store2.setDisabled(false);
126  } else {
127  lineType2.setDisabled(true);
128  store2.setDisabled(true);
129  }
130  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: