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;
        }
예제 #2
0
        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;
        }
예제 #3
0
        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);
        }