--No validar efectivo en sobrante faltante
This commit is contained in:
@@ -1581,20 +1581,24 @@
|
|||||||
HdnSobranteFaltante.value = "0";
|
HdnSobranteFaltante.value = "0";
|
||||||
//HdnCambioFaltante.value = "1";
|
//HdnCambioFaltante.value = "1";
|
||||||
let cambio = total - totalVenta;
|
let cambio = total - totalVenta;
|
||||||
if (cambio > 1) {
|
if (cambio > 1 || totalEfectivo > 0) {
|
||||||
$get("TxtFaltante").value = "";
|
$get("TxtFaltante").value = "";
|
||||||
$get("ChkSobFaltante").checked = false;
|
$get("ChkSobFaltante").checked = false;
|
||||||
$get("TxtCambio").value = FormatoNumero(cambio);
|
$get("TxtCambio").value = FormatoNumero(cambio);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (cambio == 'NaN') {
|
//SOLO ACTIVAR SI NO HAY EFECTIVO
|
||||||
$get("TxtFaltante").value = "0.00";
|
if (totalEfectivo == 0) {
|
||||||
} else {
|
if (cambio == 'NaN') {
|
||||||
$get("TxtFaltante").value = FormatoNumero(cambio);
|
$get("TxtFaltante").value = "0.00";
|
||||||
|
} else {
|
||||||
|
$get("TxtFaltante").value = FormatoNumero(cambio);
|
||||||
|
}
|
||||||
|
|
||||||
|
$get("ChkSobFaltante").checked = true;
|
||||||
|
$get("TxtCambio").value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$get("ChkSobFaltante").checked = true;
|
|
||||||
$get("TxtCambio").value = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1628,13 +1632,27 @@
|
|||||||
sobFaltantePermitido = 10;
|
sobFaltantePermitido = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ToDouble($get("TxtFaltante").value) > sobFaltantePermitido) {
|
let totalEfectivo = $get("TxtImporteEfectivo") ? ToDouble($get("TxtImporteEfectivo").value) : 0;
|
||||||
alert("El sobrante/faltante no debe ser mayor a " + sobFaltantePermitido);
|
|
||||||
|
if (totalEfectivo > 0) {
|
||||||
|
sobFaltantePermitido = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sobFaltantePermitido > 0) {
|
||||||
|
if (ToDouble($get("TxtFaltante").value) > sobFaltantePermitido) {
|
||||||
|
alert("El sobrante/faltante no debe ser mayor a " + sobFaltantePermitido);
|
||||||
|
$get("TxtFaltante").value = "";
|
||||||
|
$get("ChkSobFaltante").checked = false;
|
||||||
|
} else {
|
||||||
|
$get("ChkSobFaltante").checked = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert("El sobrante/faltante no esta permitido");
|
||||||
$get("TxtFaltante").value = "";
|
$get("TxtFaltante").value = "";
|
||||||
$get("ChkSobFaltante").checked = false;
|
$get("ChkSobFaltante").checked = false;
|
||||||
} else {
|
|
||||||
$get("ChkSobFaltante").checked = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function CargaSobranteFaltante() {
|
function CargaSobranteFaltante() {
|
||||||
@@ -1645,17 +1663,32 @@
|
|||||||
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
|
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
|
||||||
sobFaltantePermitido = 10;
|
sobFaltantePermitido = 10;
|
||||||
}
|
}
|
||||||
if (ToDouble($get("TxtCambio").value) > sobFaltantePermitido) {
|
|
||||||
alert("El sobrante/faltante no debe ser mayor a " + sobFaltantePermitido)
|
let totalEfectivo = $get("TxtImporteEfectivo") ? ToDouble($get("TxtImporteEfectivo").value) : 0;
|
||||||
$get("ChkSobFaltante").checked = false;
|
|
||||||
} else {
|
if (totalEfectivo > 0) {
|
||||||
if ($get("TxtCambio").value == 'NaN') {
|
sobFaltantePermitido = 0;
|
||||||
$get("TxtFaltante").value = "0.00";
|
|
||||||
} else {
|
|
||||||
$get("TxtFaltante").value = $get("TxtCambio").value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sobFaltantePermitido > 0) {
|
||||||
|
if (ToDouble($get("TxtCambio").value) > sobFaltantePermitido) {
|
||||||
|
alert("El sobrante/faltante no debe ser mayor a " + sobFaltantePermitido)
|
||||||
|
$get("ChkSobFaltante").checked = false;
|
||||||
|
} else {
|
||||||
|
if ($get("TxtCambio").value == 'NaN') {
|
||||||
|
$get("TxtFaltante").value = "0.00";
|
||||||
|
} else {
|
||||||
|
$get("TxtFaltante").value = $get("TxtCambio").value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert("El sobrante/faltante no esta permitido");
|
||||||
|
$get("TxtFaltante").value = "";
|
||||||
|
$get("ChkSobFaltante").checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$get("TxtFaltante").value = "";
|
$get("TxtFaltante").value = "";
|
||||||
|
|||||||
@@ -1704,12 +1704,9 @@ Partial Class Ventas_PVCobranza
|
|||||||
If ChkSobFaltante.Checked AndAlso SobranteFaltante <> 0 Then
|
If ChkSobFaltante.Checked AndAlso SobranteFaltante <> 0 Then
|
||||||
'SOBRANTE
|
'SOBRANTE
|
||||||
If SobranteFaltante > 0 Then
|
If SobranteFaltante > 0 Then
|
||||||
'SI ES EL SOBRANTE EN EFECTIVO SUMAR EL SOBRANTE/FALTANTE
|
'EL SOBRANTE/FALTANTE NO PUEDE SER EN EFECTIVO
|
||||||
If Metodo = 13 Then
|
If Metodo = 13 Then
|
||||||
ImporteIE += SobranteFaltante
|
Retorno = "Error en aplicación de sobrante/faltante"
|
||||||
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
|
|
||||||
'LIMPIAR SOBRANTE/FALTANTE
|
|
||||||
SobranteFaltante = 0
|
|
||||||
Else
|
Else
|
||||||
'AJUSTAR DONDE EL IMPORTE A BANCOS SEA MAYOR EN EL DE LA VENTA
|
'AJUSTAR DONDE EL IMPORTE A BANCOS SEA MAYOR EN EL DE LA VENTA
|
||||||
If ImporteBancos.RoundSQL(2) >= ImporteAbonoVenta.RoundSQL(2) Then
|
If ImporteBancos.RoundSQL(2) >= ImporteAbonoVenta.RoundSQL(2) Then
|
||||||
@@ -1722,52 +1719,60 @@ Partial Class Ventas_PVCobranza
|
|||||||
|
|
||||||
'FALTANTE
|
'FALTANTE
|
||||||
If SobranteFaltante < 0 Then
|
If SobranteFaltante < 0 Then
|
||||||
'METER LO QUE FALTA COMO GASTO
|
'EL SOBRANTE/FALTANTE NO PUEDE SER EN EFECTIVO
|
||||||
If (ImporteBancos.RoundSQL(2) + Math.Abs(SobranteFaltante)) = ImporteAbonoVenta.RoundSQL(2) Then
|
If Metodo = 13 Then
|
||||||
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
|
Retorno = "Error en aplicación de sobrante/faltante"
|
||||||
|
Else 'METER LO QUE FALTA COMO GASTO
|
||||||
|
If (ImporteBancos.RoundSQL(2) + Math.Abs(SobranteFaltante)) = ImporteAbonoVenta.RoundSQL(2) Then
|
||||||
|
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
|
||||||
|
|
||||||
'SUMAR AL PAGO
|
'SUMAR AL PAGO
|
||||||
If ImporteBancos < ImporteAbonoVenta Then
|
If ImporteBancos < ImporteAbonoVenta Then
|
||||||
ImporteBancos += Math.Abs(SobranteFaltante)
|
ImporteBancos += Math.Abs(SobranteFaltante)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'LIMPIAR SOBRANTE/FALTANTE
|
||||||
|
SobranteFaltante = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'LIMPIAR SOBRANTE/FALTANTE
|
|
||||||
SobranteFaltante = 0
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteIE, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto)
|
If String.IsNullOrEmpty(Retorno) Then
|
||||||
If CveIEPago > 0 Then
|
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteIE, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto)
|
||||||
Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura
|
If CveIEPago > 0 Then
|
||||||
|
Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura
|
||||||
|
|
||||||
If ImporteIE > 0 Then
|
If ImporteIE > 0 Then
|
||||||
|
|
||||||
Pago.ImportePagoVenta = tImportePago
|
Pago.ImportePagoVenta = tImportePago
|
||||||
Pago.ImportePago = ImporteIE
|
Pago.ImportePago = ImporteIE
|
||||||
Pago.CveIE = CveIEPago
|
Pago.CveIE = CveIEPago
|
||||||
Pago.CveMonedaPago = VentaActual.CveMoneda
|
Pago.CveMonedaPago = VentaActual.CveMoneda
|
||||||
Pago.Fecha = NowADS()
|
Pago.Fecha = NowADS()
|
||||||
Pago.Referencia = VentaActual.SerieFolio
|
Pago.Referencia = VentaActual.SerieFolio
|
||||||
If Pago.CveMonedaPago > 1 Then Pago.TCPago = GlobalTipoCambio(Now).ToDecimal
|
If Pago.CveMonedaPago > 1 Then Pago.TCPago = GlobalTipoCambio(Now).ToDecimal
|
||||||
|
|
||||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ErrorConta Then
|
If ErrorConta Then
|
||||||
Retorno = "Error en aplicación de pago"
|
Retorno = "Error en aplicación de pago"
|
||||||
End If
|
End If
|
||||||
Dim MetodoPago As Integer = If(Metodo = 13, 1, If(Metodo = 12, 4, If(Metodo = 11, 5, If(Metodo = 3, 2, 3))))
|
Dim MetodoPago As Integer = If(Metodo = 13, 1, If(Metodo = 12, 4, If(Metodo = 11, 5, If(Metodo = 3, 2, 3))))
|
||||||
If Not ErrorConta AndAlso Not ObjVentas.AddVta_VentaPago(VentaActual.CveVenta, MetodoPago, ImporteBancos) Then
|
If Not ErrorConta AndAlso Not ObjVentas.AddVta_VentaPago(VentaActual.CveVenta, MetodoPago, ImporteBancos) Then
|
||||||
Retorno = "Error en aplicación de pago.."
|
Retorno = "Error en aplicación de pago.."
|
||||||
|
ErrorConta = True
|
||||||
|
End If
|
||||||
|
HdnCveIE.Value = CveIEPago.ToString
|
||||||
|
Else
|
||||||
|
Retorno = "Pago en Bancos no registrado"
|
||||||
ErrorConta = True
|
ErrorConta = True
|
||||||
End If
|
End If
|
||||||
HdnCveIE.Value = CveIEPago.ToString
|
|
||||||
Else
|
|
||||||
Retorno = "Pago en Bancos no registrado"
|
|
||||||
ErrorConta = True
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Retorno = "No se ha especificado la cuenta"
|
Retorno = "No se ha especificado la cuenta"
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user