View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.kfs.module.ar.businessobject;
20  
21  import org.kuali.kfs.coa.businessobject.Account;
22  import org.kuali.kfs.coa.businessobject.ObjectCode;
23  import org.kuali.kfs.coa.service.AccountService;
24  import org.kuali.kfs.coa.service.ObjectCodeService;
25  import org.kuali.kfs.sys.businessobject.TaxDetail;
26  import org.kuali.kfs.sys.context.SpringContext;
27  import org.kuali.rice.core.api.util.type.KualiDecimal;
28  
29  public class SalesTaxCustomerInvoiceDetail extends CustomerInvoiceDetail {
30  
31      private TaxDetail taxDetail;
32      private CustomerInvoiceDetail customerInvoiceDetail;
33  
34      public SalesTaxCustomerInvoiceDetail(TaxDetail taxDetail, CustomerInvoiceDetail customerInvoiceDetail) {
35          this.taxDetail = taxDetail;
36          this.customerInvoiceDetail = customerInvoiceDetail;
37      }
38  
39      @Override
40      public Account getAccount() {
41          return SpringContext.getBean(AccountService.class).getByPrimaryId(taxDetail.getChartOfAccountsCode(), taxDetail.getAccountNumber());
42      }
43  
44      @Override
45      public String getAccountNumber() {
46          return taxDetail.getAccountNumber();
47      }
48  
49      @Override
50      public KualiDecimal getAmount() {
51          return taxDetail.getTaxAmount();
52      }
53  
54      @Override
55      public String getChartOfAccountsCode() {
56          return taxDetail.getChartOfAccountsCode();
57      }
58  
59  
60      @Override
61      public String getFinancialObjectCode() {
62          return taxDetail.getFinancialObjectCode();
63      }
64  
65      @Override
66      public ObjectCode getObjectCode() {
67          return SpringContext.getBean(ObjectCodeService.class).getByPrimaryIdForCurrentYear(taxDetail.getChartOfAccountsCode(), taxDetail.getFinancialObjectCode());
68      }
69  
70      /**
71       * This returns the AR object code from customer invoice detail because sales tax detail doesn't have AR info
72       * 
73       * @see org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail#getAccountsReceivableObject()
74       */
75      @Override
76      public ObjectCode getAccountsReceivableObject() {
77          return customerInvoiceDetail.getAccountsReceivableObject();
78      }
79      
80      @Override
81      public String getAccountsReceivableObjectCode() {
82          return customerInvoiceDetail.getAccountsReceivableObjectCode();
83      }    
84  
85      @Override
86      public String getFinancialSubObjectCode() {
87          return null;
88      }
89  
90      @Override
91      public String getOrganizationReferenceId() {
92          return null;
93      }
94  
95      @Override
96      public String getProjectCode() {
97          return null;
98      }
99  
100     @Override
101     public String getSubAccountNumber() {
102         return null;
103     }
104 
105 }