gundambison

perbaikan 61

May 10th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function laporan_gaji()
  3.     {
  4.         if($this->ion_auth->logged_in() != $this->ion_auth->is_admin())
  5.         {
  6.             $user           = $this->ion_auth->user()->row();
  7.  
  8.             // Check Employe by Id user, ini sekaligus menyaring user yang belum bayar.
  9.             $check_employee = $this->admin_model->get_user_employee_by_id_user($user->id)->row();
  10.             if($check_employee != null)
  11.             {
  12.                 $id_company     = $check_employee->company_id;
  13.             }
  14.  
  15.             // Check tanggal awal dan tanggal akhir bulan
  16.             $data_tgl_skrng = date("Y-m-d");
  17.             $tanggal_awal   = date("Y-m-01");
  18.             $tanggal_akhir  = date("Y-m-t", strtotime($data_tgl_skrng));
  19.  
  20.             // hari sabtu dan minggu di set 0;
  21.             $hari_sab = 0;
  22.             $hari_min = 0;
  23.             while (strtotime($tanggal_awal) <= strtotime($tanggal_akhir))
  24.             {
  25.                 $datte  = $tanggal_awal;
  26.                 $tgll   = explode("-",$datte);
  27.                 $hari   = date("l", mktime(0, 0, 0, $tgll[1], $tgll[2], $tgll[0]));
  28.                        
  29.                 if($hari=="Saturday")
  30.                 {
  31.                     $hari_sab++;
  32.                 }
  33.                 if($hari=="Sunday")
  34.                 {
  35.                     $hari_min++;
  36.                 }
  37.                                
  38.                 $tanggal_awal = date ("Y-m-d", strtotime("+1 day", strtotime($tanggal_awal)));
  39.             }
  40.  
  41.             // Total hari weekend dalam 1 bulan, sesuai bulan berjalan.
  42.             $total_wekend = intval($hari_sab) + intval($hari_min);
  43.  
  44.             // Check Company By id employee
  45.             if($check_employee != null)
  46.             {
  47.                 $get_sistem_gaji = $this->admin_model->get_employee_by_id_company($id_company)->result_array();
  48.                 $count_gaji_perjam = 0;
  49.                 $data=array();
  50.                 foreach($get_sistem_gaji as $sistem_gaji)
  51.                 {
  52.                     $employee_id    = $sistem_gaji['employee_id'];
  53.                     $employee_name  = $sistem_gaji['name'];
  54.                     $employee_title = $sistem_gaji['title'];
  55.                     $gaji_pokok     = $sistem_gaji['gaji_pokok'];
  56.                     $gaji_perjam    = $sistem_gaji['gaji_perjam'];
  57.                     if($gaji_pokok != null && $gaji_pokok != 0)
  58.                     {
  59.                         // echo $sistem_gaji['name']." = ".$gaji_pokok."<hr>";
  60.                     }
  61.                     else
  62.                     {
  63.                         // echo $employee_id." = ".$sistem_gaji['name']." = ".$gaji_perjam."<hr>";
  64.                         $data_absen             = $this->admin_model->get_abseni_by_id_company($id_company, $employee_id)->result_array();
  65.  
  66.                         // Total waktu yang sudah di foreach, di parsing keluar dari foreach sehingga memerlukan varibel $total_waktu = 0
  67.                         $total_waktu = 0;
  68.                         foreach($data_absen as $jam)
  69.                         {
  70.                             $jam_masuk          = $jam['time_in'];
  71.                             $jam_keluar         = $jam['time_out'];
  72.                             $total_selisi_waktu = $this->hitung_selisi_waktu_absen($jam_masuk, $jam_keluar);
  73.                             $total_waktu        = $total_waktu - $total_selisi_waktu;  
  74.                         }
  75.                         $count_gaji_perjam  = $total_waktu * $gaji_perjam; 
  76.                     }
  77.                     $total_gaji_perjam = $count_gaji_perjam;
  78.                     //echo $employee_name."".$total_gaji_perjam."<br>";
  79. //===================TAMBAHAN                  
  80.                     $data[]=array(
  81.                         'name'=>$employee_name,
  82.                         'title'=>$employee_title,
  83.                         'gaji_pokok'=>$gaji_pokok,
  84.                         'gaji_perjam'=>$gaji_perjam,
  85.                        
  86.                     );
  87.                 }
  88. //===================DI INPUT
  89.                 $comp['gaji']= $data; ///nehhh
  90.                 // Tampilan Halaman HTML
  91.                 // $comp = array(
  92.                 //  'gaji'              => $this->admin_model->get_employee_by_id_company($id_company)->result_array(),
  93.                 //  //'name_employee'       => $employee_name,
  94.                 //  'gajiperjam'        => $total_gaji_perjam,
  95.                 //  'gaji_pokok'        => $gaji_pokok,
  96.                 //  'head'              => $this->head(),
  97.                 //  'left_sidebar'      => $this->left_sidebar(),
  98.                 //  'top_bar'           => $this->top_bar(),
  99.                 //  'javascript'        => $this->javascript()
  100.                 // );
  101.                 // $this->load->view('client/laporan/laporan_gaji', $comp);
  102.             }
  103.             else
  104.             {
  105.                 echo "belum bayar yah?";
  106.             }
  107.         }
  108.         else
  109.         {
  110.             redirect('login');
  111.         }
  112.     }
Advertisement
Add Comment
Please, Sign In to add comment