001/* Copyright (C) 2014 konik.io
002 *
003 * This file is part of the Konik library.
004 *
005 * The Konik library is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * The Konik library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with the Konik library. If not, see <http://www.gnu.org/licenses/>.
017 */
018package io.konik.zugferd.entity.trade;
019
020import io.konik.validator.annotation.Basic;
021import io.konik.validator.annotation.Comfort;
022import io.konik.zugferd.entity.CommonMonetarySummation;
023import io.konik.zugferd.unqualified.Amount;
024
025import javax.validation.Valid;
026import javax.validation.constraints.NotNull;
027import javax.xml.bind.annotation.XmlElement;
028import javax.xml.bind.annotation.XmlType;
029
030/**
031 * = The Monetary Summation of a trade settlement
032 * 
033 */
034@XmlType(propOrder = { "lineTotal", "chargeTotal", "allowanceTotal", "netTotal", "taxTotal", "grandTotal",
035      "totalPrepaid", "duePayable" })
036public class MonetarySummation extends CommonMonetarySummation {
037
038   @XmlElement(name = "ChargeTotalAmount")
039   private Amount chargeTotal;
040
041   @XmlElement(name = "AllowanceTotalAmount")
042   private Amount allowanceTotal;
043
044   @XmlElement(name = "TaxBasisTotalAmount")
045   private Amount netTotal;
046
047   @XmlElement(name = "TaxTotalAmount")
048   private Amount taxTotal;
049
050   @XmlElement(name = "GrandTotalAmount")
051   private Amount grandTotal;
052
053   @XmlElement(name = "TotalPrepaidAmount")
054   private Amount totalPrepaid;
055
056   @XmlElement(name = "DuePayableAmount")
057   private Amount duePayable;
058
059   @Override
060   public Amount getLineTotal() {
061      return lineTotal;
062   }
063
064   @Override
065   public MonetarySummation setLineTotal(Amount lineTotal) {
066      this.lineTotal = lineTotal;
067      return this;
068   }
069
070   /**
071    * Gets the total amount of surcharges.
072    * 
073    * @return the charge total amount
074    */
075   @Basic
076   @Valid
077   @NotNull
078   public Amount getChargeTotal() {
079      return chargeTotal;
080   }
081
082   /**
083    * Sets the total amount of surcharges.
084    * 
085    * @param chargeTotal the new charge total amount
086    * @return the trade settlement monetary summation
087    */
088   public MonetarySummation setChargeTotal(Amount chargeTotal) {
089      this.chargeTotal = chargeTotal;
090      return this;
091   }
092
093   /**
094    * Gets the total amount of discounts.
095    * 
096    * @return the allowance total amount
097    */
098   @Basic
099   @Valid
100   @NotNull
101   public Amount getAllowanceTotal() {
102      return allowanceTotal;
103   }
104
105   /**
106    * Sets the total amount of discounts.
107    * 
108    * @param allowanceTotal the new allowance total amount
109    * @return the trade settlement monetary summation
110    */
111   public MonetarySummation setAllowanceTotal(Amount allowanceTotal) {
112      this.allowanceTotal = allowanceTotal;
113      return this;
114   }
115
116   /**
117    * Gets the invoice total value excluding VAT.
118    * 
119    * Example:: The taxBasisTotal = netTotal + chargeTotal - allowanceTotal.
120    * 
121    * @return the tax basis total amount
122    */
123   @Basic
124   @Valid
125   @NotNull
126   public Amount getTaxBasisTotal() {
127      return netTotal;
128   }
129
130   /**
131    * Sets the invoice total value excluding VAT.
132    * 
133    * Example:: The taxBasisTotal = netTotal + chargeTotal - allowanceTotal.
134    * 
135    * @param taxBasisTotal the new tax basis total amount
136    * @return the trade settlement monetary summation
137    */
138   public MonetarySummation setTaxBasisTotal(Amount taxBasisTotal) {
139      this.netTotal = taxBasisTotal;
140      return this;
141   }
142
143   /**
144    * Gets the total tax amount.
145    * 
146    * @return the tax total amount
147    */
148   @Basic
149   @Valid
150   @NotNull
151   public Amount getTaxTotal() {
152      return taxTotal;
153   }
154
155   /**
156    * Sets the total tax amount.
157    * 
158    * @param taxTotal the new tax total amount
159    * @return the trade settlement monetary summation
160    */
161   public MonetarySummation setTaxTotal(Amount taxTotal) {
162      this.taxTotal = taxTotal;
163      return this;
164   }
165
166   /**
167    * Gets the grand total amount.
168    * 
169    * Example:: grandTotal == + taxTotal
170    * 
171    * @return the grand total amount
172    */
173   @Basic
174   @Valid
175   @NotNull
176   public Amount getGrandTotal() {
177      return grandTotal;
178   }
179
180   /**
181    * Sets the grand total amount.
182    * 
183    * @param grandTotal the new grand total amount
184    * @return the trade settlement monetary summation
185    */
186   public MonetarySummation setGrandTotal(Amount grandTotal) {
187      this.grandTotal = grandTotal;
188      return this;
189   }
190
191   /**
192    * Gets the total prepaid amount.
193    * 
194    * @return the total prepaid amount
195    */
196   @Comfort
197   @Valid
198   public Amount getTotalPrepaid() {
199      return totalPrepaid;
200   }
201
202   /**
203    * Sets the total prepaid amount.
204    * 
205    * @param totalPrepaid the new total prepaid amount
206    * @return the trade settlement monetary summation
207    */
208   public MonetarySummation setTotalPrepaid(Amount totalPrepaid) {
209      this.totalPrepaid = totalPrepaid;
210      return this;
211   }
212
213   /**
214    * Gets the due payable amount.
215    * 
216    * @return the due payable amount
217    */
218   @Comfort
219   @Valid
220   public Amount getDuePayable() {
221      return duePayable;
222   }
223
224   /**
225    * Sets the due payable amount.
226    * 
227    * @param duePayable the new due payable amount
228    * @return the trade settlement monetary summation
229    */
230   public MonetarySummation setDuePayable(Amount duePayable) {
231      this.duePayable = duePayable;
232      return this;
233   }
234
235}