function usulan($dataAset, $nodok, $debug = false) { // pr($dataAset); $jenisaset = $data['jenisaset']; $olah_tgl = date('Y-m-d H:i:s'); $alasan = "Mutasi [importing]"; $pemakai = "Sekolah"; $kodeKelompok = $data['kodeKelompok']; $TglSKKDH = "2014-12-31"; $UserNm = $_SESSION['ses_uoperatorid']; // usernm akan diganti jika session di implementasikan // $nmaset=$getPenggunaan; $asset_id = array(); $no_reg = array(); $nm_barang = array(); // $asetKapitalisasi = array_keys($_POST['asetKapitalisasi']); // $asetKapitalisasiOri = $_POST['asetKapitalisasi']; $mutasi_id = get_auto_increment("Mutasi"); logFile('Start transaksi mutasi'); // pr($jenisaset); $listTable = array('B' => 'mesin', 'E' => 'asetlain', 'H' => 'aset'); // pr($getKodeSatker); $no = 1; foreach ($dataAset['aset'] as $tipe => $value) { foreach ($value as $satkerTujuan => $val) { $sql = array('table' => "Mutasi", 'field' => "NoSKKDH , TglSKKDH, Keterangan, SatkerTujuan, NotUse, TglUpdate, UserNm, FixMutasi, Pemakai", 'value' => "'{$nodok}','{$TglSKKDH}', '{$alasan}','{$satkerTujuan}',0,'{$olah_tgl}','1','1','{$pemakai}'"); $res = $this->db->lazyQuery($sql, $debug, 1); $mutasiIDReturn = $this->db->insert_id(); foreach ($val as $key => $v) { $gabung_nomor_reg_tujuan = 0; // $nmaset = $key; // $panjang=count($nmaset); // $sleep = 1; usleep(100); $this->db->logIt($tabel = array($listTable[$tipe]), $Aset_ID = $key, $kd_riwayat = 3, $noDokumen = $nodok, $tglProses = $olah_tgl, $text = "Sukses Mutasi"); // exit; // $getJenisAset = $this->getJenisAset($nmaset); // $getKIB = $this->getTableKibAlias($getJenisAset[$i]); $asset_id = $key; // $getLokasiTujuan = $this->get_satker_tujuan($data['Mutasi_ID'], $data['aset_id'][$key]); $satkerAwal = $v['kodeSatker']; $kelompokAwal = $v['kodeKelompok']; $lokasiAwal = $v['kodeLokasi']; $registerAwal = $v['noRegister']; $namaSatkerAwal = "DINAS PENDIDIKAN, PEMUDA DAN OLAHRAGA"; $lokasiBaru = ubahLokasi($lokasiAwal, $satkerTujuan); // pr($lokasiBaru); // exit; $sqlSelect = array('table' => "Aset", 'field' => "MAX( CAST( noRegister AS SIGNED ) ) AS noRegister", 'condition' => "kodeKelompok = '{$kelompokAwal}' AND kodeLokasi = '{$lokasiBaru}'"); $result = $this->db->lazyQuery($sqlSelect, $debug); $gabung_nomor_reg_tujuan = intval($result[0]['noRegister'] + 1); // if (!in_array($asset_id, $asetKapitalisasi)){ $sql1 = array('table' => "MutasiAset", 'field' => "Mutasi_ID,Aset_ID,NamaSatkerAwal, NomorRegAwal,NomorRegBaru,SatkerAwal,SatkerTujuan, Status", 'value' => "'{$mutasi_id}','{$asset_id}','{$namaSatkerAwal}','{$registerAwal}','{$gabung_nomor_reg_tujuan}','{$satkerAwal}','{$satkerTujuan}', 1"); $res1 = $this->db->lazyQuery($sql1, $debug, 1); $sql2 = array('table' => "Aset", 'field' => "TglPembukuan = '{$TglSKKDH}', StatusValidasi = 1, Status_Validasi_Barang = 1, noRegister = '{$gabung_nomor_reg_tujuan}', kodeSatker = '{$satkerTujuan}', kodeLokasi = '{$lokasiBaru}',NotUse = 0, fixPenggunaan = 0, statusPemanfaatan = 0", 'condition' => "Aset_ID='{$asset_id}'"); $res2 = $this->db->lazyQuery($sql2, $debug, 2); $ignoreTable = array('F', 'H'); if (!in_array($tipe, $ignoreTable)) { $sqlKib = array('table' => "{$listTable[$tipe]}", 'field' => "TglPembukuan = '{$TglSKKDH}', StatusValidasi = 1, Status_Validasi_Barang = 1, StatusTampil = 1, noRegister = '{$gabung_nomor_reg_tujuan}', kodeSatker = '{$satkerTujuan}', kodeLokasi = '{$lokasiBaru}'", 'condition' => "Aset_ID='{$asset_id}'"); $resKib = $this->db->lazyQuery($sqlKib, $debug, 2); } $sql3 = array('table' => "PenggunaanAset", 'field' => "StatusMutasi=1, Mutasi_ID='{$mutasi_id}'", 'condition' => "Aset_ID='{$asset_id}'"); $res3 = $this->db->lazyQuery($sql3, $debug, 2); echo 'Data ke : ' . $no . "\n"; $no++; } } } return true; }
function store_mutasi_barang($data, $debug = false) { $jenisaset = $data['jenisaset']; $satker = $data['kodeSatker']; $nodok = $data['mutasi_trans_eks_nodok']; $tgl = $data['mutasi_trans_eks_tglproses']; $olah_tgl = format_tanggal_db2($tgl); $alasan = $data['mutasi_trans_eks_alasan']; $pemakai = $data['mutasi_trans_eks_pemakai']; $kodeKelompok = $data['kodeKelompok']; $satkerAwal = $data['lastSatker']; $kelompokAwal = $data['lastKelompok']; $lokasiAwal = $data['lastLokasi']; $registerAwal = $data['lastNoRegister']; $namaSatkerAwal = $data['lastNamaSatker']; $UserNm = $_SESSION['ses_uoperatorid']; // usernm akan diganti jika session di implementasikan $nmaset = $data['mutasi_nama_aset']; $asset_id = array(); $no_reg = array(); $nm_barang = array(); $asetKapitalisasi = array_keys($_POST['asetKapitalisasi']); $asetKapitalisasiOri = $_POST['asetKapitalisasi']; $mutasi_id = get_auto_increment("Mutasi"); // pr($jenisaset); $listTable = array('A' => 'tanah', 'B' => 'mesin', 'C' => 'bangunan', 'D' => 'jaringan', 'E' => 'asetlain', 'F' => 'kdp'); $panjang = count($nmaset); // $query="INSERT INTO Mutasi (Mutasi_ID, NoSKKDH , TglSKKDH, // Keterangan, SatkerTujuan, NotUse, TglUpdate, // UserNm, FixMutasi, Pemakai) // values ('','$nodok','$olah_tgl', // '$alasan','$satker','','$olah_tgl','$UserNm','1','$pemakai')"; $sql = array('table' => "Mutasi", 'field' => "NoSKKDH , TglSKKDH, Keterangan, SatkerTujuan, NotUse, TglUpdate, UserNm, FixMutasi, Pemakai", 'value' => "'{$nodok}','{$olah_tgl}', '{$alasan}','{$satker}',0,'{$olah_tgl}','{$UserNm}','0','{$pemakai}'"); $res = $this->db->lazyQuery($sql, $debug, 1); for ($i = 0; $i < $panjang; $i++) { $getJenisAset = $this->getJenisAset($nmaset); $getKIB = $this->getTableKibAlias($getJenisAset[$i]); $tmp = $nmaset[$i]; $tmp_olah = explode("<br/>", $tmp); $asset_id[$i] = $tmp_olah[0]; $no_reg[$i] = $tmp_olah[1]; $nm_barang[$i] = $tmp_olah[2]; // $logData = $this->db->logIt(array($getKIB['listTableOri']), $asset_id[$i]); $lokasiBaru = ubahLokasi($lokasiAwal[$i], $satker); //buat gabung nomor registrasi akhir // $array=array($pemilik,$provinsi,$kabupaten,$row_kode_satker,$tahun,$row_kode_unit); $sqlSelect = array('table' => "Aset", 'field' => "MAX(noRegister) AS noRegister", 'condition' => "kodeKelompok = '{$kelompokAwal[$i]}' AND kodeLokasi = '{$lokasiBaru}'"); $result = $this->db->lazyQuery($sqlSelect, $debug); // pr($result); $gabung_nomor_reg_tujuan = intval($result[0]['noRegister'] + 1); /* echo "<pre>"; print_r($gabung); echo "</pre>"; */ $sql1 = array('table' => "MutasiAset", 'field' => "Mutasi_ID,Aset_ID,NamaSatkerAwal, NomorRegAwal,NomorRegBaru,SatkerAwal,SatkerTujuan", 'value' => "'{$mutasi_id}','{$asset_id[$i]}','{$namaSatkerAwal[$i]}','{$registerAwal[$i]}','{$gabung_nomor_reg_tujuan}','{$satkerAwal[$i]}','{$satker}'"); $res1 = $this->db->lazyQuery($sql1, $debug, 1); if (!in_array($asset_id[$i], $asetKapitalisasi)) { $sql2 = array('table' => "Aset", 'field' => "kodeSatker='{$satker}', kodeLokasi = '{$lokasiBaru}', noRegister='{$gabung_nomor_reg_tujuan}', NotUse=0, StatusValidasi = 3, Status_Validasi_Barang = 3", 'condition' => "Aset_ID='{$asset_id[$i]}'"); $res2 = $this->db->lazyQuery($sql2, $debug, 2); } // pr($getKIB); $sqlKib = array('table' => "{$getKIB['listTableOri']}", 'field' => "kodeSatker='{$satker}', kodeLokasi = '{$lokasiBaru}', noRegister='{$gabung_nomor_reg_tujuan}', StatusValidasi = 3, Status_Validasi_Barang = 3, StatusTampil = 3", 'condition' => "Aset_ID='{$asset_id[$i]}'"); $resKib = $this->db->lazyQuery($sqlKib, $debug, 2); $sql3 = array('table' => "PenggunaanAset", 'field' => "StatusMutasi=1, Mutasi_ID='{$mutasi_id}'", 'condition' => "Aset_ID='{$asset_id[$i]}'"); $res3 = $this->db->lazyQuery($sql3, $debug, 2); $sql = array('table' => 'aset', 'field' => "TipeAset", 'condition' => "Aset_ID={$asset_id[$i]}"); $result = $this->db->lazyQuery($sql, $debug); $asetid[$asset_id[$i]] = $listTable[implode(',', $result[0])]; } if ($result) { $noDok = array('penggu_penet_eks_nopenet', 'mutasi_trans_eks_nodok'); foreach ($_POST as $key => $value) { if (in_array($value, $noDok)) { $noDokumen = $_POST[$value]; } else { $noDokumen = '-'; } } foreach ($asetid as $key => $value) { if (!in_array($key, $asetKapitalisasi)) { $this->db->logIt($tabel = array($value), $Aset_ID = $key, $kd_riwayat = 3, $noDokumen = $nodok, $tglProses = $olah_tgl, $text = "Mutasi Pending Status"); } else { $this->db->logIt($tabel = array($value), $Aset_ID = $key, $kd_riwayat = 25, $noDokumen = $nodok, $tglProses = $olah_tgl, $text = "Mutasi Pending Status dengan mode kapitalisasi", $tmpSatker = $asetKapitalisasiOri[$key]); } } return true; } return false; }