Daftar Pustaka Coderseye.
2017.
Coderseye.
12
January.
Diakses
April
20,
2017.
http://www.coderseye.com. Darmawan, Deni, dan Nur Kunkun Fauzi. 2013. Sistem Informasi Manajemen. Bandung: PT Remaja Rosdakarya. Fakhroutdinov, Kirill. 2014. uml-diagram.org. 8 Agustus. Diakses Juni 19, 2017. http://www.uml-diagram.org. Fathansyah. 2012. Basis Data. Bandung: Informatika. Indrajani. 2015. Database Design. Jakarta: Elex Media Komputindo. Otwell, Taylor. 2016. Laravel Documentation. 15 Agustus. Diakses April 22, 2017. https://laravel.com/docs/5.4. Rosa, A S, dan M Shalahudin. 2013. Rekayasa Perangkat Lunak Terstruktur dan Berorientasi Objek. Bandung: Informatika Bandung. Sommerville, Ian. 2011. Software Engineering (Rekayasa Perangkat Lunak). Jakarta: Erlangga. Sutabri, Tata. 2012. Konsep Dasar Informasi. Yogyakarta: Andi. Yakub. 2012. Pengantar Sistem Informasi. Yogyakarta: Graha Ilmu.
A
http://digilib.mercubuana.ac.id/
~LAMPIRAN~
http://digilib.mercubuana.ac.id/
Lampiran 1. File Migration 2017_04_01_154314_departemen.php increments('id'); $table->string('nama', 50); $table->string('lokasi', 30); }); } public function down() { Schema::dropIfExists('departemen'); } } Lampiran 2. File Migration 2017_04_02_150619_pegawai.php increments('id'); $table->integer('departemen_id')->unsigned(); $table->string('nip', 18)->unique(); $table->string('jabatan', 30)->nullable(); $table->string('status', 10); $table->date('mulai_kerja'); $table->timestamps(); }); Schema::table('pegawai', function (Blueprint $table) { $table->foreign('departemen_id')->references('id')>on('departemen'); }); } public function down() { Schema::dropIfExists('pegawai'); } } Lampiran 3. File Migration 2017_04_02_153223_biodata.php increments('id'); $table->integer('pegawai_id')->unsigned(); $table->string('nama', 50);
1
http://digilib.mercubuana.ac.id/
$table->char('jenis_kelamin', 1); $table->string('agama', 11); $table->string('tempat_lahir', 30); $table->date('tanggal_lahir'); $table->string('telepon', 25)->unique(); $table->string('email', 100)->unique(); }); Schema::table('biodata', function (Blueprint $table) { $table->foreign('pegawai_id')->references('id')>on('pegawai')->onDelete('cascade'); }); } public function down() { Schema::dropIfExists('biodata'); } } Lampiran 4. File Migration 2017_04_02_153832_alamat.php
increments('id'); $table->integer('pegawai_id')->unsigned(); $table->string('jalan', 100); $table->string('kecamatan', 50); $table->string('kota', 50); $table->string('provinsi', 50); $table->char('File_pos', 5)->nullable(); }); Schema::table('alamat', function (Blueprint $table) { $table->foreign('pegawai_id')->references('id')>on('pegawai')->onDelete('cascade'); }); } public function down() { Schema::dropIfExists('alamat'); } } Lampiran 5. File Migration 2017_04_03_154505_absensi.php
increments('id'); $table->integer('pegawai_id')->unsigned(); $table->date('tanggal')->nullable(); $table->time('masuk')->nullable(); $table->time('keluar')->nullable(); $table->string('status', 2)->nullable();
2
http://digilib.mercubuana.ac.id/
$table->string('keterangan', 50)->nullable(); }); Schema::table('absensi', function (Blueprint $table) { $table->foreign('pegawai_id')->references('id')>on('pegawai'); }); } public function down() { Schema::dropIfExists('absensi'); } } Lampiran 6. File Migration 2017_05_27_145156_akun.php
increments('id'); $table->integer('pegawai_id')->unsigned(); $table->string('username', 50); $table->string('remember_token', 100); $table->string('password', 100); $table->string('role', 10); $table->timestamps(); }); Schema::table('akun', function (Blueprint $table) { $table->foreign('pegawai_id')->references('id')>on('pegawai')->onDelete('cascade'); }); } public function down() { Schema::dropIfExists('akun'); } } Lampiran 7. File Route web.php name('laporan.absensi'); Route::get('laporan/absensi/bulanan', 'LaporanAbsensiController@laporanAbsensiBulanan'); Route::get('laporan/absensi/{id}','LaporanAbsensiController@show '); Route::get('laporan/absensi/{id}/pegawai', 'LaporanAbsensiController@laporanAbsensiPegawai');
3
http://digilib.mercubuana.ac.id/
Lampiran 8. File Controller LoginController.php middleware('guest', ['except' => 'logout']); } public function username() { return 'username'; } protected function guard() { return Auth::guard(); } } Lampiran 9. File Controller HomeController role == 'pegawai') { return redirect('/'); } elseif (Auth::user()->role == 'admin') { return redirect('admin'); } } } Lampiran 10. File Controller PegawaiController.php middleware('auth'); } public function index() { if (Auth::user()->role == 'pegawai') { $pegawai = Auth::user()->pegawai; // ambil absensi bulan ini $absensi = $pegawai->absensi()>whereMonth('tanggal', date('m'))->get(); // hitung jumlah hadir, izin, sakit, telat, dan alfa pegawai $hadir = count($absensi->where('status', 'H')); $izin = count($absensi->where('status', 'I')); $sakit = count($absensi->where('status', 'S'));
4
http://digilib.mercubuana.ac.id/
$telat = count($absensi->where('status', 'T')); $alfa = count($absensi->where('status', 'A')); // simpan dalam array $status = array( 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); $absenToday = $pegawai->absensi()->where('tanggal', date('Y-m-d'))->first(); // cek apakah user memiliki absensi hari ini if (is_null($absenToday)) { // absen kosong session()->put('btnIn', 'enabled'); session()->put('btnOut', 'disabled'); } elseif ($absenToday->masuk != null && $absenToday>keluar == null) { session()->put('btnIn', 'disabled'); session()->put('btnOut', 'enabled'); } else { // ada session()->put('btnIn', 'disabled'); session()->put('btnOut', 'disabled'); } // return halaman absensi return view('pegawai.absensi', compact('absensi', 'status')); } else { return redirect()->back(); } } public function showRiwayatAbsensi() { if (Auth::user()->role == 'pegawai') { $pegawai = Auth::user()->pegawai; // ambil absensi bulan ini $absensi = $pegawai->absensi()>whereMonth('tanggal', date('m'))->get(); // hitung jumlah hadir, izin, sakit, telat, dan alfa pegawai $hadir = count($absensi->where('status', 'H')); $izin = count($absensi->where('status', 'I')); $sakit = count($absensi->where('status', 'S')); $telat = count($absensi->where('status', 'T')); $alfa = count($absensi->where('status', 'A')); // simpan dalam array $status = array( 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); return view('pegawai.riwayat', compact('absensi', 'status')); } else { return redirect()->back(); } } public function applyAbsensi(Request $request) {
5
http://digilib.mercubuana.ac.id/
if (Auth::user()->role == 'pegawai') { $pegawai = Auth::user()->pegawai; $pukulMasuk = date('08:00'); $pukulTelat = date('08:30'); $batasMasuk = date('10:00'); // proses absen masuk if (isset($request->btnIn)) { // jika pegawai datang terlambat if (date('H:i') > $pukulTelat) { // hitung jumlah waktu terlambat $jam = date('H') - 8; $menit = date('i') - 30; str_replace('-', '', $menit); $absensi = new Absensi; $absensi->pegawai_id = $pegawai->id; $absensi->tanggal = date('Y-m-d'); $absensi->masuk = date('H:i:s'); $absensi->keluar = null; $absensi->status = 'T'; $absensi->keterangan = 'Terlambat ' . $jam . ' jam ' . $menit . ' menit'; $absensi->save(); } else { // simpan absen normal normal $absensi = new Absensi; $absensi->pegawai_id = $pegawai->id; $absensi->tanggal = date('Y-m-d'); $absensi->masuk = date('H:i:s'); $absensi->keluar = null; $absensi->status = 'H'; $absensi->keterangan = ''; $absensi->save(); } $request->session()->flash('sukses', 'sukses'); Session::put('btnIn', 'disabled'); // disable button absen masuk return redirect()->back(); } // proses absen keluar elseif (isset($request->btnOut)) { // absensi keluar hanya dapat dilakukan jika pegawai telah mengisi absen masuk if (!is_null($pegawai->absensi()>where('tanggal', date('Y-m-d'))->first())) { // update data absensi pegawai hari ini $pegawai->absensi()->where('tanggal', date('Y-m-d'))->update([ 'keluar' => date('H:i:s'), ]); } Session::put('btnOut', 'disabled'); // disable button absen keluar return redirect()->back(); } } else { return redirect()->back(); } } }
6
http://digilib.mercubuana.ac.id/
Lampiran 11. File Controller AdminController.php get(); $absensiHariIni = Absensi::where('tanggal', date('Y-md'))->get(); return view('admin.home', compact('departemen', 'pegawaiBaru', 'absensiHariIni')); } } Lampiran 12. File Controller LaporanAbsensiController.php middleware('auth'); } public function index() { if (Auth::user()->role == 'admin') { $bulan = date('m'); $absensiGroup = Absensi::whereMonth('tanggal', $bulan)->get()->groupBy('pegawai_id'); $laporan = []; foreach ($absensiGroup as $absensi) { $hadir = 0; $izin = 0; $sakit = 0; $telat = 0; $alfa = 0; // hitung jumlah status kehadiran foreach ($absensi as $a) { if ($a->status == 'H') { $hadir++; } elseif ($a->status == 'I') { $izin++; } elseif ($a->status == 'S') { $izin++; } elseif ($a->status == 'T') { $telat++; } elseif ($a->status == 'A') { $alfa++; }
7
http://digilib.mercubuana.ac.id/
} $pegawai = $a->pegawai; // simpan dalam array $status = array( 'pegawai' => $pegawai, 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); array_push($laporan, $status); } return view('laporan.absensi.index', compact('laporan', 'bulan')); } else { return redirect()->back(); } } public function show($id) { if (Auth::user()->role == 'admin') { $pegawai = Pegawai::find($id); $absensi = $pegawai->absensi()>whereMonth('tanggal', date('m'))->get(); // hitung jumlah hadir, izin, sakit, telat, dan alfa pegawai $hadir = count($absensi->where('status', 'H')); $izin = count($absensi->where('status', 'I')); $sakit = count($absensi->where('status', 'S')); $telat = count($absensi->where('status', 'T')); $alfa = count($absensi->where('status', 'A')); // simpan dalam array $status = array( 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); return view('laporan.absensi.show', compact('pegawai', 'absensi', 'status')); } else { return redirect()->back(); } } public function laporanAbsensiBulanan() { if (Auth::user()->role == 'admin') { $absensiGroup = Absensi::whereMonth('tanggal', date('m'))->get()->groupBy('pegawai_id'); $laporan = []; foreach ($absensiGroup as $absensi) { $hadir = 0; $izin = 0; $sakit = 0; $telat = 0; $alfa = 0; // hitung jumlah status kehadiran foreach ($absensi as $a) { if ($a->status == 'H') {
8
http://digilib.mercubuana.ac.id/
$hadir++; } elseif ($a->status $izin++; } elseif ($a->status $izin++; } elseif ($a->status $telat++; } elseif ($a->status $alfa++; }
== 'I') { == 'S') { == 'T') { == 'A') {
} $pegawai = $a->pegawai; // simpan dalam array $status = array( 'pegawai' => $pegawai, 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); array_push($laporan, $status); } $pdf = PDF::loadView('laporan.absensi.bulanan', compact('laporan')); return $pdf->download('laporan-bulanan.pdf'); } else { return redirect()->back(); } } public function laporanAbsensiPegawai($id) { if (Auth::user()->role == 'admin') { $pegawai = Pegawai::find($id); $absensi = $pegawai->absensi()>whereMonth('tanggal', date('m'))->get(); // hitung jumlah hadir, izin, sakit, telat, dan alfa pegawai $hadir = count($absensi->where('status', 'H')); $izin = count($absensi->where('status', 'I')); $sakit = count($absensi->where('status', 'S')); $telat = count($absensi->where('status', 'T')); $alfa = count($absensi->where('status', 'A')); // simpan dalam array $status = array( 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); $pdf = PDF::loadView('laporan.absensi.pegawai', compact('pegawai', 'absensi', 'status')); return $pdf->download('absensi-pegawai.pdf'); } else { return redirect()->back(); } } }
9
http://digilib.mercubuana.ac.id/
Lampiran 13. File Controller DataAbsensiController.php middleware('auth'); } public function index(Request $request) { if (Auth::user()->role == 'admin') { if ($request->tanggal == '') { $tanggal = date('Y-m-d'); } else { $tanggal = $request->tanggal; } $absensi = Absensi::where('tanggal', $tanggal)>get(); $hadir = count($absensi->where('status', 'H')); $izin = count($absensi->where('status', 'I')); $sakit = count($absensi->where('status', 'S')); $telat = count($absensi->where('status', 'T')); $alfa = count($absensi->where('status', 'A')); // simpan dalam array $status = array( 'hadir' => $hadir, 'izin' => $izin, 'sakit' => $sakit, 'telat' => $telat, 'alfa' => $alfa ); return view('master.absensi.index', compact('absensi', 'status', 'tanggal')); } else { return redirect()->back(); } } public function create() { if (Auth::user()->role == 'admin') { return view('master.absensi.create'); } else { return redirect()->back(); } } public function store(Request $request) { if (Auth::user()->role == 'admin') { $this->validate($request, [ 'nip' => 'required|exists:pegawai,nip', 'tanggal' => 'required|date', 'status' => 'required', 'keterangan' => 'nullable|min:5|max:100', ]);
10
http://digilib.mercubuana.ac.id/
// periksa apakah status hadir if ($request->status == 'H') { // validasi jam masuk dan jam keluar $this->validate($request, [ 'masuk' => 'required', 'keluar' => 'required', ]); } $pegawai = Pegawai::where('nip', $request->nip)>first(); // periksa apakah sudah ada absensi if (!is_null($pegawai->absensi()->where('tanggal', $request->tanggal)->first())) { session()->flash('terdapat_absensi', 'Sudah ada absensi'); return redirect('master/absensi'); } $absensi = new Absensi; $absensi->pegawai_id = $pegawai->id; $absensi->tanggal = $request->tanggal; $absensi->masuk = $request->masuk; $absensi->keluar = $request->keluar; $absensi->status = $request->status; $absensi->keterangan = $request->keterangan; $absensi->save(); session()->flash('tersimpan', 'tersimpan'); return redirect('master/absensi'); } else { return redirect()->back(); } } public function edit($id) { if (Auth::user()->role == 'admin') { $absensi = Absensi::find($id); return view('master.absensi.edit', compact('absensi')); } else { return redirect()->back(); } } public function update(Request $request, $id) { if (Auth::user()->role == 'admin') { $this->validate($request, [ 'status' => 'required', ]); // periksa apakah status hadir if ($request->status == 'H') { // validasi jam masuk dan jam keluar $this->validate($request, [ 'masuk' => 'required', 'keluar' => 'required', ]); } else { $this->validate($request, [ 'keterangan' => 'required', ]); $request->masuk = null; $request->keluar = null; }
11
http://digilib.mercubuana.ac.id/
$absensi = Absensi::find($id); $absensi->masuk = $request->masuk; $absensi->keluar = $request->keluar; $absensi->status = $request->status; $absensi->keterangan = $request->keterangan; $absensi->save(); session()->flash('terubah', 'terubah'); return redirect('master/absensi'); } else { return redirect()->back(); } } public function destroy(Request $request, $id) { if (Auth::user()->role == 'admin') { Absensi::find($id)->delete(); session()->flash('terhapus', 'terhapus'); return redirect('master/absensi'); } else { return redirect()->back(); } } }
12
http://digilib.mercubuana.ac.id/