Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $oldpresensi = Presensi::where([
- ['status', '=', 'Rutin'],
- ['slotjam', '=', $slotjam],
- ['karyawan_id', '=', $id_karyawan],
- ['tanggal_dan_waktu_tap', '=', $tanggal_waktu_tap],
- ])->first();
- if(isset($oldpresensi)) {
- $oldpresensi->update($presensi);
- $data_terinput = $data_terinput + 0;
- } else {
- //dd(date('Y-m-d', strtotime($today)));
- if(date('Y-m-d', strtotime($tanggal_waktu_tap)) == date('Y-m-d', strtotime("2021-02-19"))) {
- $pernah_masuk = 0;
- $pernah_istirahat_mulai = 0;
- $pernah_istirahat_selesai = 0;
- $pernah_pulang = 0;
- // cek jam masuk
- if((($slotjam == 'Masuk') || ($slotjam == 'Terlambat Masuk')) && ($pernah_masuk == 0)) {
- $data_terinput = $data_terinput + 1;
- Presensi::create($presensi);
- $pernah_masuk = 1;
- }
- // cek jam istirahat mulai
- else if($slotjam == 'Istirahat Mulai' && $pernah_istirahat_mulai == 0) {
- $data_terinput = $data_terinput + 1;
- Presensi::create($presensi);
- $pernah_istirahat_mulai = 1;
- }
- // cek jam istirahat selesai
- else if($slotjam == 'Istirahat Selesai' && $pernah_istirahat_selesai == 0) {
- $data_terinput = $data_terinput + 1;
- Presensi::create($presensi);
- $pernah_istirahat_selesai = 1;
- }
- // cek jam pulang
- else if($slotjam == 'Pulang' && $pernah_pulang == 0) {
- $data_terinput = $data_terinput + 1;
- Presensi::create($presensi);
- $pernah_pulang = 1;
- } else {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement