Esempio n. 1
0
        /**
         * Sub-totals the current ej.
         */
        public double EjSubTotal()
        {
            double total = 0;

            foreach (Object obj in ejArrayList)
            {
                EjLine ejLine = (EjLine)obj;

                if (ejLine.State != (int)EjLineStates.IN_PROGRESS)
                {
                    continue;
                }


                switch (ejLine.LineType)
                {
                case (int)EjLineType.ITEM:

                    TransItem transItem = ejLine.DataRecord() as TransItem;
                    if (transItem.State != (int)EjLineStates.VOID_ITEM)
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    }
                    break;

                case (int)EjLineType.SURCHARGE:

                    TransItem transItem1 = ejLine.DataRecord() as TransItem;
                    if (transItem1.State != (int)EjLineStates.VOID_ITEM)
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    }
                    break;

                case (int)EjLineType.ITEM_LINK:
                    //	transItem = (TransItem) (context.currItem ().dataRecord ());
                    //	if (transItem.state () != TransItem.VOID)
                    //	{
                    //		total = context.posMath ().add (total, line.extAmount ());
                    //	}
                    break;

                case (int)EjLineType.PROMOTION:
                    EjPromotion ejPromotion = ejLine as EjPromotion;
                    //if (ejPromotion.Applied )
                    //{
                    if (ejPromotion.State != (int)EjLineStates.VOID_ITEM)
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    }
                    //}
                    break;

                case (int)EjLineType.ACCOUNT:
                    EjReceiveOnAccount onAcc = ejLine as EjReceiveOnAccount;
                    total = PosContext.Instance.PosMath.Add(total, onAcc.TenderAmount);
                    break;


                default:
                    break;
                }
            }
            return(Math.Round(total, 2));
        }
Esempio n. 2
0
        public double EjTotal()
        {
            double total    = 0;
            bool   applyTax = true;

            foreach (Object obj in ejArrayList)
            {
                EjLine ejLine = (EjLine)obj;


                //if (ejLine.State != (int)EjLineStates.IN_PROGRESS) continue;


                switch (ejLine.LineType)
                {
                case (int)EjLineType.ITEM:

                    EjItem ejItem = (EjItem)ejLine;

                    // set apply tax flag
                    if (ejItem.TaxInclusive == 0)
                    {
                        applyTax = true;
                    }
                    else
                    {
                        applyTax = false;
                    }

                    TransItem transItem = (TransItem)ejLine.DataRecord();
                    if ((transItem.State != (int)EjLineStates.VOID_ITEM) && (transItem.State != (int)EjLineStates.PRICE_OVERRIDE))
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    }
                    break;

                case (int)EjLineType.SURCHARGE:

                    EjSurcharge ejSurcharge = (EjSurcharge)ejLine;

                    // set apply tax flag
                    if (ejSurcharge.TaxInclusive == 0)
                    {
                        applyTax = true;
                    }
                    else
                    {
                        applyTax = false;
                    }

                    TransItem transItem1 = (TransItem)ejLine.DataRecord();
                    if (transItem1.State != (int)EjLineStates.VOID_ITEM)
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    }
                    break;


                case (int)EjLineType.ITEM_LINK:
                    //	transItem = (TransItem) (context.currItem ().dataRecord ());
                    //	if (transItem.state () != TransItem.VOID)
                    //	{
                    //		total = context.posMath ().add (total, line.extAmount ());
                    //	}
                    break;

                case (int)EjLineType.TAX:
                    EjTax tax = (EjTax)ejLine;

                    if (applyTax)
                    {
                        //	if (tax.taxRecord ().taxable () > 0.0)
                        //	{
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                        //	}
                    }
                    break;

                case (int)EjLineType.PROMOTION:
                    EjPromotion ejPromotion = ejLine as EjPromotion;
                    //if (ejPromotion.Applied )
                    //{
                    if (ejPromotion.State != (int)EjLineStates.VOID_ITEM)
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    }
                    //}
                    break;

                case (int)EjLineType.ACCOUNT:
                    EjReceiveOnAccount onAcc = ejLine as EjReceiveOnAccount;
                    total = PosContext.Instance.PosMath.Add(total, onAcc.TenderAmount);
                    break;

                default:
                    break;
                }
            }

            return(Math.Round(total, 2));
        }