예제 #1
0
 public DashboardHistoryController(IDashboardModelFactory dashboardModelFactory,
                                   IOrganigramaModelFactory organigramaModelFactory,
                                   IEmployeeFormatModelFactory employeeFormatModelFactory)
 {
     this._dashboardModelFactory      = dashboardModelFactory;
     this._organigramaModelFactory    = organigramaModelFactory;
     this._employeeFormatModelFactory = employeeFormatModelFactory;
 }
예제 #2
0
        public JsonResult GenerateIncidenciaReportData(string dateIni, string dateFin,
                                                       [FromServices] IDashboardModelFactory dashboardModelFactory,
                                                       [FromServices] IRepository <EmployeeFormat> employeeFormatRepository,
                                                       [FromServices] IRepository <DocumentType> documentTypeRepository,
                                                       [FromServices] IEmployeeFormatModelFactory employeeFormatModelFactory)
        {
            List <ReportEmployeeDetailModel> modelFaltas        = new List <ReportEmployeeDetailModel>();
            List <ReportEmployeeDetailModel> modelIncapacidades = new List <ReportEmployeeDetailModel>();
            List <ReportEmployeeDetailModel> modelVacaciones    = new List <ReportEmployeeDetailModel>();
            List <ReportEmployeeDetailModel> modelPermisos      = new List <ReportEmployeeDetailModel>();


            var dias = Math.Abs(Math.Round((DateTime.Parse(dateIni) - DateTime.Parse(dateFin)).TotalDays, 0));

            if (dias == 0)
            {
                dias = 1;
            }

            for (int i = 0; i < dias; i++)
            {
                var t       = DateTime.Parse(dateIni).AddDays(i);
                var results = dashboardModelFactory.GetNoRegistry(t.ToShortDateString());
                modelFaltas.AddRange(results);

                var formats = employeeFormatModelFactory.GetAllApprovedFormats(t);

                var f = formats.Where(d => d.FormatName.ToLower().Contains("incapacidad"));
                modelIncapacidades.AddRange(f.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId
                }));

                var g = formats.Where(d => d.FormatName.ToLower().Contains("vacacion"));
                modelVacaciones.AddRange(g.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId
                }));

                var p = formats.Where(d => d.FormatName.ToLower().Contains("permiso"));
                modelPermisos.AddRange(p.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId
                }));
            }


            var data = new {
                incapacidades      = modelIncapacidades.ToArray(),
                incapacidadesTotal = modelIncapacidades.Count,
                faltas             = modelFaltas.ToArray(),
                faltastotal        = modelFaltas.Count,
                vacaciones         = modelVacaciones.ToArray(),
                totalvacaciones    = modelVacaciones.Count,
                permisos           = modelPermisos.ToArray(),
                totalpermisos      = modelPermisos.Count
            };


            return(Json(data));
        }
예제 #3
0
        public FileResult PrintIncidenciaReportData(string dateIni, string dateFin,
                                                    [FromServices] IDashboardModelFactory dashboardModelFactory,
                                                    [FromServices] IEmployeeFormatModelFactory employeeFormatModelFactory,
                                                    [FromServices] SARH.Core.Configuration.IConfigurationManager configManager)
        {
            List <ReportEmployeeDetailModel> model = new List <ReportEmployeeDetailModel>();

            var dias = Math.Abs(Math.Round((DateTime.Parse(dateIni) - DateTime.Parse(dateFin)).TotalDays, 0));

            if (dias == 0)
            {
                dias = 1;
            }

            for (int i = 0; i < dias; i++)
            {
                var t       = DateTime.Parse(dateIni).AddDays(i);
                var results = dashboardModelFactory.GetNoRegistry(t.ToShortDateString());
                model.AddRange(results);

                var formats = employeeFormatModelFactory.GetAllApprovedFormats(t);

                var f = formats.Where(d => d.FormatName.ToLower().Contains("incapacidad"));
                model.AddRange(f.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId,
                    Type       = 2
                }));

                var g = formats.Where(d => d.FormatName.ToLower().Contains("vacacion"));
                model.AddRange(g.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId,
                    Type       = 3
                }));

                var p = formats.Where(d => d.FormatName.ToLower().Contains("permiso"));
                model.AddRange(p.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId,
                    Type       = 4
                }));
            }

            IConfigPdf config = new ConfigPdf()
            {
                FontPathPdf     = configManager.FontPathPdf,
                ImgPathPdf      = configManager.ImgPathPdf,
                FontPathBarCode = configManager.FontPathBarCode
            };
            PdfManager manager = new PdfManager(config);


            string fileName = $"{Path.GetTempPath()}IncidenciasPeriodo-{dateIni.Replace("/", string.Empty)}-{dateFin.Replace("/", string.Empty)}.pdf";

            if (System.IO.File.Exists(fileName))
            {
                System.IO.File.Delete(fileName);
            }

            try
            {
                manager.CreateIncidenciasReport(new Core.PdfCreator.FormatData.DocumentInfoPdfData()
                {
                    TitleDocumento    = "Reporte Diario de Incidencias",
                    FormatId          = $"{dateIni}-{dateFin}",
                    IncidenciasReport = model.Select(n => new Core.PdfCreator.FormatData.ReportEmployeeDetail()
                    {
                        Area       = n.Area,
                        DetailType = n.DetailType,
                        Fecha      = n.Fecha,
                        JobCenter  = n.JobCenter,
                        JobTitle   = n.JobTitle,
                        ID         = n.ID,
                        Name       = n.Name,
                        Type       = n.Type
                    }).ToList()
                }, fileName);
            }
            catch (Exception ex)
            {
                byte[] FileBytesError = System.Text.Encoding.UTF8.GetBytes(ex.Message);
                return(File(FileBytesError, "text/plain"));
            }


            byte[] FileBytes = System.IO.File.ReadAllBytes(fileName);
            return(File(FileBytes, "application/pdf"));
        }
예제 #4
0
        public FileResult ExportIncidenciaReportData(string dateIni, string dateFin,
                                                     [FromServices] IDashboardModelFactory dashboardModelFactory,
                                                     [FromServices] IEmployeeFormatModelFactory employeeFormatModelFactory)
        {
            List <ReportEmployeeDetailModel> model = new List <ReportEmployeeDetailModel>();


            var dias = Math.Abs(Math.Round((DateTime.Parse(dateIni) - DateTime.Parse(dateFin)).TotalDays, 0));

            if (dias == 0)
            {
                dias = 1;
            }

            for (int i = 0; i < dias; i++)
            {
                var t       = DateTime.Parse(dateIni).AddDays(i);
                var results = dashboardModelFactory.GetNoRegistry(t.ToShortDateString());
                model.AddRange(results);

                var formats = employeeFormatModelFactory.GetAllApprovedFormats(t);

                var f = formats.Where(d => d.FormatName.ToLower().Contains("incapacidad"));
                model.AddRange(f.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId,
                    Type       = 2
                }));

                var g = formats.Where(d => d.FormatName.ToLower().Contains("vacacion"));
                model.AddRange(g.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId,
                    Type       = 3
                }));

                var p = formats.Where(d => d.FormatName.ToLower().Contains("permiso"));
                model.AddRange(p.Select(h => new ReportEmployeeDetailModel()
                {
                    Area       = h.Area,
                    JobCenter  = h.Centro,
                    JobTitle   = h.JobTitle,
                    Fecha      = $"{h.StartDate} - {h.EndDate}",
                    Name       = h.Name,
                    DetailType = h.Comments,
                    ID         = h.EmployeeId,
                    Type       = 4
                }));
            }


            var sb = new StringBuilder();

            sb.Append("Id Empleado,Nombre,Area,Centro,Puesto,Periodo,Observaciones,Tipo");

            model.ForEach(d =>
            {
                sb.AppendLine();
                sb.Append($"{d.ID},{d.Name},{d.Area},{d.JobCenter},{d.JobTitle},{d.Fecha},{d.DetailType},{GetTypeModel(d.Type)}");
            });

            return(File(new System.Text.UTF8Encoding().GetBytes(sb.ToString()), "text/csv", $"IncidenciasPeriodo-{dateIni.Replace("/",string.Empty)}-{dateFin.Replace("/",string.Empty)}.csv"));
        }
예제 #5
0
 public HomeController(IDashboardModelFactory dashboardModelFactory,
                       IEmployeeFormatModelFactory employeeFormatModelFactory)
 {
     this._dashboardModelFactory      = dashboardModelFactory;
     this._employeeFormatModelFactory = employeeFormatModelFactory;
 }
예제 #6
0
        public FileResult PrintVacationFormat(int idFormat,
                                              [FromServices] IEmployeeFormatModelFactory employeeFormatModelFactory,
                                              [FromServices] SARH.Core.Configuration.IConfigurationManager configManager,
                                              [FromServices] IOrganigramaModelFactory organigramaModelFactory,
                                              [FromServices] INomipaqEmployeeVacationModelFactory nomipaqVacationModelFactory)
        {
            IConfigPdf config = new ConfigPdf()
            {
                FontPathPdf     = configManager.FontPathPdf,
                ImgPathPdf      = configManager.ImgPathPdf,
                FontPathBarCode = configManager.FontPathBarCode
            };
            PdfManager manager = new PdfManager(config);

            var    format    = employeeFormatModelFactory.GetformatInfo(idFormat);
            var    formats   = employeeFormatModelFactory.GetAllFormatsByEmployee(format.EmployeeId);
            string path      = System.IO.Path.GetTempPath();
            string empId     = int.Parse(format.EmployeeId).ToString("00000");
            var    vacations = nomipaqVacationModelFactory.GetEmployeeVacations(int.Parse(format.EmployeeId).ToString("00000"));

            Core.PdfCreator.FormatData.FormatVacationData vacationInfo = new Core.PdfCreator.FormatData.FormatVacationData();

            var empInfo = organigramaModelFactory.GetEmployeeData(format.EmployeeId);

            var sustitute = organigramaModelFactory.GetEmployeeData(format.Suplente);

            if (vacations != null)
            {
                var formatDays = (DateTime.Parse(format.EndDate) - DateTime.Parse(format.StartDate)).TotalDays + 1;
                vacationInfo = new Core.PdfCreator.FormatData.FormatVacationData()
                {
                    AñosCumplidos          = vacations.Antiguedad.ToString("00"),
                    DiasGozado             = vacations.DiasTomados.ToString(),
                    DiasPendinteAñoAnteior = vacations.TotalDias.ToString(),
                    DiasPorAño             = vacations.DiasPorAño.ToString(),
                    DiasPorGozar           = vacations.DiasDisponibles.ToString(),
                    FechaIngreso           = empInfo.GeneralInfo.HireDate,
                    PorGozar        = Math.Round((vacations.DiasDisponibles - formatDays), 0).ToString(),
                    DiasSolicitados = formatDays.ToString("00"),
                    FechaInicial    = format.StartDate,
                    FechaFinal      = format.EndDate
                };
            }

            string fileName = $"{path}FormatNumber{idFormat}.pdf";

            if (System.IO.File.Exists(fileName))
            {
                System.IO.File.Delete(fileName);
            }

            try
            {
                manager.CreateVacationFormat(new Core.PdfCreator.FormatData.DocumentInfoPdfData()
                {
                    TitleDocumento = "SOLICITUD DE VACACIONES",
                    FormatId       = $"Fecha de Solicitud: {format.FechaSolicitud}",
                    Area           = empInfo.Area,
                    JobTitle       = empInfo.GeneralInfo.JobTitle,
                    EmployeeName   = $"{empInfo.GeneralInfo.FirstName} {empInfo.GeneralInfo.LastName} {empInfo.GeneralInfo.LastName2}",
                    EmployeInfo    = new Core.PdfCreator.FormatData.EmployeeInfoData()
                    {
                        EmployeeId      = empInfo.GeneralInfo.Id,
                        EmployeeName    = $"{empInfo.GeneralInfo.FirstName} {empInfo.GeneralInfo.LastName} {empInfo.GeneralInfo.LastName2}",
                        Rfc             = empInfo.GeneralInfo.RFC,
                        Curp            = empInfo.GeneralInfo.CURP,
                        NSS             = empInfo.GeneralInfo.NSS,
                        BrithDate       = empInfo.GeneralInfo.FechaNacimiento,
                        HireDate        = empInfo.GeneralInfo.HireDate,
                        FireDate        = "N/A",
                        PhotoPath       = empInfo.GeneralInfo.Picture,
                        PersonalPhone   = empInfo.PersonalInfo.Phone,
                        CellNumber      = empInfo.PersonalInfo.CellPhone,
                        PersonalEmail   = empInfo.PersonalInfo.Email,
                        Address         = empInfo.PersonalInfo.Address,
                        City            = empInfo.PersonalInfo.City,
                        State           = empInfo.PersonalInfo.State,
                        Cp              = empInfo.PersonalInfo.Zip,
                        ContactName     = empInfo.EmergencyData.Name,
                        ContactRelation = empInfo.EmergencyData.Relacion,
                        ContactPhone    = empInfo.EmergencyData.Phone,
                        JobTitle        = empInfo.GeneralInfo.JobTitle
                    },
                    EmployeeSustitute = new Core.PdfCreator.FormatData.FormatEmployeeSustitute()
                    {
                        Name     = $"{sustitute.GeneralInfo.FirstName} {sustitute.GeneralInfo.LastName} {sustitute.GeneralInfo.LastName2}",
                        JobTitle = sustitute.GeneralInfo.JobTitle
                    },
                    FormatVacationData = vacationInfo
                }, fileName);
            }
            catch (Exception ex)
            {
                byte[] FileBytesError = System.Text.Encoding.UTF8.GetBytes(ex.Message);
                return(File(FileBytesError, "text/plain"));
            }


            byte[] FileBytes = System.IO.File.ReadAllBytes(fileName);
            return(File(FileBytes, "application/pdf"));
        }
예제 #7
0
        public FileResult PrintCurrentFormat(int idFormat,
                                             [FromServices] IEmployeeFormatModelFactory employeeFormatModelFactory,
                                             [FromServices] SARH.Core.Configuration.IConfigurationManager configManager,
                                             [FromServices] IOrganigramaModelFactory organigramaModelFactory)
        {
            IConfigPdf config = new ConfigPdf()
            {
                FontPathPdf     = configManager.FontPathPdf,
                ImgPathPdf      = configManager.ImgPathPdf,
                FontPathBarCode = configManager.FontPathBarCode
            };
            PdfManager manager = new PdfManager(config);

            var    format  = employeeFormatModelFactory.GetformatInfo(idFormat);
            var    formats = employeeFormatModelFactory.GetAllFormatsByEmployee(format.EmployeeId);
            string path    = System.IO.Path.GetTempPath();
            string empId   = int.Parse(format.EmployeeId).ToString("00000");

            var empInfo = organigramaModelFactory.GetEmployeeData(format.EmployeeId);

            var sustitute = organigramaModelFactory.GetEmployeeData(format.Suplente);

            string fileName = $"{path}FormatNumber{idFormat}.pdf";

            if (System.IO.File.Exists(fileName))
            {
                System.IO.File.Delete(fileName);
            }

            try
            {
                manager.CreatePermissionFormat(new Core.PdfCreator.FormatData.DocumentInfoPdfData()
                {
                    TitleDocumento = "SOLICITUD DE PERMISOS",
                    FormatId       = $"Fecha de Solicitud: {format.FechaSolicitud}",
                    Area           = empInfo.Area,
                    JobTitle       = empInfo.GeneralInfo.JobTitle,
                    EmployeeName   = $"{empInfo.GeneralInfo.FirstName} {empInfo.GeneralInfo.LastName} {empInfo.GeneralInfo.LastName2}",
                    EmployeInfo    = new Core.PdfCreator.FormatData.EmployeeInfoData()
                    {
                        EmployeeId      = empInfo.GeneralInfo.Id,
                        EmployeeName    = $"{empInfo.GeneralInfo.FirstName} {empInfo.GeneralInfo.LastName} {empInfo.GeneralInfo.LastName2}",
                        Rfc             = empInfo.GeneralInfo.RFC,
                        Curp            = empInfo.GeneralInfo.CURP,
                        NSS             = empInfo.GeneralInfo.NSS,
                        BrithDate       = empInfo.GeneralInfo.FechaNacimiento,
                        HireDate        = empInfo.GeneralInfo.HireDate,
                        FireDate        = "N/A",
                        PhotoPath       = empInfo.GeneralInfo.Picture,
                        PersonalPhone   = empInfo.PersonalInfo.Phone,
                        CellNumber      = empInfo.PersonalInfo.CellPhone,
                        PersonalEmail   = empInfo.PersonalInfo.Email,
                        Address         = empInfo.PersonalInfo.Address,
                        City            = empInfo.PersonalInfo.City,
                        State           = empInfo.PersonalInfo.State,
                        Cp              = empInfo.PersonalInfo.Zip,
                        ContactName     = empInfo.EmergencyData.Name,
                        ContactRelation = empInfo.EmergencyData.Relacion,
                        ContactPhone    = empInfo.EmergencyData.Phone,
                        JobTitle        = empInfo.GeneralInfo.JobTitle
                    },
                    EmployeeSustitute = new Core.PdfCreator.FormatData.FormatEmployeeSustitute()
                    {
                        Name     = $"{sustitute.GeneralInfo.FirstName} {sustitute.GeneralInfo.LastName} {sustitute.GeneralInfo.LastName2}",
                        JobTitle = sustitute.GeneralInfo.JobTitle
                    },
                    FormatPermission = new Core.PdfCreator.FormatData.FormatPermissionData()
                    {
                        Cause            = format.Comments,
                        DateStart        = format.StartDate,
                        DateEnd          = format.EndDate,
                        TimeStart        = format.StartTime,
                        TimeEnd          = format.EndTime,
                        Comments         = format.AdditionalInfo,
                        TotalPermissions = formats.Count()
                    }
                }, fileName);
            }
            catch (Exception ex)
            {
                byte[] FileBytesError = System.Text.Encoding.UTF8.GetBytes(ex.Message);
                return(File(FileBytesError, "text/plain"));
            }


            byte[] FileBytes = System.IO.File.ReadAllBytes(fileName);
            return(File(FileBytes, "application/pdf"));
        }
예제 #8
0
        public JsonResult ProcesstIncidents(string iDate, string eDate,
                                            [FromServices] IRepository <EmployeeDiscount> discountRepo,
                                            [FromServices] IOrganigramaModelFactory organimgramaModelFactory,
                                            [FromServices] IDashboardModelFactory dashboardModelFactory,
                                            [FromServices] IRepository <NOMIPAQIncidence> nomiPAQIncidence,
                                            [FromServices] IEmployeeFormatModelFactory employeeFormatModelFactory,
                                            [FromServices] IRepository <NOMIPAQVacation> nomiPAQVacation,
                                            [FromServices] INomipaqIncidenciasModelFactory nomipaqincidenciasModelFactory)
        {
            var employeess = organimgramaModelFactory.GetAllData();
            List <PersonalDashboardData> personalData      = new List <PersonalDashboardData>();
            List <EmployeeIncidents>     employeeIncidents = new List <EmployeeIncidents>();

            var formatos = employeeFormatModelFactory.GetAllFormats(DateTime.Parse(iDate), DateTime.Parse(eDate));

            if (formatos.Any())
            {
                formatos.Where(f => f.Approved == true && f.FormatName.ToLower().Contains("vacacion")).ToList().ForEach(t =>
                {
                    List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
                    parameters.Add(new KeyValuePair <string, string>("@fechaInicio", t.StartDate));
                    parameters.Add(new KeyValuePair <string, string>("@fechaFin", t.EndDate));
                    parameters.Add(new KeyValuePair <string, string>("@fechaPago", t.FechaSolicitud));
                    parameters.Add(new KeyValuePair <string, string>("@EMP", t.EmployeeId));
                    nomiPAQVacation.GetStoredProcData("VacacionesNominPAQ", parameters);
                });
            }

            employeess.Employess.ToList().ForEach(emp =>
            {
                var dashInfo = dashboardModelFactory.GetPersonalDashboardData(int.Parse(emp.Id).ToString("00000"), DateTime.Parse(iDate), DateTime.Parse(eDate));
                personalData.Add(dashInfo);
            });

            personalData.ForEach(emp =>
            {
                if (emp.PorcentajeRetardos > 0)
                {
                    int veces    = 0;
                    bool process = false;
                    emp.Days.Where(r => r.RetardoEntrada.Equals(1)).ToList().ForEach(day =>
                    {
                        DateTime dateA = DateTime.Parse($"{day.RegisterDate} {day.StartJobDay}");
                        DateTime dateB = DateTime.Parse($"{day.RegisterDate} {day.StartWorkDate}");

                        var diff = (dateA - dateB).TotalMinutes;

                        if (diff < 11 && !process)
                        {
                            veces++;
                            if (veces == 3)
                            {
                                employeeIncidents.Add(new EmployeeIncidents()
                                {
                                    Employee  = emp.EmployeeId,
                                    Mnemonico = "RET1",
                                    Period    = day.RegisterDate
                                });
                                process = true;
                            }
                        }

                        if (diff < 61 && !process)
                        {
                            employeeIncidents.Add(new EmployeeIncidents()
                            {
                                Employee  = emp.EmployeeId,
                                Mnemonico = "RET2",
                                Period    = day.RegisterDate
                            });
                            process = true;
                        }

                        if (diff < 121 && !process)
                        {
                            employeeIncidents.Add(new EmployeeIncidents()
                            {
                                Employee  = emp.EmployeeId,
                                Mnemonico = "RET3",
                                Period    = day.RegisterDate
                            });
                            process = true;
                        }
                    });
                }
            });

            if (formatos.Any())
            {
                var formatApproved = formatos.Where(f => f.Approved == true && f.FormatName.ToLower().Contains("permiso")).ToList();

                formatApproved.ToList().ForEach(t =>
                {
                    string mnemonico = string.Empty;
                    if (t.AdditionalInfo.Equals("Con goce de sueldo"))
                    {
                        mnemonico = "PCS";
                    }
                    else
                    {
                        mnemonico = "PSS";
                    }
                    employeeIncidents.Add(new EmployeeIncidents()
                    {
                        Employee  = int.Parse(t.EmployeeId).ToString("00000"),
                        Period    = t.StartDate,
                        Mnemonico = mnemonico
                    });
                });
            }

            var dias = Math.Abs(Math.Round((DateTime.Parse(iDate) - DateTime.Parse(eDate)).TotalDays, 0));

            if (dias == 0)
            {
                dias = 1;
            }

            for (int i = 0; i < dias; i++)
            {
                var t       = DateTime.Parse(iDate).AddDays(i);
                var results = dashboardModelFactory.GetNoRegistry(t.ToShortDateString());
                results.ForEach(f =>
                {
                    employeeIncidents.Add(new EmployeeIncidents()
                    {
                        Employee  = int.Parse(f.ID).ToString("00000"),
                        Period    = f.Fecha,
                        Mnemonico = "FINJ"
                    });
                });
            }

            var incidencias = nomipaqincidenciasModelFactory.GetAllIncidencias();

            var incidenciasNomipaq = incidencias.Where(g => g.Fecha >= DateTime.Parse(iDate) && g.Fecha <= (DateTime.Parse(eDate)));


            if (employeeIncidents.Any())
            {
                employeeIncidents.ForEach(item =>
                {
                    List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
                    parameters.Add(new KeyValuePair <string, string>("@Empleado", item.Employee));
                    parameters.Add(new KeyValuePair <string, string>("@TipoIncidencia", item.Mnemonico));
                    parameters.Add(new KeyValuePair <string, string>("@fecha", item.Period));
                    nomiPAQIncidence.GetStoredProcData("IncidenciasNominPAQ", parameters);
                });
            }

            return(Json("Ok"));
        }