public ViewResult Index(int?TaxIncomePersonDetailId, int?staffId, int?TaxId)
        {
            IEnumerable <ThuNhapChiuThueViewModel> q = ThuNhapChiuThueRepository.GetAllThuNhapChiuThue().Where(n => n.TaxIncomePersonDetailId == TaxIncomePersonDetailId && n.StaffId == staffId && n.TaxId == TaxId)
                                                       .Select(item => new ThuNhapChiuThueViewModel
            {
                Id             = item.Id,
                CreatedUserId  = item.CreatedUserId,
                CreatedDate    = item.CreatedDate,
                ModifiedUserId = item.ModifiedUserId,
                ModifiedDate   = item.ModifiedDate,
                Name           = item.Name,
                Value          = item.Value
            }).OrderByDescending(m => m.ModifiedDate).ToList();

            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];
            return(View(q));
        }
Beispiel #2
0
        public ActionResult Detail(int?Id)
        {
            var Tax = TaxRepository.GetTaxById(Id.Value);

            if (Tax != null && Tax.IsDeleted != true)
            {
                var model = new TaxViewModel();
                AutoMapper.Mapper.Map(Tax, model);

                if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && Helpers.Common.CurrentUser.UserTypeId != 1)
                {
                    TempData["FailedMessage"] = "NotOwner";
                    return(RedirectToAction("Index"));
                }

                //Auto load danh sách nhân viên đã đăng ký thuế thu nhập cá nhân
                List <TaxIncomePersonDetailViewModel> model_satffs = taxIncomePersonDetailRepository.GetAllvwTaxIncomePersonDetail().Where(n => n.TaxIncomePersonId == model.TaxIncomePersonId)
                                                                     .Select(item => new TaxIncomePersonDetailViewModel
                {
                    Id            = item.Id,
                    CreatedUserId = item.CreatedUserId,
                    //CreatedUserName = item.CreatedUserName,
                    CreatedDate    = item.CreatedDate,
                    ModifiedUserId = item.ModifiedUserId,
                    //ModifiedUserName = item.ModifiedUserName,
                    ModifiedDate      = item.ModifiedDate,
                    Name              = item.Name,
                    BranchName        = item.BranchName,
                    Code              = item.Code,
                    CountryId         = item.CountryId,
                    DistrictName      = item.DistrictName,
                    StaffId           = item.StaffId,
                    Sale_BranchId     = item.Sale_BranchId,
                    Email             = item.Email,
                    Gender            = item.Gender,
                    GenderName        = item.GenderName,
                    IdCardNumber      = item.IdCardNumber,
                    PositionName      = item.PositionName,
                    TaxIncomePersonId = item.TaxIncomePersonId,
                    WardName          = item.WardName,
                    ProvinceName      = item.ProvinceName
                }).OrderBy(n => n.Id).ToList();


                //MNV - Họ tên - Chức vụ - đơn vị cộn tác- Tổng thu thập chịu thuế - Tổng giảm trừ - Thu nhập tính thuế - Thuế tạm tính
                //Tính thu nhập chịu thuế từng nhân viên
                var danh_sach_chiu_thue = thuNhapChiuThueRepository.GetAllThuNhapChiuThue().ToList();

                //Thêm các khoảng giảm
                var danh_sach_giam_thue = giamTruThueTNCNRepository.GetAllGiamTruThueTNCN().ToList();

                //Cate Thu nhập chịu thếu và Giảm trừ
                var cate = categoryRepository.GetCategoryByCode("TaxCode").ToList();

                //Dữ liệu bảng thuế suất
                var thuesuat = taxRateRepository.GetAllTaxRate().ToList();


                //Lấy dữ liệu giảm trừ từ người thân
                var staff_family = staffFamilyRepository.GetAllStaffFamily().Where(n => n.IsDependencies == true).ToList();

                buildThueTNCN(Id, model_satffs, danh_sach_chiu_thue, danh_sach_giam_thue, cate, thuesuat);

                //gán
                model.Staffs = new List <TaxIncomePersonDetailViewModel>();
                model.Staffs.AddRange(model_satffs);
                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }