public ActionResult SuaQuyetDinh(QuyetDinhTD td) { //ViewBag.MaPB = new SelectList(data.PhongBans.ToList().OrderBy(n => n.TenPhongBan), "MaPB", "TenPhongBan"); //ViewBag.MaCV = new SelectList(data.ChucVus.ToList().OrderBy(n => n.TenChucVu), "MaCV", "TenChucVu"); QuyetDinhTD qd = data.QuyetDinhTDs.ToList().Find(n => n.MaQD == td.MaQD); //var cv = data.ChucVus.SingleOrDefault(n => n.MaCV == qd.MaCV); //ViewBag.Time = cv.ThoiGianThuViec; //ViewBag.ThuViec = cv.MucLuongThuViec; //ViewBag.CT = cv.MucLuongCT; //ViewBag.PhuCap = cv.PhuCap; if (ModelState.IsValid) { qd.Mota = td.Mota; qd.SoLuong = td.SoLuong; qd.Ngaycapnhat = DateTime.Now; data.SubmitChanges(); return(RedirectToAction("QuyetDinhTD")); } else { ModelState.AddModelError(" ", "Sửa thất bại"); } return(View()); }
public ActionResult ChitietQuyetDinh(int id) { QuyetDinhTD td = data.QuyetDinhTDs.SingleOrDefault(n => n.MaQD == id); ViewBag.MaQD = td.MaQD; if (td == null) { Response.StatusCode = 404; return(null); } return(View(td)); }
public ActionResult XuatBangLuong(int id) { Luong lg = data.Luongs.SingleOrDefault(n => n.MaLuong == id); NhanVien nv = data.NhanViens.SingleOrDefault(n => n.MaNV == lg.MaNV); QuyetDinhTD qd = data.QuyetDinhTDs.SingleOrDefault(n => n.MaQD == nv.MaQD); ChucVu cv = data.ChucVus.SingleOrDefault(n => n.MaCV == qd.MaCV); decimal mucLuong = 0; decimal giatringaycong = 0; decimal giatritresom = 0; decimal giatringaynghicop = 0; decimal giatringaynghikp = 0; decimal giatriphutroi = 0; if (nv.TinhTrang == "Thử việc") { mucLuong = cv.MucLuongThuViec; giatringaycong = Convert.ToDecimal(mucLuong * lg.Songaycong); giatritresom = Convert.ToDecimal(mucLuong * lg.Solantresom); giatringaynghicop = Convert.ToDecimal(mucLuong * lg.Songaynghicop); giatringaynghikp = Convert.ToDecimal(mucLuong * lg.Songaynghikp); giatriphutroi = Convert.ToDecimal(mucLuong * lg.Sogiopt); } else { mucLuong = cv.MucLuongCT; giatringaycong = Convert.ToDecimal(mucLuong * lg.Songaycong); giatritresom = Convert.ToDecimal(mucLuong * lg.Solantresom); giatringaynghicop = Convert.ToDecimal(mucLuong * lg.Songaynghicop); giatringaynghikp = Convert.ToDecimal(mucLuong * lg.Songaynghikp); giatriphutroi = Convert.ToDecimal(mucLuong * lg.Sogiopt); } LuongNV db = new LuongNV(); db.DataTable1.AddDataTable1Row(lg.MaLuong, lg.MaNV, nv.HoTen, lg.Thang, lg.Nam, Convert.ToInt32(lg.Songaycong), Convert.ToInt32(lg.Solantresom), Convert.ToInt32(lg.Songaynghicop), Convert.ToInt32(lg.Songaynghikp), Convert.ToDecimal(lg.Khenthuong), Convert.ToDecimal(lg.Kyluat), lg.GiaTri, mucLuong, Convert.ToInt32(lg.Sogiopt), giatringaycong, giatritresom, giatringaynghicop, giatringaynghikp, giatriphutroi); ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Report/BangLuong.rpt"))); rd.SetDataSource(db); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf", "Bangluong.pdf")); }
public ActionResult ThemQDmoi(QuyetDinhTD td) { ViewBag.MaPB = new SelectList(data.PhongBans.ToList().OrderBy(n => n.TenPhongBan), "MaPB", "TenPhongBan"); ViewBag.MaCV = new SelectList(data.ChucVus.ToList().OrderBy(n => n.TenChucVu), "MaCV", "TenChucVu"); if (ModelState.IsValid) { td.Ngaycapnhat = DateTime.Now; td.TrangThai = "Còn tuyển"; data.QuyetDinhTDs.InsertOnSubmit(td); data.SubmitChanges(); return(RedirectToAction("QuyetDinhTD")); } else { ModelState.AddModelError(" ", "Thêm thất bại"); } return(View()); }
public ActionResult SuaQuyetDinh(int id) { QuyetDinhTD td = data.QuyetDinhTDs.SingleOrDefault(n => n.MaQD == id); ViewBag.MaQD = td.MaQD; if (td == null) { Response.StatusCode = 404; return(null); } //ViewBag.MaPB = new SelectList(data.PhongBans.ToList().OrderBy(n => n.TenPhongBan), "MaPB", "TenPhongBan"); //ViewBag.MaCV = new SelectList(data.ChucVus.ToList().OrderBy(n => n.TenChucVu), "MaCV", "TenChucVu"); //var cv = data.ChucVus.SingleOrDefault(n => n.MaCV == td.MaCV); //ViewBag.Time = cv.ThoiGianThuViec; //ViewBag.ThuViec = cv.MucLuongThuViec; //ViewBag.CT = cv.MucLuongCT; //ViewBag.PhuCap = cv.PhuCap; return(View(td)); }