Пример #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;
                }
            }
        }
Пример #2
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;
            }
        }