Example #1
0
        public ActionResult Index(string m)
        {
            PrintedFormsModel model = new PrintedFormsModel();

            model.Message = m;
            var realRole = Role.GetRealRole(CurrentUser);

            if (!(realRole == Role.Administrator || realRole == Role.AdministratorBSO))
            {
                if (realRole == Role.ResponsibleBSO)
                {
                    model.BSOReportForm10Full.DeliveryPoints = ReferencesProvider.GetDeliveryPointsForResponsibleBSO(CurrentUser.Id, false);
                    model.BSOReportForm10.DeliveryPoints     = ReferencesProvider.GetDeliveryPointsForResponsibleBSO(CurrentUser.Id, false);
                    model.SNILSReport.DeliveryPoints         = ReferencesProvider.GetDeliveryPointsForResponsibleBSO(CurrentUser.Id, false);
                }
                else
                {
                    model.BSOReportForm10Full.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    model.BSOReportForm10.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    model.SNILSReport.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                }
            }

            return(View(model));
        }
Example #2
0
        public ActionResult GetBSOReportForm10Full(BSOReportForm10FullModel model)
        {
            string       delivery     = string.Empty;
            BSOListModel bsoListModel = new BSOListModel();

            bsoListModel.SearchCriteriaModel.StatusDateFrom = model.DateForm10FullFrom;
            bsoListModel.SearchCriteriaModel.StatusDateTo   = model.DateForm10FullTo;

            List <string> ListDelivery = new List <string>();
            List <ReferenceUniversalItem> ListDeliveryPointUniversal = referenceBusinessLogic.GetUniversalList(Constants.DeliveryPointRef);
            List <DeliveryCenter>         listDeliveryCenter         = referenceBusinessLogic.GetDeliveryCenterList();

            //для Администраторов ограничений по точкам - нет
            if (Role.Administrator.Id == Role.GetRealRole(CurrentUser).Id || Role.AdministratorBSO.Id == Role.GetRealRole(CurrentUser).Id)
            {
                if (model.DeliveryPointIds.Count > 0)
                {
                    bsoListModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    foreach (var item in model.DeliveryPointIds)
                    {
                        delivery = listDeliveryCenter.Where(a => a.Id == ListDeliveryPointUniversal.Where(b => b.Id == item).Select(c => c.DeliveryCenterId).FirstOrDefault()).Select(d => d.DisplayName).FirstOrDefault();
                        ListDelivery.Add(delivery);
                    }
                }
                else
                {
                    delivery = "Все точки";
                }
            }
            else
            {   //для ответственного
                if (Role.ResponsibleBSO == Role.GetRealRole(CurrentUser))
                {
                    if (model.DeliveryPointIds.Count > 0)
                    {
                        bsoListModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    }
                    else
                    {//все точки для ответственного
                        model.DeliveryPoints = ReferencesProvider.GetDeliveryPointsForResponsibleBSO(CurrentUser.Id, false);
                        foreach (var item in model.DeliveryPoints)
                        {
                            if (item.Value != "")
                            {
                                model.DeliveryPointIds.Add(long.Parse(item.Value));
                            }
                        }
                        bsoListModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    }
                    foreach (var item in model.DeliveryPointIds)
                    {
                        delivery = listDeliveryCenter.Where(a => a.Id == ListDeliveryPointUniversal.Where(b => b.Id == item).Select(c => c.DeliveryCenterId).FirstOrDefault()).Select(d => d.DisplayName).FirstOrDefault();
                        ListDelivery.Add(delivery);
                    }
                }
                else
                {
                    //для всех остальных, только по их собственной точке
                    bsoListModel.SearchCriteriaModel.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    model.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    delivery = listDeliveryCenter.Where(a => a.Id == ListDeliveryPointUniversal.Where(b => b.Id == CurrentUser.DeliveryPoint.Id).Select(c => c.DeliveryCenterId).FirstOrDefault()).Select(d => d.DisplayName).FirstOrDefault();
                    ListDelivery.Add(delivery);
                }
            }
            BSOSearchCriteria criteria           = bsoListModel.SearchCriteriaModel.GetBSOSearchCriteria();
            List <BSOInfo>    listBSOinRangeDate = bsoBusinessLogic.BSO_Find(
                criteria,
                new List <SortCriteria <BSOSortField> >(),
                new PageRequest()
            {
                PageNumber = 1, PageSize = int.MaxValue
            }).Data;

            List <BSOHistoryItem> listHistory = new List <BSOHistoryItem>();

            if (listBSOinRangeDate.Count > 0)
            {
                List <long> listBSO_IDs = listBSOinRangeDate.Select(a => a.Id).ToList();
                listHistory = bsoBusinessLogic.BSO_GetListHistory(new DateTime(2000, 1, 1), (DateTime)bsoListModel.SearchCriteriaModel.StatusDateTo, listBSO_IDs);
            }

            List <BSOInfo> listBSOBeforeDate = bsoBusinessLogic.BSO_Find(
                new BSOSearchCriteria()
            {
                StatusDateTo     = bsoListModel.SearchCriteriaModel.StatusDateFrom,
                DeliveryPointIds = bsoListModel.SearchCriteriaModel.DeliveryPointIds
            },
                new List <SortCriteria <BSOSortField> >(),
                new PageRequest()
            {
                PageNumber = 1, PageSize = int.MaxValue
            }).Data;

            List <BSOInfo> listBSOAllDate = bsoBusinessLogic.BSO_Find(
                new BSOSearchCriteria()
            {
                StatusDateTo     = bsoListModel.SearchCriteriaModel.StatusDateTo,
                DeliveryPointIds = bsoListModel.SearchCriteriaModel.DeliveryPointIds
            },
                new List <SortCriteria <BSOSortField> >(),
                new PageRequest()
            {
                PageNumber = 1, PageSize = int.MaxValue
            }).Data;


            //фильтруем по DeliveryPointId
            //if (dicDeliveryPoint.Count > 0)
            //{
            //    listHistory = listHistory.Where(a => dicDeliveryPoint.Keys.Contains(a.DeliveryPointId)).ToList();
            //}

            BSOReportForm10Full printedForm = new BSOReportForm10Full(listHistory, listBSOBeforeDate, listBSOinRangeDate, listBSOAllDate, ListDelivery.Distinct().ToList(), model.DateForm10FullFrom, model.DateForm10FullTo, CurrentUser);

            return(File(printedForm.GetExcel(),
                        System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("Отчет по движению ВС с группировкой по пулам номеров БСО. Форма №10.xls")));
        }
Example #3
0
        public ActionResult GetBSOReportForm10(BSOReportForm10Model model)
        {
            string       NameDeliveryPoint = string.Empty;
            BSOListModel bsoListModel      = new BSOListModel();

            bsoListModel.SearchCriteriaModel.StatusDateFrom = model.DateForm10From;
            bsoListModel.SearchCriteriaModel.StatusDateTo   = model.DateForm10To;
            //для Администраторов ограничений по точкам - нет
            if (Role.Administrator.Id == Role.GetRealRole(CurrentUser).Id || Role.AdministratorBSO.Id == Role.GetRealRole(CurrentUser).Id)
            {
                if (model.DeliveryPointIds.Count > 0)
                {
                    bsoListModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    foreach (var item in model.DeliveryPointIds)
                    {
                        NameDeliveryPoint = NameDeliveryPoint + ", " + model.DeliveryPoints.Where(a => a.Value == item.ToString()).Select(b => b.Text).FirstOrDefault();
                    }
                    NameDeliveryPoint = NameDeliveryPoint.Trim(',', ' ');
                }
                else
                {
                    NameDeliveryPoint = "Все точки";
                }
            }
            else
            {   //для ответственного
                if (Role.ResponsibleBSO == Role.GetRealRole(CurrentUser))
                {
                    if (model.DeliveryPointIds.Count > 0)
                    {
                        bsoListModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    }
                    else
                    {//все точки для ответственного
                        model.DeliveryPoints = ReferencesProvider.GetDeliveryPointsForResponsibleBSO(CurrentUser.Id, false);
                        foreach (var item in model.DeliveryPoints)
                        {
                            if (item.Value != "")
                            {
                                model.DeliveryPointIds.Add(long.Parse(item.Value));
                            }
                        }
                        bsoListModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    }

                    foreach (var item in model.DeliveryPointIds)
                    {
                        NameDeliveryPoint = NameDeliveryPoint + ", " + model.DeliveryPoints.Where(a => a.Value == item.ToString()).Select(b => b.Text).FirstOrDefault();
                    }
                    NameDeliveryPoint = NameDeliveryPoint.Trim(',', ' ');
                }
                else
                {
                    //для всех остальных, только по их собственной точке
                    bsoListModel.SearchCriteriaModel.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    model.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    NameDeliveryPoint = model.DeliveryPoints.Where(a => a.Value == model.DeliveryPointIds.FirstOrDefault().ToString()).Select(b => b.Text).FirstOrDefault();
                }
            }
            BSOSearchCriteria criteria = bsoListModel.SearchCriteriaModel.GetBSOSearchCriteria();
            List <BSOInfo>    bsos     = bsoBusinessLogic.BSO_Find(
                criteria,
                new List <SortCriteria <BSOSortField> >(),
                new PageRequest()
            {
                PageNumber = 1, PageSize = int.MaxValue
            }).Data;
            BSOReportForm10 printedForm = new BSOReportForm10(bsos, model.DateForm10From, model.DateForm10To,
                                                              NameDeliveryPoint, CurrentUser.Fullname);

            return(File(printedForm.GetExcel(),
                        System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("Отчет по движению (статусам) временных свидетельств.xls")));
        }
Example #4
0
        public ActionResult SNILSReport(SNILSReportModel model)
        {
            string NameDeliveryPoint = string.Empty;
            ClientVisitListModel clientVisitModel = new ClientVisitListModel();

            clientVisitModel.SearchCriteriaModel.StatusDateFrom = model.DateSnilsFrom;
            clientVisitModel.SearchCriteriaModel.StatusDateTo   = model.DateSnilsTo;

            //для Администраторов ограничений по точкам - нет
            if (Role.Administrator.Id == Role.GetRealRole(CurrentUser).Id || Role.AdministratorBSO.Id == Role.GetRealRole(CurrentUser).Id)
            {
                if (model.DeliveryPointIds.Count > 0)
                {
                    clientVisitModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    foreach (var item in model.DeliveryPointIds)
                    {
                        NameDeliveryPoint = NameDeliveryPoint + ", " + model.DeliveryPoints.Where(a => a.Value == item.ToString()).Select(b => b.Text).FirstOrDefault();
                    }
                    NameDeliveryPoint = NameDeliveryPoint.Trim(',', ' ');
                }
                else
                {
                    NameDeliveryPoint = "Все точки";
                }
            }
            else
            {   //для ответственного
                if (Role.ResponsibleBSO == Role.GetRealRole(CurrentUser))
                {
                    if (model.DeliveryPointIds.Count > 0)
                    {
                        clientVisitModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    }
                    else
                    {//все точки для ответственного
                        model.DeliveryPoints = ReferencesProvider.GetDeliveryPointsForResponsibleBSO(CurrentUser.Id, false);
                        foreach (var item in model.DeliveryPoints)
                        {
                            if (item.Value != "")
                            {
                                model.DeliveryPointIds.Add(long.Parse(item.Value));
                            }
                        }
                        clientVisitModel.SearchCriteriaModel.DeliveryPointIds = model.DeliveryPointIds;
                    }

                    foreach (var item in model.DeliveryPointIds)
                    {
                        NameDeliveryPoint = NameDeliveryPoint + ", " + model.DeliveryPoints.Where(a => a.Value == item.ToString()).Select(b => b.Text).FirstOrDefault();
                    }
                    NameDeliveryPoint = NameDeliveryPoint.Trim(',', ' ');
                }
                else
                {
                    //для всех остальных, только по их собственной точке
                    clientVisitModel.SearchCriteriaModel.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    model.DeliveryPointIds = new List <long>()
                    {
                        CurrentUser.DeliveryPoint.Id
                    };
                    NameDeliveryPoint = model.DeliveryPoints.Where(a => a.Value == model.DeliveryPointIds.FirstOrDefault().ToString()).Select(b => b.Text).FirstOrDefault();
                }
            }

            ClientVisitSearchCriteria criteria = clientVisitModel.SearchCriteriaModel.GetClientSearchCriteria();

            criteria.IsActualInVisitGroup = true;
            List <ClientVisitInfo> clients = clientBusinessLogic.ClientVisit_Find(
                criteria,
                new List <SortCriteria <ClientVisitSortField> >(),
                new PageRequest()
            {
                PageNumber = 1, PageSize = int.MaxValue
            }).Data;

            //Отсекаем только гр. РФ
            clients = clients.Where(a => a.Citizenship == "РОССИЯ").ToList();

            // Все статусы кроме: "ошибочная запись код 6", "выдан и отправлен в фонд код 11", "изготовлен другой компанией код 7", "перерегистрация завершена код 8"
            clients = clients.Where(a => !(a.Status.Code == "6" ||
                                           a.Status.Code == "11" ||
                                           a.Status.Code == "7" ||
                                           a.Status.Code == "8")
                                    ).ToList();

            //Отсекаем по СНИЛС
            //нет СНИЛС
            //заявкой без СНИЛС является любая заявка, где поле СНИЛС заполнено иначе, чем XXX-XXX-XXX YY
            if (model.IsSnilsNotEmpty == false)
            {
                clients = clients.Where(a => (string.IsNullOrEmpty(a.SNILS) || !(a.SNILS.Length == 14 && a.SNILS[3] == '-' && a.SNILS[7] == '-' && a.SNILS[11] == ' '))).ToList();
            }
            //есть СНИЛС
            if (model.IsSnilsNotEmpty == true)
            {
                clients = clients.Where(a => (!string.IsNullOrEmpty(a.SNILS)) && (a.SNILS.Length == 14 && a.SNILS[3] == '-' && a.SNILS[7] == '-' && a.SNILS[11] == ' ')).ToList();
            }

            List <Entities.User> listUser    = userBusinessLogic.Find("");
            SNILSReport          printedForm = new SNILSReport(clients, model.DateSnilsFrom, model.DateSnilsTo, NameDeliveryPoint, CurrentUser.Fullname,
                                                               model.IsSnilsNotEmpty, listUser);

            return(File(printedForm.GetExcel(),
                        System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("Заявки и наличие СНИЛС.xlsx")));
        }