471 lines
18 KiB
VB.net
471 lines
18 KiB
VB.net
|
||
Public Class FrmNewInsuales
|
||
|
||
Dim Cuenta As clsComplejo = New clsComplejo 'para llenar el combo de cuenta
|
||
Dim ban_Exportar As Boolean
|
||
|
||
Private Sub CMBProducto_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles CMBProducto.DropDown
|
||
|
||
Dim clcmp As New clsComplejo
|
||
Try
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
'Lleno el combo de productos
|
||
'Se utiliza un procedimiento almacenado para llenar el combo
|
||
Me.CMBProducto.DataSource = Nothing
|
||
'Vicente VOG 18/03/2014
|
||
'clcmp.sbLlenaCombo("SELECT CASE PRODUCTO WHEN 'TESORERIA' THEN 'DIVISA' ELSE PRODUCTO END AS NOMBRE,idproducto CLAVE FROM cat_PRODUCTO WHERE ACTIVO = 1 ORDER BY NOMBRE", Me.CMBProducto)
|
||
'clcmp.sbLlenaCombo("SELECT CASE PRODUCTO WHEN 'TESORERIA' THEN 'DIVISA' ELSE PRODUCTO END AS NOMBRE,idproducto CLAVE FROM cat_PRODUCTO WHERE ACTIVO = 1 ORDER BY NOMBRE", Me.CMBProducto)
|
||
clcmp.sbLlenaCombo("sp_ConsultarProducto 0,1", Me.CMBProducto)
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
|
||
|
||
End Sub
|
||
|
||
|
||
Private Sub CMBCliente_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles CMBCliente.DropDown
|
||
|
||
Dim SQLFun As String
|
||
Dim clCmj1 As clsComplejo
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
Try
|
||
'clCmj1 = New clsComplejo
|
||
|
||
''SQLFun = "SELECT idcliente clave,RTRIM(LTRIM(CLIENTENOM)) + ' ' + ISNULL(LTRIM(RTRIM(APATERNO)),'') + ' ' + ISNULL(RTRIM(LTRIM(AMATERNO)),'') as nombre FROM CLIENTE Order by CLIENTENOM"
|
||
' ''SQLFun = SQLFun & " WHERE id_tipoempleado = 1 "
|
||
|
||
''clCmj1.cm.CommandText = SQLFun
|
||
''clCmj1.ad.SelectCommand = clCmj1.cm
|
||
|
||
''clCmj1.sbLlenaCombo1(SQLFun, CMBCliente, CStr("nombre"))
|
||
|
||
'clCmj1.sbLlenaCombo("spLlenaComboCliente", Me.CMBCliente)
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error CBOFun_DropDown: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End Try
|
||
|
||
End Sub
|
||
|
||
Private Sub CMBCliente_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMBCliente.SelectedIndexChanged
|
||
|
||
End Sub
|
||
|
||
Private Sub cmbCuenta_DropDown(ByVal sender As Object, ByVal e As System.EventArgs)
|
||
|
||
'Dim SQLFun As String
|
||
'Dim clCmj1 As clsComplejo
|
||
'Dim cad As String
|
||
|
||
'Try
|
||
' If clsVaribles.lbDemo = True Then Exit Sub
|
||
' 'Se modifico el SP y se agrego la funcion sbLlenaCombo3
|
||
' cad = "spLlenaComboCuenta "
|
||
' cad = cad & CInt(CMBCliente.SelectedValue) & ",2 "
|
||
' 'cad = cad & CInt(CMBCliente.SelectedValue) & ",3 " & "," & CMBProducto.SelectedValue
|
||
|
||
' Cuenta.sbLlenaCombo3(cad, Me.cmbCuenta)
|
||
|
||
' 'If CMBCliente.Text = "" Then Exit Sub
|
||
' 'clCmj1 = New clsComplejo
|
||
' 'If CMBCliente.Text <> "" Then
|
||
' ' SQLFun = "SELECT C.idcliente clave,C.idcuenta as nombre "
|
||
' ' SQLFun = SQLFun & " FROM cuenta C,CLIENTE CL "
|
||
' ' SQLFun = SQLFun & " WHERE C.idcliente = CL.idcliente AND CL.idcliente = '" & CMBCliente.SelectedValue & "'"
|
||
' ' SQLFun = SQLFun & " Order by C.idcuenta"
|
||
|
||
|
||
' 'ElseIf CMBCliente.Text <> "" And CMBCliente.SelectedIndex <> -1 Then
|
||
|
||
' ' SQLFun = "SELECT C.idcliente clave,C.idcuenta as nombre "
|
||
' ' SQLFun = SQLFun & " FROM cuenta C,CLIENTE CL "
|
||
' ' SQLFun = SQLFun & " WHERE C.idcliente = CL.idcliente AND CL.idcliente = '" & CMBCliente.SelectedValue & "'"
|
||
' ' SQLFun = SQLFun & " Order by C.idcuenta"
|
||
' 'End If
|
||
' ''SQLFun = SQLFun & " WHERE id_tipoempleado = 1 "
|
||
|
||
' 'clCmj1.cm.CommandText = SQLFun
|
||
' 'clCmj1.ad.SelectCommand = clCmj1.cm
|
||
|
||
' 'clCmj1.sbLlenaCombo1(SQLFun, cmbCuenta, CStr("nombre"))
|
||
|
||
|
||
|
||
'Catch ex As Exception
|
||
' MessageBox.Show("Error CBOFun_DropDown: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
' Exit Sub
|
||
'End Try
|
||
|
||
Call LLenaComboCuenta()
|
||
|
||
End Sub
|
||
|
||
Private Sub cmbCuenta_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
|
||
|
||
End Sub
|
||
|
||
Private Sub FrmNewInsuales_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||
Dim clcmp As New clsComplejo
|
||
Dim DT1 As New DataTable
|
||
Try
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
'Lleno el combo de productos
|
||
'Se utiliza un procedimiento almacenado para llenar el combo
|
||
'clcmp.sbLlenaCombo("SELECT CASE PRODUCTO WHEN 'BANCATRADICIONAL' THEN 'OPERACIONES COMERCIALES' WHEN 'CREDITO' THEN 'CREDITO' END AS NOMBRE,idproducto CLAVE FROM PRODUCTO WHERE ACTIVO = 1", Me.CMBProducto)
|
||
'clcmp.sbLlenaCombo("SELECT PRODUCTO AS NOMBRE,idproducto CLAVE FROM cat_PRODUCTO WHERE ACTIVO = 1", Me.CMBProducto)
|
||
|
||
clcmp.sbLlenaCombo("sp_ConsultarProducto 0,1 ", Me.CMBProducto)
|
||
|
||
|
||
Me.CMBProducto.SelectedIndex = -1
|
||
Me.CMBCliente.SelectedIndex = -1
|
||
|
||
clcmp = New clsComplejo
|
||
|
||
|
||
clcmp.sbLlenaCombo("spLlenaComboCliente 1", Me.CMBCliente)
|
||
CMBCliente.SelectedIndex = -1
|
||
|
||
clsVaribles.lsClienteNombre = ""
|
||
clsVaribles.lsClienteNombreT = ""
|
||
Label7.Text = Me.Text
|
||
Catch ex As Exception
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub GridCentral_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridCentral.DoubleClick
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
|
||
If GridCentral.EmptyRows = False Then
|
||
|
||
If GridCentral.RowCount > 0 Then
|
||
|
||
clsVaribles.Nombre = GridCentral.Columns("NOMBRE O RAZ<41>N SOCIAL").Value ' GridCentral(GridCentral.Row, 3).ToString
|
||
clsVaribles.No_Referencia = GridCentral.Columns("N<EFBFBD>MERO REFERENCIA").Value 'GridCentral(GridCentral.Row, 2).ToString
|
||
clsVaribles.varTransaccion = GridCentral(GridCentral.Row, 0).ToString
|
||
clsVaribles.varFecha = CDate(GridCentral.Columns("FECHA").Value) 'CDate(GridCentral(GridCentral.Row, 1).ToString)
|
||
|
||
Dim Calificacion As New FRCalificacion
|
||
|
||
Calificacion.ShowDialog()
|
||
BtnConsultar.PerformClick()
|
||
|
||
End If
|
||
|
||
Else
|
||
|
||
MsgBox("No hay datos para editar.")
|
||
|
||
End If
|
||
|
||
|
||
End Sub
|
||
|
||
Private Sub BTLimpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTLimpiar.Click
|
||
'Dim forma As New FRMBusqueda
|
||
'forma.ShowDialog()
|
||
|
||
Me.CMBCliente.SelectedIndex = -1
|
||
Me.cmbCuenta.SelectedIndex = -1
|
||
Me.CMBProducto.SelectedIndex = -1
|
||
|
||
Me.GridCentral.DataSource = Nothing
|
||
Me.GridCentral.Visible = False
|
||
|
||
Label6.Visible = True
|
||
|
||
End Sub
|
||
|
||
Private Sub BntSalie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BntSalie.Click
|
||
Me.Close()
|
||
End Sub
|
||
|
||
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
|
||
|
||
Me.CMBCliente.SelectedIndex = -1
|
||
Me.cmbCuenta.SelectedIndex = -1
|
||
Me.CMBProducto.SelectedIndex = -1
|
||
|
||
Me.GridCentral.DataSource = Nothing
|
||
Me.GridCentral.Visible = False
|
||
clsVaribles.lsClienteNombre = ""
|
||
clsVaribles.lsClienteNombreT = ""
|
||
Me.CMBCliente.Text = ""
|
||
CMBCliente.SelectedValue = 0
|
||
cmbCuenta.SelectedValue = 0
|
||
'Vicente 18/03/2014
|
||
cmbCuenta.Text = ""
|
||
Label6.Text = "Total de Registros 0"
|
||
Label6.Visible = True
|
||
End Sub
|
||
|
||
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnConsultar.Click
|
||
|
||
|
||
Dim SQLFun As String
|
||
Dim clCmj1 As clsComplejo
|
||
Dim strCuenta As String
|
||
Dim SQL As String
|
||
|
||
Dim rs As New ADODB.Recordset
|
||
If clsVaribles.lbDemo = True Then Exit Sub
|
||
Try
|
||
clCmj1 = New clsComplejo
|
||
|
||
GridCentral.ClearFields()
|
||
|
||
If (Me.CMBProducto.SelectedIndex = -1 Or Me.CMBProducto.Text = "") Then
|
||
MsgBox("Seleccione un Producto")
|
||
Exit Sub
|
||
|
||
End If
|
||
|
||
clsVaribles.idproducto = CMBProducto.SelectedValue
|
||
clsVaribles.strProdFraccionada = clCmj1.BuscaValores("producto", "cat_producto", " idproducto = " & clsVaribles.idproducto)
|
||
SQLFun = ""
|
||
'-- Se excluyen las alarmas que sean por NUEAS INUSUALES (IdParon = 26)
|
||
'-- Modificacion Solicitada por el usuario
|
||
'-- C.Clain 19/marzo/2013
|
||
|
||
Select Case CMBProducto.Text
|
||
|
||
Case "BANCA TRADICIONAL" 'BANCA TRADICIONAL
|
||
|
||
SQLFun = "sp_NuevaInusualBT "
|
||
|
||
|
||
Case "MERCADO DE CAPITALES" '"MERCADO DE CAPITALES" '- mercado de capitales
|
||
|
||
SQLFun = "sp_NuevaInusualMCapitales "
|
||
|
||
Case "CREDITO" '- CREDITO
|
||
|
||
SQLFun = "sp_NuevaInusualCredito "
|
||
|
||
Case "BANCA INTERNACIONAL" '- BANCA INTERNACIONAL
|
||
|
||
|
||
SQLFun = "sp_NuevaInusualBI "
|
||
|
||
Case "DIVISAS"
|
||
|
||
SQLFun = "sp_NuevaInusualDivisas "
|
||
|
||
Case Else
|
||
|
||
Exit Sub
|
||
End Select
|
||
|
||
SQLFun = SQLFun & IIf(CMBCliente.SelectedValue <> Nothing, CMBCliente.SelectedValue, "NULL")
|
||
SQLFun = SQLFun & "," & IIf(cmbCuenta.SelectedValue <> Nothing, cmbCuenta.SelectedValue, "NULL")
|
||
SQLFun = SQLFun & ",'" & DTMFecha1.Value.ToString("yyyy/MM/dd") & "'"
|
||
SQLFun = SQLFun & ",'" & DTMFecha2.Value.ToString("yyyy/MM/dd") & "'"
|
||
|
||
clCmj1 = New clsComplejo
|
||
|
||
clCmj1.fdtDataSetTabla(SQLFun)
|
||
|
||
If clCmj1.ds.Tables(0).Rows.Count <> 0 Then
|
||
|
||
GridCentral.SetDataBinding(clCmj1.ds, "tabla")
|
||
'GridCentral.Columns(5).NumberFormat = "Currency"
|
||
Me.GridCentral.Splits(0).DisplayColumns(1).Visible = False
|
||
Me.GridCentral.Splits(0).DisplayColumns(4).Visible = False
|
||
Me.GridCentral.Splits(0).DisplayColumns(6).Visible = False
|
||
Me.GridCentral.Splits(0).DisplayColumns(8).Visible = False
|
||
Me.GridCentral.Splits(0).DisplayColumns(10).Visible = False
|
||
Me.GridCentral.Splits(0).DisplayColumns(12).Visible = False
|
||
Me.GridCentral.Splits(0).DisplayColumns(14).Visible = False
|
||
Label6.Text = "Total de Registros " & clCmj1.ds.Tables(0).Rows.Count
|
||
Label6.Visible = True
|
||
clCmj1.ColsGridAutosize(GridCentral)
|
||
ban_Exportar = True
|
||
Else
|
||
Label6.Text = "Total de Registros 0"
|
||
ban_Exportar = False
|
||
End If
|
||
|
||
''Auditoria
|
||
Dim sTextoAud As String
|
||
sTextoAud = "Consulta Nuevas Inusuales. Producto=" & CMBProducto.Text & ","
|
||
If CMBCliente.Text <> "" Then
|
||
sTextoAud = sTextoAud & " IdCliente=" & CMBCliente.SelectedValue & ","
|
||
End If
|
||
If Me.cmbCuenta.Text <> "" Then
|
||
sTextoAud = sTextoAud & " Numcuenta=" & cmbCuenta.Text.Trim & ","
|
||
End If
|
||
sTextoAud = sTextoAud & " Fechas entre " & DTMFecha1.Text & " y " & DTMFecha2.Text
|
||
Dim ClassAud As New ClassMyUtils
|
||
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 121, 27, sTextoAud)
|
||
''Fin de auditoria
|
||
Label6.Visible = True
|
||
'PNCentral.Visible = True
|
||
GridCentral.Visible = True
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show("Error CBOFun_DropDown: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
Exit Sub
|
||
End Try
|
||
|
||
|
||
End Sub
|
||
|
||
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
|
||
Dim fRefBan As New FrmBuscaListas(CMBCliente.Text & "%")
|
||
|
||
|
||
If fRefBan.Text <> "0" Then
|
||
fRefBan.ShowDialog()
|
||
If clsVaribles.lsClienteNombre <> "" Then
|
||
Dim cad As String
|
||
'Dim dt As Integer
|
||
'If CMBProducto.Text = "CREDITO" Then
|
||
' dt = 1
|
||
'Else
|
||
' dt = 2
|
||
'End If
|
||
cad = "spLlenaComboCuenta "
|
||
cad = cad & CInt(CMBProducto.SelectedValue) & ",2"
|
||
Cuenta.sbLlenaCombo1(cad, Me.cmbCuenta)
|
||
'sbBuscar()
|
||
cmbCuenta.SelectedIndex = -1
|
||
CMBCliente.Text = clsVaribles.lsClienteNombreT
|
||
End If
|
||
Else
|
||
MessageBox.Show("No se Encontraron coincidencias en cliente", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
End If
|
||
fRefBan.Dispose()
|
||
End Sub
|
||
|
||
Private Sub LLenaComboCuenta()
|
||
Dim Classcom As New clsComplejo
|
||
Dim SQL As String
|
||
|
||
''If Not IsNothing(cmbCliente.SelectedValue) Then
|
||
|
||
If CMBProducto.Text = "" Then
|
||
MessageBox.Show("Seleccione un producto", "Minds Cliente", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
CMBProducto.Focus()
|
||
Exit Sub
|
||
End If
|
||
|
||
If CMBCliente.SelectedIndex > -1 Then
|
||
'jtc SQL = "SELECT NumeroCuenta as clave,NumeroCuenta as nombre from cuenta where idcliente = " & cmbCliente.SelectedValue
|
||
'SQL = "SELECT idCuenta as clave,NOCUENTA as nombre from cuenta where idcliente = " & cmbCliente.SelectedValue.ToString()
|
||
|
||
|
||
SQL = "sp_ConsultarCtaXProducto " & CMBCliente.SelectedValue & ",'" & CMBProducto.Text.Replace(" ", "") & "'"
|
||
|
||
Classcom.sbLlenaCombo(SQL, Me.cmbCuenta)
|
||
Me.cmbCuenta.SelectedIndex = -1
|
||
Me.cmbCuenta.SelectedIndex = -1
|
||
|
||
Else
|
||
|
||
MsgBox("Seleccione un Cliente", MsgBoxStyle.Information)
|
||
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub BtnExpor_Click(sender As Object, e As EventArgs) Handles BtnExpor.Click
|
||
|
||
If ban_Exportar Then
|
||
If GridCentral.RowCount > 0 Then
|
||
Me.Cursor = Cursors.WaitCursor
|
||
Exportar()
|
||
Me.Cursor = Cursors.Default
|
||
|
||
|
||
'ScreenLogger
|
||
Dim sc As New ScreenShot.ScreenLogger
|
||
sc.ScreenLog(Me, Login.NombreUsuario, Me.Text, "Exportar")
|
||
End If
|
||
Else
|
||
MsgBox("No existe informaci<63>n para exportar", MsgBoxStyle.Information)
|
||
End If
|
||
|
||
End Sub
|
||
|
||
Private Sub Exportar()
|
||
|
||
If GridCentral.DataSource Is Nothing Then
|
||
MessageBox.Show("Presione primero el bot<6F>n de consultar y despues el boton de exportar.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Return
|
||
End If
|
||
|
||
''Preparo la tabla a exportar
|
||
''hago una copia por valor de la tabla
|
||
Dim copyDS As DataSet = GridCentral.DataSource.Copy() ''clCmp.ds.Copy()
|
||
If copyDS.Tables(0) Is Nothing Then
|
||
MessageBox.Show("Presione primero el bot<6F>n de consultar y despues el boton de exportar.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Return
|
||
End If
|
||
If copyDS.Tables(0).Rows.Count = 0 Then
|
||
MessageBox.Show("No existen datos para exportar", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||
Return
|
||
End If
|
||
Dim Resul As DialogResult
|
||
Resul = MessageBox.Show("Este proceso puede tardar varios minutos, <20>Deseas continuar? ", "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||
If Resul = DialogResult.No Then
|
||
Return
|
||
End If
|
||
|
||
''Quito las columnas ocultas del grid.
|
||
Dim i As Integer
|
||
For i = 0 To GridCentral.Columns.Count - 1
|
||
If Me.GridCentral.Splits(0).DisplayColumns(i).Visible = False Then
|
||
Dim j As Integer
|
||
For j = 0 To copyDS.Tables(0).Columns.Count - 1
|
||
If Me.GridCentral.Splits(0).DisplayColumns(i).Name = copyDS.Tables(0).Columns.Item(j).ColumnName Then
|
||
copyDS.Tables(0).Columns.Remove(copyDS.Tables(0).Columns.Item(j).ColumnName)
|
||
Exit For
|
||
End If
|
||
Next
|
||
End If
|
||
Next
|
||
|
||
Try
|
||
Dim sError As String = ""
|
||
''Inicia Exportacion
|
||
'Creo una instancia de la clase aExcel
|
||
Dim clsExcel As aExcel = New aExcel
|
||
'Obtenemos el nombre o el titulo del form
|
||
clsExcel.Titulo = "Rep. Oper. Inusuales"
|
||
'Utilizo la funcion ExportDataset de la clase aExcel
|
||
clsExcel.ExportDataset(copyDS) 'Asigno el dataset a exportar
|
||
|
||
Catch ex As Exception
|
||
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||
End Try
|
||
Cursor = System.Windows.Forms.Cursors.Default
|
||
|
||
End Sub
|
||
|
||
Private Sub BTConsultar_Click(sender As Object, e As EventArgs) Handles BTConsultar.Click
|
||
|
||
End Sub
|
||
|
||
Private Sub cmbCuenta_SelectionChangeCommitted(sender As Object, e As EventArgs)
|
||
'Call LLenaComboCuenta()
|
||
End Sub
|
||
|
||
Private Sub cmbCuenta_SelectedIndexChanged_1(sender As Object, e As EventArgs)
|
||
'Call LLenaComboCuenta()
|
||
End Sub
|
||
|
||
Private Sub cmbCuenta_SelectedIndexChanged_2(sender As Object, e As EventArgs) Handles cmbCuenta.SelectedIndexChanged
|
||
|
||
End Sub
|
||
|
||
Private Sub cmbCuenta_SelectionChangeCommitted_1(sender As Object, e As EventArgs) Handles cmbCuenta.SelectionChangeCommitted
|
||
|
||
End Sub
|
||
|
||
Private Sub CMBCliente_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles CMBCliente.SelectionChangeCommitted
|
||
Call LLenaComboCuenta()
|
||
End Sub
|
||
End Class |