This commit is contained in:
Oscar Irigoyen
2022-12-07 21:19:37 -07:00
283 changed files with 167779 additions and 7134 deletions

View File

@@ -5,8 +5,7 @@ Imports System.Data
Imports System.IO
Imports System.Xml
Imports Extensiones
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Imports iText.Kernel.Pdf
Imports Microsoft.Reporting.WebForms
Imports Stimulsoft.Report
Imports Stimulsoft.Report.Web
@@ -185,7 +184,7 @@ Partial Class PopUpVerFactura
End If
If Request("REPORTE") IsNot Nothing Then
CType(Session("DTPDF"), HtmlTable).ExportToPDF("Reporte")
CType(Session("DTPDF"), HtmlTable).GenerarReportePDF("Reporte")
End If
'OPCIONES
@@ -6573,47 +6572,37 @@ Partial Class PopUpVerFactura
Dim PS As String = ""
Dim All As Byte()
Using ms As New MemoryStream
Using d As New Document
Using Copy As New PdfCopy(d, ms)
d.Open()
If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
If ObjInventarios.DtResultados IsNot Nothing Then
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
Dim CvePS As Integer = DetalleRow.Item("CvePS").ToString.ToEntero
Dim Lote As String = DetalleRow.Item("Lote").ToString
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
PS = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString)
If Modalidad = "Individual" Then
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
Using pdfdoc As New PdfDocument(New PdfReader(ms))
pdfdoc.InitializeOutlines()
If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
If ObjInventarios.DtResultados IsNot Nothing Then
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
Dim CvePS As Integer = DetalleRow.Item("CvePS").ToString.ToEntero
Dim Lote As String = DetalleRow.Item("Lote").ToString
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
PS = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString)
If Modalidad = "Individual" Then
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
Dim reader As New PdfReader(reporteByte)
Dim Paginas As Integer = reader.NumberOfPages
Dim Contador As Integer = 0
While Contador < Paginas
Contador += 1
Copy.AddPage(Copy.GetImportedPage(reader, Contador))
End While
Else
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
docEtiqueta.Close()
Else
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
For contador As Integer = 0 To Cant
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
For i As Integer = 0 To Cant
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
Dim reader As New PdfReader(reporteByte)
Dim Paginas As Integer = reader.NumberOfPages
Dim Cont As Integer = 0
While Cont < Paginas
Cont += 1
Copy.AddPage(Copy.GetImportedPage(reader, Cont))
End While
Next
End If
Next
End If
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
docEtiqueta.Close()
Next
End If
Next
End If
d.Close()
End If
pdfdoc.Close()
End Using
End Using
All = ms.ToArray()
End Using
@@ -6633,45 +6622,35 @@ Partial Class PopUpVerFactura
Dim All As Byte()
Using ms As New MemoryStream
Using d As New Document
Using Copy As New PdfCopy(d, ms)
d.Open()
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacen.ToString) Then
If ObjInventarios.DtResultados IsNot Nothing Then
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
Dim Lote As String = DetalleRow.Item("Lote").ToString
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
If Modalidad = "Individual" Then
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
Using pdfdoc As New PdfDocument(New PdfReader(ms))
pdfdoc.InitializeOutlines()
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacen.ToString) Then
If ObjInventarios.DtResultados IsNot Nothing Then
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
Dim Lote As String = DetalleRow.Item("Lote").ToString
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
If Modalidad = "Individual" Then
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
Dim reader As New PdfReader(reporteByte)
Dim Paginas As Integer = reader.NumberOfPages
Dim Contador As Integer = 0
While Contador < Paginas
Contador += 1
Copy.AddPage(Copy.GetImportedPage(reader, Contador))
End While
Else
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
docEtiqueta.Close()
Else
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
For contador As Integer = 0 To Cant
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
For i As Integer = 0 To Cant
Dim reporteByte = New MemoryStream(GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS))
Dim reader As New PdfReader(reporteByte)
Dim Paginas As Integer = reader.NumberOfPages
Dim Cont As Integer = 0
While Cont < Paginas
Cont += 1
Copy.AddPage(Copy.GetImportedPage(reader, Cont))
End While
Next
End If
Next
End If
Dim docEtiqueta As New PdfDocument(New PdfReader(reporteByte))
docEtiqueta.CopyPagesTo(1, docEtiqueta.GetNumberOfPages(), pdfdoc)
docEtiqueta.Close()
Next
End If
Next
End If
d.Close()
End If
pdfdoc.Close()
End Using
End Using
All = ms.ToArray()
End Using