Ejemplo n.º 1
0
        void HeaderEvents_OnMenuItem(object Sender, ExtenderEventArgs e)
        {
            var menuId = (string)e.get_data();
            var rnd    = new Random();

            switch (menuId)
            {
            case "mniXTrans1":
                //System.Windows.Forms.MessageBox.Show("YAY");
                double qty       = rnd.Next(1, 10) + (double)rnd.Next(0, 99) / 100;
                double unitPrice = rnd.Next(1, 100) + (double)rnd.Next(0, 99) / 100;

                var item = APIEngine.DSOCache.ItemProvider.GetItem("aaa", APIEngine.SystemSettings.BaseCurrency);
                if (item != null)
                {
                    var detail = new ItemTransactionDetail()
                    {
                        LineItemID  = bsoItemTrans.Transaction.Details.Count + 1,
                        ItemID      = item.ItemID,
                        Description = item.Description
                    };
                    if (bsoItemTrans.Transaction.TransactionTaxIncluded)
                    {
                        detail.TaxIncludedPrice = unitPrice;
                    }
                    else
                    {
                        detail.UnitPrice = unitPrice;
                    }
                    detail.SetUnitOfSaleID(item.UnitOfSaleID);
                    detail.SetQuantity(qty);
                    detail.TaxableGroupID = item.TaxableGroupID;

                    //var detail = TransAddDetail(bsoItemTrans.Transaction, item, qty, "UNI", unitPrice, 23, 1, 0, 0, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Now, 0, 0, 0);
                    // IMPORTANTE: Mandar calcular a linha!
                    bsoItemTrans.BSOItemTransactionDetail.Calculate(detail);
                    // Adicionar à venda
                    bsoItemTrans.AddDetail(detail);
                }
                break;

            case "XFunctionA":
                MessageBox.Show("Your function here...");
                break;

            case "XPosDisplay":
                SendMessageToCustomerDisplay();
                break;
            }
        }