Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -4177,104 +4177,113 @@ Namespace Modelos
|
|||||||
Dim CveMovimiento As Integer = 0
|
Dim CveMovimiento As Integer = 0
|
||||||
Dim Folio As Integer = 0
|
Dim Folio As Integer = 0
|
||||||
|
|
||||||
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso ObjFactura.SaldoAlmacen <> 0 Then
|
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then
|
||||||
Dim CveAlmacenDevolucion = ObjFactura.CveAlmacenDevolucion
|
Dim CveAlmacenDevolucion = ObjFactura.CveAlmacenDevolucion
|
||||||
'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN)
|
'VERIFICAR SI YA TIENE UNA DEVOLUCION
|
||||||
|
If ObjFactura.SaldoAlmacen <> 0 Then
|
||||||
|
'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN)
|
||||||
|
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacenDevolucion, ConceptoMovimiento, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=-1)
|
||||||
|
Folio = ObjInventario.Folio
|
||||||
|
|
||||||
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacenDevolucion, ConceptoMovimiento, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=-1)
|
If CveMovimiento > 0 Then
|
||||||
Folio = ObjInventario.Folio
|
For Each Dr As DataRow In DtExistencias.Rows
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, SerieLote:=Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||||
If CveMovimiento > 0 Then
|
|
||||||
For Each Dr As DataRow In DtExistencias.Rows
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, SerieLote:=Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Else
|
|
||||||
MensajeError = "Ocurrió un error al agregar el movimiento"
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
'GENERA PREPOLIZA DEL MOVIMIENTO DE DEVOLUCION
|
|
||||||
If Not ErrorCancelar Then
|
|
||||||
Dim DtCostos As DataTable = Nothing
|
|
||||||
Dim ValorInventario As Decimal = 0
|
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
|
||||||
DtCostos = ObjInventario.DtResultados
|
|
||||||
|
|
||||||
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
|
|
||||||
Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero
|
|
||||||
Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero
|
|
||||||
Dim IdCtaContable As Integer = 0
|
|
||||||
Dim CveCuenta As Integer = 0
|
|
||||||
If tmpCostos.Rows.Count > 0 Then
|
|
||||||
|
|
||||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
|
||||||
Dim Fecha As Date = Now
|
|
||||||
Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString.ToEntero
|
|
||||||
Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString
|
|
||||||
Dim SerieFolio As String = ObjVentas.DtResultados(0)("SerieFolio").ToString
|
|
||||||
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL()
|
|
||||||
Dim TotalCostoAcumulado As Decimal = 0
|
|
||||||
Dim cont As Integer = 1
|
|
||||||
|
|
||||||
Dim CvePrePolizaDev As Integer = ObjConta.AddPrePolizas("Inventario/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
||||||
'SE AGREGA MOVIMIENTO SEPARADO POR LA CUENTA DE VENTAS (ER)
|
|
||||||
For Each RowInv As DataRow In tmpCostos.Rows
|
|
||||||
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL()
|
|
||||||
TotalCostoAcumulado += ValorInventario
|
|
||||||
|
|
||||||
'CUANDO ES EL ÚLTIMO MOVIMIENTO Y HAY DIFERENCIAS EN LOS IMPORTES
|
|
||||||
If cont = DtCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
|
||||||
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
|
||||||
End If
|
|
||||||
|
|
||||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
|
||||||
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostosSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, False, -1 * ValorInventario, SerieFolio, 69, SerieFolio, Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=-1 * ValorInventario, CveCuenta:=CveCuenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
cont += 1
|
|
||||||
Next
|
|
||||||
|
|
||||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, True, -1 * TotalCosto, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=-1 * TotalCosto, CveCuenta:=CveCuentaAlmacen) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
'AUTOCONTA - EL MOVIMIENTO 1 ES EL DE VENTA
|
|
||||||
|
|
||||||
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 119 AndAlso ObjFactura.TipoDocto.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "NC") Then
|
|
||||||
AutoConta = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
If AutoConta And Not ErrorCancelar Then
|
|
||||||
|
|
||||||
If IdCtaContable > 0 Then
|
|
||||||
If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaDev, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Ocurrió un error al contabilizar la prepoliza."
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
Alert(String.Format("No se puede contabilizar ya que falta asignación de las cuentas contables"), TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
MensajeError = "Ocurrió un Error al ingresar las prepolizas"
|
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
||||||
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
MensajeError = "Ocurrió un error al agregar el movimiento"
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'GENERA PREPOLIZA DEL MOVIMIENTO DE DEVOLUCION
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
Dim DtCostos As DataTable = Nothing
|
||||||
|
Dim ValorInventario As Decimal = 0
|
||||||
|
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtCostos = ObjInventario.DtResultados
|
||||||
|
|
||||||
|
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
|
||||||
|
Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero
|
||||||
|
Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero
|
||||||
|
Dim IdCtaContable As Integer = 0
|
||||||
|
Dim CveCuenta As Integer = 0
|
||||||
|
If tmpCostos.Rows.Count > 0 Then
|
||||||
|
|
||||||
|
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
|
Dim Fecha As Date = Now
|
||||||
|
Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString.ToEntero
|
||||||
|
Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString
|
||||||
|
Dim SerieFolio As String = ObjVentas.DtResultados(0)("SerieFolio").ToString
|
||||||
|
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL()
|
||||||
|
Dim TotalCostoAcumulado As Decimal = 0
|
||||||
|
Dim cont As Integer = 1
|
||||||
|
|
||||||
|
Dim CvePrePolizaDev As Integer = ObjConta.AddPrePolizas("Inventario/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
'SE AGREGA MOVIMIENTO SEPARADO POR LA CUENTA DE VENTAS (ER)
|
||||||
|
For Each RowInv As DataRow In tmpCostos.Rows
|
||||||
|
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL()
|
||||||
|
TotalCostoAcumulado += ValorInventario
|
||||||
|
|
||||||
|
'CUANDO ES EL ÚLTIMO MOVIMIENTO Y HAY DIFERENCIAS EN LOS IMPORTES
|
||||||
|
If cont = DtCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
||||||
|
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
||||||
|
End If
|
||||||
|
|
||||||
|
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||||
|
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostosSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||||
|
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, False, -1 * ValorInventario, SerieFolio, 69, SerieFolio, Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=-1 * ValorInventario, CveCuenta:=CveCuenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
cont += 1
|
||||||
|
Next
|
||||||
|
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaDev, True, -1 * TotalCosto, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=ObjFactura.CveSubProyecto, ImporteMX:=-1 * TotalCosto, CveCuenta:=CveCuentaAlmacen) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'AUTOCONTA - EL MOVIMIENTO 1 ES EL DE VENTA
|
||||||
|
|
||||||
|
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 119 AndAlso ObjFactura.TipoDocto.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "NC") Then
|
||||||
|
AutoConta = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If AutoConta And Not ErrorCancelar Then
|
||||||
|
|
||||||
|
If IdCtaContable > 0 Then
|
||||||
|
If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaDev, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al contabilizar la prepoliza."
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert(String.Format("No se puede contabilizar ya que falta asignación de las cuentas contables"), TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un Error al ingresar las prepolizas"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
'UTILIZA LA DEVOLUCION YA REALIZADA
|
||||||
|
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
|
CveMovimiento = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", $"CvePS IS NULL AND CveConcepto = 18").ToEntero()
|
||||||
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ Partial Class PopUpVerFactura
|
|||||||
Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\"
|
Return AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\"
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Private ReadOnly Property DomicilioFiscalCompu As String
|
Private ReadOnly Property DomicilioFiscalCompu As String
|
||||||
Get
|
Get
|
||||||
Dim SisEmpresa As New ClsSisEmpresas()
|
Dim SisEmpresa As New ClsSisEmpresas()
|
||||||
@@ -86,6 +85,14 @@ Partial Class PopUpVerFactura
|
|||||||
Return ""
|
Return ""
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
'Private Property SessionPorImpresion As Boolean
|
||||||
|
' Get
|
||||||
|
' Return CBool(IfNull(ViewState("SessionPorImpresion"), False, ViewState("SessionPorImpresion")))
|
||||||
|
' End Get
|
||||||
|
' Set(value As Boolean)
|
||||||
|
' ViewState("SessionPorImpresion") = value
|
||||||
|
' End Set
|
||||||
|
'End Property
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
@@ -95,13 +102,13 @@ Partial Class PopUpVerFactura
|
|||||||
If Request.Headers("ADSToken") IsNot Nothing Then
|
If Request.Headers("ADSToken") IsNot Nothing Then
|
||||||
Dim UserParams As Hashtable = Parametros(Decripta((Request.Headers("ADSToken").ToString)))
|
Dim UserParams As Hashtable = Parametros(Decripta((Request.Headers("ADSToken").ToString)))
|
||||||
Dim CveEmpresaToken As Integer = UserParams("CVEEMPRESA").ToString().ToEntero()
|
Dim CveEmpresaToken As Integer = UserParams("CVEEMPRESA").ToString().ToEntero()
|
||||||
|
Dim CveUsuario As Integer = IfNull(UserParams("CVEUSUARIO"), 100, UserParams("CVEUSUARIO").ToString().ToEntero()).ToString().ToEntero()
|
||||||
|
|
||||||
Dim UsuarioToken = ValidaUsuarioSistema(CveEmpresaToken)
|
Dim UsuarioToken = ValidaUsuarioSistema(CveEmpresaToken, CveUsuario)
|
||||||
|
|
||||||
If UsuarioToken IsNot Nothing Then
|
If UsuarioToken IsNot Nothing AndAlso UsuarioActual Is Nothing Then
|
||||||
Context.Session("UsuarioSIG") = UsuarioToken
|
Context.Session("UsuarioSIG") = UsuarioToken
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Request("RFC") IsNot Nothing AndAlso Request("File") IsNot Nothing Then
|
If Request("RFC") IsNot Nothing AndAlso Request("File") IsNot Nothing Then
|
||||||
@@ -172,11 +179,11 @@ Partial Class PopUpVerFactura
|
|||||||
|
|
||||||
#Region "U S U A R I O - T O K E N"
|
#Region "U S U A R I O - T O K E N"
|
||||||
|
|
||||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
Private Function ValidaUsuarioSistema(CveEmpresa As Integer, Optional CveUsuario As Integer = 100) As Usuario
|
||||||
|
|
||||||
Dim UsuarioToken As Usuario = Nothing
|
Dim UsuarioToken As Usuario = Nothing
|
||||||
Dim ObjUsuarios As New ClsSisUsuarios
|
Dim ObjUsuarios As New ClsSisUsuarios
|
||||||
If ObjUsuarios.GetUsuarios(100) Then
|
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
||||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Imports System.IO
|
|||||||
Imports System.Linq
|
Imports System.Linq
|
||||||
Imports System.Security.Cryptography.X509Certificates
|
Imports System.Security.Cryptography.X509Certificates
|
||||||
Imports System.Globalization
|
Imports System.Globalization
|
||||||
|
Imports System.Net.Http
|
||||||
|
|
||||||
Partial Class PV
|
Partial Class PV
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
@@ -2290,6 +2291,18 @@ Partial Class PV
|
|||||||
If ObjFactura.CveCliente > 0 Then
|
If ObjFactura.CveCliente > 0 Then
|
||||||
If TmpDT.Rows.Count > 0 Then
|
If TmpDT.Rows.Count > 0 Then
|
||||||
Dim Retorno = ObjFactura.EmitirFactura()
|
Dim Retorno = ObjFactura.EmitirFactura()
|
||||||
|
If Retorno.CveVenta > 0 Then
|
||||||
|
Dim SbAlert As New StringBuilder
|
||||||
|
SbAlert.AppendFormat("{0}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
||||||
|
|
||||||
|
DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
|
||||||
|
|
||||||
|
|
||||||
|
Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
|
||||||
|
End If
|
||||||
|
|
||||||
For Each Mensaje In Retorno.Mensajes
|
For Each Mensaje In Retorno.Mensajes
|
||||||
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
|
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
|
||||||
Next
|
Next
|
||||||
@@ -2298,6 +2311,27 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
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={2}", CveEmpresa, DateTime.UtcNow.Ticks, UsuarioActual.CveUsuario)))
|
||||||
|
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
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "OBJETO VENTA"
|
#Region "OBJETO VENTA"
|
||||||
@@ -2485,7 +2519,7 @@ Partial Class PV
|
|||||||
|
|
||||||
ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados
|
ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados
|
||||||
|
|
||||||
ObjFactura.GenerarPDFFactura = True
|
ObjFactura.GenerarPDFFactura = False
|
||||||
|
|
||||||
Dim CveTipoAlmacen As Integer = If(TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0, 6, 22)
|
Dim CveTipoAlmacen As Integer = If(TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0, 6, 22)
|
||||||
If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveTipoAlmacen = {CveTipoAlmacen} AND CveSubProyecto= {DdlSubProyectoDatos.SelectedValue}").Rows.Count > 0 Then
|
If GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros($"CveTipoAlmacen = {CveTipoAlmacen} AND CveSubProyecto= {DdlSubProyectoDatos.SelectedValue}").Rows.Count > 0 Then
|
||||||
|
|||||||
@@ -14926,7 +14926,7 @@ Partial Class Ventas
|
|||||||
Dim AplicaMovimientoDetalleEntrada As Boolean = False
|
Dim AplicaMovimientoDetalleEntrada As Boolean = False
|
||||||
If RemisionesLista.Count > 0 Then
|
If RemisionesLista.Count > 0 Then
|
||||||
AplicaMovimientoDetalleEntrada = True
|
AplicaMovimientoDetalleEntrada = True
|
||||||
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND TieneSalidaxFactura IS NULL"))
|
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
|
||||||
Else
|
Else
|
||||||
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
|
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user