Permalink
Browse files

con pocoscambiosguardaimagendegrafica

  • Loading branch information...
malopez committed May 3, 2012
1 parent b4589bd commit 69a4da9dd58dce2fcc7aedb561552201c5c266f9
View
Binary file not shown.
@@ -157,6 +157,18 @@
<Compile Include="frmAcercaDe.vb">
<SubType>Form</SubType>
</Compile>
+ <Compile Include="rptReporteCaso.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>rptReporteCaso.rpt</DependentUpon>
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="rptReporteCaso1.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>rptReporteCaso1.rpt</DependentUpon>
+ <SubType>Component</SubType>
+ </Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmAbrirArchivoExistente.resx">
@@ -186,6 +198,14 @@
<EmbeddedResource Include="frmAcercaDe.resx">
<DependentUpon>frmAcercaDe.vb</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="rptReporteCaso.rpt">
+ <Generator>CrystalDecisions.VSDesigner.CodeGen.ReportCodeGenerator</Generator>
+ <LastGenOutput>rptReporteCaso.vb</LastGenOutput>
+ </EmbeddedResource>
+ <EmbeddedResource Include="rptReporteCaso1.rpt">
+ <Generator>CrystalDecisions.VSDesigner.CodeGen.ReportCodeGenerator</Generator>
+ <LastGenOutput>rptReporteCaso1.vb</LastGenOutput>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Binary file not shown.
Binary file not shown.
@@ -6,7 +6,20 @@ Elisa2010
</name>
</assembly>
<members>
-<member name="T:Elisa2010.elisasandboxDataSet.analisisDataTable">
+<member name="P:Elisa2010.My.Resources.Resources.ResourceManager">
+ <summary>
+ Returns the cached ResourceManager instance used by this class.
+</summary>
+</member><member name="P:Elisa2010.My.Resources.Resources.Culture">
+ <summary>
+ Overrides the current thread's CurrentUICulture property for all
+ resource lookups using this strongly typed resource class.
+</summary>
+</member><member name="T:Elisa2010.My.Resources.Resources">
+ <summary>
+ A strongly-typed resource class, for looking up localized strings, etc.
+</summary>
+</member><member name="T:Elisa2010.elisasandboxDataSet.analisisDataTable">
<summary>
Represents the strongly named DataTable class.
</summary>
@@ -218,19 +231,6 @@ Used to sort self-referenced table's rows
<summary>
TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios
</summary>
-</member><member name="P:Elisa2010.My.Resources.Resources.ResourceManager">
- <summary>
- Returns the cached ResourceManager instance used by this class.
-</summary>
-</member><member name="P:Elisa2010.My.Resources.Resources.Culture">
- <summary>
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-</summary>
-</member><member name="T:Elisa2010.My.Resources.Resources">
- <summary>
- A strongly-typed resource class, for looking up localized strings, etc.
-</summary>
</member>
</members>
</doc>
@@ -8,16 +8,16 @@ Public Class frmSalidaDatos
Private Sub btnGuardaResutados_Click(sender As System.Object, e As System.EventArgs) Handles btnGuardaResultados.Click
guardaResultadosExcel(frecuenciaRelativa, calculoDeTitulos, "Resultados", _
Me.lblNombreEnfermedad.Text, _
- Me.txtMediaAritmetica.Text, _
- Me.txtMediaAritmetica2.Text, _
- Me.txtMediaGeometrica.Text, _
- Me.txtCoefVariacion.Text, _
- Me.txtDesvEstandar.Text, _
- Me.txtVarianza.Text, _
- Me.txtTotalDatosCalculados.Text, _
- Me.txtDesvEstandar2.Text, _
- Me.txtCoefVariacion2.Text, _
- Me.txtVarianza2.Text)
+ Convert.ToDouble(txtMediaAritmetica.Text), _
+ Convert.ToDouble(txtMediaAritmetica2.Text), _
+ Convert.ToDouble(txtMediaGeometrica.Text), _
+ Convert.ToDouble(txtCoefVariacion.Text), _
+ Convert.ToDouble(txtDesvEstandar.Text), _
+ Convert.ToDouble(txtVarianza.Text), _
+ Convert.ToDouble(txtTotalDatosCalculados.Text), _
+ Convert.ToDouble(txtDesvEstandar2.Text), _
+ Convert.ToDouble(txtCoefVariacion2.Text), _
+ Convert.ToDouble(txtVarianza2.Text))
End Sub
Private Sub btnGeneraReporte_Click(sender As System.Object, e As System.EventArgs) Handles btnGeneraReporte.Click
@@ -31,7 +31,7 @@ Public Class frmSalidaDatos
Dim oDA As New MySqlDataAdapter
oConexion.ConnectionString = cadenaConexion
- aConsulta = "SELECT o.NombreCliente as NombreCliente,a.analysis_desc as AnalisisSolicitados, logSPS,logTit1,logTit2 FROM ordenes o,analisis a WHERE o.caso='110504-1817'" & " and o.AnalisisSolicitados=a.id_analysis and o.AnalisisSolicitados='E01/ELBI' ;"
+ aConsulta = "SELECT * FROM tblplacaleida WHERE caso='110504-1817';"
oComando.Connection = oConexion
oComando.CommandText = aConsulta
oConexion.Open()
View
@@ -118,10 +118,10 @@ Module mdlOperaciones
'Procedimiento que sirve para generar el archivo de excel con los resultados del análisis y su gráfica
Public Sub guardaResultadosExcel(ByVal frecuenciaRelativa() As Decimal, ByVal calculoDeTitulos(,) As Decimal, ByVal nombrelibro As String, ByVal nombre As String, _
- ByRef calculaMedia As Decimal, ByRef mediaAritmetica As Decimal, ByRef mediaGeometrica As Decimal, _
- ByRef coeficienteDeVariacion As Decimal, ByRef desviacionEstandar As Decimal, ByRef calculaVarianza As Decimal, _
- ByRef cuentaNoDatos As Decimal, ByRef desviacionEstandarDatosNoAgrupados As Decimal, _
- ByRef coeficienteDeVariacionDatosNoAgrupados As Decimal, ByRef calculaVarianzaDatosNoAgrupados As Decimal)
+ ByRef calculaMedia As Double, ByRef mediaAritmetica As Double, ByRef mediaGeometrica As Double, _
+ ByRef coeficienteDeVariacion As Double, ByRef desviacionEstandar As Double, ByRef calculaVarianza As Double, _
+ ByRef cuentaNoDatos As Double, ByRef desviacionEstandarDatosNoAgrupados As Double, _
+ ByRef coeficienteDeVariacionDatosNoAgrupados As Double, ByRef calculaVarianzaDatosNoAgrupados As Double)
'PAra formatear la salida de datos en excel de resultados
Dim k As Integer = 1
@@ -140,11 +140,12 @@ Module mdlOperaciones
'Darle nombre la primer hoja activa del libro de trabajo
excelApp.ActiveSheet.Name = nombrelibro
+
'Agregar datos a la hoja de Excel de la frecuencia relativa
- For i = 2 To 16
- excelApp.Range("A" & i).Value2 = i - 1
- excelApp.Range("B" & i).Value2 = Math.Round(frecuenciaRelativa(i - 2), 2)
- Next
+ 'For i = 2 To 16
+ 'excelApp.Range("A" & i).Value2 = i - 1
+ 'excelApp.Range("B" & i).Value2 = Math.Round(frecuenciaRelativa(i - 2), 2)
+ 'Next
'Colocar las cabeceras para los rangos de datos
excelApp.Range("A1").Value2 = "Grupo de Títulos"
@@ -158,47 +159,13 @@ Module mdlOperaciones
excelApp.Range("F1").Value2 = "Coef. Variación"
excelApp.Range("F2").Value2 = coeficienteDeVariacionDatosNoAgrupados
- 'Crear grafica para la frecuencia relativa
- Dim chartFrecRel As Excel.Chart
- Dim graficaFR As Excel.ChartObject
- Dim rangoGrafica As Excel.Range
- Dim j As Integer = 1
- 'Asignar ubicacion a la grafica
- graficaFR = excelApp.ActiveSheet.ChartObjects.Add(400, 50, 500, 150)
- chartFrecRel = graficaFR.Chart
- 'Establecer rango que utilizara la frafica
- rangoGrafica = excelApp.Range("B1", "B16")
- chartFrecRel.SetSourceData(Source:=rangoGrafica)
- 'Tipo de gráfica: barras
- chartFrecRel.ChartType = Excel.XlChartType.xlColumnClustered
- 'Cambia el titulo a la grafica
- With chartFrecRel
- .HasTitle = True
- .ChartTitle.Text = nombre
- 'Coloca la etiqueta de la serie
- i = 1
- For j = 1 To 15
- .SeriesCollection(i).Points(j).HasDatalabel = True
- Next
- 'Deshabilita el cuadro de leyenda de la serie
- With .Legend
- .IncludeInLayout = True
- .Delete()
- End With
- End With
-
- 'Cambiar el nombre del eje x
- Dim ejex As Excel.Axis = CType(chartFrecRel.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary), Excel.Axis)
- ejex.HasTitle = True
- ejex.AxisTitle.Text = "Porcentaje"
- ejex.AxisTitle.Font.Bold = True
- ejex.AxisTitle.Font.Size = 8
- 'Cambiar el nombre del eje y
- Dim ejey As Excel.Axis = CType(chartFrecRel.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary), Excel.Axis)
- ejey.HasTitle = True
- ejey.AxisTitle.Text = "Grupo de Títulos"
- ejey.AxisTitle.Font.Bold = True
- ejey.AxisTitle.Font.Size = 8
+ excelApp.Worksheets(1).cells(1, 1).select()
+ excelApp.ActiveSheet.Pictures.Insert("C:\ELISA2012\IMAGENES\110504-1817.jpeg").select()
+
+ 'excelApp.Range("G9:L22").CopyPicturePicture(Excel.XlPictureAppearance.xlScreen, Excel.XlCopyPictureFormat.xlBitmap)
+
+ excelApp.ActiveSheet.PrintOut()
+
'copia los valores de los títulos resultantes
excelApp.Range("A17").Value2 = "Sueros"
@@ -238,7 +205,7 @@ Module mdlOperaciones
Next
Next
excelApp.ActiveWorkbook.Close()
- 'Libera la aplicacion Excel
+ excelApp.Quit()
releaseObject(excelApp)
End Sub
@@ -342,9 +309,9 @@ Module mdlOperaciones
'# SECCION DE CARGA DE RESULTADOS EN BD #
'#################################################
- Private Sub cargaResultadosBD(ByRef numcaso As String, ByVal msn As String, ByVal promCP As Decimal, ByVal promCN As Decimal, _
- ByVal promCPS As Decimal, ByVal mediaAritmetica As Decimal, mediaGeometrica As Decimal, _
- ByVal desviacionEstandarDatosNoAgrupados As Decimal, ByVal coeficienteDeVariacionDatosNoAgrupados As Decimal)
+ Private Sub cargaResultadosBD(ByRef numcaso As String, ByVal msn As String, ByVal promCP As Double, ByVal promCN As Double, _
+ ByVal promCPS As Double, ByVal mediaAritmetica As Double, mediaGeometrica As Double, _
+ ByVal desviacionEstandarDatosNoAgrupados As Double, ByVal coeficienteDeVariacionDatosNoAgrupados As Double)
Dim resultado As Integer
Dim comando As New MySqlCommand
Try
@@ -355,8 +322,8 @@ Module mdlOperaciones
oConexion.Open()
'Asigna la cadena de conexion
comando.Connection = oConexion
- comando.CommandText = "INSERT INTO tblplacaleida (caso,placaLeida,promCP,promCN,promCPS,medArit,medGeom,desvEst,coefVar) VALUES " _
- & "('" & numcaso & "','" & msn & "'," & promCP & "," & promCN & "," & promCPS & "," & mediaAritmetica & "," & mediaGeometrica & "," _
+ comando.CommandText = "INSERT INTO tblplacaleida (caso,fechaElaboracion,placaLeida,promCP,promCN,promCPS,medArit,medGeom,desvEst,coefVar) VALUES " _
+ & "('" & numcaso & "',NOW(),'" & msn & "'," & promCP & "," & promCN & "," & promCPS & "," & mediaAritmetica & "," & mediaGeometrica & "," _
& desviacionEstandarDatosNoAgrupados & "," & coeficienteDeVariacionDatosNoAgrupados & ");"
resultado = comando.ExecuteNonQuery()
oConexion.Close()
@@ -439,10 +406,16 @@ Module mdlOperaciones
Chart1.ChartAreas.Add(ChartArea1)
Chart1.Titles.Add(nombre)
- 'Coloca los nombres de las etiquetas del gráfico para X y Y, habilita el 3d para las barras.
+ 'Coloca los nombres de las etiquetas del gráfico para X y Y
Chart1.ChartAreas("ChartArea1").AxisX.Title = titulox
Chart1.ChartAreas("ChartArea1").AxisY.Title = tituloy
- Chart1.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
+
+ 'Chart1.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
+
+ 'Elimina las lineas secundarias del gráfico
+ Chart1.ChartAreas("ChartArea1").AxisX.MajorGrid.Enabled = False
+ Chart1.ChartAreas("ChartArea1").AxisY.MajorGrid.Enabled = False
+
'Descomentar lo relacionado a Legend si se desea que aparezca el cuadrito con el titulo de Series (No recomendado)
'Legend1.Name = "Legend1"
'Chart1.Legends.Add(Legend1)
@@ -456,17 +429,26 @@ Module mdlOperaciones
Chart1.Series("Series1").IsValueShownAsLabel = True
'Ubicacion del grafico
Chart1.Location = New System.Drawing.Point(450, 50)
- Chart1.Size = New System.Drawing.Size(300, 300)
+ Chart1.Size = New System.Drawing.Size(500, 300)
Chart1.TabIndex = 21
Chart1.Anchor = AnchorStyles.Right
Chart1.Anchor = AnchorStyles.Top
'Asigna los valores de las series para miembros que se trazan en X y Y
Chart1.Series("Series1").XValueMember = "rango"
Chart1.Series("Series1").YValueMembers = "valor"
- Chart1.DataSource = ds.Tables("tblfrecrelativa").Select("rango>0")
+ Chart1.DataSource = ds.Tables("tblfrecrelativa").Select("rango>0 and rango <=15")
'Cerrar la conexion a la base de datos
oConexion.Close()
oConexion.Dispose()
+ 'Salvar la imagen a un arreglo de bytes
+
+ Try
+ Dim ruta = "C:\ELISA2012\IMAGENES\" & numcaso & ".jpeg"
+ Chart1.SaveImage(ruta, System.Drawing.Imaging.ImageFormat.Jpeg)
+ Catch ex As Exception
+ mensajeException(frmSalidaDatos.lblSalidaDatos, ex)
+ End Try
+
Catch ex As Exception
MessageBox.Show("Error al intentar la conexion a al BD al momento de crear la grafica.")
End Try
Binary file not shown.
Binary file not shown.
@@ -6,7 +6,20 @@ Elisa2010
</name>
</assembly>
<members>
-<member name="T:Elisa2010.elisasandboxDataSet.analisisDataTable">
+<member name="P:Elisa2010.My.Resources.Resources.ResourceManager">
+ <summary>
+ Returns the cached ResourceManager instance used by this class.
+</summary>
+</member><member name="P:Elisa2010.My.Resources.Resources.Culture">
+ <summary>
+ Overrides the current thread's CurrentUICulture property for all
+ resource lookups using this strongly typed resource class.
+</summary>
+</member><member name="T:Elisa2010.My.Resources.Resources">
+ <summary>
+ A strongly-typed resource class, for looking up localized strings, etc.
+</summary>
+</member><member name="T:Elisa2010.elisasandboxDataSet.analisisDataTable">
<summary>
Represents the strongly named DataTable class.
</summary>
@@ -218,19 +231,6 @@ Used to sort self-referenced table's rows
<summary>
TableAdapterManager is used to coordinate TableAdapters in the dataset to enable Hierarchical Update scenarios
</summary>
-</member><member name="P:Elisa2010.My.Resources.Resources.ResourceManager">
- <summary>
- Returns the cached ResourceManager instance used by this class.
-</summary>
-</member><member name="P:Elisa2010.My.Resources.Resources.Culture">
- <summary>
- Overrides the current thread's CurrentUICulture property for all
- resource lookups using this strongly typed resource class.
-</summary>
-</member><member name="T:Elisa2010.My.Resources.Resources">
- <summary>
- A strongly-typed resource class, for looking up localized strings, etc.
-</summary>
</member>
</members>
</doc>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 69a4da9

Please sign in to comment.