private void addPurchaseDetails() { _entities = new MicroAccountsEntities1(); var data1 = _entities.tbl_PurchaseDetail.Where(x => x.purchaseID == passedId).ToList(); List <PurchaseDetailsVM> DetailslistVm = new List <PurchaseDetailsVM>(); foreach (var item in data1) { PurchaseDetailsVM vm = new PurchaseDetailsVM(); vm.purchaseID = item.purchaseID; vm.making = item.making; vm.melting = item.melting; vm.ItemCode = _entities.tbl_ItemMaster.Where(x => x.id == item.productID).FirstOrDefault().itemCode; vm.weight = item.weight; vm.unit = item.unit; vm.rate = item.rate; vm.karat = item.karat; vm.kRate = item.kRate; vm.purchaseMelting = item.purchaseMelting; DetailslistVm.Add(vm); } ReportDataSource datasource1 = new ReportDataSource("DataSet2", DetailslistVm); this.reportViewer1.LocalReport.DataSources.Add(datasource1); }
public ActionResult LiftingDetails(int id) { var data = Db.tblt_PurchaseOrder.SingleOrDefault(x => x.Id == id); if (data != null) { var tbldDistributionHouse = Db.tbld_distribution_house.FirstOrDefault(x => x.DB_Id == data.DbId); if (tbldDistributionHouse != null) { var purchaseLine = from a in Db.tblt_PurchaseOrderLine where a.POId == id select new PurchaseLineDetailsVm() { SkuName = Db.tbld_SKU.FirstOrDefault(x => x.SKU_id == a.sku_id).SKUName, PackSize = a.PackSize, BetchId = a.BatchId, UnitSalePrice = a.Price, ChallanQuantity = (double)a.ChallanQty / a.PackSize, ReciveQty = (double)a.ReciveQty / a.PackSize, TotalPrice = (double)a.ReciveQty * a.Price, }; if (data.ChallanDate != null) { if (data.ReceivedDate != null) { PurchaseDetailsVM purchaseDetails = new PurchaseDetailsVM { ChallanDate = (DateTime)data.ChallanDate, ChallanNo = data.ChallanNo, DB = tbldDistributionHouse.DBName, ReceivedDate = (DateTime)data.ReceivedDate, PurchaseLine = purchaseLine.ToList() }; return(View(purchaseDetails)); } } } } return(HttpNotFound()); }
private void RptPurchase_Load(object sender, EventArgs e) { try { cnn.Open(); //SqlDataAdapter dap = new SqlDataAdapter("SELECT tbl_PurchaseMaster.*, tbl_AccLedger.* FROM tbl_AccLedger INNER JOIN tbl_PurchaseMaster ON tbl_AccLedger.Id = tbl_PurchaseMaster.ledgerId where refNo='" + this.passedId + "'", cnn); //PurchaseDataSet ds = new PurchaseDataSet(); //dap.Fill(ds, "DataTable1"); _en = new MicroAccountsEntities1(); var data = _en.tbl_PurchaseMaster.ToList(); List <PurchaseMasterVM> listVm = new List <PurchaseMasterVM>(); foreach (var item in data) { PurchaseMasterVM vm = new PurchaseMasterVM(); vm.ledgerName = _en.tbl_AccLedger.Where(x => x.Id == item.ledgerId).FirstOrDefault().ledgerName; listVm.Add(vm); } ReportDataSource datasource = new ReportDataSource(); datasource.Name = "DataSet1"; datasource.Value = listVm; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(datasource); ReportDataSource datasource1 = new ReportDataSource(); _en = new MicroAccountsEntities1(); var data1 = _en.tbl_PurchaseDetail.ToList(); List <PurchaseDetailsVM> DetailslistVm = new List <PurchaseDetailsVM>(); foreach (var item in data1) { PurchaseDetailsVM vm = new PurchaseDetailsVM(); vm.purchaseID = item.purchaseID; DetailslistVm.Add(vm); } datasource1.Name = "DataSet2"; datasource1.Value = DetailslistVm; this.reportViewer1.LocalReport.DataSources.Add(datasource1); //reportViewer1.LocalReport.ReportEmbeddedResource = "Redport1.rdlc"; //ReportDataSource datasource = new ReportDataSource("PurchaseDataSet", ds.Tables[0]); //this.reportViewer1.LocalReport.DataSources.Clear(); //this.reportViewer1.LocalReport.DataSources.Add(data.ToList()); this.reportViewer1.RefreshReport(); cnn.Close(); } catch (Exception x) { MessageBox.Show(x.ToString()); } this.reportViewer1.RefreshReport(); //this.reportViewer1.RefreshReport(); }