Пример #1
0
 function detail($user = "******", $tgl = "0000-00-00", $dep = "0", $shift = "0", $status = "0")
 {
     $data['user'] = $user;
     //$data['path_file'] = $this->filename.'_user_migrasi';
     $data['path_file'] = $this->filename . '_user';
     $data['main_content'] = $data['path_file'];
     $data['filename'] = $this->filename;
     $data['title'] = $this->title;
     //if($user == 0 && $tgl == "0000-00-00" && !$this->uri->segment(5)) $tgl = date("Y-m-d");
     $data['tgl'] = $tgl;
     $exp = explode("~", $tgl);
     $data['tgl_today'] = $exp[0];
     if ($exp[0] != "0000-00-00") {
         $data['start_date'] = $exp[0];
         if (!isset($exp[1])) {
             $data['end_date'] = $exp[0];
         } else {
             if (!$exp[1]) {
                 $data['end_date'] = $exp[0];
             } else {
                 $data['end_date'] = $exp[1];
             }
         }
     } else {
         $data['start_date'] = $data['end_date'] = "";
     }
     $data['shift'] = $shift;
     /* Mazhters */
     if ($exp[0] == date("Y-m-d")) {
         $tabel_view = "kg_view_kehadiran_rutin";
     } else {
         $tabel_view = "kg_view_kehadiran_mcci";
     }
     /* End Mazhters */
     $path_paging = base_url() . $this->filename . "/main/" . $user . "/" . $tgl . "/" . $dep . "/" . $shift . "/" . $status;
     $uri_segment = 8;
     $pg = $this->uri->segment($uri_segment);
     /*riza*/
     $filter = array($tabel_view . ".tahun" => "order/asc", $tabel_view . ".bulan" => "order/asc", $tabel_view . ".tanggal" => "order/asc");
     $per_page = 500;
     //End Global
     $filter_where_in = array();
     $data['opt_pic'] = GetOptPIC();
     $data['opt_pic'][''] = "";
     $data['opt_dep'] = GetOptDepartment();
     //$data['opt_dep'][''] = "";
     $data['opt_tgl'] = GetOptDate();
     $data['opt_bln'] = GetOptMonth();
     $data['opt_thn'] = GetOptYear();
     $exp = explode("-", $exp[0]);
     if (!isset($exp[0])) {
         $exp[0] = "";
     }
     if (!isset($exp[1])) {
         $exp[1] = "";
     }
     if (!isset($exp[2])) {
         $exp[2] = "";
     }
     //if($exp[2] > 0) $filter = array("tahun"=> "order/asc", "bulan"=> "order/asc", "tanggal"=> "order/asc");
     //else $filter = array("id_employee"=> "order/asc", "tahun"=> "order/asc", "bulan"=> "order/asc", "tanggal"=> "order/asc");
     if ($status) {
         /*if($status == "alpa2")
           {
               $kemarin = date("Y-m-d", mktime(0, 0, 0, $exp[1], $exp[2]-1, $exp[0]));
               $exp_alpa = explode("-", $kemarin);
               $filter["alpa"] = "where/1";
           }
           else */
         if ($status == "jh") {
             $filter['terlambat !='] = "where/1";
         }
         $filter[$status] = "where/1";
     }
     $kondisi = "";
     if ($status == "alpa2") {
         $tgl_alpa = array($exp[2], $exp_alpa[2]);
         $filter_where_in['tanggal'] = $tgl_alpa;
         $bln_alpa = array($exp[1], $exp_alpa[1]);
         $filter_where_in['bulan'] = $bln_alpa;
         $thn_alpa = array($exp[0], $exp_alpa[0]);
         $filter_where_in['tahun'] = $thn_alpa;
     } else {
         if ($data['start_date'] == $data['end_date']) {
             if ($exp[0] > 0) {
                 $filter[$tabel_view . '.tahun'] = "where/" . $exp[0];
                 $data['title'] = $this->title . " ( " . $exp[0] . " )";
                 if ($exp[1] > 0) {
                     $filter[$tabel_view . '.bulan'] = "where/" . $exp[1];
                     $data['title'] = $this->title . " ( " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     if ($exp[2] > 0) {
                         $filter[$tabel_view . '.tanggal'] = "where/" . $exp[2];
                         $data['title'] = $this->title . " ( " . $exp[2] . " " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     }
                 }
             } else {
                 if ($exp[1] > 0) {
                     $exp[0] = date("Y");
                     $filter['tahun'] = "where/" . $exp[0];
                     $filter['bulan'] = "where/" . $exp[1];
                     $data['title'] = $this->title . " ( " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     if ($exp[2] > 0) {
                         $filter['tanggal'] = "where/" . $exp[2];
                         $data['title'] = $this->title . " ( " . $exp[2] . " " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     }
                 } else {
                     if ($exp[2] > 0) {
                         $exp[0] = date("Y");
                         $exp[1] = date("m");
                         $filter['tahun'] = "where/" . $exp[0];
                         $filter['bulan'] = "where/" . $exp[1];
                         $filter['tanggal'] = "where/" . $exp[2];
                         $data['title'] = $this->title . " ( " . $exp[2] . " " . GetMonth(intval($exp[1])) . " " . $exp[0] . " )";
                     }
                 }
             }
         }
     }
     if ($dep) {
         /*$ex = explode("-",$dep);
           $dep=array();
           foreach($ex as $r)
           {
               $dep[] = $r;
           }
           $filter_where_in['id_department'] = $dep;*/
         $filter['id_department'] = "where/" . $dep;
     }
     //else $dep=array();
     if ($user) {
         $temp_user = $user;
         $ex = explode("-", $user);
         $user = array();
         foreach ($ex as $r) {
             $user[] = $r;
         }
         $filter_where_in['id_employee'] = $user;
         $user = $temp_user;
     }
     //else $user=array();
     $data['spic'] = $user;
     $data['sdep'] = $dep;
     /*$data['stgl'] = $exp[2];
       $data['sbln'] = $exp[1];
       $data['sthn'] = $exp[0];*/
     //Grup Admin
     $id_grup = $this->session->userdata("webmaster_grup");
     $where = "";
     if ($id_grup == 4) {
         $filter['nik'] = "where/-";
     }
     //else if($id_grup == 3) $filter['urut_position <'] = "where/40";
     //else if($id_grup == 2) $filter['urut_position >='] = "where/40";
     //End
     //$filter['urut_position'] = "order/asc";
     $filter[$tabel_view . '.id_employee'] = "order/asc";
     //if(count($user) > 0 || $exp[2] > 0)
     if ($exp[2] > 0 && $data['start_date'] == $data['end_date'] || $user) {
         $data['emp'] = GetAll("hris_persons", array("person_id" => "where/" . $user));
         $data['flag_tgl'] = 1;
         $data['grid'] = array("Date", "Hadir", "OFF", "Cuti", "Ijin", "Sick", "Alpa", "Late", "In", "Out", "Shift", "Description");
         $data['list'] = array("tgl", "jh", "off", "cuti", "ijin", "sakit", "alpa", "terlambat", "scan_masuk", "scan_pulang", "shift", "keterangan");
         if ($data['start_date']) {
             $filter['date_full >='] = "where/" . $data['start_date'];
             $filter['date_full <='] = "where/" . $data['end_date'];
         }
         if ($shift) {
             //if($shift == "p") $where_shift = " (kg_jadwal_shift.tgl_".intval($exp[2])."='".$shift."' || kg_jadwal_shift.tgl_".intval($exp[2])."='ns')";
             if ($shift == "p") {
                 $where_shift = " (kg_jadwal_shift.tgl_" . intval($exp[2]) . "!='s' && kg_jadwal_shift.tgl_" . intval($exp[2]) . "!='m')";
             } else {
                 $where_shift = " kg_jadwal_shift.tgl_" . intval($exp[2]) . "='" . $shift . "' ";
             }
             $data['query_all'] = GetJoin($tabel_view, "jadwal_shift", "kg_jadwal_shift.id_employee=" . $tabel_view . ".id_employee and kg_jadwal_shift.bulan='" . $exp[1] . "' and kg_jadwal_shift.tahun='" . $exp[0] . "' and {$where_shift}", "inner", "*", $filter, $filter_where_in);
             $filter['limit'] = $pg . "/" . $per_page;
             $data['query_list'] = GetJoin($tabel_view, "jadwal_shift", "kg_jadwal_shift.id_employee=" . $tabel_view . ".id_employee and kg_jadwal_shift.bulan='" . $exp[1] . "' and kg_jadwal_shift.tahun='" . $exp[0] . "' and {$where_shift}", "inner", "*," . $tabel_view . ".id as id_k", $filter, $filter_where_in);
         } else {
             $data['query_all'] = GetAll($tabel_view, $filter, $filter_where_in);
             $filter['limit'] = $pg . "/" . $per_page;
             $data['query_list'] = GetAll($tabel_view, $filter, $filter_where_in);
         }
     } else {
         if ($data['start_date']) {
             $filter['date_full >='] = "where/" . $data['start_date'];
             $filter['date_full <='] = "where/" . $data['end_date'];
         }
         $data['flag_tgl'] = 0;
         $data['grid'] = array("Nama Karyawan", "JHK", "Hadir", "OFF", "Cuti", "PHL", "Ijin", "Sakit", "Alpa", "Potong Gaji", "Pulang Cepat");
         $data['list'] = array("person_nm", "jhk", "jh", "off", "cuti", "phl", "ijin", "sakit", "alpa", "potong_gaji", "pc");
         /*if($exp[1] > 0) $filter['group'] = array("employee.id","bulan","tahun");
           elseif($exp[0] > 0) $filter['group'] = array("employee.id","tahun");
           else */
         //$filter['group'] = array("employee.id","tahun");
         $filter['id_employee'] = "group";
         //else $filter['group'] = array("employee.id");
         /*$select = "employee.id as a_id,employee.name, kg_attendance.id, SUM(kg_attendance.jhk) as jhk, SUM(kg_attendance.sakit) as sakit,
           SUM(kg_attendance.cuti) as cuti,SUM(kg_attendance.ijin) as ijin,,SUM(kg_attendance.alpa) as alpa,SUM(kg_attendance.off) as off,
           SUM(kg_attendance.potong_gaji) as potong_gaji, SUM(kg_attendance.pc) as pc,SUM(kg_attendance.jh) as jh";
           $data['query_all'] = GetJoin("employee","attendance","attendance.id_employee=employee.id ".$kondisi, "left", $select, $filter, $filter_where_in);*/
         $select = "id, person_nm, id_employee as a_id, SUM(jhk) as jhk, SUM(sakit) as sakit,\n            SUM(cuti) as cuti,SUM(ijin) as ijin,SUM(phl) as phl,SUM(alpa) as alpa,SUM(off) as off,\n            SUM(potong_gaji) as potong_gaji, SUM(pc) as pc, SUM(jh) as jh";
         $data['query_all'] = GetAllSelect($tabel_view, $select, $filter);
         //lastq();
         $filter['limit'] = $pg . "/" . $per_page;
         //$data['query_list'] = GetJoin("employee","attendance","attendance.id_employee=employee.id ".$kondisi, "left", $select, $filter, $filter_where_in);
         $data['query_list'] = GetAllSelect($tabel_view, $select, $filter);
         //die($this->db->last_query());
     }
     if (!$this->uri->segment(3) && !$this->uri->segment(4) && !$this->uri->segment(5)) {
         $data['dis_tgl'] = "display:none;";
     } else {
         $data['dis_tgl'] = "display:''";
     }
     //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->_render_page($this->filename . '_detail', $data);
 }
Пример #2
0
 function baca_cron($tglz = NULL, $blnz = NULL, $thnz = NULL)
 {
     if (!$tglz) {
         $tglz = date("d");
     }
     if (strlen($tglz) == 1) {
         $tglz = "0" . $tglz;
     }
     if (!$blnz) {
         $blnz = date("m");
     }
     if (!$thnz) {
         $thnz = date("Y");
     }
     $create_date = date("Y-m-d H:i:s");
     $temp = $temp_key = "";
     $absen = array();
     //LEFT join untuk yg di cron karena mencatat ALPA, klo disini INNER join
     $sql = GetJoin("users", "tadat", "users.mchID=tadat.mchID AND DAY(tgl)='" . $tglz . "' AND MONTH(tgl)='" . $blnz . "' AND YEAR(tgl)='" . $thnz . "'", "inner", "users.mchID as nik_emp, tadat.*", array("nik_emp" => "order/asc", "tgl" => "order/asc"));
     //lastq();
     foreach ($sql->result_array() as $r) {
         $cardno = $r['nik_emp'];
         if ($temp != $cardno) {
             if ($temp) {
                 $absen[$temp_key]['keluar'] = $last_data;
             }
             $absen[$cardno]['masuk'] = substr($r['tgl'], 11);
             $temp = $cardno;
             $temp_key = $cardno;
         }
         $last_data = substr($r['tgl'], 11);
     }
     if ($temp) {
         $absen[$cardno]['keluar'] = $last_data;
     }
     //print_mz($absen);
     foreach ($absen as $id_nik => $r) {
         $masuk = $r['masuk'];
         $keluar = $r['keluar'];
         if ($masuk == $keluar) {
             $keluar = "";
         }
         $cek_hadir = GetValue("id", "attendance", array("nik" => "where/" . $id_nik, "tanggal" => "where/" . $tglz, "bulan" => "where/" . $blnz, "tahun" => "where/" . $thnz));
         if (!$cek_hadir) {
             $jh = $alpa = $telat = 0;
             //$jadwal = strtoupper(GetValue("tgl_".intval($tglz), "jadwal_shift", array("bulan"=> "where/".$blnz, "tahun"=> "where/".$thnz, "id_employee"=> "where/".$id_employee)));
             if ($masuk) {
                 $cek_jam = intval(substr($masuk, 0, 2));
                 $cek_menit = substr($masuk, 3, 2);
                 $jam_menit = $cek_jam . $cek_menit;
                 $jh = 1;
                 //if(($jadwal) == "NS" && $jam_menit >= 901) $telat=1;
                 //else
                 if ($jam_menit >= 901) {
                     $telat = 1;
                 }
             } else {
                 $alpa = 1;
             }
             $data = array("nik" => $id_nik, "jhk" => 1, "jh" => $jh, "alpa" => $alpa, "terlambat" => $telat, "tanggal" => $tglz, "bulan" => $blnz, "tahun" => $thnz, "scan_masuk" => $masuk, "scan_pulang" => $keluar, "create_date" => $create_date);
             $this->db->insert("attendance", $data);
         } else {
             $data = array("scan_masuk" => $masuk, "scan_pulang" => $keluar, "modify_date" => $create_date);
             $this->db->where("id", $cek_hadir);
             $this->db->update("attendance", $data);
         }
     }
 }
Пример #3
0
 function baca_cron_bulan($tglz = NULL, $blnz = NULL, $thnz = NULL)
 {
     $create_date = date("Y-m-d H:i:s");
     $loop = $tglz;
     for ($b = 1; $b <= $loop; $b++) {
         $day = date("w", mktime(1, 1, 1, $blnz, $b, $thnz));
         if ($day != 0 && $day != 6) {
             $tglz = $b;
             if (strlen($tglz) == 1) {
                 $tglz = "0" . $tglz;
             }
             $temp = $temp_key = "";
             $absen = array();
             $sql = GetJoin("employee", "kehadiran_history", "kg_employee.id=kg_kehadiran_history.id_employee AND DAY(scan)='" . $tglz . "' AND MONTH(scan)='" . $blnz . "' AND YEAR(scan)='" . $thnz . "'", "left", "kg_employee.id as id_emp, kg_kehadiran_history.*", array("id_emp" => "order/asc", "scan" => "order/asc"));
             foreach ($sql->result_array() as $r) {
                 $cardno = $r['id_emp'];
                 if ($temp != $cardno) {
                     if ($temp) {
                         $absen[$temp_key]['keluar'] = $last_data;
                     }
                     $absen[$cardno]['masuk'] = substr($r['scan'], 11);
                     $temp = $cardno;
                     $temp_key = $cardno;
                 }
                 $last_data = substr($r['scan'], 11);
             }
             if ($temp) {
                 $absen[$cardno]['keluar'] = $last_data;
             }
             //print_mz($absen);
             foreach ($absen as $id_employee => $r) {
                 $masuk = $r['masuk'];
                 $keluar = $r['keluar'];
                 if ($masuk == $keluar) {
                     $keluar = "";
                 }
                 $cek_hadir = GetValue("id", "kehadirandetil", array("id_employee" => "where/" . $id_employee, "tanggal" => "where/" . $tglz, "bulan" => "where/" . $blnz, "tahun" => "where/" . $thnz));
                 if (!$cek_hadir) {
                     $jh = $alpa = $telat = 0;
                     //$jadwal = strtoupper(GetValue("tgl_".intval($tglz), "jadwal_shift", array("bulan"=> "where/".$blnz, "tahun"=> "where/".$thnz, "id_employee"=> "where/".$id_employee)));
                     if ($masuk) {
                         $cek_jam = intval(substr($masuk, 0, 2));
                         $cek_menit = substr($masuk, 3, 2);
                         $jam_menit = $cek_jam . $cek_menit;
                         $jh = 1;
                         //if(($jadwal) == "NS" && $jam_menit >= 901) $telat=1;
                         //else
                         if ($jam_menit >= 901) {
                             $telat = 1;
                         }
                     } else {
                         $alpa = 1;
                     }
                     $data = array("id_employee" => $id_employee, "jhk" => 1, "jh" => $jh, "alpa" => $alpa, "terlambat" => $telat, "tanggal" => $tglz, "bulan" => $blnz, "tahun" => $thnz, "scan_masuk" => $masuk, "scan_pulang" => $keluar, "create_date" => $create_date);
                     $this->db->insert("kehadirandetil", $data);
                     echo $this->db->last_query() . ";<br>";
                 }
             }
         }
     }
 }
Пример #4
0
 public function get_modal()
 {
     if (!$this->ion_auth->logged_in()) {
         //redirect them to the login page
         redirect('auth/login', 'refresh');
     } elseif (!$this->ion_auth->is_admin()) {
         //redirect them to the home page because they must be an administrator to view this
         //return show_error('You must be an administrator to view this page.');
         return show_error('You must be an administrator to view this page.');
     } else {
         //list of filterize limit position for pagination
         $this->data['position'] = $this->position_model->position()->result();
         $f_position_group = array("is_deleted" => "where/0");
         $q_position_group = GetAll('position_group', $f_position_group);
         $this->data['position_group'] = $q_position_group->num_rows() > 0 ? $q_position_group : array();
         $f_parent = array("is_deleted" => "where/0");
         $q_parent = GetAll('position', $f_parent);
         $this->data['q_parent'] = $q_parent;
         $this->data['parent'] = $q_parent->num_rows() > 0 ? $q_parent : array();
         $f_organization = array("organization.is_deleted" => "where/0", "organization.organization_class_id" => "order/asc");
         //GetJoin($tbl,$tbl_join,$condition,$type,$select,$filter=array())
         //$q_organization = GetAll('organization', $f_organization);
         $q_organization = GetJoin('organization', 'organization_class', 'organization.organization_class_id = organization_class.id', 'left', 'organization.*, organization_class.title as organization_class_title', $f_organization);
         $this->data['organization'] = $q_organization->num_rows() > 0 ? $q_organization : array();
         $f_competency_group = array("is_deleted" => "where/0");
         $q_competency_group = GetAll('competency_group', $f_competency_group);
         $this->data['competency_group'] = $q_competency_group->num_rows() > 0 ? $q_competency_group : array();
         $this->_render_page('position/modal/index', $this->data);
     }
 }
Пример #5
0
                                    <?php 
        $f_competency_def = array('is_deleted' => "where/0", 'comp_group_id' => "where/" . $row['id'], 'title' => "order/asc");
        $q_competency_def = GetAll_('competency_def', $f_competency_def);
        $competency_def = $q_competency_def->num_rows() > 0 ? $q_competency_def : array();
        foreach ($competency_def->result_array() as $value) {
            echo '<option value="' . $value['id'] . '" >' . $value['title'] . '</option>';
        }
        ?>
                                    </select>
                                </div>
                            </div>

                            <div id="position_conpetency_div">
                            <?php 
        $f_position_competency = array('position_competency.is_deleted' => "where/0", 'position_competency.position_id' => "where/" . $user->id, 'competency_def.comp_group_id' => "where/" . $row['id']);
        $q_competency_def = GetJoin('position_competency', 'competency_def', 'position_competency.competency_def_id = competency_def.id', 'left', 'position_competency.id as id,position_competency.position_id as position_id,position_competency.itj as itj,competency_def.title as competency_title', $f_position_competency);
        if ($q_competency_def->num_rows() > 0) {
            ?>
                            <div class="row form-row">
                                <div class="col-md-8 col-md-offset-4">
                                    <table class="table">
                                        <tr>
                                            <th>Competency</th>
                                            <th>ITJ</th>
                                        </tr>
                                        <?php 
            foreach ($q_competency_def->result_array() as $comp) {
                ?>
                                        <tr id="row_pos_comp<?php 
                echo $comp['id'];
                ?>