Upload
thomas-weiss
View
241
Download
0
Embed Size (px)
DESCRIPTION
Busquedas en asp
Citation preview
BUSQUEDAS EN ASP
EN VTNACTITO
COMENTARIAR EL DROP, LABEL33, TEXTBOX7
Y AÑADIR
<asp:Label ID="Label35" runat="server" Text="Ver Todo: " Font-Bold="True" ForeColor="#006400" Font-Size="X-Small" ></asp:Label>
<asp:ImageButton ID="imgBuscarDoC" runat="server" Width="20" Height="18" ImageUrl="~/images/check.jpg" OnClick="imgBuscarDoC_Click"/>
EN VTNRESUMENTAKEOFF
COMENTARIAR EL DROP Y LABELS Y TEXTOBX QUE NO SE USARAN, SOLAMENTE DEJAR LBETAPA Y TEXTETAPA AGREGAR PORSTBACK Y EVENTO Y EL SIGUIENTE LABEL
<asp:Label ID="Label60" runat="server" Text="Ver Todo: " Font-Bold="True" ForeColor="Orange" Font-Size="X-Small" ></asp:Label>
EN VTNCONSULTAXELEMENTO
DEJAR LABEL62 Y TEXTBOX9 Y AÑADIR
<asp:Label ID="Label49" runat="server" Text="Ver Todo: " ForeColor="#006400" Font-Size="X-Small" ></asp:Label>
EN VTNUNTARIOCON
DEJAR LABEL66 Y TEXTBOX12 Y AÑADIR
<asp:Label ID="Label50" runat="server" Text="Ver Todo: " ForeColor="#006400" Font-Size="X-Small" ></asp:Label>
BUSQUEDAS EN .CS
PARA ACTITO
EN TEXTBOX6_TEXTCHANGED
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "abrirActiTO();", true); if (DropDownList7.SelectedIndex == 2) { //try { if (TextBox6.Text.Substring(0, 1) == "0" || TextBox6.Text.Substring(0, 1) == "1" || TextBox6.Text.Substring(0, 1) == "2" || TextBox6.Text.Substring(0, 1) == "3" || TextBox6.Text.Substring(0, 1) == "4" || TextBox6.Text.Substring(0, 1) == "5" || TextBox6.Text.Substring(0, 1) == "6" || TextBox6.Text.Substring(0, 1) == "7" || TextBox6.Text.Substring(0, 1) == "8" || TextBox6.Text.Substring(0, 1) == "9") {
SqlDataAdapter cargarPrimariosC = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=2 and ScoUnitario.Identificador like '%" + TextBox6.Text + "%' order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarPrimariosC.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close();
}
else if (TextBox6.Text.Substring(0, 1) != "0" || TextBox6.Text.Substring(0, 1) != "1" || TextBox6.Text.Substring(0, 1) != "2" || TextBox6.Text.Substring(0, 1) != "3" || TextBox6.Text.Substring(0, 1) != "4" || TextBox6.Text.Substring(0, 1) != "5" || TextBox6.Text.Substring(0, 1) != "6" || TextBox6.Text.Substring(0, 1) != "7" || TextBox6.Text.Substring(0, 1) != "8" || TextBox6.Text.Substring(0, 1) != "9") {
SqlDataAdapter cargarPrimariosD = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=2 and ScoUnitario.Descripcion like '%" + TextBox6.Text + "%' order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarPrimariosD.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close();
} //} //catch (Exception) //{
//}
}
if (DropDownList7.SelectedIndex == 3) { try{ if (TextBox6.Text.Substring(0, 1) == "0" || TextBox6.Text.Substring(0, 1) == "1" || TextBox6.Text.Substring(0, 1) == "2" || TextBox6.Text.Substring(0, 1) == "3" || TextBox6.Text.Substring(0, 1) == "4" || TextBox6.Text.Substring(0, 1) == "5" || TextBox6.Text.Substring(0, 1) == "6" || TextBox6.Text.Substring(0, 1) == "7" || TextBox6.Text.Substring(0, 1) == "8" || TextBox6.Text.Substring(0, 1) == "9") { SqlDataAdapter cargarcomplejosC = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=3 and ScoUnitario.Identificador like '%" + TextBox6.Text + "%' order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarcomplejosC.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close();
}
else if (TextBox6.Text.Substring(0, 1) != "0" || TextBox6.Text.Substring(0, 1) != "1" || TextBox6.Text.Substring(0, 1) != "2" || TextBox6.Text.Substring(0, 1) != "3" || TextBox6.Text.Substring(0, 1) != "4" || TextBox6.Text.Substring(0, 1) != "5" || TextBox6.Text.Substring(0, 1) != "6" || TextBox6.Text.Substring(0, 1) != "7" || TextBox6.Text.Substring(0, 1) != "8" || TextBox6.Text.Substring(0, 1) != "9") { SqlDataAdapter cargarcomplejosD = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=3 and ScoUnitario.Descripcion like '%" + TextBox6.Text + "%' order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarcomplejosD.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close();
}
} catch (Exception) { } }
if (DropUnitario.SelectedIndex == 1) {
try{ if (TextBox6.Text.Substring(0, 1) == "0" || TextBox6.Text.Substring(0, 1) == "1" || TextBox6.Text.Substring(0, 1) == "2" || TextBox6.Text.Substring(0, 1) == "3" || TextBox6.Text.Substring(0, 1) == "4" || TextBox6.Text.Substring(0, 1) == "5" || TextBox6.Text.Substring(0, 1) == "6" || TextBox6.Text.Substring(0, 1) == "7" || TextBox6.Text.Substring(0, 1) == "8" || TextBox6.Text.Substring(0, 1) == "9") { SqlDataAdapter cargarMaterialesC = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Materiales' and ScoUnitario.Identificador like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarMaterialesC.Fill(cargar);
conn.Open();
this.GridViewelementodetalle.DataSourceID = null;
this.GridViewelementodetalle.DataSource = cargar;
this.GridViewelementodetalle.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewelementodetalle.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
else if (TextBox6.Text.Substring(0, 1) != "0" || TextBox6.Text.Substring(0, 1) != "1" || TextBox6.Text.Substring(0, 1) != "2" || TextBox6.Text.Substring(0, 1) != "3" || TextBox6.Text.Substring(0, 1) != "4" || TextBox6.Text.Substring(0, 1) != "5" || TextBox6.Text.Substring(0, 1)
!= "6" || TextBox6.Text.Substring(0, 1) != "7" || TextBox6.Text.Substring(0, 1) != "8" || TextBox6.Text.Substring(0, 1) != "9") { SqlDataAdapter cargarMaterialesD = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Materiales' and ScoUnitario.Descripcion like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarMaterialesD.Fill(cargar);
conn.Open();
this.GridViewelementodetalle.DataSourceID = null;
this.GridViewelementodetalle.DataSource = cargar;
this.GridViewelementodetalle.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewelementodetalle.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
} catch (Exception) { } }
if (DropUnitario.SelectedIndex == 2) { try { if (TextBox6.Text.Substring(0, 1) == "0" || TextBox6.Text.Substring(0, 1) == "1" || TextBox6.Text.Substring(0, 1) == "2" || TextBox6.Text.Substring(0, 1) == "3" || TextBox6.Text.Substring(0, 1) == "4" || TextBox6.Text.Substring(0, 1) == "5" || TextBox6.Text.Substring(0, 1) == "6" || TextBox6.Text.Substring(0, 1) == "7" || TextBox6.Text.Substring(0, 1) == "8" || TextBox6.Text.Substring(0, 1) == "9") {
SqlDataAdapter cargarManodeObraC = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Mano de Obra' and ScoUnitario.Identificador like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarManodeObraC.Fill(cargar);
conn.Open(); this.GridViewDetalle2.DataSourceID = null; this.GridViewDetalle2.DataSource = cargar; this.GridViewDetalle2.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle2.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
else if (TextBox6.Text.Substring(0, 1) != "0" || TextBox6.Text.Substring(0, 1) != "1" || TextBox6.Text.Substring(0, 1) != "2" || TextBox6.Text.Substring(0, 1) != "3" || TextBox6.Text.Substring(0, 1) != "4" || TextBox6.Text.Substring(0, 1) != "5" || TextBox6.Text.Substring(0, 1) != "6" || TextBox6.Text.Substring(0, 1) != "7" || TextBox6.Text.Substring(0, 1) != "8" || TextBox6.Text.Substring(0, 1) != "9") { SqlDataAdapter cargarManodeObraD = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Mano de Obra' and ScoUnitario.Descripcion like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarManodeObraD.Fill(cargar);
conn.Open(); this.GridViewDetalle2.DataSourceID = null; this.GridViewDetalle2.DataSource = cargar; this.GridViewDetalle2.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle2.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} } } catch (Exception) { } }
if (DropUnitario.SelectedIndex == 3) { try{
if (TextBox6.Text.Substring(0, 1) == "0" || TextBox6.Text.Substring(0, 1) == "1" || TextBox6.Text.Substring(0, 1) == "2" || TextBox6.Text.Substring(0, 1) == "3" || TextBox6.Text.Substring(0, 1) == "4" || TextBox6.Text.Substring(0, 1) == "5" || TextBox6.Text.Substring(0, 1) == "6" || TextBox6.Text.Substring(0, 1) == "7" || TextBox6.Text.Substring(0, 1) == "8" || TextBox6.Text.Substring(0, 1) == "9") { SqlDataAdapter cargarEquiposC = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Equipos' and ScoUnitario.Identificador like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarEquiposC.Fill(cargar);
conn.Open(); this.GridViewDetalle3.DataSourceID = null; this.GridViewDetalle3.DataSource = cargar; this.GridViewDetalle3.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle3.Rows) {
row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
else if (TextBox6.Text.Substring(0, 1) != "0" || TextBox6.Text.Substring(0, 1) != "1" || TextBox6.Text.Substring(0, 1) != "2" || TextBox6.Text.Substring(0, 1) != "3" || TextBox6.Text.Substring(0, 1) != "4" || TextBox6.Text.Substring(0, 1) != "5" || TextBox6.Text.Substring(0, 1) != "6" || TextBox6.Text.Substring(0, 1) != "7" || TextBox6.Text.Substring(0, 1) != "8" || TextBox6.Text.Substring(0, 1) != "9") { SqlDataAdapter cargarEquiposD = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Equipos' and ScoUnitario.Descripcion like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarEquiposD.Fill(cargar);
conn.Open(); this.GridViewDetalle3.DataSourceID = null; this.GridViewDetalle3.DataSource = cargar; this.GridViewDetalle3.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle3.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
} catch (Exception) { } }
if (DropUnitario.SelectedIndex == 4) { try { if (TextBox6.Text.Substring(0, 1) == "0" || TextBox6.Text.Substring(0, 1) == "1" || TextBox6.Text.Substring(0, 1) == "2" || TextBox6.Text.Substring(0, 1) == "3" || TextBox6.Text.Substring(0, 1) ==
"4" || TextBox6.Text.Substring(0, 1) == "5" || TextBox6.Text.Substring(0, 1) == "6" || TextBox6.Text.Substring(0, 1) == "7" || TextBox6.Text.Substring(0, 1) == "8" || TextBox6.Text.Substring(0, 1) == "9") { SqlDataAdapter cargarSubContratoC = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Sub Contratos' and ScoUnitario.Identificador like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarSubContratoC.Fill(cargar);
conn.Open(); this.GridViewDetalle4.DataSourceID = null; this.GridViewDetalle4.DataSource = cargar; this.GridViewDetalle4.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle4.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
}
}
else if (TextBox6.Text.Substring(0, 1) != "0" || TextBox6.Text.Substring(0, 1) != "1" || TextBox6.Text.Substring(0, 1) != "2" || TextBox6.Text.Substring(0, 1) != "3" || TextBox6.Text.Substring(0, 1) != "4" || TextBox6.Text.Substring(0, 1) != "5" || TextBox6.Text.Substring(0, 1) != "6" || TextBox6.Text.Substring(0, 1) != "7" || TextBox6.Text.Substring(0, 1) != "8" || TextBox6.Text.Substring(0, 1) != "9") { SqlDataAdapter cargarSubContratoD = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Sub Contratos' and
ScoUnitario.Descripcion like '%" + TextBox6.Text + "%' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarSubContratoD.Fill(cargar);
conn.Open(); this.GridViewDetalle4.DataSourceID = null; this.GridViewDetalle4.DataSource = cargar; this.GridViewDetalle4.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle4.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
} catch (Exception) { } }
EN IMGBUSCARDOC_CLICK
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "abrirActiTO();", true);
if (DropDownList7.SelectedIndex == 1) { this.TextBox6.Text = ""; SqlDataAdapter cargarElementoT = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round (ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=1 order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarElementoT.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close(); }
if (DropDownList7.SelectedIndex == 2) { this.TextBox6.Text = "";
SqlDataAdapter cargarPrimariosT = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round (ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=2 order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarPrimariosT.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close();
}
if (DropDownList7.SelectedIndex == 3) { this.TextBox6.Text = "";
SqlDataAdapter cargarcomplejosT = new SqlDataAdapter("select ScoUnitario.Identificador,ScoUnitario.Descripcion,ScoUnidadMedida.UM as UM, round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID and ScoTipoUnitario_ID=3 order by ScoUnitario.Identificador", conn);
DataTable cargar = new DataTable();
cargarcomplejosT.Fill(cargar);
conn.Open();
this.GridViewActividadComplejoPrimario.DataSourceID = null;
this.GridViewActividadComplejoPrimario.DataSource = cargar;
this.GridViewActividadComplejoPrimario.DataBind();
conn.Close(); }
if (DropUnitario.SelectedIndex == 1) { SqlDataAdapter cargarMaterialesT = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Materiales' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarMaterialesT.Fill(cargar);
conn.Open(); this.GridViewelementodetalle.DataSourceID = null; this.GridViewelementodetalle.DataSource = cargar; this.GridViewelementodetalle.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewelementodetalle.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
}
}
if (DropUnitario.SelectedIndex == 2)
{ SqlDataAdapter cargarMateriales = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Mano de Obra' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarMateriales.Fill(cargar);
conn.Open(); this.GridViewDetalle2.DataSourceID = null; this.GridViewDetalle2.DataSource = cargar; this.GridViewDetalle2.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle2.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
}
}
if (DropUnitario.SelectedIndex == 3) { SqlDataAdapter cargarMateriales = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Equipos' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarMateriales.Fill(cargar);
conn.Open();
this.GridViewDetalle3.DataSourceID = null; this.GridViewDetalle3.DataSource = cargar; this.GridViewDetalle3.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle3.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
}
}
if (DropUnitario.SelectedIndex == 4) { SqlDataAdapter cargarMateriales = new SqlDataAdapter("select ScoTipoElemento.Identificador, ScoTipoElemento.Descripcion as Tipo, ScoUnitario.Identificador as Elemento, ScoUnitario.Descripcion as Descripción, ScoUnidadMedida.UM as UM,round(ScoUnitario.PrecioReferencia,2) as Precio from ScoUnitario inner join ScoTipoElemento on ScoTipoElemento.ScoTipoElemento_ID=ScoUnitario.ScoTipoElemento_ID inner join vScoTipoElementos on ScoUnitario.ScoTipoElemento_ID = vScoTipoElementos.TipoElemento3 inner join ScoUnidadMedida on ScoUnitario.ScoUnidadMedida_ID = ScoUnidadMedida.ScoUnidadMedida_ID where ScoUnitario.ScoTipoUnitario_ID = 1 and DescripcionPadre='Sub Contratos' order by ScoTipoElemento.Identificador", conn);
DataTable cargar = new DataTable();
cargarMateriales.Fill(cargar);
conn.Open(); this.GridViewDetalle4.DataSourceID = null; this.GridViewDetalle4.DataSource = cargar; this.GridViewDetalle4.DataBind(); conn.Close();
foreach (GridViewRow row2 in this.GridViewDetalle4.Rows) { row2.Cells[1].BackColor = Color.FromName("#F2F5A9"); row2.Cells[2].BackColor = Color.FromName("#F2F5A9");
} }
EN DROPDOWNLIST7 Y EN DROPUNITARIO REEMPLAZAR Y CORREGIR LAS VALIDACIONES.
EN RESUMEN
EN TEXTBOX6_TEXTCHANGED
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "AResumenTakeOff();", true);
SqlDataAdapter cargagrid = new SqlDataAdapter("select distinct vScoTakeOffTipico.Etapa, vScoTakeOffTipico.Subetapa, ScoEtapa.Descripcion as DescripcionEtapa, ScoSubEtapa.Descripcion as DescripcionSubEtapa, vScoTakeOffTipico.UmSubetapa as UM, ScoTakeOffResumenTipico.Cantidad from vScoTakeOffTipico inner join ScoTakeOffTipico on ScoTakeOffTipico.ScoTakeOffTipico_ID= vScoTakeOffTipico.ScoTakeOffTipico_ID and ScoTakeOffTipico.ScoUnitario_ID= vScoTakeOffTipico.ScoUnitario_ID inner join ScoTakeOffResumenTipico on ScoTakeOffResumenTipico.ScoProyectoTipico_ID= ScoTakeOffTipico.ScoProyectoTipico_ID inner join ScoObraEtapaSubEtapa on ScoObraEtapaSubEtapa.ScoObraEtapaSubEtapa_ID= ScoTakeOffTipico.ScoObraEtapaSubEtapa_ID inner join ScoObraEtapa on ScoObraEtapa.ScoObraEtapa_ID= ScoObraEtapaSubEtapa.ScoObraEtapa_ID inner join ScoEtapa on ScoEtapa.ScoEtapa_ID= ScoObraEtapa.ScoEtapa_ID inner join ScoSubEtapa on ScoObraEtapaSubEtapa.ScoSubEtapa_ID= ScoSubEtapa.ScoSubEtapa_ID inner join ScoProyectoTipico on ScoProyectoTipico.ScoProyectoTipico_ID= ScoTakeOffTipico.ScoProyectoTipico_ID and ScoProyectoTipico.ScoProyectoTipico_ID= '" + this.HiddenFieldidtipico.Value + "' and ScoEtapa.Descripcion like '%" + TextEtapa.Text + "%' group by vScoTakeOffTipico.Etapa, vScoTakeOffTipico.Subetapa, ScoEtapa.Descripcion, ScoSubEtapa.Descripcion , vScoTakeOffTipico.UmSubetapa , ScoTakeOffResumenTipico.Cantidad union select distinct vScoTakeOffTipico.Etapa, vScoTakeOffTipico.Subetapa, ScoEtapa.Descripcion as DescripcionEtapa, ScoSubEtapa.Descripcion as DescripcionSubEtapa, vScoTakeOffTipico.UmSubetapa as UM, ScoTakeOffResumenTipico.Cantidad from vScoTakeOffTipico inner join ScoTakeOffTipico on ScoTakeOffTipico.ScoTakeOffTipico_ID= vScoTakeOffTipico.ScoTakeOffTipico_ID and ScoTakeOffTipico.ScoUnitario_ID= vScoTakeOffTipico.ScoUnitario_ID inner join ScoTakeOffResumenTipico on ScoTakeOffResumenTipico.ScoProyectoTipico_ID= ScoTakeOffTipico.ScoProyectoTipico_ID inner join ScoObraEtapaSubEtapa on ScoObraEtapaSubEtapa.ScoObraEtapaSubEtapa_ID= ScoTakeOffTipico.ScoObraEtapaSubEtapa_ID inner join ScoObraEtapa on ScoObraEtapa.ScoObraEtapa_ID= ScoObraEtapaSubEtapa.ScoObraEtapa_ID inner join ScoEtapa on ScoEtapa.ScoEtapa_ID= ScoObraEtapa.ScoEtapa_ID inner join ScoSubEtapa on ScoObraEtapaSubEtapa.ScoSubEtapa_ID= ScoSubEtapa.ScoSubEtapa_ID inner join ScoProyectoTipico on ScoProyectoTipico.ScoProyectoTipico_ID= ScoTakeOffTipico.ScoProyectoTipico_ID and ScoProyectoTipico.ScoProyectoTipico_ID= '" + this.HiddenFieldidtipico.Value + "' and ScoSubEtapa.Descripcion like '%" + TextEtapa.Text + "%' order by Etapa", conn);
DataTable cargar2 = new DataTable();
cargagrid.Fill(cargar2);
conn.Open();
this.GridViewResumen.DataSourceID = null; this.GridViewResumen.DataSource = cargar2;
this.GridViewResumen.DataBind();
EN IMGBUSQUEDARESUMEN_CLICK
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "AResumenTakeOff();", true);
SqlDataAdapter cargagrid = new SqlDataAdapter(" select distinct vScoTakeOffTipico.Etapa, vScoTakeOffTipico.Subetapa, ScoEtapa.Descripcion as DescripcionEtapa, ScoSubEtapa.Descripcion as DescripcionSubEtapa, vScoTakeOffTipico.UmSubetapa as UM, ScoTakeOffResumenTipico.Cantidad from vScoTakeOffTipico inner join ScoTakeOffTipico on ScoTakeOffTipico.ScoTakeOffTipico_ID= vScoTakeOffTipico.ScoTakeOffTipico_ID and ScoTakeOffTipico.ScoUnitario_ID= vScoTakeOffTipico.ScoUnitario_ID inner join ScoTakeOffResumenTipico on ScoTakeOffResumenTipico.ScoProyectoTipico_ID= ScoTakeOffTipico.ScoProyectoTipico_ID inner join ScoObraEtapaSubEtapa on ScoObraEtapaSubEtapa.ScoObraEtapaSubEtapa_ID= ScoTakeOffTipico.ScoObraEtapaSubEtapa_ID inner join ScoObraEtapa on ScoObraEtapa.ScoObraEtapa_ID= ScoObraEtapaSubEtapa.ScoObraEtapa_ID inner join ScoEtapa on ScoEtapa.ScoEtapa_ID= ScoObraEtapa.ScoEtapa_ID inner join ScoSubEtapa on ScoObraEtapaSubEtapa.ScoSubEtapa_ID= ScoSubEtapa.ScoSubEtapa_ID inner join ScoProyectoTipico on ScoProyectoTipico.ScoProyectoTipico_ID= ScoTakeOffTipico.ScoProyectoTipico_ID and ScoProyectoTipico.ScoProyectoTipico_ID= '" + this.HiddenFieldidtipico.Value + "' order by Etapa", conn);
DataTable cargar2 = new DataTable();
cargagrid.Fill(cargar2);
conn.Open();
this.GridViewResumen.DataSourceID = null; this.GridViewResumen.DataSource = cargar2; this.GridViewResumen.DataBind();
this.TextEtapa.Text = "";
EN VTNCONSULTAXELEMENTO
EN TEXTBOX9_TEXTCHANGED
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "abrirCxele();", true); int indice2 = Convert.ToInt32(Session["indice2"]); int indice4 = Convert.ToInt32(Session["indice4"]);
if (StateAgregar.Value == "1") { if (TextBox9.Text.Substring(0, 1) == "9" || TextBox9.Text.Substring(0, 1) == "0")
{ if (GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text.Substring(0, 1) == "9") {
GridViewUn.Columns[0].Visible = false; SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos' and vScoDetallePrimarios.Identificador like
'%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnP;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) { row2.Cells[1].ForeColor = Color.Blue; }
} else if (GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text.Substring(0, 1) == "0") { GridViewUn.Columns[0].Visible = true; //Message("Funciona Parte Dos");
SqlDataAdapter UnitComplejo = new SqlDataAdapter("select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" +
GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Unitario Primario') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Unitario Primario' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle", conn); DataTable UnC = new DataTable();
UnitComplejo.Fill(UnC);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnC;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
} }
if (TextBox9.Text.Substring(0, 1) != "9" || TextBox9.Text.Substring(0, 1) != "0") { //Message("" + CodigoActividad.Value); if (GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text.Substring(0, 1) == "9") {
GridViewUn.Columns[0].Visible = false; SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from
vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnP;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) { row2.Cells[1].ForeColor = Color.Blue; }
} else if (GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text.Substring(0, 1) == "0") { GridViewUn.Columns[0].Visible = true; //Message("Funciona Parte Dos");
SqlDataAdapter UnitComplejo = new SqlDataAdapter("select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, AnuladoDetalle as Anulado from
vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Unitario Primario') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Unitario Primario' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle", conn);
DataTable UnC = new DataTable();
UnitComplejo.Fill(UnC);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnC;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
} } }
if (StateConsultar.Value == "1" || StateModificar.Value == "1") {
//Message(StateAgregar.Value + "--" + StateConsultar.Value + "--" + StateModificar.Value); if (TextBox9.Text.Substring(0, 1) == "0" || TextBox9.Text.Substring(0, 1) == "1" || TextBox9.Text.Substring(0, 1) == "2" || TextBox9.Text.Substring(0, 1) == "3" || TextBox9.Text.Substring(0, 1) == "4" || TextBox9.Text.Substring(0, 1) == "5" || TextBox9.Text.Substring(0, 1) == "6" || TextBox9.Text.Substring(0, 1) == "7" || TextBox9.Text.Substring(0, 1) == "8" || TextBox9.Text.Substring(0, 1) == "9") { // if (CodigoActividad.Value.Substring(0, 1) == "9") {
// Message("" + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1) + TextBox9.Text.Substring(0, 1)+ TextBox9.Text.Substring(0, 1) ); GridViewUn.Columns[0].Visible = false; SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios
where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos' and vScoDetallePrimarios.Identificador like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnP;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows)
{ row2.Cells[1].ForeColor = Color.Blue; }
} else if (CodigoActividad.Value.Substring(0, 1) == "0") { //GridViewUn.Columns[0].Visible = true; //Message("Funciona Parte Dos");
SqlDataAdapter UnitComplejo = new SqlDataAdapter("select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where
IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Unitario Primario') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Unitario Primario' and vScoDetalleComplejos.Identificador like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle", conn); DataTable UnC = new DataTable();
UnitComplejo.Fill(UnC);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnC;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
} }
else if (TextBox9.Text.Substring(0, 1) != "0" || TextBox9.Text.Substring(0, 1) != "1" || TextBox9.Text.Substring(0, 1) != "2" || TextBox9.Text.Substring(0, 1) != "3" || TextBox9.Text.Substring(0, 1) != "4" || TextBox9.Text.Substring(0, 1) != "5" || TextBox9.Text.Substring(0, 1) != "6" || TextBox9.Text.Substring(0, 1) != "7" || TextBox9.Text.Substring(0, 1) != "8" || TextBox9.Text.Substring(0, 1) != "9") { if (CodigoActividad.Value.Substring(0, 1) == "9") {
GridViewUn.Columns[0].Visible = false; SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion,
UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnP;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) { row2.Cells[1].ForeColor = Color.Blue; }
} else if (CodigoActividad.Value.Substring(0, 1) == "0") { GridViewUn.Columns[0].Visible = true; //Message("Funciona Parte Dos");
SqlDataAdapter UnitComplejo = new SqlDataAdapter("select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos') as
TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Unitario Primario') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Unitario Primario' and DescripcionDetalleUnitario like '%" + TextBox9.Text + "%' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle", conn); DataTable UnC = new DataTable();
UnitComplejo.Fill(UnC);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnC;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
} } }
EN IMGBCONSULTA_CLICK
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "abrirCxele();", true); int indice2 = Convert.ToInt32(Session["indice2"]); int indice4 = Convert.ToInt32(Session["indice4"]); // Message("" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text);
if (StateAgregar.Value == "1") {
//int indice4 = Convert.ToInt32(Session["indice4"]); //Message("" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + CodigoActividad.Value); TextBox9.Text = "";
if (GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text.Substring(0, 1) == "9") {
GridViewUn.Columns[0].Visible = false; SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje,
(select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnP;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) { row2.Cells[1].ForeColor = Color.Blue; }
} else if (GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text.Substring(0, 1) == "0") { GridViewUn.Columns[0].Visible = true; //Message("Funciona Parte Dos");
SqlDataAdapter UnitComplejo = new SqlDataAdapter("select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Equipos' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM,
Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Mano de Obra' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Materiales' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Sub Contratos' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Unitario Primario') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + GridViewActividadComplejoPrimario.Rows[indice4].Cells[1].Text + "' and DescripcionPadre='Unitario Primario' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle", conn); DataTable UnC = new DataTable();
UnitComplejo.Fill(UnC);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnC;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
} }
if (StateConsultar.Value == "1" || StateModificar.Value == "1") {
TextBox9.Text = "";
if (CodigoActividad.Value.Substring(0, 1) == "9") {
GridViewUn.Columns[0].Visible = false; SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value
+ "' and DescripcionPadre='Materiales' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnP;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) { row2.Cells[1].ForeColor = Color.Blue; }
} else if (CodigoActividad.Value.Substring(0, 1) == "0") { GridViewUn.Columns[0].Visible = true; //Message("Funciona Parte Dos");
SqlDataAdapter UnitComplejo = new SqlDataAdapter("select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Equipos' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct
vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Mano de Obra' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Materiales' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Sub Contratos' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle union select distinct vScoDetalleComplejos.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioDetalle as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Unitario Primario') as TotalGrupo, AnuladoDetalle as Anulado from vScoDetalleComplejos where IdentificadorComplejo= '" + CodigoActividad.Value + "' and DescripcionPadre='Unitario Primario' group by vScoDetalleComplejos.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioDetalle, Total, AnuladoDetalle", conn); DataTable UnC = new DataTable();
UnitComplejo.Fill(UnC);
conn.Open();
this.GridViewUn.DataSourceID = null;
this.GridViewUn.DataSource = UnC;
this.GridViewUn.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUn.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
} }
REVISAR Y CORREGIR VALIDACIONES
EN VTNUNTARIOCON
EN TEXTBOX12_TEXTCHANGED
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "abrirUnitC();", true); int indice3 = Convert.ToInt32(Session["indice3"]); if (TextBox12.Text.Substring(0, 1) == "0" || TextBox12.Text.Substring(0, 1) == "1" || TextBox12.Text.Substring(0, 1) == "2" || TextBox12.Text.Substring(0, 1) == "3" || TextBox12.Text.Substring(0, 1) == "4" || TextBox12.Text.Substring(0, 1) == "5" || TextBox12.Text.Substring(0, 1) == "6" || TextBox12.Text.Substring(0, 1) == "7" || TextBox12.Text.Substring(0, 1) == "8" || TextBox12.Text.Substring(0, 1) == "9") { SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Equipos' and Identificador like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" +
GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Mano de Obra' and Identificador like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Materiales' and Identificador like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Sub Contratos' and Identificador like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);//
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUnitarioP.DataSourceID = null;
this.GridViewUnitarioP.DataSource = UnP;
this.GridViewUnitarioP.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUnitarioP.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
}
else if (TextBox12.Text.Substring(0, 1) != "0" || TextBox12.Text.Substring(0, 1) != "1" || TextBox12.Text.Substring(0, 1) != "2" || TextBox12.Text.Substring(0, 1) != "3" || TextBox12.Text.Substring(0,
1) != "4" || TextBox12.Text.Substring(0, 1) != "5" || TextBox12.Text.Substring(0, 1) != "6" || TextBox12.Text.Substring(0, 1) != "7" || TextBox12.Text.Substring(0, 1) != "8" || TextBox12.Text.Substring(0, 1) != "9") {
SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Equipos' and DescripcionDetalleUnitario like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Mano de Obra' and DescripcionDetalleUnitario like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Materiales' and DescripcionDetalleUnitario like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Sub Contratos' and DescripcionDetalleUnitario like '%" + TextBox12.Text + "%' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);//
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUnitarioP.DataSourceID = null;
this.GridViewUnitarioP.DataSource = UnP;
this.GridViewUnitarioP.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUnitarioP.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}
}
IMAGEBUTTON5_CLICK
ClientScript.RegisterStartupScript(this.GetType(), "myScript", "abrirUnitC();", true); int indice3 = Convert.ToInt32(Session["indice3"]); SqlDataAdapter UnitPrimario = new SqlDataAdapter("select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Equipos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Equipos' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Mano de Obra') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Mano de Obra' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario,
Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Materiales') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Materiales' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado union select distinct vScoDetallePrimarios.DescripcionPadre as Grupo, Identificador as Codigo, DescripcionDetalleUnitario as Descripcion, UnidadMedidaDetalle as UM, Cantidad, PrecioReferencia as CostoUnitario, Total, Round ((Total / '" + TextBPrecio.Text + "') * 100, 2) as Porcentaje, (select cast(sum(Total) as char) as total from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Sub Contratos') as TotalGrupo, Anulado from vScoDetallePrimarios where IdentificadorPrimario= '" + GridViewUn.Rows[indice3].Cells[2].Text + "' and DescripcionPadre='Sub Contratos' group by vScoDetallePrimarios.DescripcionPadre, Identificador, DescripcionDetalleUnitario, UnidadMedidaDetalle, Cantidad, PrecioReferencia, Total, Anulado", conn);//
DataTable UnP = new DataTable();
UnitPrimario.Fill(UnP);
conn.Open();
this.GridViewUnitarioP.DataSourceID = null;
this.GridViewUnitarioP.DataSource = UnP;
this.GridViewUnitarioP.DataBind();
conn.Close();
foreach (GridViewRow row2 in this.GridViewUnitarioP.Rows) {
row2.Cells[1].ForeColor = Color.Blue;
}