Cobro de caja, que se puedan registrar doble pago de tarjeta de Crédito/débito/transf.

This commit is contained in:
2024-12-24 14:56:10 -07:00
parent a528d0e0b4
commit 0576d261e8
2 changed files with 201 additions and 159 deletions

View File

@@ -331,10 +331,10 @@
DataKeyNames="CveVenta,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago,PlazoCobranza">
<Columns>
<%--<asp:BoundField HeaderText="Atención" DataField="AtencionA" />--%>
<asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label runat="server" ID="LblAtencionA" Font-Italic="true" Text='<%# Eval("AtencionA") %>' ></asp:Label><br />
<asp:Label runat="server" ID="Label4" Text='<%# Eval("NombreComercial") %>' ></asp:Label>
<asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label runat="server" ID="LblAtencionA" Font-Italic="true" Text='<%# Eval("AtencionA") %>'></asp:Label><br />
<asp:Label runat="server" ID="Label4" Text='<%# Eval("NombreComercial") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField HeaderText="Folio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" ItemStyle-HorizontalAlign="Center" />
@@ -401,7 +401,7 @@
<div class="row">
<div class="col-md-2">
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
&nbsp;
&nbsp;
<b>Nombre:</b>
</div>
<div class="col-md-4">&nbsp;<label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
@@ -553,42 +553,32 @@
</div>
</div>
<div class="chequesie1" runat="server" id="DivContadoOtros" visible="false">
<div class="row">
<asp:UpdatePanel class="chequesie1" runat="server" ID="UpContadoOtros" Visible="false" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-2">
<label>TD/TC/Trans.:</label>
</div>
<div class="col-md-4 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteOtrosContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FETxtImporteOtrosContado" runat="server" TargetControlID="TxtImporteOtrosContado" FilterType="Custom, Numbers" ValidChars=".," />
</div>
<div class="col-md-2">
<asp:DropDownList runat="server" ID="DdlOtroFormaPago" ClientIDMode="Static" AutoPostBack="true">
<asp:ListItem Value="-1">Otros</asp:ListItem>
<asp:ListItem Value="1">Credito</asp:ListItem>
<asp:ListItem Value="2">Debito</asp:ListItem>
<asp:ListItem Value="3">Cheque</asp:ListItem>
</asp:DropDownList>
<div class="col-md-2">
<asp:DropDownList runat="server" ID="DdlOtroFormaPago" CssClass="form-control input-sm select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlOtroFormaPago_SelectedIndexChanged">
<asp:ListItem Value="-1">Seleccione</asp:ListItem>
<asp:ListItem Value="1">Debito</asp:ListItem>
<asp:ListItem Value="2">Crédito</asp:ListItem>
<asp:ListItem Value="3">Transferencia</asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-4">
<asp:DropDownList ID="DdlCuentaOtrosContado" runat="server" CssClass="form-control input-sm select2me" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="100%"></asp:DropDownList>
</div>
</div>
<div class="col-md-4 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteOtrosContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FETxtImporteOtrosContado" runat="server" TargetControlID="TxtImporteOtrosContado" FilterType="Custom, Numbers" ValidChars=".," />
</div>
<div class="col-md-6" runat="server" id="DivContadoOtrosCuenta">
<asp:DropDownList ID="DdlCuentaOtrosContado" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="100%"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="DdlCuentaTarjetaCredito" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cuenta''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpAgregarPago"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender24" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator1" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-3" runat="server" id="DivMesesSinIntereses2" visible="false">
<asp:DropDownList ID="DdlMesesSinIntereses2" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="100%">
<asp:ListItem Value="-1">Meses</asp:ListItem>
<asp:ListItem Value="3">3M</asp:ListItem>
<asp:ListItem Value="6">6M</asp:ListItem>
<asp:ListItem Value="9">9M</asp:ListItem>
<asp:ListItem Value="12">12M</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="chequesie2">
<div class="row">
@@ -613,10 +603,10 @@
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="chequesie2" id="divPagar">
<div class="row">
<div class="col-md-12" style="text-align: center;">
@@ -666,11 +656,11 @@
<HeaderStyle CssClass="Titulos" />
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</asp:GridView>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="PanelIniciarTurno" TargetControlID="btnShow"
@@ -1276,152 +1266,154 @@
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="/Scripts/PrintJS/print.min.js"></script>
<script type="text/javascript">
//function impresionDirecta(urlPDF) {
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
//}
//function impresionDirecta(urlPDF) {
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
//}
function chkAnt(t, txt, importe, AmorContrato = 0) {
let totalAnt = 0;
function chkAnt(t, txt, importe, AmorContrato = 0) {
let totalAnt = 0;
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
//si es con.nc,es.el.total
let Total = ToDouble($get("C_LtlSaldo").value.replace(",",""));
//si es con.nc,es.el.total
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value.replace(",", "")).toFixed(2));
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value.replace(",", "")).toFixed(2));
if (t.checked) {
if (t.checked) {
if (SaldoCompra > 0) {
if (SaldoCompra > 0) {
if (AmorContrato > 0) {
txt.value = AmorContrato.toFixed(2);
} else {
txt.value = importe.toFixed(2);
}
totalAnt = FnSumaValoresAnt();
if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
//$get('HdnVentaSaldo').value = 0.00;
alert("El Importe no debe de exceder a el saldo");
}
if (AmorContrato > 0) {
txt.value = AmorContrato.toFixed(2);
} else {
txt.value = importe.toFixed(2);
}
totalAnt = FnSumaValoresAnt();
if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
//$get('HdnVentaSaldo').value = 0.00;
alert("El Importe no debe de exceder a el saldo");
t.checked = false;
}
} else {
t.checked = false;
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
txt.value = "";
}
} else {
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
txt.value = "";
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
}
function FnCambiaAnt(chk, txt, saldo) {
function FnCambiaAnt(chk, txt, saldo) {
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));// ToDouble($get('TxtSubTotal').value);
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));// ToDouble($get('TxtSubTotal').value);
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
if (TipoAnticipo == '4') {
Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
}
if (TipoAnticipo == '4') {
Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
}
if (isNaN(importeTxt)) {
importeTxt = 0;
} else {
if (importeTxt <= 0) {
if (isNaN(importeTxt)) {
importeTxt = 0;
chk.checked = false;
return;
} else {
if (importeTxt <= 0) {
importeTxt = 0;
chk.checked = false;
return;
}
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
// $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
function FnSumaValoresAnt() {
let totalPoints = 0;
let t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
return Math.round(totalPoints * 100) / 100;
}
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
// $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
function FnSumaValoresAnt() {
let totalPoints = 0;
let t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
return Math.round(totalPoints * 100) / 100;
}
function impresionBase64(pdfBase64) {
printJS({ printable: pdfBase64, type: 'pdf', showModal: true, base64: true });
}
function CalculaTotalPagoContado() {
let totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
let totalCredito = ToDouble($get("TxtImporteCredito").value);
let totalDebito = ToDouble($get("TxtImporteDebito").value);
let totalCheque = ToDouble($get("TxtImporteCheque").value);
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
let TotalOtrosContado = 0;
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado;
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
let totalAnticipos = ToDouble($get("TxtNCDev").value);
total = total + totalAnticipos;
function impresionBase64(pdfBase64) {
printJS({ printable: pdfBase64, type: 'pdf', showModal: true, base64: true });
}
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
function CalculaTotalPagoContado() {
let totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
let totalCredito = ToDouble($get("TxtImporteCredito").value);
let totalDebito = ToDouble($get("TxtImporteDebito").value);
let totalCheque = ToDouble($get("TxtImporteCheque").value);
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
let TotalOtrosContado = 0;
if (total > totalVenta) {
lblCambio.innerHTML = "Cambio:";
//HdnCambioFaltante.value = "1";
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
} else {
lblCambio.innerHTML = "Faltante:";
//HdnCambioFaltante.value = "0";
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia;
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
let totalAnticipos = ToDouble($get("TxtNCDev").value);
TotalOtrosContado = ToDouble($get("TxtImporteOtrosContado").value);
total = total + totalAnticipos + TotalOtrosContado;
}
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
if (total > totalVenta) {
lblCambio.innerHTML = "Cambio:";
//HdnCambioFaltante.value = "1";
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
} else {
lblCambio.innerHTML = "Faltante:";
//HdnCambioFaltante.value = "0";
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
}
$get("TxtImporteContado").value = FormatoNumero(total, 2);
}
$get("TxtImporteContado").value = FormatoNumero(total, 2);
}
function CalculaDiferencia() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
}
function CalculaDiferencia() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
}
function CalculaDiferenciaBloqueo() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
}
function CalculaDiferenciaBloqueo() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
}

View File

@@ -109,6 +109,8 @@ Partial Class Ventas_PVCobranza
If UsuarioActual.CveEmpresa = 189 Then
DivDatosCheque.Visible = True
UpContadoOtros.Visible = True
UpContadoOtros.Update()
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
@@ -458,7 +460,7 @@ Partial Class Ventas_PVCobranza
If VentaContado Then
'validaciones
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.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()
If Pagado = 0 Then
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
Exit Sub
@@ -485,6 +487,18 @@ Partial Class Ventas_PVCobranza
Exit Sub
End If
End If
If TxtImporteOtrosContado.Text.ToDecimal() > 0 Then
If DdlOtroFormaPago.SelectedValue.ToEntero() <= 0 Then
Alert("Es necesario especificar la forma de pago adicional", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlCuentaOtrosContado.SelectedValue.ToEntero() <= 0 Then
Alert("Es necesario especificar la cuenta de la forma de pago adicional", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
Dim tCveCorte As Integer = CveCorte
@@ -626,6 +640,23 @@ Partial Class Ventas_PVCobranza
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteOtrosContado.Text.ToDecimal > 0 Then
Dim CveConceptroOtros As Integer = -1
Select Case DdlOtroFormaPago.SelectedValue
Case "1" 'Debito
CveConceptroOtros = 11
Case "2" 'Crédito
CveConceptroOtros = 12
Case "3" 'Transferencia
CveConceptroOtros = 8
End Select
MsgError = RegistraIE(CveConceptroOtros, DdlCuentaOtrosContado.SelectedValue.ToEntero, TxtImporteOtrosContado.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteOtrosContado.Text.ToDecimal
PagoAplicado += TxtImporteOtrosContado.Text.ToDecimal
End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
@@ -2034,4 +2065,23 @@ Partial Class Ventas_PVCobranza
End If
End Sub
Protected Sub DdlOtroFormaPago_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim DtCC As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
Dim CveMon As Integer = 1
If DdlOtroFormaPago.SelectedValue.Contiene("1", "2") Then
DdlCuentaOtrosContado.dataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon))
ElseIf DdlOtroFormaPago.SelectedValue.Contiene("3") Then
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(195, 197) Then
DdlCuentaOtrosContado.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(CveMon <= 0, 1, CveMon)))
Else
DdlCuentaOtrosContado.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(CveMon <= 0, 1, CveMon)))
End If
End If
DdlCuentaOtrosContado.DataBind()
UpContadoOtros.Update()
End Sub
End Class