Advertisement
vitareinforce

lockTap2

Feb 19th, 2021
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. $oldpresensi = Presensi::where([
  2. ['status', '=', 'Rutin'],
  3. ['slotjam', '=', $slotjam],
  4. ['karyawan_id', '=', $id_karyawan],
  5. ['tanggal_dan_waktu_tap', '=', $tanggal_waktu_tap],
  6. ])->first();
  7.  
  8. if(isset($oldpresensi)) {
  9. $oldpresensi->update($presensi);
  10. $data_terinput = $data_terinput + 0;
  11. } else {
  12. //dd(date('Y-m-d', strtotime($today)));
  13. if(date('Y-m-d', strtotime($tanggal_waktu_tap)) == date('Y-m-d', strtotime("2021-02-19"))) {
  14. $pernah_masuk = 0;
  15. $pernah_istirahat_mulai = 0;
  16. $pernah_istirahat_selesai = 0;
  17. $pernah_pulang = 0;
  18.  
  19. // cek jam masuk
  20. if((($slotjam == 'Masuk') || ($slotjam == 'Terlambat Masuk')) && ($pernah_masuk == 0)) {
  21. $data_terinput = $data_terinput + 1;
  22. Presensi::create($presensi);
  23. $pernah_masuk = 1;
  24. }
  25. // cek jam istirahat mulai
  26. else if($slotjam == 'Istirahat Mulai' && $pernah_istirahat_mulai == 0) {
  27. $data_terinput = $data_terinput + 1;
  28. Presensi::create($presensi);
  29. $pernah_istirahat_mulai = 1;
  30. }
  31. // cek jam istirahat selesai
  32. else if($slotjam == 'Istirahat Selesai' && $pernah_istirahat_selesai == 0) {
  33. $data_terinput = $data_terinput + 1;
  34. Presensi::create($presensi);
  35. $pernah_istirahat_selesai = 1;
  36. }
  37. // cek jam pulang
  38. else if($slotjam == 'Pulang' && $pernah_pulang == 0) {
  39. $data_terinput = $data_terinput + 1;
  40. Presensi::create($presensi);
  41. $pernah_pulang = 1;
  42. } else {
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement