public List <PurchaseView> GetExpenseReportOnPurchse() { List <PurchaseView> purchaseViews = new List <PurchaseView>(); var products = _productRepository.GetAll(); foreach (var p in products) { var pds = _purchaseRepository.GetAllPurchaseDetails().Where(c => c.ProductId == p.Id).ToList(); if (pds.Count == 0) { continue; } int TotalPurchseQuantity = _purchaseRepository.GetTotalPurchaseQuantity(p.Id); int TotalSaleQuantity = _salesRepository.GetTotalSaleQuantity(p.Id); int AvailableQuantity = TotalPurchseQuantity - TotalSaleQuantity; PurchaseView purchaseView = new PurchaseView(); purchaseView.Product = p.Name; purchaseView.Quantity = AvailableQuantity; purchaseView.ReOrderLevel = p.ReOrderLevel; purchaseView.UnitPrice = pds.Last().UnitPrice; purchaseView.MRP = pds.Last().MRP; purchaseView.Profit = (purchaseView.Quantity * purchaseView.MRP) - (purchaseView.Quantity * purchaseView.UnitPrice); purchaseViews.Add(purchaseView); } return(purchaseViews); }
public void LoadPurchaseDetails() { string Invoice; Invoice = txtInvoice.Text; PurchaseGridView.DataSource = _PurchaseRepository.GetAllPurchaseDetails(Invoice); PurchaseGridView.DataBind(); }
public void GetAllPurchaseDetails() { Id = Request.QueryString["Id"].ToString(); PurchaseDetailsGridView.DataSource = _PurchaseRepository.GetAllPurchaseDetails(Id); PurchaseDetailsGridView.DataBind(); }
public List <PurchaseDetails> GetAllPurchaseDetails() { return(_purchaseRepository.GetAllPurchaseDetails()); }