client/ProcesoHIT/FrmProcesoHit.vb

136 lines
6.1 KiB
VB.net

Public Class FrmProcesoHit
Private Util As New ClassMyUtils
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub FrmProcesoHit_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Util.LogProcesoHit("FrmProcesoHit_Load", "---------------------------------------------------")
cargarHits()
End Sub
Private Function cargarHits()
Dim Ssql As String
Dim cls As clsComplejo
Dim ds As New DataSet
Util.LogProcesoHit("cargarHits", "Iniciando")
Try
SaveColumnFilterText()
cls = New clsComplejo()
Ssql = "spS_procesoHIT '" & dtpFecha.Value.Date & "'"
ds = cls.fdtDataSetTablaESP(Ssql)
gridHits.DataSource = Nothing
gridHits.AllowUpdate = False
gridHits.ClearFields()
gridHits.Refresh()
gridHits.SetDataBinding(ds, "Tabla")
For Each col As C1.Win.C1TrueDBGrid.C1DisplayColumn In gridHits.Splits(0).DisplayColumns
col.AutoSize()
Next
For i As Integer = 0 To gridHits.Columns.Count - 1
gridHits.Columns(i).Caption = gridHits.Columns(i).Caption.ToString.ToUpper
Next
gridHits.Splits(0).DisplayColumns(0).Visible = False
gridHits.Splits(0).DisplayColumns(2).Visible = False
gridHits.Splits(0).DisplayColumns(5).Visible = False
gridHits.Splits(0).DisplayColumns(6).Visible = False
gridHits.Splits(0).DisplayColumns(10).Visible = False
gridHits.Splits(0).DisplayColumns(14).Visible = False
Util.LogProcesoHit("cargarHits", "Grid llenado")
ReloadColumnFilterText()
Catch ex As Exception
Util.LogProcesoHit("cargarHits", "Error: " & ex.Message)
MessageBox.Show(ex.Message)
End Try
End Function
Private Sub gridHits_DoubleClick(sender As System.Object, e As System.EventArgs) Handles gridHits.DoubleClick
Dim dr As DataRow
If gridHits.RowCount > 0 Then
abrirDetalle()
End If
End Sub
Private Function abrirDetalle() As Boolean
Dim DetalleHit As frmDetalleHit = New frmDetalleHit
Util.LogProcesoHit("abrirDetalle", "Iniciando")
Try
Util.LogProcesoHit("abrirDetalle", "Enviando datos al detalle")
DetalleHit.Id = gridHits.Columns(0).CellValue(gridHits.Row)
Util.LogProcesoHit("abrirDetalle", "ID: " & DetalleHit.Id)
DetalleHit.IdOT = gridHits.Columns(1).CellValue(gridHits.Row)
Util.LogProcesoHit("abrirDetalle", "IdOT: " & DetalleHit.IdOT)
DetalleHit.CadenaOT = gridHits.Columns(2).CellValue(gridHits.Row)
Util.LogProcesoHit("abrirDetalle", "CadenaOT: " & DetalleHit.CadenaOT)
DetalleHit.IsOk = IIf(gridHits.Columns(3).CellValue(gridHits.Row) = "OK", True, False)
Util.LogProcesoHit("abrirDetalle", "IsOk: " & DetalleHit.IsOk)
DetalleHit.Detalles = gridHits.Columns(5).CellValue(gridHits.Row)
Util.LogProcesoHit("abrirDetalle", "Detalles: " & DetalleHit.Detalles)
DetalleHit.IdUsuario1 = IIf(IsDBNull(gridHits.Columns(6).CellValue(gridHits.Row)), 0, gridHits.Columns(6).CellValue(gridHits.Row))
Util.LogProcesoHit("abrirDetalle", "IdUsuario1: " & DetalleHit.IdUsuario1)
DetalleHit.IdUsuario2 = IIf(IsDBNull(gridHits.Columns(10).CellValue(gridHits.Row)), 0, gridHits.Columns(10).CellValue(gridHits.Row))
Util.LogProcesoHit("abrirDetalle", "IdUsuario2: " & DetalleHit.IdUsuario2)
DetalleHit.IdUsuarioOC = IIf(IsDBNull(gridHits.Columns(14).CellValue(gridHits.Row)), 0, gridHits.Columns(14).CellValue(gridHits.Row))
Util.LogProcesoHit("abrirDetalle", "IdUsuarioOC: " & DetalleHit.IdUsuarioOC)
DetalleHit.calif1 = IIf(IsDBNull(gridHits.Columns(8).CellValue(gridHits.Row)), False, gridHits.Columns(8).CellValue(gridHits.Row))
Util.LogProcesoHit("abrirDetalle", "calif1: " & DetalleHit.calif1)
DetalleHit.calif2 = IIf(IsDBNull(gridHits.Columns(12).CellValue(gridHits.Row)), False, gridHits.Columns(12).CellValue(gridHits.Row))
Util.LogProcesoHit("abrirDetalle", "calif2: " & DetalleHit.calif2)
DetalleHit.califOC = IIf(IsDBNull(gridHits.Columns(16).CellValue(gridHits.Row)), False, gridHits.Columns(16).CellValue(gridHits.Row))
Util.LogProcesoHit("abrirDetalle", "califOC: " & DetalleHit.califOC)
Util.LogProcesoHit("abrirDetalle", "abiendo detalle")
DetalleHit.ShowDialog(Me)
Util.LogProcesoHit("abrirDetalle", "finalizo detalle cargando Hits")
cargarHits()
Util.LogProcesoHit("abrirDetalle", "finalizado")
Catch ex As Exception
Util.LogProcesoHit("abrirDetalle", "Error: " & ex.Message)
MessageBox.Show(ex.Message)
End Try
End Function
Public ColumnFilterText As New ArrayList
Private Sub SaveColumnFilterText()
Me.ColumnFilterText.Clear()
For Each col As C1.Win.C1TrueDBGrid.C1DisplayColumn In Me.gridHits.Splits(0).DisplayColumns
Me.ColumnFilterText.Add(col.DataColumn.FilterText)
Next
End Sub
Private Sub ReloadColumnFilterText()
Dim i As Integer = 0
For Each col As C1.Win.C1TrueDBGrid.C1DisplayColumn In Me.gridHits.Splits(0).DisplayColumns
If i = Me.ColumnFilterText.Count Then Exit For
col.DataColumn.FilterText = Me.ColumnFilterText.Item(i)
i += 1
Next
End Sub
Private Sub cmdConfig_Click(sender As System.Object, e As System.EventArgs) Handles cmdConfig.Click
Try
Dim hitconfig As New frmConfigHit
hitconfig.ShowDialog(Me)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub dtpFecha_ValueChanged(sender As System.Object, e As System.EventArgs) Handles dtpFecha.ValueChanged
cargarHits()
End Sub
End Class