Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function laporan_gaji()
- {
- if($this->ion_auth->logged_in() != $this->ion_auth->is_admin())
- {
- $user = $this->ion_auth->user()->row();
- // Check Employe by Id user, ini sekaligus menyaring user yang belum bayar.
- $check_employee = $this->admin_model->get_user_employee_by_id_user($user->id)->row();
- if($check_employee != null)
- {
- $id_company = $check_employee->company_id;
- }
- // Check tanggal awal dan tanggal akhir bulan
- $data_tgl_skrng = date("Y-m-d");
- $tanggal_awal = date("Y-m-01");
- $tanggal_akhir = date("Y-m-t", strtotime($data_tgl_skrng));
- // hari sabtu dan minggu di set 0;
- $hari_sab = 0;
- $hari_min = 0;
- while (strtotime($tanggal_awal) <= strtotime($tanggal_akhir))
- {
- $datte = $tanggal_awal;
- $tgll = explode("-",$datte);
- $hari = date("l", mktime(0, 0, 0, $tgll[1], $tgll[2], $tgll[0]));
- if($hari=="Saturday")
- {
- $hari_sab++;
- }
- if($hari=="Sunday")
- {
- $hari_min++;
- }
- $tanggal_awal = date ("Y-m-d", strtotime("+1 day", strtotime($tanggal_awal)));
- }
- // Total hari weekend dalam 1 bulan, sesuai bulan berjalan.
- $total_wekend = intval($hari_sab) + intval($hari_min);
- // Check Company By id employee
- if($check_employee != null)
- {
- $get_sistem_gaji = $this->admin_model->get_employee_by_id_company($id_company)->result_array();
- $count_gaji_perjam = 0;
- $data=array();
- foreach($get_sistem_gaji as $sistem_gaji)
- {
- $employee_id = $sistem_gaji['employee_id'];
- $employee_name = $sistem_gaji['name'];
- $employee_title = $sistem_gaji['title'];
- $gaji_pokok = $sistem_gaji['gaji_pokok'];
- $gaji_perjam = $sistem_gaji['gaji_perjam'];
- if($gaji_pokok != null && $gaji_pokok != 0)
- {
- // echo $sistem_gaji['name']." = ".$gaji_pokok."<hr>";
- }
- else
- {
- // echo $employee_id." = ".$sistem_gaji['name']." = ".$gaji_perjam."<hr>";
- $data_absen = $this->admin_model->get_abseni_by_id_company($id_company, $employee_id)->result_array();
- // Total waktu yang sudah di foreach, di parsing keluar dari foreach sehingga memerlukan varibel $total_waktu = 0
- $total_waktu = 0;
- foreach($data_absen as $jam)
- {
- $jam_masuk = $jam['time_in'];
- $jam_keluar = $jam['time_out'];
- $total_selisi_waktu = $this->hitung_selisi_waktu_absen($jam_masuk, $jam_keluar);
- $total_waktu = $total_waktu - $total_selisi_waktu;
- }
- $count_gaji_perjam = $total_waktu * $gaji_perjam;
- }
- $total_gaji_perjam = $count_gaji_perjam;
- //echo $employee_name."".$total_gaji_perjam."<br>";
- //===================TAMBAHAN
- $data[]=array(
- 'name'=>$employee_name,
- 'title'=>$employee_title,
- 'gaji_pokok'=>$gaji_pokok,
- 'gaji_perjam'=>$gaji_perjam,
- );
- }
- //===================DI INPUT
- $comp['gaji']= $data; ///nehhh
- // Tampilan Halaman HTML
- // $comp = array(
- // 'gaji' => $this->admin_model->get_employee_by_id_company($id_company)->result_array(),
- // //'name_employee' => $employee_name,
- // 'gajiperjam' => $total_gaji_perjam,
- // 'gaji_pokok' => $gaji_pokok,
- // 'head' => $this->head(),
- // 'left_sidebar' => $this->left_sidebar(),
- // 'top_bar' => $this->top_bar(),
- // 'javascript' => $this->javascript()
- // );
- // $this->load->view('client/laporan/laporan_gaji', $comp);
- }
- else
- {
- echo "belum bayar yah?";
- }
- }
- else
- {
- redirect('login');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment