private void btnPDF_Click(object sender, EventArgs e) { RPT.rpt_all_Categories myreport = new RPT.rpt_all_Categories(); //create export options ExportOptions expoert = new ExportOptions(); //create object for destination DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); PdfFormatOptions pdfformat = new PdfFormatOptions(); //set the path of destionation SaveFileDialog ofd = new SaveFileDialog(); ofd.Filter = "ملفات pdf | *.pdf"; if (ofd.ShowDialog() == DialogResult.OK) { dfoptions.DiskFileName = ofd.FileName; } expoert = myreport.ExportOptions; expoert.ExportDestinationType = ExportDestinationType.DiskFile; expoert.ExportFormatType = ExportFormatType.PortableDocFormat; expoert.ExportFormatOptions = pdfformat; expoert.ExportDestinationOptions = dfoptions; myreport.Refresh(); myreport.Export(); MessageBox.Show("تم حفظ الملف بنجاح", "الحفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void button7_Click(object sender, EventArgs e) { RPT.rpt_all_product myreport = new RPT.rpt_all_product(); //creat export options ExportOptions export = new ExportOptions(); //creat object for destination DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); ExcelFormatOptions excelformat = new ExcelFormatOptions(); //set the path of desyination dfoptions.DiskFileName = @"D:\producrslist.xls"; export = myreport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.Excel; export.ExportFormatOptions = excelformat; export.ExportDestinationOptions = dfoptions; myreport.Export(); MessageBox.Show("list exported successfully !", "export", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); }
private void ExportarPDF(ReportDocument rep) { String ruta_exportacion; ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]); //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]; ExportOptions exportOpts = new ExportOptions(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); exportOpts = rep.ExportOptions; exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat; exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".pdf"; exportOpts.DestinationOptions = diskOpts; rep.Export(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.WriteFile(diskOpts.DiskFileName.ToString()); Response.Flush(); Response.Close(); System.IO.File.Delete(diskOpts.DiskFileName.ToString()); }
protected void butAddItem_Click(object sender, EventArgs e) { if (oPurchase != null) { PurchaseOrder cryRpt = new PurchaseOrder(); oPurchase.Print(cryRpt); try { ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); ExcelFormatOptions CrFormatTypeOptions = new ExcelFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = Server.MapPath("~/OutputFiles/") + "Purchase-" + oPurchase.ID + ".xls"; CrExportOptions = cryRpt.ExportOptions; CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.Excel; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; cryRpt.Export(); cryRpt = null; Response.Redirect("http://" + Request.ServerVariables["SERVER_NAME"] + "/OutputFiles/" + "Purchase-" + oPurchase.ID + ".xls"); } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } } } //Purchases
protected void Button2_Click(object sender, EventArgs e) { try { int idOrientador = (int)Session["id"]; ReportDocument crystalrpt = new ReportDocument(); crystalrpt.Load(Server.MapPath(@"~/Reportes/ReporteAsistenciaAnualOrientador.rpt")); //crystalrpt.SetDatabaseLogon("adminSAEDI", "SAEDI.2018*"); crystalrpt.Refresh(); crystalrpt.SetParameterValue("@Anio", DropDownList1.SelectedValue); crystalrpt.SetParameterValue("@IdOrientador", idOrientador); crystalrpt.SetParameterValue("@IdProceso", ddlProceso.SelectedValue); //crystalrpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "ReporteAsistenciaDiaria"+ ddlMes.SelectedItem.Text); //CrystalReportViewer1.ReportSource = crystalrpt; //CrystalReportViewer1.DataBind(); ExportOptions exportOption; DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions(); exportOption = crystalrpt.ExportOptions; { exportOption.ExportDestinationType = ExportDestinationType.DiskFile; exportOption.ExportFormatType = ExportFormatType.Excel; exportOption.ExportDestinationOptions = diskFileDestinationOptions; exportOption.ExportFormatOptions = new ExcelFormatOptions(); } crystalrpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "ReporteAsistenciaAnual" + DropDownList1.SelectedValue); crystalrpt.Export(); } catch { } }
protected override void ExportReportUsingCrystal(string reportPath, ExportFormatType reportType) { string absolutePathFilename1 = string.Empty; absolutePathFilename1 = reportPath; Page1 = NewCrystalReportDocument; DiskFileDestinationOptions destinationOptions = new DiskFileDestinationOptions(); SetReportParameters(); Page1.SetDataSource(dtSearchResults); Page1.ExportOptions.ExportFormatType = reportType; Page1.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; try { destinationOptions.DiskFileName = absolutePathFilename1; Page1.ExportOptions.DestinationOptions = destinationOptions; Page1.Export(); } catch (Exception ex) { throw new ApplicationException("An unexpected error occurred trying to export the report: " + ex.ToString()); } finally { //if (System.IO.File.Exists(absolutePathFilename1)) // System.IO.File.Delete(absolutePathFilename1); } }
private string ExportarPDF() { try { IListadoConformadas listado = ListadoConformadasFactory.GetListadoConformadas(); listado.ListadoConformadasID = Utiles.Validaciones.obtieneEntero(txtListadoConformadasID.Text); DsListConfAdminImprimir ds = listado.ImprimirListConforamdasAdmin(); ReportDocument oRD = new ReportDocument(); ExportOptions oExO; DiskFileDestinationOptions oExDo = new DiskFileDestinationOptions(); string nombArchi = "Listado_" + this.txtListadoConformadasID.Text + "_" + this.AgenciaConectadaID + ".pdf"; string sNombrePDF = Server.MapPath(".") + "/ReportesPDF/" + nombArchi; if (System.IO.File.Exists(sNombrePDF)) { System.IO.File.Delete(sNombrePDF); } oRD.Load(Server.MapPath("." + "/Reportes/ListConformadaAdmin.rpt")); oRD.SetDataSource(ds); //cotizacionesDS oExDo.DiskFileName = sNombrePDF; oExO = oRD.ExportOptions; oExO.ExportDestinationType = ExportDestinationType.DiskFile; oExO.ExportFormatType = ExportFormatType.PortableDocFormat; oExO.DestinationOptions = oExDo; oRD.Export(); oRD.Close(); oRD.Dispose(); return(nombArchi); } catch (Exception ex) { string mensaje = "Error al exportar a PDF: " + ex.Message; ((ErrorWeb)this.phErrores.Controls[0]).setMensaje(mensaje); return(""); } }
protected void GeneratePOAsPDF(DataTable dt, string FileName, int EmailID) { string repFilePath = Server.MapPath("TRVPOReport.rpt"); ReportDocument repDoc = new ReportDocument(); repDoc.Load(repFilePath); repDoc.SetDataSource(dt); ExportOptions exp = new ExportOptions(); DiskFileDestinationOptions dk = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions pd = new PdfRtfWordFormatOptions(); string destFile = Server.MapPath("../Uploads/Travel") + "\\" + FileName; dk.DiskFileName = destFile; //string Network_Path = System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString()+@"Uploads\Travel\"; string Network_Path = @"Uploads\Travel\"; exp.ExportDestinationType = ExportDestinationType.DiskFile; exp.ExportFormatType = ExportFormatType.PortableDocFormat; exp.DestinationOptions = dk; exp.FormatOptions = pd; repDoc.Export(exp); BLL_Infra_Common.Insert_EmailAttachedFile(EmailID, FileName, Network_Path + FileName); }
private void ExportarPDF(ReportDocument rep) { String ruta_exportacion; ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]); //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]; //Response.Write(ruta_exportacion);Response.Flush();Response.Close(); ExportOptions exportOpts = new ExportOptions(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); exportOpts = rep.ExportOptions; exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat; exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".pdf"; exportOpts.DestinationOptions = diskOpts; rep.Export(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.WriteFile(diskOpts.DiskFileName.ToString()); Response.Flush(); Response.Close(); System.IO.File.Delete(diskOpts.DiskFileName.ToString()); }
public void VistaPrevia(string key) { try { ReportDocument objRpt = new ReportDocument(); DataSet ds = (DataSet)this.GetDataReport(key); //string reportPath = Application.StartupPath + "\\Reporte\\co_ordenCompra_rpt.rpt"; string reportPath = "C:\\Reportes\\CR_Cliente_rpt01.rpt"; objRpt.Load(reportPath); DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions(); ExportOptions crExportOptions = new ExportOptions(); objRpt.SetDataSource(ds.Tables[0]); string strfolder = "C:\\Reporte\\"; crDiskFileDestinationOption.DiskFileName = strfolder + "Cliente.pdf"; crExportOptions = objRpt.ExportOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption; crExportOptions.ExportFormatOptions = crFormatTypeOption; crystalReportViewer1.ReportSource = objRpt; //objRpt.Export(); } catch (Exception ex) { ex.ToString(); } }
public static void ExportPdf(string filename, ReportClass crReport) { var dest = new DiskFileDestinationOptions { DiskFileName = GetPath(filename) }; var formatOpt = new PdfFormatOptions { FirstPageNumber = 0, LastPageNumber = 0, UsePageRange = false, CreateBookmarksFromGroupTree = false }; var ex = new ExportOptions { ExportDestinationType = ExportDestinationType.DiskFile, ExportDestinationOptions = dest, ExportFormatType = ExportFormatType.PortableDocFormat, ExportFormatOptions = formatOpt }; crReport.SetDatabaseLogon("sa", "sabroso123"); crReport.Export(ex); }
public bool ExportarPDF(string nombreArchivo) { bool resultado = false; try { ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = nombreArchivo; CrExportOptions = _docRpt.ExportOptions; CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; _docRpt.Export(); resultado = true; } catch (Exception ex) { MessageBox.Show("Exportar : " + ex.Message); PistaMgr.Instance.Error("Reportes.ExportarPDF", ex); } return(resultado); }
private void GeneratePDF() { ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/ChartOfAccountsSummary.rpt")); ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\RetailPlus\temp\"); string strFileName = "po_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".pdf"; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); dest.DiskFileName = strPath + strFileName; exportop = rpt.ExportOptions; SetDataSource(rpt); exportop.DestinationOptions = dest; exportop.ExportDestinationType = ExportDestinationType.DiskFile; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; rpt.Export(); rpt.Close(); rpt.Dispose(); fraViewer.Attributes.Add("src","/RetailPlus/temp/" + strFileName); }
/// <summary> /// 產生PDF檔案 /// </summary> private void RrintToPDF() { // 匯出檔名的設定 string sReportFileName = @"\rpt\T022_rpt.rpt"; string sMapPath = Server.MapPath(""); string sHost = Request.Url.Host; string sApplicationPath = Request.ApplicationPath; string reportID = DBCenter.GetSystemID(); string sExportFileName = Server.MapPath("../../") + @"PDF\T022_rpt" + reportID + ".pdf"; string strPath = sMapPath + sReportFileName; string ReportPath = "http://" + sHost + sApplicationPath + "/PDF/T022_rpt" + reportID + ".pdf"; DataSet dsLot = (DataSet)Session["T022View"]; rptdoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptdoc.Load(strPath); rptdoc.SetDataSource(dsLot); // 設定匯出路徑及檔名 DiskFileDestinationOptions df = new DiskFileDestinationOptions(); df.DiskFileName = sExportFileName; rptdoc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; rptdoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; rptdoc.ExportOptions.DestinationOptions = df; rptdoc.Export(); rptdoc.Dispose(); //打開文件 Response.Write("<script>window.open('" + ReportPath + "','_blank','resizable,scrollbars=no,menubar=no,toolbar=no,location=no,status=no',false);</script> "); Response.Write("<script>window.close();</script>"); }
protected void Page_Load(object sender, EventArgs e) { ClGestion = new Cl_Gestion_Registro(); ClUtilitarios = new Cl_Utilitarios(); DataSet Ds_ConstanciaRRF = new DataSet(); Ds_ConstanciaRRF = ((DataSet)Session["DatosConstanciaRRF"]); Reporte.PrintOptions.PaperOrientation = PaperOrientation.Portrait; Reporte.SetDataSource(Ds_ConstanciaRRF); string NomReporte = NomReporte = Guid.NewGuid().ToString() + ".pdf"; string url = Server.MapPath(".") + @"\" + DirRep + NomReporte; DiskFileDestinationOptions options2 = new DiskFileDestinationOptions { DiskFileName = url }; ExportOptions exportOptions = Reporte.ExportOptions; exportOptions.ExportDestinationType = ExportDestinationType.DiskFile; exportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; exportOptions.ExportDestinationOptions = options2; Reporte.Export(); url = DirApp + DirRepLong + NomReporte; base.Response.Redirect(url); }
/// <summary> /// Restituisce il percorso del report in formato PDF a cui puntare con Response.Redirect /// </summary> /// <param name="FileName"></param> /// <param name="RelativePath"></param> /// <returns></returns> public string ExportToPdf(ReportDocument RD, string FileName, string RelativePath) { // Declare variables and get the export options. //ExportOptions exportOpts = new ExportOptions(); //PdfRtfWordFormatOptions pdfRtfWordOpts = new PdfRtfWordFormatOptions (); // Set the export format. //pdfRtfWordOpts.FirstPageNumber = 1; //pdfRtfWordOpts.LastPageNumber = 2; //pdfRtfWordOpts.UsePageRange = true; //RD.ExportOptions.FormatOptions = pdfRtfWordOpts; RD.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; RD.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); diskOpts.DiskFileName = RelativePath + FileName + ".pdf"; RD.ExportOptions.DestinationOptions = diskOpts; // Export the report RD.Export(); //WebLog.Log(this,"E' stato creato il file " + FileName + " del report."); //Ritorna il percorso del Report in formato PDF return(RelativePath + FileName + ".pdf"); }
protected void Button2_Click(object sender, EventArgs e) { try { ReportDocument crystalrpt = new ReportDocument(); crystalrpt.Load(Server.MapPath(@"~/Reportes/ReporteAsistenciaDiaria.rpt")); //crystalrpt.SetDatabaseLogon("adminSAEDI", "SAEDI.2018*"); crystalrpt.Refresh(); crystalrpt.SetParameterValue("@Orientador", ddlOrientador.SelectedValue); crystalrpt.SetParameterValue("@Anio", ddlAnio.SelectedValue); crystalrpt.SetParameterValue("@Mes", ddlMes.SelectedValue); crystalrpt.SetParameterValue("@IdProceso", ddlProceso.SelectedValue); ExportOptions exportOption; DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions(); exportOption = crystalrpt.ExportOptions; { exportOption.ExportDestinationType = ExportDestinationType.DiskFile; exportOption.ExportFormatType = ExportFormatType.Excel; exportOption.ExportDestinationOptions = diskFileDestinationOptions; exportOption.ExportFormatOptions = new ExcelFormatOptions(); } crystalrpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "ReporteAsistenciaDiaria" + ddlMes.SelectedItem.Text); crystalrpt.Export(); } catch { } }
private void metroButton7_Click(object sender, EventArgs e) { RPT.rpt_all_products myReport = new RPT.rpt_all_products(); // Create Export options ExportOptions export = new ExportOptions(); // Create object for destination DiskFileDestinationOptions dfoptions = new DiskFileDestinationOptions(); ExcelFormatOptions excelformat = new ExcelFormatOptions(); // Set the path of destination dfoptions.DiskFileName = @"D:\scienses\life with c#\projects\Products Managemnt\Reports\ProductsList.xls"; export = myReport.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.Excel; export.ExportFormatOptions = excelformat; export.ExportDestinationOptions = dfoptions; myReport.Refresh(); myReport.Export(); MessageBox.Show("List Eported Successfully ", "Export", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void buttonPDFcurrent_Click(object sender, EventArgs e) { string filedes = @"D:\stock proj\CategoryDetails.pdf"; if (File.Exists(filedes)) { File.Delete(filedes); } Reports.Single_Cat_Report report = new Reports.Single_Cat_Report(); report.Refresh(); //export options obj report.SetParameterValue("@id", int.Parse(textid.Text)); ExportOptions ex = new ExportOptions(); //create disk obj DiskFileDestinationOptions disk = new DiskFileDestinationOptions(); PdfFormatOptions pdfformat = new PdfFormatOptions(); //set the path disk.DiskFileName = @"D:\stock proj\CategoryDetails.pdf"; ex = report.ExportOptions; ex.ExportDestinationType = ExportDestinationType.DiskFile; ex.ExportFormatType = ExportFormatType.PortableDocFormat; ex.ExportFormatOptions = pdfformat; ex.ExportDestinationOptions = disk; report.Export(); MessageBox.Show("Successfuly Stored", "Stored Report", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void ExportarEXCEL(ReportDocument rep) { String ruta_exportacion; ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]); //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]; ExportOptions exportOpts = new ExportOptions(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); exportOpts = rep.ExportOptions; exportOpts.ExportFormatType = ExportFormatType.Excel; exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".xls"; exportOpts.DestinationOptions = diskOpts; rep.Export(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", "attachment;filename=presupuesto_ingreso_real.xls"); Response.ContentType = "application/vnd.ms-excel"; Response.WriteFile(diskOpts.DiskFileName.ToString()); Response.Flush(); Response.Close(); System.IO.File.Delete(diskOpts.DiskFileName.ToString()); }
protected void doreport1() { string strConnString = ConfigurationManager.ConnectionStrings["TOHWConnectionString"].ConnectionString; DataSet ds = new DataSet(); rpt = new ReportDocument(); using (SqlConnection con = new SqlConnection(strConnString)) { SqlDataAdapter da = new SqlDataAdapter("Report_Encounters", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@username", SqlDbType.VarChar).Value = username; da.SelectCommand.Parameters.Add("@fromdate", SqlDbType.VarChar).Value = Request.QueryString["fromdate"]; da.SelectCommand.Parameters.Add("@todate", SqlDbType.VarChar).Value = Request.QueryString["todate"]; da.Fill(ds); //int records = ds.Tables["Table"].Rows.Count; } string report = Server.MapPath("~/private/reports/crystal/EncountersByPersonDate.rpt"); rpt.Load(report); rpt.SetDataSource(ds.Tables["Table"]); //rpt.SetParameterValue("fromdate", Request.QueryString["fromdate"]); //rpt.SetParameterValue("todate", Request.QueryString["todate"]); //crv_report.ReportSource = rpt; //int PageCount = rpt.FormatEngine.GetLastPageNumber(new ReportPageRequestContext()); //Literal1.Text = PageCount.ToString(); if (1 == 2) { ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = "C:\\temp\\test.pdf"; CrExportOptions = rpt.ExportOptions; CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrFormatTypeOptions.UsePageRange = true; //CrFormatTypeOptions.FirstPageNumber = 1; //CrFormatTypeOptions.LastPageNumber = 1; CrExportOptions.FormatOptions = CrFormatTypeOptions; rpt.Export(); } else { crv_report.ReportSource = rpt; Session.Add("Report", rpt); } }
private void BTM_SAVE_SINGLE_Click(object sender, EventArgs e) { RPT.RPT_SINGLE_CATEGORY My_Report = new RPT.RPT_SINGLE_CATEGORY(); ExportOptions export = new ExportOptions(); DiskFileDestinationOptions dfoption = new DiskFileDestinationOptions(); //PdfFormatOptions pdfformat = new PdfFormatOptions(); PdfFormatOptions pdfFormatt = new PdfFormatOptions(); //set destination of file to save in dfoption.DiskFileName = @"D:\category_details.pdf"; export = My_Report.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; //export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatOptions = pdfFormatt; //export.ExportFormatOptions = pdfformat; export.ExportDestinationOptions = dfoption; My_Report.SetParameterValue("@ID", Convert.ToInt32(TXT_ID.Text)); //My_Report.Refresh(); My_Report.Export(); MessageBox.Show("تم الحفظ ", "حفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void buttonItem2_Click(object sender, EventArgs e) { CRClientesCompletos rptExcel = new CRClientesCompletos(); rptExcel.Load("CRClientesCompletos.rpt"); rptExcel.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; rptExcel.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Environment.SpecialFolder.MyDocuments.ToString(); saveFileDialog.Filter = "Document (*.pdf)|*.pdf"; saveFileDialog.FilterIndex = 1; if (saveFileDialog.ShowDialog() == DialogResult.OK) { DiskFileDestinationOptions objOptions = new DiskFileDestinationOptions(); objOptions.DiskFileName = saveFileDialog.FileName; rptExcel.ExportOptions.ExportDestinationOptions = objOptions; rptExcel.Export(); objOptions = null; } rptExcel = null; }
private string ExportarPDF() { DsReportePlanillaTrasbordo reporte = new DsReportePlanillaTrasbordo(); IPlanillaTrasbordo planilla = PlanillaTrasbordoFactory.GetPlanillaTrasbordoFactory(); planilla.PlanillaTrasbordoID = id; reporte = planilla.GetReportePlanillaTrasbordo(); ReportDocument oRD = new ReportDocument(); ExportOptions oExO; DiskFileDestinationOptions oExDo = new DiskFileDestinationOptions(); string nombArchi = "PlanillaTrasbordo_" + id + ".pdf"; string sNombrePDF = Server.MapPath(".") + "/ReportesPDF/" + nombArchi; if (System.IO.File.Exists(sNombrePDF)) { System.IO.File.Delete(sNombrePDF); } oRD.Load(Server.MapPath("." + "/Reportes/PlanillaTrasbordo.rpt")); oRD.SetDataSource(reporte); oExDo.DiskFileName = sNombrePDF; oExO = oRD.ExportOptions; oExO.ExportDestinationType = ExportDestinationType.DiskFile; oExO.ExportFormatType = ExportFormatType.PortableDocFormat; oExO.DestinationOptions = oExDo; oRD.Export(); oRD.Close(); oRD.Dispose(); return(nombArchi); }
private void GenerateWord() { ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt")); ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\retailplus\temp\"); string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".doc"; if (System.IO.File.Exists(strPath + strFileName)) { System.IO.File.Delete(strPath + strFileName); } dest.DiskFileName = strPath + strFileName; exportop = rpt.ExportOptions; SetDataSource(rpt); exportop.DestinationOptions = dest; exportop.ExportDestinationType = ExportDestinationType.DiskFile; exportop.ExportFormatType = ExportFormatType.WordForWindows; rpt.Export(); rpt.Close(); rpt.Dispose(); fraViewer.Attributes.Add("src", "/retailplus/temp/" + strFileName); }
public void ExportReport(ReportDocument report) { ExportOptions options = new ExportOptions(); options.ExportDestinationType = (ExportDestinationType)_destinationType; options.ExportFormatType = (ExportFormatType)_destinationFormat; if (_destinationType == ReportDestination.Disk) { DiskFileDestinationOptions diskOptions = new DiskFileDestinationOptions(); diskOptions.DiskFileName = _destinationFileName; options.ExportDestinationOptions = diskOptions; } else if (_destinationType == ReportDestination.Disk) { MicrosoftMailDestinationOptions mailOptions = new MicrosoftMailDestinationOptions(); mailOptions.MailSubject = _mailSubject; mailOptions.MailMessage = _mailMessage; mailOptions.MailToList = _mailToList; mailOptions.MailCCList = _mailCCList; options.ExportDestinationOptions = mailOptions; } report.Export(options); }
private void BTM_SAVE_ALL_Click(object sender, EventArgs e) { RPT.RPT_ALL_CATT My_Report = new RPT.RPT_ALL_CATT(); ExportOptions export = new ExportOptions(); DiskFileDestinationOptions dfoption = new DiskFileDestinationOptions(); //PdfFormatOptions pdfformat = new PdfFormatOptions(); PdfFormatOptions pdfFormatt = new PdfFormatOptions(); //set destination of file to save in dfoption.DiskFileName = @"D:\categories_List.pdf"; export = My_Report.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; //export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatType = ExportFormatType.PortableDocFormat; export.ExportFormatOptions = pdfFormatt; //export.ExportFormatOptions = pdfformat; export.ExportDestinationOptions = dfoption; My_Report.Refresh(); My_Report.Export(); MessageBox.Show("تم الحفظ ", "حفظ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
//SAVE PDF TO FILE - method not used public void savePDF() { using (SqlConnection con = new SqlConnection(connectionstring)) { SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM WIZ_BulkInvoice_CrystalReport WHERE InvNumber = '" + label_InvoiceNumber.Text + "' ", con); ReportDocument rpt = new ReportDocument(); rpt.Load(@"C:\\BulkInvoice\\CrystalReport\\Invoice.rpt"); DataSet datatablesource = new DataSet(); sda.Fill(datatablesource, "WIZ_BulkInvoice_Report"); rpt.SetDataSource(datatablesource); ExportOptions rptExportOption; DiskFileDestinationOptions rptFileDestOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions rptFormatOption = new PdfRtfWordFormatOptions(); string reportFileName = @"C:\BulkInvoice\Documents\" + label_InvoiceNumber.Text + ".pdf"; //save path rptFileDestOption.DiskFileName = reportFileName; rptExportOption = rpt.ExportOptions; { rptExportOption.ExportDestinationType = ExportDestinationType.DiskFile; rptExportOption.ExportFormatType = ExportFormatType.PortableDocFormat; rptExportOption.ExportDestinationOptions = rptFileDestOption; rptExportOption.ExportFormatOptions = rptFormatOption; } rpt.Export(); rpt.Dispose(); } }
protected void ExportPDF(ReportClass rpt, string output_file_name) { if (rpt != null) { ExportOptions options = new ExportOptions(); DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions(); SaveFile_SFD.InitialDirectory = SettingsMng.Instance.GetPDFPrintsFolder(); SaveFile_SFD.FileName = output_file_name; SaveFile_SFD.AddExtension = true; SaveFile_SFD.DefaultExt = "pdf"; if (SaveFile_SFD.ShowDialog() == DialogResult.OK) { PgMng.Grow(String.Format(Face.Resources.Messages.EXPORTING_PDF, SaveFile_SFD.FileName), string.Empty); diskFileDestinationOptions.DiskFileName = SaveFile_SFD.FileName; options.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; options.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; options.ExportDestinationOptions = diskFileDestinationOptions; PgMng.Grow(); rpt.Export(options); } } else { PgMng.ShowInfoException(Resources.Messages.NO_DATA_REPORTS); } }
private void GenerateWord() { ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt")); ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\retailplus\temp\"); string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".doc"; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); dest.DiskFileName = strPath + strFileName; exportop = rpt.ExportOptions; SetDataSource(rpt); exportop.DestinationOptions = dest; exportop.ExportDestinationType = ExportDestinationType.DiskFile; exportop.ExportFormatType = ExportFormatType.WordForWindows; rpt.Export(); rpt.Close(); rpt.Dispose(); fraViewer.Attributes.Add("src","/retailplus/temp/" + strFileName); }
private void pictureBox1_Click(object sender, EventArgs e) { try { ExportOptions exportOptions; DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions(); SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Pdf Files|*.pdf"; sfd.InitialDirectory = "C:/Users/user/Documents/reportes/Ventas"; if (sfd.ShowDialog() == DialogResult.OK) { diskFileDestinationOptions.DiskFileName = sfd.FileName; } exportOptions = cryRpt.ExportOptions; { exportOptions.ExportDestinationType = ExportDestinationType.DiskFile; exportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; exportOptions.ExportDestinationOptions = diskFileDestinationOptions; exportOptions.ExportFormatOptions = new PdfRtfWordFormatOptions(); } cryRpt.Export(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void butPdf_Click(object sender, EventArgs e) { string tenfile = ReportFile.ToLower().Replace(".rpt", ""); tenfile = ExportPath + tenfile + ".pdf"; crDiskFileDestinationOptions = new DiskFileDestinationOptions(); crExportOptions = oRpt.ExportOptions; crDiskFileDestinationOptions.DiskFileName = tenfile; crExportOptions.DestinationOptions = crDiskFileDestinationOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; oRpt.Export(); try { string filerun = "AcroRd32.exe", arg = tenfile; if (System.IO.File.Exists(arg)) { backup f = new backup(filerun, arg, true); f.Launch(); } } catch { MessageBox.Show(lan.Change_language_MessageText("Tập tin :") + " " + tenfile); } }
private void btn_sauvgarder_Click(object sender, EventArgs e) { if (txt_save_name.Text != "") { RPT.RPT_ALL_PRODUCTS report = new RPT.RPT_ALL_PRODUCTS(); DiskFileDestinationOptions Destination = new DiskFileDestinationOptions(); Destination.DiskFileName = @"C:\Users\Hamza's Laptop\OneDrive\Documents\" + txt_save_name.Text + ".xls"; ExcelFormatOptions excelFormat = new ExcelFormatOptions(); ExportOptions export = new ExportOptions(); export = report.ExportOptions; export.ExportDestinationType = ExportDestinationType.DiskFile; export.ExportFormatType = ExportFormatType.Excel; export.ExportDestinationOptions = Destination; export.ExportFormatOptions = excelFormat; report.Export(); MessageBox.Show("raport est Sauvgarder avec succée !!"); txt_save_name.Text = ""; } else { MessageBox.Show("Veuiller saisie le nom de fichier a sauvgarder !!"); return; } }
protected void Page_Load(object sender, EventArgs e) { ClGestion = new Cl_Gestion_Registro(); ClUtilitarios = new Cl_Utilitarios(); DataSet ds = new DataSet(); ds = ClGestion.ImpresionAdmisionExpediente(Convert.ToInt32(ClUtilitarios.Decrypt(HttpUtility.UrlDecode(Request.QueryString["gestion"].ToString()), true)), Convert.ToInt32(ClUtilitarios.Decrypt(HttpUtility.UrlDecode(Request.QueryString["subcategoria"].ToString()), true))); Reporte.PrintOptions.PaperOrientation = PaperOrientation.Portrait; Reporte.SetDataSource(ds); string NomReporte = NomReporte = Guid.NewGuid().ToString() + ".pdf"; string url = Server.MapPath(".") + @"\" + DirRep + NomReporte; DiskFileDestinationOptions options2 = new DiskFileDestinationOptions { DiskFileName = url }; ExportOptions exportOptions = Reporte.ExportOptions; exportOptions.ExportDestinationType = ExportDestinationType.DiskFile; exportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; exportOptions.ExportDestinationOptions = options2; Reporte.Export(); url = DirApp + DirRepLong + NomReporte; base.Response.Redirect(url); }
private void ExportarEXCEL(ReportDocument rep) { String ruta_exportacion; ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]); //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]; ExportOptions exportOpts = new ExportOptions(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); exportOpts = rep.ExportOptions; exportOpts.ExportFormatType = ExportFormatType.Excel; exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".xls"; exportOpts.DestinationOptions = diskOpts; rep.Export(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader ("Content-Disposition", "attachment;filename=Morosidad.xls"); Response.ContentType = "application/vnd.ms-excel"; Response.WriteFile(diskOpts.DiskFileName.ToString()); Response.Flush(); Response.Close(); System.IO.File.Delete(diskOpts.DiskFileName.ToString()); }
public virtual void Export(string aFileName) { ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; DiskFileDestinationOptions lDestOpt = new DiskFileDestinationOptions(); lDestOpt.DiskFileName = aFileName; ExportOptions.DestinationOptions = lDestOpt; if (Source.Opened) Source.Document.Export(ExportOptions); }
public static void GenerateReport(string FileName, ReportDocument rpt, System.Web.UI.Control ClientScriptBlockControl, ExportFormatType pvtExportFormatType) { try { ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strFileExtensionName = ".pdf"; switch (pvtExportFormatType) { case ExportFormatType.PortableDocFormat: strFileExtensionName = ".pdf"; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; break; case ExportFormatType.WordForWindows: strFileExtensionName = ".doc"; exportop.ExportFormatType = ExportFormatType.WordForWindows; break; case ExportFormatType.Excel: strFileExtensionName = ".xls"; exportop.ExportFormatType = ExportFormatType.Excel; break; } string strPath = System.Web.HttpContext.Current.Server.MapPath(@"\retailplus\temp\"); string strFileName = FileName + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + strFileExtensionName; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); dest.DiskFileName = strPath + strFileName; exportop.DestinationOptions = dest; exportop.ExportDestinationType = ExportDestinationType.DiskFile; rpt.Export(exportop); //rpt.Close(); rpt.Dispose(); // remove the error if (pvtExportFormatType == ExportFormatType.WordForWindows || pvtExportFormatType == ExportFormatType.Excel || pvtExportFormatType == ExportFormatType.PortableDocFormat) { // the maximum report processing jobs limit configured by your system administrator has been reached. rpt.Close(); rpt.Dispose(); } if (pvtExportFormatType == ExportFormatType.PortableDocFormat) { string newWindowUrl = Constants.ROOT_DIRECTORY + "/temp/" + strFileName; string javaScript = "window.open('" + newWindowUrl + "');"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(ClientScriptBlockControl, ClientScriptBlockControl.GetType(), "openwindow", javaScript, true); } else { string newWindowUrl = Constants.ROOT_DIRECTORY + "/temp/" + strFileName; string javaScript = "window.open('" + newWindowUrl + "','_self');"; System.Web.UI.ScriptManager.RegisterClientScriptBlock(ClientScriptBlockControl, ClientScriptBlockControl.GetType(), "openwindow", javaScript, true); //System.Diagnostics.Process p = new System.Diagnostics.Process(); //p.StartInfo.FileName = System.Web.HttpContext.Current.Server.MapPath(Constants.ROOT_DIRECTORY + "/temp/" + strFileName); //p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; //p.Start(); } } catch (Exception ex) { throw ex; } }
public void PrintReport(string key) { try { ReportDocument objRpt = new ReportDocument(); DataSet ds = (DataSet)this.GetDataReport(key); string reportPath = "C:\\Reportes\\CRIngreso_etiqueta02.rpt"; objRpt.Load(reportPath); DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions(); ExportOptions crExportOptions = new ExportOptions(); objRpt.SetDataSource(ds.Tables[0]); string strfolder = "C:\\Reporte\\"; crDiskFileDestinationOption.DiskFileName = strfolder + "Etiqueta.pdf"; crExportOptions = objRpt.ExportOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption; crExportOptions.ExportFormatOptions = crFormatTypeOption; objRpt.Export(); this.printDialog1.Document = this.printDocument1; DialogResult dr = this.printDialog1.ShowDialog(); if (dr == DialogResult.OK) { PageMargins margins; margins = objRpt.PrintOptions.PageMargins; margins.bottomMargin = 250; margins.leftMargin = 250; margins.rightMargin = 250; margins.topMargin = 250; objRpt.PrintOptions.ApplyPageMargins(margins); string PrinterName = this.printDocument1.PrinterSettings.PrinterName; objRpt.PrintOptions.PrinterName = PrinterName; objRpt.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { ex.ToString(); } }
public void GeneratePDF(string poId) { ReportDocument rptDoc = new ReportDocument(); dsPSMS ds = new dsPSMS(); DataTable dt = new DataTable(); dt.TableName = "PO"; dt = getAllPOs(); ds.Tables["dtPO"].Merge(dt); //subreport data table dt = new DataTable(); dt.TableName = "Terms"; dt = getAllTerms(); ds.Tables["dtTerms"].Merge(dt); rptDoc.Load(Server.MapPath("~/Reports/crPO.rpt")); rptDoc.SetDataSource(ds); string fileName = "PO" + poId + "_.pdf"; String targetFolder = Server.MapPath(POAttachmentfolderPath); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = targetFolder + "\\" + fileName; CrExportOptions = rptDoc.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } rptDoc.Export(); string strFields = ""; string[] strValues = new string[3]; strFields = "[POID],[FilePath],[Note]"; string filePath = POAttachmentfolderPath + "/" + fileName; string sqlStr = "select [FilePath] from [dbo].[POAttach] where [FilePath]=@FilePath"; DataTable hasData = am.DataAccess.RecordSet(sqlStr, new string[] { filePath }); if (hasData.Rows.Count == 0) { strValues = new string[] { poId.ToString() , filePath , txtAttachmentNote.Text.Trim() }; am.DataAccess.BatchQuery.Insert("[dbo].[POAttach]", strFields, strValues); am.DataAccess.BatchQuery.Execute(); } }
/// <summary> /// Sự kiện xuất Format options /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnExport_Click(object sender, EventArgs e) { string fileName = "E:\\ReportSource\\Report_Test\\Report_Test\\bin\\Export.xls"; SaveFileDialog save = new SaveFileDialog(); save.Filter = "Crystal report |(*.rpt)| Portable Document Format |(*.pdf)| MS Excel 97-2003 |(*.xls)| MS Excel 97-2003 (Data Only)|(*.xls)| MS Word |(*.doc)|"; ExportOptions _exportOpts = new ExportOptions(); DiskFileDestinationOptions _diskDesOpts = new DiskFileDestinationOptions(); _exportOpts = report.ExportOptions; if (save.FileName != "") { switch (save.FilterIndex) { case 1: _exportOpts.ExportFormatType = ExportFormatType.CrystalReport; break; case 2: _exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat; Export_Opts _frmExpOpts = new Export_Opts(); _frmExpOpts.ShowDialog(); break; case 3: _exportOpts.ExportFormatType = ExportFormatType.Excel; ExcelFormatOption _frmExFormatOpts = new ExcelFormatOption(); _frmExFormatOpts.ShowDialog(); break; case 4: _exportOpts.ExportFormatType = ExportFormatType.ExcelRecord; _frmExFormatOpts = new ExcelFormatOption(); _frmExFormatOpts.ShowDialog(); break; case 5: _exportOpts.ExportFormatType = ExportFormatType.WordForWindows; _frmExpOpts = new Export_Opts(); _frmExpOpts.ShowDialog(); break; } } //Ổ đĩa lưu giữ file _exportOpts.ExportDestinationType = ExportDestinationType.DiskFile; _diskDesOpts.DiskFileName = fileName; _exportOpts.DestinationOptions = _diskDesOpts; }
private void loadReport() { DataTable lData = ((DataTable)Session["WRK_TABLE"]); ParameterFields paramFields = new ParameterFields(); ParameterField paramField = new ParameterField(); ParameterDiscreteValue dctField = new ParameterDiscreteValue(); if (Session["WRK_TABLE"] != null) { if (lData.Rows.Count > 0) { CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument; myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); myReportDocument.Load(Server.MapPath(hidReportName.Value + ".rpt")); myReportDocument.SetDataSource(lData); ExportOptions relExportOptions; DiskFileDestinationOptions relDiskFileDestinationOptions; string strPDFTemp = Server.MapPath(@"~\Aut\Reports\Files\" + hidReportName.Value + ".pdf"); relDiskFileDestinationOptions = new DiskFileDestinationOptions(); relDiskFileDestinationOptions.DiskFileName = strPDFTemp; relExportOptions = myReportDocument.ExportOptions; relExportOptions.ExportDestinationOptions = relDiskFileDestinationOptions; relExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; relExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; myReportDocument.Export(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "inline; filename=ReportName.pdf"); Response.WriteFile(strPDFTemp); Response.Flush(); Response.Close(); System.IO.File.Delete(strPDFTemp); } } }
private void Export(ExportFormatType pvtExportFormatType) { ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/_StockTransactionReport.rpt")); SetDataSource(rpt); ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\retailplus\temp\"); string strFileExtensionName = ".pdf"; switch (pvtExportFormatType) { case ExportFormatType.PortableDocFormat: strFileExtensionName = ".pdf"; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; break; case ExportFormatType.WordForWindows: strFileExtensionName = ".doc"; exportop.ExportFormatType = ExportFormatType.WordForWindows; break; case ExportFormatType.Excel: strFileExtensionName = ".xls"; exportop.ExportFormatType = ExportFormatType.Excel; break; } string strFileName = "tranreport_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + strFileExtensionName; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); dest.DiskFileName = strPath + strFileName; exportop.DestinationOptions = dest; exportop.ExportDestinationType = ExportDestinationType.DiskFile; rpt.Export(exportop); //rpt.Close(); rpt.Dispose(); if (pvtExportFormatType == ExportFormatType.PortableDocFormat) { rpt.Close(); rpt.Dispose(); Response.Redirect(Constants.ROOT_DIRECTORY + "/temp/" + strFileName, false); } else { CRViewer.ReportSource = rpt; Session["ReportDocument"] = rpt; CRSHelper.OpenExportedReport(strFileName); // OpenExportedReport(strFileName); } }
private void GenerateHTML() { ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt")); HTMLFormatOptions htmlOpts = new HTMLFormatOptions(); ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\RetailPlus\temp\html\"); // DeleteTempDirectory(strPath); string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".htm"; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); htmlOpts.HTMLFileName = strFileName; htmlOpts.HTMLEnableSeparatedPages = true;; htmlOpts.HTMLHasPageNavigator = true; htmlOpts.HTMLBaseFolderName = strPath; rpt.ExportOptions.FormatOptions = htmlOpts; exportop = rpt.ExportOptions; exportop.ExportDestinationType = ExportDestinationType.DiskFile; exportop.ExportFormatType = ExportFormatType.HTML40; dest.DiskFileName = strFileName.ToString(); exportop.DestinationOptions = dest; SetDataSource(rpt); rpt.Export(); rpt.Close(); rpt.Dispose(); strFileName = "//" + Request.ServerVariables["SERVER_NAME"].ToString() + FindHTMLFile(strPath,strFileName); fraViewer.Attributes.Add("src",strFileName); }
protected void btnPresupuesto_Click(object sender, EventArgs e) { /* DataSet dss = BRBitacora.buscarPorFiltro("","","","",""); DataTable dt = dss.Tables[0]; //dt.Columns.Add("id"); //TransArteReport report = new TransArteReport(); //DataTable _tabla = report.DataTable1; ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath("../Reportes/ReportBitacora.rpt")); rpt.SetDataSource(dt); */ ReportDocument rpt = new ReportDocument(); String szFileName = ""; String strServerPath = ""; rpt.PrintOptions.PaperOrientation = PaperOrientation.DefaultPaperOrientation; rpt.PrintOptions.PaperSize = PaperSize.DefaultPaperSize; rpt.PrintOptions.PaperSource = PaperSource.Upper; rpt.PrintOptions.PrinterDuplex = PrinterDuplex.Default; DataSet dss = BRBitacora.buscarPorFiltro("", "", "", "", ""); DataTable dt = dss.Tables[0]; dt.Columns.Add("Logo", System.Type.GetType("System.Byte[]"));//Agrego la columna con el tipo de dato "System.Byte[]",donde guardare mi imagen. dt.Rows[0]["Logo"] = CargarImagen("C:\\TransArte\\Website\\images\\logoMini.PNG");//Cargo La imagen dt.Columns.Add("UsuarioFiltro", System.Type.GetType("System.String"));//Agrego la columna con el tipo de dato "System.Byte[]",donde guardare mi imagen. dt.Rows[0]["UsuarioFiltro"] = "MAXIMILIANO";//Cargo La imagen rpt.Load(Server.MapPath("../Reportes/ReportBitacora.rpt")); rpt.SetDataSource(dt); szFileName = "bitacora.pdf"; strServerPath = Server.MapPath("~") + "\\Reportes\\"; DiskFileDestinationOptions dfdoFile = new DiskFileDestinationOptions(); dfdoFile.DiskFileName = strServerPath + szFileName; rpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; rpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rpt.ExportOptions.DestinationOptions = dfdoFile; rpt.Export(); Response.Redirect("../Reportes/" + szFileName, false); /* * http://localhost:49173/website/Servicio/Reportes.aspx * * */ }
private void Import() { string strId = Request.QueryString["id"].ToString().Trim(); rpDocDB.UpdatePrintFlag(strId); ReportDocument EoRpt = (ReportDocument)Session["REPORT"]; ExportOptions crExportOptions = new ExportOptions(); DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions(); string strExportedFile = this.MapPath(".") + "\\ExportedReports\\ExceptionNotices"; if (!System.IO.Directory.Exists(strExportedFile)) { System.IO.Directory.CreateDirectory(strExportedFile); } strExportedFile += "\\" + strId + ".pdf"; crDiskFileDestinationOptions.DiskFileName = strExportedFile; crExportOptions = EoRpt.ExportOptions; EoRpt.ExportOptions.DestinationOptions = crDiskFileDestinationOptions; EoRpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; EoRpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; EoRpt.Export(); EoRpt.Close(); //读取报表导出的内容并传到客户端?继续加入以下代码 Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.WriteFile(strExportedFile); Response.Flush(); Response.Close(); }
private void cmdPDF_Click(object sender, EventArgs e) { conn.Open(); string sql = "Select student_id,sname,major,minor From student order by student_id"; OleDbCommand dbComm = new OleDbCommand(sql, conn); OleDbDataAdapter dbAdap = new OleDbDataAdapter(dbComm); DataSet ds = new DataSet(); dbAdap.Fill(ds, "Student"); rptStudent rptStudent = new rptStudent(); rptStudent.SetDataSource(ds); conn.Close(); IEnumerator ie = rptStudent.Section1.ReportObjects.GetEnumerator(); ie.Reset(); while (ie.MoveNext()) { if (ie.Current != null && ie.Current.GetType().ToString().Equals("CrystalDecisions.CrystalReports.Engine.TextObject")) { CrystalDecisions.CrystalReports.Engine.TextObject txt = (CrystalDecisions.CrystalReports.Engine.TextObject)ie.Current; if (txt.Name == "txtLevelTerm") txt.Text = "Class : Level 4 Term 2"; } } ie = rptStudent.Section5.ReportObjects.GetEnumerator(); ie.Reset(); while (ie.MoveNext()) { if (ie.Current != null && ie.Current.GetType().ToString().Equals("CrystalDecisions.CrystalReports.Engine.TextObject")) { CrystalDecisions.CrystalReports.Engine.TextObject txt = (CrystalDecisions.CrystalReports.Engine.TextObject)ie.Current; if (txt.Name == "txtCGPA") txt.Text = "CGPA : 3.42"; } } try { ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = Application.StartupPath + "\\Student.pdf"; CrExportOptions = rptStudent.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.ExportDestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.ExportFormatOptions = CrFormatTypeOptions; } rptStudent.Export(); Process process = new Process(); process.StartInfo.FileName=Application.StartupPath+"\\Student.pdf"; process.Start(); } catch(IOException) { MessageBox.Show("The pdf file is already open. Please close it and try again."); } }
private void Export_pdf(DataTable dt_export, string branch_code, string type, string folderOut) { try { if (dt_export.Rows.Count > 0) { string file_path = folderOut.Trim() + branch_code.Trim() + "_" + type + "_" + dpFromDate.Text.Trim().Replace("/", "") + "_" + dpToDate.Text.Trim().Replace("/", "") + ".pdf"; PHT06 cry = new PHT06(); cry.SetDataSource(dt_export); string title = "DANH SÁCH THẺ ĐÃ PHÁT HÀNH, IN PIN"; cry.SetParameterValue("Title", title); cry.SetParameterValue("Fromdate", dpFromDate.Text.Trim()); cry.SetParameterValue("Todate", dpToDate.Text.Trim()); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; //CrExportOptions.ExportFormatType = ExportFormatType.WordForWindows; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export(); //--Fix for Load Report failse if (cry != null) { cry.Close(); cry.Dispose(); } } } catch (Exception ex) { //MessageBox.Show("Err Export_pdf: \n Branch: "+ branch_code +"\n" + ex.ToString()); string[] row = { branch_code, ex.ToString() }; dgv_err.Rows.Add(row); } }
public void VistaPrevia(string key) { try { ReportDocument objRpt = new ReportDocument(); DataSet ds = (DataSet)this.GetDataReport(key); //string reportPath = Application.StartupPath + "\\Reporte\\co_ordenCompra_rpt.rpt"; string reportPath = "C:\\Reportes\\CRTejTicket_rpt.rpt"; objRpt.Load(reportPath); DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions(); ExportOptions crExportOptions = new ExportOptions(); objRpt.SetDataSource(ds.Tables[0]); string strfolder = "C:\\Reporte\\"; crDiskFileDestinationOption.DiskFileName = strfolder + "Etiqueta.pdf"; crExportOptions = objRpt.ExportOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption; crExportOptions.ExportFormatOptions = crFormatTypeOption; crystalReportViewer1.ReportSource = objRpt; //PageMargins margins; //margins = objRpt.PrintOptions.PageMargins; //margins.bottomMargin = 250; //margins.leftMargin = 250; //margins.rightMargin = 250; //margins.topMargin = 250; //objRpt.PrintOptions.ApplyPageMargins(margins); //objRpt.Export(); } catch (Exception ex) { ex.ToString(); } }
private void GeneratePDF() { ReportDocument rpt = new ReportDocument(); switch (cboReportType.SelectedItem.Text) { case "Posted PO": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PostedPO.rpt")); break; case "Posted PO Returns": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PostedPOReturns.rpt")); break; case "Posted Debit Memo": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PostedDebitMemo.rpt")); break; case "By Vendor": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PurchaseAnalysis.rpt")); break; default: return; } ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\retailplus\temp\"); string strFileName = cboReportType.SelectedItem.Text.Replace(" ", "").ToLower() + "_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".pdf"; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); dest.DiskFileName = strPath + strFileName; exportop = rpt.ExportOptions; SetDataSource(rpt); exportop.DestinationOptions = dest; exportop.ExportDestinationType = ExportDestinationType.DiskFile; exportop.ExportFormatType = ExportFormatType.PortableDocFormat; rpt.Export(); rpt.Close(); rpt.Dispose(); fraViewer.Attributes.Add("src",Constants.ROOT_DIRECTORY + "/temp/" + strFileName); }
private void GenerateHTML() { ReportDocument rpt = new ReportDocument(); switch (cboReportType.SelectedItem.Text) { case "Posted PO": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PostedPO.rpt")); break; case "Posted PO Returns": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PostedPOReturns.rpt")); break; case "Posted Debit Memo": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PostedDebitMemo.rpt")); break; case "By Vendor": rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/PurchaseAnalysis.rpt")); break; default: return; } HTMLFormatOptions htmlOpts = new HTMLFormatOptions(); ExportOptions exportop = new ExportOptions(); DiskFileDestinationOptions dest = new DiskFileDestinationOptions(); string strPath = Server.MapPath(@"\retailplus\temp\html\"); string strFileName = cboReportType.SelectedItem.Text.Replace(" ", "").ToLower() + "_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".htm"; if (System.IO.File.Exists(strPath + strFileName)) System.IO.File.Delete(strPath + strFileName); htmlOpts.HTMLFileName = strFileName; htmlOpts.HTMLEnableSeparatedPages = true;; htmlOpts.HTMLHasPageNavigator = true; htmlOpts.HTMLBaseFolderName = strPath; rpt.ExportOptions.FormatOptions = htmlOpts; exportop = rpt.ExportOptions; exportop.ExportDestinationType = ExportDestinationType.DiskFile; exportop.ExportFormatType = ExportFormatType.HTML40; dest.DiskFileName = strFileName.ToString(); exportop.DestinationOptions = dest; SetDataSource(rpt); Session["ReportDocument"] = rpt; rpt.Export(); rpt.Close(); rpt.Dispose(); strFileName = "//" + Request.ServerVariables["SERVER_NAME"].ToString() + FindHTMLFile(strPath,strFileName); fraViewer.Attributes.Add("src",strFileName); }
private void Export_pdf(string branch_code,DataTable dt) { try { if (dt.Rows.Count > 0) { string file_path = tbFilePath.Text.Trim() + "\\" + branch_code.Trim() + "_" + dp_from_date.Text.Trim().Replace("/", ".") + "_" + dp_to_date.Text.Trim().Replace("/", ".") + ".pdf"; //string file_path = tbFilePath.Text.Trim() + "\\" + branch_code.Trim() + ".pdf"; //export PDF Rpt_PHT18 cry = new Rpt_PHT18(); cry.SetDataSource(dt); string title = "", Fromdate = "", Todate = ""; string title2 = ""; title = "DANH SÁCH CÁC THẺ CẦN GIA HẠN "; Fromdate = dp_from_date.Text.Trim(); Todate = dp_to_date.Text.Trim(); //title2 = "(Từ ngày " + dp_from_date.Text.Trim() + " đến ngày " + dp_to_date.Text.Trim() + " )"; cry.SetParameterValue("title", title); cry.SetParameterValue("Fromdate", Fromdate); cry.SetParameterValue("Todate", Todate); //cry.SetParameterValue("title2", title2); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export(); //--Fix for Load Report failse if (cry != null) { cry.Close(); cry.Dispose(); } } } catch (Exception ex) { //MessageBox.Show("Err Export_pdf: \n Branch: "+ branch_code +"\n" + ex.ToString()); string[] row = { branch_code, ex.ToString() }; dgv_err.Rows.Add(row); } }
private void button1_Click(object sender, EventArgs e) { string sql = "", err = ""; string title = ""; string type = ""; if (cbOption.SelectedIndex + 1 == 1) type = "MB-TNT01"; if (cbOption.SelectedIndex + 1 == 2) type = "MB-TNT04"; if (cbOption.SelectedIndex + 1 == 3) type = "MB-TNT05"; if (cbOption.SelectedIndex + 1 == 4) type = "CR_TN21"; if (cbOption.SelectedIndex + 1 == 5) type = "CR_TN3"; if (cbOption.SelectedIndex + 1 == 6) type = "CR_ADC"; if (cbOption.SelectedIndex + 1 == 7) type = "MB-TNT09"; if (cbOption.SelectedIndex + 1 == 8) type = "CR_LV1"; if (cbOption.SelectedIndex + 1 == 9) type = "CR_TD1"; this.Cursor = Cursors.WaitCursor; string folderOut = tbFilePath.Text.Trim(); //Tao thu muc if (!Directory.Exists(folderOut)) { Directory.CreateDirectory(folderOut); } if (type != "") { sql = ""; err = ""; sql = " select *"; sql += " from "+Businessbp.executedb.owner+"nab_credit_xln_sendmail g"; sql += " where trim(g.type_report)='" + type + "'"; sql += " and trunc(g.date_create)=trunc(sysdate)"; DataTable dtCheck = Businessbp.executedb.getTable(sql, ref err); if (err != "") { MessageBox.Show(err); return; } else { if (dtCheck.Rows.Count > 0) { MessageBox.Show("Đã xử lý Report này cho hôm nay."); return; } } for (int k = 0; k < dtBranch.Rows.Count; k++)//Vòng lặp để xuất ra từng Branch { string branch = dtBranch.Rows[k]["branch_code"].ToString().Trim(); tbStatus.Text = "Da xu ly : "+ (k +1).ToString() +" --" +"Dang xu ly :"+branch; if (type.ToUpper() == "MB-TNT04") { //sql = "select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = "select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } else { sql = "select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } sql += " nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.cr_account_nbr"; sql += " and c.cr_account_nbr = d.card_number"; sql += " and d.application_no = e.source_application_no"; //sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) <> '0' "; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 1 "; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) < 16 "; sql += " and trim(e.branch_code_dsa_code) = '" + branch + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH KHÁCH HÀNG CẦN THÚC NỢ LẦN 1"; } #region chualam else if (type.ToUpper() == "MB-TNT05") { //sql = "select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due," + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = "select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due," + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } else { sql = "select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due," + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } sql += " nvl(" +Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.cr_account_nbr"; sql += " and c.cr_account_nbr = d.card_number"; sql += " and d.application_no = e.source_application_no"; // sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) <> '0' "; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 16 "; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) < 31 "; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH KHÁCH HÀNG CẦN THÚC NỢ LẦN 2"; } else if (type.ToUpper() == "CR_TN21") { //sql = "select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, trunc(b.payment_date) payment_date,"; //old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = "select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, trunc(b.payment_date) payment_date,"; //2014-04-01 (1) } else { sql = "select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, trunc(b.payment_date) payment_date,"; //2014-04-01 (1) } sql += " nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.cr_account_nbr = d.card_number"; sql += " and d.application_no = e.source_application_no"; // sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) <> '0' "; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 31"; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) < 61 "; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH KHÁCH HÀNG CẦN THÚC NỢ LẦN 3";// VÀ GỬI THƯ LẦN 1"; } else if (type.ToUpper() == "CR_TN3") { //sql = "select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = "select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } else { sql = "select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } sql += " nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.card_number = d.card_number"; sql += " and d.application_no = e.source_application_no"; // sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) <> '0' "; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 61"; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) < 91"; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH CÁC THẺ CẦN GỬI THƯ LẦN 2"; } else if (type.ToUpper() == "CR_ADC") { //sql = " select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status,to_char(b.payment_date,'dd/mm/yyyy') payment_date,'' as number_days,'' as Ghi_chu"; //old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = " select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status,to_char(b.payment_date,'dd/mm/yyyy') payment_date,'' as number_days,'' as Ghi_chu"; //old 2014-04-01 (1) } else { sql = " select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status,to_char(b.payment_date,'dd/mm/yyyy') payment_date,'' as number_days,'' as Ghi_chu"; //old 2014-04-01 (1) } sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.card_number = d.card_number"; sql += " and d.application_no = e.source_application_no"; // sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) ,0) >= 3"; sql += " and nvl(a.acc_adm_status,0) = 0 "; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH CÁC THẺ CẦN KHÓA ADMIN STATUS"; } else if (type.ToUpper() == "CR_LV1") { //sql = " select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = " select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } else { sql = " select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr,e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; //2014-04-01 (1) } sql += " nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.card_number = d.card_number"; sql += " and d.application_no = e.source_application_no"; // sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) <> '0' "; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 91"; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) < 121 "; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH CÁC THẺ CẦN LÀM VIỆC TRỰC TIẾP"; } else if (type.ToUpper() == "CR_TD1") { //sql = " select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,";//old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = " select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,";//2014-04-01 (1) } else { sql = " select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,";//2014-04-01 (1) } sql += " nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.card_number = d.card_number"; sql += " and d.application_no = e.source_application_no"; // sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) <> '0' "; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 121"; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) <= 150"; sql += " and a.acc_adm_status not in ('3')"; //sql += " and c.embossed_name not in ('%NQH-CD')"; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH CÁC THẺ CẦN TÁI THẨM ĐỊNH"; } else if (type.ToUpper() == "MB-TNT01") { //sql = "select a.cr_account_nbr, e.branch_code_dsa_code branch_code,";//old 2014-04-01 (1) if (Frm_main.admin_flag) { sql = "select distinct a.cr_account_nbr account_nbr,a.cr_account_nbr , e.branch_code_dsa_code branch_code,";// 2014-04-01 (1) } else { sql = "select distinct a.cr_account_nbr account_nbr,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr, e.branch_code_dsa_code branch_code,";// 2014-04-01 (1) } sql += " decode(e.ADDON_CARD_FLAG, '1', nvl(("; sql += " select aa.embossed_name"; sql += " from " + Businessbp.executedb.owner + "card aa"; sql += " where aa.card_number = e.ADDON_CARD_NUMBER"; sql += " ),' ')"; sql += " , c.embossed_name) embossed_name,";//Lấy embossing name cho thẻ phụ sql += " c.family_name, b.opening_bal, b.closing_bal, b.min_due," + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') payment_date,"; sql += " nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, " + Businessbp.executedb.owner + "card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.card_number = d.card_number"; sql += " and d.application_no = e.source_application_no"; //sql += " and nvl(a.acc_unpaid_status, '0') <> '0'"; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 sql += " and b.min_due>0 "; sql += " and nvl(b.closing_bal,0)>0 "; sql += " and trunc(b.stat_date)<=trunc(sysdate) ";// Sau ngay chay mounthly sql += " and trunc(sysdate)<= trunc(nvl(b.payment_date,sysdate)) ";// Nho hon ngay T sql += " and a.cr_account_nbr not in (select r.cr_account_nbr from " + Businessbp.executedb.owner + "nab_credit_unpaid r) "; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH CÁC THẺ CẦN NHẮC NỢ"; } ////else if (cbOption.SelectedValue.ToString().ToUpper() == "MB-CNQH") ////{ //// Session["type"] = "MB-CNQH"; //// //sql += " select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, a.acc_unpaid_status, b.payment_date,"; //// //sql += " ((sysdate - nvl(a.acc_unpaid_status_date, sysdate)) + (nvl(a.acc_unpaid_status,0) - 1)*30) number_days,'' as Ghi_chu"; //// sql = " select to_char(rownum) as STT,a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, e.legal_id as CMND "; //// sql += " ,(nvl(a.bal_purchase,0) + nvl(a.bal_cash,0) + nvl(a.bal_te,0) + nvl(a.bal_unique,0) + nvl(a.bal_cheque,0) + nvl(a.bal_fee,0) + nvl(a.bal_interest,0) - nvl(a.bal_payment,0) + nvl(a.bal_transfer,0) + nvl(a.cur_purchase,0) + nvl(a.cur_cash,0) + nvl(a.cur_te,0) + nvl(a.cur_unique,0) + nvl(a.cur_cheque,0) + nvl(a.cur_fee,0) + nvl(a.cur_interest,0) - nvl(a.cur_payment,0) + nvl(a.cur_transfer,0)) as du_no"; //// sql += " , b.opening_bal, b.closing_bal, b.min_due, a.acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') as payment_date"; //// sql += " ,a.cycoff_code"; //// sql += " ,round(((sysdate - nvl(a.acc_unpaid_status_date, sysdate)) + (nvl(a.acc_unpaid_status,0) - 1)*30)) number_days,'' as Ghi_chu"; //// sql += " from " + executedb.owner + "account a, " + executedb.owner + "cr_term b, card c, " + executedb.owner + "application d, " + executedb.owner + "cp_card e"; //// sql += " where a.cr_account_nbr = b.cr_account_nbr"; //// sql += " and a.cr_account_nbr = c.card_number"; //// sql += " and c.card_number = d.card_number"; //// sql += " and d.application_no = e.source_application_no"; //// sql += " and b.stat_date = ("; //// sql += " select max(f.stat_date)"; //// sql += " from " + executedb.owner + "cr_term f"; //// sql += " where f.cr_account_nbr = a.cr_account_nbr"; //// sql += " )"; //// sql += " and ((sysdate - nvl(a.acc_unpaid_status_date, sysdate)) + (nvl(a.acc_unpaid_status,0) - 1)*30) >= 106"; //// sql += " and not exists ("; //// sql += " select 1 "; //// sql += " from " + executedb.owner + "nab_credit_unpaid v"; //// sql += " where v.cr_account_nbr = a.cr_account_nbr"; //// sql += " )"; //// if (cbBranch.SelectedValue.ToString().ToUpper() != "9999")//9999: all //// sql += " and e.branch_code_dsa_code = '" + cbBranch.SelectedValue.ToString().ToUpper() + "'";// --set for choosing branch"; //// if (tbAccount.Text.Trim() != "") //// sql += " and a.cr_account_nbr = '" + tbAccount.Text.Trim() + "'";// --set for choosing account"; //// if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All //// sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; //// Session["sql"] = sql; //// Session["title"] = "DANH SÁCH KHÁCH HÀNG CẦN CHUYỂN NỢ QUÁ HẠN NHƯNG CHƯA CHUYỂN"; //// //Session["fromtime"] = dpFromDate.Text; //// // Session["totime"] = dpToDate.Text; //// Response.Write("<script type='text/javascript'>window.open('reportview.aspx','window_name','scrollbars=yes,menubar=no,height=700,width=785,resizable=yes,toolbar=no,location=no,status=no,fullscreen=no,titlebar=no,directories=no');</script>"); ////} else if (type.ToUpper() == "MB-TNT09") { //sql += " select a.cr_account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, c.family_name, b.opening_bal, b.closing_bal, b.min_due, a.acc_unpaid_status, b.payment_date,"; //sql += " ((sysdate - nvl(a.acc_unpaid_status_date, sysdate)) + (nvl(a.acc_unpaid_status,0) - 1)*30) number_days,'' as Ghi_chu"; if (Frm_main.admin_flag) { sql = " select to_char(rownum) as STT,a.cr_account_nbr,a.cr_account_nbr account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, e.legal_id as CMND "; } else { sql = " select to_char(rownum) as STT,substr(a.cr_account_nbr,1,4)||'xxxxxxxx'||substr(a.cr_account_nbr,-4) cr_account_nbr ,a.cr_account_nbr account_nbr, e.branch_code_dsa_code branch_code, c.embossed_name, e.legal_id as CMND "; } sql += " ,(nvl(a.bal_purchase,0) + nvl(a.bal_cash,0) + nvl(a.bal_te,0) + nvl(a.bal_unique,0) + nvl(a.bal_cheque,0) + nvl(a.bal_fee,0) + nvl(a.bal_interest,0) - nvl(a.bal_payment,0) + nvl(a.bal_transfer,0) + nvl(a.cur_purchase,0) + nvl(a.cur_cash,0) + nvl(a.cur_te,0) + nvl(a.cur_unique,0) + nvl(a.cur_cheque,0) + nvl(a.cur_fee,0) + nvl(a.cur_interest,0) - nvl(a.cur_payment,0) + nvl(a.cur_transfer,0)) as du_no"; sql += " , b.opening_bal, b.closing_bal, b.min_due, " + Businessbp.executedb.owner + "nab_getUnpaidStatus(a.cr_account_nbr) acc_unpaid_status, to_char(b.payment_date,'dd/mm/yyyy') as payment_date"; sql += " ,a.cycoff_code"; sql += " ,nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) number_days,'' as Ghi_chu"; sql += " from " + Businessbp.executedb.owner + "account a, " + Businessbp.executedb.owner + "cr_term b, card c, " + Businessbp.executedb.owner + "application d, " + Businessbp.executedb.owner + "cp_card e"; sql += " where a.cr_account_nbr = b.cr_account_nbr"; sql += " and a.cr_account_nbr = c.card_number"; sql += " and c.card_number = d.card_number"; sql += " and d.application_no = e.source_application_no"; sql += " and b.stat_date = ("; sql += " select max(f.stat_date)"; sql += " from " + Businessbp.executedb.owner + "cr_term f"; sql += " where f.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and c.status_code in ('0','3','9','10') "; //Phong edit 15/06/2013 //sql += " and ((sysdate - nvl(a.acc_unpaid_status_date, sysdate)) + (nvl(a.acc_unpaid_status,0) - 1)*30) >= 91"; sql += " and nvl(" + Businessbp.executedb.owner + "nab_getThucNoDays(a.cr_account_nbr),0) >= 106"; sql += " and not exists ("; sql += " select 1 "; sql += " from " + Businessbp.executedb.owner + "nab_credit_unpaid v"; sql += " where v.cr_account_nbr = a.cr_account_nbr"; sql += " )"; sql += " and trim(e.branch_code_dsa_code) = '" + branch.ToUpper() + "'";// --set for choosing branch"; if (cbCycle.SelectedValue.ToString().ToUpper() != "000")//000: All sql += " and a.cycoff_code = '" + cbCycle.SelectedValue.ToString().ToUpper() + "'"; title = "DANH SÁCH KHÁCH HÀNG CẦN CHUYỂN NỢ QUÁ HẠN NHƯNG CHƯA CHUYỂN"; } #endregion chualam if (sql != "") { DataTable dtReport = Businessbp.executedb.getTable(sql, ref err); dtReport.Columns.Remove("account_nbr"); if (err != "") { MessageBox.Show(err); this.Cursor = Cursors.Default; return; } else { string file_path = tbFilePath.Text.Trim() + branch.Trim() + "_" + type + "_" + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //Export pdf try { if (dtReport.Rows.Count > 0) { rpt_Xu_Ly_No cry = new rpt_Xu_Ly_No(); cry.SetDataSource(dtReport); // string title = ""; cry.SetParameterValue("title", title); cry.SetParameterValue("MauBieu", "Mẫu: "); cry.SetParameterValue("Ngayin", DateTime.Now.ToShortDateString()); cry.SetParameterValue("Gioin", DateTime.Now.ToLongTimeString()); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; //CrExportOptions.ExportFormatType = ExportFormatType.WordForWindows; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export(); //--Fix for Load Report failse if (cry != null) { cry.Close(); cry.Dispose(); } //lấy dữ liệu insert table sql = ""; err = ""; sql = "insert into " + Businessbp.executedb.owner + "NAB_CREDIT_XLN_SENDMAIL"; sql += " (BRANCH_CODE ,FILE_PATH ,USER_CREATE ,DATE_CREATE,SEND_FLAG ,TYPE_REPORT)"; sql += "values ("; sql += "'" + branch + "',"; sql += "'" + file_path.Replace("\\",@"\") + "',"; sql += "'" + Businessbp.executedb.Usrid + "',"; sql += "sysdate,"; sql += "'0',"; sql += "'" + type + "'"; sql += ")"; Businessbp.executedb.ExecuteDML(sql, ref err); if (err != "") { MessageBox.Show(err); //return; // this.Cursor = Cursors.Default; } } else { // MessageBox.Show("");//+ card_number.Trim()); } } catch (Exception ex) { MessageBox.Show(ex.Message); this.Cursor = Cursors.Default; } } }//End for branch this.Cursor = Cursors.Default; tbStatus.Text += "-- Success"; } } }
public void PrintReport(string key) { try { //---------------------------------------- ReportDocument objRpt = new ReportDocument(); DataSet ds = (DataSet)this.GetDataReport(key); string reportPath = "C:\\Reportes\\CRIngreso_etiqueta02.rpt"; objRpt.Load(reportPath); DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions(); ExportOptions crExportOptions = new ExportOptions(); objRpt.SetDataSource(ds.Tables[0]); string strfolder = "C:\\Reporte\\"; crDiskFileDestinationOption.DiskFileName = strfolder + "Etiqueta.pdf"; crExportOptions = objRpt.ExportOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption; crExportOptions.ExportFormatOptions = crFormatTypeOption; objRpt.Export(); //--------------------------------------- ////string PrinterName = this.printDocument1.PrinterSettings.PrinterName; //string NombreImpresora = ""; ////for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++) ////{ //// PrinterSettings a = new PrinterSettings(); //// a.PrinterName = PrinterSettings.InstalledPrinters[i].ToString(); //// if (a.IsDefaultPrinter) //// { //// PrinterName = PrinterSettings.InstalledPrinters[i].ToString(); //// } ////} //this.printDialog1.Document = this.printDocument1; //DialogResult dr = this.printDialog1.ShowDialog(); //if (dr == DialogResult.OK) // { PageMargins margins; margins = objRpt.PrintOptions.PageMargins; margins.bottomMargin = 250; margins.leftMargin = 250; margins.rightMargin = 250; margins.topMargin = 250; objRpt.PrintOptions.ApplyPageMargins(margins); //string PrinterName = this.printDocument1.PrinterSettings.PrinterName; // ////objRpt.PrintOptions.PrinterName = PrinterName; objRpt.PrintOptions.PrinterName = GetImpresoraDefecto(); //objRpt.PrintOptions.PrinterName = PrinterName; objRpt.PrintToPrinter(1, false, 0, 0); //} } catch (Exception ex) { ex.ToString(); } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { //--- Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } //--- Validate query string if ((Request.QueryString["target_report"] == null) || (Request.QueryString["format"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in viewer.aspx"); } //--- Initialize bool empty = false; LFSRecordForReportsGateway lfsRecordForReportsGateway = new LFSRecordForReportsGateway(); //--- Get report data #region Get report data switch (Request.QueryString["target_report"]) { //--- CXIRemovedReport case "CXIRemovedReport": TDSCXIRemovedReport dataSet = lfsRecordForReportsGateway.GetCXIRemovedReportByCompanyId(Convert.ToInt32(Session["companyID"])); if (dataSet.CXIRemovedReport.Rows.Count > 0) { report = new rCXIRemovedReport(); report.SetDataSource(dataSet); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- ReadyForLining case "ReadyForLining": TDSReadyForLining tdsReadyForLining = lfsRecordForReportsGateway.GetReadyForLiningByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsReadyForLining.ReadyForLining.Rows.Count > 0) { report = new rReadyForLining(); report.SetDataSource(tdsReadyForLining); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- ToBePrepped case "ToBePrepped": TDSToBePrepped tdsToBePrepped = lfsRecordForReportsGateway.GetToBePreppedByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsToBePrepped.ToBePrepped.Rows.Count > 0) { report = new rToBePrepped(); report.SetDataSource(tdsToBePrepped); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- ToBeMeasured case "ToBeMeasured": TDSToBeMeasured tdsToBeMeasured = lfsRecordForReportsGateway.GetToBeMeasuredByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsToBeMeasured.ToBeMeasured.Rows.Count > 0) { report = new rToBeMeasured(); report.SetDataSource(tdsToBeMeasured); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- LiningCompleted case "LiningCompleted": TDSLiningCompleted tdsLiningCompleted = lfsRecordForReportsGateway.GetLiningCompletedByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"]), Convert.ToDateTime(Request.QueryString["start_date"]), Convert.ToDateTime(Request.QueryString["end_date"])); if (tdsLiningCompleted.LiningCompleted.Rows.Count > 0) { report = new rLiningCompleted(); report.SetDataSource(tdsLiningCompleted); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- OverviewReport case "OverviewReport": TDSOverviewReport tdsOverviewReport = lfsRecordForReportsGateway.GetOverviewReportByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsOverviewReport.OverviewReport.Rows.Count > 0) { report = new rOverviewReport(); report.SetDataSource(tdsOverviewReport); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- RehabAssessmentAreas case "RehabAssessmentAreas": TDSRehabAssessmentAreas tdsRehabAssessmentAreas = lfsRecordForReportsGateway.GetRehabAssessmentAreasByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsRehabAssessmentAreas.RehabAssessmentAreas.Rows.Count > 0) { report = new rRehabAssessmentAreas(); report.SetDataSource(tdsRehabAssessmentAreas); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- AllOutstandingIssues case "AllOutstandingIssues": TDSAllOutstandingIssues tdsAllOutstandingIssues = lfsRecordForReportsGateway.GetAllOutstandingIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsAllOutstandingIssues.AllOutstandingIssues.Rows.Count > 0) { report = new rAllOutstandingIssues(); report.SetDataSource(tdsAllOutstandingIssues); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- OutstandingClientIssues case "OutstandingClientIssues": TDSOutstandingClientIssues tdsOutstandingClientIssues = lfsRecordForReportsGateway.GetOutstandingClientIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsOutstandingClientIssues.OutstandingClientIssues.Rows.Count > 0) { report = new rOutstandingClientIssues(); report.SetDataSource(tdsOutstandingClientIssues); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- OutstandingLFSIssues case "OutstandingLFSIssues": TDSOutstandingLFSIssues tdsOutstandingLFSIssues = lfsRecordForReportsGateway.GetOutstandingLFSIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsOutstandingLFSIssues.OutstandingLFSIssues.Rows.Count > 0) { report = new rOutstandingLFSIssues(); report.SetDataSource(tdsOutstandingLFSIssues); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- OutstandingInvestigationIssues case "OutstandingInvestigationIssues": TDSOutstandingInvestigationIssues tdsOutstandingInvestigationIssues = lfsRecordForReportsGateway.GetOutstandingInvestigacionIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsOutstandingInvestigationIssues.OutstandingInvestigationUssue.Rows.Count > 0) { report = new rOutstandingInvestigationIssues(); report.SetDataSource(tdsOutstandingInvestigationIssues); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- OutstandingSalesIssues case "OutstandingSalesIssues": TDSOutstandingSalesIssues tdsOutstandingSalesIssues = lfsRecordForReportsGateway.GetOutstandingSalesIssuesByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsOutstandingSalesIssues.OutstandingSalesIssues.Rows.Count > 0) { report = new rOutstandingSalesIssues(); report.SetDataSource(tdsOutstandingSalesIssues); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- ClientInvestigationIssuesCityCopy case "ClientInvestigationIssuesCityCopy": TDSClientInvestigationIssuesCityCopy tdsClientInvestigationIssuesCityCopy = lfsRecordForReportsGateway.GetClientInvestigationIssuesCityCopyByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsClientInvestigationIssuesCityCopy.ClientInvestigationIssuesCityCopy.Rows.Count > 0) { report = new rClientInvestigationIssuesCityCopy(); report.SetDataSource(tdsClientInvestigationIssuesCityCopy); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- PointLinerReport case "PointLinerReport": TDSPointLinerReport tdsPointLinerReport = lfsRecordForReportsGateway.GetPointLinerReportByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsPointLinerReport.PointLinerReport.Rows.Count > 0) { report = new rPointLinerReport(); report.SetDataSource(tdsPointLinerReport); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- PointLinerScopeSheet case "PointLinerScopeSheet": TDSPointLinerScopeSheet tdsPointLinerScopeSheet = lfsRecordForReportsGateway.GetPointLinerScopeSheetByCompanyId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsPointLinerScopeSheet.PointLinerScopeSheet.Rows.Count > 0) { report = new rPointLinerScopeSheet(); report.SetDataSource(tdsPointLinerScopeSheet); report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- OutstandingPointRepairs case "OutstandingPointRepairsReport": TDSOutstandingPointRepairs tdsOutstandingPointRepairs = lfsRecordForReportsGateway.GetOutstandingPointRepairsCompanyIdCompaniesId(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsOutstandingPointRepairs.OutstandingPointRepairs.Rows.Count > 0) { //--- Report creation and data binding report = new rOutstandingPointRepairs(); report.SetDataSource(tdsOutstandingPointRepairs); //--- Format control if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } //--- Report format report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- M1ReportByClient case "M1ReportByClient": TDSM1ReportByClient tdsM1ReportByClient; if ((Request.QueryString["id"] != "0") && (Request.QueryString["companies"] == "0") && (Request.QueryString["date"] == "0")) { tdsM1ReportByClient = lfsRecordForReportsGateway.GetM1ReportByClientByCompanyIdByID(Convert.ToInt32(Session["companyID"]), Request.QueryString["id"]); } else if ((Request.QueryString["id"] == "0") && (Convert.ToInt32(Request.QueryString["companies"]) != 0) && (Request.QueryString["date"] == "0")) { tdsM1ReportByClient = lfsRecordForReportsGateway.GetM1ReportByClientByCompanyIdByCompanies(Convert.ToInt32(Session["companyID"]), Convert.ToInt32(Request.QueryString["companies"])); } else { tdsM1ReportByClient = lfsRecordForReportsGateway.GetM1ReportByClientByCompanyIdByDate(Convert.ToInt32(Session["companyID"]), Request.QueryString["date"]); } if (tdsM1ReportByClient.M1ReportByClient.Rows.Count > 0) { report = new rM1ReportByClient(); report.SetDataSource(tdsM1ReportByClient); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- M2ReportByID case "M2ReportByID": TDSM2ReportByID tdsM2ReportByID; if ((Request.QueryString["id"] != "0") && (Request.QueryString["companies"] == "0") && (Request.QueryString["date"] == "0")) { tdsM2ReportByID = lfsRecordForReportsGateway.GetM2ReportByIDByCompanyIdById(Convert.ToInt32(Session["companyID"]), Request.QueryString["id"]); } else if ((Request.QueryString["id"] == "0") && (Convert.ToInt32(Request.QueryString["companies"]) != 0) && (Request.QueryString["date"] == "0")) { tdsM2ReportByID = lfsRecordForReportsGateway.GetM2ReportByIDByCompanyIdByCompanies(Convert.ToInt32(Session["companyID"]), Convert.ToInt32(Request.QueryString["companies"])); } else { tdsM2ReportByID = lfsRecordForReportsGateway.GetM2ReportByIDByCompanyIdByDate(Convert.ToInt32(Session["companyID"]), Request.QueryString["date"]); } if (tdsM2ReportByID.LFS_MASTER_AREA.Rows.Count > 0) { report = new rM2ReportByID(); report.SetDataSource(tdsM2ReportByID); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- WorkAhead case "WorkAhead": TDSWorkAhead tdsWorkAhead = lfsRecordForReportsGateway.GetWorkAheadByCompanyId(Convert.ToInt32(Session["companyID"])); if (tdsWorkAhead.WorkAhead1.Rows.Count > 0) { report = new rWorkAhead(); report.SetDataSource(tdsWorkAhead); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; //--- JLinerOverviewReport case "JLinerOverviewReport": TDSJLinerOverviewReport tdsJLinerOverviewReport = lfsRecordForReportsGateway.GetJLinerOverviewReportByCompanyIDCompaniesID(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsJLinerOverviewReport.JLinerOverviewReport.Rows.Count > 0) { //---Report creation and data binding if (Convert.ToBoolean(Session["sgLFS_APP_ADMIN"])) { report = new rJLinerOverviewReport(); } else { report = new rJLinerOverviewReportSimple(); } report.SetDataSource(tdsJLinerOverviewReport); //---Format control if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } //---Report format report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- JLinersReadyToLine case "JLinersReadyToLine": TDSJLinersReadyToLine tdsJLinersReadyToLine = lfsRecordForReportsGateway.GetJLinersReadyToLineByCompanyIDCompaniesID(Convert.ToInt32(Session["companyID"]), Convert.ToBoolean(Request.QueryString["all_clients"]), Convert.ToInt32(Request.QueryString["companies_id"])); if (tdsJLinersReadyToLine.JLinersReadyToLine.Rows.Count > 0) { //---Report creation and data binding report = new rJLinersReadyToLine(); report.SetDataSource(tdsJLinersReadyToLine); //---Format control if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sReportHeader"]).SectionFormat.EnableSuppress = false; ((Section)report.ReportDefinition.Sections["sPageHeader"]).SectionFormat.EnableSuppress = true; ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } //---Report format report.PrintOptions.PaperOrientation = PaperOrientation.Landscape; report.PrintOptions.PaperSize = PaperSize.PaperLegal; } else { empty = true; } break; //--- JLinersToBuild case "JLinersToBuild": TDSJLinersToBuild tdsJLinersToBuild = lfsRecordForReportsGateway.GetJLinersToBuildByCompanyId(Convert.ToInt32(Session["companyID"])); if (tdsJLinersToBuild.JLinersToBuild.Rows.Count > 0) { report = new rJLinersToBuild(); report.SetDataSource(tdsJLinersToBuild); if (Request.QueryString["format"] == "pdf") { ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = false; } else { ((Section)report.ReportDefinition.Sections["sPageFooter"]).SectionFormat.EnableSuppress = true; } report.PrintOptions.PaperOrientation = PaperOrientation.Portrait; report.PrintOptions.PaperSize = PaperSize.PaperLetter; } else { empty = true; } break; } #endregion if (!empty) { //--- Configure report //--- ... Disk options string physicalApplicationPath = Request.PhysicalApplicationPath; if (Request.PhysicalApplicationPath.Substring(Request.PhysicalApplicationPath.Length-1, 1) != "\\") { physicalApplicationPath += "\\"; } string fName = ""; switch (Request.QueryString["format"]) { case "pdf": fName = physicalApplicationPath + "export\\" + Guid.NewGuid().ToString() + ".pdf"; Session["fName"] = fName; break; case "excel": fName = physicalApplicationPath + "export\\" + Guid.NewGuid().ToString() + ".xls"; Session["fName"] = fName; break; case "word": break; } DiskFileDestinationOptions diskOptions = new DiskFileDestinationOptions(); diskOptions.DiskFileName = fName; //--- ... Export options report.ExportOptions.DestinationOptions = diskOptions; report.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; switch (Request.QueryString["format"]) { case "pdf": report.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; break; case "excel": ExcelFormatOptions excelOptions = new ExcelFormatOptions(); excelOptions.ExcelUseConstantColumnWidth = false; excelOptions.ExcelTabHasColumnHeadings = false; report.ExportOptions.ExportFormatType = ExportFormatType.Excel; report.ExportOptions.FormatOptions = excelOptions; break; case "word": break; } //--- Export report try { report.Export(); } catch(Exception ex) { Response.Redirect("./../error_page.aspx?error=" + ex.Message); } //--- Preview report Response.Redirect("viewer2.aspx?target_report=" + Request.QueryString["target_report"] + "&format=" + Request.QueryString["format"], true); } else { Response.Write("<br> No records found for your report."); } }
private void muestrareporte(String IdOperacion) { SqlDataAdapter adapter; DataSet ds = new DataSet(); String archivo = ""; DataTable dtVoucher = new DataTable(); DataSet dsVoucher = new DataSet(); String emailenviavoucher = ""; dtVoucher.Columns.Add("IdOperacion"); dtVoucher.Columns.Add("FechaEmision"); dtVoucher.Columns.Add("NroVoucher"); dtVoucher.Columns.Add("Pasajero_Nombre"); dtVoucher.Columns.Add("Pasajero_Apellido"); dtVoucher.Columns.Add("Pasajero_Documento"); dtVoucher.Columns.Add("Pasajero_FechaNac"); dtVoucher.Columns.Add("Pasajero_TipoTelefono"); dtVoucher.Columns.Add("Pasajero_Telefono"); dtVoucher.Columns.Add("Pasajero_Celular"); dtVoucher.Columns.Add("Pasajero_Email"); dtVoucher.Columns.Add("ContactoEmergencia_Apellido"); dtVoucher.Columns.Add("ContactoEmergencia_Nombre"); dtVoucher.Columns.Add("ContactoEmergencia_Email"); dtVoucher.Columns.Add("ProductoDescripcion"); dtVoucher.Columns.Add("OrigenDescripcion"); dtVoucher.Columns.Add("DestinoDescripcion"); dtVoucher.Columns.Add("FechaPartida"); dtVoucher.Columns.Add("FechaRegreso"); dtVoucher.Columns.Add("ImporteTarifaPesos"); dtVoucher.Columns.Add("ImporteTarifaDolar"); dtVoucher.Columns.Add("IdCobertura"); dtVoucher.Columns.Add("DescripcionCobertura"); dtVoucher.Columns.Add("ValorCobertura"); dtVoucher.Columns.Add("MonedaDescripcion"); dtVoucher.Columns.Add("SimboloMoneda"); dtVoucher.Columns.Add("IdCobertura2"); dtVoucher.Columns.Add("DescripcionCobertura2"); dtVoucher.Columns.Add("ValorCobertura2"); dtVoucher.Columns.Add("MonedaDescripcion2"); dtVoucher.Columns.Add("SimboloMoneda2"); dtVoucher.Columns.Add("EmailEnviaVoucher"); try { System.Data.SqlClient.SqlConnection conn; conn = new System.Data.SqlClient.SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString; conn.Open(); SqlCommand command = new SqlCommand("spselImprimeVoucher", conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("Id_Operacion", Convert.ToInt32(IdOperacion)); command.ExecuteNonQuery(); adapter = new SqlDataAdapter(command); adapter.Fill(ds); conn.Close(); ds.Dispose(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow row = dtVoucher.NewRow(); row["IdOperacion"] = ds.Tables[0].Rows[i]["IdOperacion"].ToString(); row["FechaEmision"] = ds.Tables[0].Rows[i]["FechaEmision"].ToString(); ; row["NroVoucher"] = ds.Tables[0].Rows[i]["NroVoucher"].ToString(); row["Pasajero_Nombre"] = ds.Tables[0].Rows[i]["Pasajero_Nombre"].ToString(); row["Pasajero_Apellido"] = ds.Tables[0].Rows[i]["Pasajero_Apellido"].ToString(); row["Pasajero_Documento"] = ds.Tables[0].Rows[i]["Pasajero_Documento"].ToString(); row["Pasajero_FechaNac"] = ds.Tables[0].Rows[i]["Pasajero_FechaNac"].ToString(); row["Pasajero_TipoTelefono"] = ds.Tables[0].Rows[i]["Pasajero_TipoTelefono"].ToString(); row["Pasajero_Telefono"] = ds.Tables[0].Rows[i]["Pasajero_Telefono"].ToString(); row["Pasajero_Celular"] = ds.Tables[0].Rows[i]["Pasajero_Celular"].ToString(); row["Pasajero_Email"] = ds.Tables[0].Rows[i]["Pasajero_Email"].ToString(); row["ContactoEmergencia_Apellido"] = ds.Tables[0].Rows[i]["ContactoEmergencia_Apellido"].ToString(); row["ContactoEmergencia_Nombre"] = ds.Tables[0].Rows[i]["ContactoEmergencia_Nombre"].ToString(); row["ContactoEmergencia_Email"] = ds.Tables[0].Rows[i]["ContactoEmergencia_Email"].ToString(); row["ProductoDescripcion"] = ds.Tables[0].Rows[i]["ProductoDescripcion"].ToString(); row["OrigenDescripcion"] = ds.Tables[0].Rows[i]["OrigenDescripcion"].ToString(); row["DestinoDescripcion"] = ds.Tables[0].Rows[i]["DestinoDescripcion"].ToString(); row["FechaPartida"] = ds.Tables[0].Rows[i]["FechaPartida"].ToString(); row["FechaRegreso"] = ds.Tables[0].Rows[i]["FechaRegreso"].ToString(); row["ImporteTarifaPesos"] = ds.Tables[0].Rows[i]["ImporteTarifaPesos"].ToString(); row["ImporteTarifaDolar"] = ds.Tables[0].Rows[i]["ImporteTarifaDolar"].ToString(); row["IdCobertura"] = ds.Tables[0].Rows[i]["IdCobertura"].ToString(); row["DescripcionCobertura"] = ds.Tables[0].Rows[i]["DescripcionCobertura"].ToString(); row["ValorCobertura"] = ds.Tables[0].Rows[i]["ValorCobertura"].ToString(); row["MonedaDescripcion"] = ds.Tables[0].Rows[i]["MonedaDescripcion"].ToString(); row["SimboloMoneda"] = ds.Tables[0].Rows[i]["SimboloMoneda"].ToString(); row["IdCobertura2"] = ds.Tables[0].Rows[i]["IdCobertura2"].ToString(); row["DescripcionCobertura2"] = ds.Tables[0].Rows[i]["DescripcionCobertura2"].ToString(); row["ValorCobertura2"] = ds.Tables[0].Rows[i]["ValorCobertura2"].ToString(); row["MonedaDescripcion2"] = ds.Tables[0].Rows[i]["MonedaDescripcion2"].ToString(); row["SimboloMoneda2"] = ds.Tables[0].Rows[i]["SimboloMoneda2"].ToString(); row["EmailEnviaVoucher"] = ds.Tables[0].Rows[i]["EmailEnviaVoucher"].ToString(); emailenviavoucher = ds.Tables[0].Rows[i]["EmailEnviaVoucher"].ToString(); dtVoucher.Rows.Add(row); } ds.Dispose(); dsVoucher.Tables.Add(dtVoucher); ReportDocument reporte = new ReportDocument(); // creating object of crystal report reporte.Load(Server.MapPath("~/Reportes/pagoconfirmado.rpt")); // path of report reporte.SetDataSource(dsVoucher.Tables[0]); dsVoucher.Dispose(); DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions(); reporte.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; reporte.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; archivo = "C:/Data/Tusegurodeviaje/Reports/TempReports/pagoconfirmado_" + IdOperacion + ".pdf"; diskOpts.DiskFileName = archivo; reporte.ExportOptions.DestinationOptions = diskOpts; reporte.Export(); //CrystalReportViewer1.ReportSource = reporte; //reporte.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "pagoconfirmado" + IdOperacion); enviaemail(archivo, emailenviavoucher); } catch (Exception ex) { Response.Write(ex.Message); } finally { } }
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { FilePath = saveFileDialog1.FileName; ExportOptions eo = new ExportOptions(); eo.ExportDestinationType = ExportDestinationType.DiskFile; string Extension = Path.GetExtension(FilePath); switch (Extension.ToUpper().Trim()) { case ".DOC": eo.ExportFormatType = ExportFormatType.WordForWindows; break; case ".DOCX": eo.ExportFormatType = ExportFormatType.WordForWindows; break; case ".XLS": eo.ExportFormatType = ExportFormatType.Excel; break; case ".XLSX": eo.ExportFormatType = ExportFormatType.Excel; break; case ".PDF": eo.ExportFormatType = ExportFormatType.PortableDocFormat; break; default: eo.ExportFormatType = ExportFormatType.WordForWindows; break; } DiskFileDestinationOptions DestOption = new DiskFileDestinationOptions(); DestOption.DiskFileName = FilePath; eo.ExportDestinationOptions = DestOption; ma_nv = oThongTinCNVC.txt_MaNV.Text; oCNVC.MaNV = oCNVC_CMND_HoChieu.MaNV = oCNVC_ThongTinPhu.MaNV = oCNVC_ThongTinTuyenDung.MaNV = oCNVC_ChinhTri.MaNV = oCNVC_ChinhTriExt.Ma_NV = oCNVC_ChuyenMonTongQuat.MaNV = oCNVC_DienBienSK.MaNV = oCNVC_DaoTaoBoiDuong.MaNV = oCNVC_QTr_CongTac_OU.MaNV = oCNVC_LSBiBat.MaNV = oCNVC_QHGiaDinh.MaNV = oCNVC_QuanHeToChuc.MaNV = ma_nv; Init_Table_CNVC_QTr_CongTac_OU_ChinhTri_ChucVu(); Prepare_ThongTinAll(); DataTable dt_ThongTinTuyenDung = oCNVC_ThongTinTuyenDung.GetData(); Reports.NV_BoNoiVu rpt = new Reports.NV_BoNoiVu(); rpt.Database.Tables["ThongTinChinh"].SetDataSource(dt_ThongTinChinh); rpt.Database.Tables["CMND_HoChieu"].SetDataSource(dt_CMND); rpt.Database.Tables["ThongTinPhu"].SetDataSource(dt_ThongTinPhu); rpt.Database.Tables["ThongTinTuyenDung"].SetDataSource(dt_ThongTinTuyenDung); rpt.Database.Tables["ChucDanh_ChucVu"].SetDataSource(dt_ChucDanh_ChucVu); rpt.Database.Tables["ThongTinLuong"].SetDataSource(dt_ThongTinLuong); rpt.Database.Tables["ChuyenMonTongQuat"].SetDataSource(dt_ChuyenMonTongQuat); rpt.Database.Tables["ChinhTri"].SetDataSource(dt_ChinhTri); rpt.Database.Tables["ChinhTriExt"].SetDataSource(dt_ChinhTriExt); rpt.Database.Tables["ChinhTri_HCCB"].SetDataSource(dt_Chinh_Tri_HCCB); rpt.Database.Tables["SucKhoe"].SetDataSource(dt_SucKhoe); rpt.Database.Tables["DaoTaoBoiDuong"].SetDataSource(dt_DaoTaoBoiDuong); rpt.Database.Tables["QtrCtac_ChucVuChinhTri"].SetDataSource(dt_CNVC_QTr_CongTac_OU_ChinhTri_ChucVu); rpt.Database.Tables["QHGiaDinh"].SetDataSource(dt_CNVC_QHGiaDinh_nuoc_ngoai); rpt.Database.Tables["QuanHeToChuc"].SetDataSource(dt_CNVC_QuanHeToChuc); rpt.Database.Tables["tb_LSBiBat"].SetDataSource(dt_CNVC_LSBiBat); rpt.Database.Tables["QHGiaDinh_BanThan"].SetDataSource(dt_CNVC_QHGiaDinh_BanThan); rpt.Database.Tables["QHGiaDinh_VoHoacChong"].SetDataSource(dt_CNVC_QHGiaDinh_VoHoacChong); rpt.Database.Tables["DienBienLuong"].SetDataSource(dt_DienBienLuong); rpt.Export(eo); MessageBox.Show("Xuất báo cáo hoàn tất", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { MessageBox.Show("Xuất báo cáo không thành công, xin vui lòng thử lại sau", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); bw.ReportProgress(100); } }
private void btProcess_Click(object sender, EventArgs e) { try { if (rbMBPHT08.Checked) { string sql = "", err = ""; DataTable dtReport = new DataTable(); string from_dt = dpFromDate.Text; string to_dt = dpToDate.Text; #region SQL_PHT08 sql += " select h.branch_code,h.branch_name,nvl(sum(h.SoLuongThe),0) SoLuongThe "; sql += " from ( "; sql += " Select trim(cp.branch_receive_card ) branch_code "; sql += " ,(select b.code ||'- '|| b.name from " + Businessbp.executedb.owner + "branch b "; sql += " where trim(b.code)=trim(cp.branch_receive_card) and b.amnd_state='A' "; sql += " ) branch_name "; sql += " ,count(c.contract_number) as SoLuongThe "; sql += " from " + Businessbp.executedb.owner + "acnt_contract c"; sql += " ,nab_cp_card_prepaid cp,"; sql += " nab_product sp "; sql += " where c.add_info_01 = cp.source_application_no "; sql += " and c.amnd_state = 'A'"; sql += " and c.con_cat = 'C' "; sql += " and c.contr_status = '267'"; sql += " and trunc(c.date_open) >= trunc(to_date('" + from_dt + "','dd/mm/yyyy')) "; sql += " and trunc(c.date_open) <= trunc(to_date('" + to_dt + "','dd/mm/yyyy')) "; sql += " and sp.product_code <> '333' "; sql += " and c.product = sp.product_code "; sql += " and sp.type in ('D','P') "; if (cb_branch.SelectedValue.ToString().Trim() != "888") sql += " and trim(cp.branch_receive_card) ='" + cb_branch.SelectedValue.ToString().Trim() + "' "; sql += " group by cp.branch_receive_card "; sql += " union all "; sql += " Select trim(cd.branch_receive_card) branch_code, "; sql += " (select b.code ||'- '|| b.name from " + Businessbp.executedb.owner + "branch b "; sql += " where trim(b.code)=trim(cd.branch_receive_card) and b.amnd_state='A') branch_name "; sql += " ,count(c.contracT_number) as SoLuongThe "; sql += " from " + Businessbp.executedb.owner + "acnt_contract c,nab_cp_card cd, nab_product sp2"; sql += " where c.add_info_01 = cd.source_application_no "; sql += " and c.amnd_state = 'A'"; sql += " and c.con_cat = 'C' "; sql += " and c.contr_status = '267'"; sql += " and trunc(c.date_open) >= trunc(to_date('" + from_dt + "','dd/mm/yyyy')) "; sql += " and trunc(c.date_open) <= trunc(to_date('" + to_dt + "','dd/mm/yyyy')) "; sql += " and sp2.product_code <> '333' "; sql += " and c.product = sp2.product_code "; sql += " and sp2.type in ('C') "; if (cb_branch.SelectedValue.ToString().Trim() != "888") sql += " and trim(cd.branch_receive_card) ='" + cb_branch.SelectedValue.ToString().Trim() + "' "; sql += " group by cd.branch_receive_card "; sql += " )h "; sql += " group by h.branch_code,h.branch_name "; #endregion SQL_PHT08 this.Cursor = Cursors.WaitCursor; string type = "MB_PHT08"; if (sql != "") { dtReport = Businessbp.executedb.getTable(sql, ref err); if (err != "") { MessageBox.Show(err); this.Cursor = Cursors.Default; return; } else { string folderOut = tbFilePath.Text.Trim() + "" + type + "\\"; ; //Tao thu muc if (!Directory.Exists(folderOut)) { Directory.CreateDirectory(folderOut); } //Export pdf #region Export try { if (dtReport.Rows.Count > 0) { for (int i = 0; i < dtReport.Rows.Count; i++) { string branch = dtReport.Rows[i]["branch_code"].ToString().Trim(); string Branch_name = dtReport.Rows[i]["branch_name"].ToString().Trim(); string file_path = folderOut.Trim() + branch.Trim() + "_" + type + "_" + dpFromDate.Text.Trim().Replace("/", "") + "_" + dpToDate.Text.Trim().Replace("/", "") + ".doc"; ConvertNumToStr objConvert = new ConvertNumToStr(); string SoLuongThe_Chu = ""; string SoLuongThe_Nbr = dtReport.Rows[i]["SoLuongThe"].ToString().Trim(); SoLuongThe_Chu = objConvert.converNumToString(objConvert.slipArray(SoLuongThe_Nbr)); string Date_Send = " ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year; string From_To_Date = dpFromDate.Text + " - " + dpToDate.Text; Rpt_MH_PHT08_GiaoNhanThePin cry = new Rpt_MH_PHT08_GiaoNhanThePin(); // cry.SetDataSource(dtReport); // string title = ""; cry.SetParameterValue("Branch", Branch_name); cry.SetParameterValue("Date_Send", Date_Send); cry.SetParameterValue("SoLuongThe_Nbr", SoLuongThe_Nbr); cry.SetParameterValue("SoLuongThe_Chu", SoLuongThe_Chu + " Thẻ"); cry.SetParameterValue("SoLuongPin_Nbr", SoLuongThe_Nbr); cry.SetParameterValue("SoLuongPin_Chu", SoLuongThe_Chu + " PIN"); cry.SetParameterValue("From_To_Date", From_To_Date); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; //CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.ExportFormatType = ExportFormatType.WordForWindows; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export(); //--Fix for Load Report failse if (cry != null) { cry.Close(); cry.Dispose(); } } } else { // MessageBox.Show("");//+ card_number.Trim()); } } catch (Exception ex) { MessageBox.Show(ex.Message); this.Cursor = Cursors.Default; } #endregion Export } }//End for branch this.Cursor = Cursors.Default; tbStatus.Text += "-- Success:" + dtReport.Rows.Count; } else //MB-PHT06 { this.Cursor = Cursors.WaitCursor; string branch_code = cb_branch.SelectedValue.ToString().Trim(); try { process_MB_PHT06(cb_branch.SelectedValue.ToString().Trim()); tbStatus.Text = "DONE!!!"; } catch (Exception ex) { MessageBox.Show("Err btn_Process_Click: " + ex.ToString()); } this.Cursor = Cursors.Default; } } catch { } }
private void ExportPDF() { try { lblInfo.Text = "Gerando arquivo pdf para anexo"; DirectoryInfo dinfo = new DirectoryInfo(Server.MapPath("Pedidos")); if (!dinfo.Exists) { dinfo.Create(); } if (File.Exists(Server.MapPath("Pedidos\\" + sCodigoPedido + ".pdf"))) { File.Delete(Server.MapPath("Pedidos\\" + sCodigoPedido + ".pdf")); } CarregaDataTableParaImpressao(); ReportDocument rpt = new ReportDocument(); dsPedido TabelaImpressao = (dsPedido)Session["PedidoRes"]; rpt.Load(Server.MapPath("rptPedido.rpt")); rpt.SetDataSource(TabelaImpressao); CrystalDecisions.Web.CrystalReportViewer cryView = new CrystalDecisions.Web.CrystalReportViewer(); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = Server.MapPath("Pedidos\\" + sCodigoPedido + ".pdf"); CrExportOptions = rpt.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } rpt.Export(); lblInfo.Text = "Exportando arquivo para o servidor"; } catch (Exception ex) { throw ex; //lblInfo.Text = ex.Message + (ex.InnerException != null ? ex.InnerException.Message : ""); } }
private void Print() { // Border control if (!ShowTitle && !ShowToolBar && !ShowCriteria) { trTopReport.Visible = false; trBottomReport.Visible = false; tdLeftReport.Visible = false; tdRightReport.Visible = false; } // Generate report if (_generateMethod == null) { throw new Exception("Generate method is not defined"); } _generateMethod(); // Configure & export report if (_data.Tables[_table].Rows.Count > 0) { // ... Path & file name string physicalApplicationPath = Request.PhysicalApplicationPath; if (Request.PhysicalApplicationPath.Substring(Request.PhysicalApplicationPath.Length - 1, 1) != "\\") { physicalApplicationPath += "\\"; } string fileName = ""; switch (hdfFormat.Value) { case "pdf": fileName = physicalApplicationPath + "export\\" + Guid.NewGuid().ToString() + ".pdf"; break; case "excel": fileName = physicalApplicationPath + "export\\" + Guid.NewGuid().ToString() + ".xls"; break; } DiskFileDestinationOptions diskOptions = new DiskFileDestinationOptions(); diskOptions.DiskFileName = fileName; // ... Export options _report.ExportOptions.DestinationOptions = diskOptions; _report.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; switch (hdfFormat.Value) { case "pdf": _report.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; break; case "excel": ExcelFormatOptions excelOptions = new ExcelFormatOptions(); excelOptions.ExcelUseConstantColumnWidth = false; excelOptions.ExcelTabHasColumnHeadings = false; _report.ExportOptions.ExportFormatType = ExportFormatType.Excel; _report.ExportOptions.FormatOptions = excelOptions; break; } // ... Export report try { _report.Export(); } catch (Exception ex) { Response.Redirect("./../../error_page.aspx?error=" + ex.Message); } // ... Preview report //title = title.Replace("'", "''"); Title = Title.Replace("'", "%27"); this.ReportFrame = string.Format("./../../new_viewer3.aspx?file_name={0}&report_name={1}&report_format={2}", fileName, Title, hdfFormat.Value); } else { this.ReportFrame = "./../../new_viewer2.aspx"; // ... Store state hdfFormat.Value = "empty"; } }
private void button1_Click(object sender, EventArgs e) { if (dataGridView1.DataSource != null) { if (dataGridView1.RowCount > 0) { for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++) { try { if (dataGridView1.Columns[0] is DataGridViewCheckBoxColumn) { if (((bool)dataGridView1[0, i].Value).ToString().ToUpper() == "true".ToUpper()) { //string ref_no = dataGridView1["So_GD", i].Value.ToString(); //string type = dataGridView1["TYPE", i].Value.ToString(); //string batch_id = dataGridView1["batch_id", i].Value.ToString(); try {//xác định vị trí của row string ref_no = dataGridView1["ref_no", i].Value.ToString(); // string ref_no = dataGridView1["So_GD", i].Value.ToString(); string type = dataGridView1["TYPE", i].Value.ToString(); string batch_id = dataGridView1["batch_id", i].Value.ToString(); string sql = "", err = ""; if (type.Trim().ToUpper() == "PREPAID CARD") { sql = " select c.branch_name,'0300872315' as Ma_So_thue,substr(a.message_receive,9,16) as so_gd, nvl(a.type,'1') as Loai_gd"; if (Frm_main.admin_flag) { sql += " ,to_char(a.date_modify,'dd/mm/yyyy') as ngay_gd,e.client_code,d.card_number,a.embossed_name"; } else { sql += " ,to_char(a.date_modify,'dd/mm/yyyy') as ngay_gd,e.client_code,decode(d.card_number,null,d.card_number,substr(d.card_number,1,4)||'xxxxxxxx'||substr(d.card_number,-4)) card_number,a.embossed_name"; } sql += " ,upper(d.address1 || d.address2||d.address3||d.address4) as Dia_chi"; sql += " ,e.legal_id,a.decription as dien_giai,'' as sotien_bang_Chu"; sql += " from " + Businessbp.executedb.owner + "nab_balance_prepaid_realtime a," + Businessbp.executedb.owner + "app_users b," + Businessbp.executedb.owner + "branch c," + Businessbp.executedb.owner + "card d," + Businessbp.executedb.owner + "client e"; sql += " where a.card_number=d.card_number"; sql += " and trim(a.user_create)=trim(b.userid)"; sql += " and b.appid='" + Businessbp.executedb.APPID + "'"; sql += " and trim(b.branch)=trim(c.branch_code)"; sql += " and c.bank_code='970428'"; sql += " and d.client_code=e.client_code"; sql += " and nvl(a.authorize,'N')='Y'"; sql += " and a.batch_id='" + batch_id + "'"; sql += " and a.ref_no='" + ref_no + "'"; if (tbUser.Text.Trim() == "") sql += " and b.userid='" + Businessbp.executedb.Usrid + "'"; else sql += " and b.userid='" + tbUser.Text.Trim() + "'"; sql += " union all "; sql += " select c.branch_name,'0300872315' as Ma_So_thue,substr(a.message_receive,9,16) as so_gd, nvl(a.type,'1') as Loai_gd"; if (Frm_main.admin_flag) { sql += " ,to_char(a.date_modify,'dd/mm/yyyy') as ngay_gd,e.client_code,d.card_number,a.embossed_name"; } else { sql += " ,to_char(a.date_modify,'dd/mm/yyyy') as ngay_gd,e.client_code,decode(d.card_number,null,d.card_number,substr(d.card_number,1,4)||'xxxxxxxx'||substr(d.card_number,-4)) card_number,a.embossed_name"; } sql += " ,upper(d.address1 || d.address2||d.address3||d.address4) as Dia_chi"; sql += " ,e.legal_id,a.decription as dien_giai,'' as sotien_bang_Chu"; sql += " from " + Businessbp.executedb.owner + "nab_balance_prepaid a," + Businessbp.executedb.owner + "app_users b," + Businessbp.executedb.owner + "branch c," + Businessbp.executedb.owner + "card d," + Businessbp.executedb.owner + "client e"; sql += " where a.card_number=d.card_number"; sql += " and trim(a.user_create)=trim(b.userid)"; sql += " and b.appid='" + Businessbp.executedb.APPID + "'"; sql += " and trim(b.branch)=trim(c.branch_code)"; sql += " and c.bank_code='970428'"; sql += " and d.client_code=e.client_code"; sql += " and nvl(a.authorize,'N')='Y'"; sql += " and a.batch_id='" + batch_id + "'"; sql += " and a.ref_no='" + ref_no + "'"; if (tbUser.Text.Trim() == "") sql += " and b.userid='" + Businessbp.executedb.Usrid + "'"; else sql += " and b.userid='" + tbUser.Text.Trim() + "'"; // sql += " and b.userid='" + Businessbp.executedb.Usrid + "'"; } else { sql = " select c.branch_name,'0300872315' as Ma_So_thue,substr(a.message_receive,9,16) as so_gd, nvl(a.type,'1') as Loai_gd"; if (Frm_main.admin_flag) { sql += " ,to_char(a.date_modify,'dd/mm/yyyy') as ngay_gd,e.client_code,d.card_number,a.embossed_name"; } else { sql += " ,to_char(a.date_modify,'dd/mm/yyyy') as ngay_gd,e.client_code,decode(d.card_number,null,d.card_number,substr(d.card_number,1,4)||'xxxxxxxx'||substr(d.card_number,-4)) card_number,a.embossed_name"; } sql += " ,upper(d.address1 || d.address2||d.address3||d.address4) as Dia_chi"; sql += " ,e.legal_id,a.decription as dien_giai,'' as sotien_bang_Chu"; sql += " from " + Businessbp.executedb.owner + "nab_balance_credit a," + Businessbp.executedb.owner + "app_users b," + Businessbp.executedb.owner + "branch c," + Businessbp.executedb.owner + "card d," + Businessbp.executedb.owner + "client e"; sql += " where a.card_number=d.card_number"; sql += " and trim(a.user_create)=trim(b.userid)"; sql += " and b.appid='" + Businessbp.executedb.APPID + "'"; sql += " and trim(b.branch)=trim(c.branch_code)"; sql += " and c.bank_code='970428'"; sql += " and d.client_code=e.client_code"; sql += " and nvl(a.authorize,'N')='Y'"; sql += " and a.batch_id='" + batch_id + "'"; sql += " and a.ref_no='" + ref_no + "'"; } DataTable dtCheckAuthorize = Businessbp.executedb.getTable(sql, ref err); if (err != "") { MessageBox.Show(err); } else { if (dtCheckAuthorize.Rows.Count <= 0) { MessageBox.Show("No data found!!!"); //executedb.WriteLogERROR(Session["Username"].ToString(), "IP: " + Request.UserHostAddress, this.Page.ToString(), System.Reflection.MethodBase.GetCurrentMethod().ToString(), "No data found!!!: ref_no=" + e.Item.Cells[9].Text); //Alert.Show("No data found!!!", this); //return; } else { if (dtCheckAuthorize.Rows.Count > 0) { //Lấy thông tin tài khoản // Session["sql1"] = sql; string trn_ref_no = dtCheckAuthorize.Rows[0]["so_gd"].ToString(); sql = ""; err = ""; sql = ""; sql += " select '' as ref_no,'' as Don_vi,'' as Ma_so_thue,c.TRN_REF_NO,'' as ngay_gd,'' as CIF"; sql += " ,'' TK_Tham_chieu,'' ho_tenKH,'' address_KH,'' CMND,'' ngay_cap,'' noi_cap"; sql += " ,to_char(c.AC_ENTRY_SR_NO) as So_but_toan"; sql += " ,decode(c.DRCR_IND,'D','N','C') as no_co"; // sql += " ,to_char(c.AC_BRANCH) as Ma_CN"; if (Frm_main.admin_flag) { sql += " ,to_char(c.AC_BRANCH) as Ma_CN,to_char(c.AC_NO) as So_Tai_khoan"; } else { sql += " ,to_char(c.AC_BRANCH) as Ma_CN,decode(c.AC_NO,null,c.AC_NO,substr(c.AC_NO,1,4)||'xxxxxxxx'||substr(c.AC_NO,-4)) as So_Tai_khoan"; } sql += " ,nvl((select gl_desc from gltm_glmaster@Flexcube where gl_code = c.ac_no)"; sql += " ,(select sca.ac_desc"; sql += " from sttm_cust_account@Flexcube sca"; sql += " where sca.cust_ac_no = c.ac_no)) as Ten_tai_khoan"; sql += " ,ltrim(to_char(nvl(c.LCY_AMOUNT,0), '999,999,999,999'))||' VND' as so_tien"; sql += " ,'' as so_tien_bang_chu,'' dien_giai,'' as User_create,'' as user_authorize,'' as Ghi_chu"; sql += " from acvw_all_ac_entries@Flexcube c"; sql += " where c.TRN_REF_NO='" + trn_ref_no + "'"; sql += " and substr(c.ac_no, 1, 4) not in ('4711', '4712') "; sql += " and substr(c.ac_no, 1, 6) not in ('519101','519201')"; sql += " and c.event not in ('CYPO', 'RPOS')"; ////Lấy thông tin giao dịch string folderOut = "D:\\KTT\\SOGIAODICH\\".Trim(); string card_number = dtCheckAuthorize.Rows[0]["card_number"].ToString(); string file_path = folderOut + "\\" +card_number+ "-" + trn_ref_no.Trim() + ".pdf"; if (!Directory.Exists(folderOut)) { Directory.CreateDirectory(folderOut); } string typerp = ""; string title = ""; if (dtCheckAuthorize.Rows[0]["Loai_gd"].ToString() == "1") title = "PHIẾU NỘP TIỀN MẶT"; else title = "PHIẾU CHUYỂN KHOẢN"; string fromtime = dpFromDate.Text; string totime = dpToDate.Text; string Donvi = ""; string MaSoThue = ""; string NgayGD = ""; string MaKH = ""; string TaiKhoanThamChieu = ""; string HoTenKH = ""; string DiaChi = ""; string CMND = ""; string NgayCap = ""; string NoiCap = ""; string MaSoThueKH = ""; string DienGiai = ""; string SoTienBangChu = ""; if (dtCheckAuthorize.Rows.Count <= 0) { MessageBox.Show("No data found!!"); return; } else { Donvi = dtCheckAuthorize.Rows[0]["branch_name"].ToString(); MaSoThue = dtCheckAuthorize.Rows[0]["Ma_So_thue"].ToString(); NgayGD = dtCheckAuthorize.Rows[0]["ngay_gd"].ToString(); MaKH = dtCheckAuthorize.Rows[0]["client_code"].ToString(); TaiKhoanThamChieu = dtCheckAuthorize.Rows[0]["card_number"].ToString(); HoTenKH = dtCheckAuthorize.Rows[0]["embossed_name"].ToString(); DiaChi = dtCheckAuthorize.Rows[0]["Dia_chi"].ToString(); CMND = dtCheckAuthorize.Rows[0]["legal_id"].ToString(); NgayCap = ""; NoiCap = ""; MaSoThueKH = ""; DienGiai = dtCheckAuthorize.Rows[0]["dien_giai"].ToString(); SoTienBangChu = dtCheckAuthorize.Rows[0]["sotien_bang_Chu"].ToString(); } //Session["sql"] = sql; //if (dtCheckAuthorize.Rows[0]["Loai_gd"].ToString() == "1") // Session["title"] = "PHIẾU NỘP TIỀN MẶT"; //else // Session["title"] = "PHIẾU CHUYỂN KHOẢN"; //Session["type"] = "PHIEUHT"; //Session["fromtime"] = dpFromDate.Text; //Session["totime"] = dpToDate.Text; //Response.Write("<script type='text/javascript'>window.open('Reportview_HachToan.aspx','window_name','scrollbars=yes,menubar=no,height=700,width=785,resizable=yes,toolbar=no,location=no,status=no,fullscreen=no,titlebar=no,directories=no');</script>"); // DataTable dt = new DataTable(); DataTable dt = Businessbp.executedb.getTable(sql, ref err); if (err != "") { MessageBox.Show(err); //return; } for (int j = 0; j < dt.Rows.Count; j++) { if (dt.Rows[j]["So_Tai_khoan"].ToString().Trim() == Businessbp.executedb.TKTienmat) { dt.Rows[j]["Ten_tai_khoan"] = "Tien mat tai don vi"; } else if (dt.Rows[j]["So_Tai_khoan"].ToString().Trim() == Businessbp.executedb.DomesticPrepaid) { dt.Rows[j]["Ten_tai_khoan"] = "TIEN GUI DE BAO DAM THANH TOAN THE NOI DIA-PREPAID"; } else if (dt.Rows[j]["So_Tai_khoan"].ToString().Trim() == Businessbp.executedb.InternalPrepaid) { dt.Rows[j]["Ten_tai_khoan"] = "TIEN GUI DE BAO DAM THANH TOAN THE QUOC TE-PRREPAID"; } else if (dt.Rows[j]["So_Tai_khoan"].ToString().Trim() == Businessbp.executedb.DomesticCredit) { dt.Rows[j]["Ten_tai_khoan"] = "TIEN GUI DE BAO DAM THANH TOAN THE NOI DIA-CREDIT"; } else if (dt.Rows[j]["So_Tai_khoan"].ToString().Trim() == Businessbp.executedb.InternalCredit) { dt.Rows[j]["Ten_tai_khoan"] = "TIEN GUI DE BAO DAM THANH TOAN THE QUOC TE-CREDIT"; } else if (dt.Rows[j]["So_Tai_khoan"].ToString().Trim() == Businessbp.executedb.TK_TamTreoNapTien) { dt.Rows[j]["Ten_tai_khoan"] = "PHAI TRA TRONG NV NAP TIEN THE PREPAID,CREDIT"; } } //Export Rpt_Cash_Deposit cry = new Rpt_Cash_Deposit(); cry.SetDataSource(dt); cry.SetParameterValue("Title", title); cry.SetParameterValue("Donvi", Donvi); cry.SetParameterValue("MaSoThue", MaSoThue); cry.SetParameterValue("NgayGD", NgayGD); cry.SetParameterValue("MaKH", MaKH); cry.SetParameterValue("TaiKhoanThamChieu", TaiKhoanThamChieu); cry.SetParameterValue("HoTenKH", HoTenKH); cry.SetParameterValue("DiaChi", DiaChi); cry.SetParameterValue("CMND", CMND); cry.SetParameterValue("NgayCap", NgayCap); cry.SetParameterValue("NoiCap", NoiCap); cry.SetParameterValue("MaSoThueKH", MaSoThueKH); cry.SetParameterValue("DienGiai", DienGiai); cry.SetParameterValue("SoTienBangChu", SoTienBangChu); // CrystalReportViewer1.ReportSource = rptDoc; // cry.SetDataSource(dt_bill); //string title = ""; // cry.SetParameterValue("title", title); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export(); //--Fix for Load Report failse if (cry != null) { cry.Close(); cry.Dispose(); } } } } } catch (Exception ex) { #region logException //executedb.WriteLogERROR(Session["Username"].ToString(), "IP: " + Request.UserHostAddress, this.Page.ToString(), System.Reflection.MethodBase.GetCurrentMethod().ToString(), ex.Message); ////executedb.WriteLogPri(Environment.NewLine + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + " - " + Session["Username"].ToString() + ": " + ex.Message); ////Response.Write("<script>alert('Error when executing coding')</script>"); //Alert.Show("Error when executing coding!!!", this); #endregion logException } //dt2.Rows.Add("'" + dataGridView1["file_id", i].Value.ToString(), "'" + dataGridView1["settlement_currency", i].Value.ToString() // , "'" + dataGridView1["type", i].Value.ToString(), dataGridView1["billing_amount_electra", i].Value.ToString() // , dataGridView1["billing_amount_flexcube", i].Value.ToString(), dataGridView1["settlement_amount", i].Value.ToString() // , dataGridView1["fee_phai_thu", i].Value.ToString(), dataGridView1["fee_phai_tra", i].Value.ToString() // , action);//.to.Add(dataGridView1.Rows[i]); } } } catch { } } // Frm_ReportAcc.ExportToExcel(dt2, "", title, "Ngày thanh toán " + DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd/MM/yyyy")); } MessageBox.Show("OK!"); } }