client/Reportes/OperPreoSinTran.vb

814 lines
36 KiB
VB.net
Raw Permalink Normal View History

Imports System.Text.RegularExpressions
Public Class OperPreoSinTran
Dim plazaSucursalSeleccionada As String
Public bProvieneDeRepAnonimo As Boolean = False
Private Sub OperPreoAdminDetalle_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim cargarCbo As New clsComplejo
Dim sSQL As String
dtpFechaOper.MaxDate = Now
Try
''Llenar combo de estados
'sSQL = "SELECT Id_Estado clave, Nombre FROM Cat_Estado WHERE Id_Estado BETWEEN 1 AND 32 ORDER BY Id_Estado"
'sSQL = "SELECT Id_Estado clave, Nombre FROM Cat_Estado ORDER BY Id_Estado"
sSQL = "SELECT IdEstado clave, Estado as Nombre FROM Cat_Estado WHERE IdEstado BETWEEN 1 AND 33 ORDER BY IdEstado"
cargarCbo.sbLlenaCombo(sSQL, cmbEstado)
cmbEstado.SelectedIndex = -1
cargarCbo = Nothing
cargarCbo = New clsComplejo
''LLenar combo de Actividades Económicas
'sSQL = "SELECT Id_ActividadEconomica Clave, Nombre FROM Cat_ActividadEconomica ORDER BY Nombre "
sSQL = "SELECT IdActividadEconomica Clave,ActividadEconomica as Nombre FROM Cat_ActividadEconomica ORDER BY ActividadEconomica "
cargarCbo.sbLlenaCombo(sSQL, cmbActEconom)
cmbActEconom.SelectedIndex = -1
'cmbPlaza.Text = "Seleccione primero un estado"
addRegistro()
cmbPlaza.SelectedIndex = 0
cargarCbo = Nothing
cargarCbo = New clsComplejo
'cargarCbo.sbLlenaCombo("SELECT Id_Estatus as clave, CDesc_Estatus as nombre FROM EstatusTransacciones WHERE Id_Estatus = 0", cmbEstatusOper)
cargarCbo.sbLlenaCombo("SELECT IdEstatusAlarma as clave, EstatusAlarma as nombre FROM CAT_ESTATUSALARMA", cmbEstatusOper)
cmbEstatusOper.SelectedIndex = -1
cargarCbo = Nothing
cargarCbo = New clsComplejo
'cargarCbo.sbLlenaCombo("select ISO clave, nombre FROM cat_pais where len(iso) > 0", cboNacionalidad)
cargarCbo.sbLlenaCombo("select IDNACIONALIDAD clave, DESCRIPCION nombre FROM CAT_NACIONALIDAD", cboNacionalidad)
cboNacionalidad.SelectedIndex = -1
' ''Funcionario
'cargarCbo.sbLlenaCombo("spConsultarFuncionario", Me.cmbFuncionario)
'cmbFuncionario.SelectedIndex = -1
'cargarCbo = Nothing
'cargarCbo = New clsComplejo
'' ''Estatus de la operacion
'cargarCbo.sbLlenaCombo("spLlenaComboEstatusTransacciones", cmbEstatusOper)
'cmbEstatusOper.SelectedIndex = -1
cargarCbo = Nothing
cargarCbo = New clsComplejo
cargarCbo.sbLlenaCombo("select idproducto clave, alias nombre FROM cat_producto where activo = 1", cboProducto)
cboProducto.SelectedIndex = -1
'Actualiza grid
'BtnLimpiar.PerformClick()
ActualizaGrid()
dtpFechaDetecion.Enabled = False
btnRelacionadas.Enabled = False
btnRelacionadas.BackColor = Color.DarkGray
cargarSucursal()
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub BntSalie_Click(sender As System.Object, e As System.EventArgs) Handles BntSalie.Click
Me.Close()
End Sub
Private Sub txtNombre_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtNombre.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = True
End If
End Sub
Private Sub txtApePaterno_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtApePaterno.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = True
End If
End Sub
Private Sub txtApeMaterno_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtApeMaterno.KeyPress
If Char.IsDigit(e.KeyChar) Then
e.Handled = True
End If
End Sub
Private Sub txtRFC_Validating(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles txtRFC.Validating
'Try
' txtRFC.Text = txtRFC.Text.ToUpper()
' If txtRFC.Text <> String.Empty Then
' If Regex.IsMatch(txtRFC.Text.Trim, "^([A-Z\s]{4})\d{6}$") = True Then
' Return
' End If
' If Regex.IsMatch(txtRFC.Text.Trim, "^([A-Z\s]{4})\d{6}([A-Z\w]{2,3})$") = False Then
' MsgBox("El RFC no es válido. El formato correcto es: LLLL###### ó LLLL######AA ó LLLL######AAA. L=Letra, #=Número, A=Alfanumérico.")
' End If
' End If
'Catch ex As Exception
' MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'End Try
End Sub
Private Sub txtCURP_Validating(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles txtCURP.Validating
'Try
' txtCURP.Text = txtCURP.Text.ToUpper()
' If txtCURP.Text <> String.Empty Then
' If Regex.IsMatch(txtCURP.Text.Trim, "[a-zA-Z]{4,4}[0-9]{6}[a-zA-Z]{6,6}[0-9]{2}") = True Then
' Return
' Else
' ''
' MsgBox("La CURP no es válida. El formato correcto es: LLLL######LLLLLL## ")
' End If
' End If
'Catch ex As Exception
' MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'End Try
End Sub
Private Sub BtnAlta_Click(sender As System.Object, e As System.EventArgs) Handles BtnAlta.Click
''Inserta o Actualiza el registro
Dim ClassCom As New clsComplejo
Dim strSQL As String
Dim mensaje As String = ""
CambiaColorAzul()
Dim is24Hrs As Boolean
Try
If txtNombre.Text = "" Then
'MessageBox.Show("Definir el nombre.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Nombre " + vbCrLf + " "
Label1.ForeColor = Color.Red
End If
If txtApePaterno.Text = "" Then
'MessageBox.Show("Definir el apellido paterno.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Apellido Paterno " + vbCrLf + " "
Label2.ForeColor = Color.Red
End If
'If txtApeMaterno.Text = "" Then
' 'MessageBox.Show("Definir el apellido materno.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
' 'Return
' mensaje = mensaje + "Apellido Materno " + vbCrLf + " "
' Label3.ForeColor = Color.Red
'End If
If txtRFC.Text = "" Then
'MessageBox.Show("Definir el RFC.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "RFC " + vbCrLf + " "
Label4.ForeColor = Color.Red
End If
'If Regex.IsMatch(txtRFC.Text, "^([a-zA-Z]{4})([0-9]{6})([a-zA-Z0-9]{3})") = False Or txtRFC.Text.Length <> 13 Then
' If Regex.IsMatch(txtRFC.Text, "^([a-zA-Z]{4})([0-9]{6})") = False Or txtRFC.Text.Length <> 10 Then
' MsgBox("El Registro no es válido. El formato correcto es: XXXX######XXX ó XXXX######")
' Return
' End If
'End If
If txtCURP.Text = "" Then
'MessageBox.Show("Definir la CURP.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "CURP " + vbCrLf + " "
Label5.ForeColor = Color.Red
End If
'If Regex.IsMatch(txtRFC.Text, "^([a-zA-Z]{4})([0-9]{6})([a-zA-Z]{6})([0-9]{2})") = False Or txtRFC.Text.Length <> 18 Then
' MsgBox("El Registro no es válido. El formato correcto es: XXXX######XXXXXX## ")
' Return
'End If
If txtDomicilio.Text = "" Then
'MessageBox.Show("Definir el domicilio.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Domicilio " + vbCrLf + " "
Label7.ForeColor = Color.Red
End If
If txtColonia.Text = "" Then
'MessageBox.Show("Definir la colonia.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Colonia " + vbCrLf + " "
Label8.ForeColor = Color.Red
End If
If cmbEstado.SelectedValue Is Nothing Then
'MessageBox.Show("Definir el Estado.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Estado " + vbCrLf + " "
Label12.ForeColor = Color.Red
End If
If cmbPlaza.SelectedValue Is Nothing Then
'MessageBox.Show("Definir la ciudad.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Ciudad " + vbCrLf + " "
Label9.ForeColor = Color.Red
End If
If txtTelefono.Text = "" Then
'MessageBox.Show("Definir el teléfono.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Teléfono " + vbCrLf + " "
Label10.ForeColor = Color.Red
End If
If cmbActEconom.SelectedValue Is Nothing Then
'MessageBox.Show("Definir la actividad económica.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Actividad Económica " + vbCrLf + " "
Label11.ForeColor = Color.Red
End If
If cboNacionalidad.SelectedValue Is Nothing Then
'MessageBox.Show("Definir la nacionalidad.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "País Nacionalidad " + vbCrLf + " "
Label15.ForeColor = Color.Red
End If
'If cboProducto.SelectedValue Is Nothing Then
' 'MessageBox.Show("Definir el producto.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
' 'Return
' mensaje = mensaje + "Producto " + vbCrLf + " "
' Label16.ForeColor = Color.Red
'End If
If txtNota.Text = "" Then
'MessageBox.Show("Definir la descripción de la operación.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Descripción " + vbCrLf + " "
Label21.ForeColor = Color.Red
End If
If txtRazon.Text = "" Then
'MessageBox.Show("Definir la razón de la operación.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Razón " + vbCrLf + " "
Label20.ForeColor = Color.Red
End If
If cmbEstatusOper.SelectedValue Is Nothing Then
'MessageBox.Show("Definir el estatus de la operación.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Return
mensaje = mensaje + "Estatus " + vbCrLf + " "
Label18.ForeColor = Color.Red
End If
If cboSucursal.SelectedValue Is Nothing Then
mensaje = mensaje + "Sucursal " + vbCrLf + " "
Label23.ForeColor = Color.Red
End If
If txtCPSucursal.Text.Trim = "" Then
mensaje = mensaje + "Código Postal Sucursal " + vbCrLf + " "
Label24.ForeColor = Color.Red
End If
If Me.cmbEstatusOper.SelectedValue = 5 Then
MessageBox.Show("No es posible almacenar una alarma con estatus 'Enviado', este estatus es informativo.", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
If mensaje.Length > 0 Then
mensaje = "Campos Obligatorios " + vbCrLf + " " + mensaje
MessageBox.Show(mensaje, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
Dim NombreProducto As String
NombreProducto = cboProducto.Text
If cboProducto.Text = "MERCADO DE CAPITALES" Then
NombreProducto = "MERCADO DE DINERO"
End If
If chk24H.Checked Then
is24Hrs = True
Else
is24Hrs = False
End If
txtNombre.Text = txtNombre.Text.ToUpper()
txtApePaterno.Text = txtApePaterno.Text.ToUpper()
txtApeMaterno.Text = txtApeMaterno.Text.ToUpper()
txtRFC.Text = txtRFC.Text.ToUpper()
txtCURP.Text = txtCURP.Text.ToUpper()
txtDomicilio.Text = txtDomicilio.Text.ToUpper()
txtColonia.Text = txtColonia.Text.ToUpper()
txtTelefono.Text = txtTelefono.Text.ToUpper()
strSQL = "spOperacionesSinTransaccion " & Chr(39) & lblIdPreocupSinTran.Text & Chr(39) & "," & Chr(39) & txtNombre.Text & Chr(39) & ","
If txtApePaterno.Text = "" Then
strSQL = strSQL & Chr(39) & "XXXX" & Chr(39) & ","
Else
strSQL = strSQL & Chr(39) & txtApePaterno.Text & Chr(39) & ","
End If
If txtApeMaterno.Text = "" Then
strSQL = strSQL & Chr(39) & "XXXX" & Chr(39) & ","
Else
strSQL = strSQL & Chr(39) & txtApeMaterno.Text & Chr(39) & ","
End If
strSQL = strSQL & Chr(39) & txtRFC.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtCURP.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & dtpFechaNac.Value.Year.ToString & dtpFechaNac.Value.Month.ToString("d2") & dtpFechaNac.Value.Day.ToString("d2") & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtDomicilio.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtColonia.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & cmbPlaza.SelectedValue & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtTelefono.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & cmbActEconom.SelectedValue & Chr(39) & ","
''Controles de la pagina 2
'strSQL = strSQL & Chr(39) & cmbFuncionario.SelectedValue & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtNota.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtRazon.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & dtpFechaDetecion.Value.Year.ToString & dtpFechaDetecion.Value.Month.ToString("d2") & dtpFechaDetecion.Value.Day.ToString("d2") & Chr(39) & ","
strSQL = strSQL & Chr(39) & cmbEstatusOper.SelectedValue & Chr(39) & ","
'strSQL = strSQL & Chr(39) & NombreProducto & Chr(39) & ","
strSQL = strSQL & "NULL" & ","
strSQL = strSQL & Chr(39) & "PATRON INTERNA PREOCUPANTE" & Chr(39) & ","
strSQL = strSQL & Chr(39) & "PREOCUPANTE" & Chr(39) & ", " & IIf(bProvieneDeRepAnonimo = True, "1", "0") & ","
strSQL = strSQL & Chr(39) & dtpFechaOper.Value.Year.ToString & dtpFechaOper.Value.Month.ToString("d2") & dtpFechaOper.Value.Day.ToString("d2") & Chr(39) & ","
strSQL = strSQL & Chr(39) & cboNacionalidad.SelectedValue & Chr(39) & ","
strSQL = strSQL & Chr(39) & cboSucursal.SelectedValue & Chr(39) & ","
strSQL = strSQL & Chr(39) & txtCPSucursal.Text & Chr(39) & ","
strSQL = strSQL & Chr(39) & plazaSucursalSeleccionada & Chr(39) & ","
strSQL = strSQL & is24Hrs
ClassCom = New clsComplejo
ClassCom.fdtDataSetTabla(strSQL)
If ClassCom.ds.Tables(0).Rows(0)("Resultado") = -1 Then
''Mensaje de error
MessageBox.Show(ClassCom.ds.Tables(0).Rows(0)("MsgError"), "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
'AUDITORIA
Dim ClassAud As New ClassMyUtils
Dim varUser As Long
Dim ClassComodin As New clsComplejo
Dim sAuditoria As String
Dim strNota As String
Dim clCmp As clsComplejo = New clsComplejo
'strNota = clCmp.BuscaValores("nombreproducto", "producto", "id_producto = " & clsVaribles.Id_Producto)
sAuditoria = "Detalle de alarma preocupante sin transacción " &
"; Nombre = " & txtNombre.Text.Trim() &
"; Apellido Paterno = " & txtApePaterno.Text.Trim() &
"; Apellido Materno = " & txtApeMaterno.Text.Trim() &
"; RFC = " & txtRFC.Text.Trim &
"; CURP = " & txtCURP.Text.Trim &
"; Fecha Nacimiento o Constitución = " & dtpFechaNac.Text &
"; Domicilio = " & txtDomicilio.Text.Trim &
"; Colonia = " & txtColonia.Text.Trim &
"; Estado = " & cmbEstado.Text.Trim &
"; Ciudad = " & cmbPlaza.Text.Trim &
"; Telefono = " & txtTelefono.Text.Trim &
"; Act. Económica = " & cmbActEconom.Text.Trim &
"; Fecha Operación = " & dtpFechaOper.Text &
"; País Nacionalidad = " & cboNacionalidad.Text.Trim &
"; Descripción = " & txtNota.Text.Trim.Replace(vbCrLf, " ") &
"; Razón = " & txtRazon.Text.Trim.Replace(vbCrLf, " ") &
"; Fecha detección = " & dtpFechaDetecion.Text &
"; Estatus Operación = " & cmbEstatusOper.Text.Trim()
ClassAud.RT_Auditoria(VariablesGlobales.gblIdUsuario, 126, My.Computer.Name, "Minds Cliente", sAuditoria)
MessageBox.Show("Registro creado o actualizado correctamente.", "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
ActualizaGrid()
BtnLimpiar.PerformClick()
'DesBloqueaCtrls()
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub DataGrid1_MouseDoubleClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDoubleClick
Dim MiRow As DataRow
Try
MiRow = DataGrid1.DataSource.Tables(0).Rows(DataGrid1.CurrentRowIndex)
clsVaribles.Id_Transaccion = MiRow.Item("ID")
clsVaribles.Id_Producto = MiRow.Item("IdProducto")
clsVaribles.Id_Patron = MiRow.Item("IdPatron")
clsVaribles.Id_EstatusTransaccion = ("IDESTATUSTRANSACCION")
lblIdPreocupSinTran.Text = MiRow.Item("ID")
txtNombre.Text = MiRow.Item("Nombre")
txtApePaterno.Text = MiRow.Item("Apellido Paterno")
txtApeMaterno.Text = MiRow.Item("Apellido Materno")
txtRFC.Text = MiRow.Item("RFC")
txtCURP.Text = MiRow.Item("CURP")
dtpFechaNac.Value = MiRow.Item("FechaNacimiento")
txtDomicilio.Text = MiRow.Item("Domicilio")
txtColonia.Text = MiRow.Item("Colonia")
cmbEstado.SelectedValue = MiRow.Item("IdEstado")
cargarPlaza()
cmbPlaza.SelectedValue = MiRow.Item("Ciudad")
cboSucursal.SelectedValue = MiRow.Item("idsucursal")
txtCPSucursal.Text = MiRow.Item("CodigoPostalSucursal")
txtTelefono.Text = MiRow.Item("Telefono")
cmbActEconom.SelectedValue = MiRow.Item("ACT. ECONOMICA")
'cmbFuncionario.SelectedValue = MiRow.Item("IdAgente")
txtNota.Text = MiRow.Item("Nota")
txtRazon.Text = MiRow.Item("Razon")
dtpFechaDetecion.Value = MiRow.Item("FechaDeteccion")
cmbEstatusOper.SelectedValue = MiRow.Item("IdEstatusTransaccion")
dtpFechaOper.Value = MiRow.Item("FechaOperacion")
cboNacionalidad.SelectedValue = MiRow.Item("PaisNacionalidad")
'revisar si el estatus obtenido es final,
'si es asi entonces hay que bloquear los controles
'Dim clCmpX As clsComplejo = New clsComplejo
'Dim EsEstadoFinal As Boolean
'EsEstadoFinal = clCmpX.BuscaValores("bEsfinal", "EstatusTransacciones", "id_estatus = " & MiRow.Item("IdEstatusTransaccion"))
'If EsEstadoFinal Then
' BloqueaCtrls()
'Else
' DesBloqueaCtrls()
'End If
''obtener solo el estatus actual y los siguientes
'Dim cargarCbo As New clsComplejo
'cargarCbo.sbLlenaCombo("SELECT ET.Id_Estatus AS clave, ET.CDesc_Estatus AS nombre FROM EstatusTransacciones ET " &
' "INNER JOIN tbl_ReglasEstatusTransaccion RT ON ET.ID_ESTATUS = RT.IDESTATUSFINAL " &
' "WHERE RT.IDESTATUSINICIAL = " & MiRow.Item("IdEstatusTransaccion") & " ORDER BY 1", Me.cmbEstatusOper)
cboProducto.SelectedValue = MiRow.Item("IdProducto")
cmbEstatusOper.SelectedValue = MiRow.Item("IdEstatusTransaccion")
If MiRow.Item("IdEstatusTransaccion") = "4" Or
MiRow.Item("IdEstatusTransaccion") = "5" Then
BloqueaCtrls()
Else
DesBloqueaCtrls()
End If
CambiaColor()
'If cmbEstatusOper.SelectedValue = 3 Then
' ''Estatus cerrado
' BloqueaCtrls()
'Else
' DesBloqueaCtrls()
'End If
'If MiRow.Item("OrigenRepAnonimo").ToString() = "True" Then
' txtNota.ReadOnly = True
'Else
' txtNota.ReadOnly = False
'End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub CambiaColorAzul()
Label1.ForeColor = Color.MidnightBlue
Label3.ForeColor = Color.MidnightBlue
Label5.ForeColor = Color.MidnightBlue
Label2.ForeColor = Color.MidnightBlue
Label4.ForeColor = Color.MidnightBlue
Label6.ForeColor = Color.MidnightBlue
Label7.ForeColor = Color.MidnightBlue
Label8.ForeColor = Color.MidnightBlue
Label9.ForeColor = Color.MidnightBlue
Label11.ForeColor = Color.MidnightBlue
Label12.ForeColor = Color.MidnightBlue
Label10.ForeColor = Color.MidnightBlue
Label15.ForeColor = Color.MidnightBlue
Label16.ForeColor = Color.MidnightBlue
Label21.ForeColor = Color.MidnightBlue
Label20.ForeColor = Color.MidnightBlue
Label18.ForeColor = Color.MidnightBlue
Label23.ForeColor = Color.MidnightBlue
Label24.ForeColor = Color.MidnightBlue
End Sub
Private Sub CambiaColor()
If BtnAlta.Enabled = False Then
BtnAlta.BackColor = Color.DarkGray
Else
BtnAlta.BackColor = Color.Black
End If
If btnRelacionadas.Enabled = False Then
btnRelacionadas.BackColor = Color.DarkGray
Else
btnRelacionadas.BackColor = Color.Black
End If
End Sub
Private Sub ActualizaGrid()
Dim ClassCom As New clsComplejo
Dim sSQL As String
Dim MiDS As New DataSet
Try
sSQL = "SELECT idSinTransaccion ID, IDPRODUCTO, IDPATRON, IDALARMA, PD.NOMBRE, ApePaterno 'APELLIDO PATERNO', ApeMaterno 'APELLIDO MATERNO', "
sSQL = sSQL & " RFC, CURP, FECHANACIMIENTO, DOMICILIO, COLONIA, CIUDAD, TELEFONO, "
sSQL = sSQL & " ActividadEcon 'ACT. ECONOMICA', NOTA, RAZON, PD.IDESTATUSTRANSACCION, ET.EstatusAlarma ESTATUSTRANSACCION, FECHADETECCION, "
sSQL = sSQL & " CP.PLAZA, CP.IDESTADO, CE.ESTADO, PD.PAISNACIONALIDAD, PD.FECHAOPERACION,idsucursal,CodigoPostalSucursal"
sSQL = sSQL & " FROM OperacionesSinTran PD "
sSQL = sSQL & " INNER JOIN Cat_Plaza CP ON PD.Ciudad = CP.IdPlaza "
sSQL = sSQL & " INNER JOIN Cat_Estado CE ON CE.IdEstado = CP.IdEstado "
sSQL = sSQL & " INNER JOIN CAT_ESTATUSALARMA ET on ET.IdEstatusAlarma = PD.IdEstatusTransaccion "
sSQL = sSQL & " INNER JOIN CAT_TIPO_ALARMA TA ON PD.IdAlarma=TA.IdTipoAlarma "
sSQL = sSQL & " WHERE TA.Alarma='PREOCUPANTE'"
ClassCom.fdtDataSetTabla(sSQL)
If ClassCom.ds.Tables(0).Rows.Count <> 0 Then
ClassCom.ds.Tables("tabla").Columns("idsucursal").ColumnMapping = MappingType.Hidden
ClassCom.ds.Tables("tabla").Columns("CodigoPostalSucursal").ColumnMapping = MappingType.Hidden
DataGrid1.SetDataBinding(ClassCom.ds, "tabla")
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub BtnLimpiar_Click(sender As System.Object, e As System.EventArgs) Handles BtnLimpiar.Click
Try
lblIdPreocupSinTran.Text = ""
txtNombre.Text = ""
txtApePaterno.Text = ""
txtApeMaterno.Text = ""
txtRFC.Text = ""
txtCURP.Text = ""
dtpFechaNac.Value = Now.Date
txtDomicilio.Text = ""
txtColonia.Text = ""
cmbEstado.SelectedValue = -1
cmbPlaza.SelectedValue = -1
txtTelefono.Text = ""
cmbActEconom.SelectedValue = -1
'cmbFuncionario.SelectedValue = -1
txtNota.Text = ""
txtNota.ReadOnly = False
txtRazon.Text = ""
dtpFechaDetecion.Value = Now.Date
cmbEstatusOper.SelectedValue = -1
cmbEstado.SelectedValue = -1
cmbPlaza.SelectedValue = -1
cmbActEconom.SelectedValue = -1
dtpFechaOper.Value = Now.Date
cboNacionalidad.SelectedValue = -1
'cmbFuncionario.SelectedValue = -1
'cmbEstatusOper.SelectedValue = -1
' ''Estatus de la operacion
'Dim cargarCbo As New clsComplejo
'cargarCbo.sbLlenaCombo("spLlenaComboEstatusTransacciones", cmbEstatusOper)
'cargarCbo.sbLlenaCombo("SELECT Id_Estatus as clave, CDesc_Estatus as nombre FROM EstatusTransacciones WHERE Id_Estatus = 0", cmbEstatusOper)
cmbEstatusOper.SelectedIndex = -1
bProvieneDeRepAnonimo = False
cboProducto.SelectedValue = -1
cboSucursal.SelectedValue = -1
txtCPSucursal.Text = ""
DesBloqueaCtrls()
If BtnAlta.Enabled Then
BtnAlta.BackColor = Color.Black
Else
BtnAlta.BackColor = Color.DarkGray
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub BtnImprimir_Click(sender As System.Object, e As System.EventArgs) Handles BtnImprimir.Click
Dim Classcom As New clsComplejo
'Dim oApp As New Excel.Application()
'Dim m_Excel As New Excel.Application
'm_Excel = New Excel.Application
If DataGrid1.DataSource Is Nothing Then Exit Sub
''hago una copia por valor de la tabla
Dim copyDS As DataSet = DataGrid1.DataSource.Copy()
''Classcom.fdtDataSetTabla(clsVaribles.VarSQL)
'GrdPrincipal.SaveLayout( "C:\EXP.XLS")
Try
If copyDS.Tables.Count = 0 Then
MessageBox.Show("Realiza una consulta ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
If copyDS.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
'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
'REVISAR la siguiente linea
' clsExcel.ExportCSV("Preocupantes sin Transaccion", copyDS) 'Asigno el dataset a exportar
Me.Cursor = Cursors.WaitCursor
clsExcel.ExportDataset(copyDS)
Me.Cursor = Cursors.Default
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 BloqueaCtrls()
For Each ctrl As Object In Me.Controls
If ctrl.GetType.Name.ToUpper() = "BUTTON" Then
ctrl.Enabled = False
End If
If ctrl.GetType.Name.ToUpper() = "TEXTBOX" Then
ctrl.Enabled = False
End If
If ctrl.GetType.Name.ToUpper() = "GROUPBOX" Then
For Each miControl As Object In ctrl.Controls
If miControl.GetType.Name.ToUpper() = "TEXTBOX" Then
miControl.Enabled = False
End If
Next
End If
If ctrl.GetType.Name.ToUpper() = "TABCONTROL" Then
For Each MiTab As Object In ctrl.Controls
For Each MiTabCtrls As Object In MiTab.Controls
If MiTabCtrls.GetType.Name.ToUpper() = "GROUPBOX" Then
For Each miControl As Object In MiTabCtrls.Controls
If miControl.GetType.Name.ToUpper() = "TEXTBOX" Then
miControl.Enabled = False
End If
If miControl.GetType.Name.ToUpper() = "COMBOBOX" Then
miControl.Enabled = False
End If
If miControl.GetType.Name.ToUpper() = "DATETIMEPICKER" Then
miControl.Enabled = False
End If
Next
End If
Next
Next
End If
Next
BntSalie.Enabled = True
BtnImprimir.Enabled = True
BtnLimpiar.Enabled = True
End Sub
Private Sub DesBloqueaCtrls()
For Each ctrl As Object In Me.Controls
If ctrl.GetType.Name.ToUpper() = "BUTTON" Then
ctrl.Enabled = True
End If
If ctrl.GetType.Name.ToUpper() = "TEXTBOX" Then
ctrl.Enabled = True
End If
If ctrl.GetType.Name.ToUpper() = "GROUPBOX" Then
For Each miControl As Object In ctrl.Controls
If miControl.GetType.Name.ToUpper() = "TEXTBOX" Then
miControl.Enabled = True
End If
Next
End If
If ctrl.GetType.Name.ToUpper() = "TABCONTROL" Then
For Each MiTab As Object In ctrl.Controls
For Each MiTabCtrls As Object In MiTab.Controls
If MiTabCtrls.GetType.Name.ToUpper() = "GROUPBOX" Then
For Each miControl As Object In MiTabCtrls.Controls
If miControl.GetType.Name.ToUpper() = "TEXTBOX" Then
miControl.Enabled = True
End If
If miControl.GetType.Name.ToUpper() = "COMBOBOX" Then
miControl.Enabled = True
End If
If miControl.GetType.Name.ToUpper() = "DATETIMEPICKER" Then
miControl.Enabled = True
End If
Next
End If
Next
Next
End If
Next
dtpFechaDetecion.Enabled = False
End Sub
Private Sub cmbEstado_DropDownClosed(sender As System.Object, e As System.EventArgs) Handles cmbEstado.DropDownClosed
cargarPlaza()
End Sub
Private Sub cargarPlaza()
Dim ClassCom As New clsComplejo
Dim sSQL As String
Try
If cmbEstado.SelectedValue <> Nothing Then
'If cmbEstado.SelectedValue = "33" Then
' sSQL = "select Idplaza as Clave, plaza Nombre from cat_plaza where AliasId = '99999999'"
' ClassCom.sbLlenaCombo(sSQL, cmbPlaza)
' cmbPlaza.SelectedIndex = -1
'Else
sSQL = "select Idplaza as Clave, plaza Nombre from cat_plaza where IdEstado =" & cmbEstado.SelectedValue & " ORDER BY plaza"
ClassCom.sbLlenaCombo(sSQL, cmbPlaza)
cmbPlaza.SelectedIndex = -1
'End If
Else
addRegistro()
cmbPlaza.SelectedIndex = 0
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Function ObtenerCPSucursal() As String
Dim strSQL As String
Dim ClassDatos2 As New clsComplejo
Dim FilaDatos As DataRow
ObtenerCPSucursal = ""
strSQL = "select CODIGOPOSTAL,IDPLAZA from CAT_SUCURSAL where IDSUCURSAL= " & cboSucursal.SelectedValue & " "
ClassDatos2 = New clsComplejo
ClassDatos2.fdtDataSet(strSQL)
If ClassDatos2.ds.Tables(0).Rows.Count <> 0 Then
For x As Integer = 0 To ClassDatos2.ds.Tables(0).Rows.Count - 1
FilaDatos = ClassDatos2.ds.Tables(0).Rows(x)
ObtenerCPSucursal = FilaDatos("CODIGOPOSTAL").ToString()
plazaSucursalSeleccionada = FilaDatos("IDPLAZA").ToString()
Next
End If
End Function
Private Sub cargarSucursal()
Dim ClassCom As New clsComplejo
Dim sSQL As String
Try
sSQL = "select IDSUCURSAL as Clave, NOMBRESUCURSAL Nombre from CAT_SUCURSAL order by 1 asc"
ClassCom.sbLlenaCombo(sSQL, cboSucursal)
cboSucursal.SelectedIndex = -1
Catch ex As Exception
MessageBox.Show(ex.Message, "Minds", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub addRegistro()
cmbPlaza.DataSource = Nothing
cmbPlaza.Items.Clear()
cmbPlaza.Refresh()
cmbPlaza.Items.Add("Elija primero Estado")
End Sub
Private Sub cboSucursal_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cboSucursal.SelectionChangeCommitted
txtCPSucursal.Text = ObtenerCPSucursal()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnRelacionadas.Click
Dim clscon As New SenteciasSQL.ClassSQL
'clsVaribles.Id_EstatusTransaccion = clscon.BuscaValores("idestatusalarma",
' "transaccionreporte",
' "idtransaccion = " & clsVaribles.Id_Transaccion &
' " and idproducto = " & clsVaribles.Id_Producto &
' " and idpatron = " & clsVaribles.Id_Patron &
' " and idtipoalarma = 3")
Dim frmDetalles As PersonasRelacionadas = New PersonasRelacionadas
frmDetalles.IdTipoalarma = 3 '--preocupante
frmDetalles.ShowDialog()
End Sub
End Class