diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index ba54c7715..31a25e690 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5662,12 +5662,13 @@ Public Class ClsContabilidad #End Region #Region "VALIDACION POLIZA DESCUADRADA" - Public Function ValidacionPrePolizaCuadre(CvePrePoliza As Integer, Opcion As Integer) As Boolean + Public Function ValidacionPrePolizaCuadre(CvePrePoliza As Integer, Opcion As Integer, Optional CveVenta As Integer = -1) As Boolean Dim Retorno = False DataAdapter("PA_Conta_PrePoliza_Validacion") With SqlAdapter.SelectCommand.Parameters .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta .Add("@Opcion", SqlDbType.Int).Value = Opcion .Add("@Valor", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@MsgSalida", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f3a8526a7..3f0ab4f82 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10215,7 +10215,11 @@ Partial Class Ventas If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then If ObjConta.ValorPolizaDescuadre > 0 Then - 'ErrorPrepoliza = True + If ObjConta.ValorPolizaDescuadre = 2 Then + ErrorPrepoliza = True + Alert(ObjConta.MensajePolizaDescuadre, TipoMensaje.MsgError) + End If + 'ErrorPrepoliza = True GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas") 'SIRVE PARA VER LA PREPOLIZA QUE SE VALIDA @@ -15669,6 +15673,15 @@ Partial Class Ventas End If End If + If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + If ObjConta.ValorPolizaDescuadre = 2 Then + OcurrioError = True + ErrorList.Add(ObjConta.MensajePolizaDescuadre) + End If + End If + End If + If Not OcurrioError Then If RegeneracionPolizas(ObjVentas, ObjAC) Then OcurrioError = True @@ -21650,6 +21663,7 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) + Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) Dim OcurrioError = False Dim MensajeError = "" @@ -21703,6 +21717,15 @@ Partial Class Ventas End If End If + If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + If ObjConta.ValorPolizaDescuadre = 2 Then + OcurrioError = True + MensajeError = ObjConta.MensajePolizaDescuadre + End If + End If + End If + If OcurrioError Then ObjVentas.RollBack() Alert($"{MensajeError}. Por favor vuelva a intentar.", TipoMensaje.MsgError) @@ -21721,6 +21744,8 @@ Partial Class Ventas End If ObjVentas.Dispose() + ObjConta.Dispose() + ObjCGame.Dispose() End Sub #End Region