// GET: SalesReport
        public ActionResult Index()
        {
            var db1   = new SainiShopEntities1();
            var query = db1.ProductMasters.Select(c => new SelectListItem
            {
                Value = c.Product_id.ToString(),
                Text  = c.Product_name,

                //Selected = c.Product_id.Equals(3)
            }).ToList();

            var query1 = db1.WattMasters.Select(c => new SelectListItem
            {
                Value = c.product_id.ToString(),
                Text  = c.watt.ToString(),
            }).ToList();


            var model = new SalesDetailModel {
                Productname = query.ToList(), wattmain = query1.ToList()
            };

            return(View(model));
            //return View();
        }
        public ActionResult Index()
        {
            var use  = User.Identity.Name.ToString();
            var ause = User.Identity;

            var db1   = new SainiShopEntities1();
            var query = db1.ProductMasters.Select(c => new SelectListItem
            {
                Value = c.Product_id.ToString(),
                Text  = c.Product_name,

                //Selected = c.Product_id.Equals(3)
            }).ToList();

            var model = new SalesDetailModel {
                Productname = query.ToList()
            };

            return(View(model));
        }
示例#3
0
        private void AddSaleItem()
        {
            int     qty          = int.Parse(QtyTextbox.Text);
            decimal sellingPrice = UnitPriceTextbox.Text.ToDecimal();

            //bool hasLowerSellingPrice = false;

            //If no part number is selected, do nothing
            if (this.PartNumberId == 0)
            {
                ClientHelper.ShowErrorMessage("Part number does not exist.");
                return;
            }
            else if (qty > this._qtyLeft)
            {
                ClientHelper.ShowErrorMessage("Insufficient quantity.");
                return;
            }
            else if (sellingPrice < this._buyingPrice)
            {
                ClientHelper.ShowErrorMessage("Selling price cannot be less than purchase price.");
                return;
            }
            else if (sellingPrice < this._minimumPrice)
            {
                if (ClientHelper.ShowConfirmMessage("Price is lower than selling price. Administrators will be notified.\nDo you wish to continue?") ==
                    System.Windows.Forms.DialogResult.Yes)
                {
                    this.NotifyAdmin = true;
                }
                else
                {
                    return;
                }
            }

            IAutoPartDetailModel model = new SalesDetailModel()
            {
                AutoPartDetailId = this.PartNumberId,
                Name             = string.Format("{0} - {1}\n{2} / {3} / {4}",
                                                 AutoPartLabel.Text, PartNumberSearchTextbox.Text,
                                                 BrandLabel.Text, ModelLabel.Text, MakeLabel.Text),
                Quantity         = qty,
                Unit             = UnitTextbox.Text,
                UnitPrice        = sellingPrice,
                DiscountedPrice  = DiscountTextbox.Text.ToDecimal(),
                DiscountedPrice2 = DiscountTextbox2.Text.ToDecimal(),
                DiscountedPrice3 = DiscountTextbox3.Text.ToDecimal(),
                DiscountPercent  = DPercentTextbox.Text.ToDecimal(),
                DiscountPercent2 = DPercentTextbox2.Text.ToDecimal(),
                DiscountPercent3 = DPercentTextbox3.Text.ToDecimal(),
                DiscountPercents = string.Format("Less: {0}% + {1}% + {2}%",
                                                 DPercentTextbox.Text == ZeroCurrency ? "0" : DPercentTextbox.Text,
                                                 DPercentTextbox2.Text == ZeroCurrency ? "0" : DPercentTextbox2.Text,
                                                 DPercentTextbox3.Text == ZeroCurrency ? "0" : DPercentTextbox3.Text),
                TotalDiscount = TotalDiscountTextbox.Text.ToDecimal(),
                TotalAmount   = TotalAmountTextbox.Text.ToDecimal()
            };

            this.ItemList.Insert(0, model);
        }