Beispiel #1
0
 public ActionResult GpdAnalyticalStatementDetails(int id)
 {
     GpdActListModel model = new GpdActListModel
     {
         CardNumber=id.ToString()    ,
         IsFind=true
     };
     bool hasError = false;
     GpdBl.SetGpdActView(model, hasError);
     return View(model);
 }
Beispiel #2
0
 public ActionResult GpdAnalyticalStatement()
 {
     bool hasError = false;
     GpdActListModel model = new GpdActListModel();
     GpdBl.SetGpdActFind(model, hasError);
     if (model.hasErrors)
         ModelState.AddModelError("errorMessage", "Произошла ошибка при загрузке страницы!");
     return View(model);
 }
Beispiel #3
0
 public ActionResult GpdAnalyticalStatement(GpdActListModel model)
 {
     bool hasError = false;
     GpdBl.SetGpdAnalyticalStatementView(model, hasError);
     return View(model);
 }
Beispiel #4
0
 public ActionResult GpdActList(GpdActListModel model)
 {
     //GpdContractModel model = new GpdContractModel();
     bool hasError = false;
     GpdBl.SetGpdActView(model, hasError);
     return View(model);
 }
Beispiel #5
0
        /// <summary>
        /// Определяем права роли текущего пользователя.
        /// </summary>
        /// <param name="model"></param>
        public void GetPermission(GpdActListModel model)
        {
            UserRole role = CurrentUser.UserRole;
            model.Permissions = GpdActDao.GetPermission(role);

            //
            if (model.Permissions.Count == 0)
            {
                GpdPermissionDto perm = new GpdPermissionDto();
                perm.IsCancel = false;
                perm.IsComment = false;
                perm.IsCreate = false;
                perm.IsCreateAct = false;
                perm.IsDraft = false;
                perm.IsWrite = false;

                model.Permissions.Add(perm);
            }
        }
Beispiel #6
0
 public void SetGpdAnalyticalStatementView(GpdActListModel model, bool hasError)
 {
     UserRole role = CurrentUser.UserRole;
     model.CTTypes = GpdChargingTypeDao.GetAllTypes();//список видов
     model.Statuses = GpdActDao.GetStatuses();//список статусов
     string[] Monthes = new string[] { "","Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"};
     model.Monthes = new List<IdNameDto>();
     for (int i = 0; i < 13; i++)
         model.Monthes.Add(new IdNameDto { Id = i, Name = Monthes[i] });
     if (!model.IsFind)
     {
         DateTime today = DateTime.Today;
         model.DateBegin = new DateTime(today.Year, today.Month, 1);
         model.DateEnd = today;
     }
     GetPermission(model);
     var docs = GpdActDao.GetAct(role, CurrentUser.Id, model.Id, model.IsFind, model.DateBegin, model.DateEnd, model.DepartmentId, model.CTtype,model.Surname, model.StatusID,model.ChargingDateYear,model.ChargingDateMonth, model.ActNumber, model.CardNumber, model.SortBy, model.SortDescending);
     docs = docs.Distinct(model.GroupAll ? (IEqualityComparer<GpdActDto>)new GpdActEqualityComparerByPersonId() : (IEqualityComparer<GpdActDto>)new GpdActEqualityComparerByPersonIdandCTName())
         .GroupJoin(docs, o => o, i => i, (p, op) => new GpdActDto{
             PersonId=p.PersonId,
             Surname=p.Surname,
             DepLevel3Name = p.DepLevel3Name,
             DepLevel7Name = p.DepLevel7Name,
             CTName =model.GroupAll && model.CTtype==0 ?"Все виды": p.CTName,
             Amount=op.Sum(s=>s.Amount),
             Ndfl=op.Sum(s=>s.SendTo1C.HasValue?Math.Round(s.Amount/100*13):0),
             AmountPayment=op.Sum(s=>s.SendTo1C.HasValue?s.AmountPayment:0)
     },
     model.GroupAll ? (IEqualityComparer<GpdActDto>)new GpdActEqualityComparerByPersonId() : (IEqualityComparer<GpdActDto>)new GpdActEqualityComparerByPersonIdandCTName()
     ).ToList();
     if (model.SortBy == 21)
     {
         var ordered = docs.OrderBy(x => (x.Amount - x.AmountPayment - x.Ndfl));
         if (model.SortDescending) ordered.Reverse();
         docs = ordered.ToList();
     }
     if (model.SortBy == 23)
     {
         var ordered = docs.OrderBy(x => x.Ndfl);
         if (model.SortDescending) ordered.Reverse();
         docs = ordered.ToList();
     }
     model.Documents=docs;
 }
Beispiel #7
0
 /// <summary>
 /// Заполняем модель просмора актов ГПД.
 /// </summary>
 /// <param name="model">Обрабатываемая модель.</param>
 /// <param name="hasError">Флажок для ошибок.</param>
 public void SetGpdActView(GpdActListModel model, bool hasError)
 {
     UserRole role = CurrentUser.UserRole;
     model.CTTypes = GpdChargingTypeDao.GetAllTypes();//список видов
     model.Statuses = GpdActDao.GetStatuses();//список статусов
     string[] Monthes = new string[] { "", "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" };
     model.Monthes = new List<IdNameDto>();
     for (int i = 0; i < 13; i++)
         model.Monthes.Add(new IdNameDto { Id = i, Name = Monthes[i] });
     if (!model.IsFind)
     {
         DateTime today = DateTime.Today;
         model.DateBegin = new DateTime(today.Year, today.Month, 1);
         model.DateEnd = today;
     }
     GetPermission(model);
     model.Documents = GpdActDao.GetAct(role, CurrentUser.Id, model.Id, model.IsFind, model.DateBegin, model.DateEnd, model.DepartmentId, model.CTtype, model.Surname, model.StatusID,model.ChargingDateYear,model.ChargingDateMonth, model.ActNumber,model.CardNumber, model.SortBy, model.SortDescending);
 }
Beispiel #8
0
 /// <summary>
 /// Заполняем модель просмора актов ГПД (запросная форма).
 /// </summary>
 /// <param name="model"></param>
 /// <param name="hasError"></param>
 public void SetGpdActFind(GpdActListModel model, bool hasError)
 {
     string[] Monthes = new string[] { "","Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"};
     DateTime today = DateTime.Today;
     model.ChargingDateYear = DateTime.Now.Year;
     model.Monthes = new List<IdNameDto>();
     for (int i = 0; i < 13; i++)
         model.Monthes.Add(new IdNameDto { Id = i, Name = Monthes[i] });
     model.CTTypes = GpdChargingTypeDao.GetAllTypes();//список видов
     model.DateBegin = new DateTime(today.Year, today.Month, 1);
     model.DateEnd = today;
     model.Statuses = GpdActDao.GetStatuses();//список статусов
 }