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()); }
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)); }
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)); }
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)); }
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()); }
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)); }