Exemplo n.º 1
0
    protected string PreencheGrafico(DataSetPontoFrequencia ds, string visao, string periodo, string IDTPUsuario, string TPGrafico)
    {
        string texto     = string.Empty;
        string empresa   = string.Empty;
        string diaMesAno = string.Empty;
        string idempresa = string.Empty;
        string setor     = string.Empty;

        if (cbSetorPainel.Text != "")
        {
            setor = cbSetorPainel.Text.Trim();
        }

        if (IDTPUsuario == "7" || IDTPUsuario == "3" || IDTPUsuario == "9" || IDTPUsuario == "8")
        {
            idempresa = Session["IDEmpresa"].ToString();
            empresa   = Session["DSEmpresa"].ToString();
        }
        else if (!cbGrupoGeral.Checked && IDTPUsuario == "1") //Se não estiver marcado e usuário for admin
        {
            idempresa = cbEmpresaPainel.Value.ToString();
            empresa   = cbEmpresaPainel.Text.Trim();
        }
        else if (cbGrupoGeral.Checked)
        {
            empresa = "PREFEITURA MUNICIPAL DE CUIABÁ";
        }
        /// 11/06/2015 Definir a visão pelo tipo de usuário---
        /// O administrador possui o maior número de visão
        /// Se visao = 0 - Fazer gráfico geral - Todos os órgãos juntos
        /// Se visao = 1 - Filtrar por órgão
        /// Se visao = 2 - Filtrar por setor.
        /// 11/06/2015
        ///

        ///11/06/2015 Período
        ///Caso período = 0 - Filtrar por dia
        ///Período = 1 - Filtrar por Mês/Ano
        ///Período = 2 - Filtrar por Ano.

        if (visao == "2") //rotina permitida a todos os tipos de usuários
        {
            try
            {
                MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwRegistroDiaEmpresaSetorUsuarioTableAdapter adpRegistroUsuario = new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwRegistroDiaEmpresaSetorUsuarioTableAdapter();
                dsB.EnforceConstraints = false;
                switch (periodo)
                {
                case "0":    //Dia

                    if (TPGrafico == "IndicePresenca")
                    {
                        adpRegistroSetor.FillDTDiasAno(dsP.vwRegistrosDiaEmpresaSetor, Convert.ToInt32(cbSetorPainel.Value), Convert.ToInt32(idempresa), deDTReferencia.Date.Date);
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillDTFrequenciaIDEmpresaIDSetor(dsP.vwTotalMotivosFaltaSetor, deDTReferencia.Date.Date, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                    }

                    diaMesAno = deDTReferencia.Date.ToShortDateString();

                    dsB.EnforceConstraints = false;
                    MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vWHorasDiaTableAdapter adpHorasDia = new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vWHorasDiaTableAdapter();
                    adpHorasDia.FillFreqDia(dsB.vWHorasDia, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value), deDTReferencia.Date.Date, deDTReferencia.Date.Date);

                    break;

                case "1":    //mês/Ano
                    if (cbMesAnoReferencia.Text != "" && cbMesAnoReferencia.Text.IndexOf('/') >= 0)
                    {
                        diaMesAno = cbMesAnoReferencia.Text.Trim();
                        string mes, ano; int pos;
                        pos = cbMesAnoReferencia.Text.IndexOf('/');
                        mes = cbMesAnoReferencia.Text.Substring(0, pos);
                        ano = cbMesAnoReferencia.Text.Substring(pos + 1, 4);

                        if (TPGrafico == "IndicePresenca")
                        {
                            adpRegistroSetor.FillMesAnoEmpresaSetor(dsP.vwRegistrosDiaEmpresaSetor, Convert.ToInt32(ano), Convert.ToInt32(mes), Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                        }
                        else
                        {
                            adpMotivoFaltaSetor.FillMesAnoIDEmpresaIDSetor(dsP.vwTotalMotivosFaltaSetor, Convert.ToInt32(mes), Convert.ToInt32(ano), Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                        }

                        adpRegistroUsuario.FillPerctMesAnoEmpresaSetor(dsB.vwRegistroDiaEmpresaSetorUsuario, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value), Convert.ToInt32(mes), Convert.ToInt32(ano));
                    }
                    else
                    {
                        diaMesAno = string.Format("{0}/{1}", System.DateTime.Now.Month, System.DateTime.Now.Year);
                        if (TPGrafico == "IndicePresenca")
                        {
                            adpRegistroSetor.FillMesAnoEmpresaSetor(dsP.vwRegistrosDiaEmpresaSetor, System.DateTime.Now.Year, System.DateTime.Now.Month, Convert.ToInt32(idempresa), Convert.ToInt32(Session["IDSETOR"]));
                        }
                        else
                        {
                            adpMotivoFaltaSetor.FillMesAnoIDEmpresaIDSetor(dsP.vwTotalMotivosFaltaSetor, System.DateTime.Now.Month, System.DateTime.Now.Year, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                        }

                        adpRegistroUsuario.FillPerctMesAnoEmpresaSetor(dsB.vwRegistroDiaEmpresaSetorUsuario, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value), System.DateTime.Now.Month, System.DateTime.Now.Year);
                    }

                    break;

                case "2":
                    if (cbMesAnoReferencia.Text.IndexOf('/') >= 0)
                    {
                        string ano1; int pos1;
                        pos1      = cbMesAnoReferencia.Text.IndexOf('/');
                        ano1      = cbMesAnoReferencia.Text.Substring(pos1 + 1, 4);
                        diaMesAno = ano1;
                        if (TPGrafico == "IndicePresenca")
                        {
                            adpRegistroSetor.FillAnoEmpresaSetor(dsP.vwRegistrosDiaEmpresaSetor, Convert.ToInt32(ano1), Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                        }
                        else
                        {
                            adpMotivoFaltaSetor.FillAnoEmpresaSetor(dsP.vwTotalMotivosFaltaSetor, Convert.ToInt32(ano1), Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                        }


                        adpRegistroUsuario.FillPercTAnoEmpresaSetor(dsB.vwRegistroDiaEmpresaSetorUsuario, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value), Convert.ToInt32(ano1));
                    }
                    else
                    {
                        diaMesAno = System.DateTime.Now.Year.ToString();
                        if (TPGrafico == "IndicePresenca")
                        {
                            adpRegistroSetor.FillAnoEmpresaSetor(dsP.vwRegistrosDiaEmpresaSetor, System.DateTime.Now.Year, Convert.ToInt32(idempresa), Convert.ToInt32(Session["IDSETOR"]));
                        }
                        else
                        {
                            adpMotivoFaltaSetor.FillAnoEmpresaSetor(dsP.vwTotalMotivosFaltaSetor, System.DateTime.Now.Year, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value));
                        }


                        adpRegistroUsuario.FillPercTAnoEmpresaSetor(dsB.vwRegistroDiaEmpresaSetorUsuario, Convert.ToInt32(idempresa), Convert.ToInt32(cbSetorPainel.Value), System.DateTime.Now.Year);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            texto = string.Format("{0} / {1} - Referência: {2}", empresa, setor, diaMesAno);
            return(texto);
        }

        if ((IDTPUsuario == "1" || IDTPUsuario == "7" || IDTPUsuario == "8") && visao == "1")
        {
            //Aqui realizar o preenchimento para admin e admin de orgao

            MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwRegistrosDiaEmpresaSetorTableAdapter adpregistroDiaEmpresaSetor = new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwRegistrosDiaEmpresaSetorTableAdapter();
            dsB.EnforceConstraints = false;

            switch (periodo)
            {
            case "0":        //Dia
                if (TPGrafico == "IndicePresenca")
                {
                    adpEmpresaGeral.FillIDEmpresaDTDia(dsP.vwRegistrosDiaEmpresa, Convert.ToInt32(idempresa), deDTReferencia.Date.Date);
                }
                else
                {
                    adpMotivoFaltaSetor.FillDTFrequenciaEmpresa(dsP.vwTotalMotivosFaltaSetor, deDTReferencia.Date.Date, Convert.ToInt32(idempresa));
                }
                //Data do texto
                diaMesAno = deDTReferencia.Date.ToShortDateString();

                adpregistroDiaEmpresaSetor.FillPerctDia(dsB.vwRegistrosDiaEmpresaSetor, Convert.ToInt32(idempresa), deDTReferencia.Date.Date);
                break;

            case "1":        //Mes/Ano
                if (cbMesAnoReferencia.Text != "" && cbMesAnoReferencia.Text.IndexOf('/') >= 0)
                {
                    diaMesAno = cbMesAnoReferencia.Text.Trim();
                    string mes, ano; int pos;
                    pos = cbMesAnoReferencia.Text.IndexOf('/');
                    mes = cbMesAnoReferencia.Text.Substring(0, pos);
                    ano = cbMesAnoReferencia.Text.Substring(pos + 1, 4);

                    if (TPGrafico == "IndicePresenca")
                    {
                        adpEmpresaGeral.FilllIDEmpresaMesAno(dsP.vwRegistrosDiaEmpresa, Convert.ToInt32(mes), Convert.ToInt32(ano), Convert.ToInt32(idempresa));
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillMesAnoEmpresa(dsP.vwTotalMotivosFaltaSetor, Convert.ToInt32(mes), Convert.ToInt32(ano), Convert.ToInt32(idempresa));
                    }

                    adpregistroDiaEmpresaSetor.FillPerctMesAno(dsB.vwRegistrosDiaEmpresaSetor, Convert.ToInt32(ano), Convert.ToInt32(mes), Convert.ToInt32(idempresa));
                }
                else
                {
                    diaMesAno = string.Format("{0}/{1}", System.DateTime.Now.Month, System.DateTime.Now.Year);

                    if (TPGrafico == "IndicePresenca")
                    {
                        adpEmpresaGeral.FilllIDEmpresaMesAno(dsP.vwRegistrosDiaEmpresa, System.DateTime.Now.Month, System.DateTime.Now.Year, Convert.ToInt32(idempresa));
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillMesAnoEmpresa(dsP.vwTotalMotivosFaltaSetor, System.DateTime.Now.Month, System.DateTime.Now.Year, Convert.ToInt32(idempresa));
                    }

                    adpregistroDiaEmpresaSetor.FillPerctMesAno(dsB.vwRegistrosDiaEmpresaSetor, System.DateTime.Now.Year, System.DateTime.Now.Month, Convert.ToInt32(idempresa));
                }
                break;

            case "2":        //Ano
                if (cbMesAnoReferencia.Text.IndexOf('/') >= 0)
                {
                    diaMesAno = cbMesAnoReferencia.Text.Trim();
                    string ano; int pos;
                    pos = cbMesAnoReferencia.Text.IndexOf('/');
                    ano = cbMesAnoReferencia.Text.Substring(pos + 1, 4);

                    if (IDTPUsuario == "IndicePresenca")
                    {
                        adpEmpresaGeral.FillIDEmpresaAno(dsP.vwRegistrosDiaEmpresa, Convert.ToInt32(ano), Convert.ToInt32(idempresa));
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillAnoEmpresa(dsP.vwTotalMotivosFaltaSetor, Convert.ToInt32(ano), Convert.ToInt32(idempresa));
                    }

                    adpregistroDiaEmpresaSetor.FillPerctAno(dsB.vwRegistrosDiaEmpresaSetor, Convert.ToInt32(ano), Convert.ToInt32(idempresa));
                }
                else
                {
                    diaMesAno = System.DateTime.Now.Year.ToString();

                    if (IDTPUsuario == "IndicePresenca")
                    {
                        adpEmpresaGeral.FillIDEmpresaAno(dsP.vwRegistrosDiaEmpresa, System.DateTime.Now.Year, Convert.ToInt32(idempresa));
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillAnoEmpresa(dsP.vwTotalMotivosFaltaSetor, System.DateTime.Now.Year, Convert.ToInt32(idempresa));
                    }

                    adpregistroDiaEmpresaSetor.FillPerctAno(dsB.vwRegistrosDiaEmpresaSetor, System.DateTime.Now.Year, Convert.ToInt32(idempresa));
                }
                break;
            }
            texto = string.Format("{0} - Referência: {1}", empresa, diaMesAno);
            return(texto);
        }
        if (IDTPUsuario == "1" && visao == "0")
        {
            MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwRegistrosDiaEmpresaTableAdapter adpRegistroDiaEmpresa = new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwRegistrosDiaEmpresaTableAdapter();
            dsB.EnforceConstraints = false;
            switch (periodo)
            {
            case "0":     //Dia
                if (TPGrafico == "IndicePresenca")
                {
                    adpEmpresaGeral.FillDTDiasAno(dsP.vwRegistrosDiaEmpresa, deDTReferencia.Date.Date);
                }
                else
                {
                    adpMotivoFaltaSetor.FillDTFrequencia(dsP.vwTotalMotivosFaltaSetor, deDTReferencia.Date.Date);
                }

                diaMesAno = deDTReferencia.Date.ToShortDateString();

                //Para usar nos gráficos de baixo - Índice de Registros, Justificativas e faltas !
                adpRegistroDiaEmpresa.FillPerctDia(dsB.vwRegistrosDiaEmpresa, deDTReferencia.Date.Date);
                break;

            case "1":     //Mes/Ano
                if (cbMesAnoReferencia.Text != "" && cbMesAnoReferencia.Text.IndexOf('/') >= 0)
                {
                    diaMesAno = cbMesAnoReferencia.Text.Trim();
                    string mes, ano; int pos;
                    pos = cbMesAnoReferencia.Text.IndexOf('/');
                    mes = cbMesAnoReferencia.Text.Substring(0, pos);
                    ano = cbMesAnoReferencia.Text.Substring(pos + 1, 4);
                    if (TPGrafico == "IndicePresenca")
                    {
                        adpEmpresaGeral.FillMesAno(dsP.vwRegistrosDiaEmpresa, Convert.ToInt32(mes), Convert.ToInt32(ano));
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillMesAno(dsP.vwTotalMotivosFaltaSetor, Convert.ToInt32(mes), Convert.ToInt32(ano));
                    }

                    //Gráficos de baixo
                    adpRegistroDiaEmpresa.FillPerctMesAno(dsB.vwRegistrosDiaEmpresa, Convert.ToInt32(mes), Convert.ToInt32(ano));
                }
                else
                {
                    diaMesAno = string.Format("{0}/{1}", System.DateTime.Now.Month, System.DateTime.Now.Year);

                    if (TPGrafico == "IndicePresenca")
                    {
                        adpEmpresaGeral.FillMesAno(dsP.vwRegistrosDiaEmpresa, System.DateTime.Now.Month, System.DateTime.Now.Year);
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillMesAno(dsP.vwTotalMotivosFaltaSetor, System.DateTime.Now.Month, System.DateTime.Now.Year);
                    }

                    //Para usar nos gráficos de baixo - Índice de Registros, Justificativas e faltas !
                    adpRegistroDiaEmpresa.FillPerctMesAno(dsB.vwRegistrosDiaEmpresa, System.DateTime.Now.Month, System.DateTime.Now.Year);
                }
                break;

            case "2":     //Ano
                if (cbMesAnoReferencia.Text != "" && cbMesAnoReferencia.Text.IndexOf('/') < 0)
                {
                    diaMesAno = cbMesAnoReferencia.Text.Trim();
                    string ano; int pos;
                    pos = cbMesAnoReferencia.Text.IndexOf('/');
                    ano = cbMesAnoReferencia.Text.Substring(pos + 1, 4);
                    if (TPGrafico == "IndicePresenca")
                    {
                        adpEmpresaGeral.FillAno(dsP.vwRegistrosDiaEmpresa, Convert.ToInt32(ano));
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillAno(dsP.vwTotalMotivosFaltaSetor, Convert.ToInt32(ano));
                    }

                    //Gráficos de baixo
                    adpRegistroDiaEmpresa.FillPerctAno(dsB.vwRegistrosDiaEmpresa, Convert.ToInt32(ano));
                }
                else
                {
                    diaMesAno = System.DateTime.Now.Year.ToString();
                    if (TPGrafico == "IndicePresencao")
                    {
                        adpEmpresaGeral.FillAno(dsP.vwRegistrosDiaEmpresa, System.DateTime.Now.Year);
                    }
                    else
                    {
                        adpMotivoFaltaSetor.FillAno(dsP.vwTotalMotivosFaltaSetor, System.DateTime.Now.Year);
                    }

                    //Gráficos de baixo
                    adpRegistroDiaEmpresa.FillPerctAno(dsB.vwRegistrosDiaEmpresa, System.DateTime.Now.Year);
                }
                break;
            }
            texto = string.Format("{0} - Referência: {1}", empresa, diaMesAno);
            return(texto);
        }

        return(texto);
    }
Exemplo n.º 2
0
    protected void PreenchevwHorasDiaDia(string IDSetor, string DTFrequenciaInicial, string DTFrequenciaFinal, string User, bool Ausencia)
    {
        User = Cr.Descriptogra(User);

        MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vWHorasDiaTableAdapter adpHorasDia = new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vWHorasDiaTableAdapter();

        if (DTFrequenciaInicial.Length == 9)
        {
            if (DTFrequenciaInicial.Substring(0, 2).IndexOf("/") == 1)
            {
                DTFrequenciaInicial = string.Format("0{0}", DTFrequenciaInicial);
            }
            else
            {
                DTFrequenciaInicial = string.Format("{0}0{1}", DTFrequenciaInicial.Substring(0, 3), DTFrequenciaInicial.Substring(3, 6));
            }
        }
        else if (DTFrequenciaInicial.Length == 8)
        {
            DTFrequenciaInicial = string.Format("0{0}", DTFrequenciaInicial);
            DTFrequenciaInicial = string.Format("{0}0{1}", DTFrequenciaInicial.Substring(0, 3), DTFrequenciaInicial.Substring(3, 6));
        }


        if (DTFrequenciaFinal.Length == 9)
        {
            if (DTFrequenciaFinal.Substring(0, 2).IndexOf("/") == 1)
            {
                DTFrequenciaFinal = string.Format("0{0}", DTFrequenciaFinal);
            }
            else
            {
                DTFrequenciaFinal = string.Format("{0}0{1}", DTFrequenciaFinal.Substring(0, 3), DTFrequenciaFinal.Substring(3, 6));
            }
        }
        else if (DTFrequenciaFinal.Length == 8)
        {
            DTFrequenciaFinal = string.Format("0{0}", DTFrequenciaFinal);
            DTFrequenciaFinal = string.Format("{0}0{1}", DTFrequenciaFinal.Substring(0, 3), DTFrequenciaFinal.Substring(3, 6));
        }

        INICIO = DTFrequenciaInicial;
        FIM    = DTFrequenciaFinal;

        try
        {
            ds.EnforceConstraints = false;

            //09-09-2015 - Adicionei o campo ausência para filtrar apenas as ausências.

            adpHorasDia.Connection.Open();
            if (User == "0" && !Ausencia)
            {
                adpHorasDia.FillFreqDia(ds.vWHorasDia, Convert.ToInt32(Session["IDEmpresa"]), Convert.ToInt32(IDSetor), Convert.ToDateTime(DTFrequenciaInicial), Convert.ToDateTime(DTFrequenciaFinal));
            }
            else if (User == "0" && Ausencia)
            {
                adpHorasDia.FillFreqDiaSituacao(ds.vWHorasDia, Convert.ToInt32(Session["IDEmpresa"]), Convert.ToInt32(IDSetor), Convert.ToDateTime(DTFrequenciaInicial), Convert.ToDateTime(DTFrequenciaFinal), 3);
            }
            else if (User != "0" && !Ausencia)
            {
                adpHorasDia.FillFreqDiaUser(ds.vWHorasDia, Convert.ToInt32(Session["IDEmpresa"]), Convert.ToInt32(IDSetor), Convert.ToDateTime(DTFrequenciaInicial), Convert.ToDateTime(DTFrequenciaFinal), Convert.ToInt32(User));
            }
            else if (User != "0" && Ausencia)
            {
                adpHorasDia.FillFreqDiaUserSituacao(ds.vWHorasDia, Convert.ToInt32(Session["IDEmpresa"]), Convert.ToInt32(IDSetor), Convert.ToDateTime(DTFrequenciaInicial), Convert.ToDateTime(DTFrequenciaFinal), Convert.ToInt32(User), 3);
            }

            adpHorasDia.Connection.Close();
        }
        catch (Exception ex)
        {
            Label1.Text = "Houve Falha ao gerar relatório. Contate o administrador.";
        }
    }
Exemplo n.º 3
0
    protected void Preenchegrafico(int IDTPUsuario, int IDEmpresa, DateTime DTFrequencia)
    {
        //if (DTFrequencia.Length == 9)
        //{
        //if (DTFrequencia.Substring(0, 2).IndexOf("/") == 1)
        //DTFrequencia = string.Format("0{0}", DTFrequencia);
        //else
        //{
        //DTFrequencia = string.Format("{0}0{1}", DTFrequencia.Substring(0, 3), DTFrequencia.Substring(3, 6));
        //}
        //}
        //else if (DTFrequencia.Length == 8)
        //{
        //DTFrequencia = string.Format("0{0}", DTFrequencia);
        //DTFrequencia = string.Format("{0}0{1}", DTFrequencia.Substring(0, 3), DTFrequencia.Substring(3, 6));
        //}

        if (IDTPUsuario == 1 || IDTPUsuario == 3 || IDTPUsuario == 2 || IDTPUsuario == 7 || IDTPUsuario == 9 || IDTPUsuario == 8)
        {
            //Situação
            graficoFaltaSetor.Series.Remove(graficoFaltaSetor.Series["Registro Efetuado"]);

            graficoFaltaSetor.Series.Add("Registro Efetuado", ViewType.Bar);

            graficoFaltaSetor.Series.Remove(graficoFaltaSetor.Series["Registro Ausente"]);

            graficoFaltaSetor.Series.Add("Registro Ausente", ViewType.Bar);

            graficoFaltaSetor.Series.Remove(graficoFaltaSetor.Series["Registro Justificado"]);

            graficoFaltaSetor.Series.Add("Registro Justificado", ViewType.Bar);

            //Tentativa tirar DIAGRAMA - Deu certo
            XYDiagram diagrama = graficoFaltaSetor.Diagram as XYDiagram;

            diagrama.AxisY.Visible = false;
            diagrama.AxisX.Visible = false;

            graficoFaltaSetor.Series["Registro Efetuado"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;

            graficoFaltaSetor.Series["Registro Efetuado"].LegendPointOptions.ValueNumericOptions.Format = NumericFormat.General;

            graficoFaltaSetor.Series["Registro Efetuado"].ValueScaleType = ScaleType.Numerical;

            graficoFaltaSetor.Series["Registro Ausente"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;

            graficoFaltaSetor.Series["Registro Ausente"].LegendPointOptions.ValueNumericOptions.Format = NumericFormat.General;

            graficoFaltaSetor.Series["Registro Ausente"].ValueScaleType = ScaleType.Numerical;


            graficoFaltaSetor.Series["Registro Justificado"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;

            graficoFaltaSetor.Series["Registro Justificado"].LegendPointOptions.ValueNumericOptions.Format = NumericFormat.General;

            graficoFaltaSetor.Series["Registro Justificado"].ValueScaleType = ScaleType.Numerical;

            //Setores
            //graficoFaltaSetor.Series.Remove(graficoFaltaSetor.Series["Setor"]);
            //graficoFaltaSetor.Series.Add("Setor", ViewType.FullStackedBar);
            //graficoFaltaSetor.Series["Setor"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; //Não precisa aparecer no gráfico

            //graficoFaltaSetor.Series["Setor"].LegendPointOptions.ValueNumericOptions.Format = NumericFormat.General;

            //((FullStackedBarPointOptions)graficoFaltaSetor.Series["Setor"].Label.PointOptions).PercentOptions.ValueAsPercent = false;
        }
        if (IDTPUsuario == 1 || IDTPUsuario == 3 || IDTPUsuario == 7 || IDTPUsuario == 9 || IDTPUsuario == 8)
        {
            IDSetor = Convert.ToInt32(cbSetor.Value);
            //lbSetorSecretaria.Text = (string)Session["DSEMPRESA"];//"Secretaria de Estado de Administração - Situação do dia corrente.";

            //adpHoraDiaSitu.FillIDEmpresa(ds.vwHorasDiaSituacao, IDEmpresa, DTFrequencia);

            ds.EnforceConstraints = false;

            //03/07/2018 -- Mudando a Rotina aqui. Para por equanto usando a horas dia.
            //adpRegistroSituacao.FillIDSetorDTFrequencia(ds.vwSituacaoRegistroEmpresaSetor, DTFrequencia.ToShortDateString(), IDSetor);
            MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vWHorasDiaTableAdapter adpHorasDia =
                new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vWHorasDiaTableAdapter();

            adpHorasDia.FillFreqDia(ds.vWHorasDia, IDEmpresa, Convert.ToInt32(cbSetor.Value),
                                    Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")));

            if (ds.vWHorasDia.Rows.Count > 0)
            {
                for (int i = 0; i <= ds.vWHorasDia.Rows.Count - 1; i++)
                {
                    switch (ds.vWHorasDia[i].SituacaoN)
                    {
                    case 1:
                        QTDJustificado++;
                        textoJustificado += string.Format("{0}<br>", ds.vWHorasDia[i].DSUsuario);
                        break;

                    case 2:
                        QTDRegistro++;
                        texto += string.Format("{0}<br>", ds.vWHorasDia[i].DSUsuario);
                        break;

                    case 3:
                        if (ds.vWHorasDia[i].Situacao != "Sábado" && ds.vWHorasDia[i].Situacao != "Domingo")
                        {
                            QTDAusente++;
                            textoAusencia += string.Format("{0}<br>", ds.vWHorasDia[i].DSUsuario);
                        }
                        break;

                    case 4:
                        break;
                    }
                }

                //lbSetorSecretaria.Text = (string)Session["DSEMPRESA"] + "-Situação do dia corrente.";
                graficoFaltaSetor.Series["Registro Efetuado"].Points.Add(new SeriesPoint(cbSetor.Text.Trim(), QTDRegistro));
                graficoFaltaSetor.Series["Registro Efetuado"].ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;

                ////Monta Texto
                //MontaTextoToolTip mt = new MontaTextoToolTip(2);
                //mt.MontaTexto(IDSetor, DTFrequencia, 2, ds);

                graficoFaltaSetor.Series["Registro Efetuado"].ToolTipPointPattern = texto;

                graficoFaltaSetor.Series["Registro Justificado"].Points.Add(new SeriesPoint(cbSetor.Text.Trim(), QTDJustificado));
                graficoFaltaSetor.Series["Registro Justificado"].ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;

                graficoFaltaSetor.Series["Registro Justificado"].ToolTipPointPattern = textoJustificado;

                //if (IDEmpresa == 9 || IDEmpresa == 18 || IDEmpresa == 19)
                //{
                //    MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwUsuariogridTableAdapter adpUsuario = new MetodosPontoFrequencia.DataSetPontoFrequenciaTableAdapters.vwUsuariogridTableAdapter();
                //    adpUsuario.FillTotalSemRegistro(ds.vwUsuariogrid, IDEmpresa, IDSetor);
                //    QTDAusente = ds.vwSituacaoRegistroEmpresaSetor[0].QTDAUSENTE - ds.vwUsuariogrid[0].IDSetor;
                //}
                //else
                //    QTDAusente = ds.vwSituacaoRegistroEmpresaSetor[0].QTDAUSENTE;

                //Quando for plantonista, não contar como falta.
                graficoFaltaSetor.Series["Registro Ausente"].Points.Add(new SeriesPoint(cbSetor.Text.Trim(), QTDAusente));
                graficoFaltaSetor.Series["Registro Ausente"].ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;

                graficoFaltaSetor.Series["Registro Ausente"].ToolTipPointPattern = textoAusencia;
            }

            graficoFaltaSetor.DataBind();

            texto            = string.Empty;
            textoAusencia    = string.Empty;
            textoJustificado = string.Empty;
            QTDRegistro      = 0;
            QTDAusente       = 0;
            QTDJustificado   = 0;
        }
        else if (IDTPUsuario == 232) // Alterei de 3 p 232 só p testar a questão do stackoverFlow
        {
            if (cbSetor.Text == "")
            {
                IDSetor = Convert.ToInt32(Session["IDSETOR"]);
            }
            else
            {
                IDSetor = Convert.ToInt32(cbSetor.Value);
            }

            ds.EnforceConstraints = false;
            //adpHoraDiaSitu.FillIDEmpresaSetor(ds.vwHorasDiaSituacao, IDEmpresa, DTFrequencia, IDSetor);

            if (ds.vwHorasDiaSituacao.Rows.Count > 0)
            {
                //lbSetorSecretaria.Text = (string)Session["DSEMPRESA"];

                for (int i = 0; i <= ds.vwHorasDiaSituacao.Rows.Count - 1; i++)
                {
                    if (ds.vwHorasDiaSituacao[i].Situacao == "Bateu")
                    {
                        graficoFaltaSetor.Series["Registro Efetuado"].Points.Add(new SeriesPoint(ds.vwHorasDiaSituacao[i].DSSetor, ds.vwHorasDiaSituacao[i].totSitu));

                        MontaTextoToolTip mt = new MontaTextoToolTip(2);
                        graficoFaltaSetor.Series["Registro Efetuado"].ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;
                        //graficoFaltaSetor.Series["Registro Efetuado"].ToolTipPointPattern = mt.MontaTexto(IDSetor, DTFrequencia, 2,ds);
                    }
                    else if (ds.vwHorasDiaSituacao[i].Situacao == "Não Bateu")
                    {
                        graficoFaltaSetor.Series["Ausência de registro"].Points.Add(new SeriesPoint(ds.vwHorasDiaSituacao[i].DSSetor, ds.vwHorasDiaSituacao[i].totSitu));

                        MontaTextoToolTip mt = new MontaTextoToolTip(3);
                        graficoFaltaSetor.Series["Ausência de registro"].ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;
                        //graficoFaltaSetor.Series["Ausência de registro"].ToolTipPointPattern = mt.MontaTexto(IDSetor, DTFrequencia, 3,ds);
                    }
                    else if (ds.vwHorasDiaSituacao[i].Situacao == "Just")
                    {
                        graficoFaltaSetor.Series["Justificado"].Points.Add(new SeriesPoint(ds.vwHorasDiaSituacao[i].DSSetor, ds.vwHorasDiaSituacao[i].totSitu));

                        MontaTextoToolTip mt = new MontaTextoToolTip(1);
                        graficoFaltaSetor.Series["Justificado"].ToolTipEnabled = DevExpress.Utils.DefaultBoolean.True;
                        //graficoFaltaSetor.Series["Justificado"].ToolTipPointPattern = mt.MontaTexto(IDSetor, DTFrequencia, 1, ds);
                    }
                }
            }
        }
        else if (IDTPUsuario == 2)
        {
            celula.InnerText = string.Empty;
            //lbSetorSecretaria.Visible = false;
            //graficoFaltaSetor.Visible = false;

            //Aqui usuário comum
            //lbSetorSecretaria.Text = "Situação do mês corrente.";

            ds.EnforceConstraints = false;

            //adpSituacaoUsuario.Connection.Open();
            //adpSituacaoUsuario.FillMesAnoIDVinculo(ds.vwSituacaoRegistroUsuarioMesAno,DTFrequencia.Month,DTFrequencia.Year,Convert.ToInt32(Session["IDVinculoUsuarioFinal"]));
            //adpSituacaoUsuario.Connection.Close();

            //Mudança na Rotina. 04/07/2018 fill na dias ano e direto na TBFrequencia();

            //AQui, pega as frequencias realizadas até o momento.
            PT.GetFrequenciaMesAnoVinculo(ds, DateTime.Now.Month, DateTime.Now.Year, Convert.ToInt32(Session["IDVinculoUsuarioFinal"]));
            //Tabela agora dos dias do ano.
            if (ds.TBDiasAno.Rows.Count > 0)
            {
                //ROTINA MONTADA APENAS PARA USUÁRIOS EM REGIME DE EXPEDIENTE. ADIANTE, PENSAR NO PLANTONISTA.
                //esse For para Faltas
                for (int i = 0; i <= ds.TBDiasAno.Rows.Count - 1; i++)
                {
                    if (ds.TBDiasAno[i].DTDiasAno.DayOfWeek.ToString() != "Saturday" && ds.TBDiasAno[i].DTDiasAno.DayOfWeek.ToString() != "Sunday" && !ds.TBDiasAno[i].FeriadoPontoFacultativo)
                    {
                        QTDAusente++;
                        textoAusencia += string.Format("{0}<br>", ds.TBDiasAno[i].DTDiasAno.ToShortDateString());
                    }
                }
                // Esse for para Presença/Justificativa.
                for (int j = 0; j <= ds.TBFrequencia.Rows.Count - 1; j++)
                {
                    if (ds.TBFrequencia[j].IsIDMotivoFaltaNull())
                    {
                        QTDRegistro++;
                        texto += string.Format("{0}<br>", ds.TBFrequencia[j].DTFrequencia.ToShortDateString());
                    }
                    else
                    {
                        QTDJustificado++;
                        textoJustificado += string.Format("{0}<br>", ds.TBFrequencia[j].DTFrequencia.ToShortDateString());
                    }
                }

                //MontaTextoToolTip mt = new MontaTextoToolTip(2);

                //mt.MontaTextoUsuarioComum(Convert.ToInt32(Session["IDUsuario"]), Convert.ToInt32(Session["IDVinculoUsuarioFinal"]), DateTime.Now.Month, DateTime.Now.Year, "Just", ds, Convert.ToInt32(Session["IDEmpresa"]));

                graficoFaltaSetor.Series["Registro Efetuado"].Points.Add(new SeriesPoint(DateTime.Now.Month, QTDRegistro));
                graficoFaltaSetor.Series["Registro Efetuado"].ToolTipEnabled      = DevExpress.Utils.DefaultBoolean.True;
                graficoFaltaSetor.Series["Registro Efetuado"].ToolTipPointPattern = texto;

                graficoFaltaSetor.Series["Registro Ausente"].Points.Add(new SeriesPoint(DateTime.Now.Month, QTDAusente));
                graficoFaltaSetor.Series["Registro Ausente"].ToolTipEnabled      = DevExpress.Utils.DefaultBoolean.True;
                graficoFaltaSetor.Series["Registro Ausente"].ToolTipPointPattern = textoAusencia;

                graficoFaltaSetor.Series["Registro Justificado"].Points.Add(new SeriesPoint(DateTime.Now.Month, QTDJustificado));
                graficoFaltaSetor.Series["Registro Justificado"].ToolTipEnabled      = DevExpress.Utils.DefaultBoolean.True;
                graficoFaltaSetor.Series["Registro Justificado"].ToolTipPointPattern = textoJustificado;

                graficoFaltaSetor.DataBind();
                texto            = string.Empty;
                textoAusencia    = string.Empty;
                textoJustificado = string.Empty;
                QTDRegistro      = 0;
                QTDAusente       = 0;
                QTDJustificado   = 0;
            }
        }
    }