client/Reportes/FrmCuentasRelacionadas.vb

386 lines
16 KiB
VB.net
Raw Blame History

Public Class FrmCuentasRelacionadas
Private Sub FrmCuentasRelacionadas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Classcom As clsComplejo
Dim SQLGrid As String
Dim ds1 As DataSet
Dim clcmj1 As New clsComplejo
'BTAgregar.Enabled = True
Try
If clsVaribles.lbDemo = True Then Exit Sub
clcmj1 = New clsComplejo
' MessageBox.Show("'cuentas'")
clcmj1.sbLimpiaControlesEsp(GRPBDatosPer)
' ''SQLGrid = "SELECT * FROM CuentasRelacionadas WHERE idtransaccion = " & clsVaribles.idtransaccion & " and idproducto = " & clsVaribles.idproducto
''SQLGrid = "Select CtaR.idCtaRelacc, CtaR.NumCuenta,CtaR.CuentaRelacionada,CtaR.TitularCtaRelac " & _
'' "From CuentasRelacionadas CtaR Inner Join " & _
'' "Cuenta Cta on Cta.numCuenta = CtaR.NumCuenta " & _
'' "Where cta.IdCuenta =" & clsVaribles.idCuenta
SQLGrid = "Select CtaR.id ID, Cta.numCuenta Cuenta, CtaR.Clave, CtaR.Nombre, CtaR.APaterno 'Apellido Paterno', CtaR.AMaterno 'Apellido Materno', " & _
" CtaR.IDTransaccion Transaccion " & _
"From CuentasRel CtaR Inner Join Cuenta Cta on Cta.idCuenta = CtaR.idCuenta " & _
"Where cta.IdCuenta =" & clsVaribles.idCuenta
clcmj1.fdtDataSetTabla(SQLGrid)
GRDContactos.SetDataBinding(clcmj1.ds, "Tabla") 'Llena el grid
Classcom = New clsComplejo
clsVaribles.CampoID = "id "
clsVaribles.Tabla = " CuentasRel "
'GRDContactos.TableStyles(0).GridColumnStyles(0).Width = 0
'GRDContactos.TableStyles(0).GridColumnStyles(1).Width = 0
'GRDContactos.TableStyles(0).GridColumnStyles(6).Width = 0
'GRDContactos.TableStyles(0).GridColumnStyles(7).Width = 0
Catch ex As Exception
MessageBox.Show("Error Busqueda; sbBuscas: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
'Exit Sub
End Try
End Sub
Private Sub BTLimpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If clsVaribles.lbDemo = True Then Exit Sub
Dim clcmj1 As New clsComplejo
clcmj1.sbLimpiaControlesEsp(GRPBDatosPer)
End Sub
Private Sub BTEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim FilaActual As Integer
Dim ClassCom As clsComplejo
Dim Fila As DataRow
Dim SQLDelete As String
Dim SQLGrid As String
Try
If clsVaribles.lbDemo = True Then Exit Sub
If GRDContactos.CurrentRowIndex <> -1 Then
FilaActual = GRDContactos.CurrentRowIndex
SQLDelete = "DELETE FROM " & clsVaribles.Tabla & " WHERE id = " & GRDContactos.Item(FilaActual, 0)
ClassCom = New clsComplejo
ClassCom.sbInserta(SQLDelete)
MsgBox("Operacion Satisfactoria")
ClassCom = New clsComplejo
'limpia controles de la forma
BtnLimpiar.PerformClick()
SQLGrid = "SELECT * FROM cuentasrel WHERE idtransaccion = " & clsVaribles.idtransaccion & " and idproducto = " & clsVaribles.idproducto
ClassCom.fdtDataSetTabla(SQLGrid)
GRDContactos.SetDataBinding(ClassCom.ds, "Tabla") 'Llena el grid
'lleno el campo de idcliente
'TXT0idcliente.Text = ClsVariables.VarIdCliente
'actualiza ell grid con los nuevos cambios
'ClassCom.ActualizaGrid(Me.GRDContactos)
Btnbaja.Enabled = False
End If
Catch ex As Exception
MessageBox.Show("Error Busqueda; sbBuscas: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
End Sub
Private Sub BTAgregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim ListaControles As String
Dim Classcom As clsComplejo
Dim VarReturn As String
Dim SQLInsert As String
Dim SQLGrid As String
Try
If clsVaribles.lbDemo = True Then Exit Sub
'TXT0idcliente.Text = ClsVariables.VarIdCliente
Classcom = New clsComplejo
Dim ClassSQL As New clsComplejo
Dim SQL As String
Dim ValorReturn As Object
Dim SentenciaWHERE As String
Dim SQLUpdate As String
'VERIFICA LISTAS RESTRINGIDAS
Dim Classcom2 As New clsComplejo
Dim ClCmj1 As New clsComplejo
'Dim Detalle As New KYC.FrDetLista
Dim VARCliente As String
Dim VARCliente2 As String
VARCliente = ""
VARCliente2 = ""
'*********************
'SQL = "SELECT 1 FROM " & clsVaribles.Tabla & " WHERE idproducto = " & clsVaribles.idproducto
'SQL = SQL & " AND idtransaccion = " & clsVaribles.idtransaccion
'SQL = SQL & " AND nombre = '" & Me.TXT0Nombre.Text.Trim & "" & "' and apaterno = '" & Me.TXT0APaterno.Text.Trim & "" & "'"
'SQL = SQL & " AND amaterno = '" & Me.TXT0Amaterno.Text.Trim & "" & "'"
ClassSQL = New clsComplejo
'SQL = "UPDATE CUENTASREL SET NOMBRE = '" & Me.TXT0Nombre.Text.Trim & "',APATERNO = '" & Me.TXT0APaterno.Text.Trim & "',"
'SQL = SQL & "AMATERNO = '" & Me.TXT0Amaterno.Text.Trim & "',no_cuenta = '" & Me.TXT0No_cuenta.Text.Trim & "',"
'SQL = SQL & "CLAVE = '" & Me.TXT0Clave.Text.Trim & "' WHERE ID = " & TXTComodin.Text.Trim
ClassSQL.sbInserta(SQL)
'SQL = "INSERT INTO CUENTASREL (NOMBRE,APATERNO,AMATERNO,CLAVE,NO_CUENTA,idtransaccion,idproducto)"
'SQL = SQL & " Values ("
'SQL = SQL & " '" & Me.TXT0Nombre.Text.Trim & "','" & Me.TXT0APaterno.Text.Trim & "','" & Me.TXT0Amaterno.Text.Trim & "',"
'SQL = SQL & " '" & Me.TXT0Clave.Text.Trim & "','" & Me.TXT0No_cuenta.Text.Trim & "',"
'SQL = SQL & clsVaribles.idtransaccion & "," & clsVaribles.idproducto & ")"
ClassSQL.sbInserta(SQL)
'SQLInsert = Classcom.ProcesoInsert("TXT0", "CBO0", "CHK0", "DTP0", "KYC_contacto", PNPrincipal)
'Classcom.sbInserta(SQLInsert)
MsgBox("Operacion Satisfactoria")
Classcom = New clsComplejo
Classcom.sbLimpiaControlesEsp(GRPBDatosPer)
'clcmj1.sbLimpiaControlesEsp(GRPBLocalizacion)
'SQLGrid = "SELECT * FROM cuantasrel WHERE idcliente = " & ClsVariables.VarIdCliente
SQLGrid = "SELECT * FROM cuentasrel WHERE idtransaccion = " & clsVaribles.idtransaccion & " and idproducto = " & clsVaribles.idproducto
Classcom.fdtDataSetTabla(SQLGrid)
GRDContactos.SetDataBinding(Classcom.ds, "Tabla") 'Llena el grid
'TXT0Nombre.Focus()
Catch ex As Exception
MessageBox.Show("Error Busqueda; sbBuscas: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
End Sub
Private Sub GRDContactos_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles GRDContactos.DoubleClick
Dim SQL As String
Dim CLasscom As New clsComplejo
Dim FilaActual As Integer
Try
FilaActual = GRDContactos.CurrentRowIndex
'SQL = "Select CtaR.idCtaRelacc, CtaR.NumCuenta,CtaR.CuentaRelacionada,CtaR.TitularCtaRelac, " & _
' " cte.Nombre,cte.ApellidoPaterno, cte.ApellidoMaterno " & _
' "From CuentasRelacionadas CtaR Inner Join Cuenta Cta on Cta.numCuenta = CtaR.NumCuenta " & _
' " Inner Join Cliente Cte on Cta.IdCliente = cte.IdCliente " & _
' "Where cta.NumCuenta = '" & GRDContactos.Item(FilaActual, 1) & "'"
SQL = "Select CtaR.id, CtaR.idCuenta,CtaR.Clave, CtaR.Nombre, CtaR.APaterno, CtaR.AMaterno, CtaR.IDTransaccion, CtaR.IDProducto " & _
"From CuentasRel CtaR Inner Join Cuenta Cta on Cta.idCuenta = CtaR.idCuenta " & _
"Where cta.numCuenta = '" & GRDContactos.Item(FilaActual, 1) & "' and ctar.id = " & GRDContactos.Item(FilaActual, 0) & " "
CLasscom.fdtDataSet(SQL)
If CLasscom.ds.Tables(0).Rows.Count <> 0 Then
txtNumCuenta.Text = CLasscom.ds.Tables(0).Rows(0).Item("Clave") & ""
txtNumCtaRel.Text = clsVaribles.numCuenta & ""
txtidcliente.Text = CLasscom.ds.Tables(0).Rows(0).Item("id") & ""
txtNombre.Text = CLasscom.ds.Tables(0).Rows(0).Item("Nombre") & ""
txtPaterno.Text = CLasscom.ds.Tables(0).Rows(0).Item("APaterno") & ""
txtMaterno.Text = CLasscom.ds.Tables(0).Rows(0).Item("AMaterno") & ""
Else
txtNumCtaRel.Text = clsVaribles.numCuenta & ""
End If
Me.Btnbaja.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub GRDContactos_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles GRDContactos.Navigate
End Sub
Private Sub BTRegresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub BntSalie_Click(sender As System.Object, e As System.EventArgs) Handles BntSalie.Click
Me.Close()
End Sub
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
' If clsVaribles.lbDemo = True Then Exit Sub
Dim clcmj1 As New clsComplejo
clcmj1.sbLimpiaControlesEsp(GRPBDatosPer)
End Sub
Private Sub Btnbaja_Click(sender As System.Object, e As System.EventArgs) Handles Btnbaja.Click
Dim FilaActual As Integer
Dim ClassCom As clsComplejo
Dim Fila As DataRow
Dim SQLDelete As String
Dim SQLGrid As String
Try
If clsVaribles.lbDemo = True Then Exit Sub
If GRDContactos.CurrentRowIndex <> -1 Then
FilaActual = GRDContactos.CurrentRowIndex
SQLDelete = "DELETE FROM " & clsVaribles.Tabla & " WHERE id = " & GRDContactos.Item(FilaActual, 0)
ClassCom = New clsComplejo
ClassCom.sbInserta(SQLDelete)
MsgBox("Operacion Satisfactoria")
ClassCom = New clsComplejo
'limpia controles de la forma
BtnLimpiar.PerformClick()
SQLGrid = "SELECT * FROM cuentasrel WHERE idtransaccion = " & clsVaribles.idtransaccion & " and idproducto = " & clsVaribles.idproducto
ClassCom.fdtDataSetTabla(SQLGrid)
GRDContactos.SetDataBinding(ClassCom.ds, "Tabla") 'Llena el grid
'lleno el campo de idcliente
'TXT0idcliente.Text = ClsVariables.VarIdCliente
'actualiza ell grid con los nuevos cambios
'ClassCom.ActualizaGrid(Me.GRDContactos)
'auditoria'
Dim ClassAud As New ClassMyUtils
Dim sTextoAud As String
sTextoAud = "Baja de Cuentas Relacionadas, "
sTextoAud = sTextoAud & "id: " & GRDContactos.Item(FilaActual, 0)
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 114, 1, sTextoAud)
'Fin de auditoria'
Btnbaja.Enabled = False
End If
Catch ex As Exception
MessageBox.Show("Error Busqueda; sbBuscas: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
End Sub
Private Sub BtnAlta_Click(sender As System.Object, e As System.EventArgs) Handles BtnAlta.Click
Dim ClassSQL As New clsComplejo
Dim Classcom As New clsComplejo
Dim SQL As String
Dim SQLGrid As String
Try
If txtidcliente.Text = "" And (txtNumCuenta.Text <> "" And txtNombre.Text <> "" And txtPaterno.Text <> "" And txtMaterno.Text <> "") Then
SQL = "INSERT INTO CuentasRel "
SQL = SQL & " Values (" & clsVaribles.idCuenta & ",'" & txtNumCuenta.Text & "','" & txtNombre.Text & "', '" & txtPaterno.Text & "', '" & txtMaterno.Text & "', " & clsVaribles.idtransaccion & ", " & clsVaribles.idproducto & ")"
ClassSQL.sbInserta(SQL)
'auditoria'
Dim ClassAud As New ClassMyUtils
Dim sTextoAud As String
sTextoAud = "Alta de Cuentas Relacionadas, "
sTextoAud = sTextoAud & " IdCuenta:" & clsVaribles.idCuenta & ","
sTextoAud = sTextoAud & "NumCuenta:" & txtNumCuenta.Text & ","
sTextoAud = sTextoAud & "Nombre:" & txtNombre.Text & " " & txtPaterno.Text & " " & txtMaterno.Text & ","
sTextoAud = sTextoAud & "IdTransaccion:" & clsVaribles.idtransaccion & ","
sTextoAud = sTextoAud & "IdProducto:" & clsVaribles.idproducto
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 114, 1, sTextoAud)
'Fin de auditoria'
ElseIf txtidcliente.Text <> "" And txtNumCuenta.Text <> "" Then
SQL = "Update CuentasRel Set Clave = '" & txtNumCuenta.Text & _
"', Nombre ='" & txtNombre.Text & _
"', Apaterno ='" & txtPaterno.Text & _
"', Amaterno ='" & txtMaterno.Text & "' " & _
" Where id = " & txtidcliente.Text
ClassSQL.sbInserta(SQL)
'auditoria'
Dim ClassAud As New ClassMyUtils
Dim sTextoAud As String
sTextoAud = "Actualizaci<EFBFBD>n de Cuentas Relacionadas, "
sTextoAud = sTextoAud & " Clave:" & txtNumCuenta.Text & ","
sTextoAud = sTextoAud & "Nombre:" & txtNombre.Text & " " & txtPaterno.Text & " " & txtMaterno.Text
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 114, 1, sTextoAud)
'Fin de auditoria'
Else
MsgBox("Complete la informaci<63>n para registrar")
Exit Sub
End If
MsgBox("Operacion Satisfactoria")
Classcom.sbLimpiaControlesEsp(GRPBDatosPer)
SQLGrid = "Select CtaR.id ID, Cta.numCuenta Cuenta, CtaR.Clave, CtaR.Nombre, CtaR.APaterno 'Apellido Paterno', CtaR.AMaterno 'Apellido Materno', " & _
" CtaR.IDTransaccion Transaccion " & _
"From CuentasRel CtaR Inner Join Cuenta Cta on Cta.idCuenta = CtaR.idCuenta " & _
"Where cta.IdCuenta =" & clsVaribles.idCuenta
Classcom.fdtDataSetTabla(SQLGrid)
GRDContactos.SetDataBinding(Classcom.ds, "Tabla") 'Llena el grid
Catch ex As Exception
MessageBox.Show("Error Guardar; sbCtsRel: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
End Sub
Private Sub BtnCambios_Click(sender As System.Object, e As System.EventArgs) Handles BtnCambios.Click
BtnAlta.PerformClick()
End Sub
Private Sub btnConsulta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConsulta.Click
End Sub
Private Sub BtnImprimir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnImprimir.Click
End Sub
Private Sub Label2_Click(sender As System.Object, e As System.EventArgs) Handles Label2.Click
End Sub
End Class