diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx index eea7c457a..8535b6756 100644 --- a/Ventas/PVCobranza.aspx +++ b/Ventas/PVCobranza.aspx @@ -1539,8 +1539,6 @@ } $("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2)); - - // $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt(); } function FnSumaValoresAnt() { @@ -1589,7 +1587,12 @@ $get("TxtCambio").value = FormatoNumero(cambio); } else { - $get("TxtFaltante").value = FormatoNumero(cambio); + if (cambio == 'NaN') { + $get("TxtFaltante").value = "0.00"; + } else { + $get("TxtFaltante").value = FormatoNumero(cambio); + } + $get("ChkSobFaltante").checked = true; $get("TxtCambio").value = ""; } @@ -1618,8 +1621,15 @@ } function ValidaSobranteFaltante() { - if (ToDouble($get("TxtFaltante").value) > 1) { - alert("El sobrante/faltante no debe ser mayor a 1"); + + let sobFaltantePermitido = 1; + + if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) { + sobFaltantePermitido = 10; + } + + if (ToDouble($get("TxtFaltante").value) > sobFaltantePermitido) { + alert("El sobrante/faltante no debe ser mayor a " + sobFaltantePermitido); $get("TxtFaltante").value = ""; $get("ChkSobFaltante").checked = false; } else { @@ -1630,11 +1640,20 @@ function CargaSobranteFaltante() { $('#ChkSobFaltante').change(function () { if (this.checked == true) { - if (ToDouble($get("TxtCambio").value) > 1) { - alert("El sobrante/faltante no debe ser mayor a 1") + let sobFaltantePermitido = 1; + + if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) { + sobFaltantePermitido = 10; + } + if (ToDouble($get("TxtCambio").value) > sobFaltantePermitido) { + alert("El sobrante/faltante no debe ser mayor a " + sobFaltantePermitido) $get("ChkSobFaltante").checked = false; } else { - $get("TxtFaltante").value = $get("TxtCambio").value; + if ($get("TxtCambio").value == 'NaN') { + $get("TxtFaltante").value = "0.00"; + } else { + $get("TxtFaltante").value = $get("TxtCambio").value; + } } } diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 68f1cf8a0..ddad5f0c7 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -593,13 +593,19 @@ Partial Class Ventas_PVCobranza Faltante = Math.Abs(TxtFaltante.Text.ToDecimal()) End If - If Faltante > 1 Then - Alert("El faltante no puede ser mayor a 1.00", TipoMensaje.MsgAdvertencia) + Dim sobFaltantePermitido = 1 + + If UsuarioActual.CveEmpresa = 189 Then + sobFaltantePermitido = 10 + End If + + If Faltante > sobFaltantePermitido Then + Alert($"El faltante no puede ser mayor a {sobFaltantePermitido}", TipoMensaje.MsgAdvertencia) Exit Sub End If - If Sobrante > 1 Then - Alert("El sobrante no puede ser mayor a 1.00", TipoMensaje.MsgAdvertencia) + If Sobrante > sobFaltantePermitido Then + Alert($"El sobrante no puede ser mayor a {sobFaltantePermitido}", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -956,7 +962,7 @@ Partial Class Ventas_PVCobranza GuardaLog(ex.ToString()) End Try - If MsgError = "" AndAlso Not ChkSobFaltante.Checked Then + If MsgError = "" Then If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=5, CveVenta:=CveVenta) Then If ObjConta.ValorPolizaDescuadre > 0 Then GuardaLogAD($"Ventas/Ventas-NCGeneradas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")