public ActionResult Edit(JournalVoucherCreateModel model)
 {
     model.CodeCombinationList = codeCombinitionService.GetAll(AuthenticationHelper.User.CompanyId, model.SOBId, "", false, null, "", "")
                                 .Select(x => new SelectListItem
     {
         Text  = x.CodeCombinitionCode,
         Value = x.Id.ToString()
     }).ToList();
     return(View(model));
 }
        public static IList <SelectListItem> GetAccounts(long sobId, DateTime?startDate, DateTime?endDate)
        {
            //logic editted by uzair, previous one was incorrect.
            //plz check this one also.
            List <CodeCombinitionView> codeCombinationList = service.GetAll(AuthenticationHelper.CompanyId.Value, sobId, "", false, null, "", "")
                                                             .Where(x => x.AllowedPosting == true).ToList();

            if (startDate != null)
            {
                codeCombinationList = codeCombinationList.Where(a => a.StartDate <= startDate || a.StartDate == null).ToList();
            }

            if (endDate != null)
            {
                codeCombinationList = codeCombinationList.Where(a => a.EndDate >= endDate || a.EndDate == null).ToList();
            }

            List <SelectListItem> list = codeCombinationList.Select(x => new SelectListItem
            {
                Text  = x.CodeCombinitionCode,
                Value = x.Id.ToString()
            }).ToList();

            if (list.Count > 0)
            {
                return(list);
            }
            else
            {
                return(new List <SelectListItem>());
            }

            //if (SessionHelper.Calendar != null)
            //{
            //    return service.GetAll(AuthenticationHelper.CompanyId.Value, sobId, "", false, null, "", "")
            //        .Where(rec => rec.StartDate >= startDate && rec.EndDate <= endDate)
            //            .Select(x => new SelectListItem
            //            {
            //                Text = x.CodeCombinitionCode,
            //                Value = x.Id.ToString()
            //            }).ToList();
            //}
            //else
            //{
            //    return service.GetAll(AuthenticationHelper.CompanyId.Value, sobId, "", false, null, "", "")
            //            .Select(x => new SelectListItem
            //            {
            //                Text = x.CodeCombinitionCode,
            //                Value = x.Id.ToString()
            //            }).ToList();
            //}
        }
        public ActionResult Index(CodeCombinitionListModel model)
        {
            if (model.SetOfBooks == null)
            {
                model.SetOfBooks = sobService
                                   .GetByCompanyId(AuthenticationHelper.User.CompanyId)
                                   .Select(x => new SelectListItem
                {
                    Text     = x.Name,
                    Value    = x.Id.ToString(),
                    Selected = x.Id == model.SOBId ? true : false
                }).ToList();
            }

            model.CodeCombinitions = service.GetAll(AuthenticationHelper.User.CompanyId, model.SOBId != 0 ? model.SOBId : Convert.ToInt64(model.SetOfBooks.First().Value), model.SearchText, true, model.Page, model.SortColumn, model.SortDirection)
                                     .Select(x => new CodeCombinitionViewModel(x)).ToList();
            return(View(model));
        }
Ejemplo n.º 4
0
        private List <SelectListItem> getCodeCombinationList(long sobId)
        {
            List <SelectListItem> list = codeCombinitionService.GetAll(AuthenticationHelper.CompanyId.Value, sobId)
                                         .Select(x => new SelectListItem
            {
                Text  = Utility.Stringize(".", x.Segment1, x.Segment2, x.Segment3, x.Segment4, x.Segment5, x.Segment6, x.Segment7, x.Segment8),
                Value = x.Id.ToString()
            }).ToList();

            return(list);
        }