client/Reportes/frmDetalleFTI.vb

468 lines
19 KiB
VB.net
Raw Normal View History

Public Class frmDetalleFTI
Public idFTI As String
Public ValidaMes As Boolean
Dim fecha As DateTime
Private Sub frmDetalleFTI_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'Llena los textbox
llenarDatos()
'Valida mes
If ValidaMes = False Then
BlockControls()
End If
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox1.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
TextBox6.Enabled = False
TextBox7.Enabled = False
End Sub
Private Function llenarDatos() As Boolean
Dim dt As DataTable
Dim dr As DataRow
Dim cls As clsComplejo
Try
cls = New clsComplejo()
dt = cls.fdtDataTable("SPS_FTIid " & idFTI)
dr = dt.Rows(0)
'For Each dc As DataColumn In dt.Columns
' MessageBox.Show(dr(dc))
'Next
'For i As Integer = 0 To 79
' System.Console.Write("textbox" & i & ".text= IIf(IsDBNull(dr(" & i & ")), """", dr(" & i & "))")
'Next
For i As Integer = 1 To 78
System.Console.Write("textbox" & i & ".Text.Trim,")
Next
TextBox1.Text = IIf(IsDBNull(dr(1)), "", dr(1))
TextBox2.Text = IIf(IsDBNull(dr(2)), "", dr(2))
TextBox3.Text = IIf(IsDBNull(dr(3)), "", dr(3))
TextBox4.Text = IIf(IsDBNull(dr(4)), "", dr(4))
TextBox5.Text = IIf(IsDBNull(dr(5)), "", dr(5))
TextBox6.Text = IIf(IsDBNull(dr(6)), "", dr(6))
TextBox7.Text = IIf(IsDBNull(dr(7)), "", dr(7))
TextBox8.Text = IIf(IsDBNull(dr(8)), "", dr(8))
TextBox9.Text = IIf(IsDBNull(dr(9)), "", dr(9))
TextBox10.Text = IIf(IsDBNull(dr(10)), "", dr(10))
TextBox11.Text = IIf(IsDBNull(dr(11)), "", dr(11))
TextBox12.Text = IIf(IsDBNull(dr(12)), "", dr(12))
TextBox13.Text = IIf(IsDBNull(dr(13)), "", dr(13))
TextBox14.Text = IIf(IsDBNull(dr(14)), "", dr(14))
TextBox15.Text = IIf(IsDBNull(dr(15)), "", dr(15))
TextBox16.Text = IIf(IsDBNull(dr(16)), "", dr(16))
TextBox17.Text = IIf(IsDBNull(dr(17)), "", dr(17))
TextBox18.Text = IIf(IsDBNull(dr(18)), "", dr(18))
TextBox19.Text = IIf(IsDBNull(dr(19)), "", dr(19))
TextBox20.Text = IIf(IsDBNull(dr(20)), "", dr(20))
TextBox21.Text = IIf(IsDBNull(dr(21)), "", dr(21))
TextBox22.Text = IIf(IsDBNull(dr(22)), "", dr(22))
TextBox23.Text = IIf(IsDBNull(dr(23)), "", dr(23))
TextBox24.Text = IIf(IsDBNull(dr(24)), "", dr(24))
TextBox25.Text = IIf(IsDBNull(dr(25)), "", dr(25))
TextBox26.Text = IIf(IsDBNull(dr(26)), "", dr(26))
TextBox27.Text = IIf(IsDBNull(dr(27)), "", dr(27))
TextBox28.Text = IIf(IsDBNull(dr(28)), "", dr(28))
TextBox29.Text = IIf(IsDBNull(dr(29)), "", dr(29))
TextBox30.Text = IIf(IsDBNull(dr(30)), "", dr(30))
TextBox31.Text = IIf(IsDBNull(dr(31)), "", dr(31))
TextBox32.Text = IIf(IsDBNull(dr(32)), "", dr(32))
TextBox33.Text = IIf(IsDBNull(dr(33)), "", dr(33))
TextBox34.Text = IIf(IsDBNull(dr(34)), "", dr(34))
TextBox35.Text = IIf(IsDBNull(dr(35)), "", dr(35))
TextBox36.Text = IIf(IsDBNull(dr(36)), "", dr(36))
TextBox37.Text = IIf(IsDBNull(dr(37)), "", dr(37))
TextBox38.Text = IIf(IsDBNull(dr(38)), "", dr(38))
TextBox39.Text = IIf(IsDBNull(dr(39)), "", dr(39))
TextBox40.Text = IIf(IsDBNull(dr(40)), "", dr(40))
TextBox41.Text = IIf(IsDBNull(dr(41)), "", dr(41))
TextBox42.Text = IIf(IsDBNull(dr(42)), "", dr(42))
TextBox43.Text = IIf(IsDBNull(dr(43)), "", dr(43))
TextBox44.Text = IIf(IsDBNull(dr(44)), "", dr(44))
TextBox45.Text = IIf(IsDBNull(dr(45)), "", dr(45))
TextBox46.Text = IIf(IsDBNull(dr(46)), "", dr(46))
TextBox47.Text = IIf(IsDBNull(dr(47)), "", dr(47))
TextBox48.Text = IIf(IsDBNull(dr(48)), "", dr(48))
TextBox49.Text = IIf(IsDBNull(dr(49)), "", dr(49))
TextBox50.Text = IIf(IsDBNull(dr(50)), "", dr(50))
TextBox51.Text = IIf(IsDBNull(dr(51)), "", dr(51))
TextBox52.Text = IIf(IsDBNull(dr(52)), "", dr(52))
TextBox53.Text = IIf(IsDBNull(dr(53)), "", dr(53))
TextBox54.Text = IIf(IsDBNull(dr(54)), "", dr(54))
TextBox55.Text = IIf(IsDBNull(dr(55)), "", dr(55))
TextBox56.Text = IIf(IsDBNull(dr(56)), "", dr(56))
TextBox57.Text = IIf(IsDBNull(dr(57)), "", dr(57))
TextBox58.Text = IIf(IsDBNull(dr(58)), "", dr(58))
TextBox59.Text = IIf(IsDBNull(dr(59)), "", dr(59))
TextBox60.Text = IIf(IsDBNull(dr(60)), "", dr(60))
TextBox61.Text = IIf(IsDBNull(dr(61)), "", dr(61))
TextBox62.Text = IIf(IsDBNull(dr(62)), "", dr(62))
TextBox63.Text = IIf(IsDBNull(dr(63)), "", dr(63))
TextBox64.Text = IIf(IsDBNull(dr(64)), "", dr(64))
TextBox65.Text = IIf(IsDBNull(dr(65)), "", dr(65))
TextBox66.Text = IIf(IsDBNull(dr(66)), "", dr(66))
TextBox67.Text = IIf(IsDBNull(dr(67)), "", dr(67))
TextBox68.Text = IIf(IsDBNull(dr(68)), "", dr(68))
TextBox69.Text = IIf(IsDBNull(dr(69)), "", dr(69))
TextBox70.Text = IIf(IsDBNull(dr(70)), "", dr(70))
TextBox71.Text = IIf(IsDBNull(dr(71)), "", dr(71))
TextBox72.Text = IIf(IsDBNull(dr(72)), "", dr(72))
TextBox73.Text = IIf(IsDBNull(dr(73)), "", dr(73))
TextBox74.Text = IIf(IsDBNull(dr(74)), "", dr(74))
TextBox75.Text = IIf(IsDBNull(dr(75)), "", dr(75))
TextBox76.Text = IIf(IsDBNull(dr(76)), "", dr(76))
TextBox77.Text = IIf(IsDBNull(dr(77)), "", dr(77))
TextBox78.Text = IIf(IsDBNull(dr(78)), "", dr(78))
Catch ex As Exception
End Try
End Function
Private Sub cmdSalir_Click(sender As System.Object, e As System.EventArgs) Handles cmdSalir.Click
Close()
End Sub
Private Sub cmdGen_Click(sender As System.Object, e As System.EventArgs) Handles cmdGen.Click
Try
Dim Auditoria As New ClassMyUtils
'Guarda el registro
Guardar()
'Genera bitacora
'Auditoria.RT_Auditoria(clsVaribles.varUsuario, 130, 29, "Creacion de registro transferencia internacional del folio: " & idFTI.ToString() & "")
Catch ex As Exception
MsgBox("Error al guardar en auditoria:" & ex.Message, MsgBoxStyle.Information, "Aviso")
End Try
End Sub
Private Function Guardar() As Boolean
Dim Ssql As String
Dim cls As clsComplejo
Guardar = False
Dim TRIMESTRE As String
TRIMESTRE = ValidateDate()
Dim fec As String = Mid(TextBox6.Text, 1, 4) & "/" & Mid(TextBox6.Text, 5, 2) & "/" & Mid(TextBox6.Text, 7, 2)
Dim fecha As DateTime = Convert.ToDateTime(fec)
TRIMESTRE = ValidateDate()
fecha = fecha.AddMonths(1)
Try
cls = New clsComplejo()
Ssql = "INSERT INTO FTI"
Ssql += "(mes_reportado,"
Ssql += "clave_organo_regulador,"
Ssql += "clave_entidad,"
Ssql += "folio_consecutivo,"
Ssql += "folio_previo,"
Ssql += "fecha,"
Ssql += "referencia,"
Ssql += "nombre_corresponsal_envio,"
Ssql += "nombre_entidad_destino_envio,"
Ssql += "bic_aba_envio,"
Ssql += "datos_destinatario_envio,"
Ssql += "operacion_origen_envio,"
Ssql += "operacion_destino_envio,"
Ssql += "instrumento_monetario_origen_envio,"
Ssql += "moneda_origen_envio,"
Ssql += "monto_instrumento_origen_envio,"
Ssql += "mensaje_envio,"
Ssql += "nombre_corresponsal_recepcion,"
Ssql += "nombre_entidad_origen_recepcion,"
Ssql += "bic_aba_recepcion,"
Ssql += "datos_ordenante_recepcion,"
Ssql += "operacion_origen_recepcion,"
Ssql += "operacion_destino_recepcion,"
Ssql += "instrumento_monetario_destino_recepcion,"
Ssql += "moneda_destino_recepcion,"
Ssql += "monto_instrumento_destino_recepcion,"
Ssql += "mensaje_recepcion,"
Ssql += "nombre_corresponsal_vostro,"
Ssql += "nombre_entidad_origen_vostro,"
Ssql += "bic_aba_vostro,"
Ssql += "datos_ordenante_vostro,"
Ssql += "operacion_origen_vostro,"
Ssql += "nombre_entidad_destino_vostro,"
Ssql += "datos_destinatario_vostro,"
Ssql += "operacion_destino_vostro,"
Ssql += "mensaje_vostro,"
Ssql += "nombre_pf,"
Ssql += "apellido_paterno_pf,"
Ssql += "apellido_materno_pf,"
Ssql += "fecha_nacimiento_pf,"
Ssql += "curp_pf,"
Ssql += "rfc_pf,"
Ssql += "pais_nacimiento_pf,"
Ssql += "pais_nacionalidad_pf,"
Ssql += "actividad_economica_pf,"
Ssql += "razon_social_pm,"
Ssql += "fecha_constitucion_pm,"
Ssql += "rfc_pm,"
Ssql += "pais_nacionalidad_pm,"
Ssql += "giro_mercantil_pm,"
Ssql += "apoderado_legal_pm,"
Ssql += "domicilio_nacional_unificado,"
Ssql += "ciudad_poblacion_nacional_unificado,"
Ssql += "codigo_postal_nacional_unificado,"
Ssql += "entidad_federativa_nacional_separado,"
Ssql += "codigo_postal_nacional_separado,"
Ssql += "ciudad_poblacion_nacional_separado,"
Ssql += "delegacion_municipio_nacional_separado,"
Ssql += "colonia_nacional_separado,"
Ssql += "calle_nacional_separado,"
Ssql += "numero_exterior_nacional_separado,"
Ssql += "numero_interior_nacional_separado,"
Ssql += "pais_extranjero,"
Ssql += "domicilio_extranjero_unificado,"
Ssql += "ciudad_poblacion_extranjero_unificado,"
Ssql += "codigo_postal_extranjero_unificado,"
Ssql += "estado_provincia_extranjero_separado,"
Ssql += "codigo_postal_extranjero_separado,"
Ssql += "ciudad_poblacion_extranjero_separado,"
Ssql += "colonia_extranjero_separado,"
Ssql += "calle_extranjero_separado,"
Ssql += "numero_exterior_extranjero_separado,"
Ssql += "numero_interior_extranjero_separado,"
Ssql += "numero_telefono,"
Ssql += "clave_pais_telefono,"
Ssql += "extension_telefono,"
Ssql += "correo_electronico,"
Ssql += "fiel,"
Ssql += "ANIO,"
Ssql += "MES,"
Ssql += "FOLIOGENERAL)"
Ssql += "Values("
Ssql += "'" & TRIMESTRE & "',"
Ssql += "'" & TextBox2.Text.Trim & "',"
Ssql += "'" & TextBox3.Text.Trim & "',"
Ssql += "'" & Mid(TextBox4.Text.Trim, 1, 11) & "' + CONVERT(VARCHAR(10),(SELECT MAX(FOLIOGENERAL) FROM FTI) + 1),"
Ssql += "'" & TextBox4.Text.Trim & "',"
Ssql += " CONVERT(VARCHAR(500),CONVERT(datetime, '" & fecha & "'), 112),"
Ssql += "'" & TextBox7.Text.Trim & "',"
Ssql += "'" & TextBox8.Text.Trim & "',"
Ssql += "'" & TextBox9.Text.Trim & "',"
Ssql += "'" & TextBox10.Text.Trim & "',"
Ssql += "'" & TextBox11.Text.Trim & "',"
Ssql += "'" & TextBox12.Text.Trim & "',"
Ssql += "'" & TextBox13.Text.Trim & "',"
Ssql += "'" & TextBox14.Text.Trim & "',"
Ssql += "'" & TextBox15.Text.Trim & "',"
Ssql += "'" & TextBox16.Text.Trim & "',"
Ssql += "'" & TextBox17.Text.Trim & "',"
Ssql += "'" & TextBox18.Text.Trim & "',"
Ssql += "'" & TextBox19.Text.Trim & "',"
Ssql += "'" & TextBox20.Text.Trim & "',"
Ssql += "'" & TextBox21.Text.Trim & "',"
Ssql += "'" & TextBox22.Text.Trim & "',"
Ssql += "'" & TextBox23.Text.Trim & "',"
Ssql += "'" & TextBox24.Text.Trim & "',"
Ssql += "'" & TextBox25.Text.Trim & "',"
Ssql += "'" & TextBox26.Text.Trim & "',"
Ssql += "'" & TextBox27.Text.Trim & "',"
Ssql += "'" & TextBox28.Text.Trim & "',"
Ssql += "'" & TextBox29.Text.Trim & "',"
Ssql += "'" & TextBox30.Text.Trim & "',"
Ssql += "'" & TextBox31.Text.Trim & "',"
Ssql += "'" & TextBox32.Text.Trim & "',"
Ssql += "'" & TextBox33.Text.Trim & "',"
Ssql += "'" & TextBox34.Text.Trim & "',"
Ssql += "'" & TextBox35.Text.Trim & "',"
Ssql += "'" & TextBox36.Text.Trim & "',"
Ssql += "'" & TextBox37.Text.Trim & "',"
Ssql += "'" & TextBox38.Text.Trim & "',"
Ssql += "'" & TextBox39.Text.Trim & "',"
Ssql += "'" & TextBox40.Text.Trim & "',"
Ssql += "'" & TextBox41.Text.Trim & "',"
Ssql += "'" & TextBox42.Text.Trim & "',"
Ssql += "'" & TextBox43.Text.Trim & "',"
Ssql += "'" & TextBox44.Text.Trim & "',"
Ssql += "'" & TextBox45.Text.Trim & "',"
Ssql += "'" & TextBox46.Text.Trim & "',"
Ssql += "'" & TextBox47.Text.Trim & "',"
Ssql += "'" & TextBox48.Text.Trim & "',"
Ssql += "'" & TextBox49.Text.Trim & "',"
Ssql += "'" & TextBox50.Text.Trim & "',"
Ssql += "'" & TextBox51.Text.Trim & "',"
Ssql += "'" & TextBox52.Text.Trim & "',"
Ssql += "'" & TextBox53.Text.Trim & "',"
Ssql += "'" & TextBox54.Text.Trim & "',"
Ssql += "'" & TextBox55.Text.Trim & "',"
Ssql += "'" & TextBox56.Text.Trim & "',"
Ssql += "'" & TextBox57.Text.Trim & "',"
Ssql += "'" & TextBox58.Text.Trim & "',"
Ssql += "'" & TextBox59.Text.Trim & "',"
Ssql += "'" & TextBox60.Text.Trim & "',"
Ssql += "'" & TextBox61.Text.Trim & "',"
Ssql += "'" & TextBox62.Text.Trim & "',"
Ssql += "'" & TextBox63.Text.Trim & "',"
Ssql += "'" & TextBox64.Text.Trim & "',"
Ssql += "'" & TextBox65.Text.Trim & "',"
Ssql += "'" & TextBox66.Text.Trim & "',"
Ssql += "'" & TextBox67.Text.Trim & "',"
Ssql += "'" & TextBox68.Text.Trim & "',"
Ssql += "'" & TextBox69.Text.Trim & "',"
Ssql += "'" & TextBox70.Text.Trim & "',"
Ssql += "'" & TextBox71.Text.Trim & "',"
Ssql += "'" & TextBox72.Text.Trim & "',"
Ssql += "'" & TextBox73.Text.Trim & "',"
Ssql += "'" & TextBox74.Text.Trim & "',"
Ssql += "'" & TextBox75.Text.Trim & "',"
Ssql += "'" & TextBox76.Text.Trim & "',"
Ssql += "'" & TextBox77.Text.Trim & "',"
Ssql += "'" & TextBox78.Text.Trim & "',"
Ssql += "'" & Year(Now) & "',"
Ssql += "'" & Month(Now) & "',"
Ssql += "(SELECT MAX(FOLIOGENERAL) FROM FTI) + 1)"
cls.fnInserta(Ssql)
Guardar = True
BlockControls()
'Bitacora
Dim Auditoria As New ClassMyUtils
Auditoria.RT_Auditoria(clsVaribles.varUsuario, 131, 28, "Creacion de registro Transacciones Internacionales del folio: " & idFTI.ToString() & "")
MsgBox("Se actualizaron los datos", vbInformation, "Aviso")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Function
Protected Sub BlockControls()
Dim ctl As New Control
cmdGen.Enabled = False
For Each tp As TabPage In TabControl.TabPages
For Each ctl In tp.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
Next
For Each ctl In GroupBox1.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox10.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox11.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox12.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox2.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox3.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox4.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox5.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox6.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox7.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox8.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
For Each ctl In GroupBox9.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next
End Sub
Private Function ValidateDate() As String
Dim trimestre As String = String.Empty
Dim _Trimestre As String = String.Empty
Dim mes As Integer
Dim anio As Integer
trimestre = TextBox1.Text.Trim
If (trimestre.Length = 6) Then
mes = trimestre.Substring(5, 1)
Else
mes = trimestre.Substring(5, 2)
End If
anio = Convert.ToInt32(TextBox1.Text.Substring(0, 4))
If mes = 12 Then
anio += 1
mes = 1
End If
mes += 1
trimestre = anio & "-" & Format(mes, "00")
Return trimestre
End Function
Private Sub Label44_Click(sender As Object, e As EventArgs) Handles Label44.Click
End Sub
Private Sub Label42_Click(sender As Object, e As EventArgs) Handles Label42.Click
End Sub
Private Sub GroupBox7_Enter(sender As Object, e As EventArgs) Handles GroupBox7.Enter
End Sub
End Class