-- correción de guardar el banco!

This commit is contained in:
2025-05-15 14:57:05 -07:00
parent 7924558a00
commit c0cd10104a

View File

@@ -6,10 +6,6 @@ Imports System.IO
Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports System.Globalization
Partial Class RH_Personal
Inherits ClsPaginas
@@ -2137,7 +2133,7 @@ Partial Class RH_Personal
If Not ObjCuentasDeposito.AddCuentasDepositos(row("BancoNombre").ToString(), row("Plaza").ToString(), row("Sucursal").ToString(), row("Cuenta").ToString(), row("CLABE").ToString(),
row("CIE").ToString(), row("SWIFT").ToString(), row("Referencia").ToString(), row("RefCrediProveedor").ToString(), UsuarioActual.CveUsuario,
row("CveMoneda").ToString().ToEntero(), UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal, CveUsuarioModifico:=UsuarioActual.CveUsuario,
BBVAAlias:=row("BBVAAlias").ToString(), EstatusPagoElectronico:=Boolean.Parse(row("EstatusPagoElectronico").ToString),
CveSATBanco:=row("CveSATBanco").ToString.ToEntero, BBVAAlias:=row("BBVAAlias").ToString(), EstatusPagoElectronico:=Boolean.Parse(row("EstatusPagoElectronico").ToString),
EstatusPagoElectronicoGrupos:=Boolean.Parse(row("EstatusPagoElectronicoGrupos").ToString), Correo:=row("Correo").ToString(),
ConceptoCIE:=row("ConceptoCIE").ToString(), Estatus:=If(row("EstatusTexto").ToString = "Activo", True, False)) Then
TieneError = True
@@ -3095,8 +3091,6 @@ Partial Class RH_Personal
End If
End Sub
#End Region
Protected Sub DdlEstatusPersonal_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEstatusPersonal.SelectedIndexChanged
MostrarOcultarFechasEstatus()
@@ -3133,8 +3127,6 @@ Partial Class RH_Personal
End If
e.Row.FCLinkButton("LBCancelar").Visible = True
e.Row.FCLinkButton("LBCancelar").CommandArgument = e.Row.DBCampo("FolioFiscal")
@@ -3153,7 +3145,6 @@ Partial Class RH_Personal
e.Row.FCLinkButton("LBCancelar").Visible = True
e.Row.FCLinkButton("LBCancelar").CommandArgument = e.Row.DBCampo("FolioFiscal")
End If
End If
End Sub
@@ -3354,11 +3345,8 @@ Partial Class RH_Personal
e.Row.FCLabel("LtlC").CssClass = "label label-sm label-warning"
e.Row.FCLabel("LtlC").ForeColor = Drawing.Color.White
End If
End If
End Sub
Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click
If DtCuentasContables Is Nothing Then
CargaCuentasContables()
@@ -3377,10 +3365,6 @@ Partial Class RH_Personal
DdlPrestamos.DataSource = DtCuentasContables : DdlPrestamos.DataBind() : DdlPrestamos.SelectedValueExist(SeleccionadoContPrestamos)
DdlPrestamos.AutoPostBack = False : DdlPrestamos.Attributes.Remove("onclick") : DdlPrestamos.CssClass &= " select2me"
End Select
End Sub
#Region "TAB BANCOS"
Private Sub CargaMonedas()
@@ -3417,10 +3401,6 @@ Partial Class RH_Personal
TxtCorreoCuenta.Text = ""
TxtBBVAAlias.Text = ""
ChkPagoElectronicoGrupos.Checked = False
UpAddBancos.Update()
End Sub
@@ -3441,6 +3421,7 @@ Partial Class RH_Personal
Else
If IndexCuentaDepostito > -1 Then
Dim Row As DataRow = TempDTCuentasBancos.Rows(IndexCuentaDepostito)
Row("CveSATBanco") = DdlBancoSat.SelectedValue.ToEntero()
Row("BancoNombre") = nombrebanco
Row("Cuenta") = TxtNumeroCuenta.Text.Trim
Row("Sucursal") = TxtNumeroSucursal.Text
@@ -3460,7 +3441,6 @@ Partial Class RH_Personal
Row("Correo") = TxtCorreoCuenta.Text.Trim
Row("ConceptoCIE") = TxtConceptoCIE.Text
Row("EstatusTexto") = If(ChkEstatuscuenta.Checked, "Activo", "Inactivo")
End If
End If
@@ -3504,7 +3484,6 @@ Partial Class RH_Personal
Exit Sub
End If
If ChkPagoElectronicoGrupos.Checked Then
If TxtConvenioCIE.Text.Trim.Length > 0 Then
@@ -3518,15 +3497,8 @@ Partial Class RH_Personal
Alert("Se debe de especificar el banco.")
Exit Sub
End If
End If
End If
''CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
'If EsBancomer AndAlso Not (TxtNumeroCuenta.Text.Trim.Length = 10 Or TxtConvenioCIE.Text.Trim.Length = 6) Then
' Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia)
@@ -3562,8 +3534,6 @@ Partial Class RH_Personal
Private Sub AgregarCuentaBanco(NombreBanco As String, NumeroSucursal As String, CLABE As String, SWIFT As String, Plaza As String, NumeroCuenta As String, ConvenioCIE As String, Referencia As String, RefCrediProveedor As String, CveMoneda As Integer,
Moneda As String, Estatus As Boolean, Correo As String, BBVAAlias As String, CveSATBanco As Integer, EstatusPagoElectronico As Boolean, EstatusPagoElectronicoGrupos As Boolean, ConceptoCIE As String)
If CvePersonal > 0 Then
Using ObjCuentasBancos As New ClsGenerales()
@@ -3582,6 +3552,7 @@ Partial Class RH_Personal
If IndexCuentaDepostito > -1 Then
Dim Row As DataRow = TempDTCuentasBancos.Rows(IndexCuentaDepostito)
Row("CveSATBanco") = CveSATBanco
Row("BancoNombre") = NombreBanco
Row("Sucursal") = NumeroSucursal
Row("CLABE") = CLABE
@@ -3594,7 +3565,6 @@ Partial Class RH_Personal
Row("CveMoneda") = CveMoneda
Row("Moneda") = Moneda
Row("BBVAAlias") = BBVAAlias
Row("CveSATBanco") = CveSATBanco
Row("EstatusPagoElectronico") = EstatusPagoElectronico
Row("EstatusPagoElectronicoGrupos") = EstatusPagoElectronicoGrupos
Row("Correo") = Correo
@@ -3603,6 +3573,7 @@ Partial Class RH_Personal
Else
Dim Row As DataRow = TempDTCuentasBancos.NewRow
Row("CveSATBanco") = CveSATBanco
Row("BancoNombre") = NombreBanco
Row("Sucursal") = NumeroSucursal
Row("CLABE") = CLABE
@@ -3615,18 +3586,13 @@ Partial Class RH_Personal
Row("CveMoneda") = CveMoneda
Row("Moneda") = Moneda
Row("BBVAAlias") = BBVAAlias
Row("CveSATBanco") = CveSATBanco
Row("EstatusPagoElectronico") = EstatusPagoElectronico
Row("EstatusPagoElectronicoGrupos") = EstatusPagoElectronicoGrupos
Row("Correo") = Correo
Row("ConceptoCIE") = ConceptoCIE
TempDTCuentasBancos.Rows.Add(Row)
Row("EstatusTexto") = If(ChkEstatuscuenta.Checked, "Activo", "Inactivo")
End If
End If
LimpiaCuentasBancarias()
@@ -3712,9 +3678,7 @@ Partial Class RH_Personal
TxtCLABECB.Text = gvrow.DataKey("CLABE")
ChkEstatusPagoE.Checked = gvrow.DataKey("EstatusPagoElectronico").ToUpper().Contiene("TRUE", "1")
ChkEstatuscuenta.Checked = gvrow.DataKey("EstatusTexto").ToUpper().Contiene("TRUE", "1", "ACTIVO")
'CveCuentaDeposito,BancoNombre,Sucursal,Cuenta,CLABE,SWIFT,Plaza,CIE,Referencia,RefCrediProveedor,CveMoneda,Estatus,Correo,BBVAAlias,EstatusPagoElectronico,EstatusPagoElectronicoGrupos,CveSATBanco,ConceptoCIE
'DdlBancoSat
TxtNombreBanco.Text = gvrow.DataKey("BancoNombre")
TxtNumeroSucursal.Text = gvrow.DataKey("Sucursal")
TxtSWIFT.Text = gvrow.DataKey("SWIFT")
@@ -3728,18 +3692,10 @@ Partial Class RH_Personal
ChkPagoElectronicoGrupos.Checked = Boolean.Parse(gvrow.DataKey("EstatusPagoElectronicoGrupos").ToString)
ChkEstatuscuenta.Checked = If(gvrow.DataKey("EstatusTexto").ToString = "Activo", True, False)
'CveCuentaDeposito,BancoNombre,Sucursal,Cuenta,CLABE,SWIFT,Plaza,CIE,Referencia,RefCrediProveedor,CveMoneda,Estatus,Correo,BBVAAlias,EstatusPagoElectronico,EstatusPagoElectronicoGrupos,CveSATBanco,ConceptoCIE,EstatusTexto
'asdasd
UpAddBancos.Update()
RegistraScript("$('#DivAddCuentasBancarias').modal();")
End Sub
Protected Sub GvBancosCuentas_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvBancosCuentas.RowEditing
GvBancosCuentas.EditIndex = e.NewEditIndex
CargaGridCuentasBancos("")
End Sub
@@ -3747,97 +3703,7 @@ Partial Class RH_Personal
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos("")
End Sub
Protected Sub GvBancosCuentas_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvBancosCuentas.RowUpdating
Dim NombreBanco As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNombreBanco").Text.Trim
Dim NumeroSucursal As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNumeroSucursal").Text.Trim
Dim CLABE As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtCLABE").Text.Trim
Dim SWIFT As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtSWIFT").Text.Trim
Dim Plaza As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtPlaza").Text.Trim
Dim NumeroCuenta As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtNumeroCuenta").Text.Trim
Dim ConvenioCIE As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtConvenioCIE").Text.Trim
Dim Referencia As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtReferencia").Text.Trim
Dim CveMoneda As Integer = GvBancosCuentas.Rows(e.RowIndex).FCDropDownList("DdlMoneda").SelectedValue.ToString().ToEntero()
Dim Estatus As Boolean = GvBancosCuentas.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked
Dim EstatusPagoElectronico As Boolean = GvBancosCuentas.Rows(e.RowIndex).FCCheckBox("ChkEstatusPagoE").Checked
Dim Moneda As String = GvBancosCuentas.Rows(e.RowIndex).FCDropDownList("DdlMoneda").SelectedItem.Text
Dim BBVAAlias As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtBBVAAlias").Text
Dim RefCrediProveedor As String = GvBancosCuentas.Rows(e.RowIndex).FCTextBox("TxtRefCrediProveedor").Text.Trim
Dim EsBancomer As Boolean = False
If NombreBanco.ToUpper.Contains("BBVA") Or NombreBanco.ToUpper.Contains("BANCOMER") Or (CLABE.Length = 18 AndAlso CLABE.Substring(0, 3) = "012") Then
EsBancomer = True
End If
If EsBancomer AndAlso (CLABE.Length = 18 AndAlso Not CLABE.Substring(0, 3) = "012") Then
Alert("La CLABE ingresada no pertenece a BANCOMER.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
''CLABE SIEMPRE OBLIGATORIA CUANDO NO ES BANCOMER CON CIE
'If (CLABE.Trim.Length <> 18 And Not EsBancomer) Or (EsBancomer And ConvenioCIE.Trim.Length <> 6 And CLABE.Trim.Length <> 18) Then
' Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER
If CLABE.Trim.Length <> 18 And CLABE.Trim.Length = 0 And Not EsBancomer Then
Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10
If NumeroCuenta.Trim.Length <> 0 AndAlso NumeroCuenta.Trim.Length <> 10 AndAlso EsBancomer Then
Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18
If CLABE.Trim.Length <> 0 AndAlso CLABE.Trim.Length <> 18 Then
Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 6 Y REFERENCIA OBLIGATORIA
If (ConvenioCIE.Trim.Length <> 0 And ConvenioCIE.Trim.Length <> 6) Or (ConvenioCIE.Trim.Length = 6 And Referencia.Trim.Length < 3) Then
Alert("El Convenio CIE debe tener una longitud de 6 dígitos y se debe especificar una referencia. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA"
If EsBancomer AndAlso Not (NumeroCuenta.Trim.Length = 10 Or ConvenioCIE.Trim.Length = 6) Then
Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim ObjCuentasBancos As New ClsGenerales
If CvePersonal > 0 Then
If ObjCuentasBancos.UpdateCuentasDepositos(GvBancosCuentas.DataKeys(e.RowIndex)("CveCuentaDeposito").ToString().ToEntero(), NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, RefCrediProveedor, False, Estatus, CveMoneda, UsuarioActual.CveEmpresa, CveUsuarioModifico:=UsuarioActual.CveUsuario, BBVAAlias:=BBVAAlias, EstatusPagoElectronico:=EstatusPagoElectronico) Then
DTCuentasBancos.Clear()
DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CvePersonal = {0}", CvePersonal)))
Alert("Cuenta actualizada con exito.", TipoMensaje.MsgInformacion)
End If
Else
Dim index As Integer = GvBancosCuentas.Rows(e.RowIndex).DataKey("CveCuentaDeposito").ToString().ToEntero() - 1
Dim Row As DataRow = TempDTCuentasBancos.Rows(index)
Row("BancoNombre") = NombreBanco
Row("Sucursal") = NumeroSucursal
Row("CLABE") = CLABE
Row("SWIFT") = SWIFT
Row("Plaza") = Plaza
Row("Cuenta") = NumeroCuenta
Row("CIE") = ConvenioCIE
Row("Referencia") = Referencia
Row("CveMoneda") = CveMoneda
Row("Moneda") = Moneda
TempDTCuentasBancos.AcceptChanges()
End If
ObjCuentasBancos.Dispose()
GvBancosCuentas.EditIndex = -1
CargaGridCuentasBancos("")
CargaGvBitacora()
End Sub
Protected Sub GvBancosCuentas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvBancosCuentas.RowDeleting
Dim ObjCuentasBancos As New ClsGenerales