Пример #1
0
        /// <summary>
        /// This method add a new Item in the SaleItemList
        /// </summary>
        /// <param name="saleItem"></param>
        private void AddSaleItem(SaleItem saleItem)
        {
            SaleItem sItem = SaleItemList.Where(i => i.ProductId == saleItem.ProductId || i.Name == saleItem.Name).FirstOrDefault();
            if (sItem != null)
            {
                sItem.Quantity += saleItem.Quantity;
                sItem.UnitCost += saleItem.UnitCost;
            }
            else
                SaleItemList.Add(saleItem);

        }
Пример #2
0
        protected void AddExistentSaleItem()
        {
            SaleItem saleItem = new SaleItem();
            Product product = new ProductManager(this).GetProductByName((int)Company.MatrixId, selProduct.Name);
            Inventory productInInventory = new InventoryManager(this).GetProductInventory(
                 Company.CompanyId, product.ProductId, Deposit.DepositId);

            saleItem.ProductId = product.ProductId;
            saleItem.Name = selProduct.Name;
            //se o preco na tela for != de null, então ele é convertido e arqmazenado
            //senão verificamos se o preco do produto já existe em inventário, se este for o caso, armazenamos o preco
            //senão, setamos 0 para o price 
            saleItem.Price = ucCurrFieldUnitPrice.CurrencyValue.HasValue ? ucCurrFieldUnitPrice.CurrencyValue.Value : (productInInventory != null ? Convert.ToDecimal(productInInventory.UnitPrice) : Decimal.Zero);
            saleItem.Quantity = ucCurrFieldQuantityData.IntValue;
            if (productInInventory != null)
                saleItem.UnitCost = productInInventory.RealCost;

            SaleItemList.Add(saleItem);
        }
Пример #3
0
        protected void AddNewSaleItem()
        {
            SaleItem saleItem = new SaleItem();
            saleItem.ProductId = null;
            saleItem.Quantity = ucCurrFieldQuantityData.IntValue;
            saleItem.Name = selProduct.Name;
            saleItem.Code = String.Empty;
            saleItem.Price = ucCurrFieldUnitPrice.CurrencyValue;
            saleItem.UnitCost = Decimal.Zero;
            SaleItemList.Add(saleItem);
            // AddSaleItem(saleItem);

        }
Пример #4
0
        protected void lstBudget_SelectedIndexChanged(object sender, EventArgs e)
        {
            SaleItemList = null;
            txtDiscount.Text = String.Empty;
            Discount = null;

            SaleManager budgetManager = new SaleManager(this);
            Budget budget = budgetManager.GetBudget(Convert.ToInt32(lstBudget.SelectedValue), Company.CompanyId);
            Page.ViewState["budgetId"] = Convert.ToInt32(lstBudget.SelectedValue);

            Discount.DiscountValue = budgetManager.CalculateBudgetDiscount(budget);
            Discount.IsCashDiscount = true;

            if (budget.AdditionalCost.HasValue)
                Discount.DiscountValue -= budget.AdditionalCost.Value;


            SaleItem saleItem;

            foreach (BudgetItem budgetItem in budgetManager.GetBudgetItemByBudget(budget.BudgetId, Company.CompanyId))
            {
                saleItem = new SaleItem();
                if (budgetItem.ProductId.HasValue)
                    saleItem.Name = budgetItem.Product.Name;
                else
                    saleItem.Name = budgetItem.SpecialProductName + "&nbsp;&nbsp;&nbsp;&nbsp;<img src='" + ResolveClientUrl("~/App_Shared/themes/glasscyan/Company/Product_warning.gif") + "' alt='Este produto não se encontra cadastrado!' />";

                saleItem.ProductId = budgetItem.ProductId;
                saleItem.Quantity = budgetItem.Quantity;
                saleItem.Code = budgetItem.ProductCode;
                saleItem.Price = budgetItem.UnitPrice;
                saleItem.UnitCost = budgetItem.UnitCost;

                SaleItemList.Add(saleItem);
            }
            BindGrdSaleItem();



        }