-- correción de errores. -- ashx para visualizacion de documentos pdf. -- cambios de popUpVerFacturas a ClsPaginas para generacion de pdf de ventas.
49 lines
2.0 KiB
Plaintext
49 lines
2.0 KiB
Plaintext
<%@ WebHandler Language="VB" Class="SIGDesc" %>
|
|
|
|
Option Strict Off
|
|
Imports System.Data
|
|
Imports System.IO
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Newtonsoft.Json
|
|
|
|
Public Class SIGDesc : Implements IHttpHandler, IRequiresSessionState
|
|
|
|
ReadOnly Property UsuarioActual(ByVal context As HttpContext) As Usuario
|
|
Get
|
|
UsuarioActual = DirectCast(context.Session("UsuarioSIG"), Usuario)
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
|
If context.Request("metodo") IsNot Nothing AndAlso context.Request("metodo").ToString() = "descargarPDFVenta" Then
|
|
Dim CveVenta As Integer = context.Request("CveVenta").ToEntero()
|
|
DescargarPDFVenta(context, CveVenta)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub DescargarPDFVenta(ByVal context As HttpContext, CveVenta As Integer)
|
|
Dim usuario As Usuario = UsuarioActual(context)
|
|
If Not IsNothing(usuario) Then
|
|
Dim ObjFactura As New Modelos.Factura(usuario, CveVenta, usuario.CveEmpresa, CargaDTDetalle:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
|
|
|
|
Dim ArchivoPDF = String.Format("{0}Empresas\{1}\PDF\{2}\{3}.pdf", ModExtensiones.DirectorioBaseEmpresas, usuario.CveEmpresa, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
|
|
Dim FileInfo As FileInfo = New FileInfo(ArchivoPDF)
|
|
If FileInfo.Exists Then
|
|
context.Response.ContentType = "application/pdf"
|
|
context.Response.Flush()
|
|
context.Response.WriteFile(FileInfo.FullName)
|
|
context.Response.End()
|
|
End If
|
|
FileInfo = Nothing
|
|
End If
|
|
End Sub
|
|
|
|
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
|
Get
|
|
Return False
|
|
End Get
|
|
End Property
|
|
|
|
End Class |