private void listaTareas(int iNumPE)
        {
            StringBuilder strBuilder = new StringBuilder();
            double        fAvance, fETPL, fETPR, fConsumo;
            string        sCad, sFecha;

            strBuilder.Append("<table id='tblDatos' class='texto MA' style='width: 396px;'>");
            strBuilder.Append("<colgroup><col style='width:50px'/><col style='width:346px'/></colgroup>");
            strBuilder.Append("<tbody>");
            SqlDataReader dr = HITOPSP.CatalogoTareasPE(iNumPE);

            while (dr.Read())
            {
                strBuilder.Append("<tr style='height:16px;' ");

                StringBuilder sbTitle = new StringBuilder();
                sbTitle.Append("<b>Proy. Eco.</b>: ");
                sbTitle.Append(dr["nom_proyecto"].ToString().Replace((char)34, (char)39));
                sbTitle.Append("<br><b>Proy. Téc.</b>: ");
                sbTitle.Append(dr["t331_despt"].ToString().Replace((char)34, (char)39));
                if (dr["t334_desfase"].ToString() != "")
                {
                    sbTitle.Append("<br><b>Fase</b>:          ");
                    sbTitle.Append(dr["t334_desfase"].ToString().Replace((char)34, (char)39));
                }
                if (dr["t335_desactividad"].ToString() != "")
                {
                    sbTitle.Append("<br><b>Actividad</b>:  ");
                    sbTitle.Append(dr["t335_desactividad"].ToString().Replace((char)34, (char)39));
                }
                sbTitle.Append("<br><b>Tarea</b>:  ");
                sbTitle.Append(dr["desTarea"].ToString().Replace((char)34, (char)39));

                strBuilder.Append("id='");
                strBuilder.Append(dr["codTarea"].ToString());
                strBuilder.Append("' onclick='mm(event)' ondblclick='aceptar()' onmouseover='TTip(event);' title=\"cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../images/info.gif' style='vertical-align:middle'>  Estructura] body=[");
                strBuilder.Append(sbTitle);
                strBuilder.Append("]\"");
                sCad = dr["ETPL"].ToString();
                if (sCad == "")
                {
                    fETPL = 0;
                }
                else
                {
                    fETPL = double.Parse(sCad);
                }
                strBuilder.Append(" ETPL='" + fETPL.ToString("N") + "'");

                sCad = dr["FIPL"].ToString();
                if (sCad != "")
                {
                    sFecha = DateTime.Parse(sCad).ToShortDateString();
                }
                else
                {
                    sFecha = "";
                }
                strBuilder.Append(" FIPL='" + sFecha + "'");

                sCad = dr["FFPL"].ToString();
                if (sCad != "")
                {
                    sFecha = DateTime.Parse(sCad).ToShortDateString();
                }
                else
                {
                    sFecha = "";
                }
                strBuilder.Append(" FFPL='" + sFecha + "'");

                sCad = dr["ETPR"].ToString();
                if (sCad == "")
                {
                    fETPR = 0;
                }
                else
                {
                    fETPR = double.Parse(sCad);
                }
                strBuilder.Append(" ETPR='" + fETPR.ToString("N") + "'");

                sCad = dr["FFPR"].ToString();
                if (sCad != "")
                {
                    sFecha = DateTime.Parse(sCad).ToShortDateString();
                }
                else
                {
                    sFecha = "";
                }
                strBuilder.Append(" FFPR='" + sFecha + "'");

                sCad = dr["Consumo"].ToString();
                if (sCad == "")
                {
                    fConsumo = 0;
                }
                else
                {
                    fConsumo = double.Parse(sCad);
                }
                strBuilder.Append(" CONSUMO='" + fConsumo.ToString("N") + "'");

                if (fConsumo == 0)
                {
                    fAvance = 0;
                }
                else
                {
                    fAvance = (fETPR * 100) / fConsumo;
                }
                strBuilder.Append(" AVANCE='" + fAvance.ToString("N") + "'");
                strBuilder.Append(">");

                strBuilder.Append("<td style='text-align:right'>");
                strBuilder.Append(int.Parse(dr["codTarea"].ToString()).ToString("#,###"));
                strBuilder.Append("</td><td style='padding-left:5px;'><nobr style='width:346px;' class='NBR'>");
                strBuilder.Append(dr["desTarea"].ToString());
                strBuilder.Append("</nobr></td>");
            }
            dr.Close();
            dr.Dispose();
            strBuilder.Append("</tbody>");
            strBuilder.Append("</table>");
            strTablaHtml = strBuilder.ToString();
        }
Exemple #2
0
    protected string ObtenerTodasTareas(string sPE)
    {
        //Relacion de tareas asignadas del proyecto económico
        string sResul = "", sCad, sFecha, sCodTarea;
        double fPrev = 0, fCons = 0, fAvance = 0;
        bool   bAvanceAutomatico;

        StringBuilder sbuilder = new StringBuilder();

        try
        {
            sbuilder.Append("<table id='tblTareas' class='texto MANO' style='width: 800px;'>");
            //............................ idTarea........... Desc Tarea..........ETPL.......................................separador............FIPL....................FFPL..............ETPR......................................separador...........FFPR................CONSUMO.....................................AVANCE
            sbuilder.Append("<colgroup><col style='width:40px;' /><col style='width:340px;' /><col style='width:50px;'/><col style='width:10px' /><col style='width:60px' /><col style='width:60px' /><col style='width:50px' /><col style='width:10px' /><col style='width:60px' /><col style='width:50px'/><col style='width:50px' /></colgroup>");
            sbuilder.Append("<tbody>");
            if (sTipoHito != "HF")
            {
                SqlDataReader dr = HITOPSP.CatalogoTareasPE(int.Parse(sPE));

                //Tarea 50 Desc 350 ETPL 40+10 FIPL 60 FFPL 60 ETPR 40+10 FFPR 60 CONSUMO 50 AVANCE 50
                int i = 0;
                while (dr.Read())
                {
                    sCodTarea = dr["codTarea"].ToString();
                    sbuilder.Append("<tr id='" + sCodTarea + "' est='I' onclick='mm(event)' style='height:16px;'>");
                    sbuilder.Append("<td>" + int.Parse(sCodTarea).ToString() + "</td>");
                    sbuilder.Append("<td>" + dr["desTarea"].ToString() + "</td>");

                    if (dr["ETPL"] != DBNull.Value)
                    {
                        sbuilder.Append("<td style='text-align:right'>" + double.Parse(dr["ETPL"].ToString()).ToString("N") + "</td>");
                    }
                    else
                    {
                        sbuilder.Append("<td style='text-align:right'></td>");
                    }

                    sbuilder.Append("<td>&nbsp;</td>");

                    sFecha = dr["FIPL"].ToString();
                    if (sFecha != "")
                    {
                        sFecha = DateTime.Parse(dr["FIPL"].ToString()).ToShortDateString();
                    }

                    sbuilder.Append("<td>" + sFecha + "</td>");

                    sFecha = dr["FFPL"].ToString();
                    if (sFecha != "")
                    {
                        sFecha = DateTime.Parse(dr["FFPL"].ToString()).ToShortDateString();
                    }

                    sbuilder.Append("<td>" + sFecha + "</td>");

                    if (dr["ETPR"] != DBNull.Value)
                    {
                        sbuilder.Append("<td style='text-align:right'>" + double.Parse(dr["ETPR"].ToString()).ToString("N") + "</td>");
                    }
                    else
                    {
                        sbuilder.Append("<td style='text-align:right'></td>");
                    }

                    sbuilder.Append("<td>&nbsp;</td>");

                    sFecha = dr["FFPR"].ToString();
                    if (sFecha != "")
                    {
                        sFecha = DateTime.Parse(dr["FFPR"].ToString()).ToShortDateString();
                    }

                    sbuilder.Append("<td>" + sFecha + "</td>");

                    sbuilder.Append("<td style='text-align:right'>" + double.Parse(dr["consumo"].ToString()).ToString("N") + "</td>");

                    //%Avance
                    bAvanceAutomatico = (bool)dr["t332_avanceauto"];
                    if (!bAvanceAutomatico)
                    {
                        fAvance = double.Parse(dr["t332_AVANCE"].ToString());
                    }
                    else
                    {
                        fPrev = double.Parse(dr["ETPR"].ToString());
                        fCons = double.Parse(dr["Consumo"].ToString());
                        if (fPrev == 0)
                        {
                            fAvance = 0;
                        }
                        else
                        {
                            fAvance = (fCons * 100) / fPrev;
                        }
                    }
                    sCad = fAvance.ToString("N");
                    sbuilder.Append("<td style='text-align:right'>" + sCad + "</td></tr>");
                    i++;
                }
                dr.Close();
                dr.Dispose();
            }
            sbuilder.Append("</tbody>");
            sbuilder.Append("</table>");
            strTablaTareas = sbuilder.ToString();
            sResul         = "OK@#@" + strTablaTareas;
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al obtener la relación de tareas.", ex);
        }

        return(sResul);
    }