public ActionResult DescargarReporteAsignaciones(int?id) { try { //var asignaciones = ProyectoCN.ListarAsignaciones(); var rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reportes/AsignacionReport.rpt"); rptH.Load(); if (id == null) { rptH.SetDataSource(ProyectoCN.ListarAsignaciones()); } else { rptH.SetDataSource(ProyectoCN.ListarAsignaciones(id.Value)); } Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); //En PDF Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); rptH.Dispose(); rptH.Close(); return(new FileStreamResult(stream, "application/pdf")); } catch (Exception ex) { throw; } }
private ReportClass GenerateUserRepost() { var cs = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; var con = new SqlConnection(cs); var dt = new DataTable(); var sql = "select * from Users order by lastName, FirstName"; try { con.Open(); var cmd = new SqlCommand(sql, con); var da = new SqlDataAdapter(cmd); da.Fill(dt); } catch (Exception ex) { ex.ToString(); } var report = new ReportClass(); report.FileName = Server.MapPath("/Reports/Users.rpt"); //cargo el reporte en memoria: report.Load(); report.SetDataSource(dt); return(report); }
public static void PrepararImpressão(ReportClass relatório, List<Entidades.Mercadoria.MercadoriaEmFaltaCliente> itens, Entidades.Pessoa.Pessoa emPosseDe) { DataSetMercadoriaEmFaltaCliente ds = new DataSetMercadoriaEmFaltaCliente(); DataTable tabelaItens = ds.Tables["Itens"]; foreach (Entidades.Mercadoria.MercadoriaEmFaltaCliente item in itens) { DataRow linha = tabelaItens.NewRow(); linha["referência"] = Entidades.Mercadoria.Mercadoria.MascararReferência(item.ReferênciaNumérica); linha["pedido"] = item.Pedido; linha["qtdPedido"] = item.QuantidadePedido; linha["qtdConsignação"] = item.QuantidadeConsignado; linha["dataPedido"] = item.DataPedido.ToShortDateString(); linha["cliente"] = item.ClienteNome; linha["descrição"] = item.Descricao; tabelaItens.Rows.Add(linha); } DataTable tabelaInformações = ds.Tables["Informações"]; DataRow linhaÚnica = tabelaInformações.NewRow(); linhaÚnica["cliente"] = emPosseDe.Nome; tabelaInformações.Rows.Add(linhaÚnica); relatório.SetDataSource(ds); }
//private readonly IMasterDetailsReportService _iMasterDetailsReportService; //public MasterDetails(IMasterDetailsReportService iMasterDetailsReportService) //{ // this._iMasterDetailsReportService = iMasterDetailsReportService; //} protected void Page_Load(object sender, EventArgs e) { try { int categoryId = Convert.ToInt32(Request.QueryString["catid"]); IMasterDetailsReportService _iMasterDetailsReportService = new MasterDetailsReportService(); var masterDetailsViewModels = _iMasterDetailsReportService.GetMasterDetailsViewModelsByCategoryId(categoryId); var detailsViewModels = masterDetailsViewModels as List<MasterDetailsViewModel> ?? masterDetailsViewModels.ToList(); var reportData = detailsViewModels; ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/CrystalReports/MasterDetails.rpt"); reportClass.Load(); reportClass.SetDataSource(reportData); masterDetailsCrystalReportViewer.ReportSource = reportClass; } catch (Exception) { throw; } }
private ReportClass GenerateUserReport() { DataTable datatable = new DataTable(); try { var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; string sql = "select * from Users order by LastName, FirstName"; using (var connection = new SqlConnection(connectionString)) { connection.Open(); using (var comand = new SqlCommand(sql, connection)) { var adapter = new SqlDataAdapter(comand); adapter.Fill(datatable); } } } catch (Exception ex) { } var report = new ReportClass(); report.FileName = Server.MapPath("/Reports/Users.rpt"); //cargamos el reporte en memoria report.Load(); //cargamos el origen de datos report.SetDataSource(datatable); return(report); }
/// <summary> /// รายงานการเปลี่ยนยาง /// </summary> /// <returns></returns> public ActionResult TiresChanging() { List <TiresChanging> list = new List <TiresChanging>(); list.Add(new TiresChanging() { CarRegis = "61-9747 กท", Date = DateTime.Now, Mile = 36520, Position = 2, PutOnBrand = "Bridgestone", PutOnSerial = "B4L2L5559", PutOnSize = "11R22.5/16PR157", TakeOffBrand = "Bridgestone", TakeOffSerial = "L01589349", TakeOffSize = "11R22.5/16PR157" }); list.Add(new TiresChanging() { CarRegis = "81 - 6040", Date = DateTime.Now, Mile = 267017, Position = 5, PutOnBrand = "Bridgestone", PutOnSerial = "B4L2L5559", PutOnSize = "11R22.5/16PR157", TakeOffBrand = "Bridgestone", TakeOffSerial = "L01589349", TakeOffSize = "11R22.5/16PR157" }); list.Add(new TiresChanging() { CarRegis = "50-3719", Date = DateTime.Now, Mile = 267017, Position = 10, PutOnBrand = "Bridgestone", PutOnSerial = "B4L2L5559", PutOnSize = "11R22.5/16PR157", TakeOffBrand = "Bridgestone", TakeOffSerial = "L01589349", TakeOffSize = "11R22.5/16PR157" }); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Views/Report/TiresChanging.rpt"); rptH.Load(); rptH.SetDataSource(list); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public ActionResult YearwiseReport(FormCollection FC, YearwiseModel objMW) { YearwiseModel objMWlist = new YearwiseModel(); objMWlist.YearNameList = BindYear(); if (objMW.YearID == "0") { ModelState.AddModelError("Message", "Please select Year"); } else { objMWlist.YearID = objMW.YearID; DataSet ds = objIlReports.Get_YearwisePayment_details(objMW.YearID); ds.Tables[0].TableName = "DSYear"; if (ds.Tables[0].Rows.Count > 0) { ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("~/Reports/YearwiseCollectionreport.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "YearwiseMaintenanceReport.pdf")); } } return(View(objMWlist)); }
public async Task<ActionResult> UserStats(string _sDate, string _eDate) { //Declarations of variables DateTime _sdt = Convert.ToDateTime(_sDate); DateTime _edt = Convert.ToDateTime(_eDate).AddDays(1); List<userDTO> _list = new List<userDTO>(); string _path = ""; _path = "/CrystalReport/rptUserStats.rpt"; //string sname = Session["LName"].ToString(); //Database Query var sql =await (from a in db.TBL_WEBUSERS where a.DATE_VERIFIED >= _sdt && a.DATE_VERIFIED <= _edt select a).ToListAsync(); foreach (var r in sql) { userDTO tbl = new userDTO(); tbl._dateV = r.DATE_VERIFIED.ToString(); tbl.userName = r.USERNAME; tbl.region = getRegioName(r.REGION); _list.Add(tbl); } ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath(_path); rptH.Load(); rptH.SetDataSource(_list); rptH.SetParameterValue("Petsa", _sdt.ToShortDateString() + " - " + _edt.ToShortDateString()); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
// // GET: /Report/ public ActionResult AuditDriverList() { // database call var TANK_usp_rpt_AuditDrivers_spParams = new TANK_usp_rpt_AuditDrivers_spParams() { //TODO: re-factor it later from hard coded LocationID = 1, StartDT = DateTime.Now.AddYears(-1), EndDT = DateTime.Now }; DataTable data = _utilityService.ExecStoredProcedureForDataTable("TANK_usp_rpt_AuditDrivers", TANK_usp_rpt_AuditDrivers_spParams); //# database call ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("~/Reports/crDailyDriverActivity.rpt"); rptH.Load(); rptH.SetDataSource(data); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); // return View(); }
public ActionResult DescargarReporteProyectos() { try { var proyectos = ProyectoCN.ListarProyectos(); var rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reportes/ProyectosListas.rpt"); rptH.Load(); rptH.SetDataSource(proyectos); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); //En PDF Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); rptH.Dispose(); rptH.Close(); return(new FileStreamResult(stream, "application/pdf")); } catch (Exception ex) { throw; } }
public ActionResult ProductIndentReports(string indent) { DataSet ds = new DataSet(); DataSet ds1 = new DataSet(); try { ds = mmsReports.GetProductIndentReport(indent); ds1 = posTransactions.companyname(); string strcompanyname = ds1.Tables[0].Rows[0]["vchcompanyname"].ToString(); string strcompanyAddress = ds1.Tables[0].Rows[0]["address"].ToString(); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reports/ProductIndentReport.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); rptH.SetParameterValue("CompanyName", strcompanyname); rptH.SetParameterValue("Address", strcompanyAddress); Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); } catch (Exception ex) { throw ex; } }
public ActionResult ImprimirColaboradorQueryClasic(string COD_Colaborador) { String ConnStr = @"data source=.;initial catalog=IDCHECKDB;persist security info=True;user id=sa;password=12345"; SqlConnection myConnection = new SqlConnection(ConnStr); DataTable dt = new DataTable(); try { myConnection.Open(); SqlCommand cmd = new SqlCommand("SELECT COD_Colaborador, ApellidoPaterno, ApellidoMaterno, Nombres, Foto FROM Colaboradores where COD_Colaborador =" + COD_Colaborador, myConnection); SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); myConnection.Close(); } catch (Exception e) { } ReportClass rpth = new ReportClass(); rpth.FileName = Server.MapPath("~/Reports/CrystalReportFotocheck.rpt"); rpth.Load(); rpth.SetDataSource(dt); Stream stream = rpth.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public ActionResult BillGenerationReport(string billno) { System.Data.DataSet ds = posTransactions.BillGenerationReport(billno); System.Data.DataSet ds1 = posTransactions.companyname(); string strcompanyname = ds1.Tables[0].Rows[0]["vchcompanyname"].ToString(); string strcompanyAddress = ds1.Tables[0].Rows[0]["address"].ToString(); string Hostname = ""; string session = ""; ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reports/rptBillGeneration.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); rptH.SetParameterValue("CompanyName", strcompanyname); rptH.SetParameterValue("Address", strcompanyAddress); rptH.SetParameterValue("TableId", ds.Tables[0].Rows[0]["tableid"]); rptH.SetParameterValue("BillNo", ds.Tables[0].Rows[0]["vchbillno"]); rptH.SetParameterValue("HostName", Hostname); rptH.SetParameterValue("SessionNo", session); rptH.SetParameterValue("Printtype", "Original"); // rptH.SetParameterValue("Billtype", "billtype"); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public void PrepararImpressão(ReportClass relatório, IEnumerable<Entidades.Pessoa.Impressão.PessoaImpressão> pessoas, Região região) { DataSetPessoa ds = new DataSetPessoa(); DataTable tabela = ds.Tables["Pessoa"]; DataTable info = ds.Tables["Informações"]; DataRow itemInfo = info.NewRow(); if (região != null) { Representante representante = região.ObterRepresentante(); itemInfo["Representante"] = (representante == null ? "" : representante.PrimeiroNome); itemInfo["Região"] = (região.Nome); } else { itemInfo["Representante"] = ""; itemInfo["Região"] = "Todas"; } info.Rows.Add(itemInfo); foreach (Entidades.Pessoa.Impressão.PessoaImpressão p in pessoas) { DataRow linha = tabela.NewRow(); MapearItem(p, linha); tabela.Rows.Add(linha); } relatório.SetDataSource(ds); }
//Begin public static void ShowRp(ReportClass rc, object objDataSource, Window parentWindow, string database, string server, string use, string pass) { try { rc.SetDataSource(objDataSource); ReportViewUI Viewer = new ReportViewUI(); //log on TableLogOnInfos logonInfos = new TableLogOnInfos(); TableLogOnInfo logonInfo = new TableLogOnInfo(); ConnectionInfo connectioninfo = new ConnectionInfo(); Tables CrTables; // tham so server connectioninfo.DatabaseName = database; connectioninfo.ServerName = server; connectioninfo.Password = pass; connectioninfo.UserID = use; CrTables = rc.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables) { logonInfo = CrTable.LogOnInfo; logonInfo.ConnectionInfo = connectioninfo; CrTable.ApplyLogOnInfo(logonInfo); } // Viewer.setReportSource(rc); Viewer.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public ActionResult PurchasesMaster() { // var unitId = System.Web.HttpContext.Current.Session["ReportName"].ToString(); // Setting ReportName // string strFromDate = System.Web.HttpContext.Current.Session["rptFromDate"].ToString(); // Setting FromDate // string strToDate = System.Web.HttpContext.Current.Session["rptToDate"].ToString(); // Setting ToDate // var rptSource = System.Web.HttpContext.Current.Session["rptSource"]; //Rename Processed Batch // string newPath = AddSuffix(sourceFile, String.Format("({0})", parameters.IsProcessed)); //FileInfo fi = new FileInfo(sourceFile); //if (fi.Exists) //{ // fi.MoveTo(newPath); //} SqlConnection con = new SqlConnection(Helpers.Helpers.DatabaseConnect); DataTable dt = new DataTable(); try { con.Open(); SqlCommand cmd = new SqlCommand("SELECT AllocationName,ExpenseName,UnitName,VendorName,ActualAmount,Reference,CreatedOn,CurrencyAbbr,Discount FROM vw_PurchasesByCriteria ", con); SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); } catch (Exception ex) { ExceptionLogging.SendErrorToText(ex); ViewBag.ErrorMessage = Messages.GENERAL_ERROR; return(View()); // ex.Message.ToString(); } // string OutputFileName = BatchId + "_" + monthend + ".xlsx"; ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath(("~/Reports/") + "PurchasesByCriteria.rpt"); rptH.Load(); rptH.SetDataSource(dt); // string filePath = Server.MapPath("~/BatchOut/"); // string destPath = Path.Combine(filePath, ToSafeFileName(OutputFileName)); // if (formatId == parameters.Excel) // rptH.ExportToDisk(ExportFormatType.ExcelWorkbook, destPath); // Stream stream = rptH.ExportToStream(ExportFormatType.ExcelWorkbook); //return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // else // rptH.ExportToDisk(ExportFormatType.PortableDocFormat, destPath); Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
//private readonly IMasterDetailsReportService _iMasterDetailsReportService; //public MasterDetails(IMasterDetailsReportService iMasterDetailsReportService) //{ // this._iMasterDetailsReportService = iMasterDetailsReportService; //} protected void Page_Load(object sender, EventArgs e) { try { int categoryId = Convert.ToInt32(Request.QueryString["catid"]); IMasterDetailsReportService _iMasterDetailsReportService = new MasterDetailsReportService(); var masterDetailsViewModels = _iMasterDetailsReportService.GetMasterDetailsViewModelsByCategoryId(categoryId); var detailsViewModels = masterDetailsViewModels as List <MasterDetailsViewModel> ?? masterDetailsViewModels.ToList(); var reportData = detailsViewModels; ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/CrystalReports/MasterDetails.rpt"); reportClass.Load(); reportClass.SetDataSource(reportData); masterDetailsCrystalReportViewer.ReportSource = reportClass; } catch (Exception) { throw; } }
public ActionResult ShiftWiseReport(DateTime fromdate, DateTime todate, string Shift) { System.Data.DataSet ds = posTransactions.ShiftwiseItemSaleReport(fromdate, todate, Shift); System.Data.DataSet ds1 = posTransactions.companyname(); string strcompanyname = ds1.Tables[0].Rows[0]["vchcompanyname"].ToString(); string strcompanyAddress = ds1.Tables[0].Rows[0]["address"].ToString(); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reports/ShiftWiseSaleReport 2.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); rptH.SetParameterValue("CompanyName", strcompanyname); rptH.SetParameterValue("Address", strcompanyAddress); rptH.SetParameterValue("Date", fromdate); rptH.SetParameterValue("Todate", todate); //if (true) //{ // Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.ExcelRecord); // return File(stream, "application/excel"); //} Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); // stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf")); }
private void Initialize(DataSet1 ds, ReportClass rpt, string p_id) { InitializeComponent(); //set app datasource DataRow row = ds.dtApp.NewRow(); var collection = MainForm.database.GetCollection <BsonDocument>("app"); var result = collection.Find(new BsonDocument()).First(); row["app_name"] = result["name"]; row["app_address"] = result["address"]; ds.dtApp.Rows.Add(row); if (p_id != null) { collection = MainForm.database.GetCollection <BsonDocument>("patients"); var filter = Builders <BsonDocument> .Filter.Eq("_id", ObjectId.Parse(p_id)); result = collection.Find(filter).First(); row = ds.dtDataSheet.NewRow(); row["firstname"] = result["firstname"]; row["middlename"] = result["middlename"]; row["lastname"] = result["lastname"]; ds.dtDataSheet.Rows.Add(row); } rpt.SetDataSource(ds); crystalReportViewer1.ReportSource = rpt; crystalReportViewer1.Refresh(); }
public ActionResult OutWardReports(string fromdate, string todate, string Store, string Category) { System.Data.DataSet ds = mmsReports.GetOutwardData(fromdate, todate, Store, Category); if (ds != null) { System.Data.DataSet ds1 = posTransactions.companyname(); string strcompanyname = ds1.Tables[0].Rows[0]["vchcompanyname"].ToString(); string strcompanyAddress = ds1.Tables[0].Rows[0]["address"].ToString(); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reports/OuwardItemStatement.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); rptH.SetParameterValue("CompanyName", strcompanyname); rptH.SetParameterValue("Address", strcompanyAddress); rptH.SetParameterValue("FromDate", fromdate); rptH.SetParameterValue("ToDate", todate); rptH.SetParameterValue("Store", Store); rptH.SetParameterValue("Category", Category); Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); } else { return(View("StockReport")); } }
public ActionResult Reporte5AS() { String cnn = @"data source = TOSHIBA; initial catalog = BD_Colegio; persist security info = True; user id = sa; password = 12345;"; SqlConnection con = new SqlConnection(cnn); DataTable dt = new DataTable(); try { con.Open(); SqlCommand cmd = new SqlCommand("sp_matriculados", con); SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dt); } catch (Exception e) { } ReportClass rpth = new ReportClass(); rpth.FileName = Server.MapPath("~/Reporte/Secundaria/Reporte5AS.rpt"); rpth.Load(); rpth.SetDataSource(dt); Stream stream = rpth.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public void PrepararImpressão(ReportClass relatório, List<Entidades.PedidoConserto.Pedido> pedidos) { DataSetRecibo ds = new DataSetRecibo(); DataTable tabela = ds.Tables["Recibo"]; foreach (Entidades.PedidoConserto.Pedido p in pedidos) { DataRow linha = tabela.NewRow(); MapearItem(p, linha); tabela.Rows.Add(linha); } DataTable tabelaItens = ds.Tables["Itens"]; ControleImpressãoPedido.PrepararItens(pedidos, tabelaItens); DataRow linha2 = tabelaItens.NewRow(); linha2["código"] = 22; linha2["pedido"] = 33; linha2["referênciaFormatada"] = "ref. formatada"; tabelaItens.Rows.Add(linha2); relatório.SetDataSource(ds); //relatório.Subreports["Miolo.rpt"].SetDataSource(ds); }
public void PrepararImpressão(ReportClass relatório, List<Entidades.PedidoConserto.Pedido> pedidos, DateTime início, DateTime fim, bool apenasConsertos, bool períodoPrevisão) { DataSetPedido ds = new DataSetPedido(); DataTable tabela = ds.Tables["Pedido"]; DataTable info = ds.Tables["Informações"]; DataRow item = info.NewRow(); item["dataInicio"] = início.ToShortDateString(); item["dataFim"] = fim.ToShortDateString(); item["título"] = apenasConsertos ? "Relação de Consertos" : "Relação de Pedidos"; item["tipoPeríodo"] = períodoPrevisão ? "Previsão" : "Recebido"; info.Rows.Add(item); DataTable tabelaItens = ds.Tables["Itens"]; PrepararItens(pedidos, tabelaItens); DataTable tabelaRastro = ds.Tables["Rastro"]; Dictionary<string, List<Entidades.Mercadoria.Mercadoria.RastroConsignado>> rastreamentos = Entidades.Mercadoria.Mercadoria.ObterRastreamento(); foreach (KeyValuePair<string, List<Entidades.Mercadoria.Mercadoria.RastroConsignado>> par in rastreamentos) { foreach (Entidades.Mercadoria.Mercadoria.RastroConsignado rastro in par.Value) { DataRow linha = tabelaRastro.NewRow(); linha["referênciaNumérica"] = par.Key; linha["quantidade"] = rastro.Quantidade; linha["pessoaNome"] = Entidades.Pessoa.Pessoa.AbreviarNome(rastro.Pessoa.Nome); tabelaRastro.Rows.Add(linha); } } List<Entidades.PedidoConserto.Pedido> listaPedidos = new List<Entidades.PedidoConserto.Pedido>(); foreach (Entidades.PedidoConserto.Pedido pedido in pedidos) { /* Na apresentação, pode-se escolher entre já entregues ou não. * Porém, apenas os ainda não entregues são obtidos para impressão. * * É necessário filtrar ainda ou já concluidos. * Só é impresso a pendência, ou seja, os pedidos não concluídos. */ if (!pedido.DataConclusão.HasValue) listaPedidos.Add(pedido); } //listaPedidos.Sort(); foreach (Entidades.PedidoConserto.Pedido p in listaPedidos) { DataRow linha = tabela.NewRow(); MapearItem(p, linha); tabela.Rows.Add(linha); } relatório.SetDataSource(ds); }
public void PrepararImpressão(ReportClass relatório, Entidades.Pagamentos.NotaPromissória entidade) { DataSetNotaPromissória ds = new DataSetNotaPromissória(); DataTable tabela = ds.Tables["NotaPromissória"]; tabela.Rows.Add(CriarItem(entidade, tabela)); relatório.SetDataSource(ds); }
public ReportClass GetReportClass(object report, DataSet items) { // ReportDocument rd = new ReportDocument(); ReportClass reporte = (ReportClass)report; reporte.Load(); if (items.Tables.Count > 1) { reporte.SetDataSource(items); } else { DataTable dt = items.Tables[0]; reporte.SetDataSource(dt); } return(reporte); }
public ActionResult DescargarReporteAsignacionesExcel(int?id) { try { var rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reportes/AsignacionReport.rpt"); rptH.Load(); if (id == null) { rptH.SetDataSource(ProyectoCN.ListarAsignaciones()); } else { rptH.SetDataSource(ProyectoCN.ListarAsignaciones(id.Value)); } // Report connection var connInfo = CrystalReportsCnn.GetConnectionInfo(); TableLogOnInfo logonInfo = new TableLogOnInfo(); Tables tables; tables = rptH.Database.Tables; foreach (Table table in tables) { logonInfo = table.LogOnInfo; logonInfo.ConnectionInfo = connInfo; table.ApplyLogOnInfo(logonInfo); } Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); // Descargar en Excel Stream stream = rptH.ExportToStream(ExportFormatType.Excel); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/vnd.ms-excel", "asignacionRpt.xls")); } catch (Exception ex) { return(Json(new { ok = false, msg = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public void PrintPreview(ReportClass iReport, string rpt_procedure, Hashtable ht, bool isPrint) { try { DataTable DTab_reportData = (DataTable)ReportData(rpt_procedure); if (DTab_reportData.Rows.Count > 0) { if (isPrint == false) { // frmRptv ifrmPrint = new frmRptv(); iReport.SetDataSource(DTab_reportData); foreach (object obj in ht.Keys) { iReport.SetParameterValue(obj.ToString(), ht[obj]); } frmPrint ifrmPrint = new frmPrint(iReport); ifrmPrint.Visible = true; } else { iReport.ReportOptions.EnableSaveDataWithReport = true; iReport.SetDataSource(DTab_reportData); foreach (object obj in ht.Keys) { iReport.SetParameterValue(obj.ToString(), ht[obj]); } iReport.PrintToPrinter(1, false, 0, 0); //iReport.PrintToPrinter(1, false, 0, 0); } } else { MessageBox.Show("No Records Found"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { } }
public ActionResult BillReprintReport(string BillNo, string Billtype, string Takeawayno, string Printtype) { System.Data.DataSet ds = posTransactions.BillReprintReport(BillNo, Billtype); System.Data.DataSet ds1 = posTransactions.companyname(); string strcompanyname = ds1.Tables[0].Rows[0]["vchcompanyname"].ToString(); string strcompanyAddress = ds1.Tables[0].Rows[0]["address"].ToString(); string Hostname = ""; string session = ""; ReportClass rptH = new ReportClass(); if (Takeawayno == null) { Takeawayno = ""; } if (Billtype == "Dinning") { rptH.FileName = Server.MapPath("/Reports/rptBillGeneration.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); } else { rptH.FileName = Server.MapPath("/Reports/rptBillReprint.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); rptH.SetParameterValue("TakeAwayNo", Takeawayno); rptH.SetParameterValue("Billtype", Billtype); } rptH.SetParameterValue("CompanyName", strcompanyname); rptH.SetParameterValue("Address", strcompanyAddress); rptH.SetParameterValue("TableId", ds.Tables[0].Rows[0]["tableid"]); rptH.SetParameterValue("BillNo", ds.Tables[0].Rows[0]["vchbillno"]); rptH.SetParameterValue("HostName", Hostname); rptH.SetParameterValue("Printtype", Printtype); rptH.SetParameterValue("SessionNo", session); Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public static void PrepararImpressão(ReportClass relatório, List<Entidades.PedidoConserto.Pedido> pedidos) { DataSetPedidosParaFornecedores ds = new DataSetPedidosParaFornecedores(); PrepararFornecedores(ds); PrepararItens(pedidos, ds); PrepararObservações(pedidos, ds); relatório.SetDataSource(ds); relatório.Subreports["RelatórioPedido.rpt"].SetDataSource(ds); }
/// <summary> /// รายงานสรุปการจ่ายค่าเที่ยวพนักงานขับรถประจำงวด /// </summary> /// <returns></returns> public ActionResult CarDriversPayPeriod() { List <CarDriversPayPeriod> list = new List <CarDriversPayPeriod>(); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Views/Report/CarDriversPayPeriod.rpt"); rptH.Load(); rptH.SetDataSource(list); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public ActionResult MonthlyTransporting() { List <MonthlyTransporting> list = new List <MonthlyTransporting>(); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Views/Report/MonthlyTransporting.rpt"); rptH.Load(); rptH.SetDataSource(list); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
/// <summary> /// รายงานสรุปการเกิดอุบัติเหตุรถขนส่งประจำเดือน /// </summary> /// <returns></returns> public ActionResult MonthlyAccident() { List <MonthlyAccident> list = new List <MonthlyAccident>(); ReportClass rptH = new ReportClass(); //C:\inetpub\wwwroot\TMS\Views\Report rptH.FileName = Server.MapPath("~/Views/Report/MonthlyAccident.rpt"); rptH.Load(); rptH.SetDataSource(list); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public ActionResult RenewalReport(RenewalSearch obj, string actionType) { if (string.Equals(actionType, "Download")) { if (!string.IsNullOrEmpty(obj.Exactdate)) { obj.Fromdate = null; obj.Todate = null; } else if (!string.IsNullOrEmpty(obj.Fromdate) && !string.IsNullOrEmpty(obj.Todate)) { obj.Exactdate = "1990-01-01 00:00:00.000"; } if (string.IsNullOrEmpty(obj.RenewalSearchID)) { ModelState.AddModelError("Error", "Please select By Exact Date or By Between Date !"); } else if (string.IsNullOrEmpty(obj.Exactdate) && obj.RenewalSearchID == "1") { ModelState.AddModelError("Error", "Please enter Exact date!"); } else if (string.IsNullOrEmpty(obj.Fromdate) && obj.RenewalSearchID == "2") { ModelState.AddModelError("Error", "Please enter From date!"); } else if (string.IsNullOrEmpty(obj.Todate) && obj.RenewalSearchID == "2") { ModelState.AddModelError("Error", "Please enter To date!"); } else { DataSet ds = objIRecepit.Get_RenewalReport(obj); ds.Tables[0].TableName = "RecepitDataset"; if (ds.Tables[0].Rows.Count > 0) { ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("~/Reports/ExactDate.rpt"); rptH.Load(); rptH.SetDataSource(ds.Tables[0]); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "RenewalReport.pdf")); } } } return(View(obj)); }
public void Display_report(ReportClass rc, object objDataSource, Window parentWindow) { try { rc.SetDataSource(objDataSource); this.setReportSource(rc); } catch (Exception ex) { throw ex; } }
private ReportClass GenerateResultReport(int id) { var dataTable = GenerateData(id); var report = new ReportClass(); report.FileName = Server.MapPath("/Reports/Results.rpt"); report.Load(); report.SetDataSource(dataTable); return(report); }
public ActionResult GetBranchDetailsCR() { DataTable dt = new DataTable(); dt = ReportsManager.GetBranchDetails(1); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("../Content/cr_BranchDetails.rpt"); rptH.Load(); rptH.SetDataSource(dt); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public ActionResult Download(string reportname, ReportByProductBrandOption search) { ReportClass rptH = new ReportClass(); rptH.FileName = ReportPath(reportname); var data = searchProduct(search).ToList(); rptH.SetDataSource(data); rptH.SetParameterValue("datefrom", search.FromDate.ToReportFormat()); rptH.SetParameterValue("dateto", search.ToDate.ToReportFormat()); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
private ReportClass GenerateUserCrystalReport() { var dataTable = GenerateData(); var report = new ReportClass(); report.FileName = Server.MapPath("/Reports/Users.rpt"); report.Load(); report.SetDataSource(dataTable); return(report); }
//Used for showing simple report public void ShowSimple() { using (ReportClass reportClass = new ReportClass()) { var productList = _db.Products.ToList().Select(x => new ProductViewModel { ProductId = x.ProductId, ProductName = x.Name, ProductPrice = x.Price }); reportClass.FileName = Server.MapPath("~/") + "//CrystalReports//simple.rpt"; reportClass.SetDataSource(productList); reportClass.Load(); reportClass.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crystalReport"); } }
public ActionResult ViewVariableProfitCost() { List <VariableProfitCost> list = new List <VariableProfitCost>(); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Views/Report/VariableProfitCost.rpt"); rptH.Load(); rptH.SetDataSource(list); rptH.SetParameterValue("Date", "มิถุนายน 2559"); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
/// <summary> /// รายงานการขนส่งประจำวัน /// </summary> /// <returns></returns> public ActionResult Transporting() { List <Transporting> list = new List <Models.Transporting>(); //list.Add(new Models.Transporting() { BeginDate = DateTime.Now, Destination = "บ่อเต็ง/ลาว", Distance = 2350, Driver = "นายสมหวัง บรรจง", Head = "62-7340กท", Mobile = "087-079-0879", NumberOfDriver = 1, Source = "กม19", Tail = "78-2431กท", TankNO = "PXT03315004-9", WorkTime = 45 }); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Views/Report/Transporting.rpt"); rptH.Load(); rptH.SetDataSource(list); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
public ActionResult Print() { ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("~/Content/report/demo.rpt"); List<dynamic> mock = new List<dynamic>(); for (int i=0;i<10;i++) { mock.Add( new {Id = 1,Name="test"}); } rptH.SetDataSource(mock); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public void PrepararImpressão(ReportClass relatório, IEnumerable<Entidades.Mercadoria.MercadoriaImpressão> mercadoria) { DataSetMercadoria ds = new DataSetMercadoria(); DataTable tabela = ds.Tables["Mercadoria"]; foreach (Entidades.Mercadoria.MercadoriaImpressão m in mercadoria) { DataRow linha = tabela.NewRow(); MapearItem(m, linha); tabela.Rows.Add(linha); } relatório.SetDataSource(ds); }
public byte[] readRPT() { ReportClass rptH = new ReportClass(); try { ParameterDiscreteValue par; rptH.FileName = file; rptH.Load(); rptH.SetDataSource(listData["table"]); foreach (ReportDocument subreport in rptH.Subreports) { if (listData.ContainsKey(subreport.Name.Trim().ToLower())) { subreport.SetDataSource(listData[subreport.Name.Trim().ToLower()]); } } parameters = insencitiveParameter(); foreach (ParameterField field in rptH.ParameterFields) { if (parameters != null) { if (parameters.ContainsKey(field.Name.Trim().ToLower())) { par = new ParameterDiscreteValue(); par.Value = parameters[field.Name.Trim().ToLower()]; field.CurrentValues.Add(par); } } } System.IO.Stream stream = rptH.ExportToStream(this.type); byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, (int)stream.Length); return buffer; } finally { rptH.Close(); rptH.Dispose(); } }
public ActionResult AssignValueinReport(int id) { DataTable dtbranchdetails = new DataTable(); DataTable dtpatientvisit = new DataTable(); using (HMSDBEntities context = new HMSDBEntities()) { var branchdetails = context.sp_BranchDetails(1); var patientvisit = context.sp_GetReceipt(id); dtbranchdetails = ExtensionMethods.ConvertToDataTable(branchdetails); dtpatientvisit = ExtensionMethods.ConvertToDataTable(patientvisit); ReportClass rptH = new ReportClass(); //rptH.FileName = Server.MapPath("~/Content/cr_RegReceipt.rpt"); rptH.FileName = @"C:/Users/tanmay/Documents/GitHub/HMSApp/HospitalManagement/HospitalManagement/Content/cr_RegReceipt.rpt"; rptH.Load(); rptH.Subreports["cr_BranchDetails.rpt"].SetDataSource(dtbranchdetails);//datasource for subreport rptH.SetDataSource(dtpatientvisit);//Mainreport datasourcc Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); } }
public static void PrepararImpressão(ReportClass relatório, List<Entidades.PedidoConserto.MercadoriaEmFalta> itens) { DataSetMercadoriaEmFalta ds = new DataSetMercadoriaEmFalta(); DataTable tabelaPedidoItem = ds.Tables["PedidoItem"]; List<Entidades.PedidoConserto.Pedido> pedidos = Entidades.PedidoConserto.MercadoriaEmFalta.ObterPedidosQueTemMercadoriasEmFalta(); foreach (Entidades.PedidoConserto.MercadoriaEmFalta item in itens) { DataRow linha = tabelaPedidoItem.NewRow(); linha["referênciaFormatada"] = item.ReferênciaFormatada; linha["quantidade"] = item.Quantidade; linha["fornecedor"] = item.Fornecedor; linha["pedidos"] = item.Pedidos; linha["detalhes"] = item.Detalhes; linha["referênciaFornecedor"] = item.ReferênciaFornecedorFFL; linha["saldoConsignado"] = item.SaldoConsignado; tabelaPedidoItem.Rows.Add(linha); } // Observação dos pedidos DataTable tabelaPedido = ds.Tables["Pedido"]; foreach (Entidades.PedidoConserto.Pedido p in pedidos) { //if (p.Observações != null && p.Observações.Trim().Length > 0 // && numeraçãoPedidosMostrados.Contains(p.Código.ToString())) if (!p.DataConclusão.HasValue && p.Observações != null && p.Observações.Trim().Length > 0) { DataRow linha = tabelaPedido.NewRow(); linha["código"] = p.Código; linha["observações"] = p.Observações.Trim(); tabelaPedido.Rows.Add(linha); } } relatório.SetDataSource(ds); relatório.Subreports["RelatórioPedido.rpt"].SetDataSource(ds); }
public ActionResult ManagerRPTEXCELall(string startDate = "", string endDate="") { ManagerinfoEntity _Model = new ManagerinfoEntity(); _Model.StartDate = startDate; _Model.EndDate = endDate; ALLManagerrptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/ALLManagerrpt.rpt"); rptH.Load(); DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetManagerRecord, _Model); List<ManagerinfoEntity> ItemList = null; ItemList = new List<ManagerinfoEntity>(); foreach (DataRow dr in dt.Rows) { ItemList.Add(new ManagerinfoEntity() { PDate = dr["PDate"].ToString(), EMPID = dr["EMPID"].ToString(), EName = dr["EName"].ToString(), Designation = dr["Designation"].ToString(), DeptName = dr["DeptName"].ToString(), Intime = dr["Intime"].ToString(), Outtime = dr["Outtime"].ToString(), Status = dr["Status"].ToString(), }); } foreach (ManagerinfoEntity dr in ItemList) { obj = new ALLManagerrptEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel); return File(stream, "application/octet-stream", "ManagerAttend.xls"); }
public virtual void PrepararImpressão(ReportClass relatório, List<Entidades.Estoque.Saldo> itens) { relatório.SetDataSource(GerarDataSet(itens)); }
private void toolStripButton3_Click(object sender, EventArgs e) { HeaderContent = _repo.GetPackOrderByID(HeaderContent.WorkOrderId); ReportClass rptH = new ReportClass(); dsPlanning ds = new dsPlanning(); string outPath = Application.StartupPath + string.Format(@"\\Out\\{0}.pdf", HeaderContent.WorkOrderNum); rptH.FileName = Application.StartupPath + "\\Reports\\Planning\\PackingOrder.rpt"; ds.PackingOrderHead.AddPackingOrderHeadRow(HeaderContent.Id, HeaderContent.WorkOrderId, HeaderContent.WorkOrderNum , HeaderContent.DueDate, HeaderContent.IssueDate, HeaderContent.PackOrderNum , HeaderContent.CompleteFlag, HeaderContent.Remark); foreach (var p in HeaderContent.PackStyles) { ds.PackStyleLines.AddPackStyleLinesRow(p.HeadLineID, p.Id, p.CustId, p.CustomerName, p.ThickMin, p.ThickMax , p.WidthMin, p.WidthMax, p.StyleCode, p.Remarks); foreach (var k in HeaderContent.SkidPacks.Where(i => i.PackStyleId == p.Id)) { ds.SkidPackingDesign.AddSkidPackingDesignRow(k.PackStyleId, k.Seq, k.SkidNumber, k.Description, k.Id); foreach (var s in HeaderContent.SerialLines.Where(i => i.PackStyleId == p.Id && i.PackingDesignId == k.Id)) { ds.SerialsByPackingStyle.AddSerialsByPackingStyleRow(s.PackStyleId, s.SerialNo, s.Thick, s.Width, s.Length, s.PackingDesignId); } } } rptH.Load(); ds.AcceptChanges(); rptH.SetDataSource(ds); rptH.Refresh(); rptH.ExportToDisk(ExportFormatType.PortableDocFormat, outPath); OpenPdfFile(outPath); }
public ActionResult GetReceipt(int id) { DataSet ds = new DataSet(); ds = ReportsManager.GetReceipt(id, 1); ReportClass rptH = new ReportClass(); //rptH.FileName = Server.MapPath("../Content/cr_RegReceipt.rpt"); rptH.FileName = @"C:/Users/tanmay/Documents/GitHub/HMSApp/HospitalManagement/HospitalManagement/Content/cr_RegReceipt.rpt"; rptH.Load(); //rptH.SetDataSource(ds.Tables["dtpatientvisit"]); rptH.SetDataSource(ds.Tables["Table1"]); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public ActionResult GenerateReport(string empresa,string entidade) { ClientesDataSet dt = imprimirPdf(empresa,entidade); ReportClass objReport = new ReportClass(); objReport.FileName = Server.MapPath("/Content/Reports/ExtratoPendentes.rpt"); objReport.Load(); //objReport.SetDataSource(dt); objReport.SetDataSource(dt.Tables["Pendentes"]); objReport.Database.Tables["Pendentes"].SetDataSource(dt.Tables["Pendentes"]); objReport.Database.Tables["Clientes"].SetDataSource(dt.Tables["Clientes"]); objReport.Subreports["ContasBancarias"].SetDataSource(dt.Tables["Banco"]); objReport.OpenSubreport("Pendentes").SetDataSource(dt.Tables["Pendentes"]); objReport.DataDefinition.FormulaFields["NomeEmpresa"].Text = "'" + "Accsys" + "'"; objReport.DataDefinition.FormulaFields["MoradaEmpresa"].Text = "'" + "Maputo" + "'"; objReport.DataDefinition.FormulaFields["LocalidadeEmpresa"].Text = "'" + "Maputo" + "'"; objReport.DataDefinition.FormulaFields["TelefoneEmpresa"].Text = "'+ " + "+258" + "'"; objReport.DataDefinition.FormulaFields["NuitEmpresa"].Text = "' Nuit : " + "123456" + "'"; objReport.DataDefinition.FormulaFields["EmailEmpresa"].Text = "'" + "*****@*****.**" + "'"; //objReport.DataDefinition.FormulaFields["Ao_Cuidado_de"].Text = "' " + objectoContacto.Titulo + " " + objectoContacto.PrimeiroNome + " " + objectoContacto.UltimoNome + "'"; Stream stream = objReport.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public ActionResult NorthTowerrptall(string p1 = "", string p2 = "") { AttendanceEntity _Model = new AttendanceEntity(); _Model.StartDate = p1; _Model.EndDate = p2; AttendanceEntity obj; //ReportClass rptH = new ReportClass(); ReportClass rpt = new ReportClass(); ArrayList al = new ArrayList(); rpt.FileName = Server.MapPath("/Reports/CrystalReport1.rpt"); rpt.Load(); DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetAttenInfoRecord, _Model); List<AttendanceEntity> ItemList = null; ItemList = new List<AttendanceEntity>(); // List<NorthTowerdaycal> ItemList = (List<NorthTowerdaycal>)Session["NTR"]; foreach (DataRow dr in dt.Rows) { ItemList.Add(new AttendanceEntity() { PDate = dr["PDate"].ToString(), EMPID = dr["EMPID"].ToString(), EName = dr["EName"].ToString(), Designation = dr["Designation"].ToString(), DeptName = dr["DeptName"].ToString(), Intime = dr["Intime"].ToString(), Outtime = dr["Outtime"].ToString(), Status = dr["Status"].ToString(), }); } foreach (AttendanceEntity dr in ItemList) { obj = new AttendanceEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rpt.SetDataSource(al); MemoryStream stream = (MemoryStream)rpt.ExportToStream(ExportFormatType.Excel); return File(stream, "application/octet-stream", "ManagerAttend.xls"); }
private void butPrint_Click(object sender, EventArgs e) { var result = HeaderContent.SerialLines.Where(i => i.CutSeq == HeaderContent.CutSeq).Min(i => i.LengthActual); if (!timer1.Enabled) { MessageBox.Show("Pleas start work before calculate weight.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (result == 0) { MessageBox.Show("Please complete all data in the Grid.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_repo.SaveSerialCutting(epiSession, HeaderContent)) { CuttedLineUpModel cutline = new CuttedLineUpModel(); var matlineid = (from item in HeaderContent.SerialLines where item.CutSeq == HeaderContent.CutSeq select item.MaterialTransLineID).First(); cutline.ProductionID = HeaderContent.ProductionID; cutline.WorkOrderID = HeaderContent.WorkOrderID; cutline.CutSeq = HeaderContent.CutSeq; cutline.StartTime = DateTime.Now; cutline.FinishTime = DateTime.Now; cutline.MaterialTransLineID = matlineid; HeaderContent.Cutteds = _repo.SaveCuttedLineUp(epiSession, cutline).ToList(); SetTimeControl("Print"); ReportClass rptH = new ReportClass(); dsProduction ds = new dsProduction(); string outPath = Application.StartupPath + "\\Out\\test.pdf"; rptH.FileName = Application.StartupPath + "\\Reports\\Production\\ProductionLabel1.rpt"; foreach (var item in HeaderContent.SerialLines.Where(i => i.CutSeq == HeaderContent.CutSeq)) { ds.Label.AddLabelRow(item.SerialNo, item.NGFlag.ToString()); } rptH.Load(); ds.AcceptChanges(); rptH.SetDataSource(ds); rptH.Refresh(); rptH.ExportToDisk(ExportFormatType.PortableDocFormat, outPath); OpenPdfFile(outPath); } }
public ActionResult ReportView() { ReportClass rptH = new ReportClass(); DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetManagerReportView, null); rptH.FileName = Server.MapPath("/Reports/ALLManagerrpt.rpt"); rptH.Load(); rptH.SetDataSource(dt); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public ActionResult NorthtowerDeptrptExcel() { EmployeeWise obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/NTDeptrpt.rpt"); rptH.Load(); List<EmployeewiseEntity> ItemList = (List<EmployeewiseEntity>)Session["NTDept"]; foreach (EmployeewiseEntity dr in ItemList) { obj = new EmployeeWise(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel); //For Excel File return File(stream, "application/octet-stream", "NorthTower.xls"); //For Excel with File Name }
public ActionResult AppearlDeptrpt() { ApparelWiserptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/AppearlDeptrpt.rpt"); rptH.Load(); List<ApprealInfoEntity> ItemList = (List<ApprealInfoEntity>)Session["APPDept"]; foreach (ApprealInfoEntity dr in ItemList) { obj = new ApparelWiserptEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public ActionResult Appearldaycalrpt() { AppearldaycalrptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/Appearldaycalrpt.rpt"); rptH.Load(); List<AppearldaycalEntity> ItemList = (List<AppearldaycalEntity>)Session["Appreal"]; foreach (AppearldaycalEntity dr in ItemList) { obj = new AppearldaycalrptEntity(); obj.EMPID = dr.EMPID; obj.ENAME = dr.ENAME; obj.SECTION = dr.SECTION; obj.JDate = dr.JDate; obj.Status = dr.Status; obj.TTDay = dr.TTDay; obj.Holiday = dr.Holiday; obj.Present = dr.Present; obj.Absent = dr.Absent; obj.CL = dr.CL; obj.SL = dr.SL; obj.ML = dr.ML; obj.EL = dr.EL; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.PortableDocFormat); return File(stream, "application/pdf"); }
public ActionResult ALLManagerRPTEXCEL() { ALLManagerrptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/ALLManagerrpt.rpt"); rptH.Load(); List<ManagerinfoEntity> ItemList = (List<ManagerinfoEntity>)Session["ALLMGR"]; foreach (ManagerinfoEntity dr in ItemList) { obj = new ALLManagerrptEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel); return File(stream, "application/octet-stream", "ManagerAttend.xls"); }
public ActionResult ReportViewExcel() { AttendanceEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/CrystalReport1.rpt"); rptH.Load(); List<AttendanceEntity> ItemList = (List<AttendanceEntity>)Session["opl"]; foreach (AttendanceEntity dr in ItemList) { obj = new AttendanceEntity(); obj.PDate = dr.PDate; obj.EMPID = dr.EMPID; obj.EName = dr.EName; obj.Designation = dr.Designation; obj.DeptName = dr.DeptName; obj.Intime = dr.Intime; obj.Outtime = dr.Outtime; obj.Status = dr.Status; al.Add(obj); } rptH.SetDataSource(al); MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel); return File(stream, "application/octet-stream", "NorthTower.xls"); }
public virtual void PrepararImpressão(ReportClass relatório, ControleAcertoMercadorias relacionamento) { relatório.SetDataSource(GerarDataSet(relacionamento)); }