Пример #1
0
 protected void btnRun_Click(object sender, EventArgs e)
 {
     hfSdate.Value = dpSdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
     hfEdate.Value = dpEdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
     RadHtmlChart2.DataBind();
     RadHtmlChart2.ChartTitle.Text = "All Members Chart (" + hfSdate.Value + " To " + hfEdate.Value + ")";
 }
        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();
        }
Пример #3
0
 protected void btnRun_Click(object sender, EventArgs e)
 {
     hfSdate.Value = dpSdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
     hfEdate.Value = dpEdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
     RadHtmlChart2.DataBind();
     RadHtmlChart2.ChartTitle.Text = "Members Chart (Yearly) " + hfSdate.Value + " To " + hfEdate.Value;
     RadHtmlChart2.PlotArea.YAxis.TitleAppearance.Text = "Members (" + dlGender.SelectedText + ")";
 }
Пример #4
0
        protected void btnRun_Click(object sender, EventArgs e)
        {
            hfSdate.Value = dpSdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
            hfEdate.Value = dpEdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
            reloadTuesdayPie();
            RadHtmlChart2.DataBind();

            RadHtmlChart2.ChartTitle.Text = "Tuesday Service Attendance Chart (" + hfSdate.Value + " To " + hfEdate.Value + ")";
        }
Пример #5
0
        protected void btnRun_Click(object sender, EventArgs e)
        {
            hfSdate.Value = dpSdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
            hfEdate.Value = dpEdate.SelectedDate.Value.ToString("dd-MMM-yyyy");
            RadHtmlChart2.DataBind();

            RadHtmlChart2.ChartTitle.Text = "Program Attendance Chart (" + hfSdate.Value + " To " + hfEdate.Value + ")";
            RadHtmlChart2.PlotArea.YAxis.TitleAppearance.Text = "Attendance (" + dlService.SelectedValue + ")";
        }
Пример #6
0
        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);
            }
        }
Пример #7
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)
        {
            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";
            }
        }
Пример #9
0
 protected void btnRun_Click(object sender, EventArgs e)
 {
     RadHtmlChart2.DataBind();
     RadHtmlChart2.ChartTitle.Text = "Data On " + dlService.SelectedText + ", " + dlServiceMode.SelectedText + " For " + dlMnth.SelectedText + " " + dlYear.SelectedText;
 }
Пример #10
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 gridFabStatus_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;

            for (int i = 0; i < item.Cells.Count; i++)
            {
                item.Cells[i].Text = item.Cells[i].Text.ToString(CultureInfo.InvariantCulture.NumberFormat);
            }

            double total_scope  = Convert.ToDouble(item.Cells[2].Text);
            double sg_done      = Convert.ToDouble(item.Cells[3].Text);
            double mat_avl      = Convert.ToDouble(item.Cells[4].Text);
            double jc_issued    = Convert.ToDouble(item.Cells[5].Text);
            double weld_done    = Convert.ToDouble(item.Cells[6].Text);
            double nde_done     = Convert.ToDouble(item.Cells[7].Text);
            double spl_paint    = Convert.ToDouble(item.Cells[8].Text);
            double sent_to_site = Convert.ToDouble(item.Cells[9].Text);

            var sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(sg_done * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(sg_done * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart2.DataSource = sg_dt;
            RadHtmlChart2.DataBind();

            sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(mat_avl * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(mat_avl * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart3.DataSource = sg_dt;
            RadHtmlChart3.DataBind();

            sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(jc_issued * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(jc_issued * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart4.DataSource = sg_dt;
            RadHtmlChart4.DataBind();


            sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(weld_done * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(weld_done * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart5.DataSource = sg_dt;
            RadHtmlChart5.DataBind();

            sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(nde_done * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(nde_done * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart6.DataSource = sg_dt;
            RadHtmlChart6.DataBind();

            sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(spl_paint * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(spl_paint * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart7.DataSource = sg_dt;
            RadHtmlChart7.DataBind();

            sg_dt = new DataTable();

            sg_dt.Columns.Add("SCOPE_TEXT");
            sg_dt.Columns.Add("SCOPE_VALUE");
            sg_dt.Columns.Add("COLOR_CODE");
            sg_dt.Rows.Add("SPOOLGEN PROGRESS", Math.Round(sent_to_site * 100 / total_scope, 1), "#4DCA5E");
            sg_dt.Rows.Add("BALANCE", Math.Round(100 - Math.Round(sent_to_site * 100 / total_scope, 1), 1), "#D6D6D6");
            RadHtmlChart8.DataSource = sg_dt;
            RadHtmlChart8.DataBind();
        }
    }
Пример #12
0
 protected void btnRun_Click(object sender, EventArgs e)
 {
     RadHtmlChart2.DataBind();
     RadHtmlChart2.ChartTitle.Text = dlCurrency.SelectedValue + " Payment For " + dlYear.SelectedText + " - " + dlPayFreq.SelectedValue;
 }
Пример #13
0
 protected void btnRun_Click(object sender, EventArgs e)
 {
     RadHtmlChart2.DataBind();
     RadHtmlChart2.ChartTitle.Text = dlCurrency.SelectedValue + " Contribution Comparison";
 }
Пример #14
0
 protected void btnRun_Click(object sender, EventArgs e)
 {
     RadHtmlChart2.DataBind();
     RadHtmlChart2.ChartTitle.Text = dlCurrency.SelectedValue + " Payment From " + dlYearFrom.SelectedText + " To " + dlYearTo.SelectedText;
 }
        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";
            }
        }