Search in sources :

Example 1 with CustomerInvoiceItemCode

use of org.kuali.kfs.module.ar.businessobject.CustomerInvoiceItemCode in project cu-kfs by CU-CommunityApps.

the class CustomerInvoiceDetailServiceImpl method getCustomerInvoiceDetailFromCustomerInvoiceItemCode.

@Override
public CustomerInvoiceDetail getCustomerInvoiceDetailFromCustomerInvoiceItemCode(String invoiceItemCode, String chartOfAccountsCode, String organizationCode) {
    Map<String, String> criteria = new HashMap<>();
    criteria.put("invoiceItemCode", invoiceItemCode);
    criteria.put("chartOfAccountsCode", chartOfAccountsCode);
    criteria.put("organizationCode", organizationCode);
    CustomerInvoiceItemCode customerInvoiceItemCode = businessObjectService.findByPrimaryKey(CustomerInvoiceItemCode.class, criteria);
    CustomerInvoiceDetail customerInvoiceDetail = null;
    if (ObjectUtils.isNotNull(customerInvoiceItemCode)) {
        customerInvoiceDetail = new CustomerInvoiceDetail();
        customerInvoiceDetail.setChartOfAccountsCode(customerInvoiceItemCode.getDefaultInvoiceChartOfAccountsCode());
        customerInvoiceDetail.setAccountNumber(customerInvoiceItemCode.getDefaultInvoiceAccountNumber());
        customerInvoiceDetail.setSubAccountNumber(customerInvoiceItemCode.getDefaultInvoiceSubAccountNumber());
        customerInvoiceDetail.setFinancialObjectCode(customerInvoiceItemCode.getDefaultInvoiceFinancialObjectCode());
        customerInvoiceDetail.setFinancialSubObjectCode(customerInvoiceItemCode.getDefaultInvoiceFinancialSubObjectCode());
        customerInvoiceDetail.setProjectCode(customerInvoiceItemCode.getDefaultInvoiceProjectCode());
        customerInvoiceDetail.setOrganizationReferenceId(customerInvoiceItemCode.getDefaultInvoiceOrganizationReferenceIdentifier());
        customerInvoiceDetail.setInvoiceItemCode(customerInvoiceItemCode.getInvoiceItemCode());
        customerInvoiceDetail.setInvoiceItemDescription(customerInvoiceItemCode.getInvoiceItemDescription());
        customerInvoiceDetail.setInvoiceItemUnitPrice(customerInvoiceItemCode.getItemDefaultPrice());
        customerInvoiceDetail.setInvoiceItemUnitOfMeasureCode(customerInvoiceItemCode.getDefaultUnitOfMeasureCode());
        customerInvoiceDetail.setInvoiceItemQuantity(customerInvoiceItemCode.getItemDefaultQuantity());
        customerInvoiceDetail.setTaxableIndicator(customerInvoiceItemCode.isTaxableIndicator());
        // TODO set sales tax accordingly
        customerInvoiceDetail.setInvoiceItemTaxAmount(new KualiDecimal(0.00));
        // set amount = unit price * quantity
        customerInvoiceDetail.updateAmountBasedOnQuantityAndUnitPrice();
    }
    return customerInvoiceDetail;
}
Also used : CustomerInvoiceItemCode(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceItemCode) HashMap(java.util.HashMap) AccountsReceivableCustomerInvoiceDetail(org.kuali.kfs.integration.ar.AccountsReceivableCustomerInvoiceDetail) CustomerInvoiceDetail(org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail) KualiDecimal(org.kuali.kfs.core.api.util.type.KualiDecimal)

Aggregations

HashMap (java.util.HashMap)1 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)1 AccountsReceivableCustomerInvoiceDetail (org.kuali.kfs.integration.ar.AccountsReceivableCustomerInvoiceDetail)1 CustomerInvoiceDetail (org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail)1 CustomerInvoiceItemCode (org.kuali.kfs.module.ar.businessobject.CustomerInvoiceItemCode)1