001 /* 002 * Copyright 2011 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 */ 021 package org.kuali.kfs.module.purap.businessobject; 022 023 import java.math.BigDecimal; 024 025 import org.apache.commons.lang.builder.ToStringBuilder; 026 import org.kuali.kfs.module.purap.PurapConstants; 027 import org.kuali.kfs.module.purap.service.ElectronicInvoiceMappingService; 028 029 public class ElectronicInvoiceDetailRequestSummary { 030 031 private String subTotalAmount; // has money xml node 032 private String subTotalAmountCurrency; 033 private String taxAmount; // has money xml node (not all tax fields are stored as tax should never occur) 034 private String taxAmountCurrency; 035 private String taxDescription; 036 private String specialHandlingAmount; // has money xml node 037 private String specialHandlingAmountCurrency; 038 private String specialHandlingAmountDescription; 039 private String shippingAmount; // has money xml node 040 private String shippingAmountCurrency; 041 // grossAmount should = subTotalAmount + taxAmount + specialHandlingAmount + shippingAmount 042 private String grossAmount; // subTotal + taxes + shipping + special handling 043 private String grossAmountCurrency; 044 private String discountAmount; // has money xml node 045 private String discountAmountCurrency; 046 // netAmount should = grossAmount - discountAmount 047 private String netAmount; // has money xml node 048 private String netAmountCurrency; 049 private String depositAmount; // has money xml node 050 private String depositAmountCurrency; 051 // dueAmount should = newAmount - depositAmount 052 private String dueAmount; // has money xml node 053 private String dueAmountCurrency; 054 055 /** 056 * Newly Added 057 */ 058 private String taxCategory; 059 private String taxPurpose; 060 private String taxPercentageRate; 061 // private String taxableAmount; 062 // private String taxableAmountCurrency; 063 064 public ElectronicInvoiceDetailRequestSummary() { 065 super(); 066 } 067 068 public String getShippingDescription() { 069 if (this.shippingAmount != null) { 070 try { 071 if (BigDecimal.ZERO.compareTo(this.getInvoiceShippingAmount()) != 0) { 072 return PurapConstants.ElectronicInvoice.DEFAULT_SHIPPING_DESCRIPTION; 073 } else { 074 return null; 075 } 076 } catch (Throwable t) { 077 return null; 078 } 079 } 080 return null; 081 } 082 083 public BigDecimal getInvoiceSubTotalAmount() { 084 if ( (this.subTotalAmount == null) || ("".equals(this.subTotalAmount)) ) { 085 return BigDecimal.ZERO; 086 } else { 087 return new BigDecimal(this.subTotalAmount); 088 } 089 } 090 091 public BigDecimal getInvoiceTaxAmount() { 092 if ( (this.taxAmount == null) || ("".equals(this.taxAmount)) ) { 093 return BigDecimal.ZERO; 094 } else { 095 return new BigDecimal(this.taxAmount); 096 } 097 } 098 099 public BigDecimal getInvoiceSpecialHandlingAmount() { 100 if ( (this.specialHandlingAmount == null) || ("".equals(this.specialHandlingAmount)) ) { 101 return BigDecimal.ZERO; 102 } else { 103 return new BigDecimal(this.specialHandlingAmount); 104 } 105 } 106 107 public BigDecimal getInvoiceShippingAmount() { 108 if ( (this.shippingAmount == null) || ("".equals(this.shippingAmount)) ) { 109 return BigDecimal.ZERO; 110 } else { 111 return new BigDecimal(this.shippingAmount); 112 } 113 } 114 115 public BigDecimal getInvoiceGrossAmount() { 116 if ( (this.grossAmount == null) || ("".equals(this.grossAmount)) ) { 117 return BigDecimal.ZERO; 118 } else { 119 return new BigDecimal(this.grossAmount); 120 } 121 } 122 123 public BigDecimal getInvoiceDiscountAmount() { 124 if ( (this.discountAmount == null) || ("".equals(this.discountAmount)) ) { 125 return BigDecimal.ZERO; 126 } else { 127 return new BigDecimal(this.discountAmount); 128 } 129 } 130 131 public BigDecimal getInvoiceNetAmount() { 132 if ( (this.netAmount == null) || ("".equals(this.netAmount)) ) { 133 return BigDecimal.ZERO; 134 } else { 135 return new BigDecimal(this.netAmount); 136 } 137 } 138 139 public BigDecimal getInvoiceDepositAmount() { 140 if ( (this.depositAmount == null) || ("".equals(this.depositAmount)) ) { 141 return BigDecimal.ZERO; 142 } else { 143 return new BigDecimal(this.depositAmount); 144 } 145 } 146 147 public BigDecimal getInvoiceDueAmount() { 148 if ( (this.dueAmount == null) || ("".equals(this.dueAmount)) ) { 149 return BigDecimal.ZERO; 150 } else { 151 return new BigDecimal(this.dueAmount); 152 } 153 } 154 155 /** 156 * @return Returns the depositAmount. 157 */ 158 public String getDepositAmount() { 159 return depositAmount; 160 } 161 /** 162 * @param depositAmount The depositAmount to set. 163 */ 164 public void setDepositAmount(String depositAmount) { 165 this.depositAmount = depositAmount; 166 } 167 /** 168 * @return Returns the depositAmountCurrency. 169 */ 170 public String getDepositAmountCurrency() { 171 return depositAmountCurrency; 172 } 173 /** 174 * @param depositAmountCurrency The depositAmountCurrency to set. 175 */ 176 public void setDepositAmountCurrency(String depositAmountCurrency) { 177 this.depositAmountCurrency = depositAmountCurrency; 178 } 179 /** 180 * @return Returns the discountAmount. 181 */ 182 public String getDiscountAmount() { 183 return discountAmount; 184 } 185 /** 186 * @param discountAmount The discountAmount to set. 187 */ 188 public void setDiscountAmount(String discountAmount) { 189 this.discountAmount = discountAmount; 190 } 191 /** 192 * @return Returns the discountAmountCurrency. 193 */ 194 public String getDiscountAmountCurrency() { 195 return discountAmountCurrency; 196 } 197 /** 198 * @param discountAmountCurrency The discountAmountCurrency to set. 199 */ 200 public void setDiscountAmountCurrency(String discountAmountCurrency) { 201 this.discountAmountCurrency = discountAmountCurrency; 202 } 203 /** 204 * @return Returns the dueAmount. 205 */ 206 public String getDueAmount() { 207 return dueAmount; 208 } 209 /** 210 * @param dueAmount The dueAmount to set. 211 */ 212 public void setDueAmount(String dueAmount) { 213 this.dueAmount = dueAmount; 214 } 215 /** 216 * @return Returns the dueAmountCurrency. 217 */ 218 public String getDueAmountCurrency() { 219 return dueAmountCurrency; 220 } 221 /** 222 * @param dueAmountCurrency The dueAmountCurrency to set. 223 */ 224 public void setDueAmountCurrency(String dueAmountCurrency) { 225 this.dueAmountCurrency = dueAmountCurrency; 226 } 227 /** 228 * @return Returns the grossAmount. 229 */ 230 public String getGrossAmount() { 231 return grossAmount; 232 } 233 /** 234 * @param grossAmount The grossAmount to set. 235 */ 236 public void setGrossAmount(String grossAmount) { 237 this.grossAmount = grossAmount; 238 } 239 /** 240 * @return Returns the grossAmountCurrency. 241 */ 242 public String getGrossAmountCurrency() { 243 return grossAmountCurrency; 244 } 245 /** 246 * @param grossAmountCurrency The grossAmountCurrency to set. 247 */ 248 public void setGrossAmountCurrency(String grossAmountCurrency) { 249 this.grossAmountCurrency = grossAmountCurrency; 250 } 251 /** 252 * @return Returns the netAmount. 253 */ 254 public String getNetAmount() { 255 return netAmount; 256 } 257 /** 258 * @param netAmount The netAmount to set. 259 */ 260 public void setNetAmount(String netAmount) { 261 this.netAmount = netAmount; 262 } 263 /** 264 * @return Returns the netAmountCurrency. 265 */ 266 public String getNetAmountCurrency() { 267 return netAmountCurrency; 268 } 269 /** 270 * @param netAmountCurrency The netAmountCurrency to set. 271 */ 272 public void setNetAmountCurrency(String netAmountCurrency) { 273 this.netAmountCurrency = netAmountCurrency; 274 } 275 /** 276 * @return Returns the shippingAmount. 277 */ 278 public String getShippingAmount() { 279 return shippingAmount; 280 } 281 /** 282 * @param shippingAmount The shippingAmount to set. 283 */ 284 public void setShippingAmount(String shippingAmount) { 285 this.shippingAmount = shippingAmount; 286 } 287 /** 288 * @return Returns the shippingAmountCurrency. 289 */ 290 public String getShippingAmountCurrency() { 291 return shippingAmountCurrency; 292 } 293 /** 294 * @param shippingAmountCurrency The shippingAmountCurrency to set. 295 */ 296 public void setShippingAmountCurrency(String shippingAmountCurrency) { 297 this.shippingAmountCurrency = shippingAmountCurrency; 298 } 299 /** 300 * @return Returns the specialHandlingAmount. 301 */ 302 public String getSpecialHandlingAmount() { 303 return specialHandlingAmount; 304 } 305 /** 306 * @param specialHandlingAmount The specialHandlingAmount to set. 307 */ 308 public void setSpecialHandlingAmount(String specialHandlingAmount) { 309 this.specialHandlingAmount = specialHandlingAmount; 310 } 311 /** 312 * @return Returns the specialHandlingAmountCurrency. 313 */ 314 public String getSpecialHandlingAmountCurrency() { 315 return specialHandlingAmountCurrency; 316 } 317 /** 318 * @param specialHandlingAmountCurrency The specialHandlingAmountCurrency to set. 319 */ 320 public void setSpecialHandlingAmountCurrency(String specialHandlingAmountCurrency) { 321 this.specialHandlingAmountCurrency = specialHandlingAmountCurrency; 322 } 323 /** 324 * @return the specialHandlingAmountDescription 325 */ 326 public String getSpecialHandlingAmountDescription() { 327 if (this.specialHandlingAmount != null) { 328 try { 329 if (BigDecimal.ZERO.compareTo(this.getInvoiceSpecialHandlingAmount()) != 0) { 330 return PurapConstants.ElectronicInvoice.DEFAULT_SPECIAL_HANDLING_DESCRIPTION; 331 } else { 332 return null; 333 } 334 } catch (Throwable t) { 335 return null; 336 } 337 } 338 return null; 339 } 340 341 /** 342 * @param specialHandlingAmountDescription the specialHandlingAmountDescription to set 343 */ 344 public void setSpecialHandlingAmountDescription(String specialHandlingAmountDescription) { 345 this.specialHandlingAmountDescription = specialHandlingAmountDescription; 346 } 347 /** 348 * @return Returns the subTotalAmount. 349 */ 350 public String getSubTotalAmount() { 351 return subTotalAmount; 352 } 353 /** 354 * @param subTotalAmount The subTotalAmount to set. 355 */ 356 public void setSubTotalAmount(String subTotalAmount) { 357 this.subTotalAmount = subTotalAmount; 358 } 359 /** 360 * @return Returns the subTotalAmountCurrency. 361 */ 362 public String getSubTotalAmountCurrency() { 363 return subTotalAmountCurrency; 364 } 365 /** 366 * @param subTotalAmountCurrency The subTotalAmountCurrency to set. 367 */ 368 public void setSubTotalAmountCurrency(String subTotalAmountCurrency) { 369 this.subTotalAmountCurrency = subTotalAmountCurrency; 370 } 371 /** 372 * @return Returns the taxAmount. 373 */ 374 public String getTaxAmount() { 375 return taxAmount; 376 } 377 /** 378 * @param taxAmount The taxAmount to set. 379 */ 380 public void setTaxAmount(String taxAmount) { 381 this.taxAmount = taxAmount; 382 } 383 /** 384 * @return Returns the taxAmountCurrency. 385 */ 386 public String getTaxAmountCurrency() { 387 return taxAmountCurrency; 388 } 389 /** 390 * @param taxAmountCurrency The taxAmountCurrency to set. 391 */ 392 public void setTaxAmountCurrency(String taxAmountCurrency) { 393 this.taxAmountCurrency = taxAmountCurrency; 394 } 395 /** 396 * @return Returns the taxDescription. 397 */ 398 public String getTaxDescription() { 399 return taxDescription; 400 } 401 /** 402 * @param taxDescription The taxDescription to set. 403 */ 404 public void setTaxDescription(String taxDescription) { 405 this.taxDescription = taxDescription; 406 } 407 408 public String getTaxCategory() { 409 return taxCategory; 410 } 411 412 public void setTaxCategory(String taxCategory) { 413 this.taxCategory = taxCategory; 414 } 415 416 public String getTaxPercentageRate() { 417 return taxPercentageRate; 418 } 419 420 public void setTaxPercentageRate(String taxPercentageRate) { 421 this.taxPercentageRate = taxPercentageRate; 422 } 423 424 public String getTaxPurpose() { 425 return taxPurpose; 426 } 427 428 public void setTaxPurpose(String taxPurpose) { 429 this.taxPurpose = taxPurpose; 430 } 431 432 // public String getTaxableAmount() { 433 // return taxableAmount; 434 // } 435 // 436 // public void setTaxableAmount(String taxableAmount) { 437 // this.taxableAmount = taxableAmount; 438 // } 439 // 440 // public String getTaxableAmountCurrency() { 441 // return taxableAmountCurrency; 442 // } 443 // 444 // public void setTaxableAmountCurrency(String taxableAmountCurrency) { 445 // this.taxableAmountCurrency = taxableAmountCurrency; 446 // } 447 448 public String toString(){ 449 ToStringBuilder toString = new ToStringBuilder(this); 450 toString.append("subTotalAmount",getSubTotalAmount()); 451 toString.append("subTotalAmountCurrency",getSubTotalAmountCurrency()); 452 toString.append("taxAmount",getTaxAmount()); 453 toString.append("taxAmountCurrency",getTaxAmountCurrency()); 454 // toString.append("taxableAmount",getTaxableAmount()); 455 // toString.append("taxableAmountCurrency",getTaxableAmountCurrency()); 456 toString.append("taxDescription",getTaxDescription()); 457 toString.append("taxPercentageRate",getTaxPercentageRate()); 458 toString.append("taxPurpose",getTaxPurpose()); 459 toString.append("taxCategory",getTaxCategory()); 460 toString.append("specialHandlingAmount",getSpecialHandlingAmount()); 461 toString.append("specialHandlingAmountCurrency",getSpecialHandlingAmountCurrency()); 462 toString.append("specialHandlingAmountDescription",getSpecialHandlingAmountDescription()); 463 toString.append("shippingAmount",getShippingAmount()); 464 toString.append("shippingAmountCurrency",getShippingAmountCurrency()); 465 toString.append("grossAmount",getGrossAmount()); 466 toString.append("grossAmountCurrency",getGrossAmountCurrency()); 467 toString.append("discountAmount",getDiscountAmount()); 468 toString.append("discountAmountCurrency",getDiscountAmountCurrency()); 469 toString.append("netAmount",getNetAmount()); 470 toString.append("netAmountCurrency",getNetAmountCurrency()); 471 toString.append("depositAmount",getDepositAmount()); 472 toString.append("depositAmountCurrency",getDepositAmountCurrency()); 473 toString.append("dueAmount",getDueAmount()); 474 toString.append("dueAmountCurrency",getDueAmountCurrency()); 475 476 return toString.toString(); 477 } 478 479 }