if ($minutes >= 60) { $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) {
$optKeg = makeOption($dbname, 'setup_kegiatan', 'kodekegiatan,namakegiatan', $whereKeg, '0', true); $optSupp = makeOption($dbname, 'log_5supplier', 'supplierid,namasupplier', "supplierid='" . $param['koderekanan'] . "'"); $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);
include_once 'lib/zPdfMaster.php'; $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();
$table .= "</tbody>"; $table .= "</table>"; #=== Formatting === switch ($proses) { case 'preview': echo $table; break; case 'excel': $nop_ = "Summary_JMemorial " . $unit . " " . $tahun . "-" . $bulan; $gztralala = gzopen("tempExcel/" . $nop_ . ".xls.gz", "w9"); gzwrite($gztralala, $table); gzclose($gztralala); echo "<script language=javascript1.2>\r\n window.location='tempExcel/" . $nop_ . ".xls.gz';\r\n </script>"; break; case 'pdf': $pdf = new zPdfMaster('L', 'pt', 'A4'); $pdf->setAttr1($title, $align, $length, $colArr); $pdf->_finReport = true; $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(); }
$noref = $row['noreferensi']; } break; default: } # Mode switch ($mode) { case 'pdf': /** Report Prep **/ $colsNew = 'noakun,namaakun,keterangan,debet,kredit,nodok'; $colPdf = explode(',', $colsNew); $title = $_SESSION['lang']['nojurnal'] . ": " . $nojurnal; $title .= " " . $_SESSION['lang']['noreferensi'] . ": " . $noref; $align = explode(",", "L,L,L,R,R,L"); $length = explode(",", "7,25,38,8,8,13"); $pdf = new zPdfMaster('L', 'pt', 'A4'); $pdf->SetFont('Arial', '', 8); $pdf->setAttr1($title, $align, $length, $colPdf); $width = $pdf->w - $pdf->lMargin - $pdf->rMargin; $height = 12; $pdf->AddPage(); $pdf->SetFillColor(255, 255, 255); foreach ($data as $row) { $i = 0; $awalY = $pdf->GetY(); $awalX = $pdf->GetX(); $currentX = $pdf->GetX(); $pdf->SetY($awalY); $pdf->SetX($currentX); $pdf->MultiCell($length[0] / 100 * $width, $height, $row['noakun'], '0', $align[0]); $pdf->SetY($awalY);
foreach ($dataShow as $key => $row) { $dataShow[$key]['station'] = $optOrg[$row['station']]; $dataShow[$key]['tahuntanam'] = $optOrg[$row['tahuntanam']]; } $dataMat = array(); if (is_array($resMat)) { foreach ($resMat as $key => $row) { $dataMat[$row['kodeorg']][$row['tahuntanam']][] = array('nama' => $optBarang[$row['kodebarang']], 'jumlah' => $row['jumlah']); } } $title = $_SESSION['lang']['operasipabrik']; $titleDetail = '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']['nopengolahan'] . " : " . $param['nopengolahan'], 0, 1, 'L', 1); $iData = "select * from " . $dbname . ".pabrik_pengolahan where nopengolahan='" . $param['nopengolahan'] . "' "; $nData = mysql_query($iData) or die(mysql_error($conn)); $dData = mysql_fetch_assoc($nData); $pdf->Cell($width, $height, $_SESSION['lang']['jammulai'] . " : " . $dData['jammulai'], 0, 1, 'L', 1); $pdf->Cell($width, $height, $_SESSION['lang']['jamselesai'] . " : " . $dData['jamselesai'], 0, 1, 'L', 1); $pdf->Ln(); # Header
case "PNN": $title = $_SESSION['lang']['panen']; break; case "TB": $title = "UPKEEP-" . $_SESSION['lang']['tbm']; break; default: echo "Error : Atribut not Defined"; exit; break; } $titleDetail = array($_SESSION['lang']['prestasi'], $_SESSION['lang']['absensi'], $_SESSION['lang']['material']); /** Output Format **/ switch ($proses) { case 'pdf': $pdf = new zPdfMaster('P', '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->Ln(); $pdf->Cell($width, $height, $_SESSION['lang']['notransaksi'] . " : " . $param['notransaksi'], 0, 1, 'L', 1); //'tanggal,kodekegiatan,a.kodeorg,hasilkerja,jumlahhk,upahkerja,upahpremi,umr'; $sPres = "select distinct sum(a.insentif) as upahpremi, sum(a.umr) as umr,sum(a.jhk) as jumlahhk,kodekegiatan,\r\n tanggal,b.kodeorg,b.hasilkerja from " . $dbname . ".kebun_kehadiran a left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n left join " . $dbname . ".kebun_aktifitas c on a.notransaksi=c.notransaksi where a.notransaksi='" . $param['notransaksi'] . "' group by a.notransaksi"; $pdf->Ln(); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell($width, $height, $titleDetail[0], 0, 1, 'L', 1); $pdf->SetFillColor(220, 220, 220);
*/ $query = selectQuery($dbname, 'sdm_5gajipokok', $cols, $where); $data = fetchData($query); # Data Show $dataShow = $data; foreach ($dataShow as $key => $row) { $dataShow[$key]['karyawanid'] = $optKary[$row['karyawanid']]; $dataShow[$key]['idkomponen'] = $optComp[$row['idkomponen']]; //$dataShow[$key]['namakaryawan'] = $optNmKar[$optKary[$row['karyawanid']]]; } $title = $_SESSION['lang']['gajipokok']; $colArr = explode(',', $cols); $align = explode(",", "L,L,L,R"); $length = explode(",", "10,30,30,20"); # Print $pdf = new zPdfMaster('P', '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->Ln(); $pdf->SetFont('Arial', 'B', 9); #$pdf->Cell($width,$height,$titleDetail[0],0,1,'L',1); $pdf->SetFillColor(220, 220, 220); $i = 0; foreach ($colArr as $column) { $pdf->Cell($length[$i] / 100 * $width, $height, $_SESSION['lang'][$column], 1, 0, 'C', 1); $i++;
$saldoAwal = $saldoAwal; $saldoKK = $saldoKK; } break; default: break; } switch ($mode) { case 'pdf': /** Report Prep **/ # Options $optJab = makeOption($dbname, 'sdm_5jabatan', 'kodejabatan,namajabatan', "kodejabatan='" . $_SESSION['empl']['kodejabatan'] . "'"); $colPdf = array('nourut', 'tanggal', 'keterangan', 'kasmasuk', 'penerimaan', 'kaskeluar', 'pengeluaran'); $title = $_SESSION['lang']['kasharian']; $length = explode(",", "5,12,35,10,14,10,14"); $pdf = new zPdfMaster('P', 'pt', 'A4'); $pdf->setAttr1($title, $align, $length, $colPdf); $pdf->_finReport = true; $width = $pdf->w - $pdf->lMargin - $pdf->rMargin; $height = 12; $pdf->AddPage(); $pdf->SetFillColor(255, 255, 255); # Saldo Awal $pdf->SetFont('Arial', 'B', 9); $pdf->Cell($length[0] / 100 * $width, $height, '', 'TLR', 0, 'C', 1); $pdf->Cell($length[1] / 100 * $width, $height, '', 'TLR', 0, 'C', 1); $pdf->Cell($length[2] / 100 * $width, $height, 'Saldo Awal ' . $periode1, 'TLR', 0, 'C', 1); $pdf->Cell($length[3] / 100 * $width, $height, '', 'TLR', 0, 'R', 1); $pdf->Cell($length[4] / 100 * $width, $height, $saldoAwal, 'TLR', 0, 'R', 1); $pdf->Cell($length[5] / 100 * $width, $height, '', 'TLR', 0, 'R', 1); $pdf->Cell($length[6] / 100 * $width, $height, '', 'TLR', 0, 'R', 1);
$optJabatan = makeOption($dbname, 'sdm_5jabatan', 'kodejabatan,namajabatan', null, '0', true); // Rearrange Data foreach ($data as $key => $row) { $data[$key]['data'] = json_decode($row['data'], 1); } $dataShow = $data; $dataExcel = $data; # Report Gen $theCols = array($_SESSION['lang']['tanggalupdate'], $_SESSION['lang']['updateby'], $_SESSION['lang']['namakaryawan'], $_SESSION['lang']['data']); $align = explode(",", "C,C,C,C"); switch ($mode) { case 'pdf': /** Report Prep **/ $title = $_SESSION['lang']['histkaryawan']; $length = explode(",", "20,20,20,40"); $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 != 'data') { $pdf->Cell($length[$i] / 100 * $width, $height * count($row['data']), $cont, 'LBR', 0, $align[$i], 1); } else { $tmpX = $pdf->GetX();
} //exit("Error:$qSupp"); $resSupp = fetchData($qSupp); if ($resSupp[0]['namasupplier'] == '' || !isset($resSupp[0]['namasupplier'])) { $str = "select b.namasupplier from " . $dbname . ".keu_tagihanht a left join " . $dbname . ".log_5supplier b\r\n on a.kodesupplier=b.supplierid where a.noinvoice='" . $param['noinvoice'] . "'"; $res = mysql_query($str); while ($bar = mysql_fetch_object($res)) { $resSupp[0]['namasupplier'] = $bar->namasupplier; } } #================================ Prep Data =================================== $title = "INVOICE"; /** Output Format **/ switch ($proses) { case 'pdf': $pdf = new zPdfMaster('P', 'pt', 'A4'); $pdf->_noThead = true; $pdf->_title = $title; $width = $pdf->w - $pdf->lMargin - $pdf->rMargin; $height = 12; $pdf->AddPage(); $pdf->SetFillColor(255, 255, 255); $pdf->SetFont('Arial', '', 9); switch ($dataH['tipeinvoice']) { case 'p': $tipe = 'PO'; break; case 'k': $tipe = 'SPK'; break; }
case "PNN": $title = $_SESSION['lang']['panen']; break; default: echo "Error : Attribut not defined"; exit; break; } $titleDetail = array($_SESSION['lang']['prestasi'], $_SESSION['lang']['absensi'], $_SESSION['lang']['material']); // Init Total $totJanjang = $totUpahKerja = $totUpahKerjapenalty = $totUpahPremi = 0; $totUpahPremibasis = $totUpahDenda = $totLuas = $totSisa = 0; /** Output Format **/ switch ($proses) { case 'pdf': $pdf = new zPdfMaster('P', 'pt', 'A4'); $pdf->_noThead = true; $pdf->setAttr1($title, $align, $length, array()); $width = $pdf->w - $pdf->lMargin - $pdf->rMargin; $height = 12; $pdf->AddPage(); $pdf->Ln(); $pdf->SetFillColor(255, 255, 255); $pdf->SetFont('Arial', 'B', 9); $pdf->Cell($width, $height, $_SESSION['lang']['notransaksi'] . " : " . $param['notransaksi'], 0, 1, 'L', 1); $pdf->SetFillColor(220, 220, 220); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(10 / 100 * $width, $height, $_SESSION['lang']['tanggal'], 1, 0, 'C', 1); $pdf->Cell(15 / 100 * $width, $height, $_SESSION['lang']['nik'], 1, 0, 'C', 1); $pdf->Cell(13 / 100 * $width, $height, $_SESSION['lang']['kodeorg'], 1, 0, 'C', 1); $pdf->Cell(5 / 100 * $width, $height, $_SESSION['lang']['jjg'], 1, 0, 'C', 1);