コード例 #1
0
function countKode()
{
    global $dbname;
    global $conn;
    global $regional;
    $optReg = makeOption($dbname, 'bgt_regional', 'regional,kodepenerimaankaryawan');
    $sCount = "select substring(kode,2,3) as kodeku from " . $dbname . ".sdm_5uangmukapjd where regional = '" . $regional . "' order by kode desc limit 1";
    $qCount = mysql_query($sCount) or die(mysql_error($conn));
    $rCount = mysql_fetch_assoc($qCount);
    $nextKode = $optReg[$regional] . "" . addZero($rCount['kodeku'] + 1, 3);
    return $nextKode;
}
コード例 #2
0
ファイル: format.php プロジェクト: rcroxyosox/transitap
function formatTime($timeStr){
	$time = explode(":",$timeStr);
	$hr = $time[0];
	$min = $time[1];
	$sec = substr($time[2], 0, strpos($time[2], " "));
	$ampm = substr($time[2], strpos($time[2], " "));
	
	if(strtoupper(trim($ampm)) == "PM"){
		$hr += 12;
	}

	return addZero($hr).":".addZero($min).":".addZero($sec);
}
コード例 #3
0
ファイル: profileSettings.php プロジェクト: Neldris/Amisti
function monthDay()
{
    ?>
       <select id="addAgeDay"> 
       <option>...</option>
	<?php 
    for ($x = 1; $x <= 31; $x++) {
        $id = addZero($x);
        ?>
        <option name= "<?php 
        echo $id;
        ?>
" > <?php 
        echo $id;
        ?>
 </option>
        <?php 
    }
    ?>
		</select>
		<?php 
}
コード例 #4
0
         echo "";
     } else {
         echo " Gagal," . addslashes(mysql_error($conn));
     }
     break;
 case 'getNodok':
     $iList = "select notransaksi,tanggal,statasiun  from " . $dbname . ".pabrik_rawatmesinht where statasiun ='" . $station . "' " . "and tanggal='" . $tglOrder . "' order by notransaksi desc limit 1";
     $nList = mysql_query($iList) or die(mysql_error($conn));
     $dList = mysql_fetch_assoc($nList);
     if ($dList['notransaksi'] != '') {
         $listDok = explode('/', $dList['notransaksi']);
         $noUrut = $listDok[2] + 1;
     } else {
         $noUrut = 1;
     }
     $counter = addZero($noUrut, 4);
     $noDok = $station . '/' . $tglOrderDok . '/' . $counter;
     echo $noDok;
     break;
 case 'getMesin':
     $optMesin .= "<option value=''>" . $_SESSION['lang']['pilihdata'] . "</option>";
     $optMesin .= "<option value='Others'>Others</option>";
     $iMesin = "select * from " . $dbname . ".organisasi where induk='" . $station . "' ";
     $nMesin = mysql_query($iMesin) or die(mysql_error($conn));
     while ($dMesin = mysql_fetch_assoc($nMesin)) {
         if ($mesin == $dMesin['kodeorganisasi']) {
             $select = "selected=selected";
         } else {
             $select = "";
         }
         $optMesin .= "<option " . $select . " value=" . $dMesin['kodeorganisasi'] . ">" . $dMesin['namaorganisasi'] . "</option>";
コード例 #5
0
    if ($bar->jurnalid == 'ROTM') {
        $penerima['akundebet']['tm'] = $bar->noakundebet;
    } else {
        $penerima['akundebet']['tbm'] = $bar->noakundebet;
    }
}
if ($penerima['akundebet']['tm'] == '' or $penerima['akundebet']['tbm'] == '') {
    exit(" Error: No.Akun debet untuk ROTBM atau ROTM belum terisi pada parameterjurnal");
}
#generate jurnal========================================================
$queryJ = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $param['pt'] . "' and kodekelompok='" . $kodejurnal . "'");
$tmpKonter = fetchData($queryJ);
$konter = addZero($tmpKonter[0]['nokounter'] + 1, 3);
foreach ($penerima['unit'] as $key => $val) {
    # Prep No Jurnal
    $konter = addZero($konter + 1, 3);
    $nojurnal = $tanggal . "/" . $val . "/" . $kodejurnal . "/" . $konter;
    $arrNoJurnal[] = $nojurnal;
    //        echo $konter."<>";
    $data['header'][] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodejurnal, 'tanggal' => $tanggal, 'tanggalentry' => date('Ymd'), 'posting' => '1', 'totaldebet' => $jumlah[$val], 'totalkredit' => -1 * $jumlah[$val], 'amountkoreksi' => '0', 'noreferensi' => 'ALK_' . $param['kodeorg'], 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
    $noUrut = 1;
    #kredit
    $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $penerima['akunkredit'], 'keterangan' => 'Alokasi Biaya Tidak Langsung RO/HO', 'jumlah' => -1 * $jumlah[$val], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $val, 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_' . $param['kodeorg'], 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => $defSegment);
    $noUrut++;
    #debet TM
    if ($jatahtm[$val] > 0) {
        $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $penerima['akundebet']['tm'], 'keterangan' => 'Alokasi Biaya Tidak Langsung RO/HO', 'jumlah' => $jatahtm[$val], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $val, 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_' . $param['kodeorg'], 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => $defSegment);
        $noUrut++;
    }
    #debet TBM
    if (count($blok[$val]) > 0) {
コード例 #6
0
     $query = mysql_query($sql) or die(mysql_error());
     $rdata = mysql_fetch_assoc($query);
     $eksplot = explode("/", $rdata['notransaksi']);
     $awal = $eksplot[0];
     //exit("error:".$awal);
     $awal = intval($awal);
     $cekbln = isset($eksplot[1]) ? $eksplot[1] : '';
     $cekthn = isset($eksplot[4]) ? $eksplot[4] : '';
     if ($thn != $cekthn) {
         $awal = 1;
     } else {
         $awal++;
     }
     $counter = $awal;
     if ($awal < 1000) {
         $counter = addZero($awal, 3);
     }
     $notransaksi = $counter . "/" . $notrans;
     echo $notransaksi;
     break;
 case 'insert':
     if ($tanggal == '') {
         exit("error: " . $_SESSION['lang']['tanggal'] . " is empty!");
     }
     if ($_POST['kodetraksi'] == '') {
         exit("error: " . $_SESSION['lang']['kodetraksi'] . " is empty!");
     }
     if ($_POST['kd_vhc'] == '') {
         exit("error: " . $_SESSION['lang']['kde_vhc'] . " is empty!");
     }
     $i = "insert into " . $dbname . ".vhc_balaka (notransaksi,kodetraksi,tanggal,kodealat,operator,security,mekanik,managerunit,kaworkshop,kronologis,akibatkejadian,updateby)\r\n                    values ('" . $_POST['notransaksi'] . "','" . $kodetraksi . "','" . tanggalsystem($tanggal) . "','" . $kde_vhc . "','" . $_POST['operator'] . "','" . $_POST['security'] . "','" . $_POST['karymekanik'] . "'\r\n                            ,'" . $_POST['managerunit'] . "','" . $_POST['karyworkshop'] . "','" . $_POST['kronologiskejadian'] . "','" . $_POST['akibatkejadian'] . "','" . $_SESSION['standard']['userid'] . "')";
コード例 #7
0
             exit("Warning: Depresiasi " . $kode . " belum terjurnal dengan benar");
         }
     }
 }
 #==================== /Prep Jurnal ====================================
 createSaldoAwal($param['periode'], $tahunLanjut . '-' . addZero($bulanLanjut, 2), $param['kodeorg']);
 #========================== Proses Insert dan Update ==========================
 # Header and Detail inserted
 # Update Status Tutup Buku
 $queryUpd = updateQuery($dbname, 'setup_periodeakuntansi', array('tutupbuku' => 1), "kodeorg='" . $param['kodeorg'] . "' and periode='" . $param['periode'] . "'");
 if (!mysql_query($queryUpd)) {
     echo 'Error Update : ' . mysql_error();
     exit;
 } else {
     # Insert periode baru
     $dataIns = array('kodeorg' => $param['kodeorg'], 'periode' => $tahunLanjut . '-' . addZero($bulanLanjut, 2), 'tanggalmulai' => $tglAwal, 'tanggalsampai' => $tglAkhir, 'tutupbuku' => 0);
     $queryIns = insertQuery($dbname, 'setup_periodeakuntansi', $dataIns);
     echo '1';
     if (!mysql_query($queryIns)) {
         # Rollback
         echo 'Error Insert : ' . mysql_error();
         $queryRB = updateQuery($dbname, 'setup_periodeakuntansi', array('tutupbuku' => 0), "kodeorg='" . $param['kodeorg'] . "' and periode='" . $param['periode'] . "'");
         if (!mysql_query($queryRB)) {
             echo 'Error Rollback Update : ' . mysql_error();
             exit;
         }
     } else {
         //update history tutup buku
         $str = "delete from " . $dbname . ".keu_setup_watu_tutup where periode='" . $param['periode'] . "' and kodeorg='" . $param['kodeorg'] . "'";
         mysql_query($str);
         $str = "insert into " . $dbname . ".keu_setup_watu_tutup(kodeorg,periode,username) values(\n                                  '" . $param['kodeorg'] . "','" . $param['periode'] . "','" . $_SESSION['standard']['username'] . "')";
コード例 #8
0
function prosesGajiKebun()
{
    global $conn;
    global $tanggal;
    global $param;
    global $dbname;
    global $defSegment;
    #karyawan kebun
    #output pada jurnal kolom noreferensi ALK_GAJI
    if ($param['komponen'] == 1 or $param['komponen'] == 14) {
        $group = 'KBNB0';
    } elseif ($param['komponen'] == 16 or $param['komponen'] == 32 or $param['komponen'] == 33) {
        $group = 'KBNB1';
    } elseif ($param['komponen'] == 28) {
        $group = 'KBNB3';
    } elseif ($param['komponen'] == 26) {
        $group = 'KBNB4';
    } elseif ($param['komponen'] == 21) {
        $group = 'KBNB5';
    } else {
        $group = 'KBNB2';
    }
    //defaultnya tunjangan
    $str = "select noakundebet,noakunkredit from " . $dbname . ".keu_5parameterjurnal\r\n          where jurnalid='" . $group . "' limit 1";
    $res = mysql_query($str);
    if (mysql_num_rows($res) < 1) {
        exit("Error: No.Akun pada parameterjurnal belum ada untuk " . $param['namakomponen']);
    } else {
        $akundebet = '';
        $akunkredit = '';
        $bar = mysql_fetch_object($res);
        $akundebet = $bar->noakundebet;
        $akunkredit = $bar->noakunkredit;
    }
    #proses data
    $kodeJurnal = $group;
    #======================== Nomor Jurnal =============================
    # Get Journal Counter
    $queryJ = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "' ");
    $tmpKonter = fetchData($queryJ);
    $konter = addZero($tmpKonter[0]['nokounter'] + 1, 3);
    # Transform No Jurnal dari No Transaksi
    $nojurnal = str_replace("-", "", $tanggal) . "/" . $_SESSION['empl']['lokasitugas'] . "/" . $kodeJurnal . "/" . $konter;
    #======================== /Nomor Jurnal ============================
    # Prep Header
    $dataRes['header'] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodeJurnal, 'tanggal' => $tanggal, 'tanggalentry' => date('Ymd'), 'posting' => 1, 'totaldebet' => $param['jumlah'], 'totalkredit' => -1 * $param['jumlah'], 'amountkoreksi' => '0', 'noreferensi' => 'ALK_GAJI', 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
    # Data Detail
    $noUrut = 1;
    # Debet
    $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akundebet, 'keterangan' => $param['namakomponen'] . ' ' . $param['namakaryawan'], 'jumlah' => $param['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => $param['karyawanid'], 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_GAJI', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => $param['subbagian'], 'revisi' => '0', 'kodesegment' => $defSegment);
    $noUrut++;
    # Kredit
    $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akunkredit, 'keterangan' => $param['namakomponen'] . ' ' . $param['namakaryawan'], 'jumlah' => -1 * $param['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => $param['karyawanid'], 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_GAJI', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => $param['subbagian'], 'revisi' => '0', 'kodesegment' => $defSegment);
    $noUrut++;
    /*
    #periksa apakah sudah pernah diproses dengan karyawan yang sama
    $str="select * from ".$dbname.".keu_jurnaldt where nojurnal 
         like '".str_replace("-","",$tanggal)."/".$_SESSION['empl']['lokasitugas']."/".$kodeJurnal."/%'
         and noakun='".$akundebet."' and nik='".$param['karyawanid']."'";
    if(mysql_num_rows(mysql_query($str))>0)
       exit("Error: Data sudah pernah di proses");
    * 
    */
    $insHead = insertQuery($dbname, 'keu_jurnalht', $dataRes['header']);
    if (!mysql_query($insHead)) {
        $headErr .= 'Insert Header BTL Error : ' . mysql_error() . "\n";
    }
    if (empty($headErr)) {
        #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Detail
        $detailErr = '';
        foreach ($dataRes['detail'] as $row) {
            $insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
            echo $insDet;
            if (!mysql_query($insDet)) {
                $detailErr .= "Insert Detail Error 2 : " . mysql_error() . "\n";
                break;
            }
        }
        if ($detailErr == '') {
            # Header and Detail inserted
            #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Update Kode Jurnal
            $updJurnal = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
            if (!mysql_query($updJurnal)) {
                echo "Update Kode Jurnal Error : " . mysql_error() . "\n";
                # Rollback if Update Failed
                $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                if (!mysql_query($RBDet)) {
                    echo "Rollback Delete Header BTL Error : " . mysql_error() . "\n";
                    exit;
                }
                exit;
            } else {
            }
        } else {
            echo $detailErr;
            # Rollback, Delete Header
            $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
            if (!mysql_query($RBDet)) {
                echo "Rollback Delete Header Error : " . mysql_error();
                exit;
            }
        }
    } else {
        echo $headErr;
        exit;
    }
}
コード例 #9
0
     $headErr .= 'Insert Header Error : ' . mysql_error() . "\n" . $insHead;
 }
 if ($headErr == '') {
     #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Detail
     $detailErr = '';
     foreach ($dataRes['detail'] as $row) {
         $insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
         if (!mysql_query($insDet)) {
             $detailErr .= "Insert Detail Error : " . mysql_error() . "\n";
             break;
         } else {
         }
     }
     if ($detailErr == '') {
         #==================== /Prep Jurnal ====================================
         createSaldoAwal($param['periode'], $tahunLanjut . '-' . addZero($bulanLanjut, 2), $param['kodeorg']);
         #========================== Proses Insert dan Update ==========================
         #delete semua periodeakuntansi untuk tahun depan
         // $str="delete from ".$dbname.".setup_periodeakuntansi where kodeorg='".$param['kodeorg']."'
         //           and periode like '".$tahunLanjut ."%'";
         //  mysql_query($str);
         # Header and Detail inserted
         # Update Status Tutup Buku
         $queryUpd = updateQuery($dbname, 'setup_periodeakuntansi', array('tutupbuku' => 1), "kodeorg='" . $param['kodeorg'] . "' and periode='" . $param['periode'] . "'");
         if (!mysql_query($queryUpd)) {
             echo 'Error Update : ' . mysql_error();
             exit;
         } else {
             # Insert periode baru
             // $dataIns = array(
             //     'kodeorg'=>$param['kodeorg'],
コード例 #10
0
     }
 } elseif (substr($kdTimbangan, 0, 1) == '1') {
     $sCek = "select kodetimbangan from " . $dbname . ".pmn_4customer where kodetimbangan='" . $kdTimbangan . "'";
     //	echo"customer__".$sCek;
     $qCek = mysql_query($sCek) or die(mysql_error());
     $rCek = mysql_num_rows($qCek);
     if ($rCek < 1) {
         $sNo = "select kodecustomer,klcustomer from " . $dbname . ".pmn_4customer\r\n\t\t\t\twhere kodecustomer like 'C%' and length(kodecustomer)=5\r\n\t\t\t\torder by `kodecustomer` desc limit 1";
         //echo $sNo;
         $qNo = mysql_query($sNo) or die(mysql_error());
         $rNo = mysql_fetch_assoc($qNo);
         $no = substr($rNo['kodecustomer'], 1, 4);
         $kdCust = intval($no);
         //echo $no.":".$kdCust;
         $kdCust += 1;
         $kdCust = 'C' . addZero($kdCust, 4);
         $sIns = "INSERT INTO " . $dbname . ".`pmn_4customer` (`kodecustomer`, `namacustomer`,`klcustomer`,`kodetimbangan`) VALUES ('" . $kdCust . "','" . $nmCust . "','" . $rNo['klcustomer'] . "','" . $kdTimbangan . "')";
         //	echo $sIns;exit();
         if (mysql_query($sIns)) {
             @($corn = mysql_connect($ipAdd . ":" . $prt, $usrName, $pswrd)) or die("Error/Gagal :Unable to Connect to database : " . $ipAdd);
             $supd = "update " . $dbnm . "." . $nmTable . " set uploadStat=1 where BUYERCODE='" . $kdTimbangan . "'";
             if (mysql_query($supd, $corn)) {
                 $stat = 1;
                 echo $stat;
                 exit;
             }
         } else {
             echo "DB Error : " . mysql_error($conn);
             $stat = 0;
             echo $stat;
         }
コード例 #11
0
         }
     }
     echo $optDtSpb;
     break;
 case 'insert':
     $whr = "nospb='" . $param['spbId'] . "'";
     $optCust = makeOption($dbname, 'kebun_spbht', 'nospb,penerimatbs', $whr);
     $scek = "select max(notransaksi) as notransaksi from " . $dbname . ".pabrik_timbangan where char_length(notransaksi)>7 and kodeorg='" . $_SESSION['empl']['lokasitugas'] . "'";
     $qcek = mysql_query($scek) or die(mysql_error($conn));
     $rcek = mysql_fetch_assoc($qcek);
     if ($rcek['notransaksi'] == '') {
         $rcek['notransaksi'] = 0;
     } else {
         $rcek['notransaksi'] = substr($rcek['notransaksi'], -6, 6);
     }
     $notrans = $_SESSION['empl']['lokasitugas'] . addZero(intval($rcek['notransaksi']) + 1, 6);
     if ($param['tgl'] == '' || $param['kdKend'] == '' || $param['nmSupir'] == '' || $param['jmlhJjg'] == '' || $param['brtMsk'] == '' || $param['brtKlr'] == '' || $param['spbId'] == '') {
         exit("error: Seluruh field tidak boleh kosong");
     }
     $sins = "insert into " . $dbname . ".pabrik_timbangan (notransaksi,tanggal,kodeorg,kodecustomer,jumlahtandan1,kodebarang,jammasuk,beratmasuk,jamkeluar,beratkeluar,nokendaraan,supir,nospb,timbangonoff,intex,millcode,beratbersih,jjgsortasi,kgpotsortasi,username) values ";
     $sins .= "('" . $notrans . "','" . tanggalsystem($param['tgl']) . "','" . $_SESSION['empl']['lokasitugas'] . "','" . $optCust[$param['spbId']] . "','" . $param['jmlhJjg'] . "','40000003','" . $param['jamMasuk'] . "','" . $param['brtMsk'] . "','" . $param['jamKeluar'] . "','" . $param['brtKlr'] . "','" . $param['kdKend'] . "','" . $param['nmSupir'] . "','" . $param['spbId'] . "','1','1','EXTM','" . $param['brtBrsh'] . "','" . $param['JjgSortasi'] . "','" . $param['potKg'] . "','" . $_SESSION['standard']['username'] . "')";
     if (!mysql_query($sins)) {
         exit("error: " . mysql_error($conn) . "__" . $sins);
     }
     break;
 case 'update':
     if ($param['tgl'] == '' || $param['kdKend'] == '' || $param['nmSupir'] == '' || $param['jmlhJjg'] == '' || $param['brtMsk'] == '' || $param['brtKlr'] == '' || $param['spbId'] == '') {
         exit("error: Seluruh field tidak boleh kosong");
     }
     $sins = "update " . $dbname . ".pabrik_timbangan set tanggal='" . tanggalsystem($param['tgl']) . "',kodeorg='" . $_SESSION['empl']['lokasitugas'] . "',kodecustomer='" . $optCust[$param['spbId']] . "',jumlahtandan1='" . $param['jmlhJjg'] . "',jammasuk='" . $param['jamMasuk'] . "',beratmasuk='" . $param['brtMsk'] . "',jamkeluar='" . $param['jamKeluar'] . "',beratkeluar='" . $param['brtKlr'] . "',nokendaraan='" . $param['kdKend'] . "',supir='" . $param['nmSupir'] . "',nospb='" . $param['spbId'] . "',beratbersih='" . $param['brtBrsh'] . "',jjgsortasi='" . $param['JjgSortasi'] . "',kgpotsortasi='" . $param['potKg'] . "',username='******'standard']['username'] . "' where notransaksi='" . $param['notransaksi'] . "'";
     if (!mysql_query($sins)) {
コード例 #12
0
function generateNoDO()
{
    global $dbname;
    global $conn;
    global $_POST;
    global $optPt;
    $bulan = substr($_POST['tanggalsurat'], 3, 2);
    $arrayRomawi = array("I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII");
    $resultRomawi = $arrayRomawi[(int) $bulan - 1];
    $ql = "select `nodo` from " . $dbname . ".`pmn_suratperintahpengiriman`";
    $ql .= " where nodo like '%" . $optPt[$_POST['nokontrak']] . "_%' and tanggaldo like '" . substr($_POST['tanggalsurat'], 6, 4) . "%'\n\t\torder by nodo desc limit 1";
    $qr = mysql_query($ql) or die('error: ' . mysql_error());
    $data = mysql_fetch_object($qr);
    $countNoDO = substr($data->nodo, 0, 3);
    $noInvoice = addZero($countNoDO + 1, 3) . "/" . $optPt[$_POST['nokontrak']] . "_" . $_POST['kodecustomer'] . "/" . $resultRomawi . "/" . substr($_POST['tanggalsurat'], 6, 4);
    return $noInvoice;
}
コード例 #13
0
function generateNoInvoice($nokontrak, $tgl)
{
    global $dbname;
    global $conn;
    #no invoice
    $tgldt = explode("-", $tgl);
    $bulan = $tgldt[1];
    $thn = date('Y');
    $sPt = "select distinct kodebarang,kodept from " . $dbname . ".pmn_kontrakjual where nokontrak='" . $nokontrak . "'";
    $qPt = mysql_query($sPt) or die(mysql_error($conn));
    $rPt = mysql_fetch_assoc($qPt);
    $arrayRomawi = array("I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII");
    $resultRomawi = $arrayRomawi[(int) $bulan - 1];
    if ($rPt['kodept'] == 'API') {
        $invPT = 'AMP';
    } else {
        $invPT = $rPt['kodept'];
    }
    $ql = "select `noinvoice` from " . $dbname . ".`keu_penagihanht` where kodept = '" . $invPT . "' and left(noinvoice,3) = '" . $invPT . "' and left(tanggal,4) = '" . $tgldt[2] . "'\n\t\torder by noinvoice desc limit 1";
    $qr = mysql_query($ql) or die('error: ' . mysql_error());
    $data = mysql_fetch_object($qr);
    $countNoInvoice = substr($data->noinvoice, 4, 3);
    //$countNoInvoice = mysql_num_rows($qr);
    $noInvoice = $rPt['kodept'] . "/" . addZero($countNoInvoice + 1, 3) . "/JKT/" . $resultRomawi . "/" . $tgldt[2];
    return $noInvoice;
}
コード例 #14
0
        while ($bar = mysql_fetch_object($res)) {
            $sq = "select * " . $dbname . ".`datakaryawan` where `lokasitugas`='" . $bar->kodeorg . "' or `induk`='" . $induk_org . "'";
            //echo $sql;
            $qty = mysql_query($sq) or die(mysql_error());
            $opt .= "<option value='" . $res2->karyawanid . "'>" . $res2->namakaryawan . "</option>";
            $no += 1;
            echo "\r\n                                <tr class=rowcontent style='cursor:pointer;' onclick=\"setDraft( '" . $bar->karyawanid . "','" . $bar->nopp . "')\" title='Click' >\r\n                                          <td class=firsttd colspan=3>" . $no . "</td>\r\n                                                <tr >\r\n                                                        <td>No. PP</td>\r\n                                                        <td>:</td>\r\n                                                        <td><input id=nopp type=text readonly=readonly value=" . $bar->nopp . "></td>\r\n                                                </tr>\r\n                                                <tr>\r\n                                                        <td>Nama Karyawan</td>\r\n                                                        <td>:</td>\r\n                                                        <td>\r\n                                                        <select id='kd_krywn'>\r\n                                                        <option value=\"\" selected=selected></option>" . $opt . "\r\n                                                        </select></td>\r\n                                                </tr>";
        }
        echo "</tbody>\r\n                                  <tfoot>\r\n                                  </tfoot>\r\n                                  </table>";
    } else {
        echo " Gagal," . addslashes(mysql_error($conn));
    }
}
if (isset($_POST['rkrywn_id'])) {
    $rkrywn_id = intval($_POST['rkrywn_id']);
    $rkrywn_id = addZero($rkrywn_id, 10);
    $no_pp = $_POST['no_pp'];
    $tanggl = date("Y-m-d");
    $ql = "update " . $dbname . ".log_prapoht set `persetujuan1`='" . $rkrywn_id . "',`close`='1',`tglp1`='" . $tanggl . "' where `nopp`='" . $no_pp . "' ";
    //	 echo $ql; exit();
    if ($res = mysql_query($ql)) {
    } else {
        echo " Gagal," . addslashes(mysql_error($conn));
    }
}
if (isset($_POST['hnopp'])) {
    $nopp = $_POST['hnopp'];
    $krywn = $_POST['karywn_id'];
    $str = "select * from " . $dbname . ".`log_prapoht` where `nopp`='" . $nopp . "'";
    //echo $str;
    if ($res = mysql_query($str)) {
コード例 #15
0
     $fQuery = selectQuery($dbname, 'kebun_aktifitas', 'notransaksi', $fWhere);
     $tmpNo = fetchData($fQuery);
     # Generate No Transaksi
     if (count($tmpNo) == 0) {
         $data['notransaksi'] = $data['tanggal'] . "/" . $data['kodeorg'] . "/" . $data['tipetransaksi'] . "/001";
     } else {
         # Get Max No Urut
         $maxNo = 1;
         foreach ($tmpNo as $row) {
             $tmpRow = explode('/', $row['notransaksi']);
             $noUrut = (int) $tmpRow[3];
             if ($noUrut > $maxNo) {
                 $maxNo = $noUrut;
             }
         }
         $currNo = addZero($maxNo + 1, 3);
         $data['notransaksi'] = $data['tanggal'] . "/" . $data['kodeorg'] . "/" . $data['tipetransaksi'] . "/" . $currNo;
     }
     $data['updateby'] = $_SESSION['standard']['userid'];
     $cols = array('notransaksi', 'kodeorg', 'tanggal', 'nikmandor', 'nikmandor1', 'nikasisten', 'keranimuat', 'tipetransaksi', 'updateby');
     $query = insertQuery($dbname, 'kebun_aktifitas', $data, $cols);
     if (!mysql_query($query)) {
         echo "DB Error : " . mysql_error();
     } else {
         echo $data['notransaksi'];
     }
     break;
     # Proses Edit Header
 # Proses Edit Header
 case 'edit':
     $data = $_POST;
コード例 #16
0
     $thnSkrng = date("Y");
     $thn = substr($thnSkrng, 2, 2);
     $nofaktur = $jp . "." . $npwp . "." . $thn;
     $s_data = "select distinct nofaktur from " . $dbname . ".pmn_faktur where nofaktur like '%" . $nofaktur . "%' order by nofaktur desc ";
     //exit("error".$s_data);
     $q_data = mysql_query($s_data) or die(mysql_error($conn));
     $r_data = mysql_fetch_assoc($q_data);
     $thndata = substr($r_data['nofaktur'], 8, 2);
     $urut = intval(substr($r_data['nofaktur'], 11, 8));
     //exit("error".$nofaktur);
     if ($thn != $thndata) {
         $urut = 1;
     } else {
         $urut++;
     }
     $counter = addZero($urut, 8);
     $nofaktur = $jp . "." . $npwp . "." . $thn . "." . $counter;
     echo $nofaktur;
     break;
 case 'loadvol':
     #Volume:
     # Jika atas biaya uang muka maka vol diambil dari kuantitas kontrak, jika bukan maka
     #   jika timbangan sendiri ambil sum(berat bersih) dari kg timbangan dari tanggal s/d tanggal,
     #   jika timbangan pembeli maka sum(kgpembeli) dari kg timbangan dari tanggal s/d tanggal dari table pabrik timbangan
     if ($biaya == 'Uang Muka') {
         $s_qtykontrak = "select kuantitaskontrak from " . $dbname . ".pmn_kontrakjual\r\n                         where nokontrak='" . $kontrak . "' ";
         $q_qtykontrak = mysql_query($s_qtykontrak) or die(mysql_error($conn));
         $r_qtykontrak = mysql_fetch_assoc($q_qtykontrak);
         $vol = $r_qtykontrak['kuantitaskontrak'];
     } else {
         if ($timbangan == 'Sendiri') {
コード例 #17
0
# Get Attr
$proses = $_GET['proses'];
$data = $_POST;
switch ($proses) {
    case 'add':
        // Validasi, tidak boleh jurnal ke depan
        if (substr(tanggalsystem($data['tanggal']), 0, 4) > $_SESSION['org']['period']['tahun'] - 1) {
            exit("Warning: Jurnal Audit hanya dapat dilakukan untuk tanggal 31 Desember tahun - tahun sebelumnya");
        }
        #=============== Get Nomor Jurnal
        $whereNo = "kodekelompok='" . $data['kodejurnal'] . "' and kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "'";
        $query = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', $whereNo);
        $noKon = fetchData($query);
        $tmpC = $noKon[0]['nokounter'];
        $tmpC++;
        $counter = addZero($tmpC, 3);
        $data['nojurnal'] = tanggalsystem($data['tanggal']) . "/" . $_SESSION['empl']['lokasitugas'] . "/" . $data['kodejurnal'] . "/" . $counter;
        $nojur = $data['nojurnal'];
        #=============== Insert Process
        # Column
        $column = array('kodejurnal', 'tanggal', 'noreferensi', 'matauang', 'revisi', 'nojurnal', 'tanggalentry', 'posting', 'totaldebet', 'totalkredit', 'amountkoreksi', 'autojurnal', 'kurs');
        # Add Default Data
        $data['tanggal'] = tanggalsystem($data['tanggal']);
        $data['tanggalentry'] = date('Ymd');
        $data['posting'] = 0;
        $data['totaldebet'] = 0;
        $data['totalkredit'] = 0;
        $data['amountkoreksi'] = 0;
        $data['autojurnal'] = 0;
        $data['kurs'] = 0;
        # Query
コード例 #18
0
 # Debet
 $dataRes1['detail'][] = array('nojurnal' => $nojurnal1, 'tanggal' => $param['tanggal'], 'nourut' => $noUrut, 'noakun' => $ayatSilang, 'keterangan' => 'Transfer dana tanggal ' . $param['tanggal'] . ' ke ' . $param['kodeorgpenerima'], 'jumlah' => $data[0]['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pt1['kode'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => '', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => null);
 $noUrut++;
 # Kredit
 $dataRes1['detail'][] = array('nojurnal' => $nojurnal1, 'tanggal' => $param['tanggal'], 'nourut' => $noUrut, 'noakun' => $data[0]['noakunpengirim'], 'keterangan' => 'Transfer dana tanggal ' . $param['tanggal'] . ' ke ' . $param['kodeorgpenerima'], 'jumlah' => -1 * $data[0]['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pt1['kode'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => '', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => null);
 $noUrut++;
 #========================= /Prep Dana Keluar ==============================
 #========================= Prep Dana Masuk ================================
 #========================= Journal Counter ================================
 $queryC2 = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodejurnal2 . "'");
 $tmpC2 = fetchData($queryC2);
 if (empty($tmpC2)) {
     echo "Warning : Kode Jurnal belum disetting untuk PT anda";
     exit;
 }
 $konter2 = addZero($tmpC2[0]['nokounter'] + 1, 3);
 $nojurnal2 = $param['tanggal'] . "/" . $data[0]['kodeorgpenerima'] . "/" . $kodejurnal2 . "/" . $konter2;
 #========================= /Journal Counter ===============================
 # Prep Header
 $dataRes2['header'] = array('nojurnal' => $nojurnal2, 'kodejurnal' => $kodejurnal2, 'tanggal' => $param['tanggal'], 'tanggalentry' => date('Ymd'), 'posting' => '0', 'totaldebet' => '0', 'totalkredit' => '0', 'amountkoreksi' => '0', 'noreferensi' => $param['tanggal'] . '/' . $param['kodeorgpengirim'] . '/' . $param['kodeorgpenerima'] . '/' . $param['nogiro'], 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1');
 # Data Detail
 $noUrut = 1;
 # Debet
 $dataRes2['detail'][] = array('nojurnal' => $nojurnal2, 'tanggal' => $param['tanggal'], 'nourut' => $noUrut, 'noakun' => $data[0]['noakunpenerima'], 'keterangan' => 'Transfer dana tanggal ' . $param['tanggal'] . ' dari ' . $param['kodeorgpengirim'], 'jumlah' => $data[0]['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pt2['kode'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => '', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => null);
 $noUrut++;
 # Kredit
 $dataRes2['detail'][] = array('nojurnal' => $nojurnal2, 'tanggal' => $param['tanggal'], 'nourut' => $noUrut, 'noakun' => $ayatSilang, 'keterangan' => 'Transfer dana tanggal ' . $param['tanggal'] . ' dari ' . $param['kodeorgpengirim'], 'jumlah' => -1 * $data[0]['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pt2['kode'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => '', 'noaruskas' => '', 'kodevhc' => '', 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => null);
 $noUrut++;
 #========================= /Prep Dana Masuk ===============================
 #========================== Proses Insert dan Update ======================
 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Header
コード例 #19
0
ファイル: pProfile.php プロジェクト: Neldris/Amisti
    public function getSaveAge()
    {
        $this->setRquery("SELECT pDOBD,pDOBM,pDOBY  FROM amistiPersonal WHERE userID=?", array($this->UID));
        $res = $this->getRquery();
        $id = $this->UID;
        $age = getUserAge($res[0]['pDOBD'], $res[0]['pDOBM'], $res[0]['pDOBY']);
        $age .= " years";
        $birthD .= addZero($res[0]['pDOBD']) . " " . numberToMonth($res[0]['pDODM']);
        $ageInfo = $this->UID == UID ? "Your age information:" : $this->uName . " age information:";
        ?>
				<div class="pProfileICHeader"> <?php 
        echo $ageInfo;
        ?>
</div>
				<?php 
        if ($this->UID == UID) {
            //check if it same as cur user
            ?>
				<div class="pProfileMenuShow">...</div>
				<!--- menu -->
				<div class="pProfileMenu">
				<li id="ageEdit">Edit</li>
				<li id="ageDelete">Delete</li>
				</div>
				<?php 
        }
        ?>
				<div class="pProfileItem">
                <table> 
                <tr><td>Date of Birth </td><td>: <?php 
        echo $birthD;
        ?>
</td></tr>
				<tr><td> Age </td><td>: <?php 
        echo $age;
        ?>
 </td></tr>
               </table>
               
                </div>

				<?php 
    }
コード例 #20
0
     $ql = "select `notransaksi` from " . $dbname . ".`kebun_pengirimanbbt` where notransaksi like '%" . $notransaksi . "%' order by `notransaksi` desc limit 0,1";
     $qr = mysql_query($ql) or die(mysql_error());
     $rp = mysql_fetch_object($qr);
     $awal = substr($rp->notransaksi, -4, 4);
     $awal = intval($awal);
     $cekbln = substr($rp->notransaksi, -7, 2);
     $cekthn = substr($rp->notransaksi, -12, 4);
     //echo "warning:".$awal;exit();
     if ($bln != $cekbln && $thn != $cekthn) {
         //echo $awal; exit();
         $awal = 1;
     } else {
         $awal++;
         // echo"warning:masuk".$awal;exit();
     }
     $counter = addZero($awal, 4);
     $notransaksi = $codeOrg . "/" . $thn . "/" . $bln . "/" . $counter;
     echo $notransaksi;
     break;
     ///insert data
 ///insert data
 case 'insert':
     //echo"warning:masuk";
     if ($notrans == '' || $tgl == '' || $jnsBibit == '' || $jmlh == '') {
         echo "warning:Please Complete The Form";
         exit;
     }
     $sCek = "select notransaksi from " . $dbname . ".kebun_pengirimanbbt where notransaksi='" . $notrans . "'";
     $qCek = mysql_query($sCek) or die(mysql_error());
     $rCek = mysql_num_rows($qCek);
     if ($rCek < 1) {
コード例 #21
0
     if ($rcek['kodeasset'] != '') {
         //if(strlen($_POST['kdAset'])==3)
         //{
         //    $urut=substr($rcek['kodeasset'],-7);
         //}
         //else
         //{
         $urut = substr($rcek['kodeasset'], -6);
         //}
     }
     // exit("Error:".);
     $rer = intval($urut);
     $kdcrt = $rer + 1;
     $kdcrt = addZero($kdcrt, 5);
     if (strlen($_POST['kdAset']) < 3) {
         $kdcrt = addZero($kdcrt, 6);
     }
     $kdasst = $kpl . $kdcrt;
     echo $kdasst . "#####" . $tppenyusutan[$_POST['kdAset']];
     break;
 case 'getSub':
     $optSub = "<option value=''>" . $_SESSION['empl']['pilihdata'] . "</option>";
     $iSub = "select * from " . $dbname . ".sdm_5subtipeasset where kodetipe='" . $_POST['tipe'] . "' ";
     $nSub = mysql_query($iSub) or die(mysql_error($conn));
     while ($dSub = mysql_fetch_assoc($nSub)) {
         if ($_POST['sub'] == $dSub['kodesub']) {
             $select = "selected=selected";
         } else {
             $select = "";
         }
         $optSub .= "<option " . $select . " value='" . $dSub['kodesub'] . "'>" . $dSub['namasub'] . "</option>";
コード例 #22
0
$resPeriod = fetchData($qPeriod);
$tanggalSampai = $resPeriod[0]['tanggalsampai'];
# Get Akun
$kodejurnal = 'WS1';
$qParam = selectQuery($dbname, 'keu_5parameterjurnal', 'noakundebet,noakunkredit', "kodeaplikasi='WS' and jurnalid='" . $kodejurnal . "'");
$tmpParam = fetchData($qParam);
$akunDebet = $tmpParam[0]['noakundebet'];
$akunKredit = $tmpParam[0]['noakunkredit'];
#==================== Journal Counter ==================
$queryC = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodejurnal . "'");
$tmpC = fetchData($queryC);
if (empty($tmpC)) {
    echo "Warning : Kode Jurnal belum disetting untuk PT anda";
    exit;
}
$konter = addZero($tmpC[0]['nokounter'] + 1, 3);
$tanggalJ = tanggalsystem(tanggalnormal($tanggalSampai));
$nojurnal = $tanggalJ . "/" . substr($param['kodeorg'], 0, 4) . "/" . $kodejurnal . "/" . $konter;
#==================== Journal Counter ==================
# Prep Header
$dataRes['header'] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodejurnal, 'tanggal' => $tanggalSampai, 'tanggalentry' => date('Ymd'), 'posting' => '0', 'totaldebet' => '0', 'totalkredit' => '0', 'amountkoreksi' => '0', 'noreferensi' => $param['kodevhc'], 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1');
# Data Detail
$noUrut = 1;
# Debet
$dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggalSampai, 'nourut' => $noUrut, 'noakun' => $akunDebet, 'keterangan' => 'Biaya Bengkel ' . $param['kodevhc'], 'jumlah' => $param['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pt['kode'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => '', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => $param['kodeorg'], 'revisi' => '0', 'kodesegment' => null);
$noUrut++;
# Kredit
$dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggalSampai, 'nourut' => $noUrut, 'noakun' => $akunKredit, 'keterangan' => 'Biaya Bengkel ' . $param['kodevhc'], 'jumlah' => -1 * $param['jumlah'], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pt['kode'], 'kodekegiatan' => '', 'kodeasset' => '', 'kodebarang' => '', 'nik' => '', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => '', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => $param['kodeorg'], 'revisi' => '0', 'kodesegment' => null);
$noUrut++;
#========================== Proses Insert dan Update ==========================
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Header
コード例 #23
0
         }
     }
     echo $res['nokontrak'] . "###" . $res['koderekanan'] . "###" . tanggalnormal($res['tanggalkontrak']) . "###" . $optKom . "###" . $optSatuan . "###" . $res['hargasatuan'] . "###" . $res['matauang'] . "###" . $res['terbilang'] . "###" . $res['kuantitaskontrak'] . "###" . tanggalnormal($res['tanggalkirim']) . "###" . tanggalnormal($res['sdtanggal']) . "###" . tanggalnormal($res['tanggalkirim1']) . "###" . tanggalnormal($res['sdtanggal1']) . "###" . tanggalnormal($res['tanggalkirim2']) . "###" . tanggalnormal($res['sdtanggal2']) . "###" . tanggalnormal($res['tanggalkirim3']) . "###" . tanggalnormal($res['sdtanggal3']) . "###" . $res['kuantitaskirim'] . "###" . $res['kuantitaskirim1'] . "###" . $res['kuantitaskirim2'] . "###" . $res['kuantitaskirim3'] . "###" . $res['franco'] . "###" . $res['ffa'] . "###" . $res['dobi'] . "###" . $res['mdani'] . "###" . $res['toleransi'] . "###" . $res['kdtermin'] . "###" . $optRek . "###" . $res['penandatangan'] . "###" . $res['namajabatan'] . "###" . $res['penandatangan2'] . "###" . $res['namajabatan2'] . "###" . $res['catatanlain'] . "###" . $optCon . "###" . $res['kodept'] . "###" . $res['ppn'] . "###" . tanggalnormal($res['tglpembayarpertama']) . "###" . $res['moist'] . "###" . $res['dirt'] . "###" . $res['grading'] . "###" . $optData;
     break;
 case 'insert':
     $tgl = explode("-", $param['tlgKntrk']);
     $whr = "kodebarang='" . $param['kdBrg'] . "'";
     $optKd = makeOption($dbname, 'pmn_4komoditi', 'kodebarang,kodekomoditi', $whr);
     $sCek = "select max(nokontrak) as nokontrak from " . $dbname . ".pmn_kontrakjual where kodept='" . $param['kdPt'] . "' and left(tanggalkontrak,4)='" . $tgl[2] . "'";
     $qCek = mysql_query($sCek) or die(mysql_error($conn));
     $rCek = mysql_fetch_assoc($qCek);
     $noKntak = explode("/", $rCek['nokontrak']);
     if (intval($noKntak[0]) == 0) {
         $nourut = addZero(intval($noKntak[0]) + 1, 3);
     } else {
         $nourut = addZero(intval($noKntak[0]) + 1, 3);
     }
     // if($optKd[$param['kdBrg']]=='KERNE'){
     // $hKomoditi = 'PK';
     // }else{
     // $hKomoditi = $optKd[$param['kdBrg']];
     // }
     $nokontrak = $nourut . "/" . $param['kdPt'] . "/" . $param['custId'] . "_" . $optKd[$param['kdBrg']] . "/" . $arrBulan[$tgl[1]] . "/" . $tgl[2];
     //exit("error:".$nokontrak);
     if ($param['custId'] == '' || $param['kdBrg'] == '' || $param['HrgStn'] == '' || $param['qty'] == '' || $param['tlgKntrk'] == '' || $param['satuan'] == '') {
         echo "Warning: Please complete the form";
         exit;
     }
     $param['tglKrm0'] == '' ? $param['tglKrm0'] = '0000-00-00' : tanggalsystem($param['tglKrm0']);
     $param['tglKrm1'] == '' ? $param['tglKrm1'] = '0000-00-00' : tanggalsystem($param['tglKrm1']);
     $param['tglKrm2'] == '' ? $param['tglKrm2'] = '0000-00-00' : tanggalsystem($param['tglKrm2']);
コード例 #24
0
ファイル: sdm_slave_saveSP.php プロジェクト: halimc17/magsys
                     }
                 }
             }
         }
     }
     $bulan = substr($tanggalsp, 4, 2);
     $tahun = substr($tanggalsp, 0, 4);
     $arrayRomawi = array("I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII");
     $resultRomawi = $arrayRomawi[(int) $bulan - 1];
     $ql = "select `nomor` from " . $dbname . ".`sdm_suratperingatan` where year(tanggal)='" . $tahun . "'";
     $qr = mysql_query($ql) or die(mysql_error());
     $ql2 = "select `nomor` from " . $dbname . ".`sdm_suratperingatan` where jenissp='" . $jenissp . "' and year(tanggal)='" . $tahun . "'";
     $qr2 = mysql_query($ql2) or die(mysql_error());
     $countNo = mysql_num_rows($qr2);
     $countNoGlobal = mysql_num_rows($qr);
     $noSP = addZero($countNoGlobal + 1, 3) . "/" . $js . "-" . addZero($countNo + 1, 3) . "/" . $resultRomawi . "/" . $tahun;
     //get number
     $potSK = substr($_SESSION['empl']['lokasitugas'], 0, 4) . strtoupper($jenissp) . substr($tanggalsp, 0, 4);
     $str = "select nomor from " . $dbname . ".sdm_suratperingatan\r\n      where  nomor like '" . $potSK . "%'\r\n          order by nomor desc limit 1";
     $notrx = 0;
     $res = mysql_query($str);
     while ($bar = mysql_fetch_object($res)) {
         $notrx = substr($bar->nomor, 10, 5);
     }
     $notrx = intval($notrx);
     $notrx = $notrx + 1;
     $notrx = str_pad($notrx, 4, "0", STR_PAD_LEFT);
     $notrx = $potSK . $notrx;
     $str = "insert into " . $dbname . ".sdm_suratperingatan (\r\n                      `nomor`,`jenissp`,`karyawanid`,\r\n                          `pelanggaran`,`tanggal`,`masaberlaku`,\r\n                          `sampai`,`tembusan1`,`tembusan2`,\r\n                          `tembusan4`,`tembusan3`,\r\n                          `kodeorg`, `penandatangan`,`jabatan`,\r\n                          `updateby`,`paragraf1`,`paragraf3`,\r\n                          `paragraf4`,`verifikasi`,`dibuat`,`jabatanverifikasi`,`jabatandibuat`\r\n                  ) values(\r\n                   '" . $noSP . "','" . $jenissp . "'," . $karyawanid . ",\r\n                   '" . $pelanggaran . "'," . $tanggalsp . "," . $masaberlaku . ",\r\n                   " . $sampai . ",'" . $tembusan1 . "','" . $tembusan2 . "',\r\n                   '" . $tembusan4 . "','" . $tembusan3 . "','" . $kodeorg . "',\r\n                   '" . $penandatangan . "','" . $jabatan . "'," . $_SESSION['standard']['userid'] . ",\r\n                   '" . $paragraf1 . "','" . $paragraf3 . "','" . $paragraf4 . "','" . $verifikasi . "','" . $dibuat . "','" . $jabatan1 . "','" . $jabatan2 . "'\r\n                  )";
 } else {
     if ($method == 'delete') {
コード例 #25
0
     $where = "nojurnal='" . $nojurnal . "'";
     $queryRB = "delete from `" . $dbname . "`.`keu_jurnalht` where " . $where;
     $queryRB2 = updateQuery($dbname, 'kebun_aktifitas', array('jurnal' => 0), "notransaksi='" . $dataH[0]['notransaksi'] . "'");
     $queryRBKonter = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $tmpKonter[0]['nokounter']), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
     if (!mysql_query($queryRB)) {
         $errorDB .= "Rollback 1 Error :" . mysql_error() . "\n" . $queryRB;
     }
     if (!mysql_query($queryRB2)) {
         $errorDB .= "Rollback 2 Error :" . mysql_error() . "\n" . $queryRB2;
     }
     if (!mysql_query($queryRBKonter)) {
         $errorDB .= "Rollback Counter Error :" . mysql_error() . "\n" . $queryRBKonter;
     }
     exit("Error: Kelompok jurnal untuk " . $kodeJurnal1 . " belum ada dan " . $errorDB);
 }
 $konter1 = addZero($tmpKonter1[0]['nokounter'] + 1, 3);
 # Transform No Jurnal dari No Transaksi
 $tmpNoJurnal = explode('/', $param['notransaksi']);
 $nojurnal1 = $tmpNoJurnal[0] . "/" . $tmpNoJurnal[1] . "/" . $kodeJurnal1 . "/" . $konter1;
 #======================== Nomor Jurnal =============================
 #=== Transform Data ===
 $dataResMat['header'] = array();
 $dataResMat['detail'] = array();
 #1. Data Header
 $dataResMat['header'] = array('nojurnal' => $nojurnal1, 'kodejurnal' => $kodeJurnal1, 'tanggal' => $dataH[0]['tanggal'], 'tanggalentry' => date('Ymd'), 'posting' => '1', 'totaldebet' => '0', 'totalkredit' => '0', 'amountkoreksi' => '0', 'noreferensi' => $dataH[0]['notransaksi'], 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
 # Detail (kredit)
 $str = "select a.*,b.namabarang,b.satuan from " . $dbname . ".kebun_pakaimaterial a\r\n          left join " . $dbname . ".log_5masterbarang b on a.kodebarang=b.kodebarang\r\n          where a.notransaksi='" . $param['notransaksi'] . "' and a.kodegudang!=''";
 $resx = mysql_query($str);
 $noUrut = 1;
 $totalJumlah = 0;
 $errAkunBarang = '';
コード例 #26
0
        $strx = "update " . $dbname . ".datakaryawan set \n\t\t\t`namakaryawan`\t='" . $namakaryawan . "',\n\t\t\t`tempatlahir`\t='" . $tempatlahir . "',\n\t\t\t`tanggallahir`\t=" . $tanggallahir . ",\n\t\t\t`warganegara`            ='" . $warganegara . "',\n\t\t\t`jeniskelamin`\t='" . $jeniskelamin . "',\n\t\t\t`statusperkawinan`       ='" . $statusperkawinan . "',\n\t\t\t`tanggalmenikah`\t=" . $tanggalmenikah . ",\n\t\t\t`agama`\t\t\t='" . $agama . "',\n\t\t\t`golongandarah`\t='" . $golongandarah . "',\n\t\t\t`levelpendidikan`        =" . $levelpendidikan . ",\n\t\t\t`alamataktif`\t='" . $alamataktif . "',\n\t\t\t`provinsi`\t\t='" . $provinsi . "',\n\t\t\t`kota`\t\t='" . $kota . "',\n\t\t\t`kodepos`\t\t='" . $kodepos . "',\n\t\t\t`noteleponrumah`         ='" . $noteleponrumah . "',\n\t\t\t`nohp`\t\t='" . $nohp . "',\n\t\t\t`norekeningbank`         ='" . $norekeningbank . "',\n\t\t\t`namabank`\t\t='" . $namabank . "',\n\t\t\t`sistemgaji`\t\t='" . $sistemgaji . "',\n\t\t\t`no_keluarga`\t='" . $nopassport . "',\n\t\t\t`noktp`\t\t\t='" . $noktp . "',\n\t\t\t`notelepondarurat`   ='" . $notelepondarurat . "',\n\t\t\t`tanggalmasuk`           =" . $tanggalmasuk . ",\n\t\t\t`tanggalpengangkatan`    =" . $tanggalpengangkatan . ",\n\t\t\t`tanggalkeluar`\t=" . $tanggalkeluar . ",\n\t\t\t`tipekaryawan`           =" . $tipekaryawan . ",\n\t\t\t`jumlahanak`\t\t=" . $jumlahanak . ",\n\t\t\t`jumlahtanggungan`       =" . $jumlahtanggungan . ",\n\t\t\t`statuspajak`\t='" . $statuspajak . "',\n\t\t\t`npwp`\t\t\t='" . $npwp . "',\n\t\t\t`bpjs`\t\t\t='" . $bpjs . "',\n\t\t\t`lokasipenerimaan`   ='" . $lokasipenerimaan . "',\n\t\t\t`kodeorganisasi`\t='" . $kodeorganisasi . "',\n\t\t\t`bagian`\t\t\t='" . $bagian . "',\n\t\t\t`kodejabatan`\t=" . $kodejabatan . ",\n\t\t\t`kodegolongan`\t='" . $kodegolongan . "',\n\t\t\t`lokasitugas`            ='" . $lokasitugas . "',\n\t\t\t`email`\t\t='" . $email . "',\n\t\t\t`alokasi`\t\t=" . $alokasi . ",\n\t\t\t`subbagian`\t\t='" . $subbagian . "',\n\t\t\t`jms`                ='" . $jms . "' , \n\t\t\t`kodecatu`               ='" . $catu . "', \n\t\t\t`statpremi`          ='" . $_POST['statPremi'] . "',\n\t\t\t`updateby`\t= '" . $_SESSION['standard']['userid'] . "'\n\t\t\twhere karyawanid=" . $karyawanid;
        logData($oldData, $param);
        break;
    case 'insert':
        //Generate NIK Karyawan
        $sReg = "select t1.kodepenerimaankaryawan, t1.regional from " . $dbname . ".bgt_regional t1\n\t\t\t\tleft join " . $dbname . ".bgt_regional_assignment t2\n\t\t\t\ton t1.regional = t2.regional\n\t\t\t\twhere t2.kodeunit = '" . $lokasitugas . "' limit 1";
        $qReg = mysql_query($sReg) or die(mysql_error($conn));
        while ($bReg = mysql_fetch_object($qReg)) {
            $regionalId = $bReg->kodepenerimaankaryawan;
            $resRegional = $bReg->regional;
        }
        $time = strtotime($tanggalmasuk);
        $sKar = "select max(substring(nik,2,3)) as noUrut from " . $dbname . ".datakaryawan where lokasitugas in (select kodeunit from " . $dbname . ".bgt_regional_assignment" . " where regional='" . $resRegional . "') and MONTH(tanggalmasuk) = '" . date('m', $time) . "' and YEAR(tanggalmasuk)='" . date('Y', $time) . "'";
        $qKar = mysql_query($sKar) or die(mysql_error());
        $rKar = mysql_fetch_assoc($qKar);
        $genNik = $regionalId . "" . addZero($rKar['noUrut'] + 1, 3) . "" . date('m', $time) . "" . date('y', $time);
        $strx = "insert into " . $dbname . ".datakaryawan(\n\t\t  `nik`,`namakaryawan`,\n\t\t  `tempatlahir`,`tanggallahir`,\n\t\t  `warganegara`,`jeniskelamin`,\n\t\t  `statusperkawinan`,`tanggalmenikah`,\n\t\t  `agama`,`golongandarah`,\n\t\t  `levelpendidikan`,`alamataktif`,\n\t\t  `provinsi`,`kota`,`kodepos`,\n\t\t  `noteleponrumah`,`nohp`,\n\t\t  `norekeningbank`,`namabank`,\n\t\t  `sistemgaji`,`no_keluarga`,\n\t\t  `noktp`,`notelepondarurat`,\n\t\t  `tanggalmasuk`,`tanggalpengangkatan`,`tanggalkeluar`,\n\t\t  `tipekaryawan`,`jumlahanak`,\n\t\t  `jumlahtanggungan`,`statuspajak`,\n\t\t  `npwp`,`bpjs`,`lokasipenerimaan`,`kodeorganisasi`,\n\t\t  `bagian`,`kodejabatan`,`kodegolongan`,\n\t\t  `lokasitugas`,`email`,`alokasi`,`subbagian`,`jms`,kodecatu,statpremi,updateby)\n\t\tvalues('" . $genNik . "','" . $namakaryawan . "',\n\t\t  '" . $tempatlahir . "'," . $tanggallahir . ",\n\t\t  '" . $warganegara . "','" . $jeniskelamin . "',\n\t\t  '" . $statusperkawinan . "'," . $tanggalmenikah . ",\n\t\t  '" . $agama . "','" . $golongandarah . "',\n\t\t  " . $levelpendidikan . ",'" . $alamataktif . "',\n\t\t  '" . $provinsi . "','" . $kota . "','" . $kodepos . "',\n\t\t  '" . $noteleponrumah . "','" . $nohp . "',\n\t\t  '" . $norekeningbank . "','" . $namabank . "',\n\t\t  '" . $sistemgaji . "','" . $nopassport . "',\n\t\t  '" . $noktp . "','" . $notelepondarurat . "',\n\t\t  " . $tanggalmasuk . "," . $tanggalpengangkatan . "," . $tanggalkeluar . ",\n\t\t  " . $tipekaryawan . "," . $jumlahanak . ",\n\t\t  " . $jumlahtanggungan . ",'" . $statuspajak . "',\n\t\t  '" . $npwp . "','" . $bpjs . "','" . $lokasipenerimaan . "','" . $kodeorganisasi . "',\n\t\t  '" . $bagian . "'," . $kodejabatan . ",'" . $kodegolongan . "',\n\t\t  '" . $lokasitugas . "','" . $email . "'," . $alokasi . ",\n\t\t  '" . $subbagian . "','" . $jms . "','" . $catu . "','" . $_POST['statPremi'] . "','" . $_SESSION['standard']['userid'] . "')";
        break;
    default:
        $strx = "select 1=1";
        break;
}
if (mysql_query($strx)) {
    //whenever not deleting, return value as below to javascript
    if ($method != 'delete') {
        $karid = '';
        $nama = '';
        $str = "select karyawanid,namakaryawan,nik from " . $dbname . ".datakaryawan where\n\t\t\t  namakaryawan='" . $namakaryawan . "' and tanggallahir='" . $tanggallahir . "'";
        $res = mysql_query($str);
        //echo $str;
        while ($bar = mysql_fetch_object($res)) {
コード例 #27
0
function prosesAlokasi()
{
    global $conn;
    global $tanggal;
    global $param;
    global $dbname;
    global $defSegment;
    #1 ambil periode akuntansi
    $str = "select tanggalmulai,tanggalsampai from " . $dbname . ".setup_periodeakuntansi where \r\n          kodeorg ='" . $_SESSION['empl']['lokasitugas'] . "' and tutupbuku=0";
    $tgmulai = '';
    $tgsampai = '';
    $res = mysql_query($str);
    if (mysql_num_rows($res) < 1) {
        exit("Error: Tidak ada periode akuntansi untuk induk " . $_SESSION['empl']['lokasitugas']);
    }
    while ($bar = mysql_fetch_object($res)) {
        $tgsampai = $bar->tanggalsampai;
        $tgmulai = $bar->tanggalmulai;
    }
    if ($tgmulai == '' || $tgsampai == '') {
        exit("Error: Periode akuntasi tidak terdaftar");
    }
    #2 output pada jurnal kolom noreferensi ALK_KERJA_AB
    $group = 'VHC1';
    #ambil akun alokasi
    $str = "select noakundebet from " . $dbname . ".keu_5parameterjurnal\r\n          where jurnalid='" . $group . "' limit 1";
    $res = mysql_query($str);
    if (mysql_num_rows($res) < 1) {
        exit("Error: No.Akun pada parameterjurnal belum ada untuk VHC1");
    } else {
        $bar = mysql_fetch_object($res);
        $akunalok = $bar->noakundebet;
    }
    #3 ambil semua lokasi kegiatan
    $str = "select sum(a.jumlah) as jlh,a.alokasibiaya,b.noakun,a.kodesegment from " . $dbname . ".vhc_rundt a\r\n            left join " . $dbname . ".vhc_kegiatan b on a.jenispekerjaan=b.kodekegiatan\r\n            left join " . $dbname . ".vhc_runht c on a.notransaksi=c.notransaksi     \r\n            where c.kodevhc='" . $param['kodevhc'] . "'\r\n            and c.tanggal>='" . $tgmulai . "' and c.tanggal <='" . $tgsampai . "' and alokasibiaya!='' \r\n            and jenispekerjaan!=''    \r\n            group by jenispekerjaan,noakun,alokasibiaya,kodesegment";
    //      if($param['kodevhc']=='B9530XR'){
    //      echo "Error".$str;exit();
    //      }
    $res = mysql_query($str);
    //echo mysql_error($conn);
    $lokasi = array();
    $biaya = array();
    $jam = array();
    $akun = array();
    $kodeasset = array();
    $segment = array();
    $ttl = 0;
    while ($bar = mysql_fetch_object($res)) {
        #kusus jika project
        if (substr($bar->alokasibiaya, 0, 2) == 'AK' or substr($bar->alokasibiaya, 0, 2) == 'PB') {
            #ambil akun aktiva dalam konstruksi
            $tipeasset = substr($bar->alokasibiaya, 3, 3);
            $tipeasset = str_replace("0", "", $tipeasset);
            $str1 = "select akunak from " . $dbname . ".sdm_5tipeasset where kodetipe='" . $tipeasset . "'";
            $res1 = mysql_query($str1);
            if (mysql_num_rows($res1) < 1) {
                exit(" Error: Akun aktiva dalam konstruksi untuk " . $tipeasset . " beum disetting dari keuangan->setup->tipeasset");
            } else {
                while ($bar1 = mysql_fetch_object($res1)) {
                    if ($bar1->akunak == '') {
                        exit(" Error: Akun aktiva dalam konstruksi untuk " . $tipeasset . " beum disetting dari keuangan->setup->tipeasset");
                    } else {
                        $akun[] = $bar1->akunak;
                    }
                }
                $kodeasset[] = $bar->alokasibiaya;
                $lokasi[] = $bar->alokasibiaya;
                $jam[] = $bar->jlh;
                $biaya[] = $bar->jlh * $param['jumlah'];
                $kegiatan[] = '';
                $segment[] = $bar->kodesegment;
            }
        } else {
            $lokasi[] = $bar->alokasibiaya;
            $akun[] = $bar->noakun;
            $jam[] = $bar->jlh;
            $biaya[] = $bar->jlh * $param['jumlah'];
            $kegiatan[] = $bar->noakun . "01";
            $kodeasset[] = '';
            $segment[] = $bar->kodesegment;
        }
    }
    // foreach ($jam as $key=>$val)
    // {
    //   $biaya[$key] =$val*$param['jumlah'];
    // }
    foreach ($biaya as $key => $nilai) {
        #periksa unit
        $dataRes['header'] = array();
        $dataRes['detail'] = array();
        $intern = true;
        $pengguna = substr($lokasi[$key], 0, 4);
        if (substr($lokasi[$key], 0, 2) == 'AK' or substr($lokasi[$key], 0, 2) == 'PB') {
            #khusus project
            $str = "select kodeorg from " . $dbname . ".project where kode='" . $lokasi[$key] . "'";
            $res = mysql_query($str);
            while ($bar = mysql_fetch_object($res)) {
                $pengguna = $bar->kodeorg;
                $lokasi[$key] = '';
            }
        }
        #ambil piutang ke pengguna
        $str = "select akunpiutang,jenis from " . $dbname . ".keu_5caco where kodeorg='" . $pengguna . "'";
        $res = mysql_query($str);
        $intraco = '';
        $interco = '';
        while ($bar = mysql_fetch_object($res)) {
            if ($bar->jenis == 'intra') {
                $intraco = $bar->akunpiutang;
            } else {
                $interco = $bar->akunpiutang;
            }
        }
        #++++++++++++++++++++++++++++++++++++++
        $akunpekerjaan = $akun[$key];
        #++++++++++++++++++++++++++++++++++++++++
        $ptpengguna = '';
        $str = "select induk from " . $dbname . ".organisasi where kodeorganisasi='" . $pengguna . "'";
        $res = mysql_query($str);
        while ($bar = mysql_fetch_object($res)) {
            $ptpengguna = $bar->induk;
        }
        $ptGudang = '';
        $str = "select induk from " . $dbname . ".organisasi where kodeorganisasi='" . $_SESSION['empl']['lokasitugas'] . "'";
        $res = mysql_query($str);
        while ($bar = mysql_fetch_object($res)) {
            $ptGudang = $bar->induk;
        }
        #jika pt tidak sama maka pakai akun interco
        $akunpengguna = '';
        if ($ptGudang != $ptpengguna) {
            #ambil akun interco
            $intern = false;
            $str = "select akunhutang from " . $dbname . ".keu_5caco where kodeorg='" . $_SESSION['empl']['lokasitugas'] . "' and jenis='inter'";
            $res = mysql_query($str);
            $akunpengguna = '';
            while ($bar = mysql_fetch_object($res)) {
                $akunpengguna = $bar->akunhutang;
            }
            $akunsendiri = $interco;
            if ($akunpengguna == '') {
                exit("Error: Akun intraco  atau interco belum ada untuk unit " . $pengguna);
            }
        } else {
            if ($pengguna != $_SESSION['empl']['lokasitugas']) {
                #jika satu pt beda kebun
                #ambil akun intraco
                $intern = false;
                $str = "select akunhutang from " . $dbname . ".keu_5caco where kodeorg='" . $_SESSION['empl']['lokasitugas'] . "' and jenis='intra'";
                $res = mysql_query($str);
                $akunpengguna = '';
                while ($bar = mysql_fetch_object($res)) {
                    $akunpengguna = $bar->akunhutang;
                }
                $akunsendiri = $intraco;
                if ($akunpengguna == '') {
                    exit("Error: Akun intraco  atau interco belum ada untuk unit " . $pengguna);
                }
            } else {
                $intern = true;
            }
        }
        if ($intern) {
            #proses data
            $kodeJurnal = $group;
            #======================== Nomor Jurnal =============================
            # Get Journal Counter
            $queryJ = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "' ");
            $tmpKonter = fetchData($queryJ);
            $konter = addZero($tmpKonter[0]['nokounter'] + 1, 3);
            # Transform No Jurnal dari No Transaksi
            $nojurnal = str_replace("-", "", $tanggal) . "/" . $_SESSION['empl']['lokasitugas'] . "/" . $kodeJurnal . "/" . $konter;
            #======================== /Nomor Jurnal ============================
            # Prep Header
            $dataRes['header'] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodeJurnal, 'tanggal' => $tanggal, 'tanggalentry' => date('Ymd'), 'posting' => 1, 'totaldebet' => $biaya[$key], 'totalkredit' => -1 * $biaya[$key], 'amountkoreksi' => '0', 'noreferensi' => 'ALK_KERJA_AB', 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
            # Data Detail
            $noUrut = 1;
            # Debet
            $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akunpekerjaan, 'keterangan' => $param['periode'] . ':Biaya Kendaraan ' . $param['kodevhc'], 'jumlah' => $biaya[$key], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => $kegiatan[$key], 'kodeasset' => $kodeasset[$key], 'kodebarang' => '', 'nik' => 0, 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_KERJA_AB', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => $lokasi[$key], 'revisi' => '0', 'kodesegment' => $segment[$key]);
            $noUrut++;
            # Kredit
            $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akunalok, 'keterangan' => $param['periode'] . ':Alokasi biaya kend' . $param['kodevhc'], 'jumlah' => -1 * $biaya[$key], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => $kegiatan[$key], 'kodeasset' => '', 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_KERJA_AB', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => $lokasi[$key], 'revisi' => '0', 'kodesegment' => $segment[$key]);
            $noUrut++;
            $insHead = insertQuery($dbname, 'keu_jurnalht', $dataRes['header']);
            if (!mysql_query($insHead)) {
                $headErr .= 'Insert Header Intern Error : ' . mysql_error() . "\n";
            }
            if (empty($headErr)) {
                #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Detail
                $detailErr = '';
                foreach ($dataRes['detail'] as $row) {
                    $insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
                    if (!mysql_query($insDet)) {
                        $detailErr .= "Insert Detail Intern Error : " . mysql_error() . "\n";
                        break;
                    }
                }
                if ($detailErr == '') {
                    # Header and Detail inserted
                    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Update Kode Jurnal
                    $updJurnal = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
                    if (!mysql_query($updJurnal)) {
                        echo "Update Kode Jurnal Error : " . mysql_error() . "\n";
                        # Rollback if Update Failed
                        $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                        if (!mysql_query($RBDet)) {
                            echo "Rollback Delete Header Error : " . mysql_error() . "\n";
                            exit;
                        }
                        exit;
                    } else {
                    }
                } else {
                    echo $detailErr;
                    # Rollback, Delete Header
                    $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                    if (!mysql_query($RBDet)) {
                        echo "Rollback Delete Header Error : " . mysql_error();
                        exit;
                    }
                }
            } else {
                echo $headErr;
                exit;
            }
        } else {
            # Data Detail
            $noUrut = 1;
            #proses data
            $kodeJurnal = $group;
            #======================== Nomor Jurnal =============================
            # Get Journal Counter
            $queryJ = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "' ");
            $tmpKonter = fetchData($queryJ);
            $konter = addZero($tmpKonter[0]['nokounter'] + 1, 3);
            # Transform No Jurnal dari No Transaksi
            $nojurnal = str_replace("-", "", $tanggal) . "/" . $_SESSION['empl']['lokasitugas'] . "/" . $kodeJurnal . "/" . $konter;
            #======================== /Nomor Jurnal ============================
            # Prep Header
            $dataRes['header'] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodeJurnal, 'tanggal' => $tanggal, 'tanggalentry' => date('Ymd'), 'posting' => 1, 'totaldebet' => $biaya[$key], 'totalkredit' => -1 * $biaya[$key], 'amountkoreksi' => '0', 'noreferensi' => 'ALK_KERJA_AB', 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
            # Debet
            $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akunsendiri, 'keterangan' => $param['periode'] . ':Biaya Kendaraan ' . $param['kodevhc'], 'jumlah' => $biaya[$key], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => $kegiatan[$key], 'kodeasset' => '', 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_KERJA_AB', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => $defSegment);
            $noUrut++;
            # Kredit
            $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tanggal, 'nourut' => $noUrut, 'noakun' => $akunalok, 'keterangan' => $param['periode'] . ':Alokasi biaya kend' . $param['kodevhc'], 'jumlah' => -1 * $biaya[$key], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $_SESSION['empl']['lokasitugas'], 'kodekegiatan' => $kegiatan[$key], 'kodeasset' => '', 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_KERJA_AB', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => '', 'revisi' => '0', 'kodesegment' => $defSegment);
            $noUrut++;
            $insHead = insertQuery($dbname, 'keu_jurnalht', $dataRes['header']);
            if (!mysql_query($insHead)) {
                $headErr .= 'Insert Header Ex.Self Error : ' . mysql_error() . "\n";
            }
            if (empty($headErr)) {
                #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Detail
                $detailErr = '';
                foreach ($dataRes['detail'] as $row) {
                    $insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
                    if (!mysql_query($insDet)) {
                        $detailErr .= "Insert Detail Ex.Self Error : " . mysql_error() . "\n";
                        break;
                    }
                }
                if ($detailErr == '') {
                    # Header and Detail inserted
                    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Update Kode Jurnal
                    $updJurnal = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter), "kodeorg='" . $_SESSION['org']['kodeorganisasi'] . "' and kodekelompok='" . $kodeJurnal . "'");
                    if (!mysql_query($updJurnal)) {
                        echo "Update Kode Jurnal Error : " . mysql_error() . "\n";
                        # Rollback if Update Failed
                        $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                        if (!mysql_query($RBDet)) {
                            echo "Rollback Delete Header Error : " . mysql_error() . "\n";
                            exit;
                        }
                        exit;
                    } else {
                    }
                } else {
                    echo $detailErr;
                    # Rollback, Delete Header
                    $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                    if (!mysql_query($RBDet)) {
                        echo "Rollback Delete Header Error : " . mysql_error();
                        exit;
                    }
                }
            } else {
                echo $headErr;
                exit;
            }
            #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            #sisi Pengguna
            $kodeJurnal = $group;
            #ambil periodeaktif pengguna
            //            $strd="select tanggalmulai,tanggalsampai from ".$dbname.".setup_periodeakuntansi where
            //                  kodeorg='".$pengguna."' and tutupbuku=0";
            //
            //            $resd=mysql_query($strd);
            //            $tgmulaid='';
            //            while($bard=mysql_fetch_object($resd))
            //            {
            //                $tgmulaid    = $bard->tanggalmulai;
            //            }
            //             if($tgmulaid=='' or substr($tgmulaid,0,7)==substr($tanggal,0,7))#jika periode sama maka biarkan
            $tgmulaid = $tanggal;
            #======================== Nomor Jurnal =============================
            # Get Journal Counter
            $queryJ = selectQuery($dbname, 'keu_5kelompokjurnal', 'nokounter', "kodeorg='" . $ptpengguna . "' and kodekelompok='" . $kodeJurnal . "' ");
            $tmpKonter = fetchData($queryJ);
            $konter = addZero($tmpKonter[0]['nokounter'] + 1, 3);
            # Transform No Jurnal dari No Transaksi
            $nojurnal = str_replace("-", "", $tgmulaid) . "/" . $pengguna . "/" . $kodeJurnal . "/" . $konter;
            #======================== /Nomor Jurnal ============================
            # Prep Header
            unset($dataRes['header']);
            //ganti header
            $dataRes['header'] = array('nojurnal' => $nojurnal, 'kodejurnal' => $kodeJurnal, 'tanggal' => $tgmulaid, 'tanggalentry' => date('Ymd'), 'posting' => 1, 'totaldebet' => $biaya[$key], 'totalkredit' => -1 * $biaya[$key], 'amountkoreksi' => '0', 'noreferensi' => 'ALK_KERJA_AB', 'autojurnal' => '1', 'matauang' => 'IDR', 'kurs' => '1', 'revisi' => '0');
            //print_r($dataRes['header']);
            //exit("Error");
            # Debet 1
            $noUrut = 1;
            unset($dataRes['detail']);
            //ganti header
            $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tgmulaid, 'nourut' => $noUrut, 'noakun' => $akunpekerjaan, 'keterangan' => $param['periode'] . ':Biaya Kendaraan ' . $param['kodevhc'], 'jumlah' => $biaya[$key], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pengguna, 'kodekegiatan' => $kegiatan[$key], 'kodeasset' => $kodeasset[$key], 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_KERJA_AB', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => $lokasi[$key], 'revisi' => '0', 'kodesegment' => $segment[$key]);
            $noUrut++;
            # Kredit 1
            $dataRes['detail'][] = array('nojurnal' => $nojurnal, 'tanggal' => $tgmulaid, 'nourut' => $noUrut, 'noakun' => $akunpengguna, 'keterangan' => $param['periode'] . ':Alokasi biaya kend' . $param['kodevhc'], 'jumlah' => -1 * $biaya[$key], 'matauang' => 'IDR', 'kurs' => '1', 'kodeorg' => $pengguna, 'kodekegiatan' => $kegiatan[$key], 'kodeasset' => '', 'kodebarang' => '', 'nik' => '0', 'kodecustomer' => '', 'kodesupplier' => '', 'noreferensi' => 'ALK_KERJA_AB', 'noaruskas' => '', 'kodevhc' => $param['kodevhc'], 'nodok' => '', 'kodeblok' => $lokasi[$key], 'revisi' => '0', 'kodesegment' => $segment[$key]);
            $noUrut++;
            $insHead = insertQuery($dbname, 'keu_jurnalht', $dataRes['header']);
            if (!mysql_query($insHead)) {
                $headErr .= 'Insert Header OSIDE Error : ' . mysql_error() . "\n";
            }
            if (empty($headErr)) {
                #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Insert Detail
                $detailErr = '';
                foreach ($dataRes['detail'] as $row) {
                    $insDet = insertQuery($dbname, 'keu_jurnaldt', $row);
                    if (!mysql_query($insDet)) {
                        $detailErr .= "Insert Detail OSIDE Error : " . mysql_error() . "\n" . $insDet;
                        break;
                    }
                }
                if ($detailErr == '') {
                    # Header and Detail inserted
                    #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Update Kode Jurnal
                    $updJurnal = updateQuery($dbname, 'keu_5kelompokjurnal', array('nokounter' => $konter), "kodeorg='" . $ptpengguna . "' and kodekelompok='" . $kodeJurnal . "'");
                    if (!mysql_query($updJurnal)) {
                        echo "Update Kode Jurnal Error : " . mysql_error() . "\n";
                        # Rollback if Update Failed
                        $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                        if (!mysql_query($RBDet)) {
                            echo "Rollback Delete Header Error : " . mysql_error() . "\n";
                            exit;
                        }
                        exit;
                    } else {
                    }
                } else {
                    echo $detailErr;
                    # Rollback, Delete Header
                    $RBDet = deleteQuery($dbname, 'keu_jurnalht', "nojurnal='" . $nojurnal . "'");
                    if (!mysql_query($RBDet)) {
                        echo "Rollback Delete Header Error : " . mysql_error();
                        exit;
                    }
                }
            } else {
                echo $headErr;
                exit;
            }
        }
    }
}
コード例 #28
0
require_once 'master_validation.php';
require_once 'config/connection.php';
require_once 'lib/nangkoelib.php';
include_once 'lib/zLib.php';
?>
<script language=javascript1.2 src="js/generic.js"></script>
<script language=javascript1.2 src="js/pabrik_2pengolahan.js"></script>
<link rel=stylesheet type='text/css' href='style/generic.css'>
<?php 
$nopengolahan = $_GET['nopengolahan'];
$tanggal = checkPostGet('tanggal', '');
$kodeorg = $_GET['kodeorg'];
$periode_tahun = $_GET['periode_tahun'];
$periode_bulan = $_GET['periode_bulan'];
$periode = $periode_tahun . '-' . addZero($periode_bulan, 2);
setIt($_GET['type'], '');
//=================================================
echo "<fieldset><legend>Print Excel</legend>\r\n     <img onclick=\"detailExcel(event,'pabrik_slave_2pengolahanbarang.php?type=excel&nopengolahan=" . $nopengolahan . "&kodeorg=" . $kodeorg . "&periode_tahun=" . $periode_tahun . "&periode_bulan=" . $periode_bulan . "')\" src=images/excel.jpg class=resicon title='MS.Excel'>\r\n     </fieldset>";
if ($_GET['type'] != 'excel') {
    $stream = "<table class=sortable border=0 cellspacing=1>";
} else {
    $stream = "<table class=sortable border=1 cellspacing=1>";
}
$stream .= "\r\n      <thead>\r\n        <tr class=rowcontent>\r\n          <td>No</td>\r\n          <td>Station</td>\r\n          <td>" . $_SESSION['lang']['mesin'] . "</td>\r\n          <td>" . $_SESSION['lang']['namabarang'] . "</td>\r\n          <td>" . $_SESSION['lang']['jumlah'] . "</td>\r\n          <td>" . $_SESSION['lang']['satuan'] . "</td>\r\n          <td>" . $_SESSION['lang']['hargasatuan'] . "</td>\r\n          <td>" . $_SESSION['lang']['total'] . "</td>\r\n        </tr>\r\n      </thead>\r\n      <tbody>";
$str = "select * from " . $dbname . ".pabrik_pengolahan_barang\r\n              where nopengolahan = '" . $nopengolahan . "%'";
$strJ = "select * from " . $dbname . ".organisasi";
$resJ = mysql_query($strJ, $conn);
while ($barJ = mysql_fetch_object($resJ)) {
    $org[$barJ->kodeorganisasi] = $barJ->namaorganisasi;
}
コード例 #29
0
         $jamstag = "";
     }
     $tab .= "<td align='" . $alignPrev[$i] . "'>" . $jamstag . "</td>";
 } else {
     if ($i == 2) {
         // jam operasional
         $jambrut = fixHours($dataShow[$key][$head]);
         list($hoursb, $minutesb) = strstr($jambrut, ':') ? explode(':', $jambrut) : array(0, 0);
         list($hourss, $minutess) = strstr($jamstag, ':') ? explode(':', $jamstag) : array(0, 0);
         $minutes = $minutesb - $minutess;
         $hours = $hoursb - $hourss;
         if ($minutes < 0) {
             $minutes = 60 + $minutes;
             $hours -= 1;
         }
         $minutes = addZero($minutes, 2);
         $jamop = "{$hours}:{$minutes}";
         if ($jambrut == "0:00" and $jamstag == "") {
             $jamop = "";
         }
         $tab .= "<td align='" . $alignPrev[$i] . "'>" . $jamop . "</td>";
     } else {
         if ($i == 7) {
             // detail
             if ($mode != 'excel') {
                 $tab .= "<td align='" . $alignPrev[$i] . "'><img onclick=\"viewDetail('" . $dataShow[$key][$head] . "','" . $tanggal . "','" . $kodeorg . "','" . $periode_tahun . "','" . $periode_bulan . "',event);\" title='" . $_SESSION['lang']['klikdetail'] . "' class=\"resicon\" src=\"images/icons/clipboard_sign.png\"></td>";
             }
         } else {
             // lori & tbs
             $jumlah = number_format(intval($dataShow[$key][$head]), 0);
             if ($jumlah == 0) {
コード例 #30
0
ファイル: zForm.php プロジェクト: halimc17/magsys
function optionNum($arrEl)
{
    $len = strlen($arrEl);
    $strArr = $len;
    $num = array();
    for ($i = 0; $i < $arrEl; $i++) {
        $tmpI = strval($i);
        $tmpNo = addZero($tmpI, $strArr);
        $num[$i] = $tmpNo;
    }
    return $num;
}