199 lines
7.7 KiB
VB.net
199 lines
7.7 KiB
VB.net
Public Class FrmReporteAsesorias
|
|
Dim clCmp As clsComplejo = New clsComplejo
|
|
|
|
|
|
|
|
Private Sub FrmReporteAsesorias_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
|
|
Dim clCmp As clsComplejo = New clsComplejo
|
|
clCmp.sbLlenaCombo("spLlenaComboClienteAsesoria", Me.cmbCliente)
|
|
cmbCliente.SelectedIndex = -1
|
|
Dim clCmp2 As clsComplejo = New clsComplejo
|
|
clCmp2.sbLlenaCombo("spLlenaComboPropositoCuentasAsesoria", Me.cmbTipoServicio)
|
|
cmbTipoServicio.SelectedIndex = -1
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub DBGDetalleAlarmas_DoubleClick(sender As Object, e As EventArgs) Handles DBGDetalleAlarmas.DoubleClick
|
|
Dim FilaActual As Integer
|
|
FilaActual = Me.DBGDetalleAlarmas.Row
|
|
If Me.DBGDetalleAlarmas.RowCount <= 0 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Try
|
|
Dim idCuenta As Integer = DBGDetalleAlarmas.Columns("idcuenta").Text
|
|
Dim SQL As String = ""
|
|
Dim MyDs As New DataSet
|
|
SQL = "sp_ObtieneAlarmasEnAsesoriasPorCuenta " & idCuenta & " "
|
|
MyDs = clCmp.fdtDataSetTablaESP(SQL)
|
|
Me.C1TrueDBGrid2.DataSource = Nothing
|
|
Me.C1TrueDBGrid2.Columns.Clear()
|
|
Me.C1TrueDBGrid2.Refresh()
|
|
Me.C1TrueDBGrid2.SetDataBinding(MyDs, "Tabla")
|
|
For number As Integer = 0 To C1TrueDBGrid2.Columns.Count - 1
|
|
C1TrueDBGrid2.Splits(0).DisplayColumns(number).AutoSize()
|
|
Next
|
|
|
|
|
|
lblRegistros.Text = "No. de Registros: " & C1TrueDBGrid2.RowCount
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub BtnConsul_Click(sender As Object, e As EventArgs) Handles BtnConsul.Click
|
|
Dim SQL As String = ""
|
|
Dim MyDs As New DataSet
|
|
'spObtieneAlarmasConFiltros
|
|
'sp_ObtieneAlarmasEnAsesorias
|
|
SQL = "spObtieneAlarmasConFiltros "
|
|
If (Convert.ToInt32(cmbCliente.SelectedValue) > 0) Then
|
|
SQL = SQL & Convert.ToInt32(cmbCliente.SelectedValue)
|
|
Else
|
|
SQL += "null"
|
|
End If
|
|
If (Convert.ToInt32(cmbCuenta.SelectedValue) > 0) Then
|
|
SQL = SQL & " , " & Convert.ToInt32(cmbCuenta.SelectedValue)
|
|
Else
|
|
SQL += ",null"
|
|
End If
|
|
If (Convert.ToInt32(cmbTipoServicio.SelectedValue) > 0) Then
|
|
SQL = SQL & " , " & Convert.ToInt32(cmbTipoServicio.SelectedValue)
|
|
Else
|
|
SQL += ",null"
|
|
End If
|
|
' SQL = "spObtieneAlarmasConFiltros " & Convert.ToInt32(cmbCliente.SelectedValue) & ", " & Convert.ToInt32(cmbCuenta.SelectedValue) & " "
|
|
|
|
Try
|
|
MyDs = clCmp.fdtDataSetTablaESP(SQL)
|
|
Me.DBGDetalleAlarmas.DataSource = Nothing
|
|
Me.DBGDetalleAlarmas.Columns.Clear()
|
|
Me.DBGDetalleAlarmas.Refresh()
|
|
Me.DBGDetalleAlarmas.SetDataBinding(MyDs, "Tabla")
|
|
Me.DBGDetalleAlarmas.Splits(0).DisplayColumns(6).Visible = False
|
|
For number As Integer = 0 To DBGDetalleAlarmas.Columns.Count - 1
|
|
DBGDetalleAlarmas.Splits(0).DisplayColumns(number).AutoSize()
|
|
Next
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
Dim ClassAud As New ClassMyUtils
|
|
Dim sTextoAud As String
|
|
sTextoAud = "Reporte de Asesorias "
|
|
If cmbCliente.Text <> "" Then
|
|
sTextoAud = sTextoAud & ", Cliente: " & cmbCliente.Text
|
|
End If
|
|
If cmbCuenta.Text <> "" Then
|
|
sTextoAud = sTextoAud & ", Cuenta: " & cmbCuenta.Text
|
|
End If
|
|
If cmbTipoServicio.Text <> "" Then
|
|
sTextoAud = sTextoAud & ", Tipo Servicio: " & cmbTipoServicio.SelectedValue
|
|
End If
|
|
If sTextoAud.Trim = "Reporte de Asesorias" Then
|
|
sTextoAud = "Reporte general de Asesorias "
|
|
End If
|
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 130, 24, sTextoAud)
|
|
|
|
End Sub
|
|
|
|
Private Sub cmbCliente_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cmbCliente.SelectionChangeCommitted
|
|
Dim clCmp As clsComplejo = New clsComplejo
|
|
clCmp.sbLlenaCombo("spLlenaComboCuentasAsesoria " & Convert.ToInt32(cmbCliente.SelectedValue) & " ", Me.cmbCuenta)
|
|
cmbCuenta.SelectedIndex = -1
|
|
End Sub
|
|
|
|
Private Sub cmbCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbCliente.SelectedIndexChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub panel2_Paint(sender As Object, e As PaintEventArgs) Handles panel2.Paint
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnExpor_Click(sender As Object, e As EventArgs) Handles BtnExpor.Click
|
|
Exportar()
|
|
End Sub
|
|
Private Sub Exportar()
|
|
|
|
If DBGDetalleAlarmas.DataSource Is Nothing Then
|
|
MessageBox.Show("Presione primero el botó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 = DBGDetalleAlarmas.DataSource.Copy() ''clCmp.ds.Copy()
|
|
If copyDS.Tables(0) Is Nothing Then
|
|
MessageBox.Show("Presione primero el botó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, ¿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 DBGDetalleAlarmas.Columns.Count - 1
|
|
If Me.DBGDetalleAlarmas.Splits(0).DisplayColumns(i).Visible = False Then
|
|
Dim j As Integer
|
|
For j = 0 To copyDS.Tables(0).Columns.Count - 1
|
|
If Me.DBGDetalleAlarmas.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
|
|
|
|
Dim ClassAud As New ClassMyUtils
|
|
Dim sTextoAud As String
|
|
sTextoAud = "Exporta reporte de Asesorías "
|
|
ClassAud.RT_Auditoria(clsVaribles.varUsuario, 130, 24, sTextoAud)
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnRefres_Click(sender As Object, e As EventArgs) Handles BtnRefres.Click
|
|
Me.cmbCliente.SelectedIndex = -1
|
|
Me.cmbCliente.SelectedIndex = -1
|
|
|
|
cmbCuenta.DataSource = Nothing
|
|
cmbCuenta.Items.Clear()
|
|
Me.cmbTipoServicio.SelectedIndex = -1
|
|
Me.cmbTipoServicio.SelectedIndex = -1
|
|
|
|
|
|
Me.DBGDetalleAlarmas.DataSource = Nothing
|
|
Me.DBGDetalleAlarmas.DataBindings.Clear()
|
|
|
|
End Sub
|
|
|
|
Private Sub BtnSal_Click(sender As Object, e As EventArgs) Handles BtnSal.Click
|
|
Me.Close()
|
|
End Sub
|
|
End Class |