示例#1
0
 private function clonePaymentData($id_pegawai, $request_post)
 {
     $data_gaji_val = DataGajiPayroll::find()->where(['id_pegawai' => $id_pegawai])->one();
     $payment = new PaymentPayroll();
     $payment->status_persetujuan = false;
     $payment->status_penerimaan = false;
     $payment->tgl_terima = date('Y-m-d');
     $payment->gaji_per_jam_lembur = $data_gaji_val->gaji_per_jam_lembur;
     $payment->jam_lembur = $data_gaji_val->jam_lembur;
     $payment->gaji_pokok = $data_gaji_val->gaji_pokok;
     $payment->jumlah_tunjangan = $data_gaji_val->tunjangan_per_tanggungan * $data_gaji_val->tanggungan_keluarga;
     $payment->id_pegawai = $id_pegawai;
     $payment->insert();
     $check_exist = $this->find()->where(['id_pegawai' => $id_pegawai])->exists();
     if ($check_exist) {
         $peminjaman = new PeminjamanPayroll();
         $payment_extends = new PaymentExtendsPayroll();
         $payment_extends->id_payment = $payment->id;
         $payment_extends->transportasi = $request_post['transportasi'];
         $payment_extends->makan = $request_post['makan'];
         $payment_extends->peminjaman = $peminjaman->getTotalPeminjaman($id_pegawai);
         $payment_extends->bpjs = $request_post['bpjs'];
         $payment_extends->jamsostek = $request_post['jamsostek'];
         $payment_extends->pajak = $request_post['pajak'];
         $peminjaman->buatPinjamanLunas($id_pegawai);
         $payment_extends->insert();
     }
 }
示例#2
0
 private function dtablePenggajian($request)
 {
     $payment = new PaymentPayroll();
     $draw = $request['draw'];
     $start = $request['start'];
     $length = $request['length'];
     $a_total = $payment->getCount();
     if (!empty($request['search']['value'])) {
         $s_key = $request['search']['value'];
     } else {
         $s_key = null;
     }
     if ($s_key == null) {
         $dump_data = $payment->getDumpData($start, $length);
         $v_total = $payment->getDumpData($start, $length, '', true);
     } else {
         $dump_data = $payment->getDumpData($start, $length, $s_key);
         $v_total = $payment->getDumpData($start, $length, $s_key, true);
     }
     $i_penggajian = 0;
     $e_penggajian = array();
     foreach ($dump_data as $e_data) {
         $e_penggajian[$i_penggajian++] = ['id' => $e_data['id'], 'id_pegawai' => $e_data['id_pegawai'], 'nip' => $e_data['nip'], 'nama_lengkap' => $e_data['nama_lengkap'], 'status_persetujuan' => 1 == $e_data['status_persetujuan'] ? 'Ya' : 'Belum', 'status_penerimaan' => 1 == $e_data['status_penerimaan'] ? 'Ya' : 'Belum', 'tgl_terima' => date("d-m-Y", strtotime($e_data['tgl_terima'])), 'tgl_cair' => date("d-m-Y", strtotime($e_data['tgl_terima'])), 'action' => "<button class=\"btn btn-sm btn-primary\" data-toggle=\"modal\" onclick=\"showDetailPayment(" . $e_data['id'] . ")\" data-target=\"#modal-popup\"><i class=\"fa fa-edit\"></i> Details</button>"];
     }
     return (object) array('draw' => intval($draw), 'recordsTotal' => intval($a_total), 'recordsFiltered' => intval($v_total), 'data' => $e_penggajian);
 }