Exemplo n.º 1
0
            private void AddTaxCode(RequestContext context, TaxableItem taxableItem, TaxCodeInterval taxCodeInterval, Dictionary <string, TaxCode> codes, SalesTransaction transaction)
            {
                TaxCode code = this.GetTaxCode(context, taxableItem, taxCodeInterval, transaction);

                codes.Add(code.Code, code);
                this.transactionTaxCodes.Add(code);
            }
Exemplo n.º 2
0
            /// <summary>
            /// Initializes a new instance of the <see cref="TaxCode"/> class.
            /// </summary>
            /// <param name="context">The request context.</param>
            /// <param name="lineItem">The taxable line item.</param>
            /// <param name="interval">The tax code interval.</param>
            /// <param name="taxContext">Tax context.</param>
            /// <param name="transaction">Current transaction.</param>
            public TaxCode(RequestContext context, TaxableItem lineItem, TaxCodeInterval interval, TaxContext taxContext, SalesTransaction transaction)
            {
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }

                if (interval == null)
                {
                    throw new ArgumentNullException("interval");
                }

                this.Code                 = interval.TaxCode;
                this.TaxableEntity        = lineItem;
                this.TaxGroup             = interval.TaxItemGroup;
                this.Currency             = interval.TaxCurrencyCode;
                this.Exempt               = interval.IsTaxExempt;
                this.TaxBase              = (TaxBase)interval.TaxBase;
                this.TaxLimitBase         = (TaxLimitBase)interval.TaxLimitBase;
                this.TaxCalculationMethod = (TaxCalculationMode)interval.TaxCalculationMethod;
                this.TaxOnTax             = interval.TaxOnTax;
                this.Unit                 = interval.TaxUnit;
                this.RoundingOff          = interval.TaxRoundOff;
                this.RoundingOffType      = Rounding.ConvertRoundOffTypeToRoundingMethod(interval.TaxRoundOffType);
                this.CollectLimitMax      = interval.TaxMaximum;
                this.CollectLimitMin      = interval.TaxMinimum;
                this.TaxGroupRounding     = interval.IsGroupRounding;
                this.IsTaxIncludedInTax   = interval.IsTaxIncludedInTax;

                this.TaxIntervals = new Collection <TaxInterval>(new List <TaxInterval>(1));

                // should this be removed in favor of intervals?
                this.Value          = interval.TaxValue;
                this.TaxLimitMin    = interval.TaxLimitMinimum;
                this.TaxLimitMax    = interval.TaxLimitMaximum;
                this.RequestContext = context;
                this.Transaction    = transaction;
                this.TaxIntervals.Add(new TaxInterval(interval.TaxLimitMinimum, interval.TaxLimitMaximum, interval.TaxValue));

                this.TaxContext = taxContext;
            }
Exemplo n.º 3
0
            /// <summary>
            /// Gets the tax code.
            /// </summary>
            /// <param name="context">The request context.</param>
            /// <param name="taxableItem">The taxable item.</param>
            /// <param name="taxCodeInterval">The tax code interval.</param>
            /// <param name="transaction">Current transaction.</param>
            /// <returns>The tax code object.</returns>
            protected virtual TaxCode GetTaxCode(RequestContext context, TaxableItem taxableItem, TaxCodeInterval taxCodeInterval, SalesTransaction transaction)
            {
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }

                return(new TaxCode(context, taxableItem, taxCodeInterval, this.TaxContext, transaction));
            }
            /// <summary>
            /// Gets the tax code.
            /// </summary>
            /// <param name="context">The request context.</param>
            /// <param name="taxableItem">The taxable item.</param>
            /// <param name="taxCodeInterval">The tax code interval.</param>
            /// <param name="transaction">Current transaction.</param>
            /// <returns>The tax code object.</returns>
            protected override TaxCode GetTaxCode(RequestContext context, TaxableItem taxableItem, TaxCodeInterval taxCodeInterval, SalesTransaction transaction)
            {
                if (context == null)
                {
                    throw new ArgumentNullException("context");
                }

                TaxCodeIntervalIndia taxCodeIntervalIndia = taxCodeInterval as TaxCodeIntervalIndia;

                if (taxCodeIntervalIndia.TaxType == TaxTypeIndia.None)
                {
                    return(base.GetTaxCode(context, taxableItem, taxCodeInterval, transaction));
                }
                else
                {
                    return(new TaxCodeIndia(context, taxableItem, taxCodeIntervalIndia, this.TaxContext, transaction));
                }
            }