001/*
002 * Copyright 2006-2009 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017/*
018 * Created on Feb 13, 2006
019 *
020 */
021package org.kuali.ole.module.purap.businessobject;
022
023import org.apache.commons.lang.builder.ToStringBuilder;
024import org.kuali.ole.module.purap.PurapConstants;
025
026import java.math.BigDecimal;
027
028public class ElectronicInvoiceDetailRequestSummary {
029
030    private String subTotalAmount; // has money xml node
031    private String subTotalAmountCurrency;
032    private String taxAmount; // has money xml node  (not all tax fields are stored as tax should never occur)
033    private String taxAmountCurrency;
034    private String taxDescription;
035    private String specialHandlingAmount; // has money xml node
036    private String specialHandlingAmountCurrency;
037    private String specialHandlingAmountDescription;
038    private String shippingAmount; // has money xml node
039    private String shippingAmountCurrency;
040    // grossAmount should = subTotalAmount + taxAmount + specialHandlingAmount + shippingAmount
041    private String grossAmount; // subTotal + taxes + shipping + special handling
042    private String grossAmountCurrency;
043    private String discountAmount; // has money xml node
044    private String discountAmountCurrency;
045    // netAmount should = grossAmount - discountAmount
046    private String netAmount;  // has money xml node
047    private String netAmountCurrency;
048    private String depositAmount;  // has money xml node
049    private String depositAmountCurrency;
050    // dueAmount should = newAmount - depositAmount
051    private String dueAmount;  // has money xml node
052    private String dueAmountCurrency;
053
054    /**
055     * Newly Added
056     */
057    private String taxCategory;
058    private String taxPurpose;
059    private String taxPercentageRate;
060//  private String taxableAmount;
061//  private String taxableAmountCurrency;
062
063    public ElectronicInvoiceDetailRequestSummary() {
064        super();
065    }
066
067    public String getShippingDescription() {
068        if (this.shippingAmount != null) {
069            try {
070                if (BigDecimal.ZERO.compareTo(this.getInvoiceShippingAmount()) != 0) {
071                    return PurapConstants.ElectronicInvoice.DEFAULT_SHIPPING_DESCRIPTION;
072                } else {
073                    return null;
074                }
075            } catch (Throwable t) {
076                return null;
077            }
078        }
079        return null;
080    }
081
082    public BigDecimal getInvoiceSubTotalAmount() {
083        if ((this.subTotalAmount == null) || ("".equals(this.subTotalAmount))) {
084            return BigDecimal.ZERO;
085        } else {
086            return new BigDecimal(this.subTotalAmount);
087        }
088    }
089
090    public BigDecimal getInvoiceTaxAmount() {
091        if ((this.taxAmount == null) || ("".equals(this.taxAmount))) {
092            return BigDecimal.ZERO;
093        } else {
094            return new BigDecimal(this.taxAmount);
095        }
096    }
097
098    public BigDecimal getInvoiceSpecialHandlingAmount() {
099        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}