Exemple #1
0
        protected void lnk_litigios_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                DataTable dt;
                cLitigios oDetalle = new cLitigios(ref oConn);
                oDetalle.nKeyCliente = hdd_cliente.Value;
                oDetalle.CodHolding  = hdd_holding.Value;
                dt = oDetalle.getDetalle();
                gdDetalle.DataSource = dt;
                gdDetalle.DataBind();

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        toExcel.Visible = true;
                    }
                }
                dt = null;

                hdd_periodo.Value = string.Empty;
                num_factura.Text  = string.Empty;
                nom_cliente.Text  = string.Empty;
            }
            oConn.Close();
        }
        public void ProcessRequest(HttpContext context)
        {
            DataTable dt    = null;
            DBConn    oConn = new DBConn();

            if (oConn.Open())
            {
                cLitigios oDetalle = new cLitigios(ref oConn);
                oDetalle.nKeyCliente = oWeb.GetData("hdd_cliente");
                oDetalle.CodHolding  = oWeb.GetData("hdd_holding");

                if (!string.IsNullOrEmpty(oWeb.GetData("nom_cliente")))
                {
                    oDetalle.NomCliente = oWeb.GetData("nom_cliente");
                }

                if (!string.IsNullOrEmpty(oWeb.GetData("num_factura")))
                {
                    oDetalle.NumFactura = oWeb.GetData("num_factura");
                }

                if (!string.IsNullOrEmpty(oWeb.GetData("hdd_periodo")))
                {
                    oDetalle.Periodo = oWeb.GetData("hdd_periodo");
                    oDetalle.OrderBy = true;
                }

                dt = oDetalle.getDetalle();
            }
            oConn.Close();

            System.Web.HttpResponse oResponse = System.Web.HttpContext.Current.Response;
            XLWorkbook wb = new XLWorkbook();

            wb.Worksheets.Add(dt, "ReporteVentas");

            oResponse.Clear();
            oResponse.Buffer      = true;
            oResponse.Charset     = "";
            oResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            oResponse.AddHeader("content-disposition", "attachment;filename=Reporte_Litigios_" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx");
            using (MemoryStream MyMemoryStream = new MemoryStream())
            {
                wb.SaveAs(MyMemoryStream);
                MyMemoryStream.WriteTo(oResponse.OutputStream);
                oResponse.Flush();
                oResponse.End();
            }
        }
Exemple #3
0
        public void getDetalle()
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                DataTable dt;
                cLitigios oDetalle = new cLitigios(ref oConn);
                oDetalle.nKeyCliente = hdd_cliente.Value;
                oDetalle.CodHolding  = hdd_holding.Value;
                if (!string.IsNullOrEmpty(nom_cliente.Text))
                {
                    oDetalle.NomCliente = nom_cliente.Text;
                }
                if (!string.IsNullOrEmpty(num_factura.Text))
                {
                    oDetalle.NumFactura = num_factura.Text;
                }

                if (!string.IsNullOrEmpty(hdd_periodo.Value))
                {
                    oDetalle.Periodo = hdd_periodo.Value;
                    oDetalle.OrderBy = true;
                }
                dt = oDetalle.getDetalle();
                gdDetalle.DataSource = dt;
                gdDetalle.DataBind();

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        toExcel.Visible = true;
                    }
                }
                dt = null;
            }
            oConn.Close();
        }
Exemple #4
0
        protected void lnk_litigiosmayor_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                DataTable dt;
                cLitigios oDetalle = new cLitigios(ref oConn);
                oDetalle.nKeyCliente = hdd_cliente.Value;
                oDetalle.CodHolding  = hdd_holding.Value;
                if (!string.IsNullOrEmpty(nom_cliente.Text))
                {
                    oDetalle.NomCliente = nom_cliente.Text;
                }
                if (!string.IsNullOrEmpty(num_factura.Text))
                {
                    oDetalle.NumFactura = num_factura.Text;
                }
                oDetalle.Periodo = "mayor";
                oDetalle.OrderBy = true;
                dt = oDetalle.getDetalle();
                gdDetalle.DataSource = dt;
                gdDetalle.DataBind();

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        toExcel.Visible = true;
                    }
                }
                dt = null;

                hdd_periodo.Value = "mayor";
            }
            oConn.Close();
        }