Centrar generacion de pdf en el popUpVerFactura.aspx
This commit is contained in:
@@ -11021,6 +11021,10 @@ Partial Class Ventas
|
||||
|
||||
ObjFactura.EsGarantia = Me.EsGarantia
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then
|
||||
ObjFactura.Kilometraje = TxtKilometraje.Text.Trim.ToDecimal()
|
||||
End If
|
||||
|
||||
'ASIGNAR RFC RECEPTOR
|
||||
If ObjFactura.Timbre IsNot Nothing Then
|
||||
If ObjFactura.Timbre.Receptor IsNot Nothing Then
|
||||
@@ -14831,12 +14835,11 @@ Partial Class Ventas
|
||||
|
||||
'TIMBRADO NUEVO
|
||||
Try
|
||||
PdfFactura(ObjFactura)
|
||||
'If DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
' PdfFactura(ObjFactura)
|
||||
' 'Else
|
||||
' ' pdf = PdfFactura(ObjFactura)
|
||||
'End If
|
||||
Dim ObjetoPDF As Byte() = DescargarFactura(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)
|
||||
|
||||
If ObjetoPDF Is Nothing OrElse ObjetoPDF.Length = 0 Then
|
||||
PdfFactura(ObjFactura, AplicaPagare:=If(ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant"), "1", "0"))
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
|
||||
@@ -14935,7 +14938,7 @@ Partial Class Ventas
|
||||
|
||||
'TIMBRADO NUEVO
|
||||
Try
|
||||
pdf = PdfFactura(ObjFactura)
|
||||
pdf = PdfFactura(ObjFactura, AplicaPagare:="1")
|
||||
Catch ex As Exception
|
||||
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
|
||||
End Try
|
||||
@@ -32987,27 +32990,27 @@ Partial Class Ventas
|
||||
|
||||
' Return File
|
||||
'End Function
|
||||
'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||
' Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||
' Dim File As Byte() = Nothing
|
||||
' Try
|
||||
' Using httpClient = New HttpClient()
|
||||
' httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||
' Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
' request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario=100", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||
' Dim response = httpClient.SendAsync(request).Result
|
||||
' If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
' File = response.Content.ReadAsByteArrayAsync().Result
|
||||
' End If
|
||||
' End Using
|
||||
' End Using
|
||||
' Catch ex As Exception
|
||||
' File = Nothing
|
||||
' OnError("Ocurrió un error al descargar la factura", ex)
|
||||
' End Try
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient = New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 2, 0)
|
||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
File = response.Content.ReadAsByteArrayAsync().Result
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
File = Nothing
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
|
||||
' Return File
|
||||
'End Function
|
||||
Return File
|
||||
End Function
|
||||
Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs)
|
||||
Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC")
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user