Esempio n. 1
0
        /// <summary>
        /// Calculates the invoice item total.
        /// </summary>
        /// <param name="itemization">
        /// The itemization.
        /// </param>
        /// <returns>
        /// The total.
        /// </returns>
        public static decimal CalculateTotal(this InvoiceItemItemization itemization)
        {
            var productTotal   = itemization.CalculateProductTotal();
            var shippingTotal  = itemization.CalculateShippingTotal();
            var taxTotal       = itemization.CalculateTaxTotal();
            var adjTotal       = itemization.CalculateAdjustmentTotal();
            var discountsTotal = itemization.CalculateDiscountTotal();
            var customTotal    = itemization.CalculateCustomTotal();

            return(productTotal + shippingTotal + taxTotal + customTotal + adjTotal - discountsTotal);
        }
 /// <summary>
 /// Reconciles the itemization.
 /// </summary>
 /// <param name="itemization">
 /// The itemization.
 /// </param>
 /// <returns>
 /// A value that indicates that the itemization could be reconciled.
 /// </returns>
 protected virtual bool Reconcile(InvoiceItemItemization itemization)
 {
     return(itemization.CalculateTotal() == this.Invoice.Total);
 }
Esempio n. 3
0
 /// <summary>
 /// Calculates the custom total.
 /// </summary>
 /// <param name="itemization">
 /// The itemization.
 /// </param>
 /// <returns>
 /// The <see cref="decimal"/>.
 /// </returns>
 public static decimal CalculateCustomTotal(this InvoiceItemItemization itemization)
 {
     return(InvoiceExtensions.Ensure2Places(itemization.Custom.Sum(x => x.Price * x.Quantity)));
 }