$minutes = $minutes - 60;
        $hours = $hours + 1;
    }
    //	return $hours;
    return sprintf("%d:%02.0f", $hours, $minutes);
}
switch ($mode) {
    case 'pdf':
        /** Report Prep **/
        $colPdf = explode(',', $cols2e);
        $title = $_SESSION['lang']['pabrik'] . " " . $kodeorg;
        $length = explode(",", "10,10,10,10,10,10,10,10");
        $colPdf[6] = "CPO (Kg)";
        $colPdf[7] = "Kernel (Kg)";
        $pdf = new zPdfMaster('L', 'pt', 'A4');
        $pdf->setAttr1($title, $align, $length, $colPdf);
        $width = $pdf->w - $pdf->lMargin - $pdf->rMargin;
        $height = 12;
        $pdf->AddPage();
        $pdf->SetFillColor(255, 255, 255);
        $pdf->SetFont('Arial', '', 9);
        # Content
        $pdf->SetFont('Arial', '', 9);
        $j = 0;
        foreach ($data as $key => $row) {
            $i = 0;
            $j += 1;
            // nomor baris
            $pdf->Cell($length[$i] / 100 * $width, $height, $j, 1, 0, $align[$i], 1);
            foreach ($row as $head => $cont) {
                if ($i == 0) {
$optProject = makeOption($dbname, 'project', 'kode,nama');
$optProjectDt = makeOption($dbname, 'project_dt', 'kegiatan,namakegiatan');
# Data Show
$dataShow = $data;
foreach ($dataShow as $key => $row) {
    $dataShow[$key]['kodeblok'] = isset($optOrg[$row['kodeblok']]) ? $optOrg[$row['kodeblok']] : $optProject[$row['kodeblok']];
    $dataShow[$key]['kodekegiatan'] = isset($optKeg[$row['kodekegiatan']]) ? $optKeg[$row['kodekegiatan']] : $optProjectDt[$row['kodekegiatan']];
}
$title = $_SESSION['lang']['spk'];
$titleDetail = array('Detail');
/** Output Format **/
switch ($proses) {
    case 'pdf':
        $pdf = new zPdfMaster('L', 'pt', 'A4');
        $pdf->_noThead = true;
        $pdf->setAttr1($title, $align, $length, array());
        $width = $pdf->w - $pdf->lMargin - $pdf->rMargin;
        $height = 12;
        $pdf->AddPage();
        $pdf->SetFillColor(255, 255, 255);
        $pdf->SetFont('Arial', 'B', 9);
        $pdf->Cell($width, $height, $_SESSION['lang']['notransaksi'] . " : " . $param['notransaksi'], 0, 1, 'L', 1);
        $pdf->Cell($width, $height, $_SESSION['lang']['kodeorg'] . " : " . $optOrg[$param['kodeorg']], 0, 1, 'L', 1);
        $pdf->Cell($width, $height, $_SESSION['lang']['koderekanan'] . " : " . $optSupp[$param['koderekanan']], 0, 1, 'L', 1);
        $pdf->Ln();
        # Header
        $pdf->SetFont('Arial', 'B', 9);
        $pdf->Cell($width, $height, $titleDetail[0], 0, 1, 'L', 1);
        $pdf->SetFillColor(220, 220, 220);
        $i = 0;
        foreach ($cols as $column) {
$proses = $_GET['proses'];
$param = $_POST;
/** Report Prep **/
$where = null;
$cols = 'nosj,kodept,tanggal,tanggalkirim,tanggaltiba';
$colArr = explode(',', $cols);
$query = selectQuery($dbname, 'log_suratjalanht', $cols, $where, 'nosj desc');
$data = fetchData($query);
$title = "Delivery Order";
$align = explode(",", "L,L,L,L,L");
$length = explode(",", "20,20,20,20,20");
/** Output Format **/
switch ($proses) {
    case 'pdf':
        $pdf = new zPdfMaster('P', 'pt', 'A4');
        $pdf->setAttr1($title, $align, $length, $colArr);
        $width = $pdf->w - $pdf->lMargin - $pdf->rMargin;
        $height = 12;
        $pdf->AddPage();
        $pdf->SetFillColor(255, 255, 255);
        $pdf->SetFont('Arial', '', 9);
        foreach ($data as $key => $row) {
            $i = 0;
            foreach ($row as $cont) {
                $pdf->Cell($length[$i] / 100 * $width, $height, $cont, 1, 0, $align[$i], 1);
                $i++;
            }
            $pdf->Ln();
        }
        $pdf->Output();
        break;
foreach ($data as $key => $row) {
    $dataShow[$key]['idkomponen'] = $optCmp[$row['idkomponen']];
    $dataShow[$key]['jumlahlalu'] = number_format($row['jumlahlalu'], 0);
    $dataShow[$key]['jumlah'] = number_format($row['jumlah'], 0);
}
$dataExcel = $data;
# Report Gen
$theCols = array($_SESSION['lang']['tanggalupdate'], $_SESSION['lang']['updateby'], $_SESSION['lang']['namakaryawan'], $_SESSION['lang']['tahun'], $_SESSION['lang']['idkomponen'], $_SESSION['lang']['jumlahlalu'], $_SESSION['lang']['jumlah']);
$align = explode(",", "C,C,C,C,C,R,R");
switch ($mode) {
    case 'pdf':
        /** Report Prep **/
        $title = $_SESSION['lang']['histgaji'];
        $length = explode(",", "17,17,17,10,17,12,10");
        $pdf = new zPdfMaster('P', 'pt', 'A4');
        $pdf->setAttr1($title, $align, $length, $theCols);
        $pdf->_finReport = true;
        $width = $pdf->w - $pdf->lMargin - $pdf->rMargin;
        $height = 12;
        $pdf->AddPage();
        $pdf->SetFillColor(255, 255, 255);
        # Content
        $pdf->SetFont('Arial', '', 9);
        foreach ($dataShow as $key => $row) {
            $i = 0;
            foreach ($row as $head => $cont) {
                if ($head == 'tanggal') {
                    $cont = tanggalnormal($cont);
                }
                $pdf->Cell($length[$i] / 100 * $width, $height, $cont, 'LBR', 0, $align[$i], 1);
                $i++;