Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["IDU"] != null &&
                Request["IDP"] != null &&
                Request["Y"] != null &&
                Request["M"] != null &&
                Request["DS"] != null &&
                Request["DE"] != null &&
                Request["HS"] != null &&
                Request["HE"] != null)
            {
                int IDU = int.Parse(Request["IDU"].ToString());
                int IDP = int.Parse(Request["IDP"].ToString());
                int Y   = int.Parse(Request["Y"].ToString());
                int M   = int.Parse(Request["M"].ToString());
                int DS  = int.Parse(Request["DS"].ToString());
                int DE  = int.Parse(Request["DE"].ToString());
                int HS  = int.Parse(Request["HS"].ToString());
                int HE  = int.Parse(Request["HE"].ToString());



                DateTime DateStart = new DateTime(Y, M, DS, HS, 0, 0);
                DateTime DateEnd   = new DateTime(Y, M, DE, HE, 0, 0);

                System.Collections.Generic.List <Turno> LT = Turno.GetTurnosByPeriod(DateStart, DateEnd, IDU, "Finalizado");
                if (LT != null)
                {
                    Session.Add("result", LT);
                }
                else
                {
                    Session.Remove("result");
                }


                UserController UC = new UserController();
                UserInfo       UI = UC.GetUser(IDP, IDU);

                Establecimiento.Text  = "___________________________________________________";
                IndependenciaNro.Text = "________________";
                Departamento.Text     = "________________";


                if (UI != null)
                {
                    NombreMedico.Text = UI.FirstName + " " + UI.LastName;
                    if (UI.Profile.GetPropertyValue("Puesto") != "")
                    {
                        Servicio.Text = UI.Profile.GetPropertyValue("Puesto");
                    }
                    else
                    {
                        Servicio.Text = "No definido";
                    }
                    Mes.Text = DateTime.Now.ToString("MMMM", CultureInfo.CreateSpecificCulture("es"));
                    Año.Text = DateTime.Now.Year.ToString();
                }
                else
                {
                }
            }
        }
Example #2
0
        protected void GenerateC2()
        {
            RV.LocalReport.ReportPath = MapPath("/DesktopModules/Planillas/Reports/ReportC2.rdlc");
            List <ConnectionDispensario.Modelos.Reporting.C2Item> itemsC2 = new List <ConnectionDispensario.Modelos.Reporting.C2Item>();
            int Month = int.Parse(Request["month"].ToString());
            int year  = int.Parse(Request["year"].ToString());
            //Buscar dentro de los usuarios que cumplan con el servicio
            string nombreservicio = "";

            if (Request["service"] != null)
            {
                //DotNetNuke.Entities.Portals.PortalController PC = new DotNetNuke.Entities.Portals.PortalController();



                ConnectionDispensario.Modelos.Servicio Service = ConnectionDispensario.Modelos.Servicio.ObtenerServicioById(int.Parse(Request["service"].ToString()));
                nombreservicio = Service.NOMBRE;

                for (int dia = 0; dia < DateTime.DaysInMonth(year, Month); dia++)
                {
                    itemsC2.Add(new ConnectionDispensario.Modelos.Reporting.C2Item());
                    itemsC2[dia].Dia = dia + 1;
                    List <Jornada> ListaJornadas   = Jornada.SelectClosedJornadasByDateAndIdService(year, Month, dia + 1, Service.ID);
                    decimal        horasdeconsulta = 0;
                    if (ListaJornadas != null)
                    {
                        foreach (Jornada j in ListaJornadas)
                        {
                            List <Turno> T = Turno.GetTurnosByPeriod(j.Start, j.End.Value, j.USERID.Value, "Finalizado");
                            horasdeconsulta            += (decimal)((j.End.Value - j.Start).TotalMinutes / 60);
                            itemsC2[dia].HorasAtencion += horasdeconsulta;
                            if (T != null)
                            {
                                foreach (Turno t in T)
                                {
                                    if (t.Pac != null)
                                    {
                                        Paciente p   = t.Pac;
                                        int      age = ConnectionDispensario.Utils.Conversiones.getAge(p.FECHA_NACIMIENTO);
                                        string   sex = "";
                                        if (p.SEXO == "Masculino")
                                        {
                                            sex = "m";
                                        }
                                        else
                                        {
                                            sex = "f";
                                        }



                                        itemsC2[dia].TotalTotal++;

                                        if (sex == "m")
                                        {
                                            itemsC2[dia].Totalm++;
                                            if (age < 1)
                                            {
                                                itemsC2[dia].Menor1m++;
                                            }
                                            if (age == 1)
                                            {
                                                itemsC2[dia].Ano1m++;
                                            }
                                            if (age > 1 && age < 5)
                                            {
                                                itemsC2[dia].Ano2a4m++;
                                            }
                                            if (age > 4 && age < 10)
                                            {
                                                itemsC2[dia].Ano5a9m++;
                                            }
                                            if (age > 9 && age < 15)
                                            {
                                                itemsC2[dia].Ano10a14m++;
                                            }
                                            if (age > 14 && age < 50)
                                            {
                                                itemsC2[dia].Ano15a49m++;
                                            }
                                            if (age > 49)
                                            {
                                                itemsC2[dia].Ano50ymasm++;
                                            }
                                        }
                                        else
                                        {
                                            itemsC2[dia].Totalf++;
                                            if (age < 1)
                                            {
                                                itemsC2[dia].Menor1f++;
                                            }
                                            if (age == 1)
                                            {
                                                itemsC2[dia].Ano1f++;
                                            }
                                            if (age > 1 && age < 5)
                                            {
                                                itemsC2[dia].Ano2a4f++;
                                            }
                                            if (age > 4 && age < 10)
                                            {
                                                itemsC2[dia].Ano5a9f++;
                                            }
                                            if (age > 9 && age < 15)
                                            {
                                                itemsC2[dia].Ano10a14f++;
                                            }
                                            if (age > 14 && age < 50)
                                            {
                                                itemsC2[dia].Ano15a49f++;
                                            }
                                            if (age > 49)
                                            {
                                                itemsC2[dia].Ano50ymasf++;
                                            }
                                        }

                                        if (t.ControlEmbarazo == true)
                                        {
                                            itemsC2[dia].TotalPregnant++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            ReportDataSource RDS = new ReportDataSource("DataSetC2", itemsC2);

            RV.LocalReport.DataSources.Add(RDS);
            RV.LocalReport.SetParameters(new ReportParameter[] {
                new ReportParameter("Establecimiento", "Dispensario Municipal \"Dr. H Weihmuller\""),
                new ReportParameter("Departamento", "Gral. San Martin"),
                new ReportParameter("NombreServicio", nombreservicio),
                new ReportParameter("CodigoEstablecimiento", "4200026"),
                new ReportParameter("CodigoServicio", "..."),
                new ReportParameter("Mes", Month.ToString()),
                new ReportParameter("Anio", year.ToString())
            });
        }