Descarga PDF en rep venta detalle,limpiar al recibir usados de remision

This commit is contained in:
2020-01-29 18:50:20 -07:00
parent a667f61ba4
commit 8d16bf75d3
2 changed files with 25 additions and 20 deletions

View File

@@ -615,8 +615,22 @@ Partial Class Inventarios_RecepcionUsados
BloqueaEdicionEncabezado()
End Sub
Private Sub LimpiarMovimiento()
CveMovimiento = -1
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
ObjFactura = Nothing
End If
If ObjRemisionNC IsNot Nothing Then
ObjRemisionNC.Dispose()
ObjRemisionNC = Nothing
End If
CveRemisionRecibida = -1
EsDistribuidor = False
DdlClientes.SelectedValueExist("-1")
SiguienteFolio()
HplCompra.Visible = False
@@ -666,16 +680,6 @@ Partial Class Inventarios_RecepcionUsados
TxtRemision.Text = ""
DivRemision.Visible = False
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
ObjFactura = Nothing
End If
If ObjRemisionNC IsNot Nothing Then
ObjRemisionNC.Dispose()
ObjRemisionNC = Nothing
End If
UpRegistroTipoCambio.Update()
UPDatos.Update()
End Sub

View File

@@ -811,7 +811,7 @@ Partial Class RepVentaDetalle
Private Sub BtnDescargarPDF_Click(sender As Object, e As EventArgs) Handles BtnDescargarPDF.Click
Dim pathPDF As String
Dim TipoDocto As String = ""
'Dim ListaPDF As New List(Of MFacturaDescarga)
'GENERA FACTURAS QUE NO ESTAN EN LA CARPETA
For Each gvr As GridViewRow In GvDatos.Rows
If gvr.DataKey("CveVenta").ToEntero > 0 Then
@@ -835,8 +835,9 @@ Partial Class RepVentaDetalle
pathPDF = Server.MapPath(String.Format("~/Empresas/{0}/PDF/{1}/{2}.pdf", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString))
If Not IO.File.Exists(pathPDF) Then
GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero)
If Not IO.File.Exists(pathPDF) Then
GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero, UsuarioActual.CveUsuario)
'ListaPDF.Add(New MFacturaDescarga() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero, .PDF = GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero, 100)})
End If
End If
Next
@@ -877,14 +878,14 @@ Partial Class RepVentaDetalle
Response.ContentType = "application/zip"
Response.End()
End Sub
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte()
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte()
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost/", 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}", CveEmpresa, DateTime.UtcNow.Ticks)))
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 response.StatusCode = Net.HttpStatusCode.OK Then
File = response.Content.ReadAsByteArrayAsync().Result
@@ -999,9 +1000,9 @@ Partial Class RepVentaDetalle
GenerarPDF()
End Sub
Private Sub GenerarFacturaVentaDEV(CveVenta As Integer)
Private Function GenerarFacturaVentaDEV(CveVenta As Integer, CveUsuario As Integer) As Byte()
DescargarFactura(CveVenta, UsuarioActual.CveEmpresa)
Return DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, CveUsuario)
'Dim ObjVentas As New ClsVentas
'Dim Vta As Modelos.Factura = Nothing
@@ -1121,7 +1122,7 @@ Partial Class RepVentaDetalle
' Vta = Nothing
'End If
End Sub
End Function
#End Region