<?php require_once 'master_validation.php'; require_once 'config/connection.php'; require_once 'lib/nangkoelib.php'; $pt = $_POST['pt']; $gudang = $_POST['gudang']; $periode = $_POST['periode']; $periodeKmrn = periodelalu($periode); $nourut = $_POST['nourut']; #print_r($_POST); #exit; //ambil namapt $str = "select namaorganisasi from " . $dbname . ".organisasi where kodeorganisasi='" . $pt . "'"; $namapt = 'COMPANY NAME'; $res = mysql_query($str); while ($bar = mysql_fetch_object($res)) { $namapt = strtoupper($bar->namaorganisasi); } $whr = " and kodeorg in (select kodeorganisasi from " . $dbname . ".organisasi where induk='" . $pt . "')"; if ($gudang != '') { $whr = " and kodeorg='" . $gudang . "'"; } $str = "select distinct tanggalmulai,tanggalsampai from " . $dbname . ".setup_periodeakuntansi where \r\n periode='" . $periode . "' " . $whr . ""; //echo $str."____"; $res = mysql_query($str); $currstart = ''; $currend = ''; while ($bar = mysql_fetch_object($res)) { $currstart = $bar->tanggalmulai; $currend = $bar->tanggalsampai;
//echo $awal; exit(); $awal = 1; } else { $awal++; // echo"warning:masuk".$awal;exit(); } $counter = addZero($awal, 4); $nospb = $lokasi . "/" . $thn . "/" . $bln . "/" . $counter; echo $nospb; } else { echo "warning:Anda Bukan di Kebun atau Traksi"; exit; } break; case 'amblBjr': $perlalu = periodelalu(substr($_POST['periode'], 0, 7)); ##tambahkan pengecekan spb bulan lalu sudah terposting semua $iSpb = "select count(*) as jumlah from " . $dbname . ".kebun_spbht where kodeorg='" . substr($blok, 0, 4) . "' " . " and tanggal like '%" . $perlalu . "%' and posting=0 "; $nSpb = mysql_query($iSpb) or die(mysql_error($conn)); $dSpb = mysql_fetch_assoc($nSpb); $belumposting = $dSpb['jumlah']; //exit("Error:$belumposting"); if ($belumposting > 0) { exit("Warning : Ada nomor spb yang belum di posting untuk " . substr($blok, 0, 4) . " "); } #bentuk periode baru dan bentuk bjr periode lalu $iBjr = "SELECT sum(a.totalkg)/sum(a.jjg) as bjr,tanggal,blok\r\n FROM " . $dbname . ".`kebun_spbdt` a left join " . $dbname . ".kebun_spbht b on \r\n a.nospb=b.nospb where blok='" . $blok . "'\r\n and tanggal like '%" . $perlalu . "%' "; $nBjr = mysql_query($iBjr) or die(mysql_error($conn)); $dBjr = mysql_fetch_assoc($nBjr); $bjrlalu = $dBjr['bjr']; #bentuk bjr dari tabel bjr