public List <Models.MViewModels.MViewTransactions> GetAll() { List <Models.MViewModels.MViewTransactions> Transactions = new List <Models.MViewModels.MViewTransactions>(); List <Models.MSaleTransactions> AllTransactions = new List <Models.MSaleTransactions>(); Models.MViewModels.MViewTransactions mvv = new Models.MViewModels.MViewTransactions(); Classes.CProducts cp = new CProducts(); Classes.CSaleTransations cst = new CSaleTransations(); Classes.CWareHouse cw = new CWareHouse(); AllTransactions = cst.GetAll(); AllTransactions = (from o in AllTransactions select o).OrderBy(o => o.date).ToList(); for (int i = 0; i < AllTransactions.Count; i++) { mvv = new Models.MViewModels.MViewTransactions(); string ProductId = AllTransactions[i].ProductID; string ProductName = cp.GetProductNameWithTagsById(Convert.ToInt32(ProductId)); string WareHouseId = AllTransactions[i].WareHouseId; string WareHouseName = cw.GetWareHouseNameById(Convert.ToInt32(WareHouseId)); mvv.TransactionId = AllTransactions[i].id.ToString(); mvv.Date = AllTransactions[i].date.ToShortDateString(); mvv.Product = ProductName; mvv.Type = AllTransactions[i].transactionType; mvv.Units = AllTransactions[i].units; mvv.WareHouse = WareHouseName; mvv.OrderId = AllTransactions[i].OrderId; mvv.WareHouseId = WareHouseId; Transactions.Add(mvv); } return(Transactions); }
public List <Models.MInventoryBalance> GetInventoryBalance(DateTime fromDate, DateTime toDate) { List <Models.MInventoryBalance> Data = new List <Models.MInventoryBalance>(); var query = from o in obj.InventoryBalances where o.Date >= fromDate && o.Date <= toDate select o; Classes.CProducts cp = new CProducts(); Classes.CWareHouse cw = new CWareHouse(); foreach (var item in query) { Models.MInventoryBalance mib = new Models.MInventoryBalance(); string ProductName = string.Empty; string WarehouseName = string.Empty; ProductName = cp.GetProductNameWithTagsById(Convert.ToInt32(item.ProductsId)); mib.WareHouseId = Convert.ToInt32(item.WarehouseId.ToString()); WarehouseName = cw.GetWareHouseNameById(Convert.ToInt32(item.WarehouseId)); mib.BalanceTotal = item.BalanceTotal; mib.BalanceUnits = item.BalanceUnits; mib.BalanceUnitsCost = item.BalanceUnitsCost; mib.date = Convert.ToDateTime(item.Date); mib.ProductName = ProductName; mib.PurchaseTotal = item.PurchaseTotal; mib.PurchaseUnits = item.PurchaseUnits; mib.PurchaseUnitsCost = item.PurchaseUnitsCost; mib.SaleTotal = item.SaleTotal; mib.SaleUnits = item.SaleUnits; mib.SaleUnitsCost = item.SaleUnitsCost; mib.WareHouseName = WarehouseName; Data.Add(mib); } return(Data); }
public List <Models.MInventory> GetInventoryData() { List <Models.MInventory> Data = new List <Models.MInventory>(); var query = from o in obj.Inventories orderby o.WareHouseId ascending select o; if (query != null) { foreach (var item in query) { Models.MInventory mi = new Models.MInventory(); string Get = string.Empty; string WareHouseName = string.Empty; Classes.CProducts cp = new CProducts(); Classes.CWareHouse cw = new CWareHouse(); Get = cp.GetProductNameWithTagsById(Convert.ToInt32(item.ProductId)); WareHouseName = cw.GetWareHouseNameById(Convert.ToInt32(item.WareHouseId)); string[] ProductDetails = Get.Split('-'); mi.ProductCode = ProductDetails[0]; mi.ProductName = ProductDetails[1]; mi.ProducyTag1 = ProductDetails[2]; mi.ProductTag2 = ProductDetails[3]; mi.ProductId = item.ProductId.ToString(); mi.WareHouseld = item.WareHouseId.ToString(); mi.WareHouseName = WareHouseName; mi.Cost = item.Cost; mi.Quantity = item.Quantity; mi.TotalCost = Convert.ToSingle(Convert.ToSingle(item.Cost) * Convert.ToSingle(item.Quantity)); Data.Add(mi); } } return(Data); }
public List <Models.MViewModels.MViewCashInHand> GetAll(int fiscalYeadId) { List <Models.MViewModels.MViewCashInHand> Get = new List <Models.MViewModels.MViewCashInHand>(); Models.MViewModels.MViewCashInHand mvm = new Models.MViewModels.MViewCashInHand(); Classes.CInventory ci = new CInventory(); Classes.CWareHouse cw = new CWareHouse(); List <Models.MInventory> Inventory = new List <Models.MInventory>(); Inventory = ci.GetAll(); Inventory = (from o in Inventory where Convert.ToInt32(o.FiscalYearld) == fiscalYeadId select o).ToList(); for (int i = 0; i < Inventory.Count; i++) { string ProductName; string ProductCode; string ProductTag1; string ProductTag2; string Units; string PerUnitCost; string Total; string WareHouseName; Classes.CProducts cp = new CProducts(); int ProductId = 0; ProductId = Convert.ToInt32(Inventory[i].ProductId); List <Models.MProducts> Products = new List <Models.MProducts>(); Products = cp.GetAllbyid(ProductId); if (Products.Count() != 0) { mvm = new Models.MViewModels.MViewCashInHand(); int WareHouseId = 0; WareHouseId = Convert.ToInt32(Inventory[i].WareHouseld); WareHouseName = cw.GetWareHouseNameById(WareHouseId); ProductName = Products[0].Name; ProductCode = Products[0].ProductCode; ProductTag1 = Products[0].tag1; ProductTag2 = Products[0].tag2; Units = Inventory[i].Quantity.ToString(); PerUnitCost = Inventory[i].Cost; Total = (Convert.ToSingle(Units) * Convert.ToSingle(PerUnitCost)).ToString(); //object mvm.PerUnitCost = PerUnitCost; mvm.ProductCode = ProductCode; mvm.ProductName = ProductName; mvm.ProductTag1 = ProductTag1; mvm.ProductTag2 = ProductTag2; mvm.Total = Total; mvm.Units = Units; mvm.WareHouseName = WareHouseName; Get.Add(mvm); } } return(Get); }
public string GetWareHouseNameByUserId(string UserId) { string WareHouseName = string.Empty; var query = (from o in obj.UserWareHouseContainers where o.UserId == Convert.ToInt32(UserId) select o.WareHouseId).FirstOrDefault(); if (query == null) { WareHouseName = "No WareHouse Associated"; } else { CWareHouse cw = new CWareHouse(); WareHouseName = cw.GetWareHouseNameById(Convert.ToInt32(query)); } return(WareHouseName); }