View Javadoc
1   /*
2    * Copyright 2006-2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  /*
18   * Created on Feb 13, 2006
19   *
20   */
21  package org.kuali.ole.module.purap.businessobject;
22  
23  import org.apache.commons.lang.builder.ToStringBuilder;
24  import org.kuali.ole.module.purap.PurapConstants;
25  
26  import java.math.BigDecimal;
27  
28  public class ElectronicInvoiceDetailRequestSummary {
29  
30      private String subTotalAmount; // has money xml node
31      private String subTotalAmountCurrency;
32      private String taxAmount; // has money xml node  (not all tax fields are stored as tax should never occur)
33      private String taxAmountCurrency;
34      private String taxDescription;
35      private String specialHandlingAmount; // has money xml node
36      private String specialHandlingAmountCurrency;
37      private String specialHandlingAmountDescription;
38      private String shippingAmount; // has money xml node
39      private String shippingAmountCurrency;
40      // grossAmount should = subTotalAmount + taxAmount + specialHandlingAmount + shippingAmount
41      private String grossAmount; // subTotal + taxes + shipping + special handling
42      private String grossAmountCurrency;
43      private String discountAmount; // has money xml node
44      private String discountAmountCurrency;
45      // netAmount should = grossAmount - discountAmount
46      private String netAmount;  // has money xml node
47      private String netAmountCurrency;
48      private String depositAmount;  // has money xml node
49      private String depositAmountCurrency;
50      // dueAmount should = newAmount - depositAmount
51      private String dueAmount;  // has money xml node
52      private String dueAmountCurrency;
53  
54      /**
55       * Newly Added
56       */
57      private String taxCategory;
58      private String taxPurpose;
59      private String taxPercentageRate;
60  //  private String taxableAmount;
61  //  private String taxableAmountCurrency;
62  
63      public ElectronicInvoiceDetailRequestSummary() {
64          super();
65      }
66  
67      public String getShippingDescription() {
68          if (this.shippingAmount != null) {
69              try {
70                  if (BigDecimal.ZERO.compareTo(this.getInvoiceShippingAmount()) != 0) {
71                      return PurapConstants.ElectronicInvoice.DEFAULT_SHIPPING_DESCRIPTION;
72                  } else {
73                      return null;
74                  }
75              } catch (Throwable t) {
76                  return null;
77              }
78          }
79          return null;
80      }
81  
82      public BigDecimal getInvoiceSubTotalAmount() {
83          if ((this.subTotalAmount == null) || ("".equals(this.subTotalAmount))) {
84              return BigDecimal.ZERO;
85          } else {
86              return new BigDecimal(this.subTotalAmount);
87          }
88      }
89  
90      public BigDecimal getInvoiceTaxAmount() {
91          if ((this.taxAmount == null) || ("".equals(this.taxAmount))) {
92              return BigDecimal.ZERO;
93          } else {
94              return new BigDecimal(this.taxAmount);
95          }
96      }
97  
98      public BigDecimal getInvoiceSpecialHandlingAmount() {
99          if ((this.specialHandlingAmount == null) || ("".equals(this.specialHandlingAmount))) {
100             return BigDecimal.ZERO;
101         } else {
102             return new BigDecimal(this.specialHandlingAmount);
103         }
104     }
105 
106     public BigDecimal getInvoiceShippingAmount() {
107         if ((this.shippingAmount == null) || ("".equals(this.shippingAmount))) {
108             return BigDecimal.ZERO;
109         } else {
110             return new BigDecimal(this.shippingAmount);
111         }
112     }
113 
114     public BigDecimal getInvoiceGrossAmount() {
115         if ((this.grossAmount == null) || ("".equals(this.grossAmount))) {
116             return BigDecimal.ZERO;
117         } else {
118             return new BigDecimal(this.grossAmount);
119         }
120     }
121 
122     public BigDecimal getInvoiceDiscountAmount() {
123         if ((this.discountAmount == null) || ("".equals(this.discountAmount))) {
124             return BigDecimal.ZERO;
125         } else {
126             return new BigDecimal(this.discountAmount);
127         }
128     }
129 
130     public BigDecimal getInvoiceNetAmount() {
131         if ((this.netAmount == null) || ("".equals(this.netAmount))) {
132             return BigDecimal.ZERO;
133         } else {
134             return new BigDecimal(this.netAmount);
135         }
136     }
137 
138     public BigDecimal getInvoiceDepositAmount() {
139         if ((this.depositAmount == null) || ("".equals(this.depositAmount))) {
140             return BigDecimal.ZERO;
141         } else {
142             return new BigDecimal(this.depositAmount);
143         }
144     }
145 
146     public BigDecimal getInvoiceDueAmount() {
147         if ((this.dueAmount == null) || ("".equals(this.dueAmount))) {
148             return BigDecimal.ZERO;
149         } else {
150             return new BigDecimal(this.dueAmount);
151         }
152     }
153 
154     /**
155      * @return Returns the depositAmount.
156      */
157     public String getDepositAmount() {
158         return depositAmount;
159     }
160 
161     /**
162      * @param depositAmount The depositAmount to set.
163      */
164     public void setDepositAmount(String depositAmount) {
165         this.depositAmount = depositAmount;
166     }
167 
168     /**
169      * @return Returns the depositAmountCurrency.
170      */
171     public String getDepositAmountCurrency() {
172         return depositAmountCurrency;
173     }
174 
175     /**
176      * @param depositAmountCurrency The depositAmountCurrency to set.
177      */
178     public void setDepositAmountCurrency(String depositAmountCurrency) {
179         this.depositAmountCurrency = depositAmountCurrency;
180     }
181 
182     /**
183      * @return Returns the discountAmount.
184      */
185     public String getDiscountAmount() {
186         return discountAmount;
187     }
188 
189     /**
190      * @param discountAmount The discountAmount to set.
191      */
192     public void setDiscountAmount(String discountAmount) {
193         this.discountAmount = discountAmount;
194     }
195 
196     /**
197      * @return Returns the discountAmountCurrency.
198      */
199     public String getDiscountAmountCurrency() {
200         return discountAmountCurrency;
201     }
202 
203     /**
204      * @param discountAmountCurrency The discountAmountCurrency to set.
205      */
206     public void setDiscountAmountCurrency(String discountAmountCurrency) {
207         this.discountAmountCurrency = discountAmountCurrency;
208     }
209 
210     /**
211      * @return Returns the dueAmount.
212      */
213     public String getDueAmount() {
214         return dueAmount;
215     }
216 
217     /**
218      * @param dueAmount The dueAmount to set.
219      */
220     public void setDueAmount(String dueAmount) {
221         this.dueAmount = dueAmount;
222     }
223 
224     /**
225      * @return Returns the dueAmountCurrency.
226      */
227     public String getDueAmountCurrency() {
228         return dueAmountCurrency;
229     }
230 
231     /**
232      * @param dueAmountCurrency The dueAmountCurrency to set.
233      */
234     public void setDueAmountCurrency(String dueAmountCurrency) {
235         this.dueAmountCurrency = dueAmountCurrency;
236     }
237 
238     /**
239      * @return Returns the grossAmount.
240      */
241     public String getGrossAmount() {
242         return grossAmount;
243     }
244 
245     /**
246      * @param grossAmount The grossAmount to set.
247      */
248     public void setGrossAmount(String grossAmount) {
249         this.grossAmount = grossAmount;
250     }
251 
252     /**
253      * @return Returns the grossAmountCurrency.
254      */
255     public String getGrossAmountCurrency() {
256         return grossAmountCurrency;
257     }
258 
259     /**
260      * @param grossAmountCurrency The grossAmountCurrency to set.
261      */
262     public void setGrossAmountCurrency(String grossAmountCurrency) {
263         this.grossAmountCurrency = grossAmountCurrency;
264     }
265 
266     /**
267      * @return Returns the netAmount.
268      */
269     public String getNetAmount() {
270         return netAmount;
271     }
272 
273     /**
274      * @param netAmount The netAmount to set.
275      */
276     public void setNetAmount(String netAmount) {
277         this.netAmount = netAmount;
278     }
279 
280     /**
281      * @return Returns the netAmountCurrency.
282      */
283     public String getNetAmountCurrency() {
284         return netAmountCurrency;
285     }
286 
287     /**
288      * @param netAmountCurrency The netAmountCurrency to set.
289      */
290     public void setNetAmountCurrency(String netAmountCurrency) {
291         this.netAmountCurrency = netAmountCurrency;
292     }
293 
294     /**
295      * @return Returns the shippingAmount.
296      */
297     public String getShippingAmount() {
298         return shippingAmount;
299     }
300 
301     /**
302      * @param shippingAmount The shippingAmount to set.
303      */
304     public void setShippingAmount(String shippingAmount) {
305         this.shippingAmount = shippingAmount;
306     }
307 
308     /**
309      * @return Returns the shippingAmountCurrency.
310      */
311     public String getShippingAmountCurrency() {
312         return shippingAmountCurrency;
313     }
314 
315     /**
316      * @param shippingAmountCurrency The shippingAmountCurrency to set.
317      */
318     public void setShippingAmountCurrency(String shippingAmountCurrency) {
319         this.shippingAmountCurrency = shippingAmountCurrency;
320     }
321 
322     /**
323      * @return Returns the specialHandlingAmount.
324      */
325     public String getSpecialHandlingAmount() {
326         return specialHandlingAmount;
327     }
328 
329     /**
330      * @param specialHandlingAmount The specialHandlingAmount to set.
331      */
332     public void setSpecialHandlingAmount(String specialHandlingAmount) {
333         this.specialHandlingAmount = specialHandlingAmount;
334     }
335 
336     /**
337      * @return Returns the specialHandlingAmountCurrency.
338      */
339     public String getSpecialHandlingAmountCurrency() {
340         return specialHandlingAmountCurrency;
341     }
342 
343     /**
344      * @param specialHandlingAmountCurrency The specialHandlingAmountCurrency to set.
345      */
346     public void setSpecialHandlingAmountCurrency(String specialHandlingAmountCurrency) {
347         this.specialHandlingAmountCurrency = specialHandlingAmountCurrency;
348     }
349 
350     /**
351      * @return the specialHandlingAmountDescription
352      */
353     public String getSpecialHandlingAmountDescription() {
354         if (this.specialHandlingAmount != null) {
355             try {
356                 if (BigDecimal.ZERO.compareTo(this.getInvoiceSpecialHandlingAmount()) != 0) {
357                     return PurapConstants.ElectronicInvoice.DEFAULT_SPECIAL_HANDLING_DESCRIPTION;
358                 } else {
359                     return null;
360                 }
361             } catch (Throwable t) {
362                 return null;
363             }
364         }
365         return null;
366     }
367 
368     /**
369      * @param specialHandlingAmountDescription
370      *         the specialHandlingAmountDescription to set
371      */
372     public void setSpecialHandlingAmountDescription(String specialHandlingAmountDescription) {
373         this.specialHandlingAmountDescription = specialHandlingAmountDescription;
374     }
375 
376     /**
377      * @return Returns the subTotalAmount.
378      */
379     public String getSubTotalAmount() {
380         return subTotalAmount;
381     }
382 
383     /**
384      * @param subTotalAmount The subTotalAmount to set.
385      */
386     public void setSubTotalAmount(String subTotalAmount) {
387         this.subTotalAmount = subTotalAmount;
388     }
389 
390     /**
391      * @return Returns the subTotalAmountCurrency.
392      */
393     public String getSubTotalAmountCurrency() {
394         return subTotalAmountCurrency;
395     }
396 
397     /**
398      * @param subTotalAmountCurrency The subTotalAmountCurrency to set.
399      */
400     public void setSubTotalAmountCurrency(String subTotalAmountCurrency) {
401         this.subTotalAmountCurrency = subTotalAmountCurrency;
402     }
403 
404     /**
405      * @return Returns the taxAmount.
406      */
407     public String getTaxAmount() {
408         return taxAmount;
409     }
410 
411     /**
412      * @param taxAmount The taxAmount to set.
413      */
414     public void setTaxAmount(String taxAmount) {
415         this.taxAmount = taxAmount;
416     }
417 
418     /**
419      * @return Returns the taxAmountCurrency.
420      */
421     public String getTaxAmountCurrency() {
422         return taxAmountCurrency;
423     }
424 
425     /**
426      * @param taxAmountCurrency The taxAmountCurrency to set.
427      */
428     public void setTaxAmountCurrency(String taxAmountCurrency) {
429         this.taxAmountCurrency = taxAmountCurrency;
430     }
431 
432     /**
433      * @return Returns the taxDescription.
434      */
435     public String getTaxDescription() {
436         return taxDescription;
437     }
438 
439     /**
440      * @param taxDescription The taxDescription to set.
441      */
442     public void setTaxDescription(String taxDescription) {
443         this.taxDescription = taxDescription;
444     }
445 
446     public String getTaxCategory() {
447         return taxCategory;
448     }
449 
450     public void setTaxCategory(String taxCategory) {
451         this.taxCategory = taxCategory;
452     }
453 
454     public String getTaxPercentageRate() {
455         return taxPercentageRate;
456     }
457 
458     public void setTaxPercentageRate(String taxPercentageRate) {
459         this.taxPercentageRate = taxPercentageRate;
460     }
461 
462     public String getTaxPurpose() {
463         return taxPurpose;
464     }
465 
466     public void setTaxPurpose(String taxPurpose) {
467         this.taxPurpose = taxPurpose;
468     }
469 
470 //  public String getTaxableAmount() {
471 //      return taxableAmount;
472 //  }
473 //
474 //  public void setTaxableAmount(String taxableAmount) {
475 //      this.taxableAmount = taxableAmount;
476 //  }
477 //
478 //  public String getTaxableAmountCurrency() {
479 //      return taxableAmountCurrency;
480 //  }
481 //
482 //  public void setTaxableAmountCurrency(String taxableAmountCurrency) {
483 //      this.taxableAmountCurrency = taxableAmountCurrency;
484 //  }
485 
486     public String toString() {
487         ToStringBuilder toString = new ToStringBuilder(this);
488         toString.append("subTotalAmount", getSubTotalAmount());
489         toString.append("subTotalAmountCurrency", getSubTotalAmountCurrency());
490         toString.append("taxAmount", getTaxAmount());
491         toString.append("taxAmountCurrency", getTaxAmountCurrency());
492 //      toString.append("taxableAmount",getTaxableAmount());
493 //      toString.append("taxableAmountCurrency",getTaxableAmountCurrency());
494         toString.append("taxDescription", getTaxDescription());
495         toString.append("taxPercentageRate", getTaxPercentageRate());
496         toString.append("taxPurpose", getTaxPurpose());
497         toString.append("taxCategory", getTaxCategory());
498         toString.append("specialHandlingAmount", getSpecialHandlingAmount());
499         toString.append("specialHandlingAmountCurrency", getSpecialHandlingAmountCurrency());
500         toString.append("specialHandlingAmountDescription", getSpecialHandlingAmountDescription());
501         toString.append("shippingAmount", getShippingAmount());
502         toString.append("shippingAmountCurrency", getShippingAmountCurrency());
503         toString.append("grossAmount", getGrossAmount());
504         toString.append("grossAmountCurrency", getGrossAmountCurrency());
505         toString.append("discountAmount", getDiscountAmount());
506         toString.append("discountAmountCurrency", getDiscountAmountCurrency());
507         toString.append("netAmount", getNetAmount());
508         toString.append("netAmountCurrency", getNetAmountCurrency());
509         toString.append("depositAmount", getDepositAmount());
510         toString.append("depositAmountCurrency", getDepositAmountCurrency());
511         toString.append("dueAmount", getDueAmount());
512         toString.append("dueAmountCurrency", getDueAmountCurrency());
513 
514         return toString.toString();
515     }
516 
517 }