Descarga PDF en rep venta detalle,limpiar al recibir usados de remision
This commit is contained in:
@@ -615,8 +615,22 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
BloqueaEdicionEncabezado()
|
BloqueaEdicionEncabezado()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub LimpiarMovimiento()
|
Private Sub LimpiarMovimiento()
|
||||||
|
|
||||||
CveMovimiento = -1
|
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()
|
SiguienteFolio()
|
||||||
|
|
||||||
HplCompra.Visible = False
|
HplCompra.Visible = False
|
||||||
@@ -666,16 +680,6 @@ Partial Class Inventarios_RecepcionUsados
|
|||||||
TxtRemision.Text = ""
|
TxtRemision.Text = ""
|
||||||
DivRemision.Visible = False
|
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()
|
UpRegistroTipoCambio.Update()
|
||||||
UPDatos.Update()
|
UPDatos.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -811,7 +811,7 @@ Partial Class RepVentaDetalle
|
|||||||
Private Sub BtnDescargarPDF_Click(sender As Object, e As EventArgs) Handles BtnDescargarPDF.Click
|
Private Sub BtnDescargarPDF_Click(sender As Object, e As EventArgs) Handles BtnDescargarPDF.Click
|
||||||
Dim pathPDF As String
|
Dim pathPDF As String
|
||||||
Dim TipoDocto As String = ""
|
Dim TipoDocto As String = ""
|
||||||
|
'Dim ListaPDF As New List(Of MFacturaDescarga)
|
||||||
'GENERA FACTURAS QUE NO ESTAN EN LA CARPETA
|
'GENERA FACTURAS QUE NO ESTAN EN LA CARPETA
|
||||||
For Each gvr As GridViewRow In GvDatos.Rows
|
For Each gvr As GridViewRow In GvDatos.Rows
|
||||||
If gvr.DataKey("CveVenta").ToEntero > 0 Then
|
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))
|
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
|
If Not IO.File.Exists(pathPDF) Then
|
||||||
GenerarFacturaVentaDEV(gvr.DataKey("CveVenta").ToEntero)
|
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
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
@@ -877,14 +878,14 @@ Partial Class RepVentaDetalle
|
|||||||
Response.ContentType = "application/zip"
|
Response.ContentType = "application/zip"
|
||||||
Response.End()
|
Response.End()
|
||||||
End Sub
|
End Sub
|
||||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte()
|
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}", ClsPaginas.UrlSitio, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
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
|
Dim File As Byte() = Nothing
|
||||||
Try
|
Try
|
||||||
Using httpClient = New HttpClient()
|
Using httpClient = New HttpClient()
|
||||||
httpClient.Timeout = New TimeSpan(0, 15, 0)
|
httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
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
|
Dim response = httpClient.SendAsync(request).Result
|
||||||
If response.StatusCode = Net.HttpStatusCode.OK Then
|
If response.StatusCode = Net.HttpStatusCode.OK Then
|
||||||
File = response.Content.ReadAsByteArrayAsync().Result
|
File = response.Content.ReadAsByteArrayAsync().Result
|
||||||
@@ -999,9 +1000,9 @@ Partial Class RepVentaDetalle
|
|||||||
GenerarPDF()
|
GenerarPDF()
|
||||||
End Sub
|
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 ObjVentas As New ClsVentas
|
||||||
'Dim Vta As Modelos.Factura = Nothing
|
'Dim Vta As Modelos.Factura = Nothing
|
||||||
|
|
||||||
@@ -1121,7 +1122,7 @@ Partial Class RepVentaDetalle
|
|||||||
' Vta = Nothing
|
' Vta = Nothing
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
End Sub
|
End Function
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user