Ferretera. Impresion con copia, facturacion de remision con pago en ventas.aspx
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Ventas_PVCobranza
|
||||
@@ -543,13 +544,13 @@ Partial Class Ventas_PVCobranza
|
||||
Dim ExistePDF As Boolean = False
|
||||
Dim ArchivoPDF As String = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
||||
|
||||
If ObjFactura.TipoDocto = "Rem" AndAlso System.IO.File.Exists(ArchivoPDF) Then
|
||||
If File.Exists(ArchivoPDF) Then
|
||||
ExistePDF = True
|
||||
Else
|
||||
'REGENERAR EL PDF
|
||||
Try
|
||||
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False, EsTicket:=True)
|
||||
If System.IO.File.Exists(ArchivoPDF) Then
|
||||
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False)
|
||||
If File.Exists(ArchivoPDF) Then
|
||||
ExistePDF = True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -558,8 +559,24 @@ Partial Class Ventas_PVCobranza
|
||||
End If
|
||||
|
||||
If ExistePDF Then
|
||||
Dim urlPDF As String = $"/Ashx/SIGDesc.ashx?metodo=descargarPDFVenta&CveVenta={CveVenta}"
|
||||
RegistraScript($"impresionDirecta('{urlPDF}');", "Imprimir")
|
||||
Dim pdf64 As String = ""
|
||||
'DUPLICA EL PDF
|
||||
Using ms As New MemoryStream
|
||||
Using pdfdoc As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfWriter(ms))
|
||||
pdfdoc.InitializeOutlines()
|
||||
Dim reporteByte As New MemoryStream(System.IO.File.ReadAllBytes(ArchivoPDF))
|
||||
|
||||
Dim docPDF As New iText.Kernel.Pdf.PdfDocument(New iText.Kernel.Pdf.PdfReader(reporteByte))
|
||||
docPDF.CopyPagesTo(1, docPDF.GetNumberOfPages(), pdfdoc)
|
||||
docPDF.CopyPagesTo(1, docPDF.GetNumberOfPages(), pdfdoc)
|
||||
docPDF.Close()
|
||||
|
||||
pdfdoc.Close()
|
||||
End Using
|
||||
pdf64 = Convert.ToBase64String(ms.ToArray())
|
||||
End Using
|
||||
|
||||
RegistraScript($"impresionBase64('{pdf64}');", "Imprimir")
|
||||
Else
|
||||
Alert("No se pudo imprimir el pdf directamente. favor de descargar manualmente el pdf.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user