public List <PrqPurchaseChallan> GetChallanList(long purchaseID) { var challanList = (from c in _context.Prq_PurchaseChallan.AsEnumerable() where c.PurchaseID == purchaseID from s in _context.Sys_Source where s.SourceID == c.SourceID from l in _context.Sys_Location where l.LocationID == c.LocationID orderby c.ChallanID select new PrqPurchaseChallan { ChallanID = c.ChallanID, ChallanNo = c.ChallanNo, ChallanDate = (c.ChallanDate).ToString("dd'/'MM'/'yyyy"), SourceID = c.SourceID, SourceName = s.SourceName, LocationID = c.LocationID, LocationName = l.LocationName, ChallanCategory = c.ChallanCategory, ReceiveStore = DalCommon.GetStoreName(c.ReceiveStore), ChallanNote = c.ChallanNote, RecordStatus = DalCommon.ReturnRecordStatus(c.RecordStatus) }).ToList(); return(challanList); }
public PurchaseReceiveTest GetDetailPurchaseInformation(string PurchaseNumber) { var model = new PurchaseReceiveTest(); var PurchaseInfo = (from p in _context.Prq_Purchase.AsEnumerable() where (p.PurchaseID).ToString() == PurchaseNumber from s in _context.Sys_Supplier where s.SupplierID == p.SupplierID from sa in _context.Sys_SupplierAddress where sa.SupplierID == p.SupplierID select new PrqPurchase { SupplierID = p.SupplierID, SupplierCode = s.SupplierCode, SupplierName = s.SupplierName, SupplierAddressID = p.SupplierAddressID, Address = sa.Address, ContactNumber = sa.ContactNumber, ContactPerson = sa.ContactPerson, PurchaseID = p.PurchaseID, PurchaseNo = p.PurchaseNo, PurchaseCategory = p.PurchaseCategory, PurchaseType = p.PurchaseType, PurchaseDate = (p.PurchaseDate).ToString("dd'/'MM'/'yyyy"), PurchaseYear = p.PurchaseYear, PurchaseNote = p.PurchaseNote, RecordStatus = p.RecordStatus }).FirstOrDefault(); model.PurchaseInformation = PurchaseInfo; var ChallanInfo = (from c in _context.Prq_PurchaseChallan.AsEnumerable() where (c.PurchaseID).ToString() == PurchaseNumber from s in _context.Sys_Source where s.SourceID == c.SourceID from l in _context.Sys_Location where l.LocationID == c.LocationID orderby c.ChallanID select new PrqPurchaseChallan { ChallanID = c.ChallanID, ChallanNo = c.ChallanNo, ChallanDate = (c.ChallanDate).ToString("dd'/'MM'/'yyyy"), SourceID = c.SourceID, SourceName = s.SourceName, LocationID = c.LocationID, LocationName = l.LocationName, ChallanCategory = c.ChallanCategory, ReceiveStore = DalCommon.GetStoreName(c.ReceiveStore), ChallanNote = c.ChallanNote, RecordStatus = DalCommon.ReturnRecordStatus(c.RecordStatus) }).ToList(); model.ChallanList = ChallanInfo; if (ChallanInfo.Count > 0) { if ((ChallanInfo.FirstOrDefault().ChallanID).ToString() != null) { var ChallanItemInfoTest = (from c in _context.Prq_PurchaseChallanItem.AsEnumerable() where c.ChallanID == ChallanInfo.FirstOrDefault().ChallanID select new PrqPurchaseChallanItem { ChallanItemID = c.ChallanItemID, ChallanID = c.ChallanID, ItemTypeName = DalCommon.GetItemTypeName(c.ItemTypeID), SizeName = DalCommon.GetSizeName(c.ItemSizeID), UnitName = DalCommon.GetUnitName(c.UnitID), Description = c.Description, ChallanQty = c.ChallanQty, ReceiveQty = c.ReceiveQty, Remark = c.Remark, RecordStatus = DalCommon.ReturnRecordStatus(c.RecordStatus) }); model.ChallanItemList = ChallanItemInfoTest.ToList(); } } return(model); }