0 - Conta: Aplicación de pago a proveedores en pesos y dólares con una misma cuenta, ej. SCHNEIDER ELECTRIC MEXICO

This commit is contained in:
2025-01-15 21:12:30 -07:00
parent bc94bb9a12
commit 5b282abf7f
5 changed files with 270 additions and 103 deletions

View File

@@ -99,6 +99,14 @@ Partial Class Bancos_ProveedoresAbonar
End Set
End Property
Public Property FiltrarCuentas As Integer
Get
Return If(IsNothing(ViewState("FiltrarCuentas")), 1, ViewState("FiltrarCuentas").ToString.ToEntero)
End Get
Set(value As Integer)
ViewState("FiltrarCuentas") = value
End Set
End Property
Private Property CveMonedaFiltro As Integer
Get
Return ViewState("CveMonedaFiltro").ToString.ToEntero
@@ -247,6 +255,7 @@ Partial Class Bancos_ProveedoresAbonar
CveClasificacionProveedor = IfNull(Request("CveClasificacion"), "-1").ToString.ToEntero
CveMoneda = IfNull(Request("CveMoneda"), "-1").ToString.ToEntero
CveMonedaFiltro = IfNull(Request("CveMoneda"), "-1").ToString.ToEntero
FiltrarCuentas = IfNull(Request("FiltrarCuentas"), "1").ToString.ToEntero
CveEstatus = IfNull(Request("CveEstatus"), "-1").ToString.ToEntero
Serie = IfNull(Request("Serie"), "").ToString
CveAplicaNC = IfNull(Request("CveAplicaNC"), "-1").ToString.ToEntero
@@ -254,7 +263,6 @@ Partial Class Bancos_ProveedoresAbonar
CodigoProgramacion = IfNull(Request("CodigoProgramacion"), "-1").ToString
CveSubProyectoFiltro = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero
TxtOtrosImportes.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1});", "TxtTotal", 0))
'proceso para que solo pague lo que este programada
@@ -300,13 +308,25 @@ Partial Class Bancos_ProveedoresAbonar
LbTipoMoneda.Text = String.Format("Pago en {0}", GlobalDTMonedas.FiltraParametros(String.Format("CveMoneda = {0}", CveMoneda)).Rows(0)("Moneda"))
End If
If CveMoneda = 2 Then
ChkPagarPesos.Visible = True
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
'SI NO ES GDIAZ, NO PERMITIR LA MEZCLA DE CUENTAS
If UsuarioActual.Empresa.Funcionalidad(382) <> "1" AndAlso FiltrarCuentas = 0 Then
FiltrarCuentas = 1
End If
If FiltrarCuentas = 0 Then
ChkPagarPesos.Visible = False
ChkPagarDolares.Visible = False
CveMonedaFiltro = -1
Else
ChkPagarDolares.Visible = True
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
If CveMoneda = 2 Then
ChkPagarPesos.Visible = True
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
Else
ChkPagarDolares.Visible = True
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
End If
End If
RegistraScript($"TipoCambioActual = {GlobalTipoCambio(NowADS()).FormatoNumero(4)}")
@@ -324,7 +344,7 @@ Partial Class Bancos_ProveedoresAbonar
If UsuarioActual.TienePermisoProceso(361) Then
'GvCxP.Columns(11).Visible = True
chkaplicaDescuento.Visible = True
'chkaplicaDescuentoMasivo.Visible = True
chkaplicaDescuentoMasivo.Visible = True
End If
@@ -367,23 +387,27 @@ Partial Class Bancos_ProveedoresAbonar
Private Sub CargaDatos(Optional tCveMoneda As Integer = -1) 'pCveProveedor As Integer, tCveMoneda As Integer, FechaVencimientoInicio As String, FechaVencimientoFin As String, CveUsuarioRegistro As Integer, CveUsuarioPrograma As Integer, Serie As String)
If tCveMoneda = -1 Then tCveMoneda = CveMoneda
Dim Mov As New ClsMovimientos
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso FiltrarCuentas = 0 Then
tCveMoneda = -1
End If
TxtObservaciones.Text = ""
TxtImporte.Text = ""
TxtTotal.Text = ""
If Mov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion, CveSubProyecto:=CveSubProyectoFiltro) Then
DtDatos = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio")
Dim ObjMov As New ClsMovimientos
If ObjMov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion, CveSubProyecto:=CveSubProyectoFiltro) Then
DtDatos = ObjMov.DtResultados.FiltraParametros("CveCompra > 0 AND Saldo > 0", "Fecha,SerieFolio")
GvCxP.DataSource = DtDatos
DtDatos.Columns.Add("Movimiento")
If DtDatos.Rows.Count > 0 Then
DVBusqueda.Visible = True
DtDatos.Rows(0)("Movimiento") = "FACTURA DE ACREEDOR"
End If
End If
ObjMov.Dispose()
Mov.Dispose()
GvCxP.DataBind()
UPCompras.Update()
UpBusqueda.Update()
@@ -473,6 +497,8 @@ Partial Class Bancos_ProveedoresAbonar
e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("Folio")
End If
e.Row.FCTextBox("TxtAbonar").Attributes.Add("CveMoneda", e.Row.DBCampo("CveMoneda"))
If e.Row.DBCampo("CveCompra").ToEntero > 0 Then
Dim FiltroInv As String = ""
@@ -643,6 +669,10 @@ Partial Class Bancos_ProveedoresAbonar
Dim ValidaSAT As Boolean = True
If UsuarioActual.Empresa.Funcionalidad(529) = "1" OrElse ChkNoValidaSAT.Checked Then ValidaSAT = False
If Not EsProduccion Then
ValidaSAT = False
End If
If ValidaSAT Then
Dim Validada As Boolean = False
Dim MsgValidadas As New StringBuilder
@@ -1117,18 +1147,22 @@ Partial Class Bancos_ProveedoresAbonar
DdlCuenta.Items.Clear()
Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
If ChkPagarPesos.Checked Then
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1))
RegistraScript("CambiaPesosDolares();")
ElseIf ChkPagarDolares.Checked Then
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 2))
RegistraScript("CambiaDolaresPesos();")
Else
If CveMonedaFiltro > 0 Then
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", CveMonedaFiltro))
If FiltrarCuentas = 1 Then
If ChkPagarPesos.Checked Then
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1))
RegistraScript("CambiaPesosDolares();")
ElseIf ChkPagarDolares.Checked Then
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 2))
RegistraScript("CambiaDolaresPesos();")
Else
If CveMonedaFiltro > 0 Then
dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", CveMonedaFiltro))
End If
End If
End If
If TipoPago = 3 Then
dt = dt.FiltraParametros("CveTipoCuenta = 7")
End If
@@ -1148,8 +1182,32 @@ Partial Class Bancos_ProveedoresAbonar
End Sub
Protected Sub DdlCuenta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuenta.SelectedIndexChanged
'recargo la moneda con la que se va a pagar
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuenta.SelectedValue))
If FiltrarCuentas = 0 Then
If dr("CveMoneda").ToString() = "2" Then
ChkPagarDolares.Visible = True
ChkPagarDolares.Checked = True
ChkPagarDolares.Enabled = False
ChkPagarPesos.Visible = False
ChkPagarPesos.Checked = False
Else
ChkPagarPesos.Visible = True
ChkPagarPesos.Checked = True
ChkPagarPesos.Enabled = False
ChkPagarDolares.Visible = False
ChkPagarDolares.Checked = False
End If
TxtTC.Text = GlobalTipoCambio(NowADS()).FormatoNumero(4)
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
End If
'recargo la moneda con la que se va a pagar
If dr IsNot Nothing Then
TxtFechaDocumento.Attributes.Remove("onchange")
UpDatos.Update()
@@ -1673,11 +1731,17 @@ Partial Class Bancos_ProveedoresAbonar
Protected Sub chkaplicaDescuento_CheckedChanged(sender As Object, e As EventArgs)
GvCxP.Columns(11).Visible = chkaplicaDescuento.Checked
TxtDescuenoMasivo.Visible = chkaplicaDescuento.Checked
UPCompras.Update()
End Sub
Protected Sub chkaplicaDescuentoMasivo_CheckedChanged(sender As Object, e As EventArgs)
GvCxP.Columns(11).Visible = chkaplicaDescuentoMasivo.Checked
TxtDescuenoMasivo.Visible = chkaplicaDescuentoMasivo.Checked
UPCompras.Update()
End Sub
Private Sub tmpValida()
Dim ValidaSAT As Boolean = True