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 int TinhTongTienThuongDaTichLuyTrongThang(INhatKylamViecRepository nhatKylamViecRepository, string employeeId, int year, int month) { var nhatKyLamViecs = nhatKylamViecRepository.FindByMaNhanVien(employeeId) .Result .Where(q => q.ThoiGianBatDau.Year == year && q.ThoiGianBatDau.Month == month); int tongSoTien = 0; foreach (var nhatKy in nhatKyLamViecs) { tongSoTien += nhatKy.SoTienThuongThem; } return(tongSoTien); }
public static int TinhTongSoPhutLamDaTichLuyTrongThang(INhatKylamViecRepository nhatKylamViecRepository, string employeeId, int year, int month) { var nhatKyLamViecs = nhatKylamViecRepository.FindByMaNhanVien(employeeId) .Result .Where(q => q.ThoiGianBatDau.Year == year && q.ThoiGianBatDau.Month == month); int tongSoPhut = 0; foreach (var nhatKy in nhatKyLamViecs) { tongSoPhut += (int)(nhatKy.ThoiGianKetThuc - nhatKy.ThoiGianBatDau).TotalMinutes; } return(tongSoPhut); }
public LeaveRequestController( ILeaveRequestRepository leaveRequestRepo, ILeaveAllocationRepository leaveAllocationRepo, ILeaveTypeRepository leaveTypeRepo, IMapper mapper, UserManager <Employee> userManager, IPhongBanRepository phongBanRepository, INhatKylamViecRepository nhatKylamViecRepository) { _leaveTypeRepo = leaveTypeRepo; _leaveAllocationRepo = leaveAllocationRepo; _leaveRequestRepo = leaveRequestRepo; _mapper = mapper; _userManager = userManager; this.phongBanRepository = phongBanRepository; this.nhatKylamViecRepository = nhatKylamViecRepository; }
public static int TinhTongLuongCoBanTichLuyTrongThang(INhatKylamViecRepository nhatKylamViecRepository, string employeeId, int year, int month) { //Tiền lương đã tích lũy = lương cơ bản /(6 ngày * 4 tuần *8 giờ* 60 phút)*hệ số lương * số phút của lịch biểu var nhatKyLamViecs = nhatKylamViecRepository.FindByMaNhanVien(employeeId) .Result .Where(q => q.ThoiGianBatDau.Year == year && q.ThoiGianBatDau.Month == month); int tongSoTien = 0; foreach (var nhatKy in nhatKyLamViecs) { int soPhut = (int)(nhatKy.ThoiGianKetThuc - nhatKy.ThoiGianBatDau).TotalMinutes; tongSoTien += (int)((double)nhatKy.MucLuongCoBan / (6 * 4 * 8 * 60) * nhatKy.HeSoLuongCoBan * soPhut); } return(tongSoTien); }
public ChamCongController(ILeaveTypeRepository leaverepo, ILeaveAllocationRepository leaveallocationrepo, IMapper mapper, UserManager <Employee> userManager, IChucVuRepository chucVuRepo, IChuyenMonRepository chuyenMonRepo, IPhongBanRepository phongBanRepo, IRoleRepository roleRepository, IWebHostEnvironment hostEnvironment, IUserRoleRepository userRoleRepository, IMauHopDongRepository mauHopDongRepository, IHopDongLaoDongRepository hopDongLaoDongRepository, INhatKylamViecRepository nhatKylamViecRepository, ILoaiLichBieuRepository loaiLichBieuRepository, ILeaveAllocationRepository leaveAllocationRepository, ILeaveRequestRepository leaveRequestRepository, ILeaveTypeRepository leaveTypeRepository, IPhongBanRepository phongBanRepository, IPhieuChi_NKLVRepository phieuChi_NKLVRepository) { this.leaverepo = leaverepo; this.leaveallocationrepo = leaveallocationrepo; this.mapper = mapper; this.userManager = userManager; this.chucVuRepo = chucVuRepo; this.chuyenMonRepo = chuyenMonRepo; this.phongBanRepo = phongBanRepo; this.roleRepository = roleRepository; webHostEnvironment = hostEnvironment; this.userRoleRepository = userRoleRepository; this.mauHopDongRepository = mauHopDongRepository; this.hopDongLaoDongRepository = hopDongLaoDongRepository; this.nhatKylamViecRepository = nhatKylamViecRepository; this.loaiLichBieuRepository = loaiLichBieuRepository; this.leaveAllocationRepository = leaveAllocationRepository; this.leaveRequestRepository = leaveRequestRepository; this.leaveTypeRepository = leaveTypeRepository; this.phongBanRepository = phongBanRepository; this.phieuChi_NKLVRepository = phieuChi_NKLVRepository; }
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); }