示例#1
0
 /** Database save function. */
 public override bool Save()
 {
     if (!PosContext.Instance.Training)
     {
         try
         {
             transItem.Add();
         }
         catch (Exception e)
         {
             Logger.Error("EjItem.cs", e.ToString());
         }
     }
     return(true);
 }
示例#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;
            }
        }
示例#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;
                }
            }
        }