-- unificar a un solo campo de Tipo de cambio

This commit is contained in:
2023-10-27 10:34:59 -07:00
parent c21d0641c9
commit bceb1064f0
2 changed files with 24 additions and 37 deletions

View File

@@ -70,16 +70,10 @@
<asp:TextBox ID="TxtTC" runat="server" Text="1" placeholder="Tipo de Cambio" CssClass="form-control input-sm" MaxLength="12" onblur="CambiaPesosDolares();" Width="70px" ClientIDMode="Static" Style="text-align: right; display: inline-block;" />
<asp:RequiredFieldValidator ID="RFVTC" Enabled="false" runat="server" ControlToValidate="TxtTC" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Cambio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETC" runat="server" HighlightCssClass="vco" TargetControlID="RFVTC" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:Label ID="LbImporteME" Text="" ClientIDMode="Static" runat="server" />
</div>
<div class="col-md-5" runat="server" id="DivTCDolares" visible="false">
T.C:
<asp:TextBox ID="TxtTCDolares" runat="server" placeholder="Tipo de Cambio" CssClass="form-control input-sm" MaxLength="12" onkeyup="CambiaDolaresPesos();" Width="70px" ClientIDMode="Static" Style="text-align: right; display: inline-block;" />
<asp:RequiredFieldValidator ID="RFVTCDolares" Enabled="false" runat="server" ControlToValidate="TxtTCDolares" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Cambio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="server" HighlightCssClass="vco" TargetControlID="RFVTCDolares" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:Label ID="LbImporteMN" Text="" ClientIDMode="Static" runat="server" />
<asp:Label ID="LbImporteME" Text="" ClientIDMode="Static" runat="server" />
<asp:Label ID="LbImporteMN" Text="" ClientIDMode="Static" runat="server" />
</div>
<asp:Button ID="BtnCambiaTipoMoneda" Text="" OnClick="BtnCambiaTipoMoneda_Click" ClientIDMode="Static" Style="display: none;" runat="server" />
</div>
<div class="row" runat="server" id="DivTarjeta" visible="false">
<label class="col-xs-2 control-label">Tarjeta:</label>
@@ -701,9 +695,8 @@
debugger;
if ($("#LbImporteMN").length) {
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaValores(), 2) + ' MXN';
$get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) / ToDouble($get('TxtTCDolares').value), 2);
$get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTCDolares').value), 2);
$get('TxtImporte').value = FormatoNumero(ToDouble($get('TxtImporte').value.replace(',', '')) / ToDouble($get('TxtTC').value), 2);
$get('LtlTotalMXN').value = FormatoNumero(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTC').value), 2);
}
if ($get('TxtTotal') != null) {
@@ -718,11 +711,12 @@
var TipoCambioActual = 0.0;
function CambiaTC(txt) {
let TipoCambioTxt = ToDouble(txt.value)
if (TipoCambioActual != TipoCambioTxt) {
debugger;
//let TipoCambioTxt = ToDouble(txt.value)
//if (TipoCambioActual != TipoCambioTxt) {
$get("BtnCambiaTipoMoneda").click();
TipoCambioActual = TipoCambioTxt;
}
// TipoCambioActual = TipoCambioTxt;
//}
}
function calculaDescuentoEscalonado(saldo, TxtDescuento, TxtAbonar, chk,Text,Tipo) {

View File

@@ -252,7 +252,7 @@ Partial Class Bancos_ProveedoresAbonar
If UsuarioActual.TienePermisoProceso(98) Then
PermiteModificarImporte = False
End If
Calendario.StartDate = NowADS().AddMonths(-18)
Calendario.StartDate = NowADS().AddMonths(-24)
'proceso que restringue solo el pago de apartir del dia de hoy y como limite fin de mes
If UsuarioActual.TienePermisoProceso(105) Then
Calendario.StartDate = NowADS()
@@ -297,7 +297,7 @@ Partial Class Bancos_ProveedoresAbonar
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
Else
ChkPagarDolares.Visible = True
TxtTCDolares.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
End If
RegistraScript($"TipoCambioActual = {GlobalTipoCambio(NowADS()).FormatoNumero(4)}")
@@ -328,14 +328,9 @@ Partial Class Bancos_ProveedoresAbonar
If DivTC.Visible Then
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
RegistraScript("CambiaPesosDolares();")
If ChkPagarDolares.Checked Then RegistraScript("CambiaPesosDolares();")
If ChkPagarPesos.Checked Then RegistraScript("CambiaDolaresPesos();")
End If
If DivTCDolares.Visible Then
TxtTCDolares.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
RegistraScript("CambiaDolaresPesos();")
End If
UpDatos.Update()
End Sub
#Region " CARGA DATOS "
@@ -722,7 +717,7 @@ Partial Class Bancos_ProveedoresAbonar
CvePrePoliza = ObjMov.AddPrePolizas("Bancos/ProveedoresAbonar", 2, ImporteSeleccionado, ImporteSeleccionado, 1, TxtFechaDocumento.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, Nothing, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa))
If CveMoneda = 2 Then
TipoCambio = TxtTCDolares.Text.ToDecimal
TipoCambio = TxtTC.Text.ToDecimal
Else
If TxtTC.Visible Then
TipoCambio = TxtTC.Text.ToDecimal
@@ -794,13 +789,13 @@ Partial Class Bancos_ProveedoresAbonar
Pago.TCPago = 1 ' TxtTC.Text.ToDecimal
Pago.ImportePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * TxtTC.Text.ToDecimal).RoundSQL
ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
Pago.TCPago = TxtTCDolares.Text.ToDecimal
Pago.TCPago = TxtTC.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
Pago.TCPago = TxtTCDolares.Text.ToDecimal
Pago.ImportePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal / TxtTCDolares.Text.ToDecimal)
Pago.TCPago = TxtTC.Text.ToDecimal
Pago.ImportePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal / TxtTC.Text.ToDecimal)
End If
If ChkPagarPesos.Checked Then Pago.TCCambioMoneda = 1 / TxtTC.Text.ToDecimal
If ChkPagarDolares.Checked Then Pago.TCCambioMoneda = TxtTCDolares.Text.ToDecimal
If ChkPagarDolares.Checked Then Pago.TCCambioMoneda = TxtTC.Text.ToDecimal
If gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then
Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal
@@ -1149,9 +1144,9 @@ Partial Class Bancos_ProveedoresAbonar
End If
If CveMoneda = 2 Then
DivTCDolares.Visible = True
DivTC.Visible = True
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
TxtTCDolares.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
End If
End If
@@ -1356,7 +1351,6 @@ Partial Class Bancos_ProveedoresAbonar
Protected Sub ChkPagarPesos_CheckedChanged(sender As Object, e As EventArgs)
If ChkPagarPesos.Checked Then
DivTC.Visible = True
DivTCDolares.Visible = False
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
@@ -1374,13 +1368,12 @@ Partial Class Bancos_ProveedoresAbonar
#Region "PAGAR CON DOLARES"
Protected Sub ChkPagarDolares_CheckedChanged(sender As Object, e As EventArgs)
If ChkPagarDolares.Checked Then
DivTCDolares.Visible = True
'DivDolaresDolares.Visible = False
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
TxtTCDolares.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
Else
DivTCDolares.Visible = False
'DivDolaresDolares.Visible = False
CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
TxtFechaDocumento.Attributes.Remove("onchange")
@@ -1624,7 +1617,7 @@ Partial Class Bancos_ProveedoresAbonar
Private Sub RVTxtFechaDocumento_Init(sender As Object, e As EventArgs) Handles RVTxtFechaDocumento.Init
RVTxtFechaDocumento.MaximumValue = NowADS().ToShortDateString
RVTxtFechaDocumentoMenor.MinimumValue = NowADS().AddMonths(-18).ToShortDateString
RVTxtFechaDocumentoMenor.MinimumValue = NowADS().AddMonths(-24).ToShortDateString
RVTxtFechaDocumentoMenor.MaximumValue = NowADS().ToShortDateString
Calendario.EndDate = NowADS()