diff --git a/OC/RepSolicitudesAnticipo.aspx b/OC/RepSolicitudesAnticipo.aspx
index 7b3187682..4cfdc6282 100644
--- a/OC/RepSolicitudesAnticipo.aspx
+++ b/OC/RepSolicitudesAnticipo.aspx
@@ -16,6 +16,9 @@
Exporta Excel
+
+ Descargar PDFs
+
@@ -92,7 +95,7 @@
" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
-
diff --git a/OC/RepSolicitudesAnticipo.aspx.cs b/OC/RepSolicitudesAnticipo.aspx.cs
index b8cc189ea..d4c250158 100644
--- a/OC/RepSolicitudesAnticipo.aspx.cs
+++ b/OC/RepSolicitudesAnticipo.aspx.cs
@@ -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();
+ }
}
\ No newline at end of file