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 package org.kuali.kfs.module.ar.report.util; 017 018 import java.sql.Date; 019 import java.util.HashMap; 020 import java.util.Map; 021 022 import org.kuali.kfs.coa.businessobject.Organization; 023 import org.kuali.kfs.module.ar.ArConstants; 024 import org.kuali.kfs.module.ar.businessobject.SystemInformation; 025 import org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader; 026 import org.kuali.kfs.sys.context.SpringContext; 027 import org.kuali.kfs.sys.service.UniversityDateService; 028 import org.kuali.rice.kns.service.BusinessObjectService; 029 import org.kuali.rice.kns.service.DateTimeService; 030 import org.kuali.rice.kns.util.KualiDecimal; 031 032 public class CustomerStatementDetailReportDataHolder { 033 034 private String documentNumber; 035 private Date documentFinalDate; 036 private String documentFinalDateString; 037 private String documentDescription; 038 private KualiDecimal financialDocumentTotalAmountCharge; 039 private KualiDecimal financialDocumentTotalAmountCredit; 040 private String orgName; 041 private String fein; 042 private String docType; 043 044 045 public CustomerStatementDetailReportDataHolder(FinancialSystemDocumentHeader docHeader, Organization processingOrg, String docType, KualiDecimal totalAmount) { 046 documentDescription = docHeader.getDocumentDescription(); 047 if (docType.equals(ArConstants.CREDIT_MEMO_DOC_TYPE)) { 048 financialDocumentTotalAmountCredit = totalAmount; 049 } else if (docType.equals(ArConstants.INVOICE_DOC_TYPE)) { 050 financialDocumentTotalAmountCharge = totalAmount; 051 } 052 documentNumber = docHeader.getDocumentNumber(); 053 this.setDocumentFinalDate(docHeader.getDocumentFinalDate()); 054 this.docType = docType; 055 orgName = processingOrg.getOrganizationName(); 056 057 String fiscalYear = SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear().toString(); 058 Map<String, String> criteria = new HashMap<String, String>(); 059 criteria.put("universityFiscalYear", fiscalYear); 060 criteria.put("processingChartOfAccountCode", processingOrg.getChartOfAccountsCode()); 061 criteria.put("processingOrganizationCode", processingOrg.getOrganizationCode()); 062 063 064 SystemInformation sysinfo = (SystemInformation)SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(SystemInformation.class, criteria); 065 fein = sysinfo.getUniversityFederalEmployerIdentificationNumber(); 066 067 } 068 069 /** 070 * Gets the documentNumber attribute. 071 * @return Returns the documentNumber. 072 */ 073 public String getDocumentNumber() { 074 return documentNumber; 075 } 076 077 /** 078 * Sets the documentNumber attribute value. 079 * @param documentNumber The documentNumber to set. 080 */ 081 public void setDocumentNumber(String documentNumber) { 082 this.documentNumber = documentNumber; 083 } 084 085 /** 086 * Gets the documentFinalDate attribute. 087 * @return Returns the documentFinalDate. 088 */ 089 public Date getDocumentFinalDate() { 090 return documentFinalDate; 091 } 092 093 /** 094 * 095 * This method formats the date value into a string that can then be used 096 * @return 097 */ 098 public String getDocumentFinalDateString() { 099 return documentFinalDateString; 100 } 101 102 /** 103 * Sets the documentFinalDate attribute value. 104 * @param documentFinalDate The documentFinalDate to set. 105 */ 106 public void setDocumentFinalDate(Date documentFinalDate) { 107 this.documentFinalDate = documentFinalDate; 108 this.documentFinalDateString = SpringContext.getBean(DateTimeService.class).toDateString(documentFinalDate); 109 } 110 111 /** 112 * Gets the documentDescription attribute. 113 * @return Returns the documentDescription. 114 */ 115 public String getDocumentDescription() { 116 return documentDescription; 117 } 118 119 /** 120 * Sets the documentDescription attribute value. 121 * @param documentDescription The documentDescription to set. 122 */ 123 public void setDocumentDescription(String documentDescription) { 124 this.documentDescription = documentDescription; 125 } 126 127 /** 128 * Gets the orgName attribute. 129 * @return Returns the orgName. 130 */ 131 public String getOrgName() { 132 return orgName; 133 } 134 135 /** 136 * Sets the orgName attribute value. 137 * @param orgName The orgName to set. 138 */ 139 public void setOrgName(String orgName) { 140 this.orgName = orgName; 141 } 142 143 /** 144 * Gets the fein attribute. 145 * @return Returns the fein. 146 */ 147 public String getFein() { 148 return fein; 149 } 150 151 /** 152 * Sets the fein attribute value. 153 * @param fein The fein to set. 154 */ 155 public void setFein(String fein) { 156 this.fein = fein; 157 } 158 159 /** 160 * Gets the docType attribute. 161 * @return Returns the docType. 162 */ 163 public String getDocType() { 164 return docType; 165 } 166 167 /** 168 * Sets the docType attribute value. 169 * @param docType The docType to set. 170 */ 171 public void setDocType(String docType) { 172 this.docType = docType; 173 } 174 175 /** 176 * Gets the financialDocumentTotalAmountCharge attribute. 177 * @return Returns the financialDocumentTotalAmountCharge. 178 */ 179 public KualiDecimal getFinancialDocumentTotalAmountCharge() { 180 return financialDocumentTotalAmountCharge; 181 } 182 183 /** 184 * Sets the financialDocumentTotalAmountCharge attribute value. 185 * @param financialDocumentTotalAmountCharge The financialDocumentTotalAmountCharge to set. 186 */ 187 public void setFinancialDocumentTotalAmountCharge(KualiDecimal financialDocumentTotalAmountCharge) { 188 this.financialDocumentTotalAmountCharge = financialDocumentTotalAmountCharge; 189 } 190 191 /** 192 * Gets the financialDocumentTotalAmountCredit attribute. 193 * @return Returns the financialDocumentTotalAmountCredit. 194 */ 195 public KualiDecimal getFinancialDocumentTotalAmountCredit() { 196 return financialDocumentTotalAmountCredit; 197 } 198 199 /** 200 * Sets the financialDocumentTotalAmountCredit attribute value. 201 * @param financialDocumentTotalAmountCredit The financialDocumentTotalAmountCredit to set. 202 */ 203 public void setFinancialDocumentTotalAmountCredit(KualiDecimal financialDocumentTotalAmountCredit) { 204 this.financialDocumentTotalAmountCredit = financialDocumentTotalAmountCredit; 205 } 206 207 208 } 209