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.businessobject;
017
018 import org.kuali.kfs.coa.businessobject.Account;
019 import org.kuali.kfs.coa.businessobject.ObjectCode;
020 import org.kuali.kfs.coa.service.AccountService;
021 import org.kuali.kfs.coa.service.ObjectCodeService;
022 import org.kuali.kfs.sys.businessobject.TaxDetail;
023 import org.kuali.kfs.sys.context.SpringContext;
024 import org.kuali.kfs.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.GENERAL_LEDGER_PENDING_ENTRY_CODE;
025 import org.kuali.rice.kns.service.BusinessObjectService;
026 import org.kuali.rice.kns.util.KualiDecimal;
027
028 public class SalesTaxCustomerInvoiceDetail extends CustomerInvoiceDetail {
029
030 private TaxDetail taxDetail;
031 private CustomerInvoiceDetail customerInvoiceDetail;
032
033 public SalesTaxCustomerInvoiceDetail(TaxDetail taxDetail, CustomerInvoiceDetail customerInvoiceDetail) {
034 this.taxDetail = taxDetail;
035 this.customerInvoiceDetail = customerInvoiceDetail;
036 }
037
038 @Override
039 public Account getAccount() {
040 return SpringContext.getBean(AccountService.class).getByPrimaryId(taxDetail.getChartOfAccountsCode(), taxDetail.getAccountNumber());
041 }
042
043 @Override
044 public String getAccountNumber() {
045 return taxDetail.getAccountNumber();
046 }
047
048 @Override
049 public KualiDecimal getAmount() {
050 return taxDetail.getTaxAmount();
051 }
052
053 @Override
054 public String getChartOfAccountsCode() {
055 return taxDetail.getChartOfAccountsCode();
056 }
057
058
059 @Override
060 public String getFinancialObjectCode() {
061 return taxDetail.getFinancialObjectCode();
062 }
063
064 @Override
065 public ObjectCode getObjectCode() {
066 return SpringContext.getBean(ObjectCodeService.class).getByPrimaryIdForCurrentYear(taxDetail.getChartOfAccountsCode(), taxDetail.getFinancialObjectCode());
067 }
068
069 /**
070 * This returns the AR object code from customer invoice detail because sales tax detail doesn't have AR info
071 *
072 * @see org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail#getAccountsReceivableObject()
073 */
074 @Override
075 public ObjectCode getAccountsReceivableObject() {
076 return customerInvoiceDetail.getAccountsReceivableObject();
077 }
078
079 @Override
080 public String getAccountsReceivableObjectCode() {
081 return customerInvoiceDetail.getAccountsReceivableObjectCode();
082 }
083
084 @Override
085 public String getFinancialSubObjectCode() {
086 return null;
087 }
088
089 @Override
090 public String getOrganizationReferenceId() {
091 return null;
092 }
093
094 @Override
095 public String getProjectCode() {
096 return null;
097 }
098
099 @Override
100 public String getSubAccountNumber() {
101 return null;
102 }
103
104 }