Esempio n. 1
0
 function createpdf($idtbl, $iddata, $idu)
 {
     $cekmng = cekurlid('manage', 'idmng');
     if (empty($idtbl) || empty($iddata) || strlen($idtbl) === 0 || strlen($iddata) === 0) {
         $this->session->unset_userdata('logged_in');
         $this->session->sess_destroy();
         redirect('login', 'refresh');
     } else {
         if (!in_array($idtbl, $cekmng)) {
             echo 'tidak terdaftar';
         } else {
             $tabel = $this->mweb->getmanage_by_id($idtbl);
             $listf = $this->db->list_fields($tabel);
             $fkol = array_shift(array_slice($listf, 0, 1));
             $cekurid = cekurlid($tabel, $fkol);
             if (in_array($iddata, $cekurid)) {
                 //--pdf-----------------------------------------------------------------------------
                 $result = $this->mweb->get_tabelandid($tabel, $iddata);
                 $kolom = $this->db->list_fields($tabel);
                 foreach ($result as $isidata) {
                     foreach ($kolom as $kol) {
                         switch ($kol) {
                             case 'id':
                                 $id = $isidata[$kol];
                                 break;
                             case 'kdquo':
                                 $kdquo = $isidata[$kol];
                                 break;
                             case 'iduser':
                                 $iduser = $isidata[$kol];
                                 break;
                             case 'tgl':
                                 $tgl = $isidata[$kol];
                                 break;
                             case 'idcus':
                                 $idcus = $isidata[$kol];
                                 $qcuss = $this->mweb->getcus_byid($idcus);
                                 foreach ($qcuss as $isicus) {
                                     $namacuss = $isicus['nama'];
                                     $kota = $isicus['kota'];
                                 }
                                 break;
                             case 'address':
                                 $address = $isidata[$kol];
                                 break;
                             case 'attn':
                                 $attn = $isidata[$kol];
                                 break;
                             case 'cc':
                                 $cc = $isidata[$kol];
                                 break;
                             case 'telp':
                                 $telp = $isidata[$kol];
                                 break;
                             case 'fax':
                                 $fax = $isidata[$kol];
                                 break;
                             case 'email':
                                 $email = $isidata[$kol];
                                 break;
                             case 'produk':
                                 $produk = $isidata[$kol];
                                 break;
                             case 'Model':
                                 $model = $isidata[$kol];
                                 break;
                             case 'qty':
                                 $qty = $isidata[$kol];
                                 break;
                             case 'disc':
                                 $disc = $isidata[$kol];
                                 break;
                             case 'price':
                                 $price = $isidata[$kol];
                                 break;
                             case 'subtotal':
                                 $subtotal = $isidata[$kol];
                                 break;
                             case 'amount':
                                 $amount = $isidata[$kol];
                                 break;
                             case 'total':
                                 $total = $isidata[$kol];
                                 break;
                             case 'kdinv':
                                 $kdinv = $isidata[$kol];
                                 break;
                             case 'ship_method':
                                 $ship_method = $isidata[$kol];
                                 break;
                             case 'pay_stat':
                                 $pay_stat = $isidata[$kol];
                                 break;
                             case 'note_pay':
                                 $note_pay = $isidata[$kol];
                                 break;
                             case 'cust_address':
                                 $cust_address = $isidata[$kol];
                                 break;
                             case 'cust_telp':
                                 $cust_telp = $isidata[$kol];
                                 break;
                             case 'bill_name':
                                 $bill_name = $isidata[$kol];
                                 break;
                             case 'bill_address':
                                 $bill_address = $isidata[$kol];
                                 break;
                             case 'bill_telp':
                                 $bill_telp = $isidata[$kol];
                                 break;
                             case 'ship_name':
                                 $ship_name = $isidata[$kol];
                                 break;
                             case 'ship_address':
                                 $ship_address = $isidata[$kol];
                                 break;
                             case 'ship_telp':
                                 $ship_telp = $isidata[$kol];
                                 break;
                             case 'ship_cost':
                                 $ship_cost = $isidata[$kol];
                                 break;
                             case 'pay_method':
                                 $pay_method = $isidata[$kol];
                                 break;
                             case 'catatan':
                                 $catatan = $isidata[$kol];
                                 break;
                             case 'website':
                                 $website = geturlweb($isidata[$kol]);
                                 break;
                             case 'total':
                                 $total = $isidata[$kol];
                                 break;
                             default:
                                 $isidata[$kol];
                                 break;
                         }
                     }
                 }
                 $detailu = getdetuser($idu);
                 foreach ($detailu as $valur) {
                     $namaur = $valur['nama'];
                     $telpur = $valur['telp'];
                     $nohpur = $valur['nohp'];
                     $pinbbur = $valur['pinbb'];
                     $ttdur = $valur['ttd'];
                 }
                 $pdf = new PDF_Quotation('P', 'mm', 'A4');
                 $pdf->cMargin = 0;
                 $pdf->AddPage();
                 $pdf->cMargin = 0;
                 switch ($tabel) {
                     case 'invoice':
                         $pdf->Header();
                         $pdf->jdlinv();
                         $pdf->Line(15, 32, 200, 32);
                         $pdf->lefttopinv();
                         $pdf->Kdinv($kdinv);
                         $pdf->rsideinv($tgl, $pay_method, $ship_method, $pay_stat, $note_pay);
                         $pdf->jdl_cusside();
                         $pdf->isi_cusside(!empty($namacuss) ? $namacuss : ($namacuss = '-'), $cust_address, !empty($kota) ? $kota : ($kota = '-'), !empty($cust_telp) ? $cust_telp : ($cust_telp = '-'));
                         $pdf->jdl_billside();
                         $pdf->isi_billside(!empty($bill_name) ? $bill_name : ($bill_name = '-'), !empty($bill_address) ? $bill_address : ($bill_address = '-'), !empty($bill_telp) ? $bill_telp : ($bill_telp = '-'));
                         $pdf->jdl_shipside();
                         $pdf->isi_shipside(!empty($ship_name) ? $ship_name : ($ship_name = '-'), !empty($ship_address) ? $ship_address : ($ship_address = '-'), !empty($ship_telp) ? $ship_telp : ($ship_telp = '-'));
                         $pdf->Ln(15);
                         $kdbrgg = explode('|', $produk);
                         $jml = explode('|', $qty);
                         $hrg = explode('|', $price);
                         $potong = explode('|', $disc);
                         $subhrg = explode('|', $subtotal);
                         $n = count($kdbrgg);
                         //SetFillColor(int r [, int g, int b])
                         //$pdf->theadinv();
                         $pdf->SetX(14);
                         $html = '<table border="1">';
                         $html .= '<tr><td width="348" align="center"><b> Product</b></td>';
                         $html .= '<td width="28"><b> Qty </b></td>';
                         $html .= '<td width="140"><b>  Unit Price </b></td>';
                         $html .= '<td width="40"><b>  disc </b></td>';
                         $html .= '<td width="160"><b>  Subtotal</b></td>';
                         $html .= '</tr></table>';
                         $pdf->WriteHTML($html);
                         for ($i = 0; $i < $n; $i++) {
                             $pdf->SetX(14);
                             $nmmbrg = $this->mweb->get_Descriptionbyid($kdbrgg[$i]);
                             $pdf->Cell(87, 7, '  ' . $nmmbrg, 1, 0, 'L');
                             $pdf->Cell(7, 7, $jml[$i], 1, 0, 'C');
                             $pdf->Cell(35, 7, $hrg[$i], 1, 0, 'C');
                             $pdf->Cell(10, 7, $potong[$i], 1, 0, 'C');
                             $pdf->Cell(40, 7, $subhrg[$i] . ' ', 1, 0, 'R');
                             $pdf->Ln();
                         }
                         $pdf->totalinv($total);
                         break;
                     case 'quotation':
                         $pdf->addlogo("");
                         $pdf->addjvm("");
                         $idtbl == '7' ? $titlle = "QUOTATION " : ($titlle = "INVOICE ");
                         $pdf->fact_dev($titlle, " ");
                         $pdf->temporaire("CV. Java Multi Mandiri");
                         $pdf->descr("");
                         $pdf->addHeadAlamat(": Jl. Raya Baturaden Timur KM 7 No. 17 Rempoah, Baturaden - Jawa Tengah - 53100");
                         $pdf->addHeadTelp(": 0281-6572222 / 0281-6572606, Email : info@jvm.co.id, Website : http://www.jvm.co.id");
                         $pdf->addTabelDate($tgl);
                         $pdf->addTabelAttn(!empty($attn) ? $attn : ($attn = '-'));
                         $pdf->addTabelQuNo($kdquo);
                         $pdf->addTabelCc("-");
                         // cc
                         $pdf->addTabelTo(!empty($namacuss) ? $namacuss : ($namacuss = '-'));
                         //penerima
                         $pdf->addTabelTelp(!empty($telp) ? $telp : ($telp = '-'));
                         // telp
                         $pdf->addTabelAddress();
                         //alamat
                         $pdf->addressisi(!empty($address) ? $address : ($address = '-'));
                         //alamat
                         $pdf->addTabelFaks(!empty($fax) ? $fax : ($fax = '-'));
                         // faks
                         $pdf->addEmail(!empty($email) ? $email : ($email = '-'));
                         // email
                         $pdf->AddWeAre("");
                         $pdf->Ln();
                         $pdf->Ln();
                         $kdbrgg = explode('|', $produk);
                         $jml = explode('|', $qty);
                         $hrg = explode('|', $price);
                         $potong = explode('|', $disc);
                         $subhrg = explode('|', $subtotal);
                         $n = count($kdbrgg);
                         //SetFillColor(int r [, int g, int b])
                         //$pdf->theadinv();
                         $pdf->SetX(14);
                         $html = '<table border="1">';
                         $html .= '<tr><td width="360"><b> Product </b></td>';
                         $html .= '<td width="48"><b> Qty </b></td>';
                         $html .= '<td width="140"><b> Unit Price </b></td>';
                         $html .= '<td width="48"><b> Disc </b></td>';
                         $html .= '<td width="140"><b> Subtotal </b></td>';
                         $html .= '</tr></table>';
                         $pdf->WriteHTML($html);
                         for ($i = 0; $i < $n; $i++) {
                             $pdf->SetX(14);
                             $nmmbrg = $this->mweb->get_Descriptionbyid($kdbrgg[$i]);
                             $pdf->Cell(90, 7, ' ' . $nmmbrg, 1, 0, 'L');
                             $pdf->Cell(12, 7, ' ' . $jml[$i], 1, 0, 'C');
                             $pdf->Cell(35, 7, ' ' . $hrg[$i], 1, 0, 'C');
                             $pdf->Cell(12, 7, ' ' . $potong[$i], 1, 0, 'C');
                             $pdf->Cell(35, 7, ' ' . $subhrg[$i], 1, 0, 'R');
                             $pdf->Ln();
                         }
                         $pdf->addGrandTotal(array_sum($subhrg));
                         $pdf->addExVAT("");
                         $pdf->addPriceStok("");
                         $pdf->addTerm("DP 50% with order balances 50% before delivery (Full Amount)");
                         $pdf->addDeliv("1 Day After Payment");
                         // bisa ganti
                         $pdf->addwarranty("");
                         $pdf->addwarrantyy("1st Month (Replacement)");
                         $pdf->addwarrantyyy("12nd Month (Repair / Service Hardware & Software)");
                         break;
                     default:
                         $pdf->Cell(40, 5, "No Result !", 0, 0, 'L');
                         break;
                 }
                 $pdf->addBank("");
                 $pdf->addBCA("");
                 $pdf->addMDR("");
                 $pdf->addBNI("");
                 if ($tabel == 'quotation') {
                     $pdf->addThk("");
                     if (empty($ttdur) || strlen($ttdur) === 0 || $ttdur === '0') {
                         $src = 'asset/img/ttd.jpg';
                     } else {
                         $path = geturl_img($ttdur);
                         $src = substr($path, 21);
                     }
                     $pdf->addttd($src);
                     $pdf->addstamp("");
                     $pdf->addCv("");
                     if (empty($namaur) || empty($nohpur) || empty($pinbbur)) {
                         $pdf->addFootTelp("Eka Setiawati Irawan", "0281-5755222/087837160608/Pin BB 29433756");
                     } else {
                         $pdf->addFootTelp($namaur, $telpur . "/" . $nohpur . "/Pin BB " . $pinbbur);
                     }
                 }
                 $detuser = getdetuser($iduser);
                 if ($detuser) {
                     foreach ($detuser as $valuser) {
                         $namau = $valuser['nama'];
                         $pinbbu = $valuser['pinbb'];
                         $emailu = $valuser['email'];
                         $nohpu = $valuser['nohp'];
                     }
                 } else {
                     $detown = getdetuser(1);
                     foreach ($detown as $valuser) {
                         $namau = $valuser['nama'];
                         $pinbbu = $valuser['pinbb'];
                         $emailu = $valuser['email'];
                         $nohpu = $valuser['nohp'];
                     }
                 }
                 $pdf->SetXY(15, 235);
                 $pdf->SetFont('Arial', 'B', 14);
                 $pdf->WriteHTML("<a  href='" . $website . "'>" . $website . "</a>");
                 //$pdf->Contactus($namau,$pinbbu,$emailu,$nohpu);
                 $pdf->hcatatn();
                 $pdf->catatan($catatan);
                 $pdf->Output();
                 //--pdf-----------------------------------------------------------------------------
                 echo 'ada';
             } else {
                 echo 'tidak ada';
             }
         }
     }
 }
Esempio n. 2
0
$pdf->addTabelDate(date("F d, Y"));
$pdf->addTabelAttn("Ari Sebastian");
//nama
$pdf->addTabelQuNo($data['id']);
// no. quot
$pdf->addTabelCc("-");
// cc
$pdf->addTabelTo("PT. Rafa Bhakti Mulya");
//penerima
$pdf->addTabelTelp("02183786432");
// telp
$pdf->addTabelAddress("Rasuna Office Park III Jl. HR Rasuna Said - Kuningan Suite ZO-12 (komp. Apartemen rasuna) Jakarta Selatan");
//alamat
$pdf->addTabelFaks("02183703107");
// faks
$pdf->addEmail("*****@*****.**");
// email
$pdf->AddWeAre("");
$pdf->Ln();
$pdf->Ln();
//
$pdf->addExVAT("");
$pdf->addPriceStok("");
$pdf->addTerm("DP 50% with order balances 50% before delivery (Full Amount)");
$pdf->addDeliv("1 Day After Payment");
// bisa ganti
$pdf->addwarranty("");
$pdf->addwarrantyy("1st Month (Replacement)");
$pdf->addwarrantyyy("12nd Month (Repair / Service Hardware & Software)");
$pdf->addBank("");
$pdf->addBCA("");