--FIX pago en dolares a facturas en dolares en cobranza

This commit is contained in:
2025-05-09 19:46:10 -07:00
parent 1d38df5484
commit b5398e9030
2 changed files with 68 additions and 27 deletions

View File

@@ -368,7 +368,7 @@
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" Width="100%"
EmptyDataText="No se encontraron Ventas con los filtros especificados" data-sort="true" ToolTip="Listado de Ventas"
CssClass="ScrollAD table table-striped table-hover Widthall mysmallbtn" data-heighterror="320" data-freezecols="0" data-freezerows="0" GridLines="None"
DataKeyNames="CveVenta,CveCliente,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago,PlazoCobranza">
DataKeyNames="CveVenta,CveCliente,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago,PlazoCobranza,CveMoneda,Moneda">
<Columns>
<%--<asp:BoundField HeaderText="Atención" DataField="AtencionA" />--%>
<asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="25%">
@@ -481,36 +481,29 @@
<div class="col-md-7">
<asp:Panel runat="server" ID="PnlContado" DefaultButton="BtnPagar" Visible="false">
<div class="row">
<div class="note note-success">
<div class="row">
<div class="col-md-2">
<b>Nombre:</b>
</div>
<div class="row" style="display: flex;">
<div class="col-md-1"><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>
<div class="col-md-1"><b>Folio:</b></div>
<div class="col-md-2">&nbsp;<label><asp:Literal ID="LtlFolio" runat="server"></asp:Literal></label>&nbsp;</div>
<div class="col-md-1">
<div class="col-md-2"><b>Folio:</b> &nbsp;<label><asp:Literal ID="LtlFolio" runat="server"></asp:Literal></label>&nbsp;</div>
<div class="col-md-4">
<b>
<asp:Literal ID="LtLTipoSaldo" runat="server" Text="Total:"></asp:Literal></b>
</div>
<div class="col-md-1">
<b>
<asp:TextBox ID="LtlSaldo" runat="server" Enabled="true" CssClass="TextBoxAsLabel" BorderStyle="None" BackColor="Transparent" ForeColor="#3c763d" Style="text-align: left"></asp:TextBox>
</b>
<asp:Literal ID="LtLTipoSaldo" runat="server" Text="Total:"></asp:Literal>
</b>&nbsp;
<asp:Literal ID="LtlSaldo" runat="server" Text=""></asp:Literal>
&nbsp;
<b>
<asp:Literal ID="LtlMoneda" runat="server"></asp:Literal></b>
</div>
<div class="col-md-1" style="text-align: right;">
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
</div>
</div>
</div>
</div>
<div class="row">
<div>
<div runat="server" id="DivContadoBancos" class="row" visible="True">
<div class="col-md-12">
<div class="chequesie1">
@@ -682,7 +675,7 @@
<div class="chequesie2">
<div class="row">
<div class="col-md-4" style="display: flex; align-items: center;">
<label style="font-weight: bold; font-size: medium;">Total:</label>
<label style="font-weight: bold; font-size: 13px;width: 90px;">Total:</label>
<div class="input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100%" ReadOnly="true" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
@@ -692,7 +685,7 @@
<div class="col-md-8">
<div class="row">
<div class="col-md-5" style="display: flex; align-items: center;">
<label id="lblCambio" runat="server" style="font-weight: bold; font-size: medium;">Cambio:</label>
<label id="lblCambio" runat="server" style="font-weight: bold; font-size: 13px;width: 60px;">Cambio:</label>
<div class="input-icon">
<i style="margin: 0px;">$</i>
<asp:HiddenField ID="HdnSobranteFaltante" Value="0" ClientIDMode="Static" runat="server" />
@@ -701,7 +694,7 @@
</div>
</div>
<div class="col-md-7" style="display: flex; align-items: center;">
<label style="font-weight: bold; font-size: medium;">Sob/falt:</label>
<label style="font-weight: bold; font-size: 13px;">Sob/falt:</label>
&nbsp;
<asp:CheckBox ID="ChkSobFaltante" runat="server" ClientIDMode="Static" />
<div class="input-icon" style="margin-left: 20px;">
@@ -713,6 +706,25 @@
</div>
</div>
</div>
<br />
<div id="DivUSD" runat="server" class="row" visible="false">
<div class="col-md-4" style="display: flex; align-items: center;">
<label style="font-weight: bold; font-size: 13px;width: 90px;">Total (MXN):</label>
<div class="input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtTotalMXN" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100%" ReadOnly="true" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTETotalMXN" runat="server" TargetControlID="TxtTotalMXN" FilterType="Custom, Numbers" ValidChars=".," />
</div>
</div>
<div class="col-md-4" style="display: flex; align-items: center;">
<label style="font-weight: bold; font-size: 13px; width: 60px;">TC:</label>
<div class="input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtTC" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ReadOnly="false" ClientIDMode="Static" Style="text-align: right; font-size: 14px;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTETC" runat="server" TargetControlID="TxtTC" FilterType="Custom, Numbers" ValidChars=".," />
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
@@ -727,6 +739,7 @@
<asp:HiddenField ID="HdnVentaCondicionesPago" runat="server" />
<asp:HiddenField ID="HdnCveIE" runat="server" />
<asp:HiddenField ID="HdnTotal" runat="server" ClientIDMode="Static" />
<asp:HiddenField ID="HdnMoneda" runat="server" ClientIDMode="Static" Value="1" />
<asp:Button ID="BtnPagar" CssClass="btn btn-large btn-success e-big-btn" runat="server" Text="Pagar" />
</div>
</div>
@@ -1239,7 +1252,7 @@
<input type="text" id="TxtBusquedaAnticipos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" style="display: flex; justify-content: end; font-size: 16px; font-weight: bold;">
<span>Total: </span>
@@ -1609,6 +1622,12 @@
}
$get("TxtImporteContado").value = FormatoNumero(total, 2);
//DOLARES
if ($get("HdnMoneda").value == "2") {
$get("TxtTotalMXN").value = FormatoNumero(ToDouble($get('TxtImporteContado').value) * ToDouble($get('TxtTC').value), 2);
}
}
function CalculaDiferencia() {

View File

@@ -517,6 +517,17 @@ Partial Class Ventas_PVCobranza
LtlNombre.Text = GvRow.DataKey("AtencionA")
LtlFolio.Text = GvRow.DataKey("SerieFolio")
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
LtlMoneda.Text = GvRow.DataKey("Moneda")
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
HdnMoneda.Value = CveMoneda.ToString()
If CveMoneda = 2 Then
DivUSD.Visible = True
TxtTC.Text = GlobalTipoCambio(Now).ToString()
TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero()
End If
HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago")
HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza")
@@ -1262,6 +1273,11 @@ Partial Class Ventas_PVCobranza
LtlTipoAnticipo.Text = ""
TxtFaltante.Text = ""
ChkSobFaltante.Checked = False
LtlMoneda.Text = ""
TxtTC.Text = ""
TxtTotalMXN.Text = ""
DivUSD.Visible = False
HdnMoneda.Value = "1"
'HdnTipoAmortizacion.Value = ""
CveCliente = -1
CveVendedor = -1
@@ -1318,7 +1334,7 @@ Partial Class Ventas_PVCobranza
ObjFactura.CveMoneda = VentaRemision.CveMoneda
If ObjFactura.CveMoneda = 2 Then
ObjFactura.TipoCambio = GlobalTipoCambio(Now).ToString().ToDecimal()
ObjFactura.TipoCambio = TxtTC.Text.ToDecimal()
Else
ObjFactura.TipoCambio = 1
End If
@@ -1699,6 +1715,9 @@ Partial Class Ventas_PVCobranza
Dim CveIEPago As Integer = 0
Dim ErrorConta As Boolean
Dim CveMonedaVenta As Integer = VentaActual.CveMoneda
Dim CveMonedaPago As Integer = CveMonedaVenta
If String.IsNullOrEmpty(Obs) Then
Obs = $"Folio: {VentaActual.SerieFolio}"
Else
@@ -1750,7 +1769,7 @@ Partial Class Ventas_PVCobranza
End If
If String.IsNullOrEmpty(Retorno) 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)
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImporteIE, CveMonedaPago, If(CveMonedaVenta = 1, 1, TxtTC.Text.ToDecimal()), Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto, Modulo:="PVCob")
If CveIEPago > 0 Then
Dim tImportePago As Decimal = If(ImporteBancos > ImporteAbonoVenta, ImporteAbonoVenta, ImporteBancos) 'toma el importe menor para la factura
@@ -1759,10 +1778,10 @@ Partial Class Ventas_PVCobranza
Pago.ImportePagoVenta = tImportePago
Pago.ImportePago = ImporteIE
Pago.CveIE = CveIEPago
Pago.CveMonedaPago = VentaActual.CveMoneda
Pago.CveMonedaPago = CveMonedaPago ' EL PAGO SIEMRE DEBE SER EN PESOS
Pago.Fecha = NowADS()
Pago.Referencia = VentaActual.SerieFolio
If Pago.CveMonedaPago > 1 Then Pago.TCPago = GlobalTipoCambio(Now).ToDecimal
Pago.TCPago = If(CveMonedaVenta = 1, 1, TxtTC.Text.ToDecimal())
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
End If
@@ -3092,6 +3111,9 @@ Partial Class Ventas_PVCobranza
Next
TxtCxCAplicado.Text = (SaldoCxC).FormatoNumero
TxtImporteContado.Text = (LtlSaldo.Text.ToDecimal + SaldoCxC).FormatoNumero
If DivUSD.Visible Then
TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero()
End If
RegistraScript("$('#divCxC').hide();", "AE21")
UPPCobranza.Update()
UPPTotalesContado.Update()