Example #1
0
 function shift($dep = 0, $period = 0)
 {
     $this->data['title'] = $this->title;
     permission();
     $data['path_file'] = $this->filename;
     permissionkaryawan($this->session->userdata('webmaster_id'), $data['path_file']);
     $data['main_content'] = $data['path_file'];
     $data['filename'] = $this->filename;
     $data['title'] = $this->title;
     $path_paging = base_url() . $this->filename . "/main/" . $dep . "/" . $period;
     $uri_segment = 5;
     $pg = $this->uri->segment($uri_segment);
     $per_page = 15;
     //End Global
     //$data['opt_pic'] = GetOptPIC();
     $data['opt_pic'][''] = "";
     //$data['opt_dep'] = GetOptDepartment();
     //$data['opt_dep'][''] = "";
     $filter = array("bulan" => "order/asc", "tahun" => "order/asc", "person_nm" => "order/asc");
     //$filter = array("tahun"=> "order/asc", "bulan"=> "order/asc", "person_nm"=> "order/asc");
     $filter_where_in = array();
     if ($dep && $dep != "-") {
         $exp = explode("-", $dep);
         $dep = array();
         foreach ($exp as $r) {
             $dep[] = $r;
         }
         $filter_where_in['id_department'] = $dep;
     } else {
         $dep = array();
     }
     if ($period) {
         $period = urldecode($period);
     } else {
         $period = date("M Y");
     }
     $filter['bulan'] = "where/" . GetMonthIndex(substr($period, 0, 3));
     $filter['tahun'] = "where/" . substr($period, 4, 4);
     $data['dep'] = $dep;
     $data['period'] = $period;
     $data['grid'] = array("Name", "Bulan", "Shift 1", "Shift 2", "Shift 3", "Reguler", "Off");
     $data['query_all'] = GetAll('kg_view_jadwal_shift', $filter, $filter_where_in);
     $filter['limit'] = $pg . "/" . $per_page;
     $data['query_list'] = GetAll('kg_view_jadwal_shift', $filter, $filter_where_in);
     $data['list'] = array("person_nm", "bulan", "jum_p", "jum_s", "jum_m", "jum_ns", "jum_off");
     //lastq();
     //Page
     $pagination = Page($data['query_all']->num_rows(), $per_page, $pg, $path_paging, $uri_segment);
     if (!$pagination) {
         $pagination = "<strong>1</strong>";
     }
     $data['pagination'] = $pagination;
     //End Page
     $this->load->view('shift', $data);
 }
Example #2
0
 function ajax_list_shift($period = NULL, $regs = NULL, $div = NULL, $sec = NULL, $pos = NULL, $grade = NULL)
 {
     permission();
     $this->load->model('shift_model', 'shift');
     $period = urldecode($period);
     $bulan = GetMonthIndex(substr($period, 0, 3));
     $tahun = substr($period, 4, 4);
     $param = array("bulan" => $bulan, "tahun" => $tahun, "regs" => $regs, "divisi" => $div, "section" => $sec, "position" => $pos, "grade" => $grade);
     $list = $this->shift->get_datatables($param);
     $data = array();
     $no = $_POST['start'];
     foreach ($list->result() as $r) {
         $no++;
         $edit = '<a class="btn btn-sm btn-primary" href="javascript:void(0);" onclick="detailShift(' . "'" . $r->id_employee . "'" . ', ' . "'" . GetPeriod($period) . "'" . ')"><i class="glyphicon glyphicon-info-sign"></i> Detail</a>';
         $data[] = array($no, $r->ext_id, $r->person_nm, GetMonth(intval($r->bulan)) . ' ' . $r->tahun, $r->jum_p, $r->jum_s, $r->jum_m, $r->jum_ns, $r->jum_off, $edit);
     }
     $output = array("draw" => $_POST['draw'], "recordsTotal" => $this->shift->count_all($param), "recordsFiltered" => $this->shift->count_all($param), "data" => $data);
     //output to json format
     echo json_encode($output);
 }
Example #3
0
 function GetPeriod($param)
 {
     $exp = explode(" ", $param);
     $bln = GetMonthIndex($exp[0]);
     $tgl_start = GetValue("value", "kg_config", array("title" => "where/att_start_period"));
     $tgl_start = sprintf("%02d", $tgl_start);
     $tgl_end = GetValue("value", "kg_config", array("title" => "where/att_end_period"));
     if ($tgl_start >= $tgl_end) {
         $start = date("Y-m-d", mktime(0, 0, 0, $bln - 1, $tgl_start, $exp[1]));
         $end = $exp[1] . "-" . $bln . "-" . $tgl_end;
     } else {
         $start = $exp[1] . "-" . $bln . "-" . $tgl_start;
         $end = $exp[1] . "-" . $bln . "-" . $tgl_end;
     }
     return $start . "~" . $end;
 }
Example #4
0
 function compare_ovt()
 {
     $ext = array();
     $q = GetAll("kg_overtime_temp");
     foreach ($q->result_array() as $r) {
         $exp = explode("-", $r['ovt_date']);
         $dt = $exp[2] . "-" . GetMonthIndex($exp[1]) . "-" . sprintf("%02d", $exp[0]);
         $id_kehadirandetil = GetValue("id", "kg_view_attendance", array("date_full" => "where/" . $dt, "ext_id" => "where/" . $r['ext_id']));
         if ($id_kehadirandetil) {
             //$cek = GetValue("id", "kg_overtime", array("id_kehadirandetil"=> "where/".$id_kehadirandetil));
             //if(!$cek) {
             $ins = array("id_kehadirandetil" => $id_kehadirandetil, "ovt_hour_sum" => $r['ovt_hour_sum'], "ovt_flag" => $r['ovt_flag'], "ovt_reason" => $r['ovt_reason'], "ovt_detail_reason" => $r['ovt_detail_reason']);
             $this->db->insert("kg_overtime", $ins);
             //}
         }
         // else $ext[$r['ext_id']] = $r['ext_id'];
     }
     //print_mz($ext);
 }