client/HistoricoAlarmas/frmDetalleHistoricoDIV.vb

286 lines
13 KiB
VB.net

Public Class frmDetalleHistoricoDIV
Inherits System.Windows.Forms.Form
Dim clCmp As clsComplejo = New clsComplejo
Dim Patron As clsComplejo = New clsComplejo 'Para llenar combo patron
Dim Periodo As clsComplejo = New clsComplejo 'Para llenar combo periodo
Dim Cliente As clsComplejo = New clsComplejo 'para llenar combo cliente
Dim Estatus As clsComplejo = New clsComplejo 'para llenar combo estatus
Dim Cuenta As clsComplejo = New clsComplejo 'para llenar el combo de cuenta
Dim clsVar As clsVaribles = New clsVaribles 'Para utilizar varibles publicas
Dim BanCliente, BanCuenta, BanPatron, BanStatus As Boolean
Private Sub tlbInusualesDivisas_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tlbInusualesDivisas.ButtonClick
Select Case e.Button.Text
Case "Exportar"
Exportar()
Case "Salir"
Me.Close()
End Select
End Sub
Private Sub frmDetalleHistorico_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'-- busca las alarmas del cliente solicitado
sbBuscar() '
End Sub
Public Sub sbBuscar()
Try
Dim SQL As String
SQL = ""
SQL = fsDefineSQL("ReporteInusualHistoricoDIV ")
clCmp.fdtDataSetTabla(SQL)
OcultaColums()
Me.C1TrueDBGrid1.SetDataBinding(clCmp.ds, "Tabla")
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(1).Visible = False
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(2).Visible = False
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(3).Visible = False
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(4).Visible = False
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(5).Visible = False
Me.C1TrueDBGrid1.Columns(11).NumberFormat = "Currency"
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(6).FetchStyle = True
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(6).Style.VerticalAlignment = C1.Win.C1TrueDBGrid.AlignVertEnum.Center
Me.C1TrueDBGrid1.Splits(0).DisplayColumns("idTransaccion").Visible = False
Me.C1TrueDBGrid1.Splits(0).DisplayColumns("idCuenta").Visible = False
'-- los datos de la columna de si es hostorico el dato los coloca en ROJO
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(0).Style.ForeColor = Color.Red
Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Historico").Style.VerticalAlignment = C1.Win.C1TrueDBGrid.AlignVertEnum.Center
Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Historico").Width = 30
'-- para el detalle se oculta la columna de historico
Me.C1TrueDBGrid1.Splits(0).DisplayColumns("Historico").Visible = False
Me.C1TrueDBGrid1.Visible = True
Dim Cont As Integer
Cont = clCmp.ds.Tables(0).Rows.Count
LblNumReg.Text = "Elementos: " & Cont
Catch er As Exception
'MessageBox.Show(er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Exportar()
Try
If clCmp.ds.Tables.Count = 0 Then
MessageBox.Show("Realiza una consulta ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
If clCmp.ds.Tables(0).Rows.Count = 0 Then
MessageBox.Show("No hay datos para exportar ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim Resul As DialogResult
Resul = MessageBox.Show("Este proceso puede tardar varios minutos, ¿Deseas continuar? ", "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Resul = DialogResult.Yes Then
'Creamos una copia del dataset
Dim copyDS As DataSet = clCmp.ds.Copy()
'Quitamos las siguientes columnas para no exportarlas
copyDS.Tables(0).Columns.Remove("IdTransaccion")
copyDS.Tables(0).Columns.Remove("IdProducto")
copyDS.Tables(0).Columns.Remove("IdSubproducto")
copyDS.Tables(0).Columns.Remove("IdPatron")
copyDS.Tables(0).Columns.Remove("IdEstatusTransaccion")
copyDS.Tables(0).Columns.Remove("idCuenta")
copyDS.Tables(0).Columns.Remove("Historico")
'Creo una instancia de la clase aExcel
Dim clsExcel As aExcel = New aExcel
'Obtenemos el nombre o el titulo del form
clsExcel.Titulo = Me.Text
'Utilizo la funcion ExportDataset de la clase aExcel
clsExcel.ExportDataset(copyDS) 'Asigno el dataset a exportar
End If
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub OcultaColums()
Try
If clCmp.ds.Tables.Count <> 0 Then
clCmp.OcultarColumna("IdTransaccion")
clCmp.OcultarColumna("IdProducto")
clCmp.OcultarColumna("IdSubproducto")
clCmp.OcultarColumna("IdPatron")
clCmp.OcultarColumna("IdEstatusTransaccion")
clCmp.OcultarColumna("idCuenta")
End If
Catch er As Exception
' MessageBox.Show(er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Function fsDefineSQL(ByVal SP As String) As String
'Defino mi cadena para el procedimiento almacenado
Try
Dim lsSQL As String = ""
Dim _Opcion As Integer
Dim lsIni As String = " NULL,"
Dim lsFin As String = " NULL,"
Dim lsCliente As String = " NULL, "
Dim lsCuenta As String = " NULL, "
Dim lsPatron As String = " NULL, "
Dim lsEstatus As String = " NULL "
Dim Classcom As New clsComplejo
Dim FchIni As Date
Dim meses As Integer
' ************ Fechas Periodo****************
meses = ObtienePeriodoHistorico()
FchIni = DateAdd(DateInterval.Month, meses * -1, clsVaribles.Finicio)
lsIni = Classcom.ObtenFecha(FchIni, "yyyymmdd")
lsIni = " '" & lsIni & "', "
'-- se deja la fecha de inicio nuevamente solo para que traiga el historico
'-- DesEncripta Label fecha inicial menos los meses indicados hasta la fecha de inicio del
'-- periodo solicitado
lsFin = Classcom.ObtenFecha(clsVaribles.Finicio, "yyyymmdd")
lsFin = "'" & lsFin & "', "
lsCliente = clsVaribles.VarIdCliente & ", "
lblPeriodoHist.Text = " Periodo que se muestra es de " & meses.ToString & " meses, del " & FchIni.ToShortDateString & " al " & clsVaribles.Finicio.ToShortDateString & " "
'*******************************************************************************
lsSQL = ""
lsSQL = lsSQL & SP
lsSQL = lsSQL & lsIni
lsSQL = lsSQL & lsFin
lsSQL = lsSQL & lsCliente
lsSQL = lsSQL & lsCuenta
lsSQL = lsSQL & lsPatron
lsSQL = lsSQL & lsEstatus
'---
Return lsSQL
Catch ex As Exception
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Function
Function ObtienePeriodoHistorico() As Integer
Dim cSQL As String
Dim ExeQry As New SenteciasSQL.ClassSQL
Dim fila As DataRow
cSQL = "select ValorNumerico meses, Descripcion, idEstatus from ParametrosGenerales where idParametro = 250 and idEstatus = 1 "
ExeQry.fdtDataSet(cSQL)
If ExeQry.ds.Tables(0).Rows.Count <> 0 Then
fila = ExeQry.ds.Tables(0).Rows(0)
Return fila("meses")
Else
Return 0
End If
End Function
Private Sub C1TrueDBGrid1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.Click
End Sub
Private Sub C1TrueDBGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.DoubleClick
Try
If C1TrueDBGrid1.Columns(0).Text <> "RELEVANTE" Then
Dim FilaActual As Integer
FilaActual = Me.C1TrueDBGrid1.Row
Dim fila As DataRow
fila = clCmp.ds.Tables(0).Rows(FilaActual)
clsVar.ReportadoPor = C1TrueDBGrid1.Columns("ReportadoPor").Text
clsVar.Nombre = C1TrueDBGrid1.Columns("NOMBRE DEL CLIENTE").Text
clsVar.No_Referencia = C1TrueDBGrid1.Columns("NumeroReferencia").Text
clsVar.Id_Transaccion = C1TrueDBGrid1.Columns("idtransaccion").Text
clsVar.Id_Producto = C1TrueDBGrid1.Columns("IdProducto").Text
clsVar.Id_SubProducto = C1TrueDBGrid1.Columns("IdSubproducto").Text
clsVar.Id_Patron = C1TrueDBGrid1.Columns("IdPatron").Text
clsVar.Id_EstatusTransaccion = C1TrueDBGrid1.Columns("IdEstatusTransaccion").Text
Dim frmDetalles As Detalles = New Detalles
frmDetalles.Text = "Detalle Crédito"
frmDetalles.ShowDialog()
'refrescar()
sbBuscar()
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub C1TrueDBGrid1_FetchCellStyle(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs) Handles C1TrueDBGrid1.FetchCellStyle
Dim S As String = Me.C1TrueDBGrid1(e.Row, e.Col)
If S = "RELEVANTE" Then
e.CellStyle.BackColor = System.Drawing.Color.White
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
If S = "PREOCUPANTE" Then
e.CellStyle.BackColor = System.Drawing.Color.White
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
If S = "PATRON MONTO" Then
e.CellStyle.BackColor = System.Drawing.Color.Red
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON TRANSACCIONES" Then
e.CellStyle.BackColor = System.Drawing.Color.Blue
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON FECHA" Then
e.CellStyle.BackColor = System.Drawing.Color.Yellow
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
If S = "PATRON MONTO KYC" Then
e.CellStyle.BackColor = System.Drawing.Color.BlueViolet
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON FUNCIONARIO" Then
e.CellStyle.BackColor = System.Drawing.Color.Pink
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON GEOGRAFIA" Then
e.CellStyle.BackColor = System.Drawing.Color.Maroon
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON HORA" Then
e.CellStyle.BackColor = System.Drawing.Color.YellowGreen
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
If S = "PATRON DEPOSITANTE/BENEFICIARIO" Then
e.CellStyle.BackColor = System.Drawing.Color.Orange
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
If S = "PATRON DISPERSION" Then
e.CellStyle.BackColor = System.Drawing.Color.Turquoise
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
If S = "PATRON POSICIONESCONTRARIAS" Then
e.CellStyle.BackColor = System.Drawing.Color.Turquoise
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON POSICIONESCONTRARIAS" Then
e.CellStyle.BackColor = System.Drawing.Color.Gray
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON ZERO BALANCE ACCOUNT" Then
e.CellStyle.BackColor = System.Drawing.Color.DarkBlue
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON MONTO HISTORICO" Then
e.CellStyle.BackColor = System.Drawing.Color.DarkCyan
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON DISPOSICION INMEDIATA" Then
e.CellStyle.BackColor = System.Drawing.Color.IndianRed
e.CellStyle.ForeColor = System.Drawing.Color.White
End If
If S = "PATRON NUEVAS INUSUAL" Then
e.CellStyle.BackColor = System.Drawing.Color.White
e.CellStyle.ForeColor = System.Drawing.Color.Black
End If
End Sub
End Class