IE Pago de anticipos de OC en dolares con pesos

This commit is contained in:
rakcsle
2021-12-13 09:37:29 -07:00
parent 90d3d47d0b
commit d75b5adb5c
2 changed files with 150 additions and 3 deletions

View File

@@ -123,20 +123,48 @@
<asp:HiddenField ID="HdnTipoTransaccion" runat="server" Value="" />
</div>
<asp:Label CssClass="col-md-1" Text="" ID="LbTipoMoneda" runat="server" />
<div class="col-md-2" id="DVPAgoEnPesos" runat="server" visible ="false">
<asp:CheckBox Text="Pagar con pesos" TextAlign="Right" Visible="false" AutoPostBack="true" ID="ChkPagarPesos" OnCheckedChanged="ChkPagarPesos_CheckedChanged" runat="server" ClientIDMode="Static" />
<%--<asp:CheckBox Text="Pagar con dolares" TextAlign="Right" Visible="false" AutoPostBack="true" ID="ChkPagarDolares" runat="server" OnCheckedChanged="ChkPagarDolares_CheckedChanged" ClientIDMode="Static" />--%>
</div>
</div>
<div class="row">
<label class="col-md-2 control-label">Cuenta:</label>
<div class="col-md-5">
<div class="col-md-4">
<asp:Label ID="LblCuenta" runat="server" Text=""></asp:Label>
<asp:DropDownList ID="DdlCuenta" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" ValidationGroup="GrpGuardar">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVCuenta" runat="server" ControlToValidate="DdlCuenta" 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="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCuenta" runat="server" HighlightCssClass="vco" TargetControlID="RFVCuenta" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-2">
<div class="col-md-1">
<asp:Label ID="LblEstatusIE" runat="server" Text="Activo" Visible="false"></asp:Label>
<asp:DropDownList runat="server" CssClass="form-control input-sm select2me" ID="DdlEstatusIE" DataValueField="CveEstatusIE" DataTextField="EstatusIE" AutoPostBack="false"></asp:DropDownList>
</div>
<div class="col-md-2" runat="server" id="DivTC" visible="false">
T.C.:
<asp:TextBox ID="TxtTC" runat="server" Text="1" placeholder="Tipo de Cambio" CssClass="form-control input-sm" MaxLength="12" onblur="CambiaTCPagoOC();" 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 style="display:none">
<asp:Button ID="LnkActualizaTCOC" ClientIDMode="Static" runat="server" Text="Actaulziar" OnClick="LnkActualizaTCOC_Click" ></asp:Button>
</div>
</div>
<div class="col-md-2" runat="server" id="DivTC2" visible="false">
Dolares
<asp:TextBox ID="TxtImporteDolares" runat="server" Text="1" placeholder="Dolares" CssClass="form-control input-sm" MaxLength="12" Width="70px" ClientIDMode="Static" Style="text-align: right; display: inline-block;" />
<%--<asp:Label ID="Label1" Text="" ClientIDMode="Static" runat="server" />--%>
</div>
</div>
<div class="row" id="DivCheques" runat="server" visible="false">
<label class="col-md-2 control-label">Movimiento Relacionado:</label>
@@ -1781,5 +1809,10 @@
return false;
}
function CambiaTCPagoOC() {
$("#LnkActualizaTCOC").click();
}
</script>
</asp:Content>

View File

@@ -297,6 +297,17 @@ Partial Class Bancos_IE
End Set
End Property
Private Property CveMonedaOriginal As Integer
Get
Return ViewState("CveMonedaOriginal").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveMonedaOriginal") = value
End Set
End Property
Private Property CveOCSolicitudAnticipo As Integer
Get
@@ -504,6 +515,22 @@ Partial Class Bancos_IE
End Set
End Property
Private Property ImporteOriginalDolaras As Decimal
Get
If ViewState("ImporteOriginalDolaras") Is Nothing Then
Return 0
Else
Return ViewState("ImporteOriginalDolaras").ToString().ToDecimal()
End If
End Get
Set(value As Decimal)
ViewState("ImporteOriginalDolaras") = value
End Set
End Property
#Region "CANCELACIÓN COMPLEMENTO MODAL V2"
Property CveComplementoPagoCancelar As Integer
@@ -2471,6 +2498,9 @@ Partial Class Bancos_IE
If CveOCSolicitudAnticipo > 0 Then
Dim ObjOC As New ClsOC
If ObjOC.GetOCAnticipoSaldo(CveOCSolicitudAnticipo, UsuarioActual.CveEmpresa) Then
SaldoOCAnticipo = ObjOC.DtResultados(0)("Saldo").ToString.ToDecimal
@@ -2479,10 +2509,18 @@ Partial Class Bancos_IE
End If
ObjOC.Dispose()
If TxtImporte.Text.ToDecimal > SaldoOCAnticipo Then
Dim ImporteComparacion As Decimal = TxtImporte.Text.ToDecimal
'
If ChkPagarPesos.Checked Then
ImporteComparacion = ImporteOriginalDolaras
End If
If ImporteComparacion > SaldoOCAnticipo Then
EsValido = False
Alert($"El importe del movimiento es mayor al saldo de la orden de compra importe movmiento {TxtImporte.Text.FormatoNumero } saldo orden de compra: {SaldoOCAnticipo.ToString.FormatoNumero}", TipoMensaje.MsgAdvertencia)
End If
End If
Return EsValido
@@ -5557,11 +5595,23 @@ Partial Class Bancos_IE
Else
TxtImporte.Text = DrOC("ImporteAnticipo").ToString.FormatoNumero
TxtImporteLetra.Text = DrOC("ImporteAnticipo").ToString.ToDouble.Texto2Letras(DrOC("CveMoneda").ToString.ToEntero)
ImporteOriginalDolaras = DrOC("ImporteAnticipo").ToString.ToDecimal
End If
DdlMoneda.SelectedValue = DrOC("CveMoneda").ToString
CveMoneda = DrOC("CveMoneda").ToString.ToEntero
CargaCuenta(DrOC("CveMoneda").ToString.ToEntero)
CveMonedaOriginal = DrOC("CveMoneda").ToString.ToEntero
If CveMonedaOriginal > 1 Then
MostrarPagoEnPesos(True)
End If
UpCuentaDeposito.Update()
If DrOC("CveProveedor").ToString.ToEntero > 0 Then
HdnCveProveedor.Value = DrOC("CveProveedor").ToString
@@ -5644,6 +5694,69 @@ Partial Class Bancos_IE
End If
End Sub
Private Sub MostrarPagoEnPesos(Mostrar As Boolean)
LbTipoMoneda.Visible = Mostrar
LbTipoMoneda.Text = If(Mostrar, "Pago en doalres", "")
DVPAgoEnPesos.Visible = Mostrar
ChkPagarPesos.Visible = Mostrar
TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
End Sub
Protected Sub ChkPagarPesos_CheckedChanged(sender As Object, e As EventArgs)
If ChkPagarPesos.Checked Then
DivTC.Visible = True
DivTC2.Visible = True
' DivDolaresDolares.Visible = False
'CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
CargaCuenta(1)
'TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
'TxtTC.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
TxtImporteDolares.Text = TxtImporte.Text
'TxtImporteDolares.Text = TxtImporte.Text
'TxtImporte.Text = (TxtImporte.Text.ToDecimal * (TxtTC.Text.ToDecimal)).ToString("###,###,###.00")
CveMoneda = 1
Else
DivTC.Visible = False
DivTC2.Visible = False
CveMoneda = CveMonedaOriginal
'DivDolaresDolares.Visible = True
'CargaCuentas(DdlTipoTransaccion.SelectedValue.ToEntero)
CargaCuenta(CveMonedaOriginal)
'TxtFechaDocumento.Attributes.Remove("onchange")
TxtImporte.Text = ImporteOriginalDolaras.ToString("###,###,###.00")
End If
CambiaTCPagoOC()
UpDatos.Update()
' RegistraScript("CambiaPesosDolares();")
End Sub
Public Sub CambiaTCPagoOC()
If ChkPagarPesos.Checked Then
TxtImporte.Text = (TxtImporteDolares.Text.ToDecimal * (TxtTC.Text.ToDecimal)).ToString("###,###,###.00")
Else
TxtImporte.Text = TxtImporteDolares.Text
End If
UpDatos.Update()
End Sub
Protected Sub LnkActualizaTCOC_Click(sender As Object, e As EventArgs)
CambiaTCPagoOC()
End Sub
Private Function GuardaSolicitudAnticipoOC(ByRef ObjOC As ClsOC) As String
Dim ObjOI As New ClsOIEventos
Dim CveEvento As Integer = 0
@@ -6724,4 +6837,5 @@ Partial Class Bancos_IE
RVTxtFechaDocumento.MaximumValue = DateTime.Now.ToShortDateString
Calendario.EndDate = DateTime.Now
End Sub
End Class