243 lines
8.1 KiB
VB.net
243 lines
8.1 KiB
VB.net
|
|
|||
|
|
|||
|
Public Class FRAuditoria
|
|||
|
|
|||
|
Public SQL As String
|
|||
|
Dim SQL2 As String
|
|||
|
|
|||
|
Private Sub FRAuditoria_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|||
|
|
|||
|
Dim CLASSCOM As New clsComplejo
|
|||
|
Dim index As Integer
|
|||
|
|
|||
|
|
|||
|
CLASSCOM = New clsComplejo
|
|||
|
SQL = "sp_ConsultarUsuarios "
|
|||
|
CLASSCOM.sbLlenaCombo(SQL, cmbUsuario)
|
|||
|
|
|||
|
CLASSCOM = New clsComplejo
|
|||
|
SQL = "sp_CosultarTodoAuditoria "
|
|||
|
CLASSCOM.fdtDataSetTabla(SQL)
|
|||
|
|
|||
|
'cmbSuceso.Items.Clear()
|
|||
|
|
|||
|
'For index = 0 To CLASSCOM.ds.Tables(0).Rows.Count - 1
|
|||
|
' cmbSuceso.Items.Add(CLASSCOM.ds.Tables(0).Rows(index).Item(0).ToString)
|
|||
|
'Next
|
|||
|
|
|||
|
|
|||
|
'cmbSuceso.DataSource = CLASSCOM.ds.Tables(0).Columns(0)
|
|||
|
|
|||
|
'CLASSCOM.sbLlenaComboESP(SQL, Me.cmbSuceso, "NOMBRE")
|
|||
|
|
|||
|
|
|||
|
'CLASSCOM = New clsComplejo
|
|||
|
'SQL = "spTablasAuditoria "
|
|||
|
'CLASSCOM.sbLlenaComboESP(SQL, Me.CboTabla, "NOMBRE")
|
|||
|
|
|||
|
'CLASSCOM = New clsComplejo
|
|||
|
'SQL = "spConMovimiento "
|
|||
|
'CLASSCOM.sbLlenaComboESP(SQL, Me.cboMOv, "NOMBRE")
|
|||
|
|
|||
|
cmbUsuario.SelectedIndex = -1
|
|||
|
cmbSuceso.SelectedIndex = -1
|
|||
|
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Public Sub sbBuscar()
|
|||
|
Dim CLCMP As New clsComplejo
|
|||
|
Dim VarComodin As Long
|
|||
|
'Dim SQL As String
|
|||
|
|
|||
|
Try
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
|
|||
|
Dim SQL2 As String
|
|||
|
'armaquery()
|
|||
|
|
|||
|
SQL2 = "sp_CosultarAuditoria " & "'" & dtpFechaInicio.Value.ToString("yyyy/MM/dd") & "','" & dtpFechaFin.Value.ToString("yyyy/MM/dd") & "'," &
|
|||
|
IIf(cmbUsuario.Text <> "", cmbUsuario.SelectedValue, "NULL") & "," & IIf(cmbSuceso.SelectedValue <> Nothing, cmbSuceso.SelectedValue, "NULL")
|
|||
|
|
|||
|
CLCMP.fdtDataSetTabla(SQL2)
|
|||
|
|
|||
|
Me.GridCentral.SetDataBinding(CLCMP.ds, "Tabla")
|
|||
|
GridCentral.Columns(4).NumberFormat = "g"
|
|||
|
|
|||
|
Me.GridCentral.Visible = True
|
|||
|
|
|||
|
Dim Cont As Integer
|
|||
|
Cont = CLCMP.ds.Tables(0).Rows.Count
|
|||
|
LblNumReg.Text = "Numero de Registros : " & Cont
|
|||
|
|
|||
|
Catch er As Exception
|
|||
|
MessageBox.Show("Error al Buscar " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
End Try
|
|||
|
End Sub
|
|||
|
|
|||
|
|
|||
|
Private Sub armaquery()
|
|||
|
Dim CLCMP As New clsComplejo
|
|||
|
Dim VarComodin As Long
|
|||
|
|
|||
|
SQL2 = "ConAuditoria '" & CLCMP.ObtenFecha(dtpFechaInicio.Value.Date, "YYYYMMDD") & "','" & CLCMP.ObtenFecha(dtpFechaFin.Value.Date, "YYYYMMDD") & "'"
|
|||
|
|
|||
|
If Me.cmbUsuario.Text <> "" Then
|
|||
|
SQL2 = SQL2 & " ," & cmbUsuario.SelectedValue
|
|||
|
Else
|
|||
|
SQL2 = SQL2 & " , 0"
|
|||
|
End If
|
|||
|
|
|||
|
If Me.cmbSuceso.Text <> "" Then
|
|||
|
SQL2 = SQL2 & " , " & cmbSuceso.SelectedValue
|
|||
|
Else
|
|||
|
SQL2 = SQL2 & " ,0 "
|
|||
|
End If
|
|||
|
|
|||
|
|
|||
|
If Me.cboMOv.Text <> "" Then
|
|||
|
SQL2 = SQL2 & " , '" & cboMOv.Text & "'"
|
|||
|
Else
|
|||
|
SQL2 = SQL2 & " , ''"
|
|||
|
End If
|
|||
|
|
|||
|
End Sub
|
|||
|
Private Sub Exportar()
|
|||
|
Dim CLCMP As New clsComplejo
|
|||
|
Try
|
|||
|
|
|||
|
'armaquery()
|
|||
|
'CLCMP.fdtDataSetTabla(SQL2)
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
|
|||
|
'Dim copyDS As DataSet = GridCentral.DataSource.Copy()
|
|||
|
|
|||
|
If GridCentral.RowCount = 0 Then
|
|||
|
MessageBox.Show("Realiza una consulta ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
Else
|
|||
|
|
|||
|
Dim Resul As DialogResult
|
|||
|
Resul = MessageBox.Show("Este proceso puede tardar varios minutos, <20>Deseas continuar? ", "MINDS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|||
|
If Resul = DialogResult.Yes Then
|
|||
|
'Creamos una copia del dataset
|
|||
|
Dim copyDS As DataSet = GridCentral.DataSource.Copy()
|
|||
|
'Quitamos las siguientes columnas para no exportarlas
|
|||
|
'AU.ID_AUDITORIA,AU.ID_USUARIO,U.USUARIO,SU.CDESC_SUSC DESCRIPCION,AU.FECHAUDI 'FECHA AUDITORIA' ,AU.PCNAME"
|
|||
|
|
|||
|
'copyDS.Tables(0).Columns.Remove("ID_AUDITORIA")
|
|||
|
'copyDS.Tables(0).Columns.Remove("ID_USUARIO")
|
|||
|
'copyDS.Tables(0).Columns.Remove("DESCRIPCION")
|
|||
|
'copyDS.Tables(0).Columns.Remove("FECHA AUDITORIA")
|
|||
|
'copyDS.Tables(0).Columns.Remove("PCNAME")
|
|||
|
'copyDS.Tables(0).Columns.Remove("funcionario")
|
|||
|
'copyDS.Tables(0).Columns.Remove("beneficiario")
|
|||
|
'copyDS.Tables(0).Columns.Remove("ordenante")
|
|||
|
'copyDS.Tables(0).Columns.Remove("hora")
|
|||
|
'copyDS.Tables(0).Columns.Remove("idtransaccion")
|
|||
|
'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
|
|||
|
Catch ex As Exception
|
|||
|
MessageBox.Show(ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|||
|
End Try
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub refrescar()
|
|||
|
If clsVaribles.lbDemo = True Then Exit Sub
|
|||
|
|
|||
|
'Combo SUCESO
|
|||
|
Me.cmbSuceso.SelectedIndex = -1
|
|||
|
Me.cmbUsuario.SelectedIndex = -1
|
|||
|
Me.cboMOv.SelectedIndex = -1
|
|||
|
|
|||
|
|
|||
|
'Grid
|
|||
|
'Me.GridCentral.Visible = False
|
|||
|
Me.GridCentral.DataSource = Nothing
|
|||
|
Me.GridCentral.DataBindings.Clear()
|
|||
|
|
|||
|
'etiqueta
|
|||
|
Me.LblNumReg.Text = ""
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub cmbSuceso_DropDown(sender As Object, e As System.EventArgs) Handles cmbSuceso.DropDown
|
|||
|
cmbSuceso.DataSource = Nothing
|
|||
|
|
|||
|
If cmbUsuario.SelectedValue <> Nothing Then
|
|||
|
|
|||
|
Dim Classcom = New clsComplejo
|
|||
|
SQL = "sp_ConsultarSuceso " & cmbUsuario.SelectedValue
|
|||
|
Classcom.sbLlenaCombo(SQL, cmbSuceso)
|
|||
|
|
|||
|
End If
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub cmbSuceso_DropDownClosed(sender As Object, e As System.EventArgs) Handles cmbSuceso.DropDownClosed
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
'Private Sub cmbSuceso_DropDownClosed(sender As Object, e As System.EventArgs) Handles cmbSuceso.DropDownClosed
|
|||
|
' cboMOv.SelectedIndex = -1
|
|||
|
' CboTabla.SelectedIndex = -1
|
|||
|
' cboMOv.SelectedIndex = -1
|
|||
|
' CboTabla.SelectedIndex = -1
|
|||
|
'End Sub
|
|||
|
|
|||
|
Private Sub cmbSuceso_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbSuceso.SelectedIndexChanged
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BntSalie_Click(sender As System.Object, e As System.EventArgs)
|
|||
|
Me.Close()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub btnConsulta_Click(sender As System.Object, e As System.EventArgs)
|
|||
|
sbBuscar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs)
|
|||
|
refrescar()
|
|||
|
End Sub
|
|||
|
|
|||
|
|
|||
|
'Private Sub cboMOv_DropDownClosed(sender As Object, e As System.EventArgs) Handles cboMOv.DropDownClosed
|
|||
|
' cmbSuceso.SelectedIndex = -1
|
|||
|
' cmbSuceso.SelectedIndex = -1
|
|||
|
'End Sub
|
|||
|
|
|||
|
'Private Sub CboTabla_DropDownClosed(sender As Object, e As System.EventArgs) Handles CboTabla.DropDownClosed
|
|||
|
' cmbSuceso.SelectedIndex = -1
|
|||
|
' cmbSuceso.SelectedIndex = -1
|
|||
|
'End Sub
|
|||
|
|
|||
|
Private Sub BtnImprimir_Click(sender As System.Object, e As System.EventArgs)
|
|||
|
Exportar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub tlbInusualesDivisas_ButtonClick(sender As System.Object, e As System.Windows.Forms.ToolBarButtonClickEventArgs)
|
|||
|
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub btnConsulta_Click_1(sender As Object, e As EventArgs) Handles btnConsulta.Click
|
|||
|
sbBuscar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnLimpiar_Click_1(sender As Object, e As EventArgs) Handles BtnLimpiar.Click
|
|||
|
refrescar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub BtnImprimir_Click_1(sender As Object, e As EventArgs) Handles BtnImprimir.Click
|
|||
|
Exportar()
|
|||
|
End Sub
|
|||
|
|
|||
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles BntSalie.Click
|
|||
|
Close()
|
|||
|
End Sub
|
|||
|
End Class
|