コード例 #1
0
    protected string statusAcao(int cd_acao)
    {
        string cor = "";
        bool r = false;
        bool g = false;
        bool b = false;
        t09_marco t09 = new t09_marco();
        {
            t09.t08_cd_acao = cd_acao;
            foreach (DataRow dr in t09.List().Tables[0].Rows)
            {
                switch (dr["fl_status"].ToString())
                {
                    case "R":
                        r = true;
                        break;
                    case "G":
                        g = true;
                        break;
                    case "B":
                        b = true;
                        break;
                }
            }
        }
        if (r)
        {
            cor = "<img src=\"images/R.gif\" />";
        }
        else if (g)
        {
            cor = "<img src=\"images/G.gif\" />";
        }
        else if (b)
        {
            cor = "<img src=\"images/B.gif\" />";
        }
        else
        {
            cor = "";
        }
        if (!r)
        {
            t29_acaorestricao t29 = new t29_acaorestricao();
            {
                t29.t08_cd_acao = cd_acao;
                t29.RetrieveAcao();
                if (t29.Found)
                {
                    cor = "<img src=\"images/Y.gif\" />";
                }
            }
        }

        return cor;
    }
コード例 #2
0
    protected string graficoAcao(int cd_acao)
    {
        StringBuilder sb1 = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        int i;
        double fisico=0;
        double financeiro = 0;
        double difdias = 0;
        double difhoje=0;
        double crono = 0;
        t08_acao t08 = new t08_acao();
        {
            t08.t08_cd_acao = cd_acao;
            t08.Retrieve();
            if (t08.Found)
            {
                //TEMPO
                difdias = t08.dt_fim.Subtract(t08.dt_inicio).Days;
                difhoje = t08.dt_fim.Subtract(DateTime.Now).Days;

                if (DateTime.Now.Date > t08.dt_inicio.Date)
                {
                    crono = (((difhoje / difdias) * 100) - 100) * -1;
                    if (crono < 0)
                    {
                        crono = 0;
                    }
                    else if (crono > 100)
                    {
                        crono = 100;
                    }
                }
                else
                {
                    crono = 0;
                }

                //FÍSICO (Marcos Críticos)
                t09_marco t09 = new t09_marco();
                {
                    t09.t08_cd_acao = t08.t08_cd_acao;
                    //double mcprev = 0; double mcreal = 0;
                    foreach (DataRow dr in t09.List().Tables[0].Rows)
                    {
                        if ((string)dr["fl_status"] == "B")
                        {
                            fisico += (int)dr["nu_esforco"];
                        }
                        //mcprev += (int)dr["nu_esforco"];
                        //Response.Write(dr["fl_status"] + " - " + dr["nu_esforco"] + "<br>");
                    }
                    //if (mcprev>0)
                      //  fisico = ((mcreal * 100) / mcprev);
                }
                //FÍSICO (Produto)
                //t10_produto t10 = new t10_produto();
                //{
                //    i = 0;
                //    t10.t08_cd_acao = t08.t08_cd_acao;
                //    foreach (DataRow dr in t10.List().Tables[0].Rows)
                //    {
                //        double prev, real;
                //        i++;
                //        if (dr["vl_r"] == DBNull.Value)
                //        {
                //            real = 0;
                //        }
                //        else
                //        {
                //            real = double.Parse(dr["vl_r"].ToString());
                //        }
                //        if (dr["vl_p"] == DBNull.Value)
                //        {
                //            prev = 0;
                //        }
                //        else
                //        {
                //            prev = double.Parse(dr["vl_p"].ToString());
                //        }

                //        if (prev > 0)
                //        {
                //            fisico += ((real * 100) / prev);
                //        }
                //        else
                //        {
                //            fisico += 0;
                //        }
                //    }

                //    if (i>0) fisico = fisico / i;

                //    if (fisico > 100)
                //    {
                //        fisico = 100;
                //    }
                //    else if (fisico < 0)
                //    {
                //        fisico = 0;
                //    }

                //}

                //FINANCEIRO
                t11_financeiro t11 = new t11_financeiro();
                {
                    i = 0;
                    t11.t08_cd_acao = t08.t08_cd_acao;
                    foreach (DataRow dr in t11.ListCalc().Tables[0].Rows)
                    {
                        double prev, real;
                        i++;
                        if (dr["realizado"] == DBNull.Value)
                        {
                            real = 0;
                        }
                        else
                        {
                            real = double.Parse(dr["realizado"].ToString());
                        }
                        if (dr["previsto"] == DBNull.Value)
                        {
                            prev = 0;
                        }
                        else
                        {
                            prev = double.Parse(dr["previsto"].ToString());
                        }
                        if (prev > 0)
                        {
                            financeiro = ((real * 100) / prev);
                        }
                        else
                        {
                            financeiro = 0;
                        }
                    }

                    if (financeiro > 100)
                    {
                        financeiro = 100;
                    }
                    else if (financeiro < 0)
                    {
                        financeiro = 0;
                    }

                }
            }
        }
        //bgColor='" + linha + "'
        sb1.Append("<graph chartRightMargin='23' numberSuffix='%25' chartBottomMargin='30' yAxisMaxValue='100'  showAlternateVGridColor='1' alternateVGridAlpha='10' alternateVGridColor='AFD8F8'  numDivLines='4' decimalPrecision='0' canvasBorderThickness='1' canvasBorderColor='114B78' baseFontColor='114B78' hoverCapBorderColor='114B78' hoverCapBgColor='E7EFF6'>");
        sb1.Append("<set name='Tempo' value='" + crono.ToString().Replace(",", ".") + "' color='AFD8F8' alpha='70'/> ");
        sb1.Append("<set name='Físico' value='" + fisico.ToString().Replace(",", ".") + "' color='AFD8F8' alpha='70'/> ");
        sb1.Append("<set name='Financeiro' value='" + financeiro.ToString().Replace(",",".") + "' color='AFD8F8' alpha='70'/> ");
        sb1.Append("</graph>");

        sb2.Append("<object id=\"FC2Column\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"");
        sb2.Append("height=\"80\" width=\"250\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">");
        sb2.Append("<param name=\"Movie\" value=\"Charts/FC_2_3_Bar2D.swf\">");
        sb2.Append("<param name=\"FlashVars\" value=\"&chartWidth=250&chartHeight=100&dataXML=" + sb1.ToString() + "\">");
        sb2.Append("<embed src=\"Charts/FC_2_3_Bar2D.swf\" flashvars=\"&chartWidth=250&chartHeight=100&dataXML=" + sb1.ToString() + "\"");
        sb2.Append("quality=\"high\" width=\"250\" height=\"80\" name=\"FC2Column\" type=\"application/x-shockwave-flash\" pluginspace=\"http://www.macromedia.com/go/getflashplayer\"> </embed></object>");

        return sb2.ToString();
    }
コード例 #3
0
    private void GridBind()
    {
        t09_marco t09 = new t09_marco();
        {
            int nu_esforco = 0;
            int i = 0;
            t09.t08_cd_acao  = pb.cd_acao();
            t09.order = "order by " + ViewState["campo"].ToString() + " " + ViewState["sentido"].ToString();
            GridView1.DataSource = t09.List();
            GridView1.DataBind();
            if (pb.fl_gerente())
            {
                foreach (DataRow dr in t09.List().Tables[0].Rows)
                {
                    i++;
                    nu_esforco += Int32.Parse(dr["nu_esforco"].ToString());

                    if (dr["dt_realizada"] != null)
                    {
                        btnDes.Visible = true;
                    }
                    else
                    {
                        btnDes.Visible = false;
                    }
                }
                if (i > 0)
                {
                    if (nu_esforco != 100)
                    {
                      //LEVI  lblmsg_mc.Text = "Atenção: Percentual de esforço do(s) Marco(s) Crítico(s) é de: " + nu_esforco.ToString() + "% e deveria ser 100%.";
                        //lblmsg_mc.Font.Bold = true;
                        lblmsg_mc.ForeColor = System.Drawing.Color.Brown;
                    }
                    else
                    {
                        lblmsg_mc.Text = "";
                    }
                }
            }
        }
    }
コード例 #4
0
ファイル: pageBase.cs プロジェクト: samucaguimaraes/sigeor
    public string Status(int cd_projeto)
    {
        StringBuilder sb = new StringBuilder();
        string fl_status;
        int azul = 0;
        int amarelo = 0;
        int vermelho = 0;
        int verde = 0;
        int total = 0;

        t08_acao t08 = new t08_acao();
        {
            //t08.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao)";
            t08.t03_cd_projeto = cd_projeto;
            foreach (DataRow dra in t08.List().Tables[0].Rows)
            {

                bool r = false;
                bool g = false;
                bool b = false;
                bool nenhum = false;
                t09_marco t09 = new t09_marco();
                {
                    t09.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao where t08_cd_acao not in (select t08_cd_acao from t09_marco where fl_ativa=1 and fl_status='R'))";
                    t09.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                    foreach (DataRow dr in t09.List().Tables[0].Rows)
                    {
                        switch (dr["fl_status"].ToString())
                        {
                            case "R":
                                r = true;
                                break;
                            case "G":
                                g = true;
                                break;
                            case "B":
                                b = true;
                                break;
                        }
                    }
                }
                if (r)
                {
                    vermelho++;
                }
                else if (g)
                {
                    verde++;
                }
                else if (b)
                {
                    azul++;
                }
                else
                {
                    nenhum = true;
                }

                if (!r)
                {
                    t29_acaorestricao t29 = new t29_acaorestricao();
                    {
                        t29.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                        t29.RetrieveAcao();
                        if (t29.Found)
                        {
                            amarelo++;
                            nenhum = false;
                        }
                        else
                        {
                            nenhum = true;
                        }
                    }
                }
                //if (!nenhum)
                //{
                //    total++;
                //}
            }

            total = verde + vermelho + amarelo + azul;

            //t09_marco t09 = new t09_marco();
            //{
            //    t09.order = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto=" + cd_projeto.ToString() + ")";
            //    foreach (DataRow dr in t09.ListStatus().Tables[0].Rows)
            //    {
            //        fl_status = dr["fl_status"].ToString().Trim();
            //        switch (fl_status)
            //        {
            //            case ("Y"):
            //                amarelo += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;

            //            case ("B"):
            //                azul += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;

            //            case ("G"):
            //                verde += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;

            //            case ("R"):
            //                vermelho += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;
            //        }
            //        total += Int32.Parse(dr["nu_esforco"].ToString());
            //    }
            //}
            if (total > 0)
            {
                sb.Append("<table width=100% height=17 border=0 cellpadding=0 cellspacing=0><tr>");
                if (azul != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/B.gif');width:" + (azul * 100) / total + "%\" title='" + (azul * 100) / total + "%'>&nbsp;</td>");
                }
                if (verde != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/G.gif');width:" + (verde * 100) / total + "%\" title='" + (verde * 100) / total + "%'>&nbsp;</td>");
                }
                if (amarelo != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/Y.gif');width:" + (amarelo * 100) / total + "%\" title='" + (amarelo * 100) / total + "%'>&nbsp;</td>");
                }
                if (vermelho != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/R.gif');width:" + (vermelho * 100) / total + "%\" title='" + (vermelho * 100) / total + "%'>&nbsp;</td>");
                }
                sb.Append("</tr></table>");
            }
            else
            {
                sb.Append("&nbsp;");
            }

        }

        return sb.ToString();
    }
コード例 #5
0
    public void AcaoStatus(Panel pn)
    {
        try
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            int azul = 0;
            int amarelo = 0;
            int vermelho = 0;
            int verde = 0;
            int total = 0;

            t03_projeto t03 = new t03_projeto();
            {
                t03.order = "select * from t03_projeto where (fl_ativa=1)   " + pb.sqlfiltro() + " order by t03_cd_projeto";
                foreach (DataRow drp in t03.ListQuery().Tables[0].Rows)
                {
                    t08_acao t08 = new t08_acao();
                    {
                        t08.t03_cd_projeto = (int)drp["t03_cd_projeto"];
                        foreach (DataRow dra in t08.List().Tables[0].Rows)
                        {

                            bool r = false;
                            bool g = false;
                            bool b = false;
                            t09_marco t09 = new t09_marco();
                            {
                                t09.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao where t08_cd_acao not in (select t08_cd_acao from t09_marco where fl_ativa=1 and fl_status='R')) ";
                                t09.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                                foreach (DataRow dr in t09.List().Tables[0].Rows)
                                {
                                    switch (dr["fl_status"].ToString())
                                    {
                                        case "R":
                                            r = true;
                                            break;
                                        case "G":
                                            g = true;
                                            break;
                                        case "B":
                                            b = true;
                                            break;
                                    }
                                }
                            }
                            if (r)
                            {
                                vermelho++;
                            }
                            else if (g)
                            {
                                verde++;
                            }
                            else if (b)
                            {
                                azul++;
                            }

                            if (!r)
                            {
                                t29_acaorestricao t29 = new t29_acaorestricao();
                                {
                                    t29.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                                    t29.RetrieveAcao();
                                    if (t29.Found)
                                    {
                                        amarelo++;
                                    }

                                }
                            }
                        }

                    }
                }

                total = verde + vermelho + amarelo + azul;
                if (total > 0)
                {

                    lblAzul.Text = azul.ToString();
                    lblVerde.Text = verde.ToString();
                    lblAmarela.Text = amarelo.ToString();
                    lblVermelha.Text = vermelho.ToString();

                    lblFatiaAzul.Text = ((azul * 100) / total).ToString();
                    lblFatiaVerde.Text = ((verde * 100) / total).ToString();
                    lblFatiaAmarela.Text = ((amarelo * 100) / total).ToString();
                    lblFatiaVermelha.Text = ((vermelho * 100) / total).ToString();

                    if (azul == 0) linkConcluidos.NavigateUrl = "";
                    if (verde == 0) linkPrazos.NavigateUrl = "";
                    if (amarelo == 0) linkComRestricoes.NavigateUrl = "";
                    if (vermelho == 0) linkAtraso.NavigateUrl = "";

                    sb.Append("<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr>");
                    if (azul != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/B.gif');width:" + (azul * 100) / total + "%\" title='" + (azul * 100) / total + "%'>&nbsp;</td>");
                    }
                    if (verde != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/G.gif');width:" + (verde * 100) / total + "%\" title='" + (verde * 100) / total + "%'>&nbsp;</td>");
                    }
                    if (amarelo != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/Y.gif');width:" + (amarelo * 100) / total + "%\" title='" + (amarelo * 100) / total + "%'>&nbsp;</td>");
                    }
                    if (vermelho != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/R.gif');width:" + (vermelho * 100) / total + "%\" title='" + (vermelho * 100) / total + "%'>&nbsp;</td>");
                    }
                    sb.Append("</tr></table>");
                }
                else
                {

                    lblAzul.Text = "0";
                    lblVerde.Text = "0";
                    lblAmarela.Text = "0";
                    lblVermelha.Text = "0";

                    lblFatiaAzul.Text = "0";
                    lblFatiaVerde.Text = "0";
                    lblFatiaAmarela.Text = "0";
                    lblFatiaVermelha.Text = "0";

                    linkConcluidos.NavigateUrl = "";
                    linkPrazos.NavigateUrl = "";
                    linkComRestricoes.NavigateUrl = "";
                    linkAtraso.NavigateUrl = "";
                }
            }
            pn.Controls.Add(pb.GetLiteral(sb.ToString()));
        }
        catch (Exception ex)
        {
            Response.Write("AcaoStatus: " + ex.Message);
        }
    }