예제 #1
0
        public virtual decimal GetAllowableCashDiscount(APAdjust apAdjust)
        {
            var totalJointAmountToPay = JointAmountToPayCalculationService
                                        .GetTotalJointAmountToPay(apAdjust).GetValueOrDefault();
            var cashDiscountWithJointPayees =
                GetAllowableCashDiscountConsiderJointPayees(apAdjust, totalJointAmountToPay);
            var cashDiscountWithDiscountBalance       = GetAllowableCashDiscountConsiderCashDiscountBalance(apAdjust);
            var cashDiscountWithBillBalance           = GetAllowableCashDiscountConsiderBillBalance(apAdjust);
            var cashDiscountWithVendorPreparedBalance = GetAllowableCashDiscountConsiderVendorPreparedBalance(apAdjust);
            var allowableCashDiscount = Math.Min(Math.Min(cashDiscountWithBillBalance, cashDiscountWithDiscountBalance),
                                                 cashDiscountWithVendorPreparedBalance);

            return(Math.Max(totalJointAmountToPay > 0
                ? Math.Min(cashDiscountWithJointPayees, allowableCashDiscount)
                : allowableCashDiscount, 0));
        }
 protected decimal?GetVendorPaymentAmount(APAdjust adjustment)
 {
     return(adjustment.CuryAdjgAmt - jointAmountToPayCalculationService.GetTotalJointAmountToPay(adjustment));
 }