public function index1()
 {
     $dsSachMuonChuaTra = null;
     $dsSachMuonChuaTra = QuyenSach::join('chi_tiet_phieu_muon_sach', function ($join) {
         $join->on('chi_tiet_phieu_muon_sach.id_quyen_sach', '=', 'quyen_sach.id');
     })->join('phieu_muon_sach', function ($join) {
         $join->on('chi_tiet_phieu_muon_sach.id_phieu_muon', '=', 'phieu_muon_sach.id');
     })->join('dau_sach', function ($join) {
         $join->on('dau_sach.id', '=', 'quyen_sach.id_dau_sach');
     })->join('nguoi_dung', function ($join) {
         $join->on('nguoi_dung.id', '=', 'phieu_muon_sach.id_nguoi_muon');
     })->select('quyen_sach.id', 'chi_tiet_phieu_muon_sach.id_quyen_sach', 'chi_tiet_phieu_muon_sach.id_phieu_muon', 'phieu_muon_sach.id', 'dau_sach.id', 'quyen_sach.id_dau_sach', 'dau_sach.ten_dau_sach', 'dau_sach.ngon_ngu_sach', 'phieu_muon_sach.id_nguoi_muon', 'nguoi_dung.id', 'nguoi_dung.ma_so_the', 'chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'quyen_sach.ma_bar_code')->where('chi_tiet_phieu_muon_sach.trang_thai_sach_muon', 1, 'or')->where('chi_tiet_phieu_muon_sach.trang_thai_sach_muon', 2, 'or')->where('chi_tiet_phieu_muon_sach.trang_thai_sach_muon', 3)->orderBy('chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'desc');
     $dsSachMuonChuaTra = $dsSachMuonChuaTra->paginate(QUAN_LY_SO_PHIEU_MUON_TREN_TRANG);
     General::storeevents(QUAN_LY_THANH_TOAN_SV_NGHI_HOC);
     return View::make('thuthu_thanhtoanratruong.index_nghihoc')->with('title', 'Thanh toán sinh viên nghỉ học')->with('dsSachMuonChuaTra', $dsSachMuonChuaTra);
 }
 public function printdetail()
 {
     $IdDetail = Input::get('txtIdDetail');
     $dsPhieuMuon = QuyenSach::join('chi_tiet_phieu_muon_sach', function ($join) {
         $join->on('chi_tiet_phieu_muon_sach.id_quyen_sach', '=', 'quyen_sach.id');
     })->join('phieu_muon_sach', function ($join) {
         $join->on('chi_tiet_phieu_muon_sach.id_phieu_muon', '=', 'phieu_muon_sach.id');
     })->join('dau_sach', function ($join) {
         $join->on('dau_sach.id', '=', 'quyen_sach.id_dau_sach');
     })->join('nguoi_dung', function ($join) {
         $join->on('nguoi_dung.id', '=', 'phieu_muon_sach.id_nguoi_muon');
     })->select('phieu_muon_sach.id', 'quyen_sach.id', 'chi_tiet_phieu_muon_sach.id_quyen_sach', 'chi_tiet_phieu_muon_sach.id_phieu_muon', 'dau_sach.id', 'quyen_sach.id_dau_sach', 'dau_sach.ten_dau_sach', 'dau_sach.ngon_ngu_sach', 'phieu_muon_sach.id_nguoi_muon', 'nguoi_dung.id', 'nguoi_dung.ma_so_the', 'chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'chi_tiet_phieu_muon_sach.thoi_gian_muon', 'nguoi_dung.id_nhom_quyen_han', 'phieu_muon_sach.ma_so_phieu', 'phieu_muon_sach.trang_thai_phieu', 'chi_tiet_phieu_muon_sach.ghi_chu_sach_muon', 'chi_tiet_phieu_muon_sach.id_nguoi_cap_nhat', 'chi_tiet_phieu_muon_sach.tg_cap_nhat_trang_thai', 'chi_tiet_phieu_muon_sach.trang_thai_sach_muon', 'quyen_sach.ma_bar_code', 'chi_tiet_phieu_muon_sach.id')->where('chi_tiet_phieu_muon_sach.id_phieu_muon', $IdDetail);
     $dsPhieuMuon = $dsPhieuMuon->paginate(QUAN_LY_SO_PHIEU_MUON_TREN_TRANG);
     return View::make('thuthu_quanlymuontra.printdetail')->with('title', 'Bảng in chi tiết phiếu mượn')->with('dsPhieuMuon', $dsPhieuMuon);
 }
 public static function getIdDauSach($idQuyenSach)
 {
     $idDauSach = QuyenSach::select('id_dau_sach')->where('id', $idQuyenSach)->get();
     return $idDauSach[0]->id_dau_sach;
 }
 public function printt2()
 {
     $now = date('Y-m-d', time());
     $NgonNgu = Input::get('txtNgonNgu');
     $dsSachMuon = null;
     if ($NgonNgu == null || $NgonNgu == 'allNN') {
         $dsSachMuon = QuyenSach::join('chi_tiet_phieu_muon_sach', function ($join) {
             $join->on('chi_tiet_phieu_muon_sach.id_quyen_sach', '=', 'quyen_sach.id');
         })->join('phieu_muon_sach', function ($join) {
             $join->on('chi_tiet_phieu_muon_sach.id_phieu_muon', '=', 'phieu_muon_sach.id');
         })->join('dau_sach', function ($join) {
             $join->on('dau_sach.id', '=', 'quyen_sach.id_dau_sach');
         })->join('nguoi_dung', function ($join) {
             $join->on('nguoi_dung.id', '=', 'phieu_muon_sach.id_nguoi_muon');
         })->select('quyen_sach.id', 'chi_tiet_phieu_muon_sach.id_quyen_sach', 'chi_tiet_phieu_muon_sach.id_phieu_muon', 'phieu_muon_sach.id', 'dau_sach.id', 'quyen_sach.id_dau_sach', 'dau_sach.ten_dau_sach', 'dau_sach.ngon_ngu_sach', 'phieu_muon_sach.id_nguoi_muon', 'nguoi_dung.id', 'nguoi_dung.ma_so_the', 'chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'quyen_sach.ma_bar_code')->orderBy('chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'desc');
     } else {
         $dsSachMuon = QuyenSach::join('chi_tiet_phieu_muon_sach', function ($join) {
             $join->on('chi_tiet_phieu_muon_sach.id_quyen_sach', '=', 'quyen_sach.id');
         })->join('phieu_muon_sach', function ($join) {
             $join->on('chi_tiet_phieu_muon_sach.id_phieu_muon', '=', 'phieu_muon_sach.id');
         })->join('dau_sach', function ($join) {
             $join->on('dau_sach.id', '=', 'quyen_sach.id_dau_sach');
         })->join('nguoi_dung', function ($join) {
             $join->on('nguoi_dung.id', '=', 'phieu_muon_sach.id_nguoi_muon');
         })->select('quyen_sach.id', 'chi_tiet_phieu_muon_sach.id_quyen_sach', 'chi_tiet_phieu_muon_sach.id_phieu_muon', 'phieu_muon_sach.id', 'dau_sach.id', 'quyen_sach.id_dau_sach', 'dau_sach.ten_dau_sach', 'dau_sach.ngon_ngu_sach', 'phieu_muon_sach.id_nguoi_muon', 'nguoi_dung.id', 'nguoi_dung.ma_so_the', 'chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'quyen_sach.ma_bar_code')->where('dau_sach.ngon_ngu_sach', $NgonNgu)->orderBy('chi_tiet_phieu_muon_sach.thoi_gian_hen_tra', 'desc');
     }
     $dsSachMuon = $dsSachMuon->get();
     return View::make('thuthu_thongke.print2')->with('title', 'In danh sách các sách mượn nhiều')->with('dsSachMuon', $dsSachMuon);
 }