--Sobrante/faltante cobro por caja
This commit is contained in:
@@ -6,6 +6,43 @@
|
|||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||||
<style>
|
<style>
|
||||||
|
div.chksino, span.chksino {
|
||||||
|
border: 1px solid #B8B8B8;
|
||||||
|
max-width: 77px;
|
||||||
|
overflow: hidden;
|
||||||
|
max-height: 28px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chksino label::after {
|
||||||
|
content: 'No';
|
||||||
|
padding: 1px;
|
||||||
|
padding-left: 12px;
|
||||||
|
padding-right: 12px;
|
||||||
|
margin-left: 45px;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: normal !important;
|
||||||
|
display: inline-block;
|
||||||
|
background: #ececec;
|
||||||
|
color: #666;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chksino label::before {
|
||||||
|
content: 'Si ';
|
||||||
|
padding: 1px;
|
||||||
|
padding-left: 15px !important;
|
||||||
|
padding-right: 14px !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: normal !important;
|
||||||
|
display: inline-block;
|
||||||
|
background: #428bca;
|
||||||
|
color: #FFF;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.e-big-btn {
|
.e-big-btn {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
@@ -644,26 +681,36 @@
|
|||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<div class="chequesie2">
|
<div class="chequesie2">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label class="col-md-1">Total:</label>
|
<div class="col-md-4" style="display: flex; align-items: center;">
|
||||||
<div class="col-md-3 input-icon">
|
<label style="font-weight: bold; font-size: medium;">Total:</label>
|
||||||
<i style="margin: 0px;">$</i>
|
<div class="input-icon">
|
||||||
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ReadOnly="true" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
|
<i style="margin: 0px;">$</i>
|
||||||
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtImporteContado" FilterType="Custom, Numbers" ValidChars=".," />
|
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="180px" ReadOnly="true" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
|
||||||
|
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtImporteContado" FilterType="Custom, Numbers" ValidChars=".," />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label id="lblCambio" class="col-md-1">Cambio:</label>
|
<div class="col-md-8">
|
||||||
<div class="col-md-3 input-icon">
|
<div class="row">
|
||||||
<i style="margin: 0px;">$</i>
|
<div class="col-md-4" style="display: flex; align-items: center;">
|
||||||
<asp:TextBox ID="TxtCambio" CssClass="form-control input-sm " Enabled="false" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
|
<label id="lblCambio" runat="server" style="font-weight: bold; font-size: medium;">Cambio:</label>
|
||||||
<ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
<div class="input-icon">
|
||||||
<br />
|
<i style="margin: 0px;">$</i>
|
||||||
</div>
|
<asp:HiddenField ID="HdnSobranteFaltante" Value="0" ClientIDMode="Static" runat="server" />
|
||||||
<label id="lblCambio2" class="col-md-1">Sob/falt:</label>
|
<asp:TextBox ID="TxtCambio" CssClass="form-control input-sm " Enabled="false" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
|
||||||
<div class="col-md-3 input-icon">
|
<ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
||||||
<i style="margin: 0px;">$</i>
|
</div>
|
||||||
<asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
|
</div>
|
||||||
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
<div class="col-md-8" style="display: flex; align-items: center;">
|
||||||
<br />
|
<label style="font-weight: bold; font-size: medium;">Sob/falt:</label>
|
||||||
|
|
||||||
|
<asp:CheckBox ID="ChkSobFaltante" runat="server" ClientIDMode="Static" />
|
||||||
|
<div class="input-icon" style="margin-left: 20px;">
|
||||||
|
<i style="margin: 0px;">$</i>
|
||||||
|
<asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
|
||||||
|
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1195,8 +1242,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12" style="display:flex; justify-content:end; font-size:16px; font-weight: bold;">
|
<div class="col-md-12" style="display: flex; justify-content: end; font-size: 16px; font-weight: bold;">
|
||||||
<span> Total: </span>
|
<span>Total: </span>
|
||||||
<asp:Label ID="LblTotalAnticipos" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
<asp:Label ID="LblTotalAnticipos" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1519,7 +1566,7 @@
|
|||||||
let totalTransferencia = $get("TxtImporteTransferencia") ? ToDouble($get("TxtImporteTransferencia").value) : 0;
|
let totalTransferencia = $get("TxtImporteTransferencia") ? ToDouble($get("TxtImporteTransferencia").value) : 0;
|
||||||
let totalCobranza = $get("TxtCxCAplicado") ? ToDouble($get("TxtCxCAplicado").value) : 0;
|
let totalCobranza = $get("TxtCxCAplicado") ? ToDouble($get("TxtCxCAplicado").value) : 0;
|
||||||
let TotalOtrosContado = 0;
|
let TotalOtrosContado = 0;
|
||||||
debugger;
|
|
||||||
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia;
|
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia;
|
||||||
|
|
||||||
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
|
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
|
||||||
@@ -1532,12 +1579,26 @@
|
|||||||
let totalVenta = $get('HdnTotal').value ? ToDouble($get('HdnTotal').value) : 0 + totalCobranza;// - ToDouble($get('HdnTotal').value);
|
let totalVenta = $get('HdnTotal').value ? ToDouble($get('HdnTotal').value) : 0 + totalCobranza;// - ToDouble($get('HdnTotal').value);
|
||||||
|
|
||||||
if (total > totalVenta) {
|
if (total > totalVenta) {
|
||||||
lblCambio.innerHTML = "Cambio:";
|
C_lblCambio.innerHTML = "Cambio:";
|
||||||
|
HdnSobranteFaltante.value = "0";
|
||||||
//HdnCambioFaltante.value = "1";
|
//HdnCambioFaltante.value = "1";
|
||||||
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
|
let cambio = total - totalVenta;
|
||||||
|
if (cambio > 1) {
|
||||||
|
$get("TxtFaltante").value = "";
|
||||||
|
$get("ChkSobFaltante").checked = false;
|
||||||
|
$get("TxtCambio").value = FormatoNumero(cambio);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$get("TxtFaltante").value = FormatoNumero(cambio);
|
||||||
|
$get("ChkSobFaltante").checked = true;
|
||||||
|
$get("TxtCambio").value = FormatoNumero(cambio);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
lblCambio.innerHTML = "Faltante:";
|
C_lblCambio.innerHTML = "Faltante:";
|
||||||
//HdnCambioFaltante.value = "0";
|
HdnSobranteFaltante.value = "1";
|
||||||
|
$get("TxtFaltante").value = "";
|
||||||
|
$get("ChkSobFaltante").checked = false;
|
||||||
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
|
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1556,5 +1617,28 @@
|
|||||||
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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")
|
||||||
|
} else {
|
||||||
|
$get("TxtFaltante").value = $get("TxtCambio").value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$get("TxtFaltante").value = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
CargaSobranteFaltante();
|
||||||
|
Sys.Application.add_load(function (s, e) {
|
||||||
|
CargaSobranteFaltante();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ Option Strict On
|
|||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Net.Http
|
Imports System.Net.Http
|
||||||
Imports CrystalDecisions.CrystalReports.Engine
|
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports Modelos.Factura
|
|
||||||
|
|
||||||
Partial Class Ventas_PVCobranza
|
Partial Class Ventas_PVCobranza
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
@@ -579,8 +576,41 @@ Partial Class Ventas_PVCobranza
|
|||||||
Dim VentaContado As Boolean = HdnVentaCondicionesPago.Value = "0"
|
Dim VentaContado As Boolean = HdnVentaCondicionesPago.Value = "0"
|
||||||
|
|
||||||
If VentaContado Then
|
If VentaContado Then
|
||||||
|
Dim Faltante As Decimal = 0
|
||||||
|
Dim Sobrante As Decimal = 0
|
||||||
|
|
||||||
|
If ChkSobFaltante.Checked Then
|
||||||
|
If Not HdnSobranteFaltante.Value.Contiene("0", "1") Then
|
||||||
|
Alert("Sobrante/Faltante no definido", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If HdnSobranteFaltante.Value = "0" Then
|
||||||
|
Sobrante = Math.Abs(TxtFaltante.Text.ToDecimal())
|
||||||
|
End If
|
||||||
|
|
||||||
|
If HdnSobranteFaltante.Value = "1" Then
|
||||||
|
Faltante = Math.Abs(TxtFaltante.Text.ToDecimal())
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Faltante > 1 Then
|
||||||
|
Alert("El faltante no puede ser mayor a 1.00", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Sobrante > 1 Then
|
||||||
|
Alert("El sobrante no puede ser mayor a 1.00", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TxtFaltante.Text.ToDecimal() = 0 Then
|
||||||
|
Alert("No hay importe para sobrante/faltante", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'validaciones
|
'validaciones
|
||||||
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal() + TxtImporteOtrosContado.Text.ToDecimal()
|
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal() + TxtImporteOtrosContado.Text.ToDecimal() + Faltante
|
||||||
If Pagado = 0 Then
|
If Pagado = 0 Then
|
||||||
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
|
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@@ -590,7 +620,8 @@ Partial Class Ventas_PVCobranza
|
|||||||
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
|
Alert("Favor de especificar el saldo total de pagar", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal
|
|
||||||
|
Dim PagadoSinEfectivo As Decimal = Pagado - TxtImporteEfectivo.Text.ToDecimal - Sobrante
|
||||||
If PagadoSinEfectivo > (LtlSaldo.Text.ToDecimal() + TxtCxCAplicado.Text.ToDecimal) Then
|
If PagadoSinEfectivo > (LtlSaldo.Text.ToDecimal() + TxtCxCAplicado.Text.ToDecimal) Then
|
||||||
Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia)
|
Alert("El pago con los metodos de pago actuales no puede ser mayor al importe de la venta", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@@ -619,6 +650,16 @@ Partial Class Ventas_PVCobranza
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim SobranteFaltante As Decimal = 0
|
||||||
|
If ChkSobFaltante.Checked Then
|
||||||
|
SobranteFaltante = TxtFaltante.Text.ToDecimal()
|
||||||
|
'SI ES FALTANTE DEBE SER SIEMPRE NEGATIVO
|
||||||
|
If HdnSobranteFaltante.Value = "1" Then
|
||||||
|
SobranteFaltante = $"-{Math.Abs(TxtFaltante.Text.ToDecimal())}".ToDecimal()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim tCveCorte As Integer = CveCorte
|
Dim tCveCorte As Integer = CveCorte
|
||||||
@@ -771,14 +812,14 @@ Partial Class Ventas_PVCobranza
|
|||||||
|
|
||||||
If CvePrePoliza > 0 Then
|
If CvePrePoliza > 0 Then
|
||||||
If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
|
If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteCredito.Text.ToDecimal > 0 Then
|
||||||
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(12, DdlCuentaTarjetaCredito.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteCredito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto, SobranteFaltante:=SobranteFaltante)
|
||||||
SaldoPendienteVenta -= TxtImporteCredito.Text.ToDecimal
|
SaldoPendienteVenta -= TxtImporteCredito.Text.ToDecimal
|
||||||
SaldoPendientePagos -= TxtImporteCredito.Text.ToDecimal
|
SaldoPendientePagos -= TxtImporteCredito.Text.ToDecimal
|
||||||
PagoAplicado += TxtImporteCredito.Text.ToDecimal
|
PagoAplicado += TxtImporteCredito.Text.ToDecimal
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteDebito.Text.ToDecimal > 0 Then
|
||||||
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(11, DdlCuentaTarjetaDebito.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteDebito.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto, SobranteFaltante:=SobranteFaltante)
|
||||||
SaldoPendienteVenta -= TxtImporteDebito.Text.ToDecimal
|
SaldoPendienteVenta -= TxtImporteDebito.Text.ToDecimal
|
||||||
SaldoPendientePagos -= TxtImporteDebito.Text.ToDecimal
|
SaldoPendientePagos -= TxtImporteDebito.Text.ToDecimal
|
||||||
PagoAplicado += TxtImporteDebito.Text.ToDecimal
|
PagoAplicado += TxtImporteDebito.Text.ToDecimal
|
||||||
@@ -790,14 +831,14 @@ Partial Class Ventas_PVCobranza
|
|||||||
Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}"
|
Obs = $"{VentaActual.SerieFolio} - Autorizó: {TxtAutorizo.Text}"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(3, DdlCuentaCheque.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteCheque.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, Obs:=Obs, CveAutorizacion:=TxtClaveAutorizacion.Text.Trim(), CveSubProyecto:=VentaActual.CveSubProyecto, SobranteFaltante:=SobranteFaltante)
|
||||||
SaldoPendienteVenta -= TxtImporteCheque.Text.ToDecimal
|
SaldoPendienteVenta -= TxtImporteCheque.Text.ToDecimal
|
||||||
SaldoPendientePagos -= TxtImporteCheque.Text.ToDecimal
|
SaldoPendientePagos -= TxtImporteCheque.Text.ToDecimal
|
||||||
PagoAplicado += TxtImporteCheque.Text.ToDecimal
|
PagoAplicado += TxtImporteCheque.Text.ToDecimal
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
If MsgError = "" AndAlso SaldoPendientePagos > 0 AndAlso TxtImporteTransferencia.Text.ToDecimal > 0 Then
|
||||||
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(8, DdlCuentaTransferencia.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteTransferencia.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto, SobranteFaltante:=SobranteFaltante)
|
||||||
SaldoPendienteVenta -= TxtImporteTransferencia.Text.ToDecimal
|
SaldoPendienteVenta -= TxtImporteTransferencia.Text.ToDecimal
|
||||||
SaldoPendientePagos -= TxtImporteTransferencia.Text.ToDecimal
|
SaldoPendientePagos -= TxtImporteTransferencia.Text.ToDecimal
|
||||||
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
|
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
|
||||||
@@ -815,7 +856,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
CveConceptroOtros = 8
|
CveConceptroOtros = 8
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
MsgError = RegistraIE(CveConceptroOtros, DdlCuentaOtrosContado.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteOtrosContado.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(CveConceptroOtros, DdlCuentaOtrosContado.SelectedValue.ToEntero, SaldoPendienteVenta, TxtImporteOtrosContado.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto, SobranteFaltante:=SobranteFaltante)
|
||||||
SaldoPendienteVenta -= TxtImporteOtrosContado.Text.ToDecimal
|
SaldoPendienteVenta -= TxtImporteOtrosContado.Text.ToDecimal
|
||||||
SaldoPendientePagos -= TxtImporteOtrosContado.Text.ToDecimal
|
SaldoPendientePagos -= TxtImporteOtrosContado.Text.ToDecimal
|
||||||
PagoAplicado += TxtImporteOtrosContado.Text.ToDecimal
|
PagoAplicado += TxtImporteOtrosContado.Text.ToDecimal
|
||||||
@@ -830,12 +871,12 @@ Partial Class Ventas_PVCobranza
|
|||||||
PagoEfectivo = SaldoPendientePagos
|
PagoEfectivo = SaldoPendientePagos
|
||||||
End If
|
End If
|
||||||
If SaldoPendienteVenta < 0 Then SaldoPendienteVenta = 0
|
If SaldoPendienteVenta < 0 Then SaldoPendienteVenta = 0
|
||||||
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, SaldoPendienteVenta, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
|
MsgError = RegistraIE(13, DdlCuentaEfectivo.SelectedValue.ToEntero, SaldoPendienteVenta, PagoEfectivo, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto, SobranteFaltante:=SobranteFaltante)
|
||||||
SaldoPendienteVenta -= PagoEfectivo
|
SaldoPendienteVenta -= PagoEfectivo
|
||||||
SaldoPendientePagos -= PagoEfectivo
|
SaldoPendientePagos -= PagoEfectivo
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If SaldoPendienteVenta > 0 Then
|
If SaldoPendienteVenta > 0 AndAlso Not ChkSobFaltante.Checked Then
|
||||||
MsgError = "Tiene saldo pendiente por aplicar"
|
MsgError = "Tiene saldo pendiente por aplicar"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -910,7 +951,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
GuardaLog(ex.ToString())
|
GuardaLog(ex.ToString())
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
If MsgError = "" Then
|
If MsgError = "" AndAlso Not ChkSobFaltante.Checked Then
|
||||||
If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=5, CveVenta:=CveVenta) Then
|
If ObjConta.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=5, CveVenta:=CveVenta) Then
|
||||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||||
GuardaLogAD($"Ventas/Ventas-NCGeneradas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
GuardaLogAD($"Ventas/Ventas-NCGeneradas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
|
||||||
@@ -918,6 +959,16 @@ Partial Class Ventas_PVCobranza
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso VentaContado Then
|
||||||
|
Dim SaldoPendiente As Decimal = 0
|
||||||
|
If ObjVentas2.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentas2.DtResultados.Rows.Count > 0 Then
|
||||||
|
SaldoPendiente = ObjVentas2.DtResultados.FiltroPrimeroValor("Saldo").ToDecimal()
|
||||||
|
End If
|
||||||
|
If SaldoPendiente > 0 Then
|
||||||
|
MsgError = "La factura tiene saldo pendiente por aplicar"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If MsgError = "" Then
|
If MsgError = "" Then
|
||||||
ObjVentas2.Commit()
|
ObjVentas2.Commit()
|
||||||
Dim msBuild As New StringBuilder()
|
Dim msBuild As New StringBuilder()
|
||||||
@@ -1183,6 +1234,8 @@ Partial Class Ventas_PVCobranza
|
|||||||
TxtAutorizo.Text = ""
|
TxtAutorizo.Text = ""
|
||||||
TxtNCDev.Text = ""
|
TxtNCDev.Text = ""
|
||||||
LtlTipoAnticipo.Text = ""
|
LtlTipoAnticipo.Text = ""
|
||||||
|
TxtFaltante.Text = ""
|
||||||
|
ChkSobFaltante.Checked = False
|
||||||
'HdnTipoAmortizacion.Value = ""
|
'HdnTipoAmortizacion.Value = ""
|
||||||
CveCliente = -1
|
CveCliente = -1
|
||||||
CveVendedor = -1
|
CveVendedor = -1
|
||||||
@@ -1614,7 +1667,7 @@ Partial Class Ventas_PVCobranza
|
|||||||
Return ObjTimbrado
|
Return ObjTimbrado
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImporteAbonoVenta As Decimal, ImporteBancos As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
|
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImporteAbonoVenta As Decimal, ImporteBancos As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1, Optional ByRef SobranteFaltante As Decimal = 0) As String
|
||||||
Dim Retorno As String = ""
|
Dim Retorno As String = ""
|
||||||
If CveBancoCuenta > 0 Then
|
If CveBancoCuenta > 0 Then
|
||||||
Dim CveIEPago As Integer = 0
|
Dim CveIEPago As Integer = 0
|
||||||
@@ -1626,14 +1679,54 @@ Partial Class Ventas_PVCobranza
|
|||||||
Obs = $"{Obs}. Folio: {VentaActual.SerieFolio}"
|
Obs = $"{Obs}. Folio: {VentaActual.SerieFolio}"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteBancos, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto)
|
Dim ImporteIE As Decimal = ImporteBancos.ToString().ToDecimal()
|
||||||
|
|
||||||
|
Dim Pago As New VentaPago
|
||||||
|
|
||||||
|
'SOBRANTE/FALTANTE
|
||||||
|
If ChkSobFaltante.Checked AndAlso SobranteFaltante <> 0 Then
|
||||||
|
'SOBRANTE
|
||||||
|
If SobranteFaltante > 0 Then
|
||||||
|
'SI ES EL SOBRANTE EN EFECTIVO SUMAR EL SOBRANTE/FALTANTE
|
||||||
|
If Metodo = 13 Then
|
||||||
|
ImporteIE += SobranteFaltante
|
||||||
|
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
|
||||||
|
'LIMPIAR SOBRANTE/FALTANTE
|
||||||
|
SobranteFaltante = 0
|
||||||
|
Else
|
||||||
|
'AJUSTAR DONDE EL IMPORTE A BANCOS SEA MAYOR EN EL DE LA VENTA
|
||||||
|
If ImporteBancos.RoundSQL(2) >= ImporteAbonoVenta.RoundSQL(2) Then
|
||||||
|
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
|
||||||
|
'LIMPIAR SOBRANTE/FALTANTE
|
||||||
|
SobranteFaltante = 0
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'FALTANTE
|
||||||
|
If SobranteFaltante < 0 Then
|
||||||
|
'METER LO QUE FALTA COMO GASTO
|
||||||
|
If (ImporteBancos.RoundSQL(2) + Math.Abs(SobranteFaltante)) = ImporteAbonoVenta.RoundSQL(2) Then
|
||||||
|
Pago.OtroGastoIngreso = SobranteFaltante.ToString().ToDecimal()
|
||||||
|
'LIMPIAR SOBRANTE/FALTANTE
|
||||||
|
SobranteFaltante = 0
|
||||||
|
'SUMAR AL PAGO
|
||||||
|
If ImporteBancos < ImporteAbonoVenta Then
|
||||||
|
ImporteBancos += Math.Abs(SobranteFaltante)
|
||||||
|
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 CveIEPago > 0 Then
|
If CveIEPago > 0 Then
|
||||||
Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura
|
Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura
|
||||||
|
|
||||||
If ImporteBancos > 0 Then
|
If ImporteIE > 0 Then
|
||||||
Dim Pago As New VentaPago
|
|
||||||
Pago.ImportePagoVenta = tImportePago
|
Pago.ImportePagoVenta = tImportePago
|
||||||
Pago.ImportePago = ImporteBancos
|
Pago.ImportePago = ImporteIE
|
||||||
Pago.CveIE = CveIEPago
|
Pago.CveIE = CveIEPago
|
||||||
Pago.CveMonedaPago = VentaActual.CveMoneda
|
Pago.CveMonedaPago = VentaActual.CveMoneda
|
||||||
Pago.Fecha = NowADS()
|
Pago.Fecha = NowADS()
|
||||||
|
|||||||
Reference in New Issue
Block a user