示例#1
0
        protected void btnExportar_Click(object sender, EventArgs e)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("SChqRef", typeof(string));
            dataTable.Columns.Add("SDesctrans", typeof(string));
            dataTable.Columns.Add("SFechaEfect", typeof(string));
            dataTable.Columns.Add("SFechaProc", typeof(string));
            dataTable.Columns.Add("SIndDebCre", typeof(string));
            dataTable.Columns.Add("SMonto", typeof(string));
            RespuestaStmrdsjv respuestaStmrdsjv = this.respuesta;

            if (respuestaStmrdsjv != null)
            {
                StmrdsjvDet[] stmrdsjvDetArray = respuestaStmrdsjv.stmjvCuentas.smtDetalle;
                for (int i = 0; i < (int)stmrdsjvDetArray.Length; i++)
                {
                    StmrdsjvDet stmrdsjvDet = stmrdsjvDetArray[i];
                    if (stmrdsjvDet != null)
                    {
                        DataRow sChqRef = dataTable.NewRow();
                        sChqRef["SChqRef"]    = stmrdsjvDet.SChqRef;
                        sChqRef["SDesctrans"] = stmrdsjvDet.SDesctrans;
                        DateTime fecha = Formatos.ISOToFecha(stmrdsjvDet.SFechaEfect);
                        sChqRef["SFechaEfect"] = fecha.ToString("dd/MM/yyyy");
                        DateTime dateTime = Formatos.ISOToFecha(stmrdsjvDet.SFechaProc);
                        sChqRef["SFechaProc"] = dateTime.ToString("dd/MM/yyyy");
                        sChqRef["SIndDebCre"] = stmrdsjvDet.SIndDebCre;
                        decimal num = Formatos.ISOToDecimal(stmrdsjvDet.SMonto);
                        if (stmrdsjvDet.SIndDebCre.Trim().Contains("0"))
                        {
                            num *= new decimal(-1);
                        }
                        sChqRef["SMonto"] = num;
                        dataTable.Rows.Add(sChqRef);
                    }
                }
                List <ExportUtils.ExportUtilDatos> exportUtilDatos = new List <ExportUtils.ExportUtilDatos>()
                {
                    new ExportUtils.ExportUtilDatos("Fecha Transacci&oacute;n", "SFechaProc", ExportUtils.Align.center, "", "#c12f2f", "#ffffff", false),
                    new ExportUtils.ExportUtilDatos("Fecha Efectiva", "SFechaEfect", ExportUtils.Align.center, "", "#c12f2f", "#ffffff", false),
                    new ExportUtils.ExportUtilDatos("Referencia", "SChqRef", ExportUtils.Align.center, "", "#c12f2f", "#ffffff", false),
                    new ExportUtils.ExportUtilDatos("Descripci&oacute;n", "SDesctrans", ExportUtils.Align.left, "", "#c12f2f", "#ffffff", false),
                    new ExportUtils.ExportUtilDatos("Monto", "SMonto", ExportUtils.Align.right, "", "#c12f2f", "#ffffff", false)
                };
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("<table>");
                stringBuilder.Append("<tr>");
                stringBuilder.Append("<td><b>Fecha:</b></td>");
                DateTime now = DateTime.Now;
                stringBuilder.Append(string.Concat("<td style='text-align:center;'>", now.ToString("dd/MM/yyyy"), "</td>"));
                stringBuilder.Append("</tr>");
                stringBuilder.Append("<tr>");
                stringBuilder.Append("<td><b>Criterio seleccionado:</b></td>");
                stringBuilder.Append(string.Concat("<td style='text-align:center;'>", this.liCritero.Text, "</td></tr>"));
                stringBuilder.Append("</table>");
                string[] afiliado = new string[] { "Movimientos_", base.Afiliado.sCedula, "_", null, null };
                afiliado[3] = DateTime.Now.ToString("ddMMyyyyhhmmss");
                afiliado[4] = ".xls";
                ExportUtils.Export2Excel(string.Concat(afiliado), stringBuilder.ToString(), dataTable, exportUtilDatos);
            }
        }
示例#2
0
        private void llenarGrid()
        {
            if (this.rdoDia.Checked)
            {
                this.tipoConsulta   = ConsultaMovimientoTipoConsulta.Dia;
                this.liCritero.Text = "Del Día";
            }
            if (this.rdoDiaAnt.Checked)
            {
                this.tipoConsulta   = ConsultaMovimientoTipoConsulta.DiaAnterior;
                this.liCritero.Text = "Del Día Anterior";
            }
            if (this.rdoMes.Checked)
            {
                this.tipoConsulta   = ConsultaMovimientoTipoConsulta.Mes;
                this.liCritero.Text = "Del Mes";
            }
            if (this.rdoMesAnt.Checked)
            {
                this.tipoConsulta   = ConsultaMovimientoTipoConsulta.MesAnterior;
                this.liCritero.Text = "Del Mes Anterior";
            }
            if (this.rdoUltimosMov.Checked)
            {
                this.tipoConsulta   = ConsultaMovimientoTipoConsulta.UltMovimientos;
                this.liCritero.Text = "Últimos movimientos";
            }
            if (this.rdoRango.Checked)
            {
                this.tipoConsulta   = ConsultaMovimientoTipoConsulta.RangoFecha;
                this.liCritero.Text = string.Concat("Rango de fechas del ", this.FD.Text, " al ", this.FH.Text);
                this.fechad         = DateTime.Parse(this.FD.Text);
                this.fechah         = DateTime.Parse(this.FH.Text);
                if (this.fechad > this.fechah)
                {
                    throw new Exception("La Fecha Desde no puede ser mayor a la Fecha Hasta");
                }
                if (DateAndTime.DateDiff(DateInterval.Day, this.fechad, this.fechah) > (long)60)
                {
                    throw new Exception("El rango de fechas a consultar no puede ser mayor a dos(2) meses");
                }
            }
            this.respuesta = HelperIbs.ibsConsultaMovimientos(base.Afiliado.AF_CodCliente, base.Afiliado.sAF_Rif, this.ddlCuenta.getCuenta().SNroCuenta, this.tipoConsulta, this.fechad, this.fechah, 20);
            List <MovimientosR> movimientosRs = new List <MovimientosR>();

            StmrdsjvDet[] stmrdsjvDetArray = this.respuesta.stmjvCuentas.smtDetalle;
            for (int i = 0; i < (int)stmrdsjvDetArray.Length; i++)
            {
                StmrdsjvDet stmrdsjvDet = stmrdsjvDetArray[i];
                if (stmrdsjvDet != null)
                {
                    MovimientosR movimientosR = new MovimientosR()
                    {
                        SChqRef     = stmrdsjvDet.SChqRef,
                        SDesctrans  = stmrdsjvDet.SDesctrans,
                        SFechaEfect = Formatos.ISOToFecha(stmrdsjvDet.SFechaEfect),
                        SFechaProc  = Formatos.ISOToFecha(stmrdsjvDet.SFechaProc),
                        SIndDebCre  = stmrdsjvDet.SIndDebCre
                    };
                    decimal num = Formatos.ISOToDecimal(stmrdsjvDet.SMonto);
                    if (stmrdsjvDet.SIndDebCre.Trim().Contains("0"))
                    {
                        num *= new decimal(-1);
                    }
                    movimientosR.SMonto = num;
                    movimientosRs.Add(movimientosR);
                }
            }
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            StringBuilder        stringBuilder        = new StringBuilder();

            stringBuilder.Append("<script>");
            stringBuilder.AppendFormat("myData = {0};loadTable();$('.iconconsultar').hide();", javaScriptSerializer.Serialize(movimientosRs));
            this.loaded = true;
            stringBuilder.Append("</script>");
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "MyData", stringBuilder.ToString(), false);
        }