예제 #1
0
function boxesInstagram($user_id)
{
    $boxes = array();
    function fetchData($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
    }
    $result = fetchData('https://api.instagram.com/v1/users/' . $user_id . '/media/recent/?access_token=10392439.44b554e.ab889407055b456381897320866ab6b7');
    $result = json_decode($result);
    $i = 0;
    foreach ($result->data as $post) {
        $boxes[$i]['type'] = $post->type;
        $boxes[$i]['id'] = $post->id;
        $boxes[$i]['image_url'] = $post->images->low_resolution->url;
        //$boxes[$i]['date'] = date( "D n/j" , strtotime( $post->created_time ) );
        $boxes[$i]['text'] = $post->caption->text;
        $boxes[$i]['link'] = $post->link;
        $i++;
    }
    return $boxes;
}
예제 #2
0
 function Header()
 {
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $kdOrg;
     global $tgl;
     # Bulan
     // $optBulan =
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 12;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['kodeorg'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $_SESSION['empl']['lokasitugas'], '', 0, 'L');
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['user'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(15 / 100 * $width, $height, $_SESSION['standard']['username'], 0, 0, 'L');
     $this->Ln();
     $query2 = selectQuery($dbname, 'organisasi', 'namaorganisasi', "kodeorganisasi='" . $kdOrg . "'");
     $orgData2 = fetchData($query2);
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['kebun'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $orgData2[0]['namaorganisasi'], '', 0, 'L');
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['tanggal'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(15 / 100 * $width, $height, date('d-m-Y H:i:s'), '', 1, 'L');
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['periode'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $tgl[1] . "-" . $tgl[0], '', 0, 'L');
     $this->Ln();
     $this->SetFont('Arial', 'U', 12);
     $this->Cell($width, $height, $title, 0, 1, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(220, 220, 220);
     // $this->Cell(10/100*$width,$height,'No',1,0,'C',1);
     foreach ($colArr as $key => $head) {
         $this->Cell($length[$key] / 100 * $width, $height, $_SESSION['lang'][$head], 1, 0, 'C', 1);
     }
     $this->Ln();
 }
예제 #3
0
function getHookImages($hook, $count)
{
    $sql = e107::getDb();
    $pref = e107::pref('imggregator');
    $count = isset($count) ? $count : $pref['imagesToFetch'];
    $tokens = explode(';', $sql->retrieve('hooks', 'hook_tokens', 'hook_name="' . $hook . '"'));
    if ($hook == 'instagram') {
        $user_id = explode(':', $tokens[0]);
        $access_token = explode(':', $tokens[1]);
        $url = fetchData('https://api.instagram.com/v1/users/' . $user_id[1] . '/media/recent/?access_token=' . $access_token[1] . '&count=' . $count);
        $result = json_decode($url);
        $i = 0;
        foreach ($result->data as $image) {
            copy($image->images->standard_resolution->url, 'images/instagram' . $i . '.jpg');
            $i++;
            //$images[] = $image->images->standard_resolution->url;
        }
    } else {
        if ($hook == 'flickr') {
            $user_id = explode(':', $tokens[0]);
            $api_key = explode(':', $tokens[1]);
            $xml = simplexml_load_file('https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=' . $api_key[1] . '&user_id=' . urlencode($user_id[1]) . '&format=rest');
            $i = 0;
            foreach ($xml->photos->photo as $photo) {
                if ($photo['ispublic'] == 1) {
                    copy('https://farm' . $photo['farm'] . '.staticflickr.com/' . $photo['server'] . '/' . $photo['id'] . '_' . $photo['secret'] . '.jpg', 'images/flickr' . $i . '.jpg');
                    $i++;
                    //$images[] .= 'https://farm'.$photo['farm'].'.staticflickr.com/'.$photo['server'].'/'.$photo['id'].'_'.$photo['secret'].'.jpg';
                }
            }
        }
    }
    return $images;
}
 function Header()
 {
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $periode;
     //$periode=$_GET['column'];
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 12;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['user'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, ucfirst($_SESSION['standard']['username']), '', 0, 'L');
     /*   $this->Cell((20/100*$width)-5,$height,$_SESSION['lang']['periode'],'',0,'L');
          $this->Cell(5,$height,':','',0,'L');
          $this->Cell(15/100*$width,$height, $periode,0,0,'L');*/
     $this->Ln();
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['tanggal'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, date('d-m-Y H:i:s'), '', 0, 'L');
     $this->Ln();
     $this->SetFont('Arial', 'U', 12);
     $this->Cell($width, $height, $_SESSION['lang']['rekomendasiPupuk'], 0, 1, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(220, 220, 220);
     // $this->Cell(10/100*$width,$height,'No',1,0,'C',1);
     /*foreach($colArr as $key=>$head) {
           $this->Cell($length[$key]/100*$width,$height,$_SESSION['lang'][$head],1,0,'C',1);
       }*/
     $this->Cell(3 / 100 * $width, $height, 'No', 1, 0, 'C', 1);
     $this->Cell(12 / 100 * $width, $height, $_SESSION['lang']['tahunpupuk'], 1, 0, 'C', 1);
     $this->Cell(21 / 100 * $width, $height, $_SESSION['lang']['afdeling'], 1, 0, 'C', 1);
     $this->Cell(12 / 100 * $width, $height, $_SESSION['lang']['blok'], 1, 0, 'C', 1);
     $this->Cell(13 / 100 * $width, $height, $_SESSION['lang']['tahuntanam'], 1, 0, 'C', 1);
     $this->Cell(16 / 100 * $width, $height, $_SESSION['lang']['jenisPupuk'], 1, 0, 'C', 1);
     $this->Cell(7 / 100 * $width, $height, $_SESSION['lang']['dosis'], 1, 0, 'C', 1);
     $this->Cell(7 / 100 * $width, $height, $_SESSION['lang']['satuan'], 1, 0, 'C', 1);
     $this->Cell(10 / 100 * $width, $height, $_SESSION['lang']['jenisbibit'], 1, 1, 'C', 1);
 }
예제 #5
0
 function Header()
 {
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $nopp;
     global $tglSdt;
     global $statPP;
     $kdorg = explode("/", $nopp);
     # Bulan
     // $optBulan =
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 12;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['user'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $_SESSION['standard']['username'], '', 0, 'L');
     $this->Ln();
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['tanggal'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, date('d-m-Y H:i:s'), '', 0, 'L');
     $this->Ln();
     $this->Ln();
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell($width, $height, strtoupper($_SESSION['lang']['riwayatPP']), 0, 1, 'C');
     $this->SetFont('Arial', 'B', 7);
     $this->SetFillColor(220, 220, 220);
     $this->Ln();
     $this->Cell(3 / 100 * $width, $height, 'No.', 1, 0, 'C', 1);
     $this->Cell(8 / 100 * $width, $height, $_SESSION['lang']['nopp'], 1, 0, 'C', 1);
     $this->Cell(18 / 100 * $width, $height, $_SESSION['lang']['namabarang'], 1, 0, 'C', 1);
     $this->Cell(18 / 100 * $width, $height, $_SESSION['lang']['status'], 1, 0, 'C', 1);
     $this->Cell(10 / 100 * $width, $height, $_SESSION['lang']['nopo'], 1, 0, 'C', 1);
     $this->Cell(5 / 100 * $width, $height, $_SESSION['lang']['tanggal'] . " PO", 1, 0, 'C', 1);
     $this->Cell(12 / 100 * $width, $height, $_SESSION['lang']['status'] . " PO", 1, 0, 'C', 1);
     $this->Cell(10 / 100 * $width, $height, $_SESSION['lang']['namasupplier'], 1, 0, 'C', 1);
     $this->Cell(10 / 100 * $width, $height, $_SESSION['lang']['rapbNo'], 1, 0, 'C', 1);
     $this->Cell(5 / 100 * $width, $height, $_SESSION['lang']['tanggal'], 1, 1, 'C', 1);
 }
예제 #6
0
 /**
  * getParam
  * Get Parameter Jurnal based on kodeaplikasi dan kodejurnal
  */
 public function getParam($holding, $kodeApp, $kodeJurnal)
 {
     global $dbname;
     $qParam = selectQuery($dbname, 'keu_5parameterjurnal', 'noakundebet,noakunkredit,sampaidebet,sampaikredit', "kodeorg='" . $holding . "' and kodeaplikasi='" . $kodeApp . "' and jurnalid='" . $kodeJurnal . "' and aktif=1");
     $resParam = fetchData($qParam);
     if (empty($resParam)) {
         return array();
     } else {
         return $resParam[0];
     }
 }
예제 #7
0
 function Header()
 {
     global $conn;
     global $dbname;
     global $bulan;
     global $tahun;
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $sPeriode = "select distinct periode from " . $dbname . ".setup_periodeakuntansi where kodeorg='" . $_SESSION['empl']['lokasitugas'] . "'\r\n            and tutupbuku = 0";
     $qPeriode = mysql_query($sPeriode) or die(mysql_error());
     $rPeriode = mysql_fetch_assoc($qPeriode);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 12;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['kodeorg'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $_SESSION['empl']['lokasitugas'], '', 0, 'L');
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['periode'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(15 / 100 * $width, $height, $rPeriode['periode'], 0, 0, 'L');
     $this->Ln();
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['user'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $_SESSION['standard']['username'], '', 0, 'L');
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['tanggal'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(15 / 100 * $width, $height, date('d-m-Y H:i:s'), '', 1, 'L');
     $this->Ln();
     $this->SetFont('Arial', 'U', 12);
     $this->Cell($width, $height, strtoupper($this->_title), 0, 1, 'C');
     if ($this->_noThead == false) {
         $this->Ln();
         $this->SetFont('Arial', 'B', 9);
         $this->SetFillColor(220, 220, 220);
         foreach ($this->_colArr as $key => $head) {
             $this->Cell($this->_length[$key] / 100 * $width, $height, $_SESSION['lang'][$head], 1, 0, 'C', 1);
         }
         $this->Ln();
     }
 }
예제 #8
0
 function Header()
 {
     global $conn;
     global $dbname;
     global $tmpBar;
     $strx = "select b.namaorganisasi from " . $dbname . ".datakaryawan a \r\n\t\t\t\tleft join " . $dbname . ".organisasi b on a.kodeorganisasi=b.kodeorganisasi\r\n\t\t\t\twhere a.karyawanid=" . $tmpBar->karyawanid;
     $resOrg = fetchData($strx);
     $this->SetFillColor(255, 255, 255);
     $this->SetMargins(15, 10, 0);
     $path = 'images/logo.jpg';
     $this->Image($path, 15, 5, 30);
     $this->SetFont('Arial', '', 6);
     $this->SetX(163);
     $this->Cell(30, 10, 'PRINT TIME : ' . date('d-m-Y H:i:s'), 0, 1, 'L');
     $this->Ln();
 }
 function Header()
 {
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $dataTR;
     $dataTR = explode(",", $_GET['column']);
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 12;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     //                $this->SetFont('Arial','',8);
     //                $this->Cell((20/100*$width)-5,$height,$_SESSION['lang']['user'],'',0,'L');
     //                $this->Cell(5,$height,':','',0,'L');
     //                $this->Cell(45/100*$width,$height,$_SESSION['standard']['username'],'',0,'L');
     //
     //                $this->Ln();
     //                $this->Cell((20/100*$width)-5,$height,$_SESSION['lang']['tanggal'],'',0,'L');
     //                $this->Cell(5,$height,':','',0,'L');
     //                $this->Cell(45/100*$width,$height,date('d-m-Y H:i:s'),'',0,'L');
     $this->Ln();
     $this->SetFont('Arial', 'U', 11);
     $this->Cell($width, $height, $_SESSION['lang']['pengirimanBibit'], 0, 1, 'C');
     $this->Ln(35);
     //                $this->SetFont('Arial','B',9);
     //                $this->SetFillColor(220,220,220);
     // $this->Cell(10/100*$width,$height,'No',1,0,'C',1);
     /*foreach($colArr as $key=>$head) {
           $this->Cell($length[$key]/100*$width,$height,$_SESSION['lang'][$head],1,0,'C',1);
       }*/
 }
예제 #10
0
function main()
{
    $serviceUrl = 'https://service.berlin.de/terminvereinbarung/termin/tag.php?termin=1&anliegen[]=%s&Datum=%s&dienstleisterlist=%s';
    $officeList = [150230, 122301, 122297, 122294, 122210, 122217, 122219, 122227, 122280, 122282, 122284];
    $date = time();
    // Change accordingly....
    $serviceType = '120686';
    // This one is for Almendung
    // Generate the URL with all the offices we need
    $url = sprintf($serviceUrl, $serviceType, $date, implode(',', $officeList));
    // Fetch the data from our URL
    $data = fetchData($url);
    // Parse received data from berlin.de
    $finalLinks = parseData($data);
    // Render links for booking if found
    renderResults($finalLinks);
}
 function Header()
 {
     global $conn;
     global $dbname;
     global $periode;
     $cols = 247.5;
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 20;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 3, $this->lMargin + $width, $this->tMargin + $height * 3);
     $this->SetFont('Arial', 'B', 10);
     $this->Cell($width, $height, "Laporan Biaya per Blok ", '', 0, 'C');
     $this->Ln();
     $this->Cell($width, $height, strtoupper($_SESSION['lang']['periode']) . " : " . substr($periode, 5, 2) . "-" . substr($periode, 0, 4), '', 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->SetFillColor(220, 220, 220);
     $this->SetX(80);
     $this->Cell(7 / 100 * $width, $height, "No.", 1, 0, 'C', 1);
     $this->Cell(15 / 100 * $width, $height, $_SESSION['lang']['kodeblok'], 1, 0, 'C', 1);
     $this->Cell(14 / 100 * $width, $height, $_SESSION['lang']['tahuntanam'], 1, 0, 'C', 1);
     $this->Cell(15 / 100 * $width, $height, $_SESSION['lang']['luas'], 1, 0, 'C', 1);
     $this->Cell(15 / 100 * $width, $height, $_SESSION['lang']['statusblok'], 1, 0, 'C', 1);
     $this->Cell(15 / 100 * $width, $height, $_SESSION['lang']['totalbiaya'], 1, 0, 'C', 1);
 }
<?php

require_once 'master_validation.php';
require_once 'config/connection.php';
require_once 'lib/zLib.php';
$lokasibaru = $_POST['lokasibaru'];
if ($_SESSION['empl']['lokasitugas'] == $lokasibaru) {
    exit("Warning: Lokasi Tugas sama dengan lokasi saat ini");
}
$qPt = "select induk from " . $dbname . ".organisasi where kodeorganisasi='" . $lokasibaru . "'";
$resPt = fetchData($qPt);
$pt = $resPt[0]['induk'];
$data = array('lokasitugas' => array('old' => $_SESSION['empl']['lokasitugas'], 'new' => $lokasibaru), 'kodeorganisasi' => array('old' => $_SESSION['org']['kodeorganisasi'], 'new' => $pt));
$strInsHis = "insert into " . $dbname . ".hist_datakaryawan(updatetime,updateby,karyawanid,data) values ('" . date('Y-m-d H:i:s') . "','" . $_SESSION['standard']['userid'] . "','" . $_SESSION['standard']['userid'] . "','" . json_encode($data) . "')";
// echo $strInsHis;exit('error');
mysql_query($strInsHis);
$str = "update " . $dbname . ".datakaryawan set kodeorganisasi='" . $pt . "',\r\n\t      lokasitugas='" . $lokasibaru . "', updateby=" . $_SESSION['standard']['userid'] . "\r\n\t       where karyawanid=" . $_SESSION['standard']['userid'];
if (mysql_query($str)) {
    echo "Updated";
} else {
    echo " Gagal," . addslashes(mysql_error($conn));
}
예제 #13
0
    include $cacheFile;
    exit;
}
error_log("No cache file found; generating page...");
ob_start();
function fetchData()
{
    global $greyVid, $bradyVids, $lastUpdate;
    $greyVid = sqlQuery("SELECT * FROM Video WHERE creator='C.G.P. Grey' ORDER BY uploaddate DESC LIMIT 1")[0];
    $bradyVids = sqlQuery("SELECT * FROM Video WHERE creator='Brady Haran' AND uploaddate > \$1 ORDER BY uploaddate DESC", array($greyVid["uploaddate"]));
    $lastUpdate = sqlQuery("SELECT * FROM UpdateLog ORDER BY updatedatetime DESC LIMIT 1")[0]['updatedatetime'];
}
fetchData();
if (!$greyVid || !$lastUpdate) {
    update_with_api();
    fetchData();
    // Use the newly-found data
}
function echoVidRow($vid)
{
    $creator = $vid['creator'];
    $channel = $vid['channel'];
    $uploaded = $vid['uploaddate'];
    $uploaded = strftime('%B %d, %Y @ %I:%M %p', strtotime($uploaded));
    $views = $vid['viewcount'];
    $title = $vid['title'];
    $url = "http://youtube.com/watch?v=" . $vid['youtubeid'];
    if ($views == 301) {
        $views = '<a href="http://youtube.com/watch?v=oIkhgagvrjI">301</a>';
        // EASTER EGG!
    } elseif ($views == -1) {
예제 #14
0
 function Header()
 {
     global $kodeorg;
     global $thnbudget;
     global $lebar1;
     global $lebar2;
     global $lebar3;
     global $lebar4;
     global $lebar5;
     global $lebar6;
     global $dbname;
     global $kgolah;
     global $jenis;
     global $kgoil;
     global $kgkernel;
     global $kgcpo;
     # Bulan
     // $optBulan =
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 12;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(10 / 100 * $width - 5, $height, $_SESSION['lang']['produksi'] . " PP", '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(8 / 100 * $width, $height, number_format($kgoil / 1000 . 'Ton', 0, ".", ","), '', 0, 'R');
     $this->Cell(52 / 100 * $width, $height, '', '', 0, 'L');
     $this->Cell(10 / 100 * $width - 5, $height, 'Printed By', '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(15 / 100 * $width, $height, $_SESSION['empl']['name'], '', 1, 'L');
     $this->Cell(10 / 100 * $width - 5, $height, $_SESSION['lang']['produksi'] . " CPO", '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(8 / 100 * $width, $height, number_format($kgcpo / 1000 . 'Ton', 0, ".", ","), '', 0, 'R');
     $this->Cell(52 / 100 * $width, '', '', 0, 'L');
     $this->Cell(10 / 100 * $width - 5, $height, $_SESSION['lang']['tanggal'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(15 / 100 * $width, $height, date('d-m-Y H:i:s'), '', 1, 'L');
     $this->Cell(10 / 100 * $width - 5, $height, $_SESSION['lang']['produksi'] . " KER", '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(8 / 100 * $width, $height, number_format($kgkernel / 1000 . 'Ton', 0, ".", ","), '', 1, 'R');
     $this->Cell(10 / 100 * $width - 5, $height, 'TBS', '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(8 / 100 * $width, $height, number_format($kgolah / 1000 . 'Ton', 0, ".", ","), '', 0, 'R');
     $title = "BUDGET BIAYA " . $jenis . " PKS " . $kodeorg . "  " . $thnbudget;
     $this->Ln();
     $this->SetFont('Arial', 'U', 10);
     $this->Cell($width, $height, $title, 0, 1, 'C');
     $this->Ln();
     $this->SetFont('Arial', '', 9);
     $this->SetFillColor(220, 220, 220);
     $this->Cell($lebar1 / 100 * $width, $height, $_SESSION['lang']['nourut'], 1, 0, 'C', 1);
     $this->Cell($lebar2 / 100 * $width, $height, $_SESSION['lang']['noakun'], 1, 0, 'C', 1);
     $this->Cell($lebar3 / 100 * $width, $height, $_SESSION['lang']['namaakun'], 1, 0, 'C', 1);
     $this->Cell($lebar4 / 100 * $width, $height, $_SESSION['lang']['jumlahrp'], 1, 0, 'C', 1);
     $this->Cell($lebar5 / 100 * $width, $height, $_SESSION['lang']['rpperkg'], 1, 0, 'C', 1);
     for ($i = 1; $i <= 12; $i++) {
         if (strlen($i) == 1) {
             $ii = "0" . $i;
         } else {
             $ii = $i;
         }
         if ($i != 12) {
             $this->Cell($lebar6 / 100 * $width, $height, $ii . '(Rp)', 1, 0, 'C', 1);
         } else {
             $this->Cell($lebar6 / 100 * $width, $height, $ii . '(Rp)', 1, 1, 'C', 1);
         }
     }
 }
예제 #15
0
         $resData[$resAbsn['karyawanid']][] = $resAbsn['karyawanid'];
     }
 }
 $sKehadiran = "select absensi,tanggal,karyawanid,notransaksi,umr from " . $dbname . ".kebun_kehadiran_vw \n            where tanggal between  '" . $tgl1 . "' and '" . $tgl2 . "' and kodeorg like '%" . $unit . "%'";
 //exit("Error".$sKehadiran);
 $rkehadiran = fetchData($sKehadiran);
 foreach ($rkehadiran as $khdrnBrs => $resKhdrn) {
     if ($resKhdrn['absensi'] != '') {
         $umrList[$resKhdrn['karyawanid']][$resKhdrn['tanggal']][] = array('umr' => $resKhdrn['umr']);
         $hasilAbsn[$resKhdrn['karyawanid']][$resKhdrn['tanggal']][] = array('absensi' => $resKhdrn['absensi']);
         $resData[$resKhdrn['karyawanid']][] = $resKhdrn['karyawanid'];
     }
 }
 $sPrestasi = "select a.upahkerja,b.tanggal,a.jumlahhk,a.nik,a.notransaksi from " . $dbname . ".kebun_prestasi a left join " . $dbname . ".kebun_aktifitas b on a.notransaksi=b.notransaksi \n            where b.notransaksi like '%PNN%' and b.kodeorg like '%" . $unit . "%' and b.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "'";
 //exit("Error".$sPrestasi);
 $rPrestasi = fetchData($sPrestasi);
 foreach ($rPrestasi as $presBrs => $resPres) {
     //$umrList[$resKhdrn['karyawanid']][$resKhdrn['tanggal']][]=array('umr'=>$resKhdrn['upahkerja']);
     $umrList[$resPres['nik']][$resPres['tanggal']][] = array('umr' => $resPres['upahkerja']);
     $hasilAbsn[$resPres['nik']][$resPres['tanggal']][] = array('absensi' => 'H');
     $notran[$resPres['nik']][$resPres['tanggal']] .= 'BKM:' . $resPres['notransaksi'] . '__';
     $resData[$resPres['nik']][] = $resPres['nik'];
 }
 //print_r($umrList);
 // ambil pengawas
 $dzstr = "SELECT tanggal,nikmandor,a.notransaksi FROM " . $dbname . ".kebun_aktifitas a\n    left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\n    left join " . $dbname . ".datakaryawan c on a.nikmandor=c.karyawanid\n    where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '%" . $unit . "%' and c.namakaryawan is not NULL\n    union select tanggal,nikmandor1,a.notransaksi FROM " . $dbname . ".kebun_aktifitas a \n    left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\n    left join " . $dbname . ".datakaryawan c on a.nikmandor1=c.karyawanid\n    where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '%" . $unit . "%' and c.namakaryawan is not NULL";
 //exit("Error".$dzstr." ".mysql_error($conn));
 $dzres = mysql_query($dzstr);
 while ($dzbar = mysql_fetch_object($dzres)) {
     $umrList[$dzbar->nikmandor][$dzbar->tanggal][] = array('umr' => 'ind');
     $hasilAbsn[$dzbar->nikmandor][$dzbar->tanggal][] = array('absensi' => 'H');
예제 #16
0
				<?php 
    }
}
?>
				</ul>

			</div>
			<div class="clear"></div>
			<hr />
			<br />
			</div>
		</div>
		<div class="class_right">
		<?php 
$instaUrl = "https://api.instagram.com/v1/users/1181790550/media/recent/?access_token=1181790550.5b9e1e6.241cfbd9499840d0ae20eebf2b8ece4c&count=6";
$insta_res = fetchData($instaUrl);
// print_r($insta_res);
$insta_res = json_decode($insta_res);
?>
			<div class="side-youtube">
		 		<h2>Instagram:</h2>
		<?php 
foreach ($insta_res->data as $post) {
    if (!empty($post->caption->text)) {
        echo '<div class="img"><a class="instagram-unit" target="_blank" href="' . $post->link . '">
        <img src="' . $post->images->low_resolution->url . '" alt="' . $post->caption->text . '" width="100%" height="auto" /></a></div>';
        ?>
       			
       	<?php 
    }
}
예제 #17
0
$bpjsSehat = $dSehat['bebankaryawan'];
#masukin BPJS Tenaga Kerja ke sini
foreach ($umrbulanan as $key => $nilai) {
    if ($bpjstenaga[$key] != '') {
        $readyData[] = array('kodeorg' => $param['kodeorg'], 'periodegaji' => $param['periodegaji'], 'karyawanid' => $key, 'idkomponen' => 3, 'jumlah' => $bpjsKerja / 100 * $nilai, 'pengali' => 1);
    }
}
#masukin BPJS kesehatan ke sini
foreach ($umrbulanan as $key => $nilai) {
    if ($bpjskes[$key] != '') {
        $readyData[] = array('kodeorg' => $param['kodeorg'], 'periodegaji' => $param['periodegaji'], 'karyawanid' => $key, 'idkomponen' => 44, 'jumlah' => $bpjsSehat / 100 * $nilai, 'pengali' => 1);
    }
}
//calculate to component
$strx = "select id as komponen, case plus when 0 then -1 else plus end as pengali,name as nakomp \r\n              FROM " . $dbname . ".sdm_ho_component";
$comRes = fetchData($strx);
$comp = array();
$nakomp = array();
foreach ($comRes as $idx => $row) {
    $comp[$row['komponen']] = $row['pengali'];
    $nakomp[$row['komponen']] = $row['nakomp'];
}
//=tampilan  ============================
$listbutton = "<button class=mybuttton name=postBtn id=postBtn onclick=post()>Proses</button>";
$list0 = "<table class=sortable border=0 cellspacing=1>\r\n                     <thead>\r\n                     <tr class=rowheader>";
$list0 .= "<td>" . $_SESSION['lang']['nomor'] . "</td>";
$list0 .= "<td>" . $_SESSION['lang']['periodegaji'] . "</td>";
$list0 .= "<td>" . $_SESSION['lang']['karyawanid'] . "</td>";
$list0 .= "<td>" . $_SESSION['lang']['tipe'] . "</td>";
$list0 .= "<td>" . $_SESSION['lang']['jumlah'] . "</td></tr></thead><tbody>";
//periksa gaji minus
예제 #18
0
//@Copy nangkoelframework
require_once 'master_validation.php';
include 'lib/nangkoelib.php';
include_once 'lib/zLib.php';
echo open_body();
include 'master_mainMenu.php';
OPEN_BOX('', '<b>' . strtoupper($_SESSION['lang']['daftaroperator']) . '</b>');
//1 O
?>

<script type="text/javascript" src="js/vhc_daftaroperator.js" /></script>
<div id="action_list">
<?php 
$optOrg = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi');
$sOrg = "select distinct kodetraksi from " . $dbname . ".vhc_5master order by kodetraksi asc";
$qOrg = fetchData($sOrg);
$optPt = "";
foreach ($qOrg as $brsOrg) {
    $optPt .= "<option value=" . $brsOrg['kodetraksi'] . ">" . $optOrg[$brsOrg['kodetraksi']] . "</option>";
}
$optJns = "<option value=>" . $_SESSION['lang']['all'] . "</option>";
$sJvhc = "select distinct jenisvhc,namajenisvhc from " . $dbname . ".vhc_5jenisvhc order by namajenisvhc asc";
$qJvhc = mysql_query($sJvhc) or die(mysql_error($sJvhc));
while ($rJvhc = mysql_fetch_assoc($qJvhc)) {
    $optJns .= "<option value=" . $rJvhc['jenisvhc'] . ">" . $rJvhc['namajenisvhc'] . "</option>";
}
$optper = "<option value=''>" . $_SESSION['lang']['all'] . "</option>";
$sTgl = "select distinct substr(tanggal,1,7) as periode from " . $dbname . ".vhc_penggantianht order by tanggal desc";
$qTgl = mysql_query($sTgl) or die(mysql_error());
while ($rTgl = mysql_fetch_assoc($qTgl)) {
    $optper .= "<option value='" . $rTgl['periode'] . "'>" . substr($rTgl['periode'], 5, 2) . "-" . substr($rTgl['periode'], 0, 4) . "</option>";
$pdf->Ln();
$ko = 0;
$pdf->Cell(20, 1.5 * $height, 'No.', 'TBLR', 0, 'C');
$pdf->Cell(120, 1.5 * $height, $_SESSION['lang']['nama'] . ' / ' . $_SESSION['lang']['kodejabatan'], 'TBLR', 0, 'C');
$pdf->Cell(70, 1.5 * $height, $_SESSION['lang']['lokasitugas'], 'TBLR', 0, 'C');
$pdf->Cell(100, 1.5 * $height, $_SESSION['lang']['keputusan'], 'TBLR', 0, 'C');
$pdf->Cell(240, 1.5 * $height, $_SESSION['lang']['note'], 'TBLR', 0, 'C');
$pdf->Ln();
$sCek = "select nopp from " . $dbname . ".log_prapodt where nopp='" . $column . "'";
//echo $sCek;exit();
$qCek = mysql_query($sCek) or die(mysql_error());
$rCek = mysql_num_rows($qCek);
if ($rCek > 0) {
    $qp = "select * from " . $dbname . ".`log_prapoht` where `nopp`='" . $column . "'";
    //echo $qp;
    $qyr = fetchData($qp);
    foreach ($qyr as $hsl) {
        for ($i = 1; $i < 6; $i++) {
            if ($hsl['hasilpersetujuan' . $i] == 1) {
                $b['status'] = $_SESSION['lang']['disetujui'];
            } elseif ($hsl['hasilpersetujuan' . $i] == 3) {
                $b['status'] = $_SESSION['lang']['ditolak'];
            } elseif ($hsl['hasilpersetujuan' . $i] == '' || $hsl['hasilpersetujuan' . $i] == 0) {
                $b['status'] = $_SESSION['lang']['wait_approve'];
            }
            if ($hsl['persetujuan' . $i] != 00) {
                $sql = "select * from " . $dbname . ".`datakaryawan` where `karyawanid`='" . $hsl['persetujuan' . $i] . "'";
                //echo $sql;//exit();
                $keterangan = $hsl['komentar' . $i];
                $tanggal = tanggalnormal($hsl['tglp' . $i]);
                $query = mysql_query($sql) or die(mysql_error());
예제 #20
0
    $hasilAbsn[$dzbar->nikmandor][$dzbar->tanggal][] = array('absensi' => 'H');
    // $notran[$dzbar->nikmandor][$dzbar->tanggal].='BKM:'.$dzbar->notransaksi.'__';
    $resData[$dzbar->nikmandor][] = $dzbar->nikmandor;
}
// ambil administrasi
$dzstr = "SELECT tanggal,nikmandor,a.notransaksi FROM " . $dbname . ".kebun_aktifitas a\r\n            left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n            left join " . $dbname . ".datakaryawan c on a.nikmandor=c.karyawanid\r\n            where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '%" . $unit . "%' and c.namakaryawan is not NULL\r\n            union select tanggal,nikasisten,a.notransaksi FROM " . $dbname . ".kebun_aktifitas a \r\n            left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n            left join " . $dbname . ".datakaryawan c on a.keranimuat=c.karyawanid\r\n            where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '%" . $unit . "%' and c.namakaryawan is not NULL";
//exit("Error".$dzstr);
$dzres = mysql_query($dzstr);
while ($dzbar = mysql_fetch_object($dzres)) {
    $umrList[$dzbar->nikmandor][$dzbar->tanggal][] = array('umr' => 'ind');
    $hasilAbsn[$dzbar->nikmandor][$dzbar->tanggal][] = array('absensi' => 'H');
    // $notran[$dzbar->nikmandor][$dzbar->tanggal].='BKM:'.$dzbar->notransaksi.'__';
    $resData[$dzbar->nikmandor][] = $dzbar->nikmandor;
}
$sAbsn = "select a.karyawanid,tanggal,a.absensi,kodeorg,catu,insentif\r\n                  from " . $dbname . ".sdm_absensidt a left join \r\n                 " . $dbname . ".datakaryawan b on a.karyawanid=b.karyawanid\r\n                  where  (b.tanggalkeluar>='" . $tgl1 . "' or b.tanggalkeluar='0000-00-00') and b.alokasi=0\r\n                  and a.tanggal>='" . $tgl1 . "' and a.tanggal<='" . $tgl2 . "' and \r\n                  b.lokasitugas='" . $unit . "' and a.fingerprint='1' order by tanggal";
$rAbsn = fetchData($sAbsn);
foreach ($rAbsn as $absnBrs => $resAbsn) {
    #jika yang sks dkk dibayar
    //$umrList[$resAbsn['karyawanid']][$resAbsn['tanggal']][]=array('umr'=>'ind');//kalo jam tidak berpengaruh
    $umrList[$resAbsn['karyawanid']][$resAbsn['tanggal']][] = array('umr' => $resAbsn['insentif']);
    $hasilAbsnFp[$resAbsn['karyawanid']][$resAbsn['tanggal']][] = array('absensi' => $resAbsn['absensi']);
    //$notran[$resAbsn['karyawanid']][$resAbsn['tanggal']].='ABSENSI:'.$resAbsn['kodeorg'].'__';
    $resData[$resAbsn['karyawanid']][] = $resAbsn['karyawanid'];
}
function kirimnama($nama)
{
    $qwe = explode(' ', $nama);
    foreach ($qwe as $kyu) {
        $balikin .= $kyu . '__';
    }
    return $balikin;
예제 #21
0
<?php

require_once 'master_validation.php';
require_once 'config/connection.php';
require_once 'lib/nangkoelib.php';
include_once 'lib/zMysql.php';
$pt = $_GET['pt'];
$periode = $_GET['periode'];
/*	print"<pre>";
	print_r($_GET);
	print"<pre>";*/
//======================================
//ambil namapt
$query2 = selectQuery($dbname, 'organisasi', 'namaorganisasi', "kodeorganisasi='" . $pt . "'");
$orgData2 = fetchData($query2);
//echo"warning:masuk vvv";
if (strlen($pt) < 6) {
    $kdOrg = "substr(b.blok,1,4)";
} else {
    $kdOrg = "substr(b.blok,1,6)";
}
$strx = "select a.tanggal,b.* from " . $dbname . ".kebun_spbht a inner join " . $dbname . ".kebun_spbdt b on a.nospb=b.nospb \r\n\t\twhere a.tanggal like '%" . $periode . "%' and " . $kdOrg . "='" . $pt . "' order by a.tanggal asc ";
//		echo"warning:".$strx;exit();
$stream = "\r\n\t\t\t<table>\r\n\t\t\t<tr><td colspan=11 align=center>" . $_SESSION['lang']['listSpb'] . "</td></tr>\r\n\t\t\t<tr><td colspan=3>" . $_SESSION['lang']['periode'] . ":" . $periode . "</td></tr>\r\n\t\t\t<tr><td colspan=3>" . $_SESSION['lang']['unit'] . ":" . $orgData2[0]['namaorganisasi'] . "</td></tr>\r\n\t\t\t<tr><td colspan=3>&nbsp;</td></tr>\r\n\t\t\t</table>\r\n\t\t\t<table border=1>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>No.</td>\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['nospb'] . "</td>\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['tanggal'] . "</td>\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['blok'] . "</td>\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['janjang'] . "</td>\r\n                                                        <td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['kgwb'] . "</td>\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['bjr'] . "</td>\t\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['brondolan'] . "</td>\t\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['mentah'] . "</td>\t\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['busuk'] . "</td>\t\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['matang'] . "</td>\t\r\n\t\t\t\t\t\t\t<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['lewatmatang'] . "</td>\t\r\n\t\t\t\t\t\t</tr>";
$resx = mysql_query($strx);
$row = mysql_fetch_row($resx);
if ($row < 1) {
    $stream .= "\t<tr class=rowcontent>\r\n\t\t\t<td colspan=11 align=center>Not Found</td></tr>\r\n\t\t\t";
} else {
    $no = 0;
    $resx = mysql_query($strx);
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;
            }
        }
    }
}
 }
 $poolAsset = array();
 foreach ($arrAsset as $row) {
     $poolAsset[$row['kode']] = $row['nilai'];
 }
 // Get List Akun dari Parameter Jurnal = 'DEP'
 $optDep = makeOption($dbname, 'keu_5parameterjurnal', "jurnalid,noakunkredit", "kodeaplikasi='DEP'");
 // Get Jurnal
 foreach ($poolAsset as $kode => $nilai) {
     // No Jurnal
     $konter = '001';
     $tanggal = $param['periode'] . "-28";
     # Transform No Jurnal dari No Transaksi
     $nojurnal = str_replace("-", "", $tanggal) . "/" . substr($param['kodeorg'], 0, 4) . "/" . $kode . "/" . $konter;
     $qJurnal = selectQuery($dbname, 'keu_jurnaldt', "jumlah", "nojurnal='" . $nojurnal . "' and noakun='" . $optDep[$kode] . "'");
     $resJurnal = fetchData($qJurnal);
     if (empty($resJurnal)) {
         exit("Warning: Depresiasi " . $kode . " belum terjurnal dengan benar");
     } else {
         if ($resJurnal[0]['jumlah'] + round($nilai, 2) > 0.01) {
             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)) {
예제 #24
0
dataKdvhc="<?php 
echo $_SESSION['lang']['pilihdata'];
?>
";
</script>
<?php 
// Options
$optUnit = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi', "LENGTH(kodeorganisasi)=4", 2);
$optDiv = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi', "induk='" . key($optUnit) . "'", 2);
$optBlok = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi', "induk='" . key($optDiv) . "'", 2);
$optKode = makeOption($dbname, 'bgt_kode', 'kodebudget,nama', "kodebudget not in ('KONTRAK','TOOL')", 2, true);
$optKode[''] = $_SESSION['lang']['pilihdata'];
$optMethod = array('insert' => 'Insert', 'update' => 'Update');
// Onchange Organisasi
$qOrg = selectQuery($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi,induk', "LENGTH(kodeorganisasi) > 5");
$resOrg = fetchData($qOrg);
$optOrg = array();
foreach ($resOrg as $row) {
    if (strlen($row['kodeorganisasi']) == 6) {
        if (!isset($optOrg[substr($row['kodeorganisasi'], 0, 4)][$row['kodeorganisasi']])) {
            $optOrg[substr($row['kodeorganisasi'], 0, 4)][$row['kodeorganisasi']] = array('nama' => $row['kodeorganisasi'] . " - " . $row['namaorganisasi'], 'child' => array());
        } else {
            $optOrg[substr($row['kodeorganisasi'], 0, 4)][$row['kodeorganisasi']]['nama'] = $row['kodeorganisasi'] . " - " . $row['namaorganisasi'];
        }
    } else {
        if (!isset($optOrg[substr($row['kodeorganisasi'], 0, 4)][substr($row['kodeorganisasi'], 0, 6)])) {
            $optOrg[substr($row['kodeorganisasi'], 0, 4)][substr($row['kodeorganisasi'], 0, 6)] = array('nama' => '', 'child' => array($row['kodeorganisasi'] => $row['kodeorganisasi'] . " - " . $row['namaorganisasi']));
        } else {
            $optOrg[substr($row['kodeorganisasi'], 0, 4)][substr($row['kodeorganisasi'], 0, 6)]['child'][$row['kodeorganisasi']] = $row['kodeorganisasi'] . " - " . $row['namaorganisasi'];
        }
    }
예제 #25
0
$periode_tahun = $param['periode_tahun'];
# Tanggal Margin
$currTahun = $tahun = $param['periode_tahun'];
$currBulan = $bulan = $param['periode_bulan'];
$currPeriod = $currTahun . '-' . addZero($currBulan, 2);
switch ($level) {
    case '0':
        # Data
        $cols = "a.tanggal,sum(jamstagnasi),sum(jamdinasbruto),sum(jumlahlori) as jumlahlori,sum(a.tbsdiolah) as tbsdiolah,sum(oer),sum(oerpk),nopengolahan";
        $cols2 = "nomor,tanggal,jamstagnasi,jamoperasional,jumlahlori,tbsdiolah,oer,oerpk,detail";
        $cols2e = "nomor,tanggal,jamstagnasi,jamoperasional,jumlahlori,tbsdiolah,oer,oerpk";
        $where = "a.kodeorg='" . $param['kodeorg'] . "' and left(a.tanggal,7)='" . $currPeriod . "'";
        // $query = selectQuery($dbname,'pabrik_pengolahan',$cols,$where)." group by tanggal";
        $query = "select distinct " . $cols . " from " . $dbname . ".pabrik_pengolahan a left join " . $dbname . ".pabrik_produksi b \r\n                 on (a.kodeorg=b.kodeorg and a.tanggal=b.tanggal) where " . $where . " group by a.tanggal";
        //exit("Error".$query);
        $tmpRes = fetchData($query);
        if (empty($tmpRes)) {
            echo 'Warning : Data empty';
            exit;
        }
        # Set Data
        $data = $tmpRes;
        $dataShow = $dataExcel = $data;
        foreach ($data as $key => $row) {
            //$dataShow[$key]['kodebarang'] = $optBrg[$row['kodebarang']];
            $dataShow[$key]['jumlahlori'] = number_format($row['jumlahlori'], 0);
            $dataShow[$key]['tbsdiolah'] = number_format($row['tbsdiolah'], 0);
        }
        # Report Gen
        $theCols = array();
        if ($mode != 'excel') {
 function Header()
 {
     //declarasi header variabel
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $nmOrg;
     global $kdOrg;
     global $kdAst;
     global $nmAst;
     global $thnPer;
     global $nmAsst;
     global $namakar;
     global $selisih;
     global $where;
     //alamat PT minanga dan logo
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 20;
     if ($_SESSION['org']['kodeorganisasi'] == 'HIP') {
         $path = 'images/hip_logo.jpg';
     } else {
         if ($_SESSION['org']['kodeorganisasi'] == 'SIL') {
             $path = 'images/sil_logo.jpg';
         } else {
             if ($_SESSION['org']['kodeorganisasi'] == 'SIP') {
                 $path = 'images/sip_logo.jpg';
             }
         }
     }
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     //tutup logo dan alamat
     //untuk sub judul
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(20 / 100 * $width - 5, $height, "Asset List", '', 0, 'L');
     $this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(100 / 100 * $width - 5, $height, "Printed By : " . $namakar[$_SESSION['standard']['userid']], '', 0, 'R');
     $this->Ln();
     $this->Cell(100 / 100 * $width - 5, $height, "Date : " . date('d-m-Y'), '', 0, 'R');
     $this->Ln();
     $this->Cell(100 / 100 * $width - 5, $height, "Time : " . date('h:i:s'), '', 0, 'R');
     $this->Ln();
     $this->Ln();
     //tutup sub judul
     //judul tengah
     $this->SetFont('Arial', 'B', 12);
     $this->Cell($width, $height, strtoupper("Asset List " . "{$nmAst}") . " " . $_SESSION['lang']['periode'] . ":" . $kdAst, '', 0, 'C');
     $this->Ln();
     $this->Cell($width, $height, strtoupper("{$nmOrg}"), '', 0, 'C');
     $this->Ln();
     $this->Ln();
     //tutup judul tengah
     //isi atas tabel
     $this->SetFont('Arial', 'B', 6);
     $this->SetFillColor(220, 220, 220);
     $this->Cell(2 / 100 * $width, $height, "No", 1, 0, 'C', 1);
     $this->Cell(7 / 100 * $width, $height, $_SESSION['lang']['kodeorganisasi'], 1, 0, 'C', 1);
     $this->Cell(7 / 100 * $width, $height, $_SESSION['lang']['kodeasset'], 1, 0, 'C', 1);
     $this->Cell(7 / 100 * $width, $height, $_SESSION['lang']['thnperolehan'], 1, 0, 'C', 1);
     $this->Cell(15 / 100 * $width, $height, $_SESSION['lang']['namaasset'], 1, 0, 'C', 1);
     //$this->Cell(5/100*$width,$height,$_SESSION['lang']['status'],1,0,'C',1);
     $this->Cell(9 / 100 * $width, $height, $_SESSION['lang']['hargaperolehan'], 1, 0, 'C', 1);
     $this->Cell(9 / 100 * $width, $height, $_SESSION['lang']['jumlahbulanpenyusutan'], 1, 0, 'C', 1);
     $this->Cell(6 / 100 * $width, $height, $_SESSION['lang']['usia'] . " (" . $_SESSION['lang']['bulan'] . ")", 1, 0, 'C', 1);
     $this->Cell(6 / 100 * $width, $height, $_SESSION['lang']['sisa'] . " (" . $_SESSION['lang']['bulan'] . ")", 1, 0, 'C', 1);
     $this->Cell(9 / 100 * $width, $height, $_SESSION['lang']['akumulasipenyusutan'], 1, 0, 'C', 1);
     $this->Cell(9 / 100 * $width, $height, $_SESSION['lang']['nilaibuku'], 1, 0, 'C', 1);
     $this->Cell(9 / 100 * $width, $height, $_SESSION['lang']['awalpenyusutan'], 1, 0, 'C', 1);
     $this->Cell(6 / 100 * $width, $height, $_SESSION['lang']['bulanan'], 1, 1, 'C', 1);
     //tutup isi tabel
 }
예제 #27
0
 function Header()
 {
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $jmlHari;
     global $test;
     global $klmpkAbsn;
     global $tglDari;
     global $tglSmp;
     $cols = 247.5;
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 15;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', 'B', 10);
     $this->Cell($width, $height, strtoupper("Payroll Remise I"), '', 0, 'C');
     $this->Ln();
     $this->Cell($width, $height, strtoupper($_SESSION['lang']['tanggal']) . " :" . tanggalnormal($tglDari) . " " . $_SESSION['lang']['sampai'] . " " . tanggalnormal($tglSmp), '', 0, 'C');
     $this->Ln();
     $this->Ln();
     $this->SetFont('Arial', 'B', 6);
     $this->SetFillColor(220, 220, 220);
     $this->Cell(3 / 100 * $width, $height, 'No', 1, 0, 'C', 1);
     $this->Cell(13 / 100 * $width, $height, $_SESSION['lang']['namakaryawan'], 1, 0, 'C', 1);
     $this->Cell(7 / 100 * $width, $height, $_SESSION['lang']['tipekaryawan'], 1, 0, 'C', 1);
     $this->Cell(10 / 100 * $width, $height, $_SESSION['lang']['gaji'], 1, 0, 'C', 1);
     foreach ($test as $ar => $isi) {
         $this->Cell(1.5 / 100 * $width, $height, substr($isi, 8, 2), 1, 0, 'C', 1);
         $akhirX = $this->GetX();
     }
     $this->SetY($this->GetY());
     $this->SetX($akhirX);
     $sAbsen = "select kodeabsen from " . $dbname . ".sdm_5absensi order by kodeabsen";
     $qAbsen = mysql_query($sAbsen) or die(mysql_error());
     while ($rAbsen = mysql_fetch_assoc($qAbsen)) {
         $this->Cell(2 / 100 * $width, $height, $rAbsen['kodeabsen'], 1, 0, 'C', 1);
     }
     $this->Cell(5 / 100 * $width, $height, $_SESSION['lang']['total'], 1, 1, 'C', 1);
 }
예제 #28
0
 $whereKary = "";
 $i = 0;
 foreach ($optOrg as $key => $row) {
     if ($i == 0) {
         $whereKary .= "lokasitugas='" . $key . "'";
     } else {
         $whereKary .= " or lokasitugas='" . $key . "'";
     }
     $i++;
 }
 $optKary = makeOption($dbname, 'datakaryawan', 'karyawanid,namakaryawan', $whereKary, '0');
 # Get Data
 $where = "kodeorg='" . $param['kodeorg'] . "' and shift=" . $param['shift'];
 $cols = "nik";
 $query = selectQuery($dbname, 'pabrik_5shiftanggota', $cols, $where);
 $data = fetchData($query);
 $dataShow = $data;
 foreach ($dataShow as $key => $row) {
     $dataShow[$key]['nik'] = $optKary[$row['nik']];
 }
 # Form
 $theForm2 = new uForm('kasbankForm', $_SESSION['lang']['form'] . " " . $_SESSION['lang']['anggotashif']);
 $theForm2->addEls('nik', $_SESSION['lang']['nik'], '', 'select', 'L', 20, $optKary);
 # Table
 $theTable2 = new uTable('kasbankTable', $_SESSION['lang']['tabel'] . " " . $_SESSION['lang']['anggotashif'], $cols, $data, $dataShow);
 # FormTable
 $formTab2 = new uFormTable('ftPrestasi', $theForm2, $theTable2, null, array('kodeorg##shift'));
 $formTab2->_target = "pabrik_slave_5shift";
 #== Display View
 # Draw Tab
 echo "<fieldset><legend><b>Detail</b></legend>";
예제 #29
0
 function Header()
 {
     global $conn;
     global $dbname;
     global $align;
     global $length;
     global $colArr;
     global $title;
     global $kdUnit;
     global $kdBatch;
     global $rData;
     global $optNm;
     # Alamat & No Telp
     $query = selectQuery($dbname, 'organisasi', 'alamat,telepon', "kodeorganisasi='" . $_SESSION['org']['kodeorganisasi'] . "'");
     $orgData = fetchData($query);
     $width = $this->w - $this->lMargin - $this->rMargin;
     $height = 15;
     $path = 'images/logo.jpg';
     $this->Image($path, $this->lMargin, $this->tMargin, 0, 55);
     $this->SetFont('Arial', 'B', 9);
     $this->SetFillColor(255, 255, 255);
     $this->SetX(100);
     $this->Cell($width - 100, $height, $_SESSION['org']['namaorganisasi'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, $orgData[0]['alamat'], 0, 1, 'L');
     $this->SetX(100);
     $this->Cell($width - 100, $height, "Tel: " . $orgData[0]['telepon'], 0, 1, 'L');
     $this->Line($this->lMargin, $this->tMargin + $height * 4, $this->lMargin + $width, $this->tMargin + $height * 4);
     $this->Ln();
     $this->SetFont('Arial', 'B', 12);
     //	$this->Cell((20/100*$width)-5,$height,$_SESSION['lang']['laporanKendAb'],'',0,'L');
     //	$this->Ln();
     $this->SetFont('Arial', '', 8);
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['unit'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $optNm[$kdUnit], '', 0, 'L');
     $this->Ln();
     if ($kdBatch == '') {
         $kdBatchdt = $_SESSION['lang']['all'];
     } else {
         $kdBatchdt = $kdBatch;
     }
     $this->Cell(20 / 100 * $width - 5, $height, $_SESSION['lang']['batch'], '', 0, 'L');
     $this->Cell(5, $height, ':', '', 0, 'L');
     $this->Cell(45 / 100 * $width, $height, $kdBatchdt, '', 0, 'L');
     $this->Ln();
     $this->SetFont('Arial', 'U', 12);
     $this->Cell($width, $height, $_SESSION['lang']['laporanStockBIbit'], 0, 1, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 7);
     $this->SetFillColor(220, 220, 220);
     $this->Cell(3 / 100 * $width, $height, 'No', 1, 0, 'C', 1);
     $this->Cell(8 / 100 * $width, $height, $_SESSION['lang']['batch'], 1, 0, 'C', 1);
     $this->Cell(17 / 100 * $width, $height, $_SESSION['lang']['kodeorg'], 1, 0, 'C', 1);
     $this->Cell(8 / 100 * $width, $height, $_SESSION['lang']['saldo'], 1, 0, 'C', 1);
     $this->Cell(11 / 100 * $width, $height, $_SESSION['lang']['jenisbibit'], 1, 0, 'C', 1);
     $this->Cell(8 / 100 * $width, $height, $_SESSION['lang']['tgltanam'] . " " . substr($_SESSION['lang']['afkirbibit'], 5), 1, 0, 'C', 1);
     $this->Cell(8 / 100 * $width, $height, $_SESSION['lang']['umur'], 1, 1, 'C', 1);
 }
function fetchData($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    /*comment these lines out for production*/
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    /*comment these lines out for production*/
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
    $my_result = curl_exec($ch);
    curl_close($ch);
    return $my_result;
}
$result = fetchData("https://api.instagram.com/v1/users/575483058/media/recent/?access_token=22846584.1677ed0.28707fa6ef684d7d8e4b64cfb1513786&count=12");
$result = json_decode($result);
foreach ($result->data as $post) {
    if (empty($post->caption->text)) {
        // Do Nothing
    } else {
        $text = substr($post->caption->text, 0, 100);
        echo '<div class="slide">';
        echo '<a class="instagram-unit" target="blank" href="' . $post->link . '">';
        echo '<div class="insta-bg-image"  style="background-image: url(' . $post->images->standard_resolution->url . ')"></div>';
        echo '<div class="insta-caption clearfix">';
        echo '<img class="insta-icon" src="/wp-content/themes/umc_skitheme/images/home/insta-logo-white.png" />';
        echo '<div class="insta-name">' . $post->user->username . '</div>';
        echo '<div class="clearfix"></div>';
        echo '<div class="insta-text">' . $text . '...</div>';
        echo '</div>';