/// <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 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"); }
public ActionResult DescargarVentaProductos() { try { var rptH = new ReportClass(); rptH.FileName = Server.MapPath("/Reportes/ReportesProductos/VentaProductos.rpt"); rptH.Load(); var connInfo = CrystalReportCnn.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(); Stream stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat); rptH.Dispose(); rptH.Close(); return(new FileStreamResult(stream, "application/pdf")); } catch (Exception) { throw; } }
public static void exportarReporte(ReportClass pReporte, string pNombre, string pFormula, ExportFormatType pFormato) { try { PrincipalUI.cursorEnEspera(); ConnectionInfo connInfo = obtenerConexionReporte(); SetDBLogonForReport(connInfo, pReporte); SetDBLogonForSubreports(connInfo, pReporte); if (pFormula != null) { pReporte.RecordSelectionFormula = pFormula; } string ruta = System.IO.Path.GetTempPath() + pNombre + DateTime.Now.Ticks + obtenerExtensionReporte(pFormato.ToString()); pReporte.ExportToDisk(pFormato, ruta); pReporte.Load(ruta); pReporte.Close(); Process.Start(ruta); } catch (Exception ex) { Mensajes.mensajeError(ex); } PrincipalUI.cursorPredeterminado(); }
// // 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 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 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")); }
public ActionResult ApparelWiserpt() { ApparelWiserptEntity obj; ReportClass rptH = new ReportClass(); ArrayList al = new ArrayList(); rptH.FileName = Server.MapPath("/Reports/ApparelWiserpt.rpt"); rptH.Load(); List<ApprealInfoEntity> ItemList = (List<ApprealInfoEntity>)Session["Apparel"]; 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"); }
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); }
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); }
//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 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 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 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")); }
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")); }
//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 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 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 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 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; } }
public Stream GetReportPDF(object report, Dictionary <string, object> items) { // ReportDocument rd = new ReportDocument(); ReportClass reporte = (ReportClass)report; reporte.Load(); foreach (var item in items) { if (item.Key.Split('.')?.ToList()?.Count() > 1) { string subReport = item.Key.Split('.')[0]; string dataSource = item.Key.Split('.')[1]; reporte.Subreports[subReport].Database.Tables[dataSource].SetDataSource(item.Value); } else { reporte.Database.Tables[item.Key].SetDataSource(item.Value); } } //reporte.SetDataSource(items); Stream stream = reporte.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); reporte.Close(); return(stream); }
public JsonResult InitializeMonthlyRFCReport(IenumerableReportResult model, string param) { if (string.IsNullOrEmpty(param)) { return(Json(new { status = false, resCode = "0", msg = "Something went wrong with report parameters. Please re-generate report or contact support. Thank you." }, JsonRequestBehavior.AllowGet)); } string[] values = User.Identity.Name.Split('|'); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("~/CrystalReport/rptDailyReport.rpt"); rptH.Load(); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); rptH.Close(); rptH.Dispose(); rptH = null; Session["MonthlyRFCRptSession"] = stream; string pdfname = "daily-report" + DateTime.Now; return(Json(new { status = true, resCode = "1", msg = "Success", pdfName = pdfname }, JsonRequestBehavior.AllowGet)); }
//Used for showing simple report public void ShowSimple() { using (ReportClass rptH = new ReportClass()) { rptH.FileName = Server.MapPath("~/") + "//Rpts//simple.rpt"; rptH.Load(); rptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport"); } }
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 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)); }
private ReportClass GenerateUserCrystalReport() { var dataTable = GenerateData(); var report = new ReportClass(); report.FileName = Server.MapPath("/Reports/Users.rpt"); report.Load(); report.SetDataSource(dataTable); return(report); }
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")); }
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); }
/// <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")); }
/// <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 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 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")); }
//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"); } }
/// <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")); }
/// <summary> /// รายงานการซ่อมบำรุง /// </summary> /// <returns></returns> public ActionResult Maintenance() { List <CKLINE.Models.Maintenance> list = new List <CKLINE.Models.Maintenance>(); //list.Add(new Maintenance() { BeginDate = DateTime.Now, EndDate = DateTime.Now.AddDays(2), CarRegis = "บท-8340", Job = "พวงมาลัยไม่ตรง,ยางหลังปลิ", Garage = "สุภณัฐ" }); //list.Add(new Maintenance() { BeginDate = DateTime.Now, EndDate = DateTime.Now.AddDays(2), CarRegis = "50-2162", Job = "เวลาขับรถขึ้นเขา ความร้อนจะขึ้นสูง ผิดปกติ", Garage = "ธนาศักดิ์" }); ReportClass rptH = new ReportClass(); rptH.FileName = Server.MapPath("~/Views/Report/Maintenance.rpt"); rptH.Load(); rptH.SetDataSource(list); Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(stream, "application/pdf")); }
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 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 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"); }
/// <summary> /// The method reports application form new student addmission /// </summary> /// <param name="httpctx">this paramters is require as method is call asynchronously on seperate thread,hence current hhtp context</param> /// <param name="id">student id,which is in guid form is sent to report</param> /// <returns>Reports stream which can converted to pdf</returns> public Stream generateApplicationForm(HttpContext httpctx, string id) { ReportClass ApplicationForm = new ReportClass(); ApplicationForm.FileName = httpctx.Server.MapPath("~/Reports/ApplicationForm.rpt"); ApplicationForm.Load(); ApplicationForm.PrintOptions.PaperSize = PaperSize.PaperA4; ApplicationForm.SetParameterValue("StudentID", "{" + id + "}"); return genericReportSetting(ApplicationForm, httpctx); }
public async Task<ActionResult> PrintOR(string _orNo) { List<orDTO> _list = new List<orDTO>(); string _path = ""; _path = "/CrystalReport/rptOR.rpt"; var sql = await (from tcol in db.T_COLLECTION from tbilld in db.T_BILLCHRGD from tbillh in db.T_BILLCHRGH from mpai in db.M_PAIP where tbilld.BCDSINO == tcol.COLREFNO && tbilld.COLORNUM == tcol.COLORNUM && tcol.COLORNUM == _orNo && tbilld.BCHCHRGNO == tbillh.BCHCHRGNO && tbillh.PAPIN == mpai.PAPIN select new { T_COLLECTION = tcol, T_BILLCHRGD = tbilld, M_PAIP = mpai}).ToListAsync(); foreach (var r in sql) { orDTO tbl = new orDTO(); //tbl.colamt = r.T_COLLECTION.COLAMT.ToString(); //tbl.basic_premium = r.T_BILLCHRGD.BASIC_PREMIUM.ToString(); //tbl.doc_stamp = r.T_BILLCHRGD.DOC_STAMP.ToString(); //tbl.comp_fee = r.T_BILLCHRGD.COMP_FEE.ToString(); //tbl.cert_fee = r.T_BILLCHRGD.CERT_FEE.ToString(); //tbl.tax_amtd = r.T_BILLCHRGD.TAX_AMT.ToString(); //tbl.e_vat = r.T_BILLCHRGD.E_VAT.ToString(); //tbl.lgt = r.T_BILLCHRGD.LGT.ToString(); //tbl.coi = r.T_BILLCHRGD.COI.ToString(); //tbl.colordte = r.T_COLLECTION.COLORDTE.ToString(); //tbl.colpayor = r.T_COLLECTION.COLPAYOR.ToString(); //tbl.colno = r.T_COLLECTION.COLNO.ToString(); //tbl.clientcd = r.T_COLLECTION.CLIENTCD.ToString(); //tbl.colpymtyp = r.T_COLLECTION.COLPYMTYP.ToString(); //tbl.colornum = r.T_COLLECTION.COLORNUM.ToString(); //tbl.usrid = r.T_COLLECTION.USRID.ToString(); //tbl.with_tax = r.T_COLLECTION.WITH_TAX.ToString(); //tbl.tax_amt = r.T_COLLECTION.TAX_AMT.ToString(); //tbl.paddress = r.M_PAIP.PAADDRESS.ToString(); //tbl.plateno = r.M_PAIP.PLATE_NO.ToString(); //tbl.bcdesc = r.T_BILLCHRGD.BCDESC.ToString(); //tbl.bcdsp = r.T_BILLCHRGD.BCDSP.ToString(); //if (Session["UserType"].ToString() == "INTERNAL USER") //{ // tbl.cashier = Session["LName"].ToString(); //} //else { tbl.cashier = ""; } //if (r.M_PAIP.BY_COMPNAME != "1") //{ // tbl.company = r.M_PAIP.PALNAME + ", " + r.M_PAIP.FIRST_NAME + " " + r.M_PAIP.MIDDLE_NAME; //} //else //{ // tbl.company = r.M_PAIP.COMPANY_NAME.ToString(); //} //tbl.firstname = r.M_PAIP.FIRST_NAME.ToString(); //tbl.middlename = r.M_PAIP.MIDDLE_NAME.ToString(); //tbl.lastname = r.M_PAIP.PALNAME.ToString(); //tbl.company = r.M_PAIP.COMPANY_NAME.ToString(); tbl.papinNo = r.M_PAIP.PAPIN; tbl.assTin = r.M_PAIP.ASSURED_TIN; tbl.clientName = r.T_COLLECTION.COLPAYOR; tbl.clientAddress = r.M_PAIP.PAADDRESS; tbl.orDate = r.T_COLLECTION.COLORDTE.ToShortDateString(); tbl.orNo = r.T_COLLECTION.COLORNUM; tbl.paymentType = r.T_COLLECTION.COLPYMTYP; tbl.basicPremium = Convert.ToDecimal(r.T_BILLCHRGD.BASIC_PREMIUM); tbl.eVat = Convert.ToDecimal(r.T_BILLCHRGD.E_VAT); tbl.otherCharges = Convert.ToDecimal(r.T_COLLECTION.COLAMT) + Convert.ToDecimal(r.T_BILLCHRGD.DOC_STAMP) + Convert.ToDecimal(r.T_BILLCHRGD.COMP_FEE) + Convert.ToDecimal(r.T_BILLCHRGD.CERT_FEE) + Convert.ToDecimal(r.T_BILLCHRGD.TAX_AMT) + Convert.ToDecimal(r.T_BILLCHRGD.LGT) + Convert.ToDecimal(r.T_COLLECTION.TAX_AMT) + Convert.ToDecimal(r.T_BILLCHRGD.BCDSP); tbl.TotalAmount = tbl.basicPremium + tbl.eVat + tbl.otherCharges; tbl.cashierAgent = r.T_COLLECTION.USRID; _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"); }
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 TimeSheetPrint(string name, DateTime startDate, DateTime endDate) { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException(name); if (startDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("startDate"); if (endDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("endDate"); DataTable dataTable = GetDriverOperatorTimeSheetTable(name, startDate, endDate); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/Timesheet.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Driver / Operator Time Sheet"; reportClass.Database.Tables["DriverOperatorTimeSheet"].SetDataSource(dataTable); reportClass.SetParameterValue("DriverOperatorNameParameter", name); reportClass.SetParameterValue("StartDateParameter", startDate.ToString("d")); reportClass.SetParameterValue("EndDateParameter", endDate.ToString("d")); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "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 VehicleMachineRegisterPrint(DateTime startDate, DateTime endDate) { if (startDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("startDate"); if (endDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("endDate"); DataTable dataTable = GetVehicleMachineRegisterReportTable(startDate, endDate); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/VehicleMachineRegisterReport.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Vehicle Machine Register Report"; reportClass.Database.Tables["VehicleMachineRegister"].SetDataSource(dataTable); reportClass.SetParameterValue("StartDateParameter", startDate.ToString("d")); reportClass.SetParameterValue("EndDateParameter", endDate.ToString("d")); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "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 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 WorkDonePrint(DateTime startDate, DateTime endDate, int vehicleNo) { if (startDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("startDate"); if (endDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("endDate"); if (vehicleNo == 0) throw new InvalidArgumentException("Vehicle No can not be 0", EngineExceptionErrorID.InvalidArgument); IVehicleService vehicleService = new VehicleService(); var vehicle = vehicleService.GetVehicle(vehicleNo); var compCode = string.IsNullOrWhiteSpace(vehicle.CompanyCode) || string.Equals(vehicle.CompanyCode.ToLower(), "no") ? "N/A" : vehicle.CompanyCode; var measure = vehicle.IsVehicle ? " Km" : " Hrs"; var totalWorkDone = decimal.Zero; var totalFuelUsed = decimal.Zero; DataTable dataTable = GetWorkDoneReportTable(startDate, endDate, vehicleNo, measure, out totalWorkDone, out totalFuelUsed); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/WorkDoneReport.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Work Done Report – Vehicle/Machine"; reportClass.Database.Tables["WorkDoneReport"].SetDataSource(dataTable); reportClass.SetParameterValue("StartDate", startDate.ToString("d")); reportClass.SetParameterValue("EndDate", endDate.ToString("d")); reportClass.SetParameterValue("VehicleNo", vehicle.VehicleNumber); reportClass.SetParameterValue("CompanyCode", compCode); reportClass.SetParameterValue("TotalWorkDone", totalWorkDone.ToString("C").Replace("$", string.Empty) + " " + measure); reportClass.SetParameterValue("TotalFuelUsed", totalFuelUsed.ToString("C").Replace("$", string.Empty) + " L"); reportClass.SetParameterValue("WorkDoneHeading", "Work Done (" + measure.Trim() + ")"); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "application/pdf"); }
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"); }
/// <summary> /// Total fee collected by school /// </summary> /// <param name="httpctx">current httpcontext is sent to method generareInvoiceReport is called asynchronously using TPL</param> /// <param name="FromDate">form date set on report</param> /// <param name="ToDate">to date set on report</param> /// <param name="schoolid">school id parameter set on report</param> /// <returns></returns> public Stream generateTotalFeeReportBySchool(HttpContext httpctx, DateTime FromDate, DateTime ToDate, int schoolid) { ReportClass feereportbyschool = new ReportClass(); feereportbyschool.FileName = httpctx.Server.MapPath("~/Reports/TotalFeescollectedBySchool.rpt"); feereportbyschool.Load(); feereportbyschool.PrintOptions.PaperSize = PaperSize.PaperA4; feereportbyschool.SetParameterValue("InvoicefrmDate",FromDate); feereportbyschool.SetParameterValue("Invoicetodate", ToDate); feereportbyschool.SetParameterValue("SchoolID", schoolid); return genericReportSetting(feereportbyschool, httpctx); }
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 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 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"); }
/// <summary> /// generated total fee collected report between dates /// </summary> /// <param name="httpctx">current httpcontext is sent generareInvoiceReport is called asynchronously using TPL</param> /// <param name="FromDate">date from set to report</param> /// <param name="ToDate">to date set to report</param> /// <returns>pdf stream</returns> public Stream generateTotalFeeReport(HttpContext httpctx,DateTime FromDate,DateTime ToDate) { ReportClass totalfeereport = new ReportClass(); totalfeereport.FileName = httpctx.Server.MapPath("~/Reports/TotalFeescollected.rpt"); totalfeereport.Load(); totalfeereport.PrintOptions.PaperSize = PaperSize.PaperA4; totalfeereport.SetParameterValue("InvoicefrmDate", FromDate); totalfeereport.SetParameterValue("Invoicetodate", ToDate); return genericReportSetting(totalfeereport, httpctx); }
public async Task<ActionResult> StatsIncome(string _sDate, string _eDate) { DateTime _sdt = Convert.ToDateTime(_sDate); DateTime _edt = Convert.ToDateTime(_eDate).AddDays(1); List<TBChDDTO> _list = new List<TBChDDTO>(); string _path = ""; _path = "/CrystalReport/rptStatsIncome.rpt"; var sql = await (from a in db.T_BILLCHRGD where a.DATE_PRINTED >= _sdt && a.DATE_PRINTED <= _edt select a).ToListAsync(); foreach (var r in sql) { TBChDDTO tbl = new TBChDDTO(); tbl._id = r.BILLD_ID.ToString(); tbl._total =Convert.ToDecimal(r.BCDPATCOVER); 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"); }
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 HireBillPrint(DateTime startDate, DateTime endDate, int projectId, string projectName) { if (startDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("startDate"); if (endDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("endDate"); if (projectId == 0) throw new InvalidArgumentException("Project Id can not be 0", EngineExceptionErrorID.InvalidArgument); decimal totalAmount = decimal.Zero; DataTable dataTable = GetHireBillReportTable(startDate, endDate, projectId, out totalAmount); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/HireBillReport.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Hire Bill Report"; reportClass.Database.Tables["HireBillReport"].SetDataSource(dataTable); reportClass.SetParameterValue("StartDateParameter", startDate.ToString("d")); reportClass.SetParameterValue("EndDateParameter", endDate.ToString("d")); reportClass.SetParameterValue("ProjectParameter", projectName); reportClass.SetParameterValue("TotalAmountParameter", totalAmount.ToString("C").Replace("$", string.Empty)); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "application/pdf"); }
public ActionResult FuelAndLubricantPrint(DateTime startDate, DateTime endDate, int pumpstationId, string pumpstationName) { if (startDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("startDate"); if (endDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("endDate"); if (pumpstationId == 0) throw new InvalidArgumentException("Pumpstation Id can not be 0", EngineExceptionErrorID.InvalidArgument); DataTable dataTable = GetFuelAndLubricantReportTable(startDate, endDate, pumpstationId); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/FuelAndLubricantReport.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Fuel & Lubricant Report"; reportClass.Database.Tables["FuelAndLubricantReport"].SetDataSource(dataTable); reportClass.SetParameterValue("StartDateParameter", startDate.ToString("d")); reportClass.SetParameterValue("EndDateParameter", endDate.ToString("d")); reportClass.SetParameterValue("PumpstationParameter", pumpstationName); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "application/pdf"); }
//public ActionResult GenerateReport(DateTime startDate, DateTime endDate) //{ // //SqlConnection con = new SqlConnection(/*conDB.conString*/"Data Source=USER-PC\\SQLEXPRESS;Initial Catalog=DB_AAJI;User ID=sa;Password=admin123;"); // //DataTable dt = new DataTable(); // //try // //{ // // con.Open(); // // SqlCommand cmd = new SqlCommand("SELECT * FROM dbo.PurchaseRequestHeaders", con); // // SqlDataAdapter adp = new SqlDataAdapter(cmd); // // adp.Fill(dt); // //} // //catch (Exception ex) // //{ // //} // //ReportClass rptH = new ReportClass(); // //rptH.FileName = Server.MapPath("/Content/Reports/PurchaseRequestReport.rpt"); // //rptH.Load(); // ////rptH.SetDataSource(dt); // //Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); // //ReportDocument rd = new ReportDocument(); // //rd.Load(Path.Combine(Server.MapPath("~/Content/Reports"), "ReportPurchaseRequest.rpt")); // //rd.SetDataSource(dt); // //try // //{ // // Stream streams = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); // // streams.Seek(0, SeekOrigin.Begin); // // //return File(streams, "application/pdf", "PurchaseRequestReport.pdf"); // // return File(streams, "application/pdf", "ReportPurchaseRequest.pdf"); // //} // //catch(Exception exc) // //{ // // throw; // //} // string strConnection = conDB.conString;// System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; // using (SqlCommand cmd = new SqlCommand()) // { // using (SqlDataAdapter da = new SqlDataAdapter()) // { // ReportDocument rpt = new ReportDocument(); // rpt.Load(Path.Combine(Server.MapPath("~/Content/Reports"), "ReportPurchaseRequest.rpt")); // DataSet ds = new DataSet(); // cmd.CommandText = "sp_reportPurchaseRequest"; // cmd.Connection = new SqlConnection(strConnection); // cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.AddWithValue("@startDate", startDate); // cmd.Parameters.AddWithValue("@endDate", endDate); // da.SelectCommand = cmd; // da.Fill(ds); // rpt.SetParameterValue("@startDate", startDate); // rpt.SetParameterValue("@endDate", endDate); // //rpt.SetDataSource(ds); // //rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "test.pdf"); // foreach (IDataParameter param in cmd.Parameters) // { // if (param.Value == null) param.Value = DBNull.Value; // } // Stream streams = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); // streams.Seek(0, SeekOrigin.Begin); // return File(streams, "application/pdf", "ReportPurchaseRequest.pdf"); // } // } //} //[HttpPost] public ActionResult GenerateReport(DateTime startDate, DateTime endDate) { DataTable dtSalesReport = new DataTable(); using (SqlConnection conn = new SqlConnection(conDB.conString)) { SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_reportPurchaseRequest"; conn.Open(); da.SelectCommand = cmd; da.Fill(dtSalesReport); } //ReportDocument reportDocument = new ReportDocument(); //reportDocument.Load(Path.Combine(Server.MapPath("~/Content/Reports"), "ReportPurchaseRequest.rpt")); //reportDocument.SetDataSource(dtSalesReport); ReportClass reportDocument = new ReportClass(); reportDocument.FileName = Server.MapPath("/Content/Reports/PurchaseRequestReport.rpt"); reportDocument.Load(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream fstream = reportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); fstream.Seek(0, SeekOrigin.Begin); return File(fstream, "application/pdf"); } catch(Exception exc) { string a = exc.Message; throw; } }
public ActionResult HireBillPrivatePrint(DateTime startDate, DateTime endDate, int vehicleNo) { if (startDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("startDate"); if (endDate.Equals(DateTime.MinValue)) throw new ArgumentNullException("endDate"); if (vehicleNo == 0) throw new InvalidArgumentException("Vehicle No can not be 0", EngineExceptionErrorID.InvalidArgument); IVehicleService vehicleService = new VehicleService(); var vehicle = vehicleService.GetVehicle(vehicleNo); DataTable dataTable = GetHireBillPrivateReportTable(startDate, endDate, vehicleNo, vehicle.IsVehicle); ReportClass reportClass = new ReportClass(); reportClass.FileName = Server.MapPath("~/Reports/HireBillPrivateReport.rpt"); reportClass.Load(); reportClass.SummaryInfo.ReportTitle = "Hire Bill (Private) Report"; reportClass.Database.Tables["HireBillPrivateReport"].SetDataSource(dataTable); reportClass.SetParameterValue("StartDateParameter", startDate.ToString("d")); reportClass.SetParameterValue("EndDateParameter", endDate.ToString("d")); reportClass.SetParameterValue("VehicleNumberParameter", vehicle.VehicleNumber); reportClass.SetParameterValue("OwnerNameParameter", vehicle.OwnerName); string measure = vehicle.IsVehicle ? " Rs/Km" : " Rs/Hr"; reportClass.SetParameterValue("HireRateParameter", vehicle.HireRate.ConvertToDecimalString() + measure); Stream compStream = reportClass.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return File(compStream, "application/pdf"); }