function cetakPDF($tanggal_dari, $tanggal_sampai, $idRefBarang1 = 0) { ini_set('memory_limit', '512M'); $this->output->enable_profiler(FALSE); $this->load->library('TCPDF'); $stock = new stock_model(); $store = $this->orm->refstore->where('idrefstore', $_SESSION['user']['idrefstore'])->fetch(); $image_store = ($store['image_file'] == "" or $store['image_file'] == NULL) ? "./front_assets/img/bizon_inventory.jpg" : "./uploads/stores/" . $store['image_file']; if ($idRefBarang1 != 0) { $data = $stock->_loadMutasiStock($tanggal_dari, $tanggal_sampai, $idRefBarang1); } else { $data = $stock->_loadMutasiStock($tanggal_dari, $tanggal_sampai); } // print_r(json_encode($data)); exit; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A4', true, 'UTF-8', false); // set document information $pdf->SetCreator(WEB_TITLE); $pdf->SetAuthor($this->session->userdata('username')); $pdf->SetTitle("Laporan Surat Jalan"); $pdf->SetSubject('Laporan Surat Jalan'); $pdf->tanggal_dari = $tanggal_dari; $pdf->tanggal_sampai = $tanggal_sampai; // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(5, 10, 5); $pdf->SetHeaderMargin(5); $pdf->SetFooterMargin(5); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. // use the font $pdf->SetFont("Times", '', 11, '', false); // Add a page // This method has several options, check the source code documentation for more information. $pdf->AddPage('L'); // Set some content to print $html = ' <body> '; $no = 1; $html .= ' <table><tr><td> <h3>Daftar Delivery Order - ' . $store['nama'] . '</h3> </td><td style="text-align:right"> <img src="' . $image_store . '" width="150"><br/></td></tr></table> <table width="100%"> <tr> <td width="100%" style="text-align: center; vertical-align:text-top;"><h2>LAPORAN MUTASI STOCK</h2> <p><b>PERIODE : ' . Tanggal::formatDate(Tanggal::sqlDate($tanggal_dari)) . ' s/d ' . Tanggal::formatDate(Tanggal::sqlDate($tanggal_sampai)) . '</b></p> </td> </tr> </table> <table cellpadding="5" cellspacing="1" class="border" border="1" width="100%"> <tr style="text-align:center"><td width="70">No</td><td width="400">Nama Barang</td><td width="90">Stock Awal</td><td width="90">Barang Masuk</td><td width="90">Barang Keluar</td><td width="90">Saldo</td><td width="100">Satuan</td></tr> '; if (!empty($data)) { foreach ($data as $row) { $idrefbarang = $row['idrefbarang']; $row['jumlahKirim'] = $stock->_getJumlahKirim($idrefbarang, $tanggal_dari, $tanggal_sampai); $row['jumlahTerima'] = $stock->_getJumlahTerima($idrefbarang, $tanggal_dari, $tanggal_sampai); // $saw = $master->_getSaldoAwalBarang($idBarang, $tanggal_dari, $tanggal_sampai, $row['idTransaksiBarang']); $kirim = $row['jumlahKirim'] == null ? 0 : $row['jumlahKirim']; $terima = $row['jumlahTerima'] == null ? 0 : $row['jumlahTerima']; $saldo = $row['stockawal']; $saldo = $saldo + $terima; $saldo = $saldo - $kirim; $html .= '<tr>' . '<td class="border" style="text-align: center;" > ' . $no . ' </td>' . '<td class="border" style="text-align: left;"> ' . $row['namabarang'] . '</td>' . '<td class="border" style="text-align: right;"> ' . $row['stockawal'] . ' </td>' . '<td class="border" style="text-align: right;"> ' . $terima . ' </td>' . '<td class="border" style="text-align: right;"> ' . $kirim . '</td>' . '<td class="border" style="text-align: right;"> ' . $saldo . '</td>' . '<td class="border" style="text-align: right;"> ' . $row['namasatuan'] . '</td></tr>'; $no++; } } $html .= '</table>'; $html .= '<br/> <br/> <br/> <hr/> <div style="text-align: center"> Akhir Laporan </div> </body>'; //print_r($html); exit; // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); // --------------------------------------------------------- // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output("Laporan Mutasi Stock {$tanggal_dari} _ {$tanggal_sampai}.pdf", 'I'); //============================================================+ // END OF FILE //============================================================+ }
public function cetakDaftar($idrefstore = null) { ini_set('memory_limit', '512M'); //akses dari web if ($idrefstore == null) { $store = $this->orm->refstore->where('idrefstore', $_SESSION['user']['idrefstore'])->fetch(); $data = $this->orm->deliveryorder->where('idrefstore', $_SESSION['user']['idrefstore'])->order('tanggaldo DESC'); $email = $_SESSION['user']['email']; } else { $store = $this->orm->refstore->where('idrefstore', $idrefstore)->fetch(); $data = $this->orm->deliveryorder->where('idrefstore', $idrefstore)->order('tanggaldo DESC'); $email = $this->input->post('email'); } $image_store = ($store['image_file'] == "" or $store['image_file'] == NULL) ? "./front_assets/img/bizon_inventory.jpg" : "./uploads/stores/" . $store['image_file']; $this->load->library('TCPDF'); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A4', true, 'UTF-8', false); // set document information $pdf->SetCreator(WEB_TITLE); $pdf->SetAuthor($email); $pdf->SetTitle("Delivery Order - " . $store['nama']); $pdf->SetSubject($store['nama']); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(5, 10, 5); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 80); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 80); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font // dejavusans is a UTF-8 Unicode font, if you only need to // print standard ASCII chars, you can use core fonts like // helvetica or times to reduce file size. // use the font $pdf->SetFont('times', '', 10, '', false); // Add a page $pdf->AddPage('L'); // Set some content to print $html = ' <style> body { letter-spacing:5px; } </style> <style type="text/css"> .rotate-text { /* Safari */ -webkit-transform: rotate(-90deg); /* Firefox */ -moz-transform: rotate(-90deg); /* IE */ -ms-transform: rotate(-90deg); /* Opera */ -o-transform: rotate(-90deg); /* Internet Explorer */ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); } .border-table{ border:0.5px solid #000; } table { padding-top:2px; } </style> <body> <table><tr><td> <h3>Daftar Delivery Order - ' . $store['nama'] . '</h3> </td><td style="text-align:right"> <img src="' . $image_store . '" width="150"><br/></td></tr></table> <table border="1"> <tr><th style="text-align: center;" width="60"> No </th><th width="200" style="text-align: center;"> Nomor DO </th><th style="text-align: center;" width="140"> Tanggal DO </th><td style="text-align: center; "width="210"> Pelanggan </td><td style="text-align: center; "width="150"> Status </td><td style="text-align: center; "width="200"> Disetujui Oleh </td></tr> '; $no = 1; foreach ($data as $row) { $html .= "<tr><td>" . $no . "</td><td>" . $row['nomordo'] . "</td><td>" . Tanggal::formatDate($row['tanggaldo']) . "</td><td>" . $row->pelanggan['namapelanggan'] . "</td><td>" . $row['status'] . "</td><td>" . $row['disetujui'] . "</td></tr>"; $no++; } $html .= '</table> </body>'; //print_r($html); exit; // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); //$pdf->writeHTML($html, true, 0, true, true); // --------------------------------------------------------- // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output("Daftar Delivery Order", 'I'); //============================================================+ // END OF FILE //============================================================+ }
<?php $no = 1; foreach ($deliveryorderdetail as $row) { $pelanggan = $this->orm->pelanggan->where('idpelanggan', $row->deliveryorder['idpelanggan'])->fetch(); ?> <tr> <td><?php echo $no; ?> </td> <td><?php echo $row->deliveryorder['nomordo']; ?> </td> <td><?php echo Tanggal::formatDate($row->deliveryorder['tanggaldo']); ?> </td> <td><?php echo $pelanggan['namapelanggan']; ?> </td> <td><?php echo $row->refbarang['namabarang']; ?> </td> <td><?php echo $row['jumlahbarang']; ?> </td> <td><?php
echo $row->refbarang['kodebarang']; ?> </td> <td><?php echo $row->refbarang['namabarang']; ?> </td> <td><?php echo $row['jumlah_barang']; ?> </td> <td> <?php if ($row['status_konfirmasi'] == 'Y') { echo 'Sudah Dikonfirmasi Pada <br/> <b>' . Tanggal::formatDate($row['tanggal_konfirmasi']) . '</b>'; } else { ?> <a href="<?php echo base_url(); ?> index.php/sharing/konfirmasi/<?php echo $row['idsharingproduct']; ?> " class="btn btn-option1"><i class="fa fa-edit"></i>Konfirmasi</a> <a href="<?php echo base_url(); ?> index.php/sharing/batal/<?php echo $row['idsharingproduct']; ?>
<th>Nomor DO</th> <th>Tanggal</th> <th>Pelanggan</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $ids=1; foreach ($dorejected as $row) { ?> <tr> <td><?php echo $ids ?></td> <td><?php echo $row['nomor'] ?></td> <td><?php echo Tanggal::formatDate($row['tanggal']) ?></td> <td><?php echo $row->pelanggan['namapelanggan'] ?></td> <td><?php echo $row->refstatus['status'] ?></td> <td> <a href="<?php echo base_url() ?>index.php/pemesanan/do_pemesanan/rollback/<?php echo $row['idquotationsales'] ?>" onclick="return confirm('Anda Yakin Ingin Rollback Data DO ini?')" class="btn btn-danger" data-toggle="tooltip" data-placement="top" data-original-title="Klik Untuk Rollback DO"><i class="fa fa-rotate-left"></i>Rollback</a> <a onclick="edit(<?php echo $row['idquotationsales'] ?>)" data-toggle="tooltip" data-target="#myModalUpdate" class="btn btn-option5" data-placement="top" data-original-title="Klik Untuk Melihat Detil"><i class="fa fa-edit"></i>Detail</a> <a href="#" onclick="cetak(<?php echo $row['idquotationsales'] ?>)" class="btn btn-primary" data-toggle="tooltip" data-placement="top" data-original-title="Klik Untuk Cetak"><i class="fa fa-print"></i>Print</a> </td> </tr> <?php $ids++; } ?> </tbody> </table> </div>
<tbody> <?php $iddeliveryorder = 1; foreach ($deliveryorder as $row) { ?> <tr> <td><?php echo $iddeliveryorder; ?> </td> <td><?php echo $row['nomordo']; ?> </td> <td><?php echo Tanggal::formatDate($row['tanggaldo']); ?> </td> <td><?php echo $row->pelanggan['namapelanggan']; ?> </td> <td><?php echo $row['status']; ?> </td> <td> <a href="#" class="btn btn-option5" onclick="edit(<?php echo $row['iddeliveryorder']; ?> )"><i class="fa fa-edit"></i>Detil</a>
$no = 1; foreach ($pengadaans as $pengadaan) { foreach ($pengadaan->pengadaandetail() as $row) { $supplier = $this->orm->supplier->where('idsupplier', $row->pengadaan['idsupplier'])->fetch(); ?> <tr> <td><?php echo $no; ?> </td> <td><?php echo $row->pengadaan['nomorpengadaan']; ?> </td> <td><?php echo Tanggal::formatDate($row->pengadaan['tanggalpengadaan']); ?> </td> <td><?php echo $row->pengadaan['nomorreff']; ?> </td> <td><?php echo $supplier['namasupplier']; ?> </td> <td><?php echo $row->refbarang['namabarang']; ?> </td> <td><?php