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;
}
Aggregations