Esempio n. 1
0
    protected void FormBind()
    {
        t08_acao t08 = new t08_acao();
        {
            t08.t08_cd_acao = pb.cd_acao();
            t08.Retrieve();
            if (t08.Found)
            {
                lblds_acao.Text = t08.ds_acao;
                lblnm_acao.Text = t08.nm_acao;
                lbldt_inicio.Text = t08.dt_inicio.ToShortDateString();
                lbldt_fim.Text = t08.dt_fim.ToShortDateString();
                lblds_palvo.Text = t08.ds_palvo;
                lblds_latuacao.Text = t08.ds_latuacao;
                lblds_andamento.Text = t08.ds_andamento;

                t02_usuario t02 = new t02_usuario();
                {
                    t02.fl_ativa = true;
                    t02.order = " and t02.t02_cd_usuario = '" + t08.t02_cd_usuario + "'";
                    foreach (DataRow dr in t02.ListParceiro().Tables[0].Rows)
                    {
                        lblnm_nome.Text = dr["nm_nome"].ToString();
                        if ((int)dr["t05_cd_parceiro"] == 0)
                        {
                            lblnm_parceiro.Text = dr["nm_entidade"].ToString();
                        }
                        else
                        {
                            lblnm_parceiro.Text = dr["nm_parceiro"].ToString();
                        }
                    }
                }
            }
            t11_financeiro t11 = new t11_financeiro();
            {
                t11.order = "where t08_cd_acao="+ t08.t08_cd_acao;
                string financiadores = "";
                foreach (DataRow dr in t11.ListInvestimento().Tables[0].Rows)
                {
                    financiadores += dr["nm_parceiro"] + ", ";
                }
                if (financiadores.Length > 1)
                {
                    lblfinanciadores.Text = financiadores.Substring(0, financiadores.Length - 2) + ".";
                }
            }
        }
    }
Esempio n. 2
0
    private void Retrieve(int cod)
    {
        t07_restricao t07 = new t07_restricao();
        {
            t07.t07_cd_restricao = cod;
            t07.Retrieve();
            if (t07.Found)
            {
                lblds_restricao.Text = t07.ds_restricao;
                lblds_medida.Text = t07.ds_medida;
                lbldt_limite.Text = t07.dt_limite.ToShortDateString();
                lbldt_cadastro.Text = t07.dt_cadastro.ToShortDateString();

                t29_acaorestricao t29 = new t29_acaorestricao();
                {
                    t29.t07_cd_restricao = t07.t07_cd_restricao;
                    t29.Retrieve();
                    if (t29.Found)
                    {
                        t08_acao t08 = new t08_acao();
                        {
                            t08.t08_cd_acao = t29.t08_cd_acao;
                            t08.Retrieve();
                            if (t08.Found)
                            {
                                trAcao.Visible = true;
                                lblnm_acao.Text = t08.nm_acao;
                            }

                        }
                    }
                    else
                    {
                        trProjeto.Visible = true;
                    }
                }
            }
        }
    }
Esempio n. 3
0
    protected void btnAcao_Click(object sender, System.EventArgs e)
    {
        //Label lblmsg = lblme.Text;
        t08_acao t08 = new t08_acao();
        {
            bool result = false;
            bool erro = false;
            string msg = "";
            t08.t03_cd_projeto = pb.cd_projeto();
            t08.nm_acao = pb.ReplaceAspas(txtnm_acao.Text);
            t08.t02_cd_usuario = ddlt02_cd_usuario.SelectedValue;
            t08.ds_acao = pb.ReplaceAspas(txtds_acao.Text);
            t08.dt_inicio = DateTime.Parse(txtdt_inicio.Text);
            t08.dt_fim = DateTime.Parse(txtdt_fim.Text);
            t08.dt_original = DateTime.Parse(txtdt_fim.Text);
            t08.dt_cadastro = DateTime.Now;
            t08.dt_alterado = DateTime.Now;
            t08.ds_palvo = pb.ReplaceAspas(txtds_palvo.Text);
            t08.ds_andamento = pb.ReplaceAspas(txtds_andamento.Text);
            t08.ds_latuacao = pb.ReplaceAspas(txtds_latuacao.Text);
            t08.ds_parceiro = pb.ReplaceAspas(txtds_parceiro.Text);
            t08.ds_ano = pb.ReplaceAspas(txtds_ano.Text);
            t08.dt_aviso = DateTime.Parse(txtdt_aviso.Text);

            t03_projeto t03 = new t03_projeto();
            {
                t03.t03_cd_projeto = t08.t03_cd_projeto;
                t03.Retrieve();
                if (t03.Found)
                {
                    if ((t08.dt_inicio < t03.dt_inicio)||(t08.dt_fim > t03.dt_fim))
                    {
                        erro = true;
                        msg = pb.Message("As datas de início e término da Ação deve estar entre as "+
                            "datas de início (" + t03.dt_inicio .ToShortDateString() + ") "+
                            "e término ("+t03.dt_fim.ToShortDateString()+") do Projeto!", "erro");
                    }
                    if ((t08.dt_aviso < t08.dt_inicio)||(t08.dt_aviso > t08.dt_fim))
                    {
                        erro = true;
                        msg = pb.Message("A data de aviso deve estar entre as "+
                            "datas de início (" + t08.dt_inicio .ToShortDateString() + ") "+
                            "e término ("+t08.dt_fim.ToShortDateString()+") da Ação!", "erro");
                    }

                }
            }
            if (!(erro))
            {
                if (cod.Value != "0")
                {
                                t08.t08_cd_acao = Int32.Parse(cod.Value);

                                foreach (DataRow dr in t08.ListAlt().Tables[0].Rows)
                                {
                                    if (dr["menor"] != DBNull.Value)
                                    {
                                        //Response.Write(dr["menor"]);
                                        if ((DateTime.Parse(txtdt_inicio.Text).Year > (int)dr["menor"]) || (DateTime.Parse(txtdt_fim.Text).Year < (int)dr["maior"]))
                                        {
                                            if (btnAcao.CommandArgument != "1")
                                            {
                                                btnAcao.Text = "Confirmar";
                                                lblme.Text = "<b>Atenção:</b> Serão excluídos eventuais valores de Financeiros cadastrados em anos não contidos no novo prazo, clique em Confirmar para prosseguir com a alteração.<br />";
                                                btnAcao.CommandArgument = "1";
                                            }
                                            else
                                            {
                                                t08.order = " nu_ano not between '" + DateTime.Parse(txtdt_inicio.Text).Year + "' And '" + DateTime.Parse(txtdt_fim.Text).Year + "' ";
                                                t08.DeleteAlt();

                                                result = t08.Update();
                                                msg = pb.Message("Alteração realizada com sucesso!", "ok");
                                                pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "update", cod.Value);

                                            }
                                        }
                                        else
                                        {
                                            result = t08.Update();
                                            msg = pb.Message("Alteração realizada com sucesso!", "ok");
                                            pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "update", cod.Value);
                                        }
                                    }
                                    else
                                    {
                                        result = t08.Update();
                                        msg = pb.Message("Alteração realizada com sucesso!", "ok");
                                        pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "update", cod.Value);
                                    }
                                }

                }
                else
                {
                    result = t08.Save();
                    msg = pb.Message("Cadastro realizado com sucesso!", "ok");
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "insert", t08.nm_acao);

                    if (result)
                    {
                        t08.RetrieveCod();
                        if (t08.Found)
                        {
                            t09_marco t09 = new t09_marco();
                            {
                                t09.t08_cd_acao = t08.t08_cd_acao;
                                t09.nu_esforco = 1;
                                t09.ds_marco = "Ação encerrada";
                                t09.dt_prevista = t08.dt_fim;
                                t09.dt_original = t08.dt_fim;
                                t09.ds_comentario = "";
                                t09.fl_status = "G";
                                t09.dt_cadastro = DateTime.Now;
                                t09.dt_alterado = DateTime.Now;
                                t09.fl_original = true;
                                t09.Save();
                            }
                        }
                    }
                }

                if (result)
                {
                    Ocultar();
                    GridBind();
                    cod.Value = "0";
                }
            }
            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Esempio n. 4
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();
    }
Esempio n. 5
0
    //   protected void Pesquisa(object sender, EventArgs e)
    //   {
    //       string order = "";
    //       string find = txtPesquisa.Text;
    //       ViewState["pesquisa"] = " and (t08.nm_acao like '%" + find + "%' or t08.t08_cd_acao LIKE '%" + find + "%' or " +
    //       "t02.ds_andamento like '%" + find + "%')";
    //       order = ViewState["pesquisa"].ToString() + " order by nm_acao";
    //       GridBind(order);
    //       this.btnListar.Visible = true;
    //   }
    private void Retrieve()
    {
        t08_acao t08 = new t08_acao();
        {
            t08.t08_cd_acao = Int32.Parse(cod.Value);
            t08.Retrieve();
            if (t08.Found)
            {
                txtnm_acao.Text = t08.nm_acao;
                txtds_acao.Text = t08.ds_acao;
                txtds_setor.Text = t08.ds_setor;
                txtcd_programa.Text = t08.cd_programa;

                txtnu_acao.Text = t08.nu_acao;
                txtds_compromisso.Text = t08.ds_compromisso;
                txtds_subacao.Text = t08.ds_subacao;
                txtvl_orcado.Text = t08.vl_orcado;
                txtds_fonte.Text = t08.ds_fonte;
                txtds_meta.Text = t08.ds_meta;

                txtdt_inicio.Text = t08.dt_inicio.ToShortDateString();
                txtdt_fim.Text = t08.dt_fim.ToShortDateString();
                ListItem li = ddlt02_cd_usuario.Items.FindByValue(t08.t02_cd_usuario);
                txtds_palvo.Text = t08.ds_palvo;
                txtds_andamento.Text = t08.ds_andamento;
                txtds_latuacao.Text = t08.ds_latuacao;
                txtds_ano.Text = t08.ds_ano;
                txtds_parceiro.Text = t08.ds_parceiro;
                txtdt_aviso.Text = t08.dt_aviso.ToShortDateString();
                if (li != null) li.Selected = true;
            }
        }
    }
Esempio n. 6
0
    private void Retrieve(int cod)
    {
        t10_produto t10 = new t10_produto();
        {
            t10.t10_cd_produto = cod;
            t10.Retrieve();
            if (t10.Found)
            {
                lblds_produto.Text = pb.ReplaceNewLines(t10.ds_produto);
                lblnm_medida.Text = t10.nm_medida;
                t08_acao t08 = new t08_acao();
                {
                    t08.t08_cd_acao = pb.cd_acao();
                    t08.Retrieve();
                    if (t08.Found)
                    {
                        lblnm_acao.Text = t08.nm_acao;
                        t27_vlproduto t27 = new t27_vlproduto();
                        {
                            for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                            {
                                t27.t10_cd_produto = t10.t10_cd_produto;
                                t27.nu_ano = i;
                                t27.Retrieve();

                                TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                                TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                                TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                                TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());
                                TextBox txtvl_ptotal = (TextBox)ucPrevisto.FindControl("txtvl_ptotal5" + i.ToString());

                                TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                                TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                                TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                                TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());
                                TextBox txtvl_rtotal = (TextBox)ucRealizado.FindControl("txtvl_rtotal5" + i.ToString());

                                if (t27.Found)
                                {
                                    char c = char.Parse(",");
                                    int casadecimal = 0;
                                    if (txtvl_p1 != null)
                                    {
                                        casadecimal = Int32.Parse(t27.vl_p1.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_p1.Text = t27.vl_p1.ToString("N2");
                                        else
                                            txtvl_p1.Text = t27.vl_p1.ToString("N0");

                                        casadecimal = Int32.Parse(t27.vl_p4.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_p4.Text = t27.vl_p4.ToString("N2");
                                        else
                                            txtvl_p4.Text = t27.vl_p4.ToString("N0");

                                        casadecimal = Int32.Parse(t27.vl_p8.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_p8.Text = t27.vl_p8.ToString("N2");
                                        else
                                            txtvl_p8.Text = t27.vl_p8.ToString("N0");

                                        casadecimal = Int32.Parse(t27.vl_p12.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_p12.Text = t27.vl_p12.ToString("N2");
                                        else
                                            txtvl_p12.Text = t27.vl_p12.ToString("N0");

                                        casadecimal = Int32.Parse((t27.vl_p1 + t27.vl_p4 + t27.vl_p8 + t27.vl_p12).ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_ptotal.Text = (t27.vl_p1 + t27.vl_p4 + t27.vl_p8 + t27.vl_p12).ToString("N2");
                                        else
                                            txtvl_ptotal.Text = (t27.vl_p1 + t27.vl_p4 + t27.vl_p8 + t27.vl_p12).ToString("N0");

                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        casadecimal = Int32.Parse(t27.vl_r1.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_r1.Text = t27.vl_r1.ToString("N2");
                                        else
                                            txtvl_r1.Text = t27.vl_r1.ToString("N0");

                                        casadecimal = Int32.Parse(t27.vl_r4.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_r4.Text = t27.vl_r4.ToString("N2");
                                        else
                                            txtvl_r4.Text = t27.vl_r4.ToString("N0");

                                        casadecimal = Int32.Parse(t27.vl_r8.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_r8.Text = t27.vl_r8.ToString("N2");
                                        else
                                            txtvl_r8.Text = t27.vl_r8.ToString("N0");

                                        casadecimal = Int32.Parse(t27.vl_r12.ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_r12.Text = t27.vl_r12.ToString("N2");
                                        else
                                            txtvl_r12.Text = t27.vl_r12.ToString("N0");

                                        casadecimal = Int32.Parse((t27.vl_r1 + t27.vl_r4 + t27.vl_r8 + t27.vl_r12).ToString("N2").Split(c)[1].ToString());
                                        if (casadecimal > 0)
                                            txtvl_rtotal.Text = (t27.vl_r1 + t27.vl_r4 + t27.vl_r8 + t27.vl_r12).ToString("N2");
                                        else
                                            txtvl_rtotal.Text = (t27.vl_r1 + t27.vl_r4 + t27.vl_r8 + t27.vl_r12).ToString("N0");
                                    }
                                }
                                else
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = "0";
                                        txtvl_p4.Text = "0";
                                        txtvl_p8.Text = "0";
                                        txtvl_p12.Text = "0";
                                        txtvl_ptotal.Text = "0";
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = "0";
                                        txtvl_r4.Text = "0";
                                        txtvl_r8.Text = "0";
                                        txtvl_r12.Text = "0";
                                        txtvl_rtotal.Text = "0";
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
    }
Esempio n. 7
0
    private void GridBind2(string order)
    {
        string query = "";
        if (!pb.fl_admin())
        {
           // query = " and nm_acao <> 0 ";
           // query = " and t08.t03_cd_projeto in (select t03_cd_projeto from t03_projeto )";
           // GridView1.Columns[7].Visible = false;
        }
        t08_acao t08 = new t08_acao();
        {
            t08.fl_ativa = true;
            //lbltotal.Text = "(total: "+ t08.List().Tables[0].Rows.Count +" usuários)";
            t08.t03_cd_projeto = pb.cd_projeto();
            t08.order = ViewState["pesquisa"] + order;

            if (ViewState["pesquisa"] != null)
            {
                if (ViewState["pesquisa"].ToString() != "")
                {
                //lblfindtotal.Text = t08.List().Tables[0].Rows.Count + " encontrados ";
                }
                else { lblfindtotal.Text = ""; }
            }

            GridView1.DataSource = t08.List2();
            //GridView1.DataBind();
            //if (t08.List2().Tables[0].Rows.Count >= 1)
            //linkGraf.Visible = true;
            //else
            //linkGraf.Visible = false;
        }
    }
    private void Retrieve()
    {
        trReal.Visible = true;
        t11_financeiro t11 = new t11_financeiro();
        {
            t11.t11_cd_financeiro = Int32.Parse(cod.Value);
            t11.Retrieve();
            if (t11.Found)
            {
                //FormBind(" and t05_cd_parceiro not in (select t05_cd_parceiro from t11_financeiro where t08_cd_acao=" + pb.cd_acao() + " and t05_cd_parceiro<>" + t11.t05_cd_parceiro + ")");
                FormBind("");
                ListItem li = ddlt05_cd_parceiro.Items.FindByValue(t11.t05_cd_parceiro.ToString());
                if (li != null) li.Selected = true;
                li = rblfl_economico.Items.FindByValue(t11.fl_economico.ToString());
                if (li != null) li.Selected = true;

                t08_acao t08 = new t08_acao();
                {
                    t08.t08_cd_acao = pb.cd_acao();
                    t08.Retrieve();
                    if (t08.Found)
                    {
                        t28_vlfinanceiro t28 = new t28_vlfinanceiro();
                        {
                            for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                            {
                                t28.t11_cd_financeiro = t11.t11_cd_financeiro;
                                t28.nu_ano = i;
                                t28.Retrieve();

                                TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                                TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                                TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                                TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());

                                TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                                TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                                TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                                TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());

                                if (t28.Found)
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = t28.vl_p1.ToString("N2");
                                        txtvl_p4.Text = t28.vl_p4.ToString("N2");
                                        txtvl_p8.Text = t28.vl_p8.ToString("N2");
                                        txtvl_p12.Text = t28.vl_p12.ToString("N2");
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = t28.vl_r1.ToString("N2");
                                        txtvl_r4.Text = t28.vl_r4.ToString("N2");
                                        txtvl_r8.Text = t28.vl_r8.ToString("N2");
                                        txtvl_r12.Text = t28.vl_r12.ToString("N2");
                                    }
                                }
                                else
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = "0";
                                        txtvl_p4.Text = "0";
                                        txtvl_p8.Text = "0";
                                        txtvl_p12.Text = "0";
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = "0";
                                        txtvl_r4.Text = "0";
                                        txtvl_r8.Text = "0";
                                        txtvl_r12.Text = "0";
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        int numcells = 6;
        int j;

        TableRow HeaderRow = new TableRow();
        HeaderRow.Style["color"] = "white";
        HeaderRow.Style["font-weight"] = "bold";
        HeaderRow.Style["text-align"] = "center";
        HeaderRow.Style["background-color"] = "#5D7B9D";
        tbAnos.Rows.Add(HeaderRow);

        //-- Add header cells to the row
        TableCell HeaderCell_1 = new TableCell();
        HeaderCell_1.Text = "Ano";
        HeaderRow.Cells.Add(HeaderCell_1);

        TableCell HeaderCellP_1 = new TableCell();
        HeaderCellP_1.Text = "1º Trim";
        HeaderRow.Cells.Add(HeaderCellP_1);

        TableCell HeaderCellP_2 = new TableCell();
        HeaderCellP_2.Text = "2º Trim";
        HeaderRow.Cells.Add(HeaderCellP_2);

        TableCell HeaderCellP_3 = new TableCell();
        HeaderCellP_3.Text = "3º Trim";
        HeaderRow.Cells.Add(HeaderCellP_3);

        TableCell HeaderCellP_4 = new TableCell();
        HeaderCellP_4.Text = "4º Trim";
        HeaderRow.Cells.Add(HeaderCellP_4);

        TableCell HeaderCell_5 = new TableCell();
        HeaderCell_5.Text = "Total";
        HeaderRow.Cells.Add(HeaderCell_5);
        if (_editar)
            HeaderCell_5.Visible = false;

        t08_acao t08 = new t08_acao();
        t08.t08_cd_acao = pb.cd_acao();
        t08.Retrieve();
        if (t08.Found)
        {
            for (j = t08.dt_inicio.Year; j <= t08.dt_fim.Year; j++)
            {
                TableRow r = new TableRow();
                r.Style["background-color"] = "#F1F5F5";
                int i;
                for (i = 0; i <= numcells - 1; i++)
                {
                    TableCell c = new TableCell();
                    TextBox UserTextBox = new TextBox();
                    if (!_editar)
                    {

                        UserTextBox.Attributes.Add("style", "background:#F1F5F5;border:none;text-align:right;");
                        UserTextBox.ReadOnly = true;
                    }
                    CompareValidator val = new CompareValidator();
                    switch (i)
                    {
                        case 0:
                            //ANO
                            c.Controls.Add(new LiteralControl(j.ToString()));
                            r.Cells.Add(c);
                            break;
                        case 1:
                            //PREVISTO

                            UserTextBox.ID = "txtvl_p" + i.ToString() + j.ToString();
                            UserTextBox.Columns = 18;
                            UserTextBox.MaxLength = 18;
                            UserTextBox.EnableViewState = true;
                            UserTextBox.Text = "0";

                            val.ID = "valp" + i.ToString() + j.ToString();
                            val.ControlToValidate = UserTextBox.ID;
                            val.ErrorMessage = "<br>*formato inválido";
                            val.Display = ValidatorDisplay.Dynamic;
                            val.Operator = ValidationCompareOperator.DataTypeCheck;
                            val.Type = ValidationDataType.Currency;
                            c.Controls.Add(UserTextBox);
                            c.Controls.Add(val);
                            r.Cells.Add(c);

                            break;
                        case 2:
                            //PREVISTO

                            UserTextBox.ID = "txtvl_p" + i.ToString() + j.ToString();
                            UserTextBox.Columns = 18;
                            UserTextBox.MaxLength = 18;
                            UserTextBox.EnableViewState = true;
                            UserTextBox.Text = "0";

                            val.ID = "valp" + i.ToString() + j.ToString();
                            val.ControlToValidate = UserTextBox.ID;
                            val.ErrorMessage = "<br>*formato inválido";
                            val.Display = ValidatorDisplay.Dynamic;
                            val.Operator = ValidationCompareOperator.DataTypeCheck;
                            val.Type = ValidationDataType.Currency;
                            c.Controls.Add(UserTextBox);
                            c.Controls.Add(val);
                            r.Cells.Add(c);

                            break;
                        case 3:
                            //PREVISTO

                            UserTextBox.ID = "txtvl_p" + i.ToString() + j.ToString();
                            UserTextBox.Columns = 18;
                            UserTextBox.MaxLength = 18;
                            UserTextBox.EnableViewState = true;
                            UserTextBox.Text = "0";

                            val.ID = "valp" + i.ToString() + j.ToString();
                            val.ControlToValidate = UserTextBox.ID;
                            val.ErrorMessage = "<br>*formato inválido";
                            val.Display = ValidatorDisplay.Dynamic;
                            val.Operator = ValidationCompareOperator.DataTypeCheck;
                            val.Type = ValidationDataType.Currency;
                            c.Controls.Add(UserTextBox);
                            c.Controls.Add(val);
                            r.Cells.Add(c);

                            break;
                        case 4:
                            //PREVISTO

                            UserTextBox.ID = "txtvl_p" + i.ToString() + j.ToString();
                            UserTextBox.Columns = 18;
                            UserTextBox.MaxLength = 18;
                            UserTextBox.EnableViewState = true;
                            UserTextBox.Text = "0";

                            val.ID = "valp" + i.ToString() + j.ToString();
                            val.ControlToValidate = UserTextBox.ID;
                            val.ErrorMessage = "<br>*formato inválido";
                            val.Display = ValidatorDisplay.Dynamic;
                            val.Operator = ValidationCompareOperator.DataTypeCheck;
                            val.Type = ValidationDataType.Currency;
                            c.Controls.Add(UserTextBox);
                            c.Controls.Add(val);
                            r.Cells.Add(c);

                            break;
                        case 5:
                            //PREVISTO TOTAL

                            UserTextBox.ID = "txtvl_ptotal" + i.ToString() + j.ToString();
                            UserTextBox.Columns = 18;
                            UserTextBox.MaxLength = 18;
                            UserTextBox.EnableViewState = true;
                            UserTextBox.Text = "0,00";
                            UserTextBox.ReadOnly = true;
                            if (!_editar)
                            {
                                c.Controls.Add(UserTextBox);
                                r.Cells.Add(c);
                            }
                            break;

                    }

                }
                tbAnos.Rows.Add(r);
            }
        }
    }
Esempio n. 10
0
    protected void FormBind(string str_t05)
    {
        t08_acao t08 = new t08_acao();
        {
            t08.t08_cd_acao = pb.cd_acao();
            t08.Retrieve();
            if (t08.Found)
            {
                for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                {
                    TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                    TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                    TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                    TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());

                    TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                    TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                    TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                    TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());

                    if (txtvl_p1 != null)
                    {
                        txtvl_p1.Text = "";
                        txtvl_p4.Text = "";
                        txtvl_p8.Text = "";
                        txtvl_p12.Text = "";
                    }
                    if (txtvl_r1 != null)
                    {
                        txtvl_r1.Text = "";
                        txtvl_r4.Text = "";
                        txtvl_r8.Text = "";
                        txtvl_r12.Text = "";
                    }
                }
            }
        }

        t05_parceiro t05 = new t05_parceiro();
        {
            t03_projeto t03 = new t03_projeto();
            {
                t03.t03_cd_projeto = pb.cd_projeto();
                t03.Retrieve();
                if (t03.Found)
                {
                    t05.t01_cd_entidade = t03.t01_cd_entidade;
                    t05.order = "order by nm_parceiro";
                    ddlt05_cd_parceiro.DataSource = t05.List();
                    ddlt05_cd_parceiro.DataTextField = "nm_parceiro";
                    ddlt05_cd_parceiro.DataValueField = "t05_cd_parceiro";
                    ddlt05_cd_parceiro.DataBind();
                    pb.AddEmptyItem(ddlt05_cd_parceiro, "Selecione");
                }
            }
        }
    }
Esempio n. 11
0
    protected void btnAcao_Click(object sender, System.EventArgs e)
    {
        t11_financeiro t11 = new t11_financeiro();
        {
            bool result = false;
            bool erro = false;
            string msg = "";
            t11.t08_cd_acao = pb.cd_acao();
            t11.t05_cd_parceiro = Int32.Parse(ddlt05_cd_parceiro.SelectedValue);
            t11.dt_cadastro = DateTime.Now;
            t11.dt_alterado = DateTime.Now;
          // LEVI  t11.fl_economico = bool.Parse(rblfl_economico.SelectedValue);
            if (!(erro))
            {
                if (cod.Value != "0")
                {
                    t11.t11_cd_financeiro = Int32.Parse(cod.Value);
                    result = t11.Update();
                    msg = pb.Message("Alteração realizada com sucesso!", "ok");
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t11_financeiro", "update", cod.Value);
                }
                else
                {
                    result = t11.Save();
                    msg = pb.Message("Cadastro realizado com sucesso!", "ok");
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t11_financeiro", "insert", t11.nu_ano.ToString());
                }

                if (result)
                {
                    t28_vlfinanceiro t28 = new t28_vlfinanceiro();
                    {
                        t08_acao t08 = new t08_acao();
                        {
                            t08.t08_cd_acao = pb.cd_acao();
                            t08.Retrieve();
                            if (t08.Found)
                            {
                                if (trReal.Visible)
                                {
                                    t28.t11_cd_financeiro = Int32.Parse(cod.Value.ToString());
                                }
                                else
                                {
                                    t11.RetrieveCod();
                                    if (t11.Found) t28.t11_cd_financeiro = t11.t11_cd_financeiro;
                                }
                                t28.Delete();
                                for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                                {
                                    TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                                    TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                                    TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                                    TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());

                                    TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                                    TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                                    TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                                    TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());

                                    if (txtvl_p1 != null)
                                    {
                                        if (txtvl_p1.Text == "") txtvl_p1.Text = "0";
                                        if (txtvl_p4.Text == "") txtvl_p4.Text = "0";
                                        if (txtvl_p8.Text == "") txtvl_p8.Text = "0";
                                        if (txtvl_p12.Text == "") txtvl_p12.Text = "0";

                                        t28.nu_ano = i;
                                        t28.vl_p1 = Decimal.Parse(txtvl_p1.Text);
                                        t28.vl_p4 = Decimal.Parse(txtvl_p4.Text);
                                        t28.vl_p8 = Decimal.Parse(txtvl_p8.Text);
                                        t28.vl_p12 = Decimal.Parse(txtvl_p12.Text);
                                        if (trReal.Visible)
                                        {
                                            if (txtvl_r1.Text == "") txtvl_r1.Text = "0";
                                            if (txtvl_r4.Text == "") txtvl_r4.Text = "0";
                                            if (txtvl_r8.Text == "") txtvl_r8.Text = "0";
                                            if (txtvl_r12.Text == "") txtvl_r12.Text = "0";
                                            t28.vl_r1 = Decimal.Parse(txtvl_r1.Text);
                                            t28.vl_r4 = Decimal.Parse(txtvl_r4.Text);
                                            t28.vl_r8 = Decimal.Parse(txtvl_r8.Text);
                                            t28.vl_r12 = Decimal.Parse(txtvl_r12.Text);
                                        }
                                        t28.Save();
                                        if (txtvl_p1 != null)
                                        {
                                            txtvl_p1.Text = "0";
                                            txtvl_p4.Text = "0";
                                            txtvl_p8.Text = "0";
                                            txtvl_p12.Text = "0";
                                        }
                                        if (txtvl_r1 != null)
                                        {
                                            txtvl_r1.Text = "0";
                                            txtvl_r4.Text = "0";
                                            txtvl_r8.Text = "0";
                                            txtvl_r12.Text = "0";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Ocultar();
                    GridBind();
                    cod.Value = "0";
                }
            }
            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Esempio n. 12
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);
        }
    }
Esempio n. 13
0
 protected void FormBind()
 {
     //FormBind()
     t08_acao t08 = new t08_acao();
     {
         t08.t03_cd_projeto = pb.cd_projeto();
         t08.order = "order by nm_acao";
         ddlt08_cd_acao.DataSource = t08.List();
         ddlt08_cd_acao.DataTextField = "nm_acao";
         ddlt08_cd_acao.DataValueField = "t08_cd_acao";
         ddlt08_cd_acao.DataBind();
         pb.AddEmptyItem(ddlt08_cd_acao, "Selecione");
     }
 }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            StringBuilder sb = new StringBuilder();
            string[] ar = {"Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"};

            t03_projeto t03 = new t03_projeto();
            {

                t03.t03_cd_projeto = pb.cd_projeto();
                t03.Retrieve();
                if (t03.Found)
                {
                    string strclass = "";
                    int anoPinicio = t03.dt_inicio.Year;
                    int anoPfim = t03.dt_fim.Year;
                    sb.Append("<table class='grafAcao' cellpadding=0 cellspacing=0><tr>");
                    int cont = 0;
                    for (int i = anoPinicio; i <= anoPfim; i++)
                    {
                        if (i % 2 == 0) { strclass = "class='anos'"; } else { strclass = "class='anos2'"; }
                        sb.Append("<td colspan=12 " + strclass + ">" + i.ToString() + "</td>");
                        cont++;
                    }
                    sb.Append("</tr>");
                    sb.Append("<tr>");
                    int j = 0;
                    int ctemp=cont;
                    for (int i = 1; i <= (cont * 12); i++)
                    {
                        if (ctemp % 2 == 0) { strclass = "class='meses'"; } else { strclass = "class='meses2'"; }
                        sb.Append("<td " + strclass + ">" + ar[j] + "</td>");
                        j++;
                        if (j == 12)
                        {
                            j = 0;
                            ctemp--;
                        }

                    }
                    sb.Append("</tr>");

                    t08_acao t08 = new t08_acao();
                    {
                        t08.order = "order by dt_inicio";
                        t08.t03_cd_projeto = pb.cd_projeto();

                        int h = 50 + (t08.List().Tables[0].Rows.Count * 50);
                        Panel1.Height = h;

                        foreach (DataRow dr in t08.List().Tables[0].Rows)
                        {

                            DateTime acaoInicio = DateTime.Parse(dr["dt_inicio"].ToString());
                            DateTime acaoFim = DateTime.Parse(dr["dt_fim"].ToString());

                            sb.Append("<tr>");
                            sb.Append("<td colspan='" + (cont * 12) + "' class='nmAcao'><b>Ação:</b> " + dr["nm_acao"].ToString() + "</td>");
                            sb.Append("</tr>");
                            sb.Append("<tr>");
                            j = 1;
                            int diff = monthDifference(acaoInicio, acaoFim);
                            int anoP = anoPinicio;

                            bool inicia = false;
                            for (int i = 1; i <= (cont * 12); i++)
                            {
                                if (j == 13)
                                {
                                    j = 1;
                                    anoP++;
                                }
                                string str = "";
                                //Response.Write("if (" + anoP.ToString() + ">= " + acaoInicio.Year.ToString() + ")<br>");
                                if (anoP >= acaoInicio.Year)
                                {
                                    if ((acaoInicio.Month == j))
                                    {
                                        inicia = true;
                                    }

                                    if (inicia && diff > 0)
                                    {
                                        int a = (j - 1);
                                        str = "class='barraAcao' title='" + ar[a] + "/" + anoP + "'";
                                        diff--;
                                    }
                                }

                                j++;
                                sb.Append("<td " + str + ">&nbsp;</td>");

                            }
                            sb.Append("</tr>");
                        }
                    }
                }
                sb.Append("</table>");
            }
            Panel1.Controls.Add(pb.GetLiteral(sb.ToString()));

        }
    }
Esempio n. 15
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            GridView gv = (GridView)sender;
            if (e.CommandName != "Sort")
            {
                int cd = Int32.Parse(gv.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value.ToString());
                switch (e.CommandName)
                {
                    case "Selecionar":
                        Session["cd_acao"] = cd.ToString();
                        Response.Redirect("~/Acao.aspx");
                        break;

                    case "Editar":
                        Exibir();
                        this.lblHeader.Text = "Alteração";
                        this.btnAcao.Text = "Alterar";
                        cod.Value = cd.ToString();
                        Retrieve();

                        break;
                    case "Deletar":
                        t08_acao t08 = new t08_acao();
                        {
                            t08.t08_cd_acao = cd;
                            t08.Delete();
                            pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t08_acao", "delete", t08.t08_cd_acao.ToString());
                        }
                        GridBind();
                        lblMsg.Text = pb.Message("Exclusão realizada com sucesso!", "ok");
                        lblMsg.Visible = true;
                        break;
                }
            }
        }
        catch { }
    }
Esempio n. 16
0
    protected void btnAcao_Click(object sender, System.EventArgs e)
    {
        t09_marco t09 = new t09_marco();
        {
            bool result = false;
            bool erro = false;
            string msg = "";
            t09.t08_cd_acao = pb.cd_acao();
            //t09.nu_esforco = Int32.Parse(txtnu_esforco.Text);
            t09.ds_marco = pb.ReplaceAspas(txtds_marco.Text);
            t09.dt_prevista = DateTime.Parse(txtdt_prevista.Text);
            //t09.dt_original = DateTime.Parse(txtdt_prevista.Text);
            t09.ds_comentario = txtds_comentario.Text;
            t09.fl_status = "G";
            t09.dt_cadastro = DateTime.Now;
            t09.dt_alterado = DateTime.Now;
            t09.fl_original = false;
            t08_acao t08 = new t08_acao();
            {
                t08.t08_cd_acao = pb.cd_acao();
                t08.Retrieve();
                if (t08.Found)
                {
                    if ((t09.dt_prevista < t08.dt_inicio) || (t09.dt_prevista > t08.dt_fim))
                    {
                        erro = true;
                        msg = pb.Message("As Data Prevista do Marco Crítico deve estar entre as " +
                            "datas de início (" + t08.dt_inicio.ToShortDateString() + ") " +
                            "e término (" + t08.dt_fim.ToShortDateString() + ") da Ação!", "erro");
                    }
                }
            }

            if (!(erro))
            {
                if (cod.Value != "0")
                {
                    t09.t09_cd_marco = Int32.Parse(cod.Value);
                    if (txtdt_realizada.Text != "")
                    {
                        t09.order = ", dt_realizada='" + String.Format("{0:yyyy-MM-dd}", DateTime.Parse(txtdt_realizada.Text)) + "', fl_status = 'B'";

                    }
                    else
                    {
                        if (t09.dt_prevista >= DateTime.Today)
                        {
                            //t09.fl_status = "G";
                            t09.order = ", fl_status = 'G'";
                        }
                        else
                        {
                            //t09.fl_status = "R";
                            t09.order = ", fl_status = 'R'";
                        }
                    }
                    result = t09.Update();
                    msg = pb.Message("Alteração realizada com sucesso!", "ok");
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t09_marco", "update", cod.Value);
                }
                else
                {
                    if (t09.dt_prevista < DateTime.Today)
                    {
                        t09.fl_status = "R";
                    }

                    result = t09.Save();
                    msg = pb.Message("Cadastro realizado com sucesso!", "ok");
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t09_marco", "insert", t09.ds_marco);
                }

                if (result)
                {
                    Ocultar();
                    GridBind();
                    cod.Value = "0";
                }
            }
            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Esempio n. 17
0
 private void GridBind()
 {
     t08_acao t08 = new t08_acao();
     {
         t08.t03_cd_projeto = pb.cd_projeto();
         t08.order = "order by " + ViewState["campo"].ToString() +" "+ ViewState["sentido"].ToString();
         GridView1.DataSource = t08.List();
         GridView1.DataBind();
     }
     if (t08.List().Tables[0].Rows.Count >= 1)
         linkGraf.Visible = true;
     else
         linkGraf.Visible = false;
 }
Esempio n. 18
0
    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();
    }
Esempio n. 19
0
 private void Retrieve()
 {
     t08_acao t08 = new t08_acao();
     {
         t08.t08_cd_acao = Int32.Parse(cod.Value);
         t08.Retrieve();
         if (t08.Found)
         {
             txtnm_acao.Text = t08.nm_acao;
             txtds_acao.Text = t08.ds_acao;
             txtdt_inicio.Text = t08.dt_inicio.ToShortDateString();
             txtdt_fim.Text = t08.dt_fim.ToShortDateString();
             ListItem li = ddlt02_cd_usuario.Items.FindByValue(t08.t02_cd_usuario);
             txtds_palvo.Text = t08.ds_palvo;
             txtds_andamento.Text = t08.ds_andamento;
             txtds_latuacao.Text = t08.ds_latuacao;
             txtds_ano.Text = t08.ds_ano;
             txtds_parceiro.Text = t08.ds_parceiro;
             txtdt_aviso.Text = t08.dt_aviso.ToShortDateString();
             if (li != null) li.Selected = true;
         }
     }
 }
Esempio n. 20
0
    private void Retrieve(int cod)
    {
        t11_financeiro t11 = new t11_financeiro();
        {
            t11.t11_cd_financeiro = cod;
            t11.Retrieve();
            if (t11.Found)
            {
                if (t11.fl_economico)
                {
                    lbltipo.Text = "Econômico";
                }
                else
                {
                    lbltipo.Text = "Financeiro";
                }
                t05_parceiro t05 = new t05_parceiro();
                {
                    t05.t05_cd_parceiro = t11.t05_cd_parceiro;
                    t05.Retrieve();
                    if (t05.Found)
                    { lblnm_parceiro.Text = t05.nm_parceiro; }
                }
                t08_acao t08 = new t08_acao();
                {
                    t08.t08_cd_acao = pb.cd_acao();
                    t08.Retrieve();
                    if (t08.Found)
                    {
                        lblnm_acao.Text = t08.nm_acao;
                        t28_vlfinanceiro t28 = new t28_vlfinanceiro();
                        {
                            for (int i = t08.dt_inicio.Year; i <= t08.dt_fim.Year; i++)
                            {
                                t28.t11_cd_financeiro = t11.t11_cd_financeiro;
                                t28.nu_ano = i;
                                t28.Retrieve();

                                TextBox txtvl_p1 = (TextBox)ucPrevisto.FindControl("txtvl_p1" + i.ToString());
                                TextBox txtvl_p4 = (TextBox)ucPrevisto.FindControl("txtvl_p2" + i.ToString());
                                TextBox txtvl_p8 = (TextBox)ucPrevisto.FindControl("txtvl_p3" + i.ToString());
                                TextBox txtvl_p12 = (TextBox)ucPrevisto.FindControl("txtvl_p4" + i.ToString());
                                TextBox txtvl_ptotal = (TextBox)ucPrevisto.FindControl("txtvl_ptotal5" + i.ToString());

                                TextBox txtvl_r1 = (TextBox)ucRealizado.FindControl("txtvl_r1" + i.ToString());
                                TextBox txtvl_r4 = (TextBox)ucRealizado.FindControl("txtvl_r2" + i.ToString());
                                TextBox txtvl_r8 = (TextBox)ucRealizado.FindControl("txtvl_r3" + i.ToString());
                                TextBox txtvl_r12 = (TextBox)ucRealizado.FindControl("txtvl_r4" + i.ToString());
                                TextBox txtvl_rtotal = (TextBox)ucRealizado.FindControl("txtvl_rtotal5" + i.ToString());

                                if (t28.Found)
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = t28.vl_p1.ToString("N2");
                                        txtvl_p4.Text = t28.vl_p4.ToString("N2");
                                        txtvl_p8.Text = t28.vl_p8.ToString("N2");
                                        txtvl_p12.Text = t28.vl_p12.ToString("N2");
                                        txtvl_ptotal.Text = (t28.vl_p1 + t28.vl_p4 + t28.vl_p8 + t28.vl_p12).ToString("N2");
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = t28.vl_r1.ToString("N2");
                                        txtvl_r4.Text = t28.vl_r4.ToString("N2");
                                        txtvl_r8.Text = t28.vl_r8.ToString("N2");
                                        txtvl_r12.Text = t28.vl_r12.ToString("N2");
                                        txtvl_rtotal.Text = (t28.vl_r1 + t28.vl_r4 + t28.vl_r8 + t28.vl_r12).ToString("N2");
                                    }
                                }
                                else
                                {
                                    if (txtvl_p1 != null)
                                    {
                                        txtvl_p1.Text = "0,00";
                                        txtvl_p4.Text = "0,00";
                                        txtvl_p8.Text = "0,00";
                                        txtvl_p12.Text = "0,00";
                                    }
                                    if (txtvl_r1 != null)
                                    {
                                        txtvl_r1.Text = "0,00";
                                        txtvl_r4.Text = "0,00";
                                        txtvl_r8.Text = "0,00";
                                        txtvl_r12.Text = "0,00";
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
    }