Ejemplo n.º 1
0
        // GET: PersonalIncomeTax
        public ActionResult Index()
        {
            PersonalIncomeTaxViewModel model = new PersonalIncomeTaxViewModel();
            var param = new BasicParamModel()
            {
                FilterField = string.Empty,
                PageNumber  = 1,
                PageSize    = int.MaxValue,
                LanguageId  = _languageId,
                RoleId      = _roleId,
                UserId      = _userId,
                DbName      = CurrentUser.DbName
            };

            //var param = new BasicParamModel()
            //{
            //    FilterField = string.Empty,
            //    PageNumber = 1,
            //    PageSize = dataTableConfig.ItemsPerPage,
            //    LanguageId = _languageId,
            //    RoleId = _roleId,
            //    UserId = _userId,
            //    DbName = CurrentUser.DbName
            //};

            var paramEntity = MapperHelper.Map <BasicParamModel, BasicParamType>(param);
            var response    = this._personalIncomeTaxService.GetCurrentPersonalIncomeTax(paramEntity);

            if (response != null)
            {
                var result = JsonConvert.DeserializeObject <HrmResultModel <PersonalIncomeTaxModel> >(response);
                if (!CheckPermission(result))
                {
                    //return to Access Denied
                }
                else
                {
                    if (result.Results != null && result.Results.Count > 0)
                    {
                        model.PersonalIncomeTax = result.Results.FirstOrDefault();
                    }
                }
            }

            var resultTableTaxDetailConfig = this._tableConfigService.GetTableConfigByTableName(TableConfig.PersonalIncomeTaxDetail);
            var resultConfigTaxDetail      = JsonConvert.DeserializeObject <HrmResultModel <TableConfigModel> >(resultTableTaxDetailConfig);

            if (!CheckPermission(resultConfigTaxDetail))
            {
                //return to Access Denied
            }
            else
            {
                var Configresult = JsonConvert.DeserializeObject <TableViewModel>(resultConfigTaxDetail.Results.FirstOrDefault().ConfigData);
                Configresult.ShowFooter      = false;
                Configresult.TableName       = TableName.TablePersonalIncomeTaxDetail;
                Configresult.TableConfigName = TableConfig.PersonalIncomeTaxDetail;

                param.PageSize    = Int32.MaxValue;
                param.ReferenceId = model.PersonalIncomeTax.Id;

                model.TablePersonalIncomeTaxDetails = RenderTable(Configresult, param, TableName.TablePersonalIncomeTaxDetail);
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult _SaveForm()
        {
            PersonalIncomeTaxViewModel model = new PersonalIncomeTaxViewModel();
            var listGroup = new List <LongTypeModel>();
            var param     = new BasicParamModel()
            {
                FilterField = string.Empty,
                PageNumber  = 1,
                LanguageId  = _languageId,
                RoleId      = _roleId,
                UserId      = _userId,
                DbName      = CurrentUser.DbName
            };

            listGroup.Add(new LongTypeModel()
            {
                Value = MasterDataId.StatusAprove
            });
            listGroup.Add(new LongTypeModel()
            {
                Value = MasterDataId.Currency
            });
            var paramEntity    = MapperHelper.Map <BasicParamModel, BasicParamType>(param);
            var longTypeEntity = MapperHelper.MapList <LongTypeModel, LongType>(listGroup);

            //get dropdown value
            var resultMasterData = this._masterDataService.GetAllMasterDataByListGroupId(longTypeEntity);
            var response         = JsonConvert.DeserializeObject <HrmResultModel <dynamic> >(resultMasterData);

            if (!CheckPermission(response))
            {
                //return to Access Denied
            }
            else
            {
                model.DataDropdownStatus   = response.Results.Where(m => m.GroupId == MasterDataId.StatusAprove).ToList();
                model.DataDropdownCurrency = response.Results.Where(m => m.GroupId == MasterDataId.Currency).ToList();
            }
            // tax
            var responseTax = this._personalIncomeTaxService.GetCurrentPersonalIncomeTax(paramEntity);

            if (responseTax != null)
            {
                var result = JsonConvert.DeserializeObject <HrmResultModel <PersonalIncomeTaxModel> >(responseTax);
                if (!CheckPermission(result))
                {
                    //return to Access Denied
                }
                else
                {
                    if (result.Results != null && result.Results.Count > 0)
                    {
                        model.PersonalIncomeTax = result.Results.FirstOrDefault();
                    }
                }
            }

            var resultTableTaxDetailConfig  = this._tableConfigService.GetTableConfigByTableName(TableConfig.PersonalIncomeTaxDetailPopup);
            var resultConfigTaxDetailDetail = JsonConvert.DeserializeObject <HrmResultModel <TableConfigModel> >(resultTableTaxDetailConfig);

            if (!CheckPermission(resultConfigTaxDetailDetail))
            {
                //return to Access Denied
            }
            else
            {
                var dataTableTaxDetailConfig = JsonConvert.DeserializeObject <TableViewModel>(resultConfigTaxDetailDetail.Results.FirstOrDefault().ConfigData);
                dataTableTaxDetailConfig.ShowFooter      = false;
                dataTableTaxDetailConfig.TableName       = TableName.TablePersonalIncomeTaxDetailPopup;
                dataTableTaxDetailConfig.TableConfigName = TableConfig.PersonalIncomeTaxDetailPopup;
                var param3 = new BasicParamModel()
                {
                    FilterField = "",
                    OrderBy     = " Id ASC ",
                    PageNumber  = 1,
                    PageSize    = dataTableTaxDetailConfig.ItemsPerPage,
                    LanguageId  = _languageId,
                    RoleId      = _roleId,
                    UserId      = _userId,
                    DbName      = CurrentUser.DbName,
                    ReferenceId = model.PersonalIncomeTax.Id
                };
                model.TablePersonalIncomeTaxDetails = RenderTable(dataTableTaxDetailConfig, param3, TableName.TablePersonalIncomeTaxDetailPopup);
            }
            return(PartialView(UrlHelpers.TemplateAdmin("PersonalIncomeTax", "_SaveForm.cshtml"), model));
        }