$cols = array('kode', 'keterangan1', 'noakun', 'noaruskas', 'matauang', 'kurs', 'keterangan2', 'jumlah', 'kodesegment', 'kodekegiatan', 'kodeasset', 'kodebarang', 'nik', 'kodecustomer', 'kodesupplier', 'kodevhc', 'orgalokasi', 'nodok', 'hutangunit1', 'notransaksi', 'kodeorg', 'noakun2a', 'tipetransaksi');
 $data = $param;
 unset($data['numRow']);
 //=====tambahan ginting
 #periksa apakah akun tanaman, dan jika akun tanaman maka harus ada kodeblok
 if ($data['kurs'] == 0 || $data['kurs'] == '') {
     exit("[ Error ]: The value of the kurs rate there should be.");
 }
 $blk = str_replace(" ", "", $data['orgalokasi']);
 $nik = str_replace(" ", "", $data['nik']);
 $sup = str_replace(" ", "", $data['kodesupplier']);
 $vhc = str_replace(" ", "", $data['kodevhc']);
 if (cekAkun($data['noakun']) and $blk == '') {
     exit("[ Error ]: Plant Account must comply with Block Code.");
 } else {
     if (cekAkun($data['noakun']) and $data['kodekegiatan'] == '') {
         exit("[ Error ]: Activity is obligatory.");
     } else {
         if (cekAkunPiutang($data['noakun']) and $nik == '') {
             exit("[ Error ]: Employee ID is Obligatory to this Account.");
         } else {
             if (cekAkunHutang($data['noakun']) and $sup == '') {
                 exit("[ Error ]: Supplier Code is obligatory to this Account.");
             } else {
                 if (cekAkunTrans($data['noakun']) and $vhc == '') {
                     exit("[ Error ]: Vehicle Code is obligatory to this accout.");
                 }
             }
         }
     }
 }
         $row['nourut'] >= $maxNoUrut ? $maxNoUrut = $row['nourut'] : false;
     }
     $maxNoUrut++;
 }
 $cols = array('nourut', 'noakun', 'keterangan', 'jumlah', 'matauang', 'kurs', 'noaruskas', 'kodesegment', 'kodekegiatan', 'kodeasset', 'kodebarang', 'nik', 'kodecustomer', 'kodesupplier', 'kodevhc', 'nodok', 'kodeblok', 'revisi', 'nojurnal', 'tanggal', 'kodeorg');
 $data = $param;
 $data['nourut'] = $maxNoUrut;
 $data['kodeorg'] = $_SESSION['empl']['lokasitugas'];
 $data['tanggal'] = tanggalsystem($data['tanggal']);
 $data['jumlah'] = str_replace(',', '', $data['jumlah']);
 unset($data['numRow']);
 unset($data['kodejurnal']);
 //=====tambahan ginting
 #periksa apakah akun tanaman, dan jika akun tanaman maka harus ada kodeblok
 $blk = str_replace(" ", "", $param['kodeblok']);
 if (cekAkun($param['noakun']) and $blk == '') {
     exit("[ Error ]: Organization code is obligatory to this account.");
 }
 //=====end tambahan ginting
 $query = insertQuery($dbname, 'keu_jurnaldt', $data, $cols);
 if (!mysql_query($query)) {
     echo "DB Error : " . mysql_error();
     exit;
 }
 unset($data['nojurnal']);
 unset($data['kodejurnal']);
 unset($data['tanggal']);
 unset($data['kodeorg']);
 $res = "";
 foreach ($data as $cont) {
     $res .= "##" . $cont;