CostCalculator.java 文件源码

java
阅读 790 收藏 0 点赞 0 评论 0

项目:oscm 作者:
/**
 * Calculates the VAT details for the given VAT and cost data.
 * 
 * @param vatForCustomer
 *            The VAT details to be considered.
 * @return The VAT details containing the VAT amount and the total amount.
 */
public static VatRateDetails calculateVATCosts(VatRateDetails vatForCustomer) {
    BigDecimal totalCosts = vatForCustomer.getNetCosts();
    BigDecimal vatRate = vatForCustomer.getEffectiveVatRateForCustomer();
    if (vatRate != null) {
        BigDecimal fixSum = BigDecimal.ONE;
        BigDecimal percentBaseFactor = new BigDecimal(100);
        BigDecimal factor = fixSum.add(vatRate.divide(percentBaseFactor));
        BigDecimal total = totalCosts.multiply(factor).setScale(
                PriceConverter.NORMALIZED_PRICE_SCALING,
                RoundingMode.HALF_UP);
        totalCosts = total;
    }
    vatForCustomer.setTotalCosts(totalCosts);
    return vatForCustomer;
}
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号