コード例 #1
0
        public async Task <IActionResult> AddCurrent(CurrentWPViewModel model)
        {
            ViewBag.Companies = _dbContext.Companies;

            if (ModelState.IsValid)
            {
                CurrentWorkPlace current = new CurrentWorkPlace()
                {
                    Id           = model.Id,
                    WorkerId     = model.WorkerId,
                    CompanyId    = model.CompanyId,
                    DepartmentId = model.DepartmentId,
                    ShopId       = model.ShopId,
                    PositionId   = model.PositionId,
                    EntryDate    = model.EntryDate,
                    ExitDate     = model.ExitDate
                };
                await _dbContext.CurrentWorkPlaces.AddAsync(current);

                await _dbContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Current)));
            }
            return(View());
        }
コード例 #2
0
        private IActionResult BonusAndVacation(int monthDay, int day, CurrentWorkPlace data, int attendence, WorkerPromotion bonus, Vacation holiday, decimal salaryForDay, decimal SalaryForRealDate)
        {
            decimal  absentDaysSalary = attendence * salaryForDay;
            decimal  awardForWorker   = bonus.Reward;
            TimeSpan tetilihesabla    = (holiday.VacationEnded - holiday.VacationStarted);
            int      tetilBonus       = tetilihesabla.Days / 2;
            decimal  tetilTotal       = (tetilBonus * salaryForDay);
            decimal  TotalSalary      = SalaryForRealDate - absentDaysSalary + tetilBonus + awardForWorker;

            PayrollViewModel payrollView = new PayrollViewModel()
            {
                WorkerId          = data.WorkerId,
                Worker            = data.Worker,
                PositionId        = data.PositionId,
                Position          = data.Position,
                VacationBonus     = tetilTotal,
                CountofAbsentDays = attendence,
                WorkerPromotionId = bonus.Id,
                Bonus             = bonus.Reward,
                TotalSalary       = TotalSalary
            };

            if (day == monthDay)
            {
                ConfigurePayrollViewModel(payrollView);
            }
            return(View(payrollView));
        }
コード例 #3
0
        private IActionResult BonusAndShopBonus(int monthDay, int day, CurrentWorkPlace data, ShopPromotion shopBonus, int attendence, WorkerPromotion bonus, decimal salaryForDay, decimal SalaryForRealDate)
        {
            var absentDaysSalary         = attendence * salaryForDay;
            var shpBonus                 = shopBonus.Reward;
            var awardForWorker           = bonus.Reward;
            var TotalSalary              = SalaryForRealDate - absentDaysSalary + shpBonus + awardForWorker;
            PayrollViewModel payrollView = new PayrollViewModel()
            {
                WorkerId          = data.WorkerId,
                Worker            = data.Worker,
                PositionId        = data.PositionId,
                Position          = data.Position,
                WorkerPromotionId = bonus.Id,
                Bonus             = bonus.Reward,
                ShopBonus         = shpBonus,
                ShopPromotionId   = shopBonus.Id,
                CountofAbsentDays = attendence,
                TotalSalary       = TotalSalary
            };

            if (day == monthDay)
            {
                ConfigurePayrollViewModel(payrollView);
            }

            return(View(payrollView));
        }
コード例 #4
0
        private IActionResult VacationAndShopBonus(int monthDay, int day, CurrentWorkPlace data, ShopPromotion shopBonus, int attendence, Vacation holiday, decimal salaryForDay, decimal SalaryForRealDate)
        {
            var absentDaysSalary         = attendence * salaryForDay;
            var shpBonus                 = shopBonus.Reward;
            var tetilihesabla            = (holiday.VacationEnded - holiday.VacationStarted);
            var tetilBonus               = tetilihesabla.Days / 2;
            var tetilTotal               = (tetilBonus * salaryForDay);
            var TotalSalary              = SalaryForRealDate - absentDaysSalary + shpBonus + tetilTotal;
            PayrollViewModel payrollView = new PayrollViewModel()
            {
                WorkerId          = data.WorkerId,
                Worker            = data.Worker,
                PositionId        = data.PositionId,
                Position          = data.Position,
                CountofAbsentDays = attendence,
                ShopBonus         = shpBonus,
                ShopPromotionId   = shopBonus.Id,
                VacationBonus     = tetilTotal,
                TotalSalary       = TotalSalary
            };

            if (day == monthDay)
            {
                ConfigurePayrollViewModel(payrollView);
            }
            return(View(payrollView));
        }
コード例 #5
0
        public async Task <IActionResult> EditPosition(CurrentWPViewModel model)
        {
            ViewBag.Workers     = _dbContext.Workers;
            ViewBag.Companies   = _dbContext.Companies;
            ViewBag.Departments = _dbContext.Departments;
            ViewBag.Shops       = _dbContext.Shops;
            ViewBag.Positions   = _dbContext.Positions;

            if (ModelState.IsValid)
            {
                CurrentWorkPlace current = new CurrentWorkPlace()
                {
                    Id           = model.Id,
                    WorkerId     = model.WorkerId,
                    CompanyId    = model.CompanyId,
                    Company      = model.Company,
                    DepartmentId = model.DepartmentId,
                    ShopId       = model.ShopId,
                    PositionId   = model.PositionId,
                    EntryDate    = model.EntryDate,
                    ExitDate     = model.ExitDate
                };

                if (model.ExitDate != null)
                {
                    PreviousWorkPlace previous = new PreviousWorkPlace()
                    {
                        WorkerId            = current.WorkerId,
                        WorkPlaceName       = "Sinteks",
                        ReasonOfTermination = "Vəzifə dəyişikliyi",
                        EntryDate           = current.EntryDate,
                        ExitDate            = DateTime.Now
                    };
                    await _dbContext.PreviousWorkPlaces.AddAsync(previous);

                    _dbContext.CurrentWorkPlaces.Remove(current);
                    await _dbContext.SaveChangesAsync();

                    return(RedirectToAction("Previous", "Workplace"));
                }
            }
            return(View());
        }
コード例 #6
0
        private IActionResult AbsentOnly(int monthDay, int day, CurrentWorkPlace data, int attendence, decimal salaryForDay, decimal SalaryForRealDate)
        {
            decimal absentDaysSalary = attendence * salaryForDay;
            //Bugunki Tarixe local tarixe gore hesablama
            //qaib ve bugunki tarixe gore hesablamag
            decimal TotalSalary = SalaryForRealDate - absentDaysSalary;

            PayrollViewModel payrollView = new PayrollViewModel()
            {
                WorkerId          = data.WorkerId,
                Worker            = data.Worker,
                PositionId        = data.PositionId,
                Position          = data.Position,
                CountofAbsentDays = attendence,
                TotalSalary       = TotalSalary
            };

            if (day == monthDay)
            {
                ConfigurePayrollViewModel(payrollView);
            }
            return(View(payrollView));
        }