protected void Page_Load(object sender, EventArgs e)
        {
            (Master.FindControl("pnlExtruder") as Panel).Visible = false;
            (Master.FindControl("levelTwoNavigationUserControl1").FindControl("lblformname") as Label).Text                  = "Pharmacy Dashboard";
            (Master.FindControl("levelTwoNavigationUserControl1").FindControl("patientLevelMenu") as Menu).Visible           = false;
            (Master.FindControl("levelTwoNavigationUserControl1").FindControl("PharmacyDispensingMenu") as Menu).Visible     = true;
            (Master.FindControl("levelTwoNavigationUserControl1").FindControl("UserControl_Alerts1") as UserControl).Visible = false;
            (Master.FindControl("levelTwoNavigationUserControl1").FindControl("PanelPatiInfo") as Panel).Visible             = false;
            if (!IsPostBack)
            {
                BindCombo();
            }

            ISCMReport objPODetails   = (ISCMReport)ObjectFactory.CreateInstance("BusinessProcess.SCM.BSCMReport, BusinessProcess.SCM");
            DataSet    theDTPODetails = objPODetails.PharmacyDashBoard(Convert.ToInt32(ddlStore.SelectedValue));

            RadHtmlChart1.DataSource = theDTPODetails.Tables[0];
            RadHtmlChart1.DataBind();

            RadHtmlChart2.DataSource = theDTPODetails.Tables[1];
            RadHtmlChart2.DataBind();

            grdDrugsRunningOut.DataSource = theDTPODetails.Tables[2];
            grdDrugsRunningOut.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         RadHtmlChart1.DataSource = GetData();
         RadHtmlChart1.DataBind();
     }
 }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ((Default2)Page).SetTitle("THỐNG KÊ TRONG NGÀY");
        PToThongKe pchart = new PToThongKe();

        RadHtmlChart1.DataSource = pchart.GetDoanhThuNgay();
        RadHtmlChart1.DataBind();
        //
        DonutChart1.DataSource = pchart.GetHangHoa();
        DonutChart1.DataBind();
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //ServiceReference1 sr = new ServiceReference1();

        ServiceReference2.Service1Client sc = new ServiceReference2.Service1Client();
        var a = sc.GetSaleData();

        RadHtmlChart1.DataSource = a;
        RadHtmlChart1.DataBind();

        RadHtmlChartGroupDataSource.GroupDataSource(RadHtmlChart2, GetRawDataSource(), "Year", "BarSeries", "Sales", "Quarter");
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Session["PatientId"]       = 0;
                Session["TechnicalAreaId"] = 206;
                ViewState["Facility"]      = null;
                if (!IsPostBack)
                {
                    BindCombo();
                }
                ISCMReport objPODetails   = (ISCMReport)ObjectFactory.CreateInstance("BusinessProcess.SCM.BSCMReport, BusinessProcess.SCM");
                DataSet    theDTPODetails = objPODetails.PharmacyDashBoard(Convert.ToInt32(ddlStore.SelectedValue));

                RadHtmlChart1.DataSource = theDTPODetails.Tables[0];
                RadHtmlChart1.DataBind();

                RadHtmlChart2.DataSource = theDTPODetails.Tables[1];
                RadHtmlChart2.DataBind();

                grdDrugsRunningOut.DataSource = theDTPODetails.Tables[2];
                grdDrugsRunningOut.DataBind();
                resizeScreen();
                (Master.FindControl("pnlExtruder") as Panel).Visible        = false;
                (Master.FindControl("level2Navigation") as Control).Visible = true;
                //(Master.FindControl("levelTwoNavigationUserControl1").FindControl("lblformname") as Label).Text = "Pharmacy Dashboard";
                (Master.FindControl("levelTwoNavigationUserControl1").FindControl("patientLevelMenu") as Menu).Visible           = false;
                (Master.FindControl("levelTwoNavigationUserControl1").FindControl("PharmacyDispensingMenu") as Menu).Visible     = true;
                (Master.FindControl("levelTwoNavigationUserControl1").FindControl("UserControl_Alerts1") as UserControl).Visible = false;
                (Master.FindControl("levelTwoNavigationUserControl1").FindControl("PanelPatiInfo") as Panel).Visible             = false;

                //(Master.FindControl("facilityBanner") as Control).Visible = false;
                //(Master.FindControl("patientBanner") as Control).Visible = false;
                //(Master.FindControl("username1") as Control).Visible = false;
                //(Master.FindControl("currentdate1") as Control).Visible = false;
                //(Master.FindControl("facilityName") as Control).Visible = false;
                //(Master.FindControl("imageFlipLevel2") as Control).Visible = false;
            }
            catch (Exception ex)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = ex.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
            }
        }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        negocio = new Implementacion();
        RadHtmlChart1.DataSource = negocio.GetDataTable("select top 10 totalRegistros, regErroneos, regCorrectos, convert(varchar,CreadoFecha,103) fecha from LogsJobs where tipoJob = 1 order by fecha desc");
        RadHtmlChart1.DataBind();

        AreaChart.DataSource = negocio.GetDataTable("select top 10 totalRegistros, regErroneos, regCorrectos, convert(varchar,CreadoFecha,103) fecha from LogsJobs where tipoJob = 2 order by fecha desc");
        AreaChart.DataBind();

        RadHtmlChart2.DataSource = negocio.GetDataTable("select top 1 (convert(decimal(18,2),totalRegistros)-convert(decimal(18,2),regErroneos))/convert(decimal(18,2),totalRegistros)*100 as porcentaje, 'Acividades' as label from LogsJobs where tipoJob = 1 " +
                                                        "union all " +
                                                        "select top 1 (convert(decimal(18,2),totalRegistros)-convert(decimal(18,2),regCorrectos))/convert(decimal(18,2),totalRegistros)*100 as porcentaje, 'Horas' as label from LogsJobs where tipoJob = 1");
        RadHtmlChart2.DataBind();

        RadHtmlChart3.DataSource = negocio.GetDataTable("select top 1 (convert(decimal(18,2),totalRegistros)-convert(decimal(18,2),regErroneos))/convert(decimal(18,2),totalRegistros)*100 as porcentaje, 'Actividades' as label from LogsJobs where tipoJob = 2 " +
                                                        "union all " +
                                                        "select top 1 (convert(decimal(18,2),totalRegistros)-convert(decimal(18,2),regCorrectos))/convert(decimal(18,2),totalRegistros)*100 as porcentaje, 'Horas' as label from LogsJobs where tipoJob = 2");
        RadHtmlChart3.DataBind();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            using (RevenueConnectEntities rce = new RevenueConnectEntities())
            {
                DateTime qdt = DateTime.Now.AddHours(-1);

                var opencounts     = rce.ContactRecords.Where(a => a.DispositionCode == "COMPLETE").Count();
                var partialcounts  = rce.ContactRecords.Where(a => (a.DispositionCode == "PROFILE" && a.CallStartDateTime < qdt)).Count();
                var sendnewcounts  = rce.QualifiedLeadSegments.Where(a => a.ContactSegmentStatus == "SENDNEW").Count();
                var sendagedcounts = rce.QualifiedLeadSegments.Where(a => a.ContactSegmentStatus == "SEND").Count();

                RadRadialCompletes.Pointer.Value = opencounts;
                Labelcomplete.Text = "Count: " + opencounts.ToString();
                RadRadialPartials.Pointer.Value = partialcounts;
                Labelpartial.Text = "Count: " + partialcounts.ToString();
                RadRadialSendnew.Pointer.Value = sendnewcounts;
                Labelsendnew.Text = "Count: " + sendnewcounts.ToString();

                RadRadialAged.Pointer.Value = sendagedcounts;
                Labelaged.Text = "Count: " + sendagedcounts.ToString();

                int rcount = 1;

                DataSet   ds = new DataSet("Bookstore");
                DataTable dt = new DataTable("Products");
                dt.Columns.Add("Id", Type.GetType("System.Int32"));
                dt.Columns.Add("Name", Type.GetType("System.String"));
                dt.Columns.Add("Count", Type.GetType("System.Double"));
                var quecounts = rce.QualifiedLeadSegments.GroupBy(p => p.ContactSegmentStatus).Select(g => new { name = g.Key, count = g.Count() }).Where(w => w.name.Contains("SEND_"));
                foreach (var rec in quecounts)
                {
                    dt.Rows.Add(rcount, rec.name, rec.count);

                    rcount++;
                }
                ds.Tables.Add(dt);
                RadHtmlChart1.DataSource = ds;
                RadHtmlChart1.DataBind();
            }
        }
        protected void btnGraph_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }
            try
            {
                if (grdDocumentos01.SelectedIndexes.Count > 0)
                {
                    var rowIndex = Convert.ToInt32(grdDocumentos01.SelectedIndexes[0]);
                    var rows     = (List <DataRow>)HttpContext.Current.Session["rows"];
                    var list     = new List <string>();
                    foreach (var column in rows[rowIndex].Table.Columns)
                    //GrdMarkBook is Data Grid name
                    {
                        string HeaderName = column.ToString();

                        //  This line Used for find any Column Have Name With Exam
                        if (HeaderName.Contains("201") && !HeaderName.Contains("Variaci"))
                        {
                            list.Add(HeaderName);
                        }
                    }

                    var source = new List <MesCosto>();

                    foreach (string name in list)
                    {
                        var objCast = string.IsNullOrEmpty(rows[rowIndex][name].ToString())
                            ? "0"
                            : rows[rowIndex][name].ToString();
                        var elemento = new MesCosto
                        {
                            mes           = name.ToString(),
                            costoUnitario = Convert.ToDecimal(objCast)
                        };

                        source.Add(elemento);
                    }

                    RadHtmlChart1.Visible    = true;
                    grdDocumentos01.Visible  = false;
                    PanelGraph.Visible       = true;
                    PanelGrid.Visible        = false;
                    btnBack.Visible          = true;
                    btnGraph.Visible         = false;
                    RadHtmlChart1.DataSource = source;
                    RadHtmlChart1.DataBind();
                }

                else
                {
                    rwmReporte.RadAlert("Ud. Debe seleccionar una fila", 500, 100, "Error al mostrar imagen", "");
                }
            }
            catch (Exception ex)
            {
                rwmReporte.RadAlert(ex.Message, 500, 100, "Error al mostrar imagen", "");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (!Page.IsPostBack)
                {
                    LoginWCF.LoginWCFClient objLoginWCF = new LoginWCF.LoginWCFClient();
                    objLoginWCF.AuditoriaMenu_Registrar(System.Web.HttpContext.Current.Request.Url.AbsolutePath, Environment.MachineName,
                                                        ((Usuario_LoginResult)System.Web.HttpContext.Current.Session["Usuario"]).idUsuario);

                    if (!string.IsNullOrEmpty(Request.QueryString["objCliente"]))
                    {
                        List <string> objCliente = JsonHelper.JsonDeserialize <List <string> >(Request.QueryString["objCliente"]);


                        var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                        var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                        EstadoCuentaWCFClient objEstadoCuentaWCF = new EstadoCuentaWCFClient();
                        var lstSource = objEstadoCuentaWCF.EstadoCuenta_GraficoPie(idEmpresa, codigoUsuario, objCliente[0]
                                                                                   , objCliente[1], Convert.ToDateTime(objCliente[2]), Convert.ToDateTime(objCliente[3])
                                                                                   , Convert.ToDateTime(objCliente[4]), Convert.ToDateTime(objCliente[5]), Convert.ToInt32(objCliente[6]));

                        var porcentajeCancelados = (lstSource.Count(x => x.FechaVencimiento < x.fechaRenovacion) * 100) / lstSource.Count();

                        var lstChart = new List <ChartClass>();

                        var noVencidos = new ChartClass {
                            AxisX = "Letras No Vencidas", SerieDecimal = 100 - porcentajeCancelados
                        };
                        lstChart.Add(noVencidos);
                        var vencidos = new ChartClass {
                            AxisX = "Letras Vencidas", SerieDecimal = porcentajeCancelados
                        };
                        lstChart.Add(vencidos);

                        RadHtmlChart1.ChartTitle.Text = "Letras Emitidas hasta " + objCliente[3];

                        RadHtmlChart1.DataSource = lstChart;
                        RadHtmlChart1.DataBind();

                        var lstSource01 = objEstadoCuentaWCF.EstadoCuenta_LetrasPorEstados(idEmpresa, codigoUsuario, objCliente[0]
                                                                                           , objCliente[1], Convert.ToDateTime(objCliente[2]), Convert.ToDateTime(objCliente[3])
                                                                                           , Convert.ToDateTime(objCliente[4]), Convert.ToDateTime(objCliente[5]), Convert.ToInt32(objCliente[6]));

                        int contadorLetrasEstados = lstSource01.Count();

                        var lstEstados = new List <string>
                        {
                            "Letra en Descuento",
                            "Letra en Cobranza",
                            "Cancelado",
                            "Letra Renovada",
                            "Letra Protestada",
                            "Letra en Garantia"
                        };

                        var lstChart01 = new List <ChartClass>();
                        foreach (var item in lstEstados)
                        {
                            int sum = lstSource01.Count(x => x.nombreEstado == item);
                            lstChart01.Add(new ChartClass {
                                AxisX = item, SerieDecimal = ((sum * 100) / contadorLetrasEstados)
                            });
                        }
                        RadHtmlChart2.DataSource = lstChart01;
                        RadHtmlChart2.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                //lblMensaje.Text = "ERROR: " + ex.Message;
                //lblMensaje.CssClass = "mensajeError";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            using (RevenueConnectEntities rce = new RevenueConnectEntities())
            {
                DateTime qdt = DateTime.Now.AddHours(-1);

                int rcount = 1;

                int acceptedcount;
                int rejectedcount;
                int unknowncount;
                int limitcount;
                int queuedcount;


                DataSet   ds = new DataSet("Campaigns");
                DataTable dt = new DataTable("Counts");
                dt.Columns.Add("Id", Type.GetType("System.String"));
                dt.Columns.Add("AcceptedCount", Type.GetType("System.Double"));
                dt.Columns.Add("RejectedCount", Type.GetType("System.Double"));
                dt.Columns.Add("UnknownCount", Type.GetType("System.Double"));
                dt.Columns.Add("LimitCount", Type.GetType("System.Double"));
                dt.Columns.Add("QueuedCount", Type.GetType("System.Double"));

                int    curcamp = 0;
                string campname;
                int    lastpros = 0;
                acceptedcount = 0;
                rejectedcount = 0;
                unknowncount  = 0;
                limitcount    = 0;
                queuedcount   = 0;

                var query = (from t in rce.QualifiedLeadSegments join c in rce.CAMPAIGNS on t.Campaign_ID equals c.CAMPAIGN_ID
                             where c.ACTIVE == true
                             group t by new { t.Campaign_ID, t.ContactSegmentStatus }
                             into grp
                             select new
                {
                    grp.Key.Campaign_ID,
                    grp.Key.ContactSegmentStatus,
                    Quantity = grp.Count()
                }).OrderBy(grp => grp.Campaign_ID).ToList();

                foreach (var rec in query)
                {
                    if (rec.Campaign_ID == curcamp || curcamp == 0)
                    {
                        if (curcamp == 0)
                        {
                            curcamp = rec.Campaign_ID;
                        }
                        if (rec.ContactSegmentStatus.Contains("SEND"))
                        {
                            queuedcount += rec.Quantity;
                        }
                        else
                        {
                            switch (rec.ContactSegmentStatus)
                            {
                            case "ACCEPTED":
                                acceptedcount += rec.Quantity;
                                break;

                            case "REJECTED":
                                rejectedcount += rec.Quantity;
                                break;

                            case "UNKNOWN":
                                unknowncount += rec.Quantity;
                                break;

                            case "LIMIT":
                                limitcount += rec.Quantity;
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (curcamp != 0)
                        {
                            string campn = rce.CAMPAIGNS.Where(c => c.CAMPAIGN_ID == curcamp).FirstOrDefault().NAME;
                            dt.Rows.Add(campn + "(" + curcamp + ")", acceptedcount, rejectedcount, unknowncount, limitcount, queuedcount);
                            lastpros      = curcamp;
                            curcamp       = rec.Campaign_ID;
                            acceptedcount = 0;
                            rejectedcount = 0;
                            unknowncount  = 0;
                            limitcount    = 0;
                            queuedcount   = 0;
                            if (rec.ContactSegmentStatus.Contains("SEND"))
                            {
                                queuedcount += rec.Quantity;
                            }
                            else
                            {
                                switch (rec.ContactSegmentStatus)
                                {
                                case "ACCEPTED":
                                    acceptedcount += rec.Quantity;
                                    break;

                                case "REJECTED":
                                    rejectedcount += rec.Quantity;
                                    break;

                                case "UNKNOWN":
                                    unknowncount += rec.Quantity;
                                    break;

                                case "LIMIT":
                                    limitcount += rec.Quantity;
                                    break;
                                }
                            }
                        }
                    }
                }
                if (lastpros != curcamp)
                {
                    string campn = rce.CAMPAIGNS.Where(c => c.CAMPAIGN_ID == curcamp).FirstOrDefault().NAME;
                    dt.Rows.Add(campn + "(" + curcamp + ")", acceptedcount, rejectedcount, unknowncount, limitcount, queuedcount);
                }

                ds.Tables.Add(dt);
                RadHtmlChart1.DataSource = ds;
                RadHtmlChart1.DataBind();
            }
        }
示例#11
0
        protected void btnGraph_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            try
            {
                if (grdDocumentos01.SelectedIndexes.Count > 0)
                {
                    var rowIndex = Convert.ToInt32(grdDocumentos01.SelectedIndexes[0]);
                    //var rows = (List<DataRow>)HttpContext.Current.Session["rows"];
                    List <Reporte_CostoVentaResult> listaSource = (List <Reporte_CostoVentaResult>)HttpContext.Current.Session["rows"];
                    int?kardex = listaSource[rowIndex].Kardex;

                    int mesInicio = dpFecInicio.SelectedDate.Value.Month;
                    int mesFin    = dpFecFinal.SelectedDate.Value.Month;

                    var listaFiltro = (from tbl in listaSource
                                       where tbl.Kardex == kardex
                                       group tbl by new { tbl.Kardex, tbl.Descripcion } into KardexAgrupado
                                       select new
                    {
                        nroKardex = KardexAgrupado.Key.Kardex,
                        Descripcion = KardexAgrupado.Key.Descripcion,
                        Enero = KardexAgrupado.Sum(x => x.MG_Enero),
                        Febrero = KardexAgrupado.Sum(x => x.MG_Febrero),
                        Marzo = KardexAgrupado.Sum(x => x.MG_Marzo),
                        Abril = KardexAgrupado.Sum(x => x.MG_Abril),
                        Mayo = KardexAgrupado.Sum(x => x.MG_Mayo),
                        Junio = KardexAgrupado.Sum(x => x.MG_Junio),
                        Julio = KardexAgrupado.Sum(x => x.MG_Julio),
                        Agosto = KardexAgrupado.Sum(x => x.MG_Agosto),
                        Setiembre = KardexAgrupado.Sum(x => x.MG_Setiembre),
                        Octubre = KardexAgrupado.Sum(x => x.MG_Octubre),
                        Noviembre = KardexAgrupado.Sum(x => x.MG_Noviembre),
                        Diciembre = KardexAgrupado.Sum(x => x.MG_Diciembre)
                    }).ToList();

                    if (listaFiltro.Count == 1)
                    {
                        List <MesCosto> source = new List <MesCosto>();

                        Dictionary <int, string> MesesAnio = new Dictionary <int, string>();
                        MesesAnio.Add(1, "Enero");
                        MesesAnio.Add(2, "Febrero");
                        MesesAnio.Add(3, "Marzo");
                        MesesAnio.Add(4, "Abril");
                        MesesAnio.Add(5, "Mayo");
                        MesesAnio.Add(6, "Junio");
                        MesesAnio.Add(7, "Julio");
                        MesesAnio.Add(8, "Agosto");
                        MesesAnio.Add(9, "Setiembre");
                        MesesAnio.Add(10, "Octubre");
                        MesesAnio.Add(11, "Noviembre");
                        MesesAnio.Add(12, "Diciembre");


                        if (mesInicio > mesFin)
                        {
                            mesFin = mesFin + 12;
                        }

                        int difMeses = (mesFin - mesInicio) + 1;

                        for (int i = 0; i <= difMeses - 1; i++)
                        {
                            string cadena_mes = "";
                            //string cadena_anio = "";

                            if ((mesInicio + i) > 12)
                            {
                                cadena_mes = MesesAnio[(mesInicio + i) - 12];
                                //cadena_anio = fechaFinal.Year.ToString();
                            }
                            else
                            {
                                cadena_mes = MesesAnio[mesInicio + i];
                                //cadena_anio = fechaInicio.Year.ToString();
                            }

                            MesCosto itemMes = new MesCosto();
                            itemMes.mes = cadena_mes;

                            switch (cadena_mes)
                            {
                            case "Enero":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Enero);
                                break;

                            case "Febrero":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Febrero);
                                break;

                            case "Marzo":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Marzo);
                                break;

                            case "Abril":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Abril);
                                break;

                            case "Mayo":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Mayo);
                                break;

                            case "Junio":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Junio);
                                break;

                            case "Julio":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Julio);
                                break;

                            case "Agosto":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Agosto);
                                break;

                            case "Setiembre":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Setiembre);
                                break;

                            case "Octubre":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Octubre);
                                break;

                            case "Noviembre":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Noviembre);
                                break;

                            case "Diciembre":
                                itemMes.costoUnitario = Convert.ToDecimal(listaFiltro[0].Diciembre);
                                break;

                            default:
                                itemMes.costoUnitario = 0;
                                break;
                            }

                            //itemMes.costoUnitario = listaFiltro[0].


                            source.Add(itemMes);
                        }

                        lblTitulo.Text = "Costo de ventas por producto " + dpFecInicio.SelectedDate.Value.Month.ToString("00") + "-" + dpFecInicio.SelectedDate.Value.Year.ToString() +
                                         " hasta " + dpFecFinal.SelectedDate.Value.Month.ToString("00") + "-" + dpFecFinal.SelectedDate.Value.Year.ToString();

                        RadHtmlChart1.ChartTitle.Text = "Fluctuación del % Margen Unitario por Kardex " + kardex.ToString().Trim()
                                                        + " : " + listaFiltro[0].Descripcion;

                        RadHtmlChart1.Visible    = true;
                        grdDocumentos01.Visible  = false;
                        PanelGraph.Visible       = true;
                        PanelGrid.Visible        = false;
                        btnBack.Visible          = true;
                        btnGraph.Visible         = false;
                        RadHtmlChart1.DataSource = source;
                        RadHtmlChart1.DataBind();
                    }
                }
                else
                {
                    throw new System.ArgumentException("Por favor seleccione un registro de la lista de Costos de Ventas");
                }
            }
            catch (ArgumentException ex1) {
                rwmReporte.RadAlert(ex1.Message, 300, 120, "Mensaje", "");
            }
            catch (Exception ex)
            {
                rwmReporte.RadAlert(ex.Message, 500, 100, "Error al mostrar imagen", "");
            }
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (!Page.IsPostBack)
                {
                    LoginWCF.LoginWCFClient objLoginWCF = new LoginWCF.LoginWCFClient();
                    objLoginWCF.AuditoriaMenu_Registrar(System.Web.HttpContext.Current.Request.Url.AbsolutePath, Environment.MachineName,
                                                        ((Usuario_LoginResult)System.Web.HttpContext.Current.Session["Usuario"]).idUsuario);

                    if (!string.IsNullOrEmpty(Request.QueryString["objCliente"]))
                    {
                        List <string> objCliente = JsonHelper.JsonDeserialize <List <string> >(Request.QueryString["objCliente"]);


                        var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                        var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                        EstadoCuentaWCFClient objEstadoCuentaWCF = new EstadoCuentaWCFClient();
                        var lstSource = objEstadoCuentaWCF.EstadoCuenta_LetrasVencPorPlazo(idEmpresa, codigoUsuario, objCliente[0]
                                                                                           , objCliente[1], Convert.ToDateTime(objCliente[2]), Convert.ToDateTime(objCliente[3])
                                                                                           , Convert.ToDateTime(objCliente[4]), Convert.ToDateTime(objCliente[5]));

                        var lstPlazos = new List <int>
                        {
                            30,
                            45,
                            60,
                            90,
                            120
                        };

                        List <GS_GetLetrasVencPorPlazoResult> lstFiltrada = lstSource.Where(x => x.DiasMora > 0 && x.DiasMora < x.DiasCredito).ToList();

                        var lstChart = new List <ChartClass>();

                        foreach (var item in lstPlazos)
                        {
                            int sum = 0;
                            switch (item)
                            {
                            case 30:
                                sum = lstFiltrada.Count(x => x.DiasCreditoDoc > 0 && x.DiasCreditoDoc <= item);
                                lstChart.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFiltrada.Count())
                                });
                                break;

                            case 45:
                                sum = lstFiltrada.Count(x => x.DiasCreditoDoc > 30 && x.DiasCreditoDoc <= item);
                                lstChart.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFiltrada.Count())
                                });
                                break;

                            case 60:
                                sum = lstFiltrada.Count(x => x.DiasCreditoDoc > 45 && x.DiasCreditoDoc <= item);
                                lstChart.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFiltrada.Count())
                                });
                                break;

                            case 90:
                                sum = lstFiltrada.Count(x => x.DiasCreditoDoc > 60 && x.DiasCreditoDoc <= item);
                                lstChart.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFiltrada.Count())
                                });
                                break;

                            case 120:
                                sum = lstFiltrada.Count(x => x.DiasCreditoDoc > 90);
                                lstChart.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFiltrada.Count())
                                });
                                break;
                            }
                        }

                        RadHtmlChart1.ChartTitle.Text = "Letras Vencidas hasta " + objCliente[3];

                        RadHtmlChart1.DataSource = lstChart;
                        RadHtmlChart1.DataBind();

                        var lstFacturaSource = objEstadoCuentaWCF.EstadoCuenta_FacturasVencPorPlazo(idEmpresa, codigoUsuario, objCliente[0]
                                                                                                    , objCliente[1], Convert.ToDateTime(objCliente[2]), Convert.ToDateTime(objCliente[3])
                                                                                                    , Convert.ToDateTime(objCliente[4]), Convert.ToDateTime(objCliente[5]));


                        List <GS_GetFacturasVencPorPlazoResult> lstFacturaFiltrada = lstFacturaSource.Where(x => x.DiasMora > 0 && x.DiasMora < x.DiasCredito).ToList();

                        var lstChartFactura = new List <ChartClass>();

                        foreach (var item in lstPlazos)
                        {
                            int sum = 0;
                            switch (item)
                            {
                            case 30:
                                sum = lstFacturaFiltrada.Count(x => x.DiasCreditoDoc > 0 && x.DiasCreditoDoc <= item);
                                lstChartFactura.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFacturaFiltrada.Count())
                                });
                                break;

                            case 45:
                                sum = lstFacturaFiltrada.Count(x => x.DiasCreditoDoc > 30 && x.DiasCreditoDoc <= item);
                                lstChartFactura.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFacturaFiltrada.Count())
                                });
                                break;

                            case 60:
                                sum = lstFacturaFiltrada.Count(x => x.DiasCreditoDoc > 45 && x.DiasCreditoDoc <= item);
                                lstChartFactura.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFacturaFiltrada.Count())
                                });
                                break;

                            case 90:
                                sum = lstFacturaFiltrada.Count(x => x.DiasCreditoDoc > 60 && x.DiasCreditoDoc <= item);
                                lstChartFactura.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFacturaFiltrada.Count())
                                });
                                break;

                            case 120:
                                sum = lstFacturaFiltrada.Count(x => x.DiasCreditoDoc > 90);
                                lstChartFactura.Add(new ChartClass {
                                    AxisX = item.ToString(), SerieDecimal = ((sum * 100) / lstFacturaFiltrada.Count())
                                });
                                break;
                            }
                        }

                        RadHtmlChart2.ChartTitle.Text = "Facturas Vencidas hasta " + objCliente[3];

                        RadHtmlChart2.DataSource = lstChartFactura;
                        RadHtmlChart2.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                //lblMensaje.Text = "ERROR: " + ex.Message;
                //lblMensaje.CssClass = "mensajeError";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (!Page.IsPostBack)
                {
                    LoginWCF.LoginWCFClient objLoginWCF = new LoginWCF.LoginWCFClient();
                    objLoginWCF.AuditoriaMenu_Registrar(System.Web.HttpContext.Current.Request.Url.AbsolutePath, Environment.MachineName,
                                                        ((Usuario_LoginResult)System.Web.HttpContext.Current.Session["Usuario"]).idUsuario);

                    if (!string.IsNullOrEmpty(Request.QueryString["objCliente"]))
                    {
                        List <string> objCliente = JsonHelper.JsonDeserialize <List <string> >(Request.QueryString["objCliente"]);


                        var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                        var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                        EstadoCuentaWCFClient objEstadoCuentaWCF = new EstadoCuentaWCFClient();
                        var lstSource = objEstadoCuentaWCF.EstadoCuenta_LetrasVencPorPlazo(idEmpresa, codigoUsuario, objCliente[0]
                                                                                           , objCliente[1], Convert.ToDateTime(objCliente[2]), Convert.ToDateTime(objCliente[3])
                                                                                           , Convert.ToDateTime(objCliente[4]), Convert.ToDateTime(objCliente[5]));


                        var porcentajeVencMayorPlazo = (lstSource.Count(x => x.DiasMora > 0 && x.DiasMora > x.DiasCredito) * 100) / lstSource.Count();

                        var lstChart = new List <ChartClass>();

                        var noVencidos = new ChartClass {
                            AxisX = "Letras Vencidas Menor al Plazo", SerieDecimal = 100 - porcentajeVencMayorPlazo
                        };
                        lstChart.Add(noVencidos);
                        var vencidos = new ChartClass {
                            AxisX = "Letras Vencidas Mayor al plazo", SerieDecimal = porcentajeVencMayorPlazo
                        };
                        lstChart.Add(vencidos);

                        RadHtmlChart1.ChartTitle.Text = "Letras Vencidas hasta " + objCliente[3];

                        RadHtmlChart1.DataSource = lstChart;
                        RadHtmlChart1.DataBind();

                        var lstFacturaSource = objEstadoCuentaWCF.EstadoCuenta_FacturasVencPorPlazo(idEmpresa, codigoUsuario, objCliente[0]
                                                                                                    , objCliente[1], Convert.ToDateTime(objCliente[2]), Convert.ToDateTime(objCliente[3])
                                                                                                    , Convert.ToDateTime(objCliente[4]), Convert.ToDateTime(objCliente[5]));


                        var porcentajeFactVencMayorPlazo = (lstFacturaSource.Count(x => x.DiasMora > 0 && x.DiasMora > x.DiasCredito) * 100) / lstSource.Count();

                        var lstFacturaChart = new List <ChartClass>();

                        var facturasNoVencidas = new ChartClass {
                            AxisX = "Facturas Vencidas Menor al Plazo", SerieDecimal = 100 - porcentajeFactVencMayorPlazo
                        };
                        lstFacturaChart.Add(facturasNoVencidas);
                        var facturasVencidas = new ChartClass {
                            AxisX = "Facturas Vencidas Mayor al plazo", SerieDecimal = porcentajeFactVencMayorPlazo
                        };
                        lstFacturaChart.Add(facturasVencidas);

                        RadHtmlChart2.ChartTitle.Text = "Facturas Vencidas hasta " + objCliente[3];

                        RadHtmlChart2.DataSource = lstFacturaChart;
                        RadHtmlChart2.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                //lblMensaje.Text = "ERROR: " + ex.Message;
                //lblMensaje.CssClass = "mensajeError";
            }
        }