2020-01-20 18:14:59 -06:00
Imports System . Data
Imports System . Data . SqlClient
Imports System . Configuration
Imports System . Windows . Forms . DataVisualization . Charting
Imports System . ComponentModel
Imports System . Drawing . Imaging
2020-12-18 11:56:02 -06:00
Imports System . IO
Imports iTextSharp . text
Imports iTextSharp . text . pdf
Imports System . Collections . Generic
2020-01-20 18:14:59 -06:00
Public Class frmEBR
Private dtN As DataTable
Private dtE As DataTable
Private dtO As DataTable
Private Sub frmEBR_Load ( sender As Object , e As EventArgs ) Handles Me . Load
GenerarEBR ( " 0 " )
CargaCombos ( )
CargarEBR ( )
2020-12-18 11:56:02 -06:00
Me . Width = Screen . PrimaryScreen . Bounds . Width
Me . Height = Screen . PrimaryScreen . Bounds . Height
Me . WindowState = FormWindowState . Maximized
2020-01-20 18:14:59 -06:00
Dim ClassAud As New ClassMyUtils
ClassAud . RT_Auditoria ( clsVaribles . varUsuario , 86 , 1 , " Entrando EBR " )
End Sub
Private Sub GenerarEBR ( opc As String )
Dim Classcom As New clsComplejo
Dim SQL As String = String . Empty
SQL = " SP_EBR " & opc
Classcom . sbInserta ( SQL )
End Sub
Private Sub CargarEBR ( )
Try
Dim Classcom As New clsComplejo
Dim ClassCatalogos As New ClassCatalogos
Dim SQL As String = String . Empty
Dim idInherent As Integer
Dim idConrolEfeect As Integer
SQL = " SP_EBR_CONSULTA "
Dim dsGral As DataSet = Classcom . fdtDataSet ( SQL )
p1 . Text = dsGral . Tables ( 0 ) . Rows ( 0 ) ( 0 )
r1 . Text = dsGral . Tables ( 0 ) . Rows ( 0 ) ( 1 )
rg1 . Text = " Riesgo " & dsGral . Tables ( 0 ) . Rows ( 0 ) ( 1 )
v1 . Text = dsGral . Tables ( 0 ) . Rows ( 0 ) ( 2 )
p2 . Text = dsGral . Tables ( 0 ) . Rows ( 1 ) ( 0 )
r2 . Text = dsGral . Tables ( 0 ) . Rows ( 1 ) ( 1 )
rg2 . Text = " Riesgo " & dsGral . Tables ( 0 ) . Rows ( 1 ) ( 1 )
v2 . Text = dsGral . Tables ( 0 ) . Rows ( 1 ) ( 2 )
p3 . Text = dsGral . Tables ( 0 ) . Rows ( 2 ) ( 0 )
r3 . Text = dsGral . Tables ( 0 ) . Rows ( 2 ) ( 1 )
rg3 . Text = " Riesgo " & dsGral . Tables ( 0 ) . Rows ( 2 ) ( 1 )
v3 . Text = dsGral . Tables ( 0 ) . Rows ( 2 ) ( 2 )
p4 . Text = dsGral . Tables ( 0 ) . Rows ( 3 ) ( 0 )
r4 . Text = dsGral . Tables ( 0 ) . Rows ( 3 ) ( 1 )
rg4 . Text = " Riesgo " & dsGral . Tables ( 0 ) . Rows ( 3 ) ( 1 )
v4 . Text = dsGral . Tables ( 0 ) . Rows ( 3 ) ( 2 )
p5 . Text = dsGral . Tables ( 0 ) . Rows ( 4 ) ( 0 )
r5 . Text = dsGral . Tables ( 0 ) . Rows ( 4 ) ( 1 )
rg5 . Text = " Riesgo " & dsGral . Tables ( 0 ) . Rows ( 4 ) ( 1 )
v5 . Text = dsGral . Tables ( 0 ) . Rows ( 4 ) ( 2 )
p6 . Text = dsGral . Tables ( 0 ) . Rows ( 5 ) ( 0 )
r6 . Text = dsGral . Tables ( 0 ) . Rows ( 5 ) ( 1 )
rg6 . Text = " Riesgo " & dsGral . Tables ( 0 ) . Rows ( 5 ) ( 1 )
v6 . Text = dsGral . Tables ( 0 ) . Rows ( 5 ) ( 2 )
Riesgo . Text = dsGral . Tables ( 1 ) . Rows ( 0 ) ( 0 )
Riesgo2 . Text = dsGral . Tables ( 1 ) . Rows ( 0 ) ( 2 )
Label91 . Text = dsGral . Tables ( 1 ) . Rows ( 0 ) ( 2 )
Label60 . Text = dsGral . Tables ( 1 ) . Rows ( 0 ) ( 0 )
idInherent = dsGral . Tables ( 1 ) . Rows ( 0 ) ( 1 )
Chart1 . Series . Clear ( )
Chart1 . Series . Add ( " Grado de Riesgo " )
Chart1 . Series ( 0 ) . IsValueShownAsLabel = True
Chart1 . Series ( 0 ) . Points . AddXY ( " Bajo " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 0 ) )
Chart1 . Series ( 0 ) . Points . AddXY ( " Medio " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 1 ) )
Chart1 . Series ( 0 ) . Points . AddXY ( " Alto " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 2 ) )
Chart1 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
Chart2 . Series . Clear ( )
Chart2 . Series . Add ( " Tipo de Cliente " )
Chart2 . Series ( 0 ) . IsValueShownAsLabel = True
Chart2 . Series ( 0 ) . Points . AddXY ( " Bajo " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 3 ) )
Chart2 . Series ( 0 ) . Points . AddXY ( " Medio " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 4 ) )
Chart2 . Series ( 0 ) . Points . AddXY ( " Alto " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 5 ) )
Chart2 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
Chart3 . Series . Clear ( )
Chart3 . Series . Add ( " PEP " )
Chart3 . Series ( 0 ) . IsValueShownAsLabel = True
Chart3 . Series ( 0 ) . Points . AddXY ( " Bajo " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 7 ) )
'Chart3.Series(0).Points.AddXY("Medio", dsGral.Tables(2).Rows(0)(4))
Chart3 . Series ( 0 ) . Points . AddXY ( " Alto " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 6 ) )
Chart3 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
Chart4 . Series . Clear ( )
Chart4 . Series . Add ( " Servicio de inversión Asesorado y No Asesorado " )
Chart4 . Series ( 0 ) . IsValueShownAsLabel = True
Chart4 . Series ( 0 ) . Points . AddXY ( " Bajo " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 9 ) )
'Chart4.Series(0).Points.AddXY("Medio", dsGral.Tables(2).Rows(0)(9))
Chart4 . Series ( 0 ) . Points . AddXY ( " Medio " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 8 ) )
Chart4 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
Chart5 . Series . Clear ( )
Chart5 . Series . Add ( " Domicilio Principal " )
Chart5 . Series ( 0 ) . IsValueShownAsLabel = True
Chart5 . Series ( 0 ) . Points . AddXY ( " Bajo " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 10 ) )
Chart5 . Series ( 0 ) . Points . AddXY ( " Medio " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 11 ) )
Chart5 . Series ( 0 ) . Points . AddXY ( " Alto " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 12 ) )
Chart5 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
Chart6 . Series . Clear ( )
Chart6 . Series . Add ( " Principal lugar de operación " )
Chart6 . Series ( 0 ) . IsValueShownAsLabel = True
Chart6 . Series ( 0 ) . Points . AddXY ( " Bajo " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 13 ) )
Chart6 . Series ( 0 ) . Points . AddXY ( " Medio " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 14 ) )
Chart6 . Series ( 0 ) . Points . AddXY ( " Alto " , dsGral . Tables ( 2 ) . Rows ( 0 ) ( 15 ) )
Chart6 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
C1TrueDBGrid1 . SetDataBinding ( dsGral . Tables ( 3 ) , " " )
Chart7 . Series . Clear ( )
Chart7 . Series . Add ( " Historico " )
Chart7 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Area
2020-12-18 11:56:02 -06:00
2020-01-20 18:14:59 -06:00
Chart7 . ChartAreas ( 0 ) . AxisY . Maximum = 3
For Each dr As DataRow In dsGral . Tables ( 3 ) . Rows
Chart7 . Series ( 0 ) . Points . AddXY ( dr ( " MES-AÑO " ) . ToString , Convert . ToInt16 ( dr ( " IDRISK " ) ) )
2020-12-18 11:56:02 -06:00
2020-01-20 18:14:59 -06:00
Next
Chart8 . Series . Clear ( )
Chart8 . Series . Add ( " Canales de envío " )
Chart8 . Series ( 0 ) . IsValueShownAsLabel = True
Chart8 . Series ( 0 ) . Points . AddXY ( " Bajo " , 100 )
'Chart8.Series(0).Points.AddXY("Medio", dsGral.Tables(2).Rows(0)(14))
'Chart8.Series(0).Points.AddXY("Alto", dsGral.Tables(2).Rows(0)(15))
Chart8 . Series ( 0 ) . ChartType = DataVisualization . Charting . SeriesChartType . Doughnut
cmbAML . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 0 ) ( " ID_CE_SCALE " )
ComboBox1 . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 1 ) ( " ID_CE_SCALE " )
ComboBox2 . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 2 ) ( " ID_CE_SCALE " )
ComboBox3 . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 3 ) ( " ID_CE_SCALE " )
ComboBox4 . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 4 ) ( " ID_CE_SCALE " )
ComboBox5 . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 5 ) ( " ID_CE_SCALE " )
ComboBox6 . SelectedValue = dsGral . Tables ( 4 ) . Rows ( 6 ) ( " ID_CE_SCALE " )
CheckBox1 . Checked = IIf ( dsGral . Tables ( 4 ) . Rows ( 7 ) ( " VALUE " ) = " 50 " , True , False )
txtAML . Text = dsGral . Tables ( 4 ) . Rows ( 0 ) ( " TXT_CE " )
TextBox1 . Text = dsGral . Tables ( 4 ) . Rows ( 1 ) ( " TXT_CE " )
TextBox2 . Text = dsGral . Tables ( 4 ) . Rows ( 2 ) ( " TXT_CE " )
TextBox3 . Text = dsGral . Tables ( 4 ) . Rows ( 3 ) ( " TXT_CE " )
TextBox4 . Text = dsGral . Tables ( 4 ) . Rows ( 4 ) ( " TXT_CE " )
TextBox5 . Text = dsGral . Tables ( 4 ) . Rows ( 5 ) ( " TXT_CE " )
TextBox6 . Text = dsGral . Tables ( 4 ) . Rows ( 6 ) ( " TXT_CE " )
Label58 . Text = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " SUBTOTAL " )
Label57 . Text = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " DESCRIPCION " )
Label95 . Text = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " TOTAL " )
Label94 . Text = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " DESCRIPCIONt " )
Label92 . Text = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " DESCRIPCIONt " )
Label59 . Text = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " TOTAL " )
idConrolEfeect = dsGral . Tables ( 5 ) . Rows ( 0 ) ( " ID_SCALE_TOTAL " )
If idConrolEfeect = 1 And idInherent = 1 Then
Button4 . Location = Panel5 . Location
Label93 . Text = " Bajo "
ElseIf idConrolEfeect = 2 And idInherent = 1 Then
Button4 . Location = Panel6 . Location
Label93 . Text = " Bajo "
ElseIf idConrolEfeect = 3 And idInherent = 1 Then
Button4 . Location = Panel9 . Location
Label93 . Text = " Medio "
ElseIf idConrolEfeect = 1 And idInherent = 2 Then
Button4 . Location = Panel7 . Location
Label93 . Text = " Bajo "
ElseIf idConrolEfeect = 2 And idInherent = 2 Then
Button4 . Location = Panel8 . Location
Label93 . Text = " Medio "
ElseIf idConrolEfeect = 3 And idInherent = 2 Then
Button4 . Location = Panel11 . Location
Label93 . Text = " Alto "
ElseIf idConrolEfeect = 1 And idInherent = 3 Then
Button4 . Location = Panel10 . Location
Label93 . Text = " Medio "
ElseIf idConrolEfeect = 2 And idInherent = 3 Then
Button4 . Location = Panel12 . Location
Label93 . Text = " Alto "
ElseIf idConrolEfeect = 3 And idInherent = 3 Then
Button4 . Location = Panel13 . Location
Label93 . Text = " Alto "
End If
Label28 . Text = dsGral . Tables ( 6 ) . Rows ( 0 ) ( 0 )
Label34 . Text = dsGral . Tables ( 6 ) . Rows ( 1 ) ( 0 )
Label35 . Text = dsGral . Tables ( 6 ) . Rows ( 2 ) ( 0 )
Label31 . Text = dsGral . Tables ( 7 ) . Rows ( 0 ) ( 0 )
Label37 . Text = dsGral . Tables ( 7 ) . Rows ( 1 ) ( 0 )
Label38 . Text = dsGral . Tables ( 7 ) . Rows ( 2 ) ( 0 )
Label40 . Text = dsGral . Tables ( 8 ) . Rows ( 0 ) ( 0 )
Label32 . Text = dsGral . Tables ( 9 ) . Rows ( 0 ) ( 0 )
Label41 . Text = dsGral . Tables ( 9 ) . Rows ( 1 ) ( 0 )
Label43 . Text = dsGral . Tables ( 9 ) . Rows ( 2 ) ( 0 )
Label44 . Text = dsGral . Tables ( 9 ) . Rows ( 3 ) ( 0 )
Label45 . Text = dsGral . Tables ( 9 ) . Rows ( 4 ) ( 0 )
Label47 . Text = " Domicilios Nacionales: " & dsGral . Tables ( 10 ) . Rows ( 0 ) ( 0 )
dtN = dsGral . Tables ( 11 )
Label48 . Text = " Domicilios Extranjeros: " & dsGral . Tables ( 12 ) . Rows ( 0 ) ( 0 )
dtE = dsGral . Tables ( 13 )
Label33 . Text = " Lugares de Operacion: " & dsGral . Tables ( 14 ) . Rows ( 0 ) ( 0 )
dtO = dsGral . Tables ( 15 )
Label96 . Text = dsGral . Tables ( 16 ) . Rows ( 0 ) ( 0 )
Label97 . Text = dsGral . Tables ( 16 ) . Rows ( 0 ) ( 0 )
Label100 . Text = dsGral . Tables ( 16 ) . Rows ( 0 ) ( 0 )
Label101 . Text = dsGral . Tables ( 17 ) . Rows ( 0 ) ( 0 )
Label21 . Text = dsGral . Tables ( 18 ) . Rows ( 0 ) ( 0 )
Label22 . Text = dsGral . Tables ( 18 ) . Rows ( 1 ) ( 0 )
Label23 . Text = dsGral . Tables ( 18 ) . Rows ( 2 ) ( 0 )
Label24 . Text = dsGral . Tables ( 18 ) . Rows ( 3 ) ( 0 )
Label25 . Text = dsGral . Tables ( 18 ) . Rows ( 4 ) ( 0 )
Label26 . Text = dsGral . Tables ( 18 ) . Rows ( 5 ) ( 0 )
Label27 . Text = dsGral . Tables ( 18 ) . Rows ( 6 ) ( 0 )
colorLabel ( Me )
Catch ex As Exception
MessageBox . Show ( ex . Message )
End Try
End Sub
Public Sub colorLabel ( ByRef MainParent As Control )
If Not MainParent . HasChildren Then Exit Sub
For Each x As Control In MainParent . Controls ( )
If x . HasChildren Then colorLabel ( x )
Select Case True
Case TypeOf x Is Label
If x . Text . Contains ( " Bajo " ) And IsNothing ( x . Tag ) Then
x . ForeColor = Color . Green
ElseIf x . Text . Contains ( " Medio " ) And IsNothing ( x . Tag ) Then
x . ForeColor = Color . Orange
ElseIf x . Text . Contains ( " Alto " ) And IsNothing ( x . Tag ) Then
x . ForeColor = Color . Red
End If
End Select
Next
End Sub
Private Sub BtnConsul_Click ( sender As Object , e As EventArgs ) Handles BtnConsul . Click
Me . Cursor = Cursors . WaitCursor
GenerarEBR ( " 1 " )
CargarEBR ( )
Me . Cursor = Cursors . Default
End Sub
Private Sub Button1_Click ( sender As Object , e As EventArgs ) Handles Button1 . Click
Close ( )
End Sub
Private Sub Chart5_Click ( sender As Object , e As EventArgs ) Handles Chart5 . Click
End Sub
Private Sub CargaCombos ( )
Dim cls As New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . cmbAML )
cls = New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . ComboBox1 )
cls = New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . ComboBox2 )
cls = New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . ComboBox3 )
cls = New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . ComboBox4 )
cls = New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . ComboBox5 )
cls = New clsComplejo
cls . sbLlenaCombo ( " SELECT DESCRIPCION nombre, ID clave FROM EBR_CAT_CE_SCALE " , Me . ComboBox6 )
cmbAML . SelectedIndex = 0
ComboBox1 . SelectedIndex = 0
ComboBox2 . SelectedIndex = 0
ComboBox3 . SelectedIndex = 0
ComboBox4 . SelectedIndex = 0
ComboBox5 . SelectedIndex = 0
ComboBox6 . SelectedIndex = 0
End Sub
Private Sub Button3_Click ( sender As Object , e As EventArgs ) Handles Button3 . Click
GuardarMitigantes ( )
End Sub
Private Sub GuardarMitigantes ( )
Dim cls As New clsComplejo
Dim SSQL As String = cmbAML . SelectedValue . ToString ( ) & " ,' " & txtAML . Text & " ', "
SSQL += ComboBox1 . SelectedValue . ToString ( ) & " ,' " & TextBox1 . Text & " ', "
SSQL += ComboBox2 . SelectedValue . ToString ( ) & " ,' " & TextBox2 . Text & " ', "
SSQL += ComboBox3 . SelectedValue . ToString ( ) & " ,' " & TextBox3 . Text & " ', "
SSQL += ComboBox4 . SelectedValue . ToString ( ) & " ,' " & TextBox4 . Text & " ', "
SSQL += ComboBox5 . SelectedValue . ToString ( ) & " ,' " & TextBox5 . Text & " ', "
SSQL += ComboBox6 . SelectedValue . ToString ( ) & " ,' " & TextBox6 . Text & " ', "
SSQL += Convert . ToInt16 ( CheckBox1 . Checked ) & " ,' " & TextBox7 . Text & " ' "
SSQL = " SP_U_EBR_CONTROLEFFEC " & SSQL
If cls . fnInserta ( SSQL ) = " " Then
MessageBox . Show ( " Informacion Guardada. " , " MINDS " )
End If
CargarEBR ( )
End Sub
Private Sub CheckBox1_CheckedChanged ( sender As Object , e As EventArgs ) Handles CheckBox1 . CheckedChanged
TextBox7 . Enabled = CheckBox1 . Checked
TextBox7 . Text = " "
End Sub
Private Sub Button5_Click ( sender As Object , e As EventArgs ) Handles Button5 . Click
Dim fr As New frmEBRDomicilios
fr . DT = dtN
fr . Show ( )
End Sub
Private Sub Button6_Click ( sender As Object , e As EventArgs ) Handles Button6 . Click
Dim fr As New frmEBRDomicilios
fr . DT = dtE
fr . Show ( )
End Sub
Private Sub Button7_Click ( sender As Object , e As EventArgs ) Handles Button7 . Click
Dim fr As New frmEBRDomicilios
fr . DT = dtO
fr . Show ( )
End Sub
Private Sub frmEBR_Closing ( sender As Object , e As CancelEventArgs ) Handles Me . Closing
Dim ClassAud As New ClassMyUtils
ClassAud . RT_Auditoria ( clsVaribles . varUsuario , 86 , 1 , " Cerrando EBR " )
End Sub
Private Sub Button2_Click ( sender As Object , e As EventArgs ) Handles Button2 . Click
2020-12-18 11:56:02 -06:00
Try
guardarExpEbr ( )
Catch ex As Exception
End Try
End Sub
Private Function saveImgGbx ( tpg As TabPage , gbx As GroupBox ) As String
Dim ruta As String = Path . GetTempPath ' Application.StartupPath & "\"
Dim nameImg As String = DateTime . Now . ToString ( " HHmmss " ) & DateTime . Now . Millisecond
Dim bmp As Bitmap = New Bitmap ( tpg . Width , tpg . Height )
bmp = New Bitmap ( gbx . Width , gbx . Height )
gbx . DrawToBitmap ( bmp , gbx . ClientRectangle )
bmp . Save ( ruta & nameImg & " .jpg " , ImageFormat . Jpeg )
Return ruta & nameImg & " .jpg "
End Function
Private Function saveImgPBox ( tpg As TabPage , pbx As PictureBox )
Dim ruta As String = Path . GetTempPath
Dim nameImg As String = DateTime . Now . ToString ( " HHmmss " ) & DateTime . Now . Millisecond
Dim bmp As Bitmap = New Bitmap ( tpg . Width , tpg . Height )
bmp = New Bitmap ( pbx . Width , pbx . Height )
pbx . DrawToBitmap ( bmp , pbx . ClientRectangle )
bmp . Save ( ruta & nameImg & " .jpg " , ImageFormat . Jpeg )
Return ruta & nameImg & " .jpg "
End Function
Private Function saveImageRiesgoResidual ( )
TabControl1 . SelectedIndex = 2
'Dim ruta As String = Path.GetTempPath
'Dim nameImg As String = DateTime.Now.ToString("HHmmss") & DateTime.Now.Millisecond
'TabControl1.Refresh()
'Threading.Thread.Sleep(500)
'Dim screenSize As Size = New Size(GroupBox14.Width, GroupBox14.Height)
'Dim screenGrab As New Bitmap(GroupBox14.Width, GroupBox14.Height)
'Dim g As Graphics = Graphics.FromImage(screenGrab)
'g.CopyFromScreen(New Point(17, 98), New Point(0, 0), screenSize)
'screenGrab.Save(ruta & nameImg & ".jpg", ImageFormat.Jpeg)
'Return ruta & nameImg & ".jpg"
2020-01-20 18:14:59 -06:00
2020-12-18 11:56:02 -06:00
Dim ruta As String = Path . GetTempPath
Dim nameImg As String = DateTime . Now . ToString ( " HHmmss " ) & DateTime . Now . Millisecond
TabControl1 . Refresh ( )
Threading . Thread . Sleep ( 500 )
Dim screenSize As Size = New Size ( GroupBox14 . Width , GroupBox14 . Height )
Dim screenGrab As New Bitmap ( GroupBox14 . Width , GroupBox14 . Height )
Dim g As Graphics = Graphics . FromImage ( screenGrab )
g . CopyFromScreen ( Me . PointToScreen ( New Point ( 22 , 40 ) ) , Point . Empty , GroupBox14 . ClientSize )
screenGrab . Save ( ruta & nameImg & " .jpg " , ImageFormat . Jpeg )
Return ruta & nameImg & " .jpg "
End Function
Private Sub guardarExpEbr ( )
Dim listaImg As New List ( Of String )
Me . WindowState = FormWindowState . Maximized
Dim doc As New Document ( PageSize . A4 , 30 , 30 , 30 , 30 )
Dim root As String = Path . GetTempPath & " EBR_ " & DateTime . Now . ToString ( " HHmmss " ) & " .pdf "
Dim file As New FileStream ( root , FileMode . Create , FileAccess . Write , FileShare . ReadWrite )
PdfWriter . GetInstance ( doc , file )
doc . Open ( )
Dim fnt As Font = FontFactory . GetFont ( " Arial " , 18 , BaseColor . BLACK )
Dim chk = New Chunk ( " Modelo de Enfoque Basado en Riesgo " , fnt )
Dim frase As New Phrase ( )
frase . Add ( chk )
Dim title As New Paragraph ( frase )
title . Alignment = 1
doc . Add ( title )
doc . Add ( New Paragraph ( " " ) )
fnt = FontFactory . GetFont ( " Arial " , 14 , BaseColor . BLACK )
chk = New Chunk ( " Calificación de Riesgo Inherente " , fnt )
frase = New Phrase ( )
frase . Add ( chk )
title = New Paragraph ( frase )
title . Alignment = 1
doc . Add ( title )
doc . Add ( New Paragraph ( " " ) )
doc . Add ( New Paragraph ( " " ) )
Dim fileImg As String = saveImgPBox ( TabPage1 , PictureBox1 )
Dim img As Image = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
'img.ScalePercent((150 / img.Width) * 100)
img . ScalePercent ( 50 )
doc . Add ( img )
listaImg . Add ( fileImg )
Label1 . Visible = False
BtnConsul . Visible = False
Button2 . Visible = False
fileImg = saveImgGbx ( TabPage1 , gbCalificaciones )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
'img.ScalePercent(50)
img . ScaleAbsolute ( 450 , 150 )
doc . Add ( img )
listaImg . Add ( fileImg )
Label1 . Visible = True
BtnConsul . Visible = True
Button2 . Visible = True
'1
fileImg = saveImgGbx ( TabPage1 , GroupBox1 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 200 )
'Dim x As Single = InputBox("Valor", "", 100)
img . ScaleAbsolute ( 450 , 115 )
'Dim cel As New PdfPCell(img, True)
'doc.Add(cel)
doc . Add ( img )
'doc.Add(img)
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage1 , GroupBox2 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 115 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage1 , GroupBox3 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 115 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage1 , GroupBox4 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 115 )
doc . Add ( img )
listaImg . Add ( fileImg )
Button5 . Visible = False
Button6 . Visible = False
fileImg = saveImgGbx ( TabPage1 , GroupBox5 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 115 )
doc . Add ( img )
listaImg . Add ( fileImg )
Button5 . Visible = True
Button6 . Visible = True
Button7 . Visible = False
fileImg = saveImgGbx ( TabPage1 , GroupBox6 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 115 )
doc . Add ( img )
listaImg . Add ( fileImg )
Button7 . Visible = True
fileImg = saveImgGbx ( TabPage1 , GroupBox64 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 115 )
doc . Add ( img )
listaImg . Add ( fileImg )
'
doc . Add ( New Paragraph ( " " ) )
doc . Add ( New Paragraph ( " " ) )
fnt = FontFactory . GetFont ( " Arial " , 14 , BaseColor . BLACK )
chk = New Chunk ( " Efectividad de los Controles " , fnt )
frase = New Phrase ( )
frase . Add ( chk )
title = New Paragraph ( frase )
title . Alignment = 1
doc . Add ( title )
doc . Add ( New Paragraph ( " " ) )
doc . Add ( New Paragraph ( " " ) )
TabControl1 . SelectedTab = TabControl1 . TabPages . Item ( 1 )
'
fileImg = saveImgGbx ( TabPage3 , gbAML )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox8 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox9 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox10 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox12 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox13 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox11 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 60 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox68 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 200 )
img . ScaleAbsolute ( 450 , 50 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox15 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 200 )
img . ScaleAbsolute ( 450 , 50 )
doc . Add ( img )
listaImg . Add ( fileImg )
fileImg = saveImgGbx ( TabPage3 , GroupBox69 )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 200 )
img . ScaleAbsolute ( 450 , 50 )
doc . Add ( img )
listaImg . Add ( fileImg )
'
TabControl1 . SelectedTab = TabControl1 . TabPages . Item ( 2 )
Threading . Thread . Sleep ( 500 )
'doc.Add(New Paragraph(" "))
'doc.Add(New Paragraph(" "))
doc . NewPage ( )
fnt = FontFactory . GetFont ( " Arial " , 14 , BaseColor . BLACK )
chk = New Chunk ( " Riesgo Residual " , fnt )
frase = New Phrase ( )
frase . Add ( chk )
title = New Paragraph ( frase )
title . Alignment = 1
doc . Add ( title )
doc . Add ( New Paragraph ( " " ) )
fileImg = saveImageRiesgoResidual ( )
img = Image . GetInstance ( fileImg )
img . Alignment = 1
img . BorderWidth = 100
img . ScalePercent ( 50 )
img . ScaleAbsolute ( 450 , 350 )
doc . Add ( img )
listaImg . Add ( fileImg )
doc . Close ( )
TabControl1 . SelectedTab = TabControl1 . TabPages . Item ( 0 )
deleImg ( listaImg )
If ( MessageBox . Show ( " ¿Desa abrir el archivo? " & Environment . NewLine & " (Se requiere tener instalado un visor pdf para abrir el archivo). " , " Exportación EBR " , MessageBoxButtons . YesNo , MessageBoxIcon . Question , MessageBoxDefaultButton . Button2 ) = DialogResult . Yes ) Then
Try
Process . Start ( root )
Catch ex As Exception
MsgBox ( " No cuenta con visor pdf. " & Environment . NewLine & ex . Message )
End Try
End If
2020-01-20 18:14:59 -06:00
End Sub
2020-12-18 11:56:02 -06:00
Private Sub deleImg ( listaImg As List ( Of String ) )
For Each i As String In listaImg
If File . Exists ( i ) Then
File . Delete ( i )
End If
Next
End Sub
2020-01-20 18:14:59 -06:00
End Class