protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["A"] == null) { string id_archivo = Request.QueryString["AR"]; string file_name = EncontrarArchivo(id_archivo); string ruta = ConfigurationManager.AppSettings["RUTA"]; if (file_name.Contains(".pdf")) { TheDownload2(ruta + id_archivo + ".pdf", ruta, file_name); } else if (file_name.Contains(".jpg")) { TheDownload3(ruta + id_archivo + ".jpg", ruta, file_name); } } else { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string nom_factura = encriptador.DecryptData(Request.QueryString["Ar"].ToString().Replace(" ", "+").Trim()); string año_factura = encriptador.DecryptData(Request.QueryString["A"].ToString().Replace(" ", "+").Trim()); nom_factura = año_factura + "_" + "33_" + nom_factura; string ruta = ConfigurationManager.AppSettings["RUTA2"] + año_factura + ConfigurationManager.AppSettings["RUTA3"]; TheDownload2(ruta + nom_factura.Trim() + ".pdf", ruta, nom_factura.Trim()); } }
protected void G_PRODUCTOS_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[0].Text = cont_det.ToString(); cont_det++; G_PRODUCTOS.HeaderRow.Cells[0].Attributes["data-sort-method"] = "number"; G_PRODUCTOS.HeaderRow.Cells[1].Attributes["data-sort-method"] = "number"; G_PRODUCTOS.HeaderRow.Cells[0].Attributes["class"] = "sort-default"; e.Row.Cells[2].Visible = false; G_PRODUCTOS.HeaderRow.Cells[2].Visible = false; e.Row.Cells[1].Text = Double.Parse(e.Row.Cells[1].Text).ToString("N0"); string rutcliente = G_PRODUCTOS.DataKeys[e.Row.RowIndex].Values[0].ToString(); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( string script = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}');return false;", encriptador.EncryptData(PERIODOS), encriptador.EncryptData(""), encriptador.EncryptData(rutcliente), encriptador.EncryptData("5")); e.Row.Cells[3].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[3].Text + " </a>"; } }
//private void carga_doc_abiertos(string clie_rut) //{ // DataTable cr = ReporteRNegocio.corr_usuario(User.Identity.Name); // foreach (DataRow r in cr.Rows) // { // tx_enviar_.Text = r[1].ToString(); // } // titulo.InnerText = "Documentos Abiertos del cliente " + ReporteRNegocio.nombre_cliente(clie_rut.Replace(".", "").Replace("-", "")); // CLIENTES_FICHA.ActiveViewIndex = 2; // busca_columna_fac = true; // g_doc.DataSource = ReporteRNegocio.docu_abier(clie_rut.Replace(".", "").Replace("-", "")); // g_doc.DataBind(); //} protected void g_doc_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (busca_columna_fac) { try { for (int x = 0; x <= G_INFORME_TOTAL_NC.HeaderRow.Cells.Count; x++) { if (G_INFORME_TOTAL_NC.HeaderRow.Cells[x].Text.Contains("Factura")) { columna_fac = true; COLUMNA_DE_FACTURA = x; busca_columna_fac = false; break; } } } catch { } } if (columna_fac) { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string año_factura = e.Row.Cells[6].Text.Substring(6); if (año_factura != "") { año_factura = año_factura.Substring(0, 4); string script = string.Format("javascript:fuera3('{0}', '{1}');return false;", encriptador.EncryptData(e.Row.Cells[COLUMNA_DE_FACTURA].Text), encriptador.EncryptData(año_factura)); e.Row.Cells[COLUMNA_DE_FACTURA].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[COLUMNA_DE_FACTURA].Text + " </a>"; //string script2 = string.Format("javascript:fuera3('{0}', '{1}');return false;", encriptador.EncryptData(e.Row.Cells[COLUMNA_DE_FACTURA + 5].Text), encriptador.EncryptData(año_factura)); //e.Row.Cells[COLUMNA_DE_FACTURA + 5].Text = " <a href='javascript:' onclick='" + script2 + "'>" + e.Row.Cells[COLUMNA_DE_FACTURA + 5].Text + " </a>"; } } } try { string valor = e.Row.Cells[0].Text; string rut_ini = valor.Trim().Substring(0, valor.Trim().Length - 1); double rut = 0; try { rut = double.Parse(rut_ini); valor = rut.ToString("N0") + "-" + valor.Trim().Substring(valor.Trim().Length - 1); } catch { rut = double.Parse(valor); valor = rut.ToString("N0"); } e.Row.Cells[0].Text = valor; double d; double.TryParse(e.Row.Cells[5].Text, out d); string aux = ""; if (d == 0) { aux = ""; } else { aux = d.ToString("N0"); } e.Row.Cells[5].Text = aux; } catch { } }
protected void guarda_Click(object sender, EventArgs e) { string es_su_pass = ReporteRNegocio.es_su_pass(USER); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(pass_antigua.Value.ToUpper()); if (es_su_pass != contrasena) { mensaje_pass.Text = "Contraseña actual errónea, reingrese"; } else { usuarioEntity us = new usuarioEntity(); us.cod_usuario = USER.ToUpper(); usuarioBO.encontrar(ref us); clsCrypto.CL_Crypto encriptador2 = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena2 = encriptador2.EncryptData(pass_nueva.Value.ToUpper()); us.clave = contrasena2; us.activado = "true"; us.tipo_usuario = ReporteRNegocio.es_su_tipo(USER); if (usuarioBO.actualizar(us, USER) == "OK") { mensaje_pass.Text = "Contraseña cambiada ! "; } } }
protected void G_Banco_DataBound(object sender, GridViewRowEventArgs e) { // aca if (e.Row.RowType == DataControlRowType.DataRow) { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string id_categoria = G_Banco.DataKeys[e.Row.RowIndex].Values[0].ToString(); string script = string.Format("javascript:abremodal_('{0}','{1}');return false;", id_categoria, e.Row.Cells[3].Text); e.Row.Cells[3].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[3].Text + " </a>"; } }
/// <summary> /// Retorna o conteudo da pagina a partir de uma URL /// </summary> /// <param name="url">URL da pagina. Ex: http://www.microsoft.com.br</param> /// <returns>Texto da pagina</returns> //private string RetornaDocumentText(string url) //{ // HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url); // WebResponse webResponse = httpWebRequest.GetResponse(); // StreamReader streamReader = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8); // return streamReader.ReadToEnd(); //} protected void validar() { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(T_Pass.Text.ToUpper()); //string contrasena3 = encriptador.EncryptData("zsAy0X+UdTDpaKDwPiz/BA=="); //string total = Base.monto_format2(Math.Round(1603500.250, MidpointRounding.AwayFromZero)); string cont2rasena = encriptador.DecryptData("bkJ47VUtVQ/L0SBDQMWicA=="); string cont3rasena = encriptador.DecryptData("fL3tK39Qb3P4loe20QkmHasFJjMLt1oZ"); // GT015 ANTONIA2106 // CG032 ITALIA90 //string documentText = RetornaDocumentText("htt"); ////MessageBox.Show(s_unicode2); usuarioEntity u = new usuarioEntity(); u.cod_usuario = T_User.Text; u.clave = contrasena; string respuesta = usuarioBO.validar(ref u); //string usuario_1_2 = ReporteRNegocio.test_arica(); //ScriptManager.RegisterStartupScript(Page, this.GetType(), "test", "<script language='javascript'>alert('"+ usuario_1_2 + "');</script>", false); if (respuesta == "OK") { if (u.activado != "False") { string login = T_User.Text; Session["user"] = T_User.Text; Session["contraseña"] = contrasena; Session["usuario"] = u; FormsAuthentication.RedirectFromLoginPage(login, false); Response.Redirect("Menu.aspx"); } else { L_Sesion.Text = "Usuario desactivado, vuelva a ingresar."; T_User.Focus(); } } else { L_Sesion.Text = "Usuario y/o Clave inválidos, vuelva a ingresar."; T_User.Focus(); } }
public string crear_reporte_correo2(DataTable total_dias, DataTable total_periodos, DataTable periodos) { DataView view = new DataView(total_periodos); DataTable productos = view.ToTable(true, "descproducto"); DataView dv3 = productos.DefaultView; dv3.Sort = "descproducto"; productos = dv3.ToTable(); List <string> dias = new List <string>(); dias.Add(DateTime.Now.ToShortDateString().Replace("-", "/")); DateTime hasta_ = Convert.ToDateTime(DateTime.Now.ToShortDateString(), new CultureInfo("es-ES")); string ayer = hasta_.AddDays(-1).ToShortDateString().Replace("-", "/"); dias.Add(ayer); DateTime hasta_2 = Convert.ToDateTime(DateTime.Now.ToShortDateString(), new CultureInfo("es-ES")); string ante_ayer = hasta_2.AddDays(-2).ToShortDateString().Replace("-", "/"); dias.Add(ante_ayer); //HTML_EXCEL string HTML_EXCEL = ""; string color_letra_excel = "white"; string color_fondo_excel = "#428BCA"; string HTML = ""; HTML += "<table id='TABLA_REPORTE' class='table table-advance table-bordered fill-head tablesorter filtrar' style='width: 98%; border-collapse: collapse; border-spacing: 1px !important;' width:98%;>"; HTML += "<thead>"; HTML += "<tr>"; HTML_EXCEL += "<table id='T_EXCEL1' border=1>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; bool primer = true; HTML += "<th colspan=1; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48); border-bottom: 2px solid rgb(50, 48, 48);' ></th>"; HTML += "<th colspan=3; class='test2 sorter-false' style='border-right: 2px solid rgb(50, 48, 48); border-bottom: 2px solid rgb(50, 48, 48);' >3 Dias</th>"; HTML += "<th colspan=" + 3 * periodos.Rows.Count + 1 + "; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48); border-bottom: 2px solid rgb(50, 48, 48);' >Periodos</th>"; HTML += "</tr>"; HTML += "<tr>"; HTML_EXCEL += "<td></td>"; HTML_EXCEL += "<td colspan=3>3 Dias</td>"; HTML_EXCEL += "<td colspan=" + 3 * periodos.Rows.Count + 1 + ">Periodos</td>"; HTML_EXCEL += "</tr>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; int con = 0; while (con < 3) { if (primer) { HTML += "<th colspan=1; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' ><b><p class='text-left'>DescProducto </p></b></th>"; HTML_EXCEL += "<td>DescProducto</td>"; primer = false; } DataRow[] venta = total_dias.Select("'" + dias[con] + "' = fechafactura"); double suma = 0; if (venta.Length > 0) { foreach (DataRow row in venta) { suma += double.Parse(row[1].ToString()); } } HTML += "<th colspan=1; class='test2 sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' > " + suma.ToString("N0") + "</th>"; HTML_EXCEL += "<td> " + suma.ToString("N0") + "</td>"; con++; } foreach (DataRow r in periodos.Rows) { DataRow[] venta = total_periodos.Select("'" + r[0].ToString() + "' = periodo"); double suma = 0; if (venta.Length > 0) { foreach (DataRow row in venta) { suma += double.Parse(row[1].ToString()); } } HTML += "<th colspan=1; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' > " + suma.ToString("N0") + "</th>"; HTML_EXCEL += "<td> " + suma.ToString("N0") + "</td>"; } HTML += "<th colspan=1; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' > </th>"; HTML_EXCEL += "<td> </td>"; HTML += "</tr>"; HTML += "<tr>"; HTML_EXCEL += "</tr>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; bool primer2 = true; con = 0; while (con < 3) { if (primer2) { HTML += "<th class='test' style='border-right: 2px solid rgb(50, 48, 48);'> </th>"; HTML_EXCEL += "<td> </td>"; primer2 = false; } HTML += "<th colspan=1; class='test2' style='border-right: 2px solid rgb(50, 48, 48);' > " + dias[con] + "</th>"; HTML_EXCEL += "<td> " + dias[con] + "</td>"; con++; } foreach (DataRow r in periodos.Rows) { HTML += "<th colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);' > " + r[0].ToString() + "</th>"; HTML_EXCEL += "<td> " + r[0].ToString() + "</td>"; } HTML += "<th colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);' > Total </th>"; HTML_EXCEL += "<td> Total </td>"; HTML += "</tr>"; HTML += "</thead>"; HTML += "<tbody>"; HTML += "<tr>"; HTML_EXCEL += "</tr>"; HTML_EXCEL += "<tr>"; con = 0; foreach (DataRow s in productos.Rows) { string cod_produc1 = ReporteRNegocio.cod_producto(s[0].ToString().Trim()) + "*" + vendedor + "*" + bodega; string cod_produc = ReporteRNegocio.cod_producto(s[0].ToString().Trim()); HTML += "<td style='border-right: 2px solid rgb(50, 48, 48);' > " + cod_produc + " - " + s[0].ToString() + "</td>"; HTML_EXCEL += "<td> " + cod_produc + " - " + s[0].ToString() + "</td>"; con = 0; double sum_por_row = 0; while (con < 3) { DataRow[] venta = total_dias.Select("'" + dias[con] + "' = fechafactura and descproducto = '" + s[0].ToString() + "'"); double suma = 0; if (venta.Length > 0) { foreach (DataRow row in venta) { suma += double.Parse(row[1].ToString()); } } clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( string script2 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}')", encriptador.EncryptData(dias[con]), encriptador.EncryptData(cod_produc1), encriptador.EncryptData(grupos.Trim().Replace("'", "")), encriptador.EncryptData("3")); if (suma != 0) { HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='top' title='" + s[0].ToString() + "' href='javascript:' onclick='" + script2 + "'>" + suma.ToString("N0") + " </a> </td>"; HTML_EXCEL += "<td>" + suma.ToString("N0") + "</td>"; } else { HTML += "<td colspan=1;> " + suma.ToString("N0") + "</td>"; HTML_EXCEL += "<td> " + suma.ToString("N0") + "</td>"; } con++; } foreach (DataRow r in periodos.Rows) { DataRow[] venta = total_periodos.Select("'" + r[0].ToString() + "' = periodo and descproducto = '" + s[0].ToString() + "'"); double suma = 0; if (venta.Length > 0) { foreach (DataRow row in venta) { suma += double.Parse(row[1].ToString()); } } clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( sum_por_row += suma; string script2 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}')", encriptador.EncryptData(r[0].ToString()), encriptador.EncryptData(cod_produc1), encriptador.EncryptData(grupos.Trim().Replace("'", "")), encriptador.EncryptData("3")); if (suma != 0) { HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='top' title='" + s[0].ToString() + "' href='javascript:' onclick='" + script2 + "'>" + suma.ToString("N0") + " </a> </td>"; HTML_EXCEL += "<td>" + suma.ToString("N0") + "</td>"; } else { HTML += "<td colspan=1;> " + suma.ToString("N0") + "</td>"; HTML_EXCEL += "<td> " + suma.ToString("N0") + "</td>"; } } HTML += "<td colspan=1;> " + sum_por_row.ToString("N0") + "</td>"; HTML += "</tr>"; HTML_EXCEL += "<td> " + sum_por_row.ToString("N0") + "</td>"; HTML_EXCEL += "</tr>"; } HTML += "</tbody>"; HTML += " </table>"; //HTML += "</div>"; HTML += "</div>"; HTML_EXCEL += "</table>"; R_Excel_1.InnerHtml = HTML_EXCEL; return(HTML); }
private void EDITAR_GUARDAR() { if (txt_cod_usuario.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "1" && l_grupos.Text == "" || chk_otro.Checked && l_unidad_negocio.Text == "2" && l_grupos.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_vend.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } //else if (r_enviar_correo.Checked && t_correo.Text == "" || r_enviar_2.Checked && t_correo.Text == "") //{ // h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) // { // DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; // DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; // } //} else { usuarioEntity us = new usuarioEntity(); us.cod_usuario = txt_cod_usuario.Text; if (txt_clave.Text != "") { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(txt_clave.Text.ToUpper()); us.clave = contrasena; } else { //cambiar variable estatica string cod_usuario_session = Session["COD_USUARIO"].ToString(); //us.clave = ReporteRNegocio.es_su_pass(COD_USUARIO); us.clave = ReporteRNegocio.es_su_pass(cod_usuario_session); } if (chk_adm.Checked) { us.admin = "true"; } else { us.admin = "false"; } if (chk_vend.Checked) { us.tipo_usuario = 2; us.nombre_ = ReporteRNegocio.nombre_vendedor(us.cod_usuario); } else if (chk_otro.Checked) { us.tipo_usuario = 3; us.nombre_ = t_nombre_us.Text; } else { us.tipo_usuario = 1; us.nombre_ = t_nombre_us.Text; } if (r_activo.Checked) { us.activado = "true"; } else { us.activado = "false"; } if (r_enviar_2.Checked) { us.enviar2 = "true"; } else { us.enviar2 = "false"; } if (r_enviar_correo.Checked) { us.enviar = "true"; } else { us.enviar = "false"; } us.correo = t_correo.Text; us.cc = t_cc.Text; if (chk_adm.Checked) { l_unidad_negocio.Text = ReporteRNegocio.obtiene_todos_u_negocio(); l_pantallas.Text = ReporteRNegocio.obtiene_todos_app(); l_grupos.Text = ReporteRNegocio.obtiene_todos_grupos(); } us.u_negocio = l_unidad_negocio.Text; us.grupos = l_grupos.Text; us.app = l_pantallas.Text; string cod_usuario_ = txt_cod_usuario.Text; //if (usuarioBO.actualizar(us, COD_USUARIO) == "OK") if (usuarioBO.actualizar(us, cod_usuario_) == "OK") { h3_.InnerText = "Usuario Editado."; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else { h3_.InnerText = "Falló al Editar."; } } }
protected void G_PRODUCTOS_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { double sum_por_row = 0; string vendedor = G_PRODUCTOS.DataKeys[e.Row.RowIndex].Values[2].ToString(); string cliente = G_PRODUCTOS.DataKeys[e.Row.RowIndex].Values[3].ToString(); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); e.Row.Cells[1].Attributes["onclick"] = "javascript:fuera('" + encriptador.EncryptData(PERIODOS) + "', '" + encriptador.EncryptData(vendedor) + "', '" + encriptador.EncryptData(cliente) + "', '" + encriptador.EncryptData("4") + "');return false;"; //e.Row.Cells[3].Attributes["onclick"] = "javascript:fuera22('" + encriptador.EncryptData(cliente) + "', '" + encriptador.EncryptData("88") + "');return false;"; string script1 = string.Format("javascript:fuera22('{0}', '{1}');return false;", encriptador.EncryptData(cliente), encriptador.EncryptData("88")); e.Row.Cells[5].Text = " <a href='javascript:' onclick='" + script1 + "'>" + e.Row.Cells[5].Text + " </a>"; e.Row.Cells[0].Text = cont_det.ToString(); cont_det++; int colum = productos.Columns.Count; e.Row.Cells[2].Visible = false; e.Row.Cells[3].Visible = false; G_PRODUCTOS.HeaderRow.Cells[2].Visible = false; G_PRODUCTOS.HeaderRow.Cells[3].Visible = false; for (int i = 5; i <= colum; i++) { G_PRODUCTOS.HeaderRow.Cells[i + 1].Attributes["data-sort-method"] = "number"; if (e.Row.Cells[i + 1].Text != "0") { double d; double.TryParse(e.Row.Cells[i + 1].Text, out d); string aux = ""; if (d == 0) { aux = ""; } else { aux = d.ToString("N0"); } e.Row.Cells[i + 1].Text = aux; sum_por_row += d; if (i != colum) { string script = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}');return false;", encriptador.EncryptData(G_PRODUCTOS.HeaderRow.Cells[i + 1].Text.Substring(0, 6)), encriptador.EncryptData(e.Row.Cells[2].Text), encriptador.EncryptData(e.Row.Cells[3].Text), encriptador.EncryptData("8")); e.Row.Cells[i + 1].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[i + 1].Text + " </a>"; } } } e.Row.Cells[colum + 1].Text = sum_por_row.ToString("N0"); if (header_sum) { int colum2 = productos.Columns.Count; for (int i = 5; i <= colum2; i++) { try { G_PRODUCTOS.HeaderRow.Cells[i + 1].Text = G_PRODUCTOS.HeaderRow.Cells[i + 1].Text + " (" + Convert.ToDouble(ReporteRNegocio.Facturación_Mes(G_PRODUCTOS.HeaderRow.Cells[i + 1].Text, where)).ToString("N0") + ")"; } catch { } } header_sum = false; } } }
public string crear_reporte_correo2(DataTable dataTable, DataTable totales, string DESDE, string HASTA, string grupos) { double total_suma = 0; double cant_fact = 0; DataTable ta1 = new DataTable(); DataColumn column1; DataColumn column2; column1 = new DataColumn(); column2 = new DataColumn(); column1.ColumnName = "cont"; column2.ColumnName = "vendedor"; ta1.Columns.Add(column1); ta1.Columns.Add(column2); int sum_cont1 = 0; foreach (DataRow row in totales.Rows) { DataRow row2 = ta1.NewRow(); row2["cont"] = row[5].ToString().Trim(); row2["vendedor"] = row[3].ToString().Trim(); ta1.Rows.Add(row2); total_suma += double.Parse(row[1].ToString()); cant_fact += double.Parse(row[2].ToString()); } DataView view1 = new DataView(ta1); DataTable clientes1 = view1.ToTable(true, "cont", "vendedor"); sum_cont1 = clientes1.Rows.Count; string DESDE_AUX = HASTA; //HTML_EXCEL string HTML_EXCEL = ""; string color_letra_excel = "white"; string color_fondo_excel = "#428BCA"; string HTML = ""; HTML += "<table id='TABLA_REPORTE' class='table table-advance table-bordered fill-head tablesorter filtrar' style='width: 98%; border-collapse: collapse; border-spacing: 1px !important;' width:98%;>"; HTML += "<thead>"; HTML += "<tr>"; HTML_EXCEL += "<table id='T_EXCEL1' border=1>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; bool primer = true; while (HASTA != DESDE) { if (primer) { HTML += "<th colspan=4; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' ></th>"; HTML_EXCEL += "<td colspan=4 ></td>"; primer = false; } DataRow[] venta = totales.Select("'" + HASTA + "' = fechafactura"); double suma = 0; int sum_cont = 0; if (venta.Length > 0) { DataTable ta = new DataTable(); DataColumn column; column = new DataColumn(); column.ColumnName = "cont"; ta.Columns.Add(column); foreach (DataRow row in venta) { DataRow row2 = ta.NewRow(); row2["cont"] = row[5].ToString().Trim(); ta.Rows.Add(row2); suma += double.Parse(row[1].ToString()); } DataView view = new DataView(ta); DataTable clientes = view.ToTable(true, "cont"); sum_cont = clientes.Rows.Count; } HTML += "<th colspan=1; class='test sorter-false' >#cltes</th>"; HTML += "<th colspan=1; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' > " + sum_cont + "</th>"; HTML_EXCEL += "<td>#cltes</td>"; HTML_EXCEL += "<td> " + sum_cont + "</td>"; DateTime desde_ = Convert.ToDateTime(HASTA, new CultureInfo("es-ES")); HASTA = desde_.AddDays(-1).ToShortDateString().Replace("-", "/"); } HTML += "</tr>"; HTML += "<tr>"; HTML_EXCEL += "</tr>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; HASTA = DESDE_AUX; bool primer2 = true; while (DESDE != HASTA) { if (primer2) { HTML += "<th colspan=4; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);'>Total vendedor</th>"; HTML_EXCEL += "<td colspan=4 >Total vendedor</td>"; primer2 = false; } HTML += "<th colspan=2; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' > " + HASTA + "</th>"; HTML_EXCEL += "<td colspan=2 > " + HASTA + "</td>"; DateTime desde_ = Convert.ToDateTime(HASTA, new CultureInfo("es-ES")); HASTA = desde_.AddDays(-1).ToShortDateString().Replace("-", "/"); } HTML += "</tr>"; HTML += "<tr'>"; HTML_EXCEL += "</tr>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; HASTA = DESDE_AUX; bool primer3 = true; while (DESDE != HASTA) { DataRow[] venta = totales.Select("'" + HASTA + "' = fechafactura"); double suma = 0; double sum_cont = 0; if (venta.Length > 0) { foreach (DataRow row in venta) { sum_cont += double.Parse(row[2].ToString()); suma += double.Parse(row[1].ToString()); } } if (primer3) { HTML += "<th colspan=1; class='test' >Vendedor</th>"; HTML += "<th colspan=1; class='test' >Total (" + total_suma.ToString("N0") + ")</th>"; HTML += "<th colspan=1; class='test' >#clte (" + sum_cont1 + ")</th>"; HTML += "<th colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);'>#fact (" + cant_fact + ")</th>"; HTML_EXCEL += "<td>Vendedor</td>"; HTML_EXCEL += "<td>Total (" + total_suma.ToString("N0") + ")</td>"; HTML_EXCEL += "<td>#clte (" + sum_cont1 + ")</td>"; HTML_EXCEL += "<td>#fact (" + cant_fact + ")</td>"; primer3 = false; } HTML += "<th colspan=1; class='test'> " + suma.ToString("N0") + "</th>"; HTML += "<th colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);' > " + sum_cont + "</th>"; HTML_EXCEL += "<td> " + suma.ToString("N0") + "</td>"; HTML_EXCEL += "<td> " + sum_cont + "</td>"; DateTime desde_ = Convert.ToDateTime(HASTA, new CultureInfo("es-ES")); HASTA = desde_.AddDays(-1).ToShortDateString().Replace("-", "/"); } HTML += "</tr>"; HTML_EXCEL += "</tr>"; HASTA = DESDE_AUX; HTML += "</thead>"; HTML += "<tbody>"; foreach (DataRow r in dataTable.Rows) { DataRow[] total = totales.Select(" vendedor like '%" + r[0].ToString().Trim() + "%'"); double suma = 0; int sum_cont = 0; double venta_1 = 0; int cont1 = 0; if (total.Length > 0) { DataTable ta = new DataTable(); DataColumn column; column = new DataColumn(); column.ColumnName = "cont"; ta.Columns.Add(column); foreach (DataRow row in total) { venta_1 += double.Parse(row[1].ToString()); cont1 += Convert.ToInt32(row[2].ToString()); DataRow row2 = ta.NewRow(); row2["cont"] = row[5].ToString().Trim(); ta.Rows.Add(row2); suma += double.Parse(row[1].ToString()); } DataView view = new DataView(ta); DataTable clientes = view.ToTable(true, "cont"); sum_cont = clientes.Rows.Count; } string cod_vendedor = ReporteRNegocio.cod_vendedor(r[0].ToString().Trim()); HTML += "<tr>"; HTML += "<td colspan=1; class='' >" + r[0].ToString().Trim() + "</td>"; HTML_EXCEL += "<tr>"; HTML_EXCEL += "<td>" + r[0].ToString().Trim() + "</td>"; clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( string script2 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}')", encriptador.EncryptData(""), encriptador.EncryptData(cod_vendedor), encriptador.EncryptData(grupos.Trim().Replace("'", "")), encriptador.EncryptData("2")); HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='bottom' title='" + r[0].ToString().Trim() + "' href='javascript:' onclick='" + script2 + "'>" + venta_1.ToString("N0") + " </a> </td>"; HTML += "<td colspan=1; class='' >" + sum_cont + " </td>"; HTML += "<td colspan=1; class='' style='border-right: 2px solid rgb(50, 48, 48);' >" + cont1 + "</td>"; HTML_EXCEL += "<td>" + venta_1.ToString("N0") + "</td>"; HTML_EXCEL += "<td>" + sum_cont + " </td>"; HTML_EXCEL += "<td>" + cont1 + "</td>"; HASTA = DESDE_AUX; while (DESDE != HASTA) { DataRow[] venta = totales.Select("'" + HASTA + "' = fechafactura and vendedor = '" + r[0].ToString().Trim() + "'"); string v = "0"; string c = "0"; string ven = "0"; double venta_ = 0; int cont = 0; foreach (DataRow row in venta) { venta_ += double.Parse(row[1].ToString()); cont += Convert.ToInt32(row[2].ToString()); ven = r[0].ToString().Trim(); } string script = ""; if (venta_ != 0) { v = venta_.ToString("N0"); script = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}')", encriptador.EncryptData(HASTA), encriptador.EncryptData(cod_vendedor), encriptador.EncryptData(grupos.Trim().Replace("'", "")), encriptador.EncryptData("2")); } if (cont != 0) { c = cont.ToString(); } if (script == "") { HTML += "<td colspan=1;> " + v + "</td>"; HTML_EXCEL += "<td> " + v + "</td>"; } else { HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='bottom' title='" + r[0].ToString().Trim() + "' href='javascript:' onclick='" + script + "'>" + v + " </a> </td>"; HTML_EXCEL += "<td>" + v + "</td>"; } HTML += "<td colspan=1; style='border-right: 2px solid rgb(50, 48, 48);' > " + c + " </td>"; HTML_EXCEL += "<td> " + c + " </td>"; DateTime desde_ = Convert.ToDateTime(HASTA, new CultureInfo("es-ES")); HASTA = desde_.AddDays(-1).ToShortDateString().Replace("-", "/"); } HTML += "</tr>"; HTML_EXCEL += "</tr>"; } HTML += "</tbody>"; //HTML += " </tbody>"; HTML += " </table>"; //HTML += "</div>"; HTML += "</div>"; HTML_EXCEL += "</table>"; R_Excel_1.InnerHtml = HTML_EXCEL; return(HTML); }
protected void G_INFORME_TOTAL_VENDEDOR_RowDataBound(object sender, GridViewRowEventArgs e) { // aca if (e.Row.RowType == DataControlRowType.DataRow) { cont_row++; clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string año_factura = e.Row.Cells[22].Text.Substring(0, 4); string script = string.Format("javascript:fuera3('{0}', '{1}');return false;", encriptador.EncryptData(e.Row.Cells[0].Text), encriptador.EncryptData(año_factura)); e.Row.Cells[0].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[0].Text + " </a>"; e.Row.Cells[22].Visible = false; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[22].Visible = false; try { string color_rojo = "<a style='color:red;'> "; try { e.Row.Cells[8].Text = e.Row.Cells[8].Text.Replace("-.", "-"); e.Row.Cells[10].Text = e.Row.Cells[10].Text.Replace("-.", "-"); //ENCABEZADO SUMAS try { sub_peso += Convert.ToDouble(e.Row.Cells[8].Text); } catch { string aca = "se cayo"; } try { sub_dolar += Convert.ToDouble(e.Row.Cells[10].Text); } catch { } try { cost_excel += Convert.ToDouble(e.Row.Cells[13].Text); } catch { } try { cost_impot += Convert.ToDouble(e.Row.Cells[14].Text); } catch { } try { cost_compra += Convert.ToDouble(e.Row.Cells[15].Text); } catch { } //utilidad_exce += Convert.ToDouble(e.Row.Cells[17].Text); //utilidad_compra += Convert.ToDouble(e.Row.Cells[19].Text); } catch { } if (cont_row >= total_rows) { //EDITAR ENCABEZADO G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[8].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[8].Text + " (" + Base.monto_format2(sub_peso) + ")"; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[10].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[10].Text + " (" + Base.monto_format2(sub_dolar) + ")"; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[13].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[13].Text + " (" + Base.monto_format2(cost_excel) + ")"; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[14].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[14].Text + " (" + Base.monto_format2(cost_impot) + ")"; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[15].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[15].Text + " (" + Base.monto_format2(cost_compra) + ")"; //G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[13].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[17].Text + " (" + Base.monto_format2(utilidad_exce) + ")"; //G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[14].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[19].Text + " (" + Base.monto_format2(utilidad_compra) + ")"; } try { e.Row.Cells[16].Text = e.Row.Cells[16].Text.Replace("0:00:00", ""); } catch { } try { if (e.Row.Cells[16].Text == " ") { e.Row.Cells[16].Text = "00/00/0000"; } } catch { } try { e.Row.Cells[11].Text = (Convert.ToDouble(e.Row.Cells[10].Text) / Convert.ToDouble(e.Row.Cells[6].Text)).ToString(); if (e.Row.Cells[11].Text == "NeuN" || e.Row.Cells[11].Text == "NaN") { e.Row.Cells[11].Text = "0"; } if (e.Row.Cells[11].Text.Contains(",")) { if (e.Row.Cells[11].Text.Substring(e.Row.Cells[11].Text.IndexOf(",")).Length > 2) { e.Row.Cells[11].Text = e.Row.Cells[11].Text.Trim().Substring(0, e.Row.Cells[11].Text.IndexOf(",") + 3); } ; } } catch { } try { if (e.Row.Cells[17].Text.Trim() == "TON") { e.Row.Cells[14].Text = (Convert.ToDouble(e.Row.Cells[14].Text) / 1000).ToString(); e.Row.Cells[15].Text = (Convert.ToDouble(e.Row.Cells[15].Text) / 1000).ToString(); } //subtotal_peso if (e.Row.Cells[8].Text.Contains(",")) { if (e.Row.Cells[8].Text.Substring(e.Row.Cells[8].Text.IndexOf(",")).Length > 2) { e.Row.Cells[8].Text = e.Row.Cells[8].Text.Trim().Substring(0, e.Row.Cells[8].Text.IndexOf(",") + 3); } ; } //tasa_cambio if (e.Row.Cells[9].Text.Contains(",")) { if (e.Row.Cells[9].Text.Substring(e.Row.Cells[9].Text.IndexOf(",")).Length > 2) { e.Row.Cells[9].Text = e.Row.Cells[9].Text.Trim().Substring(0, e.Row.Cells[9].Text.IndexOf(",") + 3); } ; } //subtotal_dolar if (e.Row.Cells[10].Text.Contains(",")) { if (e.Row.Cells[10].Text.Substring(e.Row.Cells[10].Text.IndexOf(",")).Length > 2) { e.Row.Cells[10].Text = e.Row.Cells[10].Text.Trim().Substring(0, e.Row.Cells[10].Text.IndexOf(",") + 3); } ; } //valoruni if (e.Row.Cells[11].Text.Contains(",")) { if (e.Row.Cells[11].Text.Substring(e.Row.Cells[11].Text.IndexOf(",")).Length > 2) { e.Row.Cells[11].Text = e.Row.Cells[11].Text.Trim().Substring(0, e.Row.Cells[11].Text.IndexOf(",") + 3); } ; } //cost_excel if (e.Row.Cells[13].Text.Contains(",")) { if (e.Row.Cells[13].Text.Substring(e.Row.Cells[13].Text.IndexOf(",")).Length > 2) { e.Row.Cells[13].Text = e.Row.Cells[13].Text.Trim().Substring(0, e.Row.Cells[13].Text.IndexOf(",") + 3); } ; } //cost_impot if (e.Row.Cells[14].Text.Contains(",")) { if (e.Row.Cells[14].Text.Substring(e.Row.Cells[14].Text.IndexOf(",")).Length > 2) { e.Row.Cells[14].Text = e.Row.Cells[14].Text.Trim().Substring(0, e.Row.Cells[14].Text.IndexOf(",") + 3); } } //compra if (e.Row.Cells[15].Text.Contains(",")) { if (e.Row.Cells[15].Text.Substring(e.Row.Cells[15].Text.IndexOf(",")).Length > 2) { e.Row.Cells[15].Text = e.Row.Cells[15].Text.Trim().Substring(0, e.Row.Cells[15].Text.IndexOf(",") + 3); } ; } } catch { } double venta = 0; double compras = 0; double cant = 0; try { venta = Convert.ToDouble(e.Row.Cells[10].Text); } catch { } try { compras = Convert.ToDouble(e.Row.Cells[15].Text); } catch { } try { cant = Convert.ToDouble(e.Row.Cells[6].Text); } catch { } //double val_i_excel = 0; //double val_f_excel = 0; //try //{ // val_i_excel = Convert.ToDouble(e.Row.Cells[9].Text) * Convert.ToDouble(e.Row.Cells[13].Text); // val_f_excel = Convert.ToDouble(e.Row.Cells[9].Text) * Convert.ToDouble(e.Row.Cells[14].Text); //} //catch { }; ////double val_i_comp = Convert.ToDouble(e.Row.Cells[10].Text) * Convert.ToDouble(e.Row.Cells[13].Text); //double val_f_comp = Convert.ToDouble(e.Row.Cells[10].Text) * Convert.ToDouble(e.Row.Cells[14].Text); if (e.Row.Cells[13].Text.Trim() != " " && venta != 0 && cant != 0) { try { //utilidad excel e.Row.Cells[18].Text = (venta - (cant * Convert.ToDouble(e.Row.Cells[13].Text))).ToString(); //porct excel string porc = (((venta - (cant * Convert.ToDouble(e.Row.Cells[13].Text))) / venta) * 100).ToString("N0") + "%"; if (porc == "NaN%" || porc == "-∞%" || porc == "∞%" || porc == "Infinito%") { porc = "0%"; } e.Row.Cells[19].Text = porc; utilidad_exce += Convert.ToDouble(e.Row.Cells[18].Text); //utilidad_compra += Convert.ToDouble(e.Row.Cells[19].Text); } catch (Exception ex) { string asd = ex.ToString(); } } else { //utilidad excel e.Row.Cells[18].Text = venta.ToString(); //porct excel string porc = ((Convert.ToDouble(e.Row.Cells[18].Text) / venta) * 100).ToString("N0") + "%"; if (porc == "NaN%" || porc == "-∞%" || porc == "∞%" || porc == "Infinito%") { porc = "0%"; } e.Row.Cells[19].Text = porc; utilidad_exce += Convert.ToDouble(e.Row.Cells[18].Text); //utilidad_compra += Convert.ToDouble(e.Row.Cells[19].Text); } if (e.Row.Cells[14].Text.Trim() == " ") { e.Row.Cells[14].Text = "0"; } if (e.Row.Cells[14].Text.Trim() != " " && e.Row.Cells[15].Text.Trim() != " " && cant != 0 && venta != 0) { //(venta - (cant * (Convert.ToDouble(e.Row.Cells[9].Text) * Convert.ToDouble(e.Row.Cells[11].Text)))) //utilidad compras e.Row.Cells[20].Text = (venta - (cant * (Convert.ToDouble(e.Row.Cells[14].Text) + Convert.ToDouble(e.Row.Cells[15].Text)))).ToString(); //porct compras string porc2 = (((venta - (cant * (Convert.ToDouble(e.Row.Cells[14].Text) + Convert.ToDouble(e.Row.Cells[15].Text)))) / venta) * 100).ToString("N0") + "%"; if (porc2 == "NaN%" || porc2 == "-∞%" || porc2 == "∞%" || porc2 == "Infinito%") { porc2 = "0%"; } e.Row.Cells[21].Text = porc2; utilidad_compra += Convert.ToDouble(e.Row.Cells[20].Text); } else { } try { string script3 = string.Format("javascript:fuera_stock('{0}', '{1}');return;", e.Row.Cells[4].Text.ToString(), "2"); string script2 = string.Format("javascript:fuera_stock('{0}', '{1}');return;", e.Row.Cells[4].Text.ToString(), "1"); if (e.Row.Cells[14].Text != " ") { if (!e.Row.Cells[14].Text.Contains("-")) { e.Row.Cells[14].Text = " <a href='javascript:' onclick='" + script3 + "'>" + e.Row.Cells[14].Text + " </a>"; } else { e.Row.Cells[14].Text = " <a style='color:red;' href='javascript:' onclick='" + script3 + "'>" + e.Row.Cells[14].Text + " </a>"; } } if (e.Row.Cells[15].Text != " ") { if (!e.Row.Cells[15].Text.Contains("-")) { e.Row.Cells[15].Text = " <a href='javascript:' onclick='" + script2 + "'>" + e.Row.Cells[15].Text + " </a>"; } else { e.Row.Cells[15].Text = " <a style='color:red;' href='javascript:' onclick='" + script2 + "'>" + e.Row.Cells[15].Text + " </a>"; } } } catch { } // href='javascript:' onclick='" + script2 + "' //e.Row.Cells[13].Visible = false; //e.Row.Cells[14].Visible = false; //G_PRODUCTOS.HeaderRow.Cells[13].Visible = false; //G_PRODUCTOS.HeaderRow.Cells[14].Visible = false; //ult_excel if (e.Row.Cells[18].Text.Contains(",")) { if (e.Row.Cells[18].Text.Substring(e.Row.Cells[18].Text.IndexOf(",")).Length > 2) { e.Row.Cells[18].Text = e.Row.Cells[18].Text.Trim().Substring(0, e.Row.Cells[18].Text.IndexOf(",") + 3); } ; } //porc_exce if (e.Row.Cells[19].Text.Contains(",")) { if (e.Row.Cells[19].Text.Substring(e.Row.Cells[19].Text.IndexOf(",")).Length > 2) { e.Row.Cells[19].Text = e.Row.Cells[19].Text.Trim().Substring(0, e.Row.Cells[19].Text.IndexOf(",") + 3); } ; } //ult_compra if (e.Row.Cells[20].Text.Contains(",")) { if (e.Row.Cells[20].Text.Substring(e.Row.Cells[20].Text.IndexOf(",")).Length > 2) { e.Row.Cells[20].Text = e.Row.Cells[20].Text.Trim().Substring(0, e.Row.Cells[20].Text.IndexOf(",") + 3); } ; } //porc_compra if (e.Row.Cells[21].Text.Contains(",")) { if (e.Row.Cells[21].Text.Substring(e.Row.Cells[21].Text.IndexOf(",")).Length > 2) { e.Row.Cells[21].Text = e.Row.Cells[21].Text.Trim().Substring(0, e.Row.Cells[21].Text.IndexOf(",") + 3); } ; } List <int> sd = new List <int>(new int[] { 8, 9, 10, 11, 13, 14, 15, 18, 19, 20, 21 }); foreach (int num in sd) { if (e.Row.Cells[num].Text.Contains("-")) { e.Row.Cells[num].Text = color_rojo + e.Row.Cells[num].Text + "</a>"; } if (e.Row.Cells[num].Text.Trim() == " ") { e.Row.Cells[num].Text = "0"; } } if (cont_row >= total_rows) { //EDITAR ENCABEZADO G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[18].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[18].Text + " (" + Base.monto_format2(utilidad_exce) + ")"; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[20].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[20].Text + " (" + Base.monto_format2(utilidad_compra) + ")"; string porc = ((utilidad_exce / sub_dolar) * 100).ToString("N0") + "%"; if (porc == "NaN%" || porc == "-∞%" || porc == "∞%" || porc == "Infinito%") { porc = "0%"; } string porc2 = ((utilidad_compra / sub_dolar) * 100).ToString("N0") + "%"; if (porc2 == "NaN%" || porc2 == "-∞%" || porc2 == "∞%" || porc2 == "Infinito%") { porc2 = "0%"; } G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[19].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[19].Text + " (" + porc + ")"; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[21].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[21].Text + " (" + porc2 + ")"; } } catch (Exception ex) { string asd = ex.ToString(); } } }
protected void G_INFORME_TOTAL_VENDEDOR_RowDataBound(object sender, GridViewRowEventArgs e) { // aca if (e.Row.RowType == DataControlRowType.DataRow) { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); if (Session["comexx"].ToString() != "si") { e.Row.Cells[0].Visible = false; //e.Row.Cells[].Visible = false; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[0].Visible = false; } else { } try { monto_cos += double.Parse(e.Row.Cells[4].Text); G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[4].Text = "Costo = " + monto_cos.ToString("N0"); } catch (Exception e6) { } try { monto_import += double.Parse(e.Row.Cells[6].Text); G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[6].Text = "CostoImpor = " + monto_import.ToString("N0"); } catch (Exception e7) { } try { monto_total += double.Parse(e.Row.Cells[9].Text); G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[9].Text = "CostoTotal = " + monto_total.ToString("N0"); } catch (Exception e8) { } if (e.Row.Cells[9].Text == " ") { e.Row.Cells[9].Text = e.Row.Cells[4].Text; e.Row.Cells[10].Text = e.Row.Cells[5].Text; if (e.Row.Cells[4].Text == " ") { e.Row.Cells[4].Text = "0"; } monto_total += double.Parse(e.Row.Cells[4].Text); G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[9].Text = "CostoTotal = " + monto_total.ToString("N0"); } //sorter - false if (e.Row.Cells[19].Text != "noootiene" && Session["comexx"].ToString() == "si") { string script = string.Format("javascript:CargarEvento_Tabla('{0}','{1}','{2}','{3}');devul_fal();", "", e.Row.Cells[3].Text, e.Row.Cells[14].Text, ""); e.Row.Cells[2].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[2].Text + " </a>"; } string script2 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}');return false;", encriptador.EncryptData(e.Row.Cells[1].Text), encriptador.EncryptData(e.Row.Cells[16].Text), encriptador.EncryptData(""), encriptador.EncryptData("56")); e.Row.Cells[10].Text = " <a href='javascript:' onclick='" + script2 + "'>" + e.Row.Cells[10].Text + " </a>"; string script1 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}');return false;", encriptador.EncryptData(e.Row.Cells[14].Text), encriptador.EncryptData(""), encriptador.EncryptData(e.Row.Cells[4].Text), encriptador.EncryptData("54")); e.Row.Cells[14].Text = " <a href='javascript:' onclick='" + script1 + "'>" + e.Row.Cells[14].Text + " </a>"; string aus_des = e.Row.Cells[2].Text; e.Row.Cells[2].Text = e.Row.Cells[14].Text; e.Row.Cells[14].Text = aus_des; aus_des = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[2].Text; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[2].Text = G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[14].Text; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[14].Text = aus_des; if (e.Row.Cells[8].Text.Contains("-")) { e.Row.Cells[8].Text = "<a style='color:red;'>" + e.Row.Cells[8].Text + "</a>"; } if (e.Row.Cells[12].Text.Contains("-")) { e.Row.Cells[12].Text = "<a style='color:red;'>" + e.Row.Cells[12].Text + "</a>"; } if (e.Row.Cells[24].Text.Contains("-")) { e.Row.Cells[24].Text = "<a style='color:red;'>" + e.Row.Cells[24].Text + "</a>"; } e.Row.Cells[19].Visible = false; //e.Row.Cells[].Visible = false; G_INFORME_TOTAL_VENDEDOR.HeaderRow.Cells[19].Visible = false; } }
protected void btn_save_Click(object sender, EventArgs e) { usuarioEntity us = new usuarioEntity(); us.cod_usuario = txt_cod_usuario_edit.Text; us.correo = t_correo_editar.Text; if (txt_clave_edit.Text != "") { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(txt_clave_edit.Text.ToUpper()); us.clave = contrasena; } else { us.clave = ReporteRNegocio.es_su_pass(usuario.Text); } if (activado.Checked) { us.activado = "true"; } else { us.activado = "false"; } if (chk_enviar_correo.Checked) { us.enviar = "true"; } else { us.enviar = "false"; } bool elimina = false; if (chk_vend2.Checked) { us.tipo_usuario = 2; l_unidad_negocio.Text = ""; elimina = true; } else if (chk_otro2.Checked) { us.tipo_usuario = 3; } else { us.tipo_usuario = 1; } if (usuarioBO.actualizar(us, usuario.Text) == "OK") { if (elimina) { try { usuarioBO.eliminar_grupos_usuario(usuario.Text); } catch { } } if (l_unidad_negocio.Text != "") { try { usuarioBO.eliminar_grupos_usuario(usuario.Text); } catch { } if (l_unidad_negocio.Text.Contains(",")) { if (l_unidad_negocio.Text.Contains("-- Todos --")) { foreach (ListItem item in d_grupos_2.Items) { usuarioBO.registrar_det(us.cod_usuario, item.ToString()); } } else { string[] grupos = l_unidad_negocio.Text.Split(','); foreach (string grupo in grupos) { usuarioBO.registrar_det(us.cod_usuario, grupo); } } } else { if (l_unidad_negocio.Text == "-- Todos --") { foreach (ListItem item in d_grupos_2.Items) { if (item.ToString() != "-- Todos --") { usuarioBO.registrar_det(us.cod_usuario, item.ToString()); } } } else { usuarioBO.registrar_det(us.cod_usuario, l_unidad_negocio.Text); } } } //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>editado();</script>", false); h3_.InnerText = "Usuario Editado."; cargar_usuarios(); } else { //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>no_editado();</script>", false); h3_.InnerText = "Error al Editar, verifique los datos"; } div_editar_usuario.Visible = false; fondo_modal.Visible = false; cargar_usuarios(); }
private void NUEVO_GUARDAR() { if (txt_cod_usuario.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (txt_clave.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_unidad_negocio.Text == "1" && l_grupos.Text == "" || chk_otro.Checked && l_unidad_negocio.Text == "2" && l_grupos.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_otro.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (chk_vend.Checked && l_pantallas.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else if (r_enviar_correo.Checked && t_correo.Text == "" || r_enviar_2.Checked && t_correo.Text == "") { h3_.InnerText = "Falta completar datos"; if (!chk_adm.Checked) { DIV2_3.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; DIV222.Attributes["style"] = "margin-right: 0px; margin-left: 0px; display:block;"; } } else { usuarioEntity us = new usuarioEntity(); us.cod_usuario = txt_cod_usuario.Text; clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("Somos los mas solomon de quillota 2015"); string contrasena = encriptador.EncryptData(txt_clave.Text.ToUpper()); us.clave = contrasena; if (chk_adm.Checked) { us.admin = "true"; } else { us.admin = "false"; } if (chk_vend.Checked) { us.tipo_usuario = 2; us.nombre_ = ReporteRNegocio.nombre_vendedor(us.cod_usuario); } else if (chk_otro.Checked) { us.tipo_usuario = 3; us.nombre_ = t_nombre_us.Text; } else { us.tipo_usuario = 1; us.nombre_ = t_nombre_us.Text; } if (r_activo.Checked) { us.activado = "true"; } else { us.activado = "false"; } if (r_enviar_2.Checked) { us.enviar2 = "true"; } else { us.enviar2 = "false"; } if (r_enviar_correo.Checked) { us.enviar = "True"; } else { us.enviar = "False"; } if (usuarioBO.encontrar(ref us) == "OK") { //ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>repetido_agregar_adm();</script>", false); h3_.InnerText = "Usuario ya se encuentra."; cargar_usuarios(); return; } else { us.correo = t_correo.Text; us.cc = t_cc.Text; if (chk_adm.Checked) { l_unidad_negocio.Text = ReporteRNegocio.obtiene_todos_u_negocio(); l_pantallas.Text = ReporteRNegocio.obtiene_todos_app(); l_grupos.Text = ReporteRNegocio.obtiene_todos_grupos(); } us.u_negocio = l_unidad_negocio.Text; us.grupos = l_grupos.Text; us.app = l_pantallas.Text; if (usuarioBO.registrar(us) == "OK") { h3_.InnerText = "Usuario Agregado."; //chk_adm.Checked = true; t_cc.Text = ""; r_enviar_2.Checked = false; DIV222.Attributes["style"] = "display:none;"; l_unidad_negocio.Text = ""; l_pantallas.Text = ""; l_grupos.Text = ""; DIV2_3.Attributes["style"] = "display:none;"; txt_clave.Text = ""; txt_cod_usuario.Text = ""; t_correo.Text = ""; r_enviar_correo.Checked = false; ScriptManager.RegisterStartupScript(Page, this.GetType(), "teeee", "<script language='javascript'>vaciar_editar();</script>", false); cargar_usuarios(); } } } }
private static string crear_reporte_correo(DataTable dataTable, DataTable totales, string DESDE, string HASTA, string grupos) { //HTML += " </div>"; string HTML = ""; HTML += "<table id='TABLA_REPORTE' class='table table-advance table-bordered fill-head tablesorter' style='width: 98%; border-collapse: collapse; border-spacing: 1px !important;' width:98%;>"; //HTML += " <thead>"; HTML += " <tr>"; foreach (DataRow r in dataTable.Rows) { DataRow[] venta = totales.Select("vendedor = '" + r[0].ToString().Trim() + "'"); int sum_cont = 0; if (venta.Length > 0) { DataTable ta = new DataTable(); DataColumn column; column = new DataColumn(); column.ColumnName = "cont"; ta.Columns.Add(column); foreach (DataRow row in venta) { DataRow row2 = ta.NewRow(); row2["cont"] = row[5].ToString().Trim(); ta.Rows.Add(row2); } DataView view = new DataView(ta); DataTable clientes = view.ToTable(true, "cont"); sum_cont = clientes.Rows.Count; } HTML += "<td colspan=2; class='test' ># cltes con fact.</td>"; HTML += "<td colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);' > " + sum_cont + "</td>"; } HTML += "</tr>"; HTML += " <tr>"; foreach (DataRow r in dataTable.Rows) { HTML += "<td colspan=3; class='test' style='border-right: 2px solid rgb(50, 48, 48);' > " + r[0].ToString().Trim() + "</td>"; } HTML += "</tr>"; int cont2 = 1; foreach (DataRow r in dataTable.Rows) { DataRow[] venta = totales.Select("vendedor = '" + r[0].ToString().Trim() + "'"); double SUM_VENTA = 0; int sum_cont = 0; foreach (DataRow row in venta) { SUM_VENTA += double.Parse(row[1].ToString()); sum_cont += Convert.ToInt32(row[2].ToString()); } HTML += "<td class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'> TOTAL </td>"; HTML += "<td class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'> " + SUM_VENTA.ToString("N0") + " </td>"; HTML += "<td class='test' style='font-weight: bold; border-right: 2px solid rgb(50, 48, 48); border-bottom: 2px solid rgb(50, 48, 48); '> " + sum_cont + " </td>"; cont2++; } HTML += "</tr>"; while (DESDE != HASTA) { HTML += "<tr>"; int cont3 = 1; foreach (DataRow r in dataTable.Rows) { DataRow[] venta = totales.Select("'" + DESDE + "' = fechafactura and vendedor = '" + r[0].ToString().Trim() + "'"); string v = "-"; string c = "0"; double venta_ = 0; int cont = 0; foreach (DataRow row in venta) { venta_ += double.Parse(row[1].ToString()); cont += Convert.ToInt32(row[2].ToString()); } string script = ""; clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( if (venta_ != 0) { v = venta_.ToString("N0"); script = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}')", encriptador.EncryptData(DESDE), encriptador.EncryptData(r[0].ToString().Trim()), encriptador.EncryptData(grupos.Trim().Replace("'", "")), encriptador.EncryptData("2")); } if (cont != 0) { c = cont.ToString(); } HTML += "<td > " + DESDE + " </td>"; if (script == "") { HTML += "<td > " + v + "</td>"; } else { HTML += "<td > <a href='javascript:' onclick='" + script + "'>" + v + " </a> </td>"; } HTML += "<td style='border-right: 2px solid rgb(50, 48, 48);' > " + c + " </td>"; cont3++; } HTML += "</tr>"; DateTime desde_ = Convert.ToDateTime(DESDE, new CultureInfo("es-ES")); DESDE = desde_.AddDays(1).ToShortDateString().Replace("-", "/"); } //HTML += " </tbody>"; HTML += " </table>"; //HTML += "</div>"; HTML += "</div>"; return(HTML); }
public string crear_reporte_correo(DataTable dataTable, DataTable totales, string DESDE, string HASTA, string grupos) { string periodo_anterior = ""; string periodo_actual = ""; DataView view = new DataView(totales); DataTable distinctValues = view.ToTable(true, "periodo"); DataView dv = distinctValues.DefaultView; dv.Sort = "periodo desc"; distinctValues = dv.ToTable(); int co = 1; foreach (DataRow r in distinctValues.Rows) { if (co == 1) { periodo_actual = r[0].ToString(); } if (co == 2) { periodo_anterior = r[0].ToString(); } co++; } if (periodo_anterior == "") { periodo_anterior = periodo_actual; } double ACUMULADO = 0; int cant_cliete = 0; string var1 = ""; double total_mes_actual1 = 0; foreach (DataRow r2 in dataTable.Rows) { DateTime hasta_ant = Convert.ToDateTime(HASTA, new CultureInfo("es-ES")); string anterior_hasta = hasta_ant.AddMonths(-1).ToShortDateString().Replace("-", "/"); string where_ant = " where vendedor = '" + r2[0].ToString() + "' and FechaFactura <= CONVERT(datetime,'" + anterior_hasta + "',103) "; ACUMULADO += ReporteRNegocio.Facturación_Mes(periodo_anterior, where_ant); total_mes_actual1 += ReporteRNegocio.Facturación_Mes(periodo_actual, " where vendedor = '" + r2[0].ToString() + "' and periodo = " + periodo_actual); cant_cliete += ReporteRNegocio._cltes_con_vta(periodo_anterior, where_ant); } var1 = (Math.Round((total_mes_actual1 * 100 / ACUMULADO)) - 100).ToString() + "%"; if (var1.Contains("-")) { var1 = "<i style='color:red;'>" + var1 + "</i>"; } //HTML_EXCEL string HTML_EXCEL = ""; string color_letra_excel = "white"; string color_fondo_excel = "#428BCA"; string HTML = ""; HTML += "<table id='TABLA_REPORTE2' class='table table-advance table-bordered fill-head tablesorter filtrar2' style='width: 98%; border-collapse: collapse; border-spacing: 1px !important;' width:98%;>"; HTML += "<thead>"; HTML += " <tr>"; HTML_EXCEL += "<table id='T_EXCEL2' border=1>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; bool primer2 = true; foreach (DataRow r in distinctValues.Rows) { if (primer2) { HTML += "<th colspan=4; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);'></th>"; HTML_EXCEL += "<td colspan=4 ></td>"; primer2 = false; } HTML += "<th colspan=2; class='test sorter-false' style='border-right: 2px solid rgb(50, 48, 48);' > " + r[0].ToString().Trim() + "</th>"; HTML_EXCEL += "<td colspan=2 > " + r[0].ToString().Trim() + "</td>"; } HTML += "</tr>"; HTML_EXCEL += "</tr>"; HTML += "<tr>"; HTML_EXCEL += "<tr style='background-color:" + color_fondo_excel + "; color:" + color_letra_excel + "'>"; int cont2 = 1; bool primer1 = true; foreach (DataRow r in distinctValues.Rows) { if (primer1) { HTML += "<th colspan=1; class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'>Vendedores</th>"; HTML += "<th colspan=1; class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'>Acum.Mes Anter. (" + ACUMULADO.ToString("N0") + ")</th>"; HTML += "<th colspan=1; class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'>clte# (" + cant_cliete + ")</th>"; HTML += "<th colspan=1; id='var' class='test sort-ascending' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48); border-right: 2px solid rgb(50, 48, 48);' width='95px'>%Var (" + var1 + ") </th>"; HTML_EXCEL += "<td>Vendedores</td>"; HTML_EXCEL += "<td>Acum.Mes Anter. (" + ACUMULADO.ToString("N0") + ")</td>"; HTML_EXCEL += "<td>clte# (" + cant_cliete + ")</td>"; HTML_EXCEL += "<td width='95px'>%Var (" + var1 + ") </td>"; primer1 = false; } DataRow[] venta = totales.Select("periodo = '" + r[0].ToString().Trim() + "'"); DataTable ta = new DataTable(); DataColumn column; column = new DataColumn(); column.ColumnName = "cont"; ta.Columns.Add(column); double SUM_VENTA = 0; int sum_cont = 0; foreach (DataRow row in venta) { SUM_VENTA += double.Parse(row[1].ToString()); DataRow row2 = ta.NewRow(); row2["cont"] = row[4].ToString().Trim(); ta.Rows.Add(row2); } DataView view2 = new DataView(ta); DataTable clientes = view2.ToTable(true, "cont"); sum_cont = clientes.Rows.Count; //HTML += "<td colspan=2; class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'> TOTAL </td>"; HTML += "<th colspan=1; class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48);'> " + SUM_VENTA.ToString("N0") + " </th>"; HTML += "<th colspan=1; class='test' style='font-weight: bold; border-bottom: 2px solid rgb(50, 48, 48); border-right: 2px solid rgb(50, 48, 48);'> " + sum_cont + " </th>"; HTML_EXCEL += "<td> " + SUM_VENTA.ToString("N0") + " </td>"; HTML_EXCEL += "<td> " + sum_cont + " </td>"; cont2++; } HTML += "</tr>"; HTML += "</thead>"; HTML_EXCEL += "</tr>"; foreach (DataRow r2 in dataTable.Rows) { HTML += "<tr>"; HTML_EXCEL += "<tr>"; int cont3 = 1; HTML += "<td colspan=1; style='border-right: 2px solid rgb(50, 48, 48);'> " + r2[0].ToString() + " </td>"; HTML_EXCEL += "<td> " + r2[0].ToString() + " </td>"; DateTime hasta_ant = Convert.ToDateTime(HASTA, new CultureInfo("es-ES")); string anterior_hasta = hasta_ant.AddMonths(-1).ToShortDateString().Replace("-", "/"); string where_ant = " where vendedor = '" + r2[0].ToString() + "' and FechaFactura <= CONVERT(datetime,'" + anterior_hasta + "',103) "; string factur_acumulado = ReporteRNegocio.Facturación_Mes(periodo_anterior, where_ant).ToString("N0"); double total_mes_actual = ReporteRNegocio.Facturación_Mes(periodo_actual, " where vendedor = '" + r2[0].ToString() + "' and periodo = " + periodo_actual); string clntes = ReporteRNegocio._cltes_con_vta(periodo_anterior, where_ant).ToString(); HTML += "<td colspan=1;> " + factur_acumulado + " </td>"; HTML += "<td colspan=1;'> " + clntes + " </td>"; HTML_EXCEL += "<td> " + factur_acumulado + " </td>"; HTML_EXCEL += "<td> " + clntes + " </td>"; string var_ = (Math.Round((total_mes_actual * 100 / double.Parse(factur_acumulado.Replace(".", "")))) - 100).ToString() + "%"; if (var_.Contains("∞")) { var_ = "100%"; } if (var_.Contains("NaN") || var_.Contains("∞") || var_.Contains("NeuN") || var_.Contains("Infinito")) { var_ = ""; } if (var_.Contains("-")) { var_ = "<i style='color:red;'> " + var_ + "</i>"; } string var_tool = "(" + total_mes_actual.ToString("N0") + " * 100 / " + factur_acumulado + ") -100"; HTML += "<td colspan=1; style='border-right: 2px solid rgb(50, 48, 48);' width='95px'> <a data-toggle='tooltip' style='color:black;' data-placement='top' title='" + var_tool + "'>" + var_ + " </a> </td>"; HTML_EXCEL += "<td width='70px'>" + var_ + " </td>"; string cod_vendedor = ReporteRNegocio.cod_vendedor(r2[0].ToString().Trim()); foreach (DataRow r in distinctValues.Rows) { DataRow[] venta = totales.Select(r[0].ToString() + " = periodo and vendedor = '" + r2[0].ToString().Trim() + "'"); string v = "-"; string c = "0"; DataTable ta = new DataTable(); DataColumn column; column = new DataColumn(); column.ColumnName = "cont"; int sum_cont = 0; ta.Columns.Add(column); double venta_ = 0; int cont = 0; foreach (DataRow row in venta) { venta_ += double.Parse(row[1].ToString()); DataRow row2 = ta.NewRow(); row2["cont"] = row[4].ToString().Trim(); ta.Rows.Add(row2); } DataView view2 = new DataView(ta); DataTable clientes = view2.ToTable(true, "cont"); sum_cont = clientes.Rows.Count; clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( string bit = "2"; string script2 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}')", encriptador.EncryptData(r[0].ToString()), encriptador.EncryptData(cod_vendedor), encriptador.EncryptData(grupos.Trim().Replace("'", "")), encriptador.EncryptData(bit)); if (venta_ != 0) { HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='top' title='" + r2[0].ToString().Trim() + "' href='javascript:' onclick='" + script2 + "'>" + venta_.ToString("N0") + " </a> </td>"; HTML_EXCEL += "<td>" + venta_.ToString("N0") + "</td>"; } else { HTML += "<td colspan=1;> " + venta_ + "</td>"; HTML_EXCEL += "<td> " + venta_ + "</td>"; } HTML += "<td colspan=1; style='border-right: 2px solid rgb(50, 48, 48);'> " + sum_cont + "</td>"; HTML_EXCEL += "<td> " + sum_cont + "</td>"; cont3++; } HTML += "</tr>"; HTML_EXCEL += "</tr>"; } HTML += " </table>"; HTML_EXCEL += " </table>"; HTML += "</div>"; R_Excel_2.InnerHtml = HTML_EXCEL; return(HTML); }
private string crear_comiones(string grupos) { string HTML = ""; string where = ""; if (grupos != "") { where += " and user1 in (" + agregra_comillas(grupos) + ")"; } if (l_vendedores.Text != "") { where += " and codvendedor in (" + agregra_comillas(l_vendedores.Text) + ")"; } where = " and FECHA_PAGO >= CONVERT(datetime,'" + txt_desde.Text + "', 103) " + " and FECHA_PAGO <= CONVERT(datetime,'" + txt_hasta.Text + "',103) "; DataTable valores = ReporteRNegocio.trae_comisiones(where); DataView view2 = new DataView(valores); DataTable vendedores3 = view2.ToTable(true, "vendedor"); DataView dv32 = vendedores3.DefaultView; dv32.Sort = "vendedor"; vendedores3 = dv32.ToTable(); DataTable periodos = view2.ToTable(true, "periodo_pago"); DataView dv3 = periodos.DefaultView; dv3.Sort = "periodo_pago"; periodos = dv3.ToTable(); HTML += "<table id='TABLA_REPORTE' class='table table-advance table-bordered fill-head tablesorter filtrar' style='width: 98%; border-collapse: collapse; border-spacing: 1px !important;' width:98%;>"; HTML += "<thead>"; HTML += "<tr>"; HTML += "<th colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);' ></th>"; foreach (DataRow r in periodos.Rows) { HTML += "<th colspan=1; class='test' style='border-right: 2px solid rgb(50, 48, 48);' >" + r[0].ToString().Trim() + "</th>"; } HTML += "</tr>"; HTML += "</thead>"; HTML += "<tbody>"; foreach (DataRow r2 in vendedores3.Rows) { HTML += "<tr>"; HTML += "<td colspan=1; class='test'>" + r2[0].ToString().Trim() + "</td>"; foreach (DataRow r in periodos.Rows) { DataRow[] comision = valores.Select("periodo_pago = '" + r[0].ToString().Trim() + "' and vendedor = '" + r2[0].ToString().Trim() + "'"); if (comision.Length == 0) { HTML += "<td colspan=1; class=''>0</td>"; } else { double sum_comision = 0; foreach (DataRow row in comision) { sum_comision += double.Parse(row[2].ToString()); } sum_comision = Math.Round(sum_comision); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string script2 = string.Format("javascript:fuera('{0}', '{1}','{2}', '{3}')", encriptador.EncryptData(""), encriptador.EncryptData(r[0].ToString().Trim()), encriptador.EncryptData(r2[0].ToString().Trim()), encriptador.EncryptData("2018")); HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='bottom' title='" + r[0].ToString().Trim() + "' href='javascript:' onclick='" + script2 + "'> " + Base.monto_format2(sum_comision) + " </a> </td>"; } } HTML += "</tr>"; } //HTML += "<tr>"; //HTML += "<td colspan=1; class='' >PERIODO 2</td>"; ////string script1 = string.Format("javascript:fuera('{0}', '{1}')", encriptador.EncryptData(""), encriptador.EncryptData("")); ////HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='bottom' title='toongleee_aqui' href='javascript:' onclick='" + script2 + "'> TEXTOOO AQUII </a> </td>"; ////HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='bottom' title='toongleee_aqui' href='javascript:' onclick='" + script2 + "'> TEXTOOO AQUII </a> </td>"; ////HTML += "<td colspan=1;> <a data-toggle='tooltip' data-placement='bottom' title='toongleee_aqui' href='javascript:' onclick='" + script2 + "'> TEXTOOO AQUII </a> </td>"; //HTML += "</tr>"; HTML += "</tbody>"; HTML += " </table>"; HTML += "</div>"; return(HTML); }
protected void G_INFORME_TOTAL_VENDEDOR_RowDataBound(object sender, GridViewRowEventArgs e) { // aca if (e.Row.RowType == DataControlRowType.DataRow) { //sorter - false if (e.Row.Cells[4].Text.Contains("TOTAL")) { e.Row.Cells[1].Text = ""; e.Row.Attributes["style"] = "background-color: #aaffaa"; e.Row.CssClass = "no-sort"; e.Row.Cells[0].Attributes["style"] = "background-color: white"; e.Row.Cells[1].Attributes["style"] = "background-color: white"; } try { clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string año_mes = CB_TIPO_DOC_GRILLA.SelectedValue + "*" + TX_AÑO.Text + "*" + txt_hasta.Text + "*" + tx_valor_mensual.Text + "*" + tx_dolar.Text + "*" + tx_dias_sobre.Text; string script = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}');return false;", encriptador.EncryptData(año_mes), encriptador.EncryptData(e.Row.Cells[0].Text), encriptador.EncryptData(lb_bodegas2.Text), encriptador.EncryptData("13")); e.Row.Cells[0].Text = " <a href='javascript:' onclick='" + script + "'>" + e.Row.Cells[0].Text + " </a>"; } catch { } try { e.Row.Cells[1].Text = e.Row.Cells[1].Text.Replace(".", ","); e.Row.Cells[1].Text = e.Row.Cells[1].Text.Substring(0, e.Row.Cells[1].Text.IndexOf(",") + 3); e.Row.Cells[1].Text = e.Row.Cells[1].Text.Replace(",00", ""); e.Row.Cells[1].Text = Base.monto_format(e.Row.Cells[1].Text.Trim()); //e.Row.Cells[3].Text = e.Row.Cells[3].Text.Substring(0, e.Row.Cells[3].Text.IndexOf(",") + 3); e.Row.Cells[3].Text = e.Row.Cells[3].Text.Replace(".", ","); e.Row.Cells[3].Text = e.Row.Cells[3].Text.Replace(".00", ""); e.Row.Cells[3].Text = Base.monto_format(e.Row.Cells[3].Text.Trim()); if (e.Row.Cells[5].Text.Substring(0, 1).Contains('-')) { e.Row.Cells[5].Text = "0"; } e.Row.Cells[3].Text = Convert.ToDouble(e.Row.Cells[3].Text.Substring(0, e.Row.Cells[3].Text.IndexOf(","))).ToString("N0"); //try //{ // if (Convert.ToDouble(e.Row.Cells[5].Text) > 0) // { // } } catch { } } }
protected void G_PRODUCTOS_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string vendedor = G_PRODUCTOS.DataKeys[e.Row.RowIndex].Values[2].ToString(); string cliente = G_PRODUCTOS.DataKeys[e.Row.RowIndex].Values[3].ToString(); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); //encriptador.EncryptData( e.Row.Cells[1].Attributes["onclick"] = "javascript:fuera('" + encriptador.EncryptData(PERIODOS) + "', '" + encriptador.EncryptData(vendedor) + "', '" + encriptador.EncryptData(cliente) + "', '" + encriptador.EncryptData("4") + "');return false;"; double sum_por_row = 0; for (int i = 5; i <= colum; i++) { double d; double.TryParse(e.Row.Cells[i + 1].Text, out d); sum_por_row += d; } e.Row.Cells[colum + 2].Text = sum_por_row.ToString("N0"); e.Row.Cells[0].Text = cont_det.ToString(); cont_det++; e.Row.Cells[2].Visible = false; e.Row.Cells[3].Visible = false; G_PRODUCTOS.HeaderRow.Cells[2].Visible = false; G_PRODUCTOS.HeaderRow.Cells[3].Visible = false; if (header_sum) { periodo1 = ReporteRNegocio.Facturación_Mes_precalculado1(USER);; periodo2 = ReporteRNegocio.Facturación_Mes_precalculado2(USER);; periodo3 = ReporteRNegocio.Facturación_Mes_precalculado3(USER);; periodo4 = ReporteRNegocio.Facturación_Mes_precalculado4(USER);; periodo1_ = ReporteRNegocio.pregunta_periodo_prod(USER, "1"); periodo2_ = ReporteRNegocio.pregunta_periodo_prod(USER, "2"); periodo3_ = ReporteRNegocio.pregunta_periodo_prod(USER, "3"); periodo4_ = ReporteRNegocio.pregunta_periodo_prod(USER, "4"); header_sum = false; } List <string> periodos_list = PERIODOS.Split(',').ToList(); G_PRODUCTOS.HeaderRow.Cells[4].Text = "Vendedor"; G_PRODUCTOS.HeaderRow.Cells[3].Text = "Producto"; G_PRODUCTOS.HeaderRow.Cells[5].Text = "Cliente"; G_PRODUCTOS.HeaderRow.Cells[6].Text = periodo1_ + " (" + Double.Parse(periodo1).ToString("N0") + ") "; G_PRODUCTOS.HeaderRow.Cells[7].Text = periodo2_ + " (" + Double.Parse(periodo2).ToString("N0") + ") "; G_PRODUCTOS.HeaderRow.Cells[8].Text = periodo3_ + " (" + Double.Parse(periodo3).ToString("N0") + ") "; G_PRODUCTOS.HeaderRow.Cells[9].Text = periodo4_ + " (" + Double.Parse(periodo4).ToString("N0") + ") "; G_PRODUCTOS.HeaderRow.Cells[6].Attributes["data-sort-method"] = "number"; G_PRODUCTOS.HeaderRow.Cells[7].Attributes["data-sort-method"] = "number"; G_PRODUCTOS.HeaderRow.Cells[8].Attributes["data-sort-method"] = "number"; G_PRODUCTOS.HeaderRow.Cells[9].Attributes["data-sort-method"] = "number"; G_PRODUCTOS.HeaderRow.Cells[10].Attributes["data-sort-method"] = "number"; try { if (G_PRODUCTOS.HeaderRow.Cells[6].Text.Contains("Error")) { G_PRODUCTOS.HeaderRow.Cells[6].Attributes["style"] = "display: none;"; e.Row.Cells[6].Attributes["style"] = "display: none;"; } if (G_PRODUCTOS.HeaderRow.Cells[7].Text.Contains("Error")) { G_PRODUCTOS.HeaderRow.Cells[7].Attributes["style"] = "display: none;"; e.Row.Cells[7].Attributes["style"] = "display: none;"; } if (G_PRODUCTOS.HeaderRow.Cells[8].Text.Contains("Error")) { G_PRODUCTOS.HeaderRow.Cells[8].Attributes["style"] = "display: none;"; e.Row.Cells[8].Attributes["style"] = "display: none;"; } if (G_PRODUCTOS.HeaderRow.Cells[9].Text.Contains("Error")) { G_PRODUCTOS.HeaderRow.Cells[9].Attributes["style"] = "display: none;"; e.Row.Cells[9].Attributes["style"] = "display: none;"; } } catch { } } }
protected void G_SP_DIARIA_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string stock_zarate = e.Row.Cells[12].Text; e.Row.Cells[12].Text = Base.monto_format(stock_zarate.Replace(",00", "")); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string script1 = string.Format("javascript:fuera('{0}', '{1}', '{2}', '{3}');return false;", encriptador.EncryptData(e.Row.Cells[1].Text), encriptador.EncryptData(""), encriptador.EncryptData(""), encriptador.EncryptData("57")); e.Row.Cells[1].Text = " <a href='javascript:' onclick='" + script1 + "'>" + e.Row.Cells[1].Text + " </a>"; if (Session["codvendedor"].ToString() == "") { string costo_compra = e.Row.Cells[16].Text; string utlidad_excel = e.Row.Cells[17].Text; string utlidad_compra = e.Row.Cells[18].Text; double d3; double.TryParse(costo_compra, out d3); double d4; double.TryParse(utlidad_excel, out d4); double d5; double.TryParse(utlidad_compra, out d5); d3 = Math.Round(d3, 3, MidpointRounding.ToEven); d4 = Math.Round(d4, 3, MidpointRounding.ToEven); d5 = Math.Round(d5, 3, MidpointRounding.ToEven); e.Row.Cells[16].Text = Base.monto_format2(d3); e.Row.Cells[17].Text = Base.monto_format2(d4); e.Row.Cells[18].Text = Base.monto_format2(d5); e.Row.Cells[0].Text = e.Row.Cells[21].Text; e.Row.Cells[21].Visible = false; G_SP_DIARIA.HeaderRow.Cells[21].Visible = false; } else { e.Row.Cells[14].Visible = false; G_SP_DIARIA.HeaderRow.Cells[14].Visible = false; e.Row.Cells[15].Visible = false; G_SP_DIARIA.HeaderRow.Cells[15].Visible = false; e.Row.Cells[16].Visible = false; G_SP_DIARIA.HeaderRow.Cells[16].Visible = false; e.Row.Cells[17].Visible = false; G_SP_DIARIA.HeaderRow.Cells[17].Visible = false; e.Row.Cells[18].Visible = false; G_SP_DIARIA.HeaderRow.Cells[18].Visible = false; e.Row.Cells[19].Visible = false; G_SP_DIARIA.HeaderRow.Cells[19].Visible = false; e.Row.Cells[20].Visible = false; G_SP_DIARIA.HeaderRow.Cells[20].Visible = false; e.Row.Cells[21].Visible = false; G_SP_DIARIA.HeaderRow.Cells[21].Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { //JQ_Datatable(); string id_prod = Request.QueryString["C"]; string compras = Request.QueryString["F"]; if (compras == "2") { bool prim = true; bool prim2 = true; DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.ultima_compra(id_prod, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); //foreach (DataRow r in total_dt.Rows) //{ // DataRow row; // row = costos_dt.NewRow(); // for (int i = 19; i < total_dt.Columns.Count; i++) // { // if (prim) // { // try // { // costos_dt.Columns.Add(total_dt.Columns[i].ColumnName); // costos_dt.Columns.Add("Fecha"); // } // catch { } // } // row[total_dt.Columns[i].ColumnName] = r[i].ToString(); // row["Fecha"] = r[7].ToString(); // } // costos_dt.Rows.Add(row); // prim = false; //} //foreach (DataRow r in total_dt.Rows) //{ // DataRow row; // row = general_dt.NewRow(); // for (int i = 0; i < 19; i++) // { // if (prim2) // { // try // { // general_dt.Columns.Add(total_dt.Columns[i].ColumnName); // } // catch { } // } // row[total_dt.Columns[i].ColumnName] = r[i].ToString(); // } // general_dt.Rows.Add(row); // prim = false; // break; //} G_GENERAL.DataSource = general_dt; G_GENERAL.DataBind(); G_GENERAL.Visible = true; GENERAL_DIV.Attributes["style"] = "display:none"; G_DETALLE_STOCK.DataSource = total_dt; G_DETALLE_STOCK.DataBind(); G_DETALLE_STOCK.Visible = true; normal.Attributes["style"] = "display:block"; } else if (compras == "1") { DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.ultimas_compra2(id_prod, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); //bool prim = true; //bool prim2 = true; //foreach (DataRow r in total_dt.Rows) //{ // DataRow row; // row = costos_dt.NewRow(); // for (int i = 19; i < total_dt.Columns.Count; i++) // { // if (prim) // { // try // { // costos_dt.Columns.Add(total_dt.Columns[i].ColumnName); // costos_dt.Columns.Add("Fecha"); // } // catch { } // } // row[total_dt.Columns[i].ColumnName] = r[i].ToString(); // row["Fecha"] = r[7].ToString(); // } // costos_dt.Rows.Add(row); // prim = false; //} //foreach (DataRow r in total_dt.Rows) //{ // DataRow row; // row = general_dt.NewRow(); // for (int i = 0; i < 19; i++) // { // if (prim2) // { // try // { // general_dt.Columns.Add(total_dt.Columns[i].ColumnName); // } // catch { } // } // row[total_dt.Columns[i].ColumnName] = r[i].ToString(); // } // general_dt.Rows.Add(row); // prim = false; // break; //} ////general_dt = ReporteRNegocio.ventas_stock(id_prod.Trim()); //G_GENERAL.DataSource = general_dt; //G_GENERAL.DataBind(); //G_GENERAL.Visible = true; //GENERAL_DIV.Attributes["style"] = "display:block"; G_GENERAL.DataSource = total_dt; G_GENERAL.DataBind(); G_GENERAL.Visible = true; GENERAL_DIV.Attributes["style"] = "display:block"; G_DETALLE_STOCK.DataSource = costos_dt; G_DETALLE_STOCK.DataBind(); G_DETALLE_STOCK.Visible = true; normal.Attributes["style"] = "display:none"; } else if (compras == "88") { DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.ultima_compra(id_prod, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string where = " and producto = '" + encriptador.DecryptData(id_prod.Replace(" ", "+")).Split('*')[0] + "' " + encriptador.DecryptData(id_prod.Replace(" ", "+")).Split('*')[1]; general_dt = ReporteRNegocio.ventas_stock(where); G_VENTAS.DataSource = general_dt; G_VENTAS.DataBind(); G_VENTAS.Visible = true; GENERAL_DIV.Attributes["style"] = "display:none"; normal.Attributes["style"] = "display:none"; VENTAS.Attributes["style"] = "display:block"; } else if (compras == "89") { string intvID = id_prod.Split('*')[0].ToString(); string desde = id_prod.Split('*')[1].ToString(); string hasta = id_prod.Split('*')[2].ToString(); string siteID = id_prod.Split('*')[3].ToString(); string RcpDate = ""; if (desde != "") { RcpDate += " and RcptDate >= convert(datetime, '" + desde + "',103)"; } if (hasta != "") { RcpDate += " and RcptDate <= convert(datetime, '" + hasta + "',103)"; } string where = " invtID = '" + intvID + "' " + RcpDate; DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.ultimas_compra3(where, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); G_GENERAL.DataSource = total_dt; G_GENERAL.DataBind(); G_GENERAL.Visible = true; GENERAL_DIV.Attributes["style"] = "display:block"; G_DETALLE_STOCK.DataSource = costos_dt; G_DETALLE_STOCK.DataBind(); G_DETALLE_STOCK.Visible = true; normal.Attributes["style"] = "display:none"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "teardsaeee", "<script> creagrilla(); </script>", false); } else if (compras == "90") { DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.ultima_compra(id_prod, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); clsCrypto.CL_Crypto encriptador = new clsCrypto.CL_Crypto("thi"); string producto = encriptador.DecryptData(id_prod.Replace(" ", " + ")).Split('*')[0]; string periodo = encriptador.DecryptData(id_prod.Replace(" ", " + ")).Split('*')[1]; string bodegas = encriptador.DecryptData(id_prod.Replace(" ", " + ")).Split('*')[2]; string where = " and producto = '" + producto + "' and periodo = " + periodo; if (bodegas != "") { where += " and bodega in (" + agregra_comillas(bodegas) + ")"; } general_dt = ReporteRNegocio.ventas_stock(where); G_VENTAS.DataSource = general_dt; G_VENTAS.DataBind(); G_VENTAS.Visible = true; GENERAL_DIV.Attributes["style"] = "display:none"; normal.Attributes["style"] = "display:none"; VENTAS.Attributes["style"] = "display:block"; } else if (compras == "91") { string intvID = id_prod.Split('*')[0].ToString(); string desde = id_prod.Split('*')[1].ToString(); string hasta = id_prod.Split('*')[2].ToString(); string siteID = id_prod.Split('*')[3].ToString(); string RcpDate = ""; if (desde != "") { //RcpDate += " and RcptDate >= convert(datetime, '" + desde + "',103)"; } if (hasta != "") { RcpDate += " and trandate <= convert(datetime, '" + hasta + "',103)"; } string where = " siteID= '" + siteID.Replace("'", "") + "' and invtID = '" + intvID + "' " + RcpDate; DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.historial_stock_diario(where, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); G_GENERAL.DataSource = total_dt; G_GENERAL.DataBind(); G_GENERAL.Visible = true; GENERAL_DIV.Attributes["style"] = "display:block"; G_DETALLE_STOCK.DataSource = costos_dt; G_DETALLE_STOCK.DataBind(); G_DETALLE_STOCK.Visible = true; normal.Attributes["style"] = "display:none"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "teardsaeee", "<script> creagrilla(); </script>", false); } else if (compras == "92") { //AJUSTES string intvID = id_prod.Split('*')[0].ToString(); string desde = id_prod.Split('*')[1].ToString(); string hasta = id_prod.Split('*')[2].ToString(); string PERIODO = id_prod.Split('*')[3].ToString(); string RcpDate = ""; //if (desde != "") //{ // RcpDate += " and RcptDate >= convert(datetime, '" + desde + "',103)"; //} //if (hasta != "") //{ // RcpDate += " and trandate <= convert(datetime, '" + hasta + "',103)"; //} RcpDate += " and convert(varchar, year(trandate),103 ) + right('0000' + convert(varchar, month(trandate),103 ),2) = '" + PERIODO + "'"; string where = " TRANTYPE= 'AJ' and invtID = '" + intvID + "' " + RcpDate; DataTable total_dt = new DataTable(); //costos total_dt = ReporteRNegocio.historial_stock_diario(where, compras); DataTable general_dt = new DataTable(); DataTable costos_dt = new DataTable(); G_GENERAL.DataSource = total_dt; G_GENERAL.DataBind(); G_GENERAL.Visible = true; GENERAL_DIV.Attributes["style"] = "display:block"; G_DETALLE_STOCK.DataSource = costos_dt; G_DETALLE_STOCK.DataBind(); G_DETALLE_STOCK.Visible = true; normal.Attributes["style"] = "display:none"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "teardsaeee", "<script> creagrilla(); </script>", false); } }