Beispiel #1
0
        /**
         * Totals the current ej, exclueds surcharges, order discounts.
         */
        public double EjGrossTotal()
        {
            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.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.Promotion.PromotionType == (int)EjPromotionTypes.WHOLE_ORDER)
                    {
                        break;
                    }
                    if (ejPromotion.State == (int)EjLineStates.VOID_ITEM)
                    {
                        break;
                    }

                    total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);
                    break;


                default:
                    break;
                }
            }

            return(Math.Round(total, 2));
        }
Beispiel #2
0
//		public void  RemoveCurrLine()
//		{
//			if (this.EjArrayList.Count > 0 )
//			{
//				this.EjArrayList.RemoveAt(this.ejArrayList.Count-1);
//
//			}
//		}


        /*  public EjLine GetCurrentLine()
         * {
         *    if (this.EjArrayList.Count > 0)
         *    {
         *        return this.EjArrayList[this.ejArrayList.Count - 1] as EjLine;
         *
         *    }
         *
         *    return null;
         *
         * }
         * */


        public double EjQtyTotal()
        {
            double total = 0;

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

                if (ejLine.LineType == (int)EjLineType.ITEM)
                {
                    TransItem transItem = ejLine.DataRecord() as TransItem;
                    if (transItem.State != (int)EjLineStates.VOID_ITEM)
                    {
                        //total = PosContext.Instance.PosMath.Add(total, ejLine.Quantity);
                        total++;
                    }
                }
            }
            return(total);
        }
Beispiel #3
0
        public void ChangePrice(int lineNumber)
        {
            object[] ejList = PosContext.Instance.CurrentEj.EjArrayList.ToArray();
            foreach (object obj in ejList)
            {
                EjLine ejLine = obj as EjLine;
                if (ejLine.LineNo != lineNumber)
                {
                    continue;
                }
                switch (ejLine.LineType)
                {
                case (int)EjLineType.ITEM:

                    this.ejItem = ejLine as EjItem;

                    this.transItem = (TransItem)ejLine.DataRecord();

                    if (transItem.State != (int)EjLineStates.VOID_ITEM)
                    {
                        //transItem = PosContext.Instance.CurrentEjItem.TransItem;


                        //Create a price oveeride audit ( New line )
                        EclipsePos.Data.TransItem transItemAudit = new TransItem();
                        transItemAudit.Trans_no        = transItem.Trans_no;
                        transItemAudit.Organization_no = transItem.Organization_no;
                        transItemAudit.Store_no        = transItem.Store_no;
                        transItemAudit.Pos_no          = transItem.Pos_no;
                        transItemAudit.Sku_link        = transItem.Sku_link;
                        transItemAudit.Sku             = transItem.Sku;
                        transItemAudit.Item_desc       = transItem.Item_desc;
                        transItemAudit.Quantity        = transItem.Quantity;

                        transItemAudit.Amount     = transItem.Amount;
                        transItemAudit.Ext_amount = transItem.Ext_amount;     //PosContext.Instance.PosMath.Mult(transItem.Quantity, changedTransItem.Amount);
                        transItemAudit.State      = (int)EjLineStates.PRICE_OVERRIDE;



                        transItemAudit.Tax_exempt = transItem.Tax_exempt;
                        transItemAudit.Tax_incl   = transItem.Tax_incl;
                        transItemAudit.State      = (int)EjLineStates.PRICE_OVERRIDE;

                        EjItem ejItem = new EjItem(transItemAudit);

                        // Add to Ej to set the seq no and line no's
                        PosContext.Instance.CurrentEj.EjAdd(ejItem);

                        transItemAudit.Line_no = PosContext.Instance.CurrentEj.LineNo;
                        transItemAudit.Seq_no  = PosContext.Instance.CurrentEj.SeqNo;

                        transItemAudit.Add();



                        //Now change the current line to reflect the price change
                        transItem.Amount = newAmount;

                        transItem.Ext_amount = PosContext.Instance.PosMath.Mult(transItem.Quantity, newAmount);
                        transItem.Ext_amount = PosContext.Instance.PosMath.Mult(transItem.Ext_amount, PosContext.Instance.Sign);

                        transItem.UpdateAmounts();

                        this.ejItem.Desc = "*" + ejItem.Desc;
                        PosContext.Instance.Operprompt.Update(this.ejItem);
                        PosContext.Instance.Receipt.Update(this);
                    }
                    break;

                case (int)EjLineType.ITEM_LINK:
                    //	TransItemLink itemLink = (TransItemLink) line.dataRecord ();
                    //	itemLink.setAmount (0.0);
                    break;



                case (int)EjLineType.TAX:
                    EjTax itemTax = (EjTax)ejLine as EjTax;
                    //itemTax.ApplyTax();


                    break;
                }
            }
        }
Beispiel #4
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));
        }
Beispiel #5
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));
        }