Exemple #1
0
        public int CompareTo(object obj)
        {
            EjLine ejl = obj as EjLine;

            return(this.SeqNo.CompareTo(ejl.SeqNo));            //ejl.Seq_no.CompareTo(this.Seq_no);
            //return 0;
        }
Exemple #2
0
        /**
         * Total order discount
         */
        public double EjWholeOrderDiscountTotal()
        {
            double total = 0;

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


                if (ejLine.State == (int)EjLineStates.VOID_SALE || ejLine.State == (int)EjLineStates.VOID_ITEM || ejLine.State == (int)EjLineStates.PRICE_OVERRIDE)
                {
                    continue;
                }


                switch (ejLine.LineType)
                {
                case (int)EjLineType.PROMOTION:
                    EjPromotion ejPromo = ejLine as EjPromotion;
                    if (ejPromo.Promotion.PromotionType == (int)EjPromotionTypes.WHOLE_ORDER)
                    {
                        total = PosContext.Instance.PosMath.Add(total, ejPromo.Amount);
                    }
                    break;

                default:
                    break;
                }
            }
            return(Math.Round(total, 2));
        }
Exemple #3
0
        public void EjAdd(object obj)
        {
            if (obj is EjLine)
            {
                EjLine ejLine = obj as EjLine;
                if (ejLine.LineType == (int)EjLineType.ITEM || ejLine.LineType == (int)EjLineType.SURCHARGE)
                {
                    this.line_no++;
                }
            }

            this.seq_no++;
            ejArrayList.Add(obj);

            if (obj is EjHeader)
            {
                this.ejHeader = (EjHeader)obj;
            }

            if (obj is EjSalesPerson)
            {
                EjSalesPerson ejPerson = obj as EjSalesPerson;
                this.SalesPerson.Add(ejPerson);
            }
        }
Exemple #4
0
        /**
         * Totals the tender amounts.
         */
        public double EjTotalTender()
        {
            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.CC_TENDER:
                case (int)EjLineType.CHECK_TENDER:
                case (int)EjLineType.ALT_CURRENCY_TENDER:
                case (int)EjLineType.COUPON:
                case (int)EjLineType.DEBIT_TENDER:
                case (int)EjLineType.GIFT_CERT_TENDER:
                case (int)EjLineType.TENDER:

                    EjTax ejTax = ejLine as EjTax;
                    total = PosContext.Instance.PosMath.Add(total, ejLine.ExtAmount);

                    break;

                default:
                    break;
                }
            }

            return(Math.Round(total, 2));
        }
Exemple #5
0
        /**
         * Totals tax records
         */
        public double EjTaxTotal()
        {
            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.TAX:
                    EjTax ejTax = ejLine as EjTax;
                    total = PosContext.Instance.PosMath.Add(total, ejTax.ExtAmount);
                    break;

                default:
                    break;
                }
            }
            return(Math.Round(total, 2));
        }
Exemple #6
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));
        }
Exemple #7
0
        // Implement IComparable CompareTo method - provide default sort order.
        int IComparable.CompareTo(object obj)
        {
            EjLine x = (EjLine)obj;

            if (x == null)
            {
                return(0);
            }

            try
            {
                if (x.SeqNo > this.SeqNo)
                {
                    return(1);
                }

                if (x.SeqNo < this.SeqNo)
                {
                    return(-1);
                }

                else
                {
                    return(0);
                }
            }
            catch
            {
                return(0);
            }
        }
Exemple #8
0
        int IComparer.Compare(Object x, Object y)
        {
            if (x == null || y == null)
            {
                return(0);
            }

            try
            {
                EjLine lineX = x as EjLine;
                EjLine lineY = y as EjLine;
                if (lineX.SeqNo > lineY.SeqNo)
                {
                    return(1);
                }

                if (lineX.SeqNo < lineY.SeqNo)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
            catch
            {
                return(0);
            }
        }
Exemple #9
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);
        }
        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;
                }
            }
        }
Exemple #11
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));
        }
Exemple #12
0
        public void Complete(int state)
        {
            if (PosContext.Instance.Training)
            {
                this.Clear();
                return;
            }

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

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

                // ejLine.State = state;
                switch (ejLine.LineType)
                {
                case (int)EjLineType.TRANS_HEADER:
                    EjHeader ejHeader = (EjHeader)ejLine;
                    if (!ejHeader.UpdateState(state))
                    {
                        MessageBox.Show("Error :- Unable to complete UpdateState-Ej");
                    }
                    break;

                case (int)EjLineType.ITEM:

                    ejLine.UpdateTotals();
                    EjItem ejItem = ejLine as EjItem;
                    ejItem.SaveState((EjLineStates)state);
                    if (state == (int)Transaction.Status.COMPLETE)
                    {
                        ejItem.UpdateStock();
                    }
                    break;

                case (int)EjLineType.PROMOTION:
                case (int)EjLineType.BANK:
                case (int)EjLineType.TENDER:
                case (int)EjLineType.CHECK_TENDER:
                case (int)EjLineType.CC_TENDER:
                case (int)EjLineType.GIFT_CERT_TENDER:
                case (int)EjLineType.DEBIT_TENDER:
                case (int)EjLineType.ALT_CURRENCY_TENDER:
                case (int)EjLineType.COUPON:
                case (int)EjLineType.ACCOUNT:
                case (int)EjLineType.TAX:
                case (int)EjLineType.SURCHARGE:

                    ejLine.UpdateTotals();


                    break;

                case (int)EjLineType.TOTAL:
                    break;

                default:
                    break;
                }
                // es01-26/11/08     if (!ejLine.Save())
                // es01-26/11/08     {
                // es01-26/11/08        MessageBox.Show("Error :- Unable to save Ej");
                // es01-26/11/08     }
            }

            //EjHeader ejHeader = (EjHeader)ejArrayList[0];
            //if (!ejHeader.UpdateState(state))
            //{
            //	MessageBox.Show("Error :- Unable to complete UpdateState-Ej");
            //}

            this.Clear();
        }
Exemple #13
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));
        }