public XuatLuongCuoiThangController(ILeaveTypeRepository leaverepo, ILeaveAllocationRepository leaveallocationrepo, IMapper mapper, UserManager <Employee> userManager, IChucVuRepository chucVuRepo, IChuyenMonRepository chuyenMonRepo, IPhongBanRepository phongBanRepo, IRoleRepository roleRepository, IWebHostEnvironment hostEnvironment, IUserRoleRepository userRoleRepository, INhatKylamViecRepository nhatKylamViecRepository, IPhieuChi_LuongCuoiThangRepository phieuChi_LuongCuoiThangRepository, IPhieuChi_NKLVRepository phieuChi_NKLVRepository ) { this.leaverepo = leaverepo; this.leaveallocationrepo = leaveallocationrepo; this.mapper = mapper; this.userManager = userManager; this.chucVuRepo = chucVuRepo; this.chuyenMonRepo = chuyenMonRepo; this.roleRepository = roleRepository; webHostEnvironment = hostEnvironment; this.userRoleRepository = userRoleRepository; this.nhatKylamViecRepository = nhatKylamViecRepository; this.phieuChi_LuongCuoiThangRepository = phieuChi_LuongCuoiThangRepository; this.phieuChi_NKLVRepository = phieuChi_NKLVRepository; this.phongBanRepo = phongBanRepo; }
public static PhieuChi_LuongCuoiThangVM FeedSomeDataToPhieuChi_LuongCuoiThangModel(IMapper mapper, IPhieuChi_LuongCuoiThangRepository phieuChi_LuongCuoiThangRepository, INhatKylamViecRepository nhatKylamViecRepository, IPhieuChi_NKLVRepository phieuChi_NKLVRepository, UserManager <Employee> userManager, ClaimsPrincipal User, string maPhieuChi) { var phieuChiLuongCuoiThang = phieuChi_LuongCuoiThangRepository.FindById(maPhieuChi).Result; var model = mapper.Map <PhieuChi_LuongCuoiThangVM>(phieuChiLuongCuoiThang); //var maNhanVienDuocXuatLuong = await phieuChi_NKLVRepository.FindMaNhanVienByMaPhieuChi(model.MaPhieuChi); var phieuchi_nklv = (phieuChi_NKLVRepository.FindAll().Result) .FirstOrDefault(q => q.MaPhieuChi == model.MaPhieuChi); var thoiGianTinhLuong = phieuchi_nklv.ThoiGianBatDau_NKLV; var maNhanVienDuocChiTien = phieuchi_nklv.MaNhanVien_NKLV; int tongSoPhutLamViec = TinhTongSoPhutLamDaTichLuyTrongThang( nhatKylamViecRepository, maNhanVienDuocChiTien, thoiGianTinhLuong.Year, thoiGianTinhLuong.Month); model.TongSoGioLam = new TongSoGioLam(); model.TongSoGioLam.SoGio = tongSoPhutLamViec / 60; model.TongSoGioLam.SoPhut = tongSoPhutLamViec % 60; model.TongTienLuongCoBanDaTichLuyTrongThang = TinhTongLuongCoBanTichLuyTrongThang( nhatKylamViecRepository, maNhanVienDuocChiTien, thoiGianTinhLuong.Year, thoiGianTinhLuong.Month); model.TongTienThuongDaTichLuyTrongThang = TinhTongTienThuongDaTichLuyTrongThang( nhatKylamViecRepository, maNhanVienDuocChiTien, thoiGianTinhLuong.Year, thoiGianTinhLuong.Month); model.TongTienLuong = model.TongTienLuongCoBanDaTichLuyTrongThang + model.TongTienThuongDaTichLuyTrongThang; model.NhanVienDuocChiTien = mapper.Map <EmployeeVM>(userManager.FindByIdAsync(maNhanVienDuocChiTien).Result); model.NhanVienXuatLuong = mapper.Map <EmployeeVM>(userManager.FindByIdAsync(model.MaNhanVienXuatLuong).Result); return(model); }