コード例 #1
0
ファイル: shift_detail.php プロジェクト: pay-test/ci2
 for ($a = 1; $a <= $akhir; $a++) {
     $dt = $r['tahun'] . "-" . $r['bulan'] . "-" . sprintf("%02d", $a);
     if (date("w", strtotime($dt)) == 0 || date("w", strtotime($dt)) == 6) {
         $cls = "sunday";
     } else {
         $cls = "";
     }
     $day = substr(date("l", strtotime($dt)), 0, 1);
     echo "<td width='50' class='" . $cls . "'>" . $day . " / " . $a . "</td>";
 }
 echo "</tr><tr><th>Schedule</th>";
 for ($a = 1; $a <= $akhir; $a++) {
     $auto = 0;
     $dt = $r['tahun'] . "-" . $r['bulan'] . "-" . sprintf("%02d", $a);
     if ($r['tgl_' . $a] == 3) {
         $auto = CekLemburAuto($r['id_employee'], $dt) ? 1 : 0;
     }
     if (in_array($dt, $holiday)) {
         if (preg_match("/MCCI/", $holiday[$dt])) {
             $cls = "holiday_office";
         } else {
             $cls = "holiday";
         }
     } else {
         if ($auto) {
             $cls = "lembur_auto";
         } else {
             if (strtoupper($r['tgl_' . $a]) == "OFF") {
                 $cls = "offz";
             } else {
                 if (strtoupper($shift_ril_2['tgl_' . $a]) != strtoupper($r['tgl_' . $a])) {
コード例 #2
0
ファイル: attendance_form.php プロジェクト: pay-test/ci2
 function update_overtime()
 {
     $webmaster_id = permission();
     $id = $this->input->post('id');
     //Cek Scan
     $scan_in = $this->input->post('scan_in');
     $scan_out = $this->input->post('scan_out');
     $date_full = $this->input->post('date_full');
     $id_kehadirandetil = GetValue("id", "kg_view_attendance", array("id_employee" => "where/" . $webmaster_id, "date_full" => "where/" . $date_full));
     if ($scan_in > 0 && $scan_out > 0 || $id) {
         $data['time_in'] = $this->input->post('time_in');
         $data['time_out'] = $this->input->post('time_out');
         $data['start_ovt'] = $this->input->post('start_ovt');
         $data['end_ovt'] = $this->input->post('end_ovt');
         $data['ovt_hour_sum'] = GetHourSum($this->input->post('start_ovt'), $this->input->post('end_ovt'));
         //$data['ovt_flag'] = $this->input->post('ovt_flag');
         $data['id_reason'] = $this->input->post('ovt_reason');
         $data['ovt_detail_reason'] = $this->input->post('ovt_detail_reason');
         $data['ovt_feedback'] = $this->input->post('ovt_feedback');
         $data['is_read'] = 0;
         //print_mz($data);
         $data['modify_date'] = date("Y-m-d H:i:s");
         //print_mz($data);
         if ($id > 0) {
             $cek_status = GetValue("ovt_status", "kg_overtime", array("id" => "where/" . $id));
             //if($cek_status=="Waiting") {
             if ($this->input->post('ovt_status')) {
                 $data['ovt_status'] = $this->input->post('ovt_status');
             }
             $data['modify_user_id'] = $webmaster_id;
             if (isset($data['ovt_status']) == "Approve") {
                 unset($data['start_ovt']);
                 unset($data['end_ovt']);
                 $data['start_ovt_ref'] = $this->input->post('start_ovt');
                 $data['end_ovt_ref'] = $this->input->post('end_ovt');
                 $id_emp = $this->input->post("id_emp");
                 $exp = explode("-", $date_full);
                 $cek_jadwal = GetValue("tgl_" . intval($exp[2]), "kg_jadwal_shift", array("id_employee" => "where/" . $id_emp, "bulan" => "where/" . $exp[1], "tahun" => "where/" . $exp[0]));
                 if ($cek_jadwal == 3) {
                     if (CekLemburAuto($id_emp, $date_full)) {
                         $cek_jadwal = 33;
                     }
                 }
                 $data['ovt_hour_cal'] = GetAccOvt($data['ovt_hour_sum'], $cek_jadwal);
                 $exp = explode("-", $date_full);
                 //Cek Closing Period
                 $tgl_closing = GetConfigDirect('close_period');
                 $start_period = GetConfigDirect('att_start_period');
                 if (intval($exp[2]) > $tgl_closing) {
                     $closing = date("Y-m-d", mktime(0, 0, 0, $exp[1] + 1, $tgl_closing, $exp[0]));
                 } else {
                     $closing = $exp[0] . "-" . $exp[1] . "-" . $tgl_closing;
                 }
                 if (date("Y-m-d") > $closing) {
                     $data['date_temp'] = str_replace("-" . $tgl_closing, "-" . $start_period, $closing);
                 }
             }
             //print_mz($data);
             $this->db->where("id", $id);
             $this->db->update("kg_overtime", $data);
             //Admin Log
             //$logs = $this->db->last_query();
             //$this->model_admin_all->LogActivities($webmaster_id,$this->tabel,$this->db->insert_id(),$logs,lang($this->filename),$data[$this->title_table],$this->filename,"Add");
             //$this->session->set_flashdata("message", lang('edit')." ".$this->title." ".lang('msg_sukses'));
             $this->session->set_userdata("message", "Submitted");
             //}
         } else {
             $data['id_kehadirandetil'] = $id_kehadirandetil;
             $data['create_user_id'] = $webmaster_id;
             $data['create_date'] = $data['modify_date'];
             //print_mz($data);
             $this->db->insert("kg_overtime", $data);
             $id = $this->db->insert_id();
             //Admin Log
             //$logs = $this->db->last_query();
             //$this->model_admin_all->LogActivities($webmaster_id,$this->tabel,$this->db->insert_id(),$logs,lang($this->filename),$data[$this->title_table],$this->filename,"Add");
             $this->session->set_userdata("message", "Your request has been submitted");
         }
     } else {
         $this->session->set_userdata("message", "Failed");
     }
     //die($this->session->flashdata('message')."S");
     redirect(site_url('attendance_form/overtime/' . $id));
 }