Public Class frmPrincipalInicio
    Private Sub frmPrincipalInicio_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Listas()
    End Sub
    Sub Fuente()




        lblMontoIngresos.ForeColor = Drawing.Color.FromArgb(237, 51, 50)
        lblIngresostexto.ForeColor = Drawing.Color.FromArgb(15, 151, 208)
        lblMontoRendimiento.ForeColor = Drawing.Color.FromArgb(237, 51, 50)
        lblRendimientotexto.ForeColor = Drawing.Color.FromArgb(15, 151, 208)
    End Sub
    Sub RendimientoMonto()
        Dim general As New DAOGeneral
        Dim Monto As String = "0.00"
        Dim Cantidad As Integer = 0
        Dim Rendimiento As String = "0.00 "
        Dim dt As DataTable = general.RendimientoMontoGraficas
        For Each rows As DataRow In dt.Rows
            If Not String.IsNullOrEmpty(rows("Rendimiento").ToString) Then
                Rendimiento = rows("Rendimiento").ToString
            End If

            If Not String.IsNullOrEmpty(rows("Monto").ToString) Then
                Monto = rows("Monto").ToString
            End If

            If Not String.IsNullOrEmpty(rows("Cantidad").ToString) Then
                Cantidad = rows("Cantidad")
            End If
        Next

        lblMontoIngresos.Text = "$ " + Monto
        If Cantidad = 0 Then
            lblMontoRendimiento.Text = "0 %"
        Else

            lblMontoRendimiento.Text = FormatNumber((((CDec(Rendimiento) / Cantidad)) * 100), 6).ToString + " %"
        End If
    End Sub

    Sub GraficaInstrumentos()
        Dim general As New DAOGeneral
        Dim dt As DataTable = general.InstrumentosGrafica



        charPastel.Series(0).Points.Clear()
        charPastel.Series(0).IsValueShownAsLabel = False
        charPastel.Series(0).LabelForeColor = Color.Transparent
        'charPastel.Series(0).LabelAngle = -45

        'charPastel.Series(0).Font = New Font(charPastel.Series(0).Font.Name, 5)

        'charPastel.ChartAreas(0).Area3DStyle.Enable3D = True

        charPastel.Series(0).XValueMember = "Instrumento"
        charPastel.Series(0).YValueMembers = "Cantidad"

        charPastel.DataSource = dt
    End Sub

    Sub GraficaMontoInstrumentos()
        Dim general As New DAOGeneral

        Dim dt As DataTable = general.MontosInstrumentosGrafica
        charbarras.Series(0).Points.Clear()
        'charbarras.ChartAreas(0).Area3DStyle.Enable3D = True


        charbarras.Series(0).XValueMember = "Instrumento"
        charbarras.Series(0).YValueMembers = "Suma"
        charbarras.DataSource = dt
    End Sub


    Sub GraficaRendimientoInstrumentos()
        Dim general As New DAOGeneral

        Dim dt As DataTable = general.RendimientosInstrumentoGrafica
        charlineal.Series(0).Points.Clear()



        charlineal.Series(0).XValueMember = "Instrumento"
        charlineal.Series(0).YValueMembers = "Suma"
        charlineal.DataSource = dt
    End Sub
    Sub Listas()
        Fuente()
        GraficaInstrumentos()
        GraficaMontoInstrumentos()
        GraficaRendimientoInstrumentos()
        RendimientoMonto()
    End Sub

    Private Sub charlineal_Click(sender As Object, e As EventArgs) Handles charlineal.Click

    End Sub

    Private Sub pnlRendimientoTotal_Paint(sender As Object, e As PaintEventArgs)

    End Sub

    Private Sub TableLayoutPanel2_Paint(sender As Object, e As PaintEventArgs) Handles TableLayoutPanel2.Paint

    End Sub
End Class