Ejemplo n.º 1
0
        public void EffectChangeQuantity(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.Quantity = this.newQuantity;

                        transItem.Ext_amount = PosContext.Instance.PosMath.Mult(transItem.Amount, this.newQuantity);
                        transItem.Ext_amount = PosContext.Instance.PosMath.Mult(transItem.Ext_amount, PosContext.Instance.Sign);

                        transItem.UpdateAmounts();

                        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;
                }
            }
        }
Ejemplo n.º 2
0
        private void VoidCurrentItem()
        {
            ItemList itemList = new ItemList(PosContext.Instance.CurrentEjItem, PosContext.Instance.CurrentEj);

            for (int i = 0; i < itemList.Count; i++)
            {
                Object obj    = itemList[i];
                EjLine ejLine = (EjLine)obj;

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

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

                    if (transItem.State != (int)EjLineStates.VOID_ITEM)
                    {      // already voided?
                        transItem.State = (int)EjLineStates.VOID_ITEM;
                        transItem.UpdateState();
                        PosContext.Instance.Receipt.Update((EjItem)ejLine);
                    }
                    break;

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

                case (int)EjLineType.PROMOTION:
                    TransPromotion itemPromo = (TransPromotion)ejLine.DataRecord();
                    if (itemPromo.State != (int)EjLineStates.VOID_ITEM)
                    {      // already voided?
                        itemPromo.State = (int)EjLineStates.VOID_ITEM;
                        itemPromo.UpdateState();
                        PosContext.Instance.Receipt.Update((EjPromotion)ejLine);
                    }
                    //  itemPromo.PromotionAmount = 0;
                    break;

                case (int)EjLineType.TAX:
                    TransTax itemTax = ejLine.DataRecord() as TransTax;

                    itemTax.State = (int)EjLineStates.VOID_ITEM;
                    itemTax.UpdateState();
                    ///	itemTax.TaxAmount = 0.0;
                    //  itemTax.TaxableAmount = 0.0;
                    // ejLine.ExtAmount = 0;
                    // ejLine.TaxAmount = 0;
                    // ejLine.Amount = 0;
                    PosContext.Instance.Receipt.Update((EjTax)ejLine);
                    break;

                case (int)EjLineType.SURCHARGE:
                    TransItem transSurcharge = (TransItem)ejLine.DataRecord();

                    if (transSurcharge.State != (int)EjLineStates.VOID_ITEM)
                    {      // already voided?
                        transSurcharge.State = (int)EjLineStates.VOID_ITEM;
                        transSurcharge.UpdateState();
                        PosContext.Instance.Receipt.Update((EjSurcharge)ejLine);
                    }

                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public void Apply()
        {
            applied = false;
            int applyCount = 0;

            totalDiscount = 0;
            double itemAmount = item.Amount;

            if (itemAmount < 0.0)
            {
                itemAmount *= -1.0;
            }

            Ej ej = PosContext.Instance.CurrentEj;

            foreach (Object obj in ej.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 (item.SKU.Equals(transItem.Sku))
                    {
                        applyCount = applyCount + (int)transItem.Quantity;
                    }
                    break;


                case (int)EjLineType.PROMOTION:
                    EjPromotion ejPromotion = ejLine as EjPromotion;
                    if (this.item.SKU.Equals(ejPromotion.SKU))
                    {
                        applyCount = applyCount - (int)ejPromotion.Quantity;
                    }

                    break;


                default:
                    break;
                }
            }

            //Remaining Qty to apply the promotion
            if (applyCount >= promotion.PromotionVal1)
            {
                //Actual price
                double promoPrice = promotion.PromotionDval1 / promotion.PromotionVal1;
                // Discount for on
                double discount = item.Amount - promoPrice;
                //caluclate N
                this.promoQty = applyCount - (int)applyCount % promotion.PromotionVal1;


                totalDiscount = PosContext.Instance.PosMath.Mult(this.promoQty, discount);
                // totalDiscount = PosContext.Instance.PosMath.Negate(totalDiscount);
                this.applied = true;
            }
        }
Ejemplo n.º 4
0
        private void VoidLine(int lineNumber)
        {
            ArrayList ejList = PosContext.Instance.CurrentEj.EjArrayList;

            foreach (object obj in ejList)
            {
                EjLine ejLine = obj as EjLine;
                if (ejLine.LineNo != lineNumber)
                {
                    continue;
                }
                switch (ejLine.LineType)
                {
                case (int)EjLineType.ITEM:

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

                    if (transItem.State != (int)EjLineStates.VOID_ITEM)
                    {      // already voided?
                        transItem.State = (int)EjLineStates.VOID_ITEM;
                        transItem.UpdateState();
                        PosContext.Instance.Receipt.Update((EjItem)ejLine);
                    }
                    break;

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

                case (int)EjLineType.PROMOTION:
                    TransPromotion itemPromo = (TransPromotion)ejLine.DataRecord();
                    if (itemPromo.State != (int)EjLineStates.VOID_ITEM)
                    {      // already voided?
                        itemPromo.State = (int)EjLineStates.VOID_ITEM;
                        itemPromo.UpdateState();

                        if (itemPromo.PromotionType == (int)EjPromotionTypes.WHOLE_ORDER)
                        {
                            PosContext.Instance.SaleMode = null;
                        }
                        PosContext.Instance.Receipt.Update((EjPromotion)ejLine);
                    }
                    //  itemPromo.PromotionAmount = 0;
                    break;

                case (int)EjLineType.TAX:
                    TransTax itemTax = ejLine.DataRecord() as TransTax;

                    itemTax.State = (int)EjLineStates.VOID_ITEM;
                    itemTax.UpdateState();
                    ///	itemTax.TaxAmount = 0.0;
                    //  itemTax.TaxableAmount = 0.0;
                    // ejLine.ExtAmount = 0;
                    // ejLine.TaxAmount = 0;
                    // ejLine.Amount = 0;
                    PosContext.Instance.Receipt.Update((EjTax)ejLine);
                    break;

                case (int)EjLineType.SURCHARGE:
                    TransItem transSurcharge = (TransItem)ejLine.DataRecord();

                    if (transSurcharge.State != (int)EjLineStates.VOID_ITEM)
                    {      // already voided?
                        transSurcharge.State = (int)EjLineStates.VOID_ITEM;
                        transSurcharge.UpdateState();
                        PosContext.Instance.Receipt.Update((EjSurcharge)ejLine);
                    }

                    break;
                }
            }
        }