impresión masica
This commit is contained in:
@@ -9,7 +9,11 @@ using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using Microsoft.Reporting.WebForms;
|
||||
using static Extensiones.ModExtensiones;
|
||||
|
||||
using iTextSharp;
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using System.IO;
|
||||
using Ionic.Zip;
|
||||
public partial class OC_RepSolicitudesAnticipo : ClsPaginas
|
||||
{
|
||||
#region "Propiedades"
|
||||
@@ -75,7 +79,7 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
|
||||
{
|
||||
DdlProveedor.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa);
|
||||
DdlProveedor.DataBind();
|
||||
DdlProveedor.Items.Insert(0, new ListItem("Todos", "-1"));
|
||||
DdlProveedor.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Todos", "-1"));
|
||||
DdlProveedor.SelectedValue = "-1";
|
||||
}
|
||||
|
||||
@@ -124,6 +128,10 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
|
||||
{
|
||||
GenerarPDF("PDF");
|
||||
}
|
||||
protected void LnkImpresionMasiva_Click(object sender,EventArgs e)
|
||||
{
|
||||
GenerarImpresionMasiva();
|
||||
}
|
||||
|
||||
protected void GenerarPDF(String Opcion)
|
||||
{
|
||||
@@ -161,4 +169,44 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
|
||||
Alert("No hay datos consultados", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerarImpresionMasiva()
|
||||
{
|
||||
|
||||
byte[] all;
|
||||
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
using (Document d = new Document())
|
||||
{
|
||||
using (PdfCopy copy = new PdfCopy(d,ms))
|
||||
{
|
||||
d.Open();
|
||||
foreach (GridViewRow Gvr in GvSolicitudes.Rows)
|
||||
{
|
||||
int CveOC = Gvr.DataKey("CveOrdenCompra").ToEntero();
|
||||
byte[] reporteByte = NewGeneraBytesOC(CveOC);
|
||||
PdfReader reader = new PdfReader(reporteByte);
|
||||
int n = reader.NumberOfPages;
|
||||
int page = 0;
|
||||
while (page < n)
|
||||
{
|
||||
page++;
|
||||
copy.AddPage(copy.GetImportedPage(reader, page));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
all = ms.ToArray();
|
||||
}
|
||||
//ImprimirbytesPDF(all, "RepSolicitudesAnticipo");
|
||||
|
||||
ZipFile zip = new ZipFile();
|
||||
zip.AddEntry("RepSolicitudesAnticipo", all);
|
||||
zip.Save(Response.OutputStream);
|
||||
Response.AddHeader("content-Disposition", "attachment; filename=RepSolicitudesAnticipo.zip");
|
||||
Response.ContentType = "application/zip";
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user