Exemplo n.º 1
0
        public void LoadEj(TableButtonData bData)
        {
            Transaction trans = new Transaction(bData.Trans_no);

            trans.Pos_no          = bData.Pos_no;
            trans.Organization_no = PosSettings.Default.Organization;
            trans.Store_no        = PosSettings.Default.Store;
            trans.Load();
            if (trans.State == (int)Transaction.Status.SUSPEND)
            {  // was this a suspended transaction?
                PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans);

                if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0)
                {  // finally make sure there are records
                    PosContext.Instance.TableName = trans.Table_name;
                    trans.State = (int)Transaction.Status.IN_PROGRESS;
                    foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList)
                    {
                        EjLine line = (EjLine)obj;
                        PosContext.Instance.Receipt.Update(line);
                    }

                    //	context ().homeGuis ();
                    //	context ().eventStack ().setEvent (new FirstItem (context ()));
                    //this.States().Clear();
                    //	PosEventStack.Instance.NextEvent();
                }
            }
        }
Exemplo n.º 2
0
        private bool LoadEj(int transNo)
        {
            //PrintJobQueue.Instance.Clear();

            Transaction trans = new Transaction(transNo);

            trans.Organization_no = PosSettings.Default.Organization;
            trans.Store_no        = PosSettings.Default.Store;
            trans.Pos_no          = PosSettings.Default.Station;
            //   trans.State = (int)Transaction.Status.SUSPEND;

            trans.Load();

            if (trans.Trans_no != 0)
            {  // was this a suspended transaction?
                PosContext.Instance.CurrentEj       = Ej.GetSuspendedEj(trans);
                PosContext.Instance.TransactionType = trans.Trans_type;
                PosContext.Instance.TableName       = trans.Table_name;

                if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0)
                {  // finally make sure there are records
                    PosContext.Instance.TableName = trans.Table_name;
                    PosContext.Instance.TrxNo     = trans.Trans_no;
                    trans.State = (int)Transaction.Status.IN_PROGRESS;

                    foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList)
                    {
                        EjLine line = (EjLine)obj;
                        if (line is EjPromotion)
                        {
                            EjPromotion ejPromo = line as EjPromotion;
                            if (ejPromo.LineType == (int)EjPromotionTypes.WHOLE_ORDER)
                            {
                                PosContext.Instance.SaleMode = ejPromo.Promotion;
                            }
                        }
                        PosContext.Instance.Receipt.Update(line);
                    }
                }

                if (trans.Customer_tax_id.Length > 0)
                {
                    EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer();
                    cus.Organization_no = PosSettings.Default.Organization;
                    cus.Tax_id          = trans.Customer_tax_id;
                    cus.LoadByTaxID();
                    EjCustomer ejCus = new EjCustomer(cus);
                    PosContext.Instance.Receipt.Update(ejCus);
                    PosContext.Instance.EjCustomer = ejCus;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        private void VoidEj(Ej ej)
        {
            if (PosContext.Instance.Training)
            {
                return;
            }

            foreach (Object obj in ej.EjArrayList)
            {
                EjLine ejLine    = (EjLine)obj;
                int    voidState = (int)Transaction.Status.VOIDED;
                // if (ejLine.State != (int)EjLineStates..IN_PROGRESS) continue;


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

                case (int)EjLineType.ITEM:
                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;
                }
            }
        }
Exemplo n.º 4
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;
                }
            }
        }
Exemplo n.º 5
0
        public void  PrintEj()
        {
            foreach (Object obj in this.ej.EjArrayList)
            {
                if (obj is EjLine)
                {
                    EjLine ejLine = (EjLine)obj;

                    if ((ejLine.LineType == (int)EjLineType.ALT_CURRENCY_TENDER) ||
                        (ejLine.LineType == (int)EjLineType.DEBIT_TENDER) ||
                        (ejLine.LineType == (int)EjLineType.CHECK_TENDER) ||
                        (ejLine.LineType == (int)EjLineType.CC_TENDER) ||
                        (ejLine.LineType == (int)EjLineType.TENDER))
                    {
                        if (!totalPrinted)
                        {
                            this.PrintTotal();
                        }
                        totalPrinted = true;
                    }

                    if ((ejLine.LineType == (int)EjLineType.SALES_PERSON))
                    {
                        continue;
                    }


                    ejLine.PrintEj();
                    if (ejLine.LineType == (int)EjLineType.ITEM)
                    {
                        this.salesInvoice = true;
                    }
                }
            }

            if (salesInvoice)
            {
                this.PrintDue();
                this.PrintInvoiceTrailler();
            }
            else
            {
                this.PrintReportTrailler();
            }
        }
Exemplo n.º 6
0
        public ItemList(EjItem ejItem, Ej ej)
        {
            _count = 0;

            foreach (Object obj in ej.EjArrayList)
            {
                EjLine ejLine = obj as EjLine;
                if ((ejLine is EjItem) && ejLine.Equals(ejItem))
                {
                    if (nextitem)
                    {
                        break;
                    }
                    nextitem = true;

                    this.Add(ejLine);
                    continue; // Get the next ejLine
                }

                // Ignore other EjItems in the array list
                if (!nextitem)
                {
                    continue;
                }

                if (ejLine is EjPromotion)
                {
                    this.Add(ejLine);
                }

                if (ejLine is EjTax)
                {
                    this.Add(ejLine);
                }
            }
        }
Exemplo n.º 7
0
        public override void  Engage(int keyValue)
        {
            //Check if employee role is authorized to this event
            if (!PosContext.Instance.Employee.RolesEventNames.Contains("Recall"))
            {
                PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY);
                posError.Engage(0);
                return;
            }


            switch (this.States().PeekState())
            {
            case RECALL:

                // Tried to recall in a middle of a dialog
                if (PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.SeqNo > 0)

                {
                    PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT));
                    PosEventStack.Instance.NextEvent();
                    return;
                }


                PosEventStack.Instance.LoadDialog("RecallEj");
                this.PopState();
                this.PushState(RecallEj.ENTER_TRANS_NO);
                PosEventStack.Instance.NextEvent();
                break;

            case ENTER_TRANS_NO:

                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo");
                PosContext.Instance.Operprompt.Update(this);
                this.PopState();
                this.PushState(GET_TRANS_NO);

                break;

            case ENTER_POS_NO:

                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptPosNo");
                PosContext.Instance.Operprompt.Update(this);
                this.PopState();
                this.PushState(GET_POS_NO);

                break;

            case GET_TRANS_NO:

                this.trxno = PosContext.Instance.Input();
                PosContext.Instance.ClearInput();
                PosContext.Instance.Operprompt.Clear();
                this.PopState();
                PosEventStack.Instance.NextEvent();

                break;

            case GET_POS_NO:

                this.PosNo = PosContext.Instance.Input();
                PosContext.Instance.ClearInput();
                this.PopState();
                PosContext.Instance.Operprompt.Clear();
                PosEventStack.Instance.NextEvent();

                break;

            case COMPLETE_RECALL:

                PosContext.Instance.ClearInput();
                trans                 = new Transaction(this.trxno);
                trans.Pos_no          = this.PosNo;
                trans.Organization_no = PosSettings.Default.Organization;
                trans.Store_no        = PosContext.Instance.RetailStore.Retail_store_no;
                trans.Load();
                //	if (trans.State == (int)Transaction.Status.SUSPEND)
                //	{  // was this a suspended transaction?

                PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans);

                if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0)
                {                                          // finally make sure there are records
                    if (trans.State == (int)Transaction.Status.SUSPEND)
                    {
                        trans.State = (int)Transaction.Status.IN_PROGRESS;
                    }
                    foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList)
                    {
                        EjLine line = (EjLine)obj;
                        PosContext.Instance.Receipt.Update(line);
                    }

                    this.States().Clear();
                }
                // }
                PosContext.Instance.TrxNo = this.TrxNo;     /* ES01-26/11/08 */
                this.PromptText           = PosContext.Instance.Parameters.getParam("RegOpen");


                PosContext.Instance.Operprompt.Update(this);
                PosContext.Instance.Receipt.Update(this);

                if (trans.Customer_tax_id.Length > 0)
                {
                    EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer();
                    cus.Organization_no = PosSettings.Default.Organization;
                    cus.Tax_id          = trans.Customer_tax_id;
                    cus.LoadByTaxID();
                    EjCustomer ejCus = new EjCustomer(cus);
                    PosContext.Instance.Receipt.Update(ejCus);
                    PosContext.Instance.EjCustomer = ejCus;
                }

                this.States().Clear();
                PosEventStack.Instance.ClearPending();

                //Clear transaction if complete
                if (trans.State == (int)Transaction.Status.COMPLETE)
                {
                    PosEventStack.Instance.PushEvent(new FinishTransaction());
                }


                break;
            }
        }
Exemplo n.º 8
0
        public override void  Engage(int keyValue)
        {
            //Check if employee role is authorized to this event
            if (!PosContext.Instance.Employee.RolesEventNames.Contains("MergeOrder"))
            {
                PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY);
                posError.Engage(0);
                return;
            }


            //Merger to current order
            if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.SeqNo == 0)
            {
                PosError posError = new PosError(PosErrorCode.ERROR_EVENT);
                posError.Engage(0);
                return;
            }


            switch (this.States().PeekState())
            {
            case MERGE:

                PosContext.Instance.CurrentPosDisplay.LoadOpenOrdersList();

                this.PopState();
                this.PushState(ENTER_TRANS_NO);
                PosEventStack.Instance.NextEvent();
                break;

            case ENTER_TRANS_NO:

                PosContext.Instance.ClearInput();
                this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo");
                PosContext.Instance.Operprompt.Update(this);

                this.PopState();
                this.PushState(GET_TRANS_NO);

                break;


            case GET_TRANS_NO:

                this.trxno = PosContext.Instance.Input();
                PosContext.Instance.ClearInput();
                PosContext.Instance.Operprompt.Clear();

                this.PopState();
                this.PushState(COMPLETE_MERGE);
                PosEventStack.Instance.NextEvent();

                break;


            case COMPLETE_MERGE:

                PosContext.Instance.ClearInput();
                trans                 = new Transaction(this.trxno);
                trans.Pos_no          = PosSettings.Default.Station;
                trans.Organization_no = PosSettings.Default.Organization;
                trans.Store_no        = PosSettings.Default.Store;
                trans.Load();

                if (trans.State == (int)Transaction.Status.SUSPEND)
                {      // was this a suspended transaction?
                    Ej ejFrom = Ej.GetSuspendedEj(trans);

                    if (ejFrom.EjArrayList.Count > 0)
                    {      // finally make sure there are records
                           // trans.State = (int)Transaction.Status.IN_PROGRESS;
                        foreach (Object obj in ejFrom.EjArrayList)
                        {
                            EjLine line = (EjLine)obj;
                            ProcessEjLine(line);
                        }

                        //	context ().homeGuis ();
                        //	context ().eventStack ().setEvent (new FirstItem (context ()));
                        this.States().Clear();
                        //	PosEventStack.Instance.NextEvent();
                    }

                    // ejFrom.Complete((int)Transaction.Status.VOIDED);
                    this.VoidEj(ejFrom);
                }

                if (trans.Customer_tax_id.Length > 0)
                {
                    EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer();
                    cus.Organization_no = PosSettings.Default.Organization;
                    cus.Tax_id          = trans.Customer_tax_id;
                    cus.LoadByTaxID();
                    EjCustomer ejCus = new EjCustomer(cus);
                    PosContext.Instance.Receipt.Update(ejCus);
                    PosContext.Instance.EjCustomer = ejCus;
                }

                this.States().Clear();
                // PosEventStack.Instance.ClearPending();
                PosContext.Instance.HomeGUI();
                PosEventStack.Instance.NextEvent();


                break;
            }
        }
Exemplo n.º 9
0
        private void ProcessEjLine(EjLine ejLine)
        {
            switch (ejLine.LineType)
            {
            case (int)EjLineType.TRANS_HEADER:

                break;

            case (int)EjLineType.ITEM:

                EjItem ejItemFrom = ejLine as EjItem;

                TransItem transItem = new TransItem();

                transItem.Trans_no        = PosContext.Instance.TrxNo;
                transItem.Organization_no = PosSettings.Default.Organization;
                transItem.Store_no        = PosSettings.Default.Store;
                transItem.Pos_no          = PosSettings.Default.Station;
                transItem.Sku_link        = " ";
                transItem.Sku             = ejItemFrom.TransItem.Sku;
                transItem.Item_desc       = ejItemFrom.TransItem.Item_desc;
                transItem.Quantity        = ejItemFrom.TransItem.Quantity;
                transItem.Amount          = ejItemFrom.TransItem.Amount;
                transItem.Ext_amount      = ejItemFrom.TransItem.Ext_amount;
                transItem.Tax_exempt      = ejItemFrom.TransItem.Tax_exempt;
                transItem.Tax_incl        = ejItemFrom.TransItem.Tax_incl;
                transItem.State           = (int)EjLineStates.IN_PROGRESS;
                transItem.Reason_code     = (int)EjItemReasonCodes.NORMAL_ITEM;
                EjItem ejItem = new EjItem(transItem);

                PosContext.Instance.CurrentEjItem = ejItem;

                PosContext.Instance.CurrentEj.EjAdd(ejItem);
                transItem.Seq_no  = PosContext.Instance.CurrentEj.SeqNo;
                transItem.Line_no = PosContext.Instance.CurrentEj.LineNo;

                // if not traning mode
                if (!PosContext.Instance.Training)
                {
                    transItem.Add();
                }

                PosContext.Instance.Receipt.Update(ejItem);
                break;

            case (int)EjLineType.PROMOTION:

                EjPromotion fromPromotion = ejLine as EjPromotion;

                TransPromotion transPromotion = new  TransPromotion();

                transPromotion.Trans_no        = PosContext.Instance.TrxNo;
                transPromotion.Organization_no = PosSettings.Default.Organization;
                transPromotion.Store_no        = PosSettings.Default.Store;
                transPromotion.Pos_no          = PosSettings.Default.Station;
                transPromotion.PromotionNo     = fromPromotion.Promotion.PromotionNo;

                transPromotion.PromotionAmount   = fromPromotion.Amount;
                transPromotion.PromotionQuantity = fromPromotion.Quantity;     //PosContext.Instance.Quantity;
                transPromotion.ReasonCode        = 0;
                transPromotion.PromotionData     = " ";
                transPromotion.PromotionDesc     = fromPromotion.Desc;
                transPromotion.State             = (int)EjLineStates.IN_PROGRESS;

                EjPromotion ejPromotion = new EjPromotion(transPromotion);

                PosContext.Instance.CurrentEj.EjAdd(ejPromotion);
                transPromotion.Seq_no  = PosContext.Instance.CurrentEj.SeqNo;
                transPromotion.Line_no = PosContext.Instance.CurrentEj.LineNo;

                // if not training mode
                if (!PosContext.Instance.Training)
                {
                    transPromotion.Add();
                }
                PosContext.Instance.Receipt.Update(ejPromotion);

                break;

            case (int)EjLineType.TAX:

                EjTax    fromTax      = ejLine as EjTax;
                TransTax fromTransTax = (TransTax)fromTax.DataRecord();

                TransTax transTax = new TransTax();
                transTax.Trans_no        = PosContext.Instance.TrxNo;
                transTax.Organization_no = PosSettings.Default.Organization;
                transTax.Store_no        = PosSettings.Default.Store;
                transTax.Pos_no          = PosSettings.Default.Station;
                transTax.SeqNo           = PosContext.Instance.CurrentEj.SeqNo;
                transTax.Line_no         = PosContext.Instance.CurrentEj.LineNo;
                transTax.TaxId           = fromTransTax.TaxId;
                transTax.TaxDesc         = fromTransTax.TaxDesc;
                transTax.Rate            = fromTransTax.Rate;
                transTax.State           = (int)EjLineStates.IN_PROGRESS;
                transTax.TaxAmount       = fromTransTax.TaxAmount;
                transTax.TaxableAmount   = fromTransTax.TaxableAmount;

                //If not training mode
                if (!PosContext.Instance.Training)
                {
                    transTax.Add();
                }

                EjTax ejTax = new EjTax(transTax);
                PosContext.Instance.CurrentEj.EjAdd(ejTax);



                break;

            case (int)EjLineType.TENDER:

                break;

            case (int)EjLineType.BANK:
                //		Update( (EjBank)pEvent );
                break;

            case (int)EjLineType.ACCOUNT:
                break;

            case (int)EjLineType.ALT_CURRENCY_TENDER:

                break;

            case (int)EjLineType.CHECK_TENDER:

                break;

            case (int)EjLineType.DEBIT_TENDER:

                break;

            case (int)EjLineType.CC_TENDER:

                break;

            case (int)EjLineType.COUPON:
                //		Update ((EjCoupon) pEvent );
                break;

            case (int)EjLineType.FREE_TEXT:

                break;

            case (int)EjLineType.SURCHARGE:

                break;

            default:
                //	Log.warning ("Unhandled ej type in Receipt " + line.toString ());
                break;
            }
        }
Exemplo n.º 10
0
        public override void  Engage(int keyValue)
        {
            //Check if employee role is authorized to this event
            if (!PosContext.Instance.Employee.RolesEventNames.Contains("Recall"))
            {
                PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY);
                posError.Engage(0);
                return;
            }

            try
            {
                if (PosContext.Instance.CurrentEj.SeqNo > 0)
                {
                    PosError posError = new PosError(PosErrorCode.RECALL_FAILLED);
                    posError.Engage(0);
                    return;
                }
            }
            catch (Exception ex)
            {
            }


            PosContext.Instance.ClearInput();
            trans                 = new Transaction(this.trxno);
            trans.Pos_no          = this.PosNo;
            trans.Organization_no = PosSettings.Default.Organization;
            trans.Store_no        = PosContext.Instance.RetailStore.Retail_store_no;
            trans.Load();

            PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans);

            if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0)
            {
                // finally make sure there are records
                foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList)
                {
                    EjLine line = (EjLine)obj;
                    PosContext.Instance.Receipt.Update(line);
                }

                this.States().Clear();
            }

            PosContext.Instance.TrxNo = this.TrxNo; /* ES01-26/11/08 */
            this.PromptText           = PosContext.Instance.Parameters.getParam("RegOpen");


            //PosContext.Instance.Operprompt.Update(this);
            PosContext.Instance.Receipt.Update(this);

            if (trans.Customer_tax_id.Length > 0)
            {
                EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer();
                cus.Organization_no = PosSettings.Default.Organization;
                cus.Tax_id          = trans.Customer_tax_id;
                cus.LoadByTaxID();
                EjCustomer ejCus = new EjCustomer(cus);
                PosContext.Instance.Receipt.Update(ejCus);
                PosContext.Instance.EjCustomer = ejCus;
            }

            this.States().Clear();
            PosEventStack.Instance.ClearPending();

            //Clear transaction if complete
            if ((trans.State == (int)Transaction.Status.COMPLETE) ||
                (trans.State == (int)Transaction.Status.VOIDED))
            {
                PosEventStack.Instance.PushEvent(new FinishTransaction());
            }
        }
Exemplo n.º 11
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;
            }
        }
Exemplo n.º 12
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;
                }
            }
        }
Exemplo n.º 13
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;
                }
            }
        }