本文整理汇总了C#中ReportDocument.Close方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.Close方法的具体用法?C# ReportDocument.Close怎么用?C# ReportDocument.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportDocument
的用法示例。
在下文中一共展示了ReportDocument.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnImprimir_Click
protected void btnImprimir_Click(object sender, EventArgs e)
{
string Ciclo = this.ddlCiclo.SelectedValue;
int Zona = int.Parse(this.ddlZonas.SelectedValue);
int PlantelID = int.Parse(this.ddlPlanteles.SelectedValue);
byte Turno = byte.Parse(this.ddlTurnos.SelectedValue);
int Estatus = int.Parse(ddlEstatus.SelectedValue);
string NomPlantel = this.ddlPlanteles.SelectedItem.Text;
db = new DBEscolarDataContext();
var res = (from A in db.vwRPTEstadisticaPreInscritos011s
where A.Ciclo == Ciclo && A.Zona == Zona && A.PlantelID == PlantelID && A.Turno == (Turno == 0 ? A.Turno : Turno)
&& A.Estatus == (Estatus == -1 ? A.Estatus : Estatus)
orderby A.Zona, A.Plantel, A.Turno, A.Nombre
select A).ToList();
this.lblMensaje.Visible = res.Count() == 0;
if (res.Count() == 0)
return;
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("../Reportes/rptEstPre01.rpt"));
rptDoc.SetDataSource(res);
rptDoc.SetParameterValue("NomPlantel", NomPlantel);
MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
rptDoc.Close();
rptDoc.Dispose();
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "inline; filename=Alumnos.xls");
Response.BinaryWrite(stream.ToArray());
Response.End();
stream.Close();
stream.Dispose();
}
示例2: GeneratePDF
private void GeneratePDF()
{
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") + ".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);
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
String qs = Request.QueryString.Get("bid");
Response.Write("Query String = " + qs);
SqlConnection sql = new SqlConnection();
sql.ConnectionString = "Data Source=(local);Initial Catalog=Hotel;Integrated Security=True";
sql.Open();
ReportDocument rpd = new ReportDocument();
rpd.Load(Server.MapPath("itcreport.rpt"));
rpd.SetDatabaseLogon("sa", "ak");
rpd.SetParameterValue(0, qs);
CrystalReportViewer1.ReportSource = rpd;
//to convert report in pdf format
MemoryStream ostream = new MemoryStream();
Response.Clear();
Response.Buffer = true;
ostream = (MemoryStream)rpd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
rpd.Close();
rpd.Dispose();
Response.ContentType = "application/pdf";
Response.BinaryWrite(ostream.ToArray());
ostream.Flush();
ostream.Close();
ostream.Dispose();
}
示例4: GeneratePDF
private void GeneratePDF()
{
ReportDocument rpt = new ReportDocument();
switch (cboView.SelectedItem.Value)
{
case "0":
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/ChartOfAccountsDetails.rpt"));
break;
case "1":
rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/ChartOfAccountsSummary.rpt"));
break;
}
ExportOptions exportop = new ExportOptions();
DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
string strPath = Server.MapPath(@"\RetailPlus\temp\");
string strFileName = "chartofacc_" + 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);
}
示例5: GenerateReport
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; }
}
示例6: Imprimir
private void Imprimir(int AlumnoID)
{
DBEscolarDataContext db = new DBEscolarDataContext();
var Pago = (from P in db.vwRPTPagosEncabezados join D in db.vwRPTPagosDetalles on P.PagoID equals D.PagoID
where P.AlumnoID == AlumnoID && P.Ciclo == Utils.CicloActual && (P.Estatus != 0)
&& D.Clave == "A01"
select P).FirstOrDefault();
if (Pago == null)
{
this.lblMensaje.Text = "No se ha encontrado la ficha de pago.<br />Nota: Para poder generar la Ficha de Pago, debes de estar validado.";
return;
}
else if (Pago.Estatus == 3) {
Alumno Alumno = (from A in db.Alumnos
where A.AlumnoID == AlumnoID
select A).FirstOrDefault();
this.lblMensaje.Text = "Felicidades. Tú ficha ha sido pagada y ya te encuentras inscrito con matrícula: " + Alumno.Matricula;
return;
}
var Detalle = (from D in db.vwRPTPagosDetalles
where D.PagoID == Pago.PagoID
select D).ToList();
//Actualiza el estatus del pago a 2:Impreso
db.spEXEPagosCambiaEstatus(AlumnoID, Pago.PagoID, 2, Utils.CicloActual);
ArrayList col = new ArrayList();
col.Add(Pago);
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("Reportes/rptFichaDePago.rpt"));
//set dataset to the report viewer.
rptDoc.SetDataSource(col);
rptDoc.Subreports["Detalle"].SetDataSource(Detalle);
rptDoc.Subreports["Detalle2"].SetDataSource(Detalle);
MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
rptDoc.Close();
rptDoc.Dispose();
Response.Clear();
Response.ContentType = @"Application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=FichaDePago.pdf");
Response.AddHeader("content-length", stream.Length.ToString());
Response.BinaryWrite(stream.ToArray());
Response.Flush();
stream.Close();
stream.Dispose();
}
示例7: ExportEt
//Exporta a Excel el grid
protected void ExportEt(object sender, EventArgs e)
{
string sucursal = cmbSucursal.Value.ToString();
//1. Configurar la conexión y el tipo de comando
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["OSEF"].ConnectionString);
try
{
SqlCommand comando = new SqlCommand("web_spS_ObtenerRItemsAdicionales", conn);
SqlDataAdapter adaptador = new SqlDataAdapter(comando);
DataTable dt = new DataTable();
adaptador.SelectCommand.CommandType = CommandType.StoredProcedure;
adaptador.SelectCommand.Parameters.Add(@"Sucursal", SqlDbType.Char).Value = sucursal;
adaptador.Fill(dt);
ReportDocument reporteCuadrila = new ReportDocument();
reporteCuadrila.Load(Server.MapPath("reportess/ResumenOC.rpt"));
reporteCuadrila.SetDataSource(dt);
reporteCuadrila.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "Resumen de OC: " + sucursal);
reporteCuadrila.Close();
reporteCuadrila.Dispose();
}
catch (Exception ex)
{
ex.Message.ToString();
}
finally
{
if (conn.State != ConnectionState.Closed)
conn.Close();
conn.Dispose();
}
}
示例8: Export
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);
}
}
示例9: Page_UnLoad
//---PhongNT 04/12/2012
public void Page_UnLoad ( object sender, EventArgs e )
{
rptDoc = new ReportDocument ( );
//Fix lỗi report failed
if (rptDoc != null)
{
try
{
this.CrystalReportViewer1.Dispose ( );
this.CrystalReportViewer1 = null;
rptDoc.Close ( );
rptDoc.Dispose ( );
GC.Collect ( );
}
catch
{
this.CrystalReportViewer1 = null;
rptDoc.Close ( );
rptDoc.Dispose ( );
GC.Collect ( );
}
}
}
示例10: GenerarPDF
private void GenerarPDF(bool EsNuevo)
{
try
{
PreInscrito PreInsc = (PreInscrito)Session["PreInsc"];
if (PreInsc == null)//Nunca debe de pasar
return;
DBEscolarDataContext db = new DBEscolarDataContext();
var Alumno = (from A in db.vwRPTPreInscripcions
where A.Folio == PreInsc.Folio
select A).FirstOrDefault();
if (Alumno == null)
return;
System.Collections.ArrayList col = new System.Collections.ArrayList();
col.Add(Alumno);
ReportDocument rptDoc = new ReportDocument();
if (EsNuevo)
rptDoc.Load(Server.MapPath("Reportes/rptPreInscripcion.rpt"));
else rptDoc.Load(Server.MapPath("Reportes/rptPreInscripcion_Re.rpt"));
//set dataset to the report viewer.
rptDoc.SetDataSource(col);
MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
rptDoc.Close();
rptDoc.Dispose();
Response.Clear();
Response.ContentType = @"Application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=File.pdf");
//Response.AddHeader("Content-Disposition", "attachment; filename=File.pdf");
Response.AddHeader("content-length", stream.Length.ToString());
Response.BinaryWrite(stream.ToArray());
Response.Flush();
stream.Close();
stream.Dispose();
}
catch (Exception e) { }
}
示例11: ShowReport
//.........这里部分代码省略.........
strFileName = programID + "_" + HttpUtility.UrlEncode("門市短溢調整匯總表", System.Text.Encoding.UTF8);
break;
case 5:
programID = "CAM04R06";
report.Load(Server.MapPath("./REPORT/CAM04/CAM04R06.rpt"));
strFileName = programID + "_" + HttpUtility.UrlEncode("門市短溢調整明細表_牌價", System.Text.Encoding.UTF8);
break;
case 6:
programID = "CAM04R06";
report.Load(Server.MapPath("./REPORT/CAM04/CAM04R07.rpt"));
strFileName = programID + "_" + HttpUtility.UrlEncode("門市短溢調整明細表_成本", System.Text.Encoding.UTF8);
break;
}
string strGroupS = txtGroupS.Text + Request[((TextBox)txtGroupS.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", "");
string strGroupE = txtGroupE.Text + Request[((TextBox)txtGroupE.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", "");
if (strGroupS == "")
strGroupS = strGroupE;
if (strGroupE == "")
strGroupE = strGroupS;
string strProfitS = txtProfitS.Text.Trim() + Request[((TextBox)txtProfitS.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", "");
string strProfitE = txtProfitE.Text.Trim() + Request[((TextBox)txtProfitE.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", "");
if (strProfitS == "")
strProfitS = strProfitE;
if (strProfitE == "")
strProfitE = strProfitS;
string strStoreS = txtStoreS.Text.Trim() + Request[((TextBox)txtStoreS.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", "");
string strStoreE = txtStoreE.Text.Trim() + Request[((TextBox)txtStoreE.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", "");
if (strStoreS == "")
strStoreS = strStoreE;
if (strStoreE == "")
strStoreE = strStoreS;
report.SetDataSource(dt);
report.SetParameterValue("par_Program_ID", programID);
report.SetParameterValue("par_LoginUser", (Session["UID"].ToString()) + Login_Name);
report.SetParameterValue("par_patchDate", slpDateRangePatch.StartDate +
(string.IsNullOrEmpty(slpDateRangePatch.StartDate) ? "" : "~") + slpDateRangePatch.EndDate);
report.SetParameterValue("par_signDate", txtSignDate.StartDate + "~" + txtSignDate.EndDate);
report.SetParameterValue("par_acDate", txtACDateS.Text + "~" + txtACDateE.Text);
report.SetParameterValue("par_group", strGroupS + (string.IsNullOrEmpty(strGroupE) ? "" : "~") + strGroupE);
report.SetParameterValue("par_acInvNo", txtAcInvNo.Text);
report.SetParameterValue("par_profit", strProfitS + (string.IsNullOrEmpty(strProfitS) ? "" : "~") + strProfitE);
report.SetParameterValue("par_Store", strStoreS + (string.IsNullOrEmpty(strStoreS) ? "" : "~") + strStoreE);
report.SetParameterValue("par_acUID", txtAccID.Text + Request[((TextBox)txtAccID.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", ""));
report.SetParameterValue("par_RootNo", txtRootNo.Text + Request[((TextBox)txtRootNo.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", ""));
report.SetParameterValue("par_item", txtItem.Text + Request[((TextBox)txtItem.FindControl("TextBoxName")).UniqueID].ToString().Replace("查無資料", ""));
report.SetParameterValue("par_period", txtPeriodS.Text +
(string.IsNullOrEmpty(txtPeriodS.Text) ? "" : "~") + txtPeriodE.Text);
report.SetParameterValue("par_checkReason", txtReasonS.Text +
(string.IsNullOrEmpty(txtReasonS.Text) ? "" : "~") + txtReasonE.Text);
report.SetParameterValue("par_descType", txtDescS.Text +
(string.IsNullOrEmpty(txtDescS.Text) ? "" : "~") + txtDescE.Text);
report.SetParameterValue("par_diffTimes", txtDiffTimes.Text);
report.SetParameterValue("par_diffAmount", txtDiffAmount.Text);
report.SetParameterValue("par_diffSource", rblDiffSource.SelectedItem.Text);
Stream stream = null;
byte[] b = null;
switch (format)
{
case "PDF":
stream = report.ExportToStream(ExportFormatType.PortableDocFormat);
b = new byte[stream.Length];
stream.Read(b, 0, b.Length);
stream.Seek(0, SeekOrigin.Begin);
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("content-disposition", "attachment;filename=" + strFileName + ".pdf");
Response.ContentType = "application/pdf";
Response.OutputStream.Write(b, 0, b.Length);
Response.Flush();
Response.Close();
break;
case "EXCEL":
stream = report.ExportToStream(ExportFormatType.Excel);
b = new byte[stream.Length];
stream.Read(b, 0, b.Length);
stream.Seek(0, SeekOrigin.Begin);
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("content-disposition", "attachment;filename=" + strFileName + ".xls");
Response.ContentType = "application/vnd.ms-excel";
Response.OutputStream.Write(b, 0, b.Length);
Response.Flush();
Response.Close();
break;
}
report.Close();
}
示例12: Generar
private void Generar(Conexion Datos, string reporte, Reportes report)
{
reportDocument = new ReportDocument();
string sql = null;
switch (report)
{
case Reportes.Lps:
sql = "usp_lps_reporte ";
sql += IdLpsEmpleado.ToString();
sql += ", " + IdEmpresa;
break;
case Reportes.Acumulados:
sql = "usp_lps_acumulados_porIdEmpleado ";
sql += IdEmpleado.ToString();
break;
}
reportDocument.Load(reporte);
reportDocument.SetDataSource(Datos.ExecuteReaderConTransaccion(sql).Tables[0]);
reportDocument.DataSourceConnections[0].SetConnection("192.168.16.252", "siser_v3", "sa", "Acceso2013");
switch (report)
{
case Reportes.Lps:
Reporte = (MemoryStream)reportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
break;
case Reportes.Acumulados:
Acumulados = (MemoryStream)reportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
break;
}
try
{
reportDocument.Dispose();
reportDocument = null;
reportDocument.Close();
}
catch
{
}
}
示例13: GenerateHTML
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);
}
示例14: PrintPDF
//protected Boolean CheckAccessAble()
//{
// if (m_perimission_array[(int)Authentication.FUN_INTERFACE.wzxqjh_jjd_report][0] == '1') return true;
// return false;
//}
private void PrintPDF()
{
ReportDocument rpt_doc = new ReportDocument();
DataSet ds = new DataSet();
StringBuilder sqlstr = new StringBuilder();
//sqlstr.Append("select a.jjd_no,a.requisition_id req_id,a.rowstate,a.remark,a.package_no,a.part_no,b.part_name part_name,");
//sqlstr.Append("b.part_name_e part_name_e,gen_part_package_api.get_package_name(package_no) package_name,");
//sqlstr.Append("gen_part_package_item_api.get_unit(package_no,part_no) part_unit,gen_part_package_item_api.get_part_spec(package_no,part_no) part_spec,");
//sqlstr.Append("zh_qty,xh_qty,finish_time,rowversion,project_id proj_id from jp_pkg_jjd_line a,jp_pkg_requisition b where a.requisition_id=b.requisition_id");
sqlstr.Append(@"select a.jjd_no,a.requisition_id req_id,a.rowstate,a.remark,a.package_no,a.part_no,
b.part_name part_name, b.part_name_e part_name_e, b.package_name package_name,
b.part_unit part_unit, b.part_spec part_spec, b.released_qty xq_qty,a.zh_qty,
a.xh_qty, a.finish_time, a.rowversion,a.project_id proj_id
from jp_pkg_jjd_line a, jp_pkg_requisition_v b where a.requisition_id = b.requisition_id");
sqlstr.Append(string.Format(" and a.jjd_no ='{0}' order by a.part_no", m_jjd_no));
OleDbConnection conn = new OleDbConnection(DBHelper.OleConnectionString);
OleDbCommand cmd = new OleDbCommand();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
//DeliveryVoucher dvchr = (DeliveryVoucher)Session["delivery_voucher"];
PkgJjd objJjd = new PkgJjd(m_jjd_no);
//sqlstr.Append(" and requisition_id in (");
//for (int i = 0; i < dvchr.DeliveryItems.Count; i++)
//{
// if (i == dvchr.DeliveryItems.Count - 1)
// {
// sqlstr.Append(string.Format("'{0}'", dvchr.DeliveryItems[i].ToString()));
// }
// else
// {
// sqlstr.Append(string.Format("'{0}',", dvchr.DeliveryItems[i].ToString()));
// }
//}
//sqlstr.Append(" )");
cmd.Connection = conn;
cmd.CommandText = sqlstr.ToString();
da.Fill(ds);
rpt_doc.Load(Request.PhysicalApplicationPath + "\\UI\\Report\\CrysPkgJjd.rpt");
rpt_doc.SetDataSource(ds.Tables[0]);
//dvchr.SetDeliveryVoucherNo();
rpt_doc.SetParameterValue("jjd_no", m_jjd_no);
//rpt_doc.SetParameterValue("kuwei", "");
rpt_doc.SetParameterValue("place", objJjd.PlaceName);
rpt_doc.SetParameterValue("receiver", objJjd.ReceiptPerson);
rpt_doc.SetParameterValue("recieve_date", objJjd.ReceiptDate);
rpt_doc.SetParameterValue("receiver_contact", objJjd.ReceiptContract);
rpt_doc.SetParameterValue("ZHd", objJjd.ZhPlace);
rpt_doc.SetParameterValue("ZHr", objJjd.ZhPerson);
rpt_doc.SetParameterValue("ZHdh", objJjd.ZhContract);
rpt_doc.SetParameterValue("ZHArrTime", objJjd.ZhArrTime);
rpt_doc.SetParameterValue("XQbm", objJjd.XQDept);
rpt_doc.SetParameterValue("XQlxr", objJjd.XQPerson);
rpt_doc.SetParameterValue("XQdh", objJjd.XQContract);
rpt_doc.SetParameterValue("CYgs", objJjd.CyCompany);
rpt_doc.SetParameterValue("CYr", objJjd.CyPerson);
rpt_doc.SetParameterValue("CYdh", objJjd.CyContract);
rpt_doc.SetParameterValue("CYpz", objJjd.CycCarNo);
rpt_doc.SetParameterValue("CYjz", objJjd.CyDoc);
rpt_doc.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
rpt_doc.PrintOptions.PaperSize = PaperSize.PaperA4;
using (MemoryStream fp = (MemoryStream)(rpt_doc.ExportToStream(ExportFormatType.PortableDocFormat)))
{
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(fp.ToArray());
fp.Close();
Response.End();
}
rpt_doc.Close();
rpt_doc.Dispose();
}
示例15: GeneratePDF
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);
}