Example #1
0
 public function bukti($a)
 {
     $pdfku = new Cezpdf("A5", 'landscape');
     //595.28,841.29
     $pdfku->addInfo('Title', 'List Barang');
     $pdfku->ezSetCmMargins("3", "3", "3", "3");
     $barang = $this->barang->detail_peminjaman($a);
     $pdfku->ezSetY(100);
     $pdfku->ezSetDy(230);
     //$pdfku->addJpegFromFile("icon.jpg",20,300,-1);
     $pdfku->addText(120, $pdfku->y + 30, 18, "Bukti Peminjaman Inventaris Laboratorium");
     $pdfku->addText(160, $pdfku->y + 10, 15, "Komputasi Berbasis Jaringan (KBJ)");
     $cols_db = array('id_barang' => 'ID Barang', 'nama_barang' => 'Nama Barang');
     $option_db = array('showHeadings' => 2, 'shaded' => 0, 'xPos' => 'center', 'xOrientation' => 'center', 'fontSize' => 12, 'cols' => array('id_barang' => array('justification' => 'center', 'width' => '120'), 'nama_barang' => array('justification' => 'center', 'width' => '120')));
     $pdfku->ezTable($barang, $cols_db, '', $option_db);
     $pdfku->addText(100, $pdfku->y - 40, 12, "Mengetahui ");
     $pdfku->addText(90, $pdfku->y - 60, 12, "Administrator Lab");
     $pdfku->addText(400, $pdfku->y - 60, 12, "Kepala Laboratorium");
     $pdfku->addText(80, $pdfku->y - 130, 10, "__________________");
     $pdfku->addText(400, $pdfku->y - 130, 10, "__________________");
     $pdfku->ezStream();
 }
Example #2
0
<?php

//sambungkan ke class pdf
include 'class.ezpdf.php';
$pdf = new Cezpdf();
// Atur margin
$pdf->ezSetCmMargins(2, 3, 3, 3);
// Header dan footer didefinisikan diantara openObject dan closeObject
$all = $pdf->openObject();
// Teks di tengah atas untuk judul header
$pdf->addText(240, 820, 16, '<b>LAPORAN PERUMAHAN BOGOR</b>');
$pdf->addText(150, 800, 14, '<b>Consumer Service Division PT. Telkom Bogor</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
$pdf->addText(150, 60, 14, '<b>Dilaporkan oleh Divisi Consumer Service</b>');
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak pada tanggal: ' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Koneksi ke database dan tampilkan datanya
mysql_connect("localhost", "root", "");
mysql_select_db("drasticdata");
$sql = mysql_query("SELECT * FROM `perumahan`");
$i = 1;
while ($r = mysql_fetch_array($sql)) {
    $data[$i] = array('No' => $i, 'Nama Perumahan' => $r[nama_perum], 'Alamat' => $r[alamat], 'Daerah' => $r[daerah], 'Jumlah Dibangun' => $r[jumlah_dibangun], 'Sudah Dibangun' => $r[sudah_dibangun], 'Latitude' => $r[lat], 'Longitude' => $r[lng]);
    $i++;
}
$pdf->setFontFamily('Helvetica', $tmp);
$pdf->selectFont('fonts/Helvetica.afm');
$pdf->ezSetCmMargins(1.5, 1, 2, 3);
$pdf->addJpegFromFile("../img/libro.jpg", 50, 750, 60);
$result = mysql_query("select matricula,\n\tconcat(nombre,' ',apellido_paterno,' ',apellido_materno) as nombre,\n\tconcat(calle,' ',numero,' ',colonia,'') as direccion,ciudad,estado,telefono,celular,sueldo,tipo\n\t\t\t\t\t\tfrom empleados \n\t\t\t\t\t\twhere status = 'ACTIVO'  ");
while ($datatmp = mysql_fetch_array($result)) {
    $data[] = array_merge($datatmp, array('matricula'));
}
$options = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 550, 'fontSize' => 8, 'xPos' => 'center');
$titles = array('matricula' => '<b>ID</b>', 'nombre' => '<b>NOMBRE</b>', 'direccion' => '<b>DIRECCIÓN</b>', 'ciudad' => '<b>CIUDAD</b>', 'estado' => '<b>ESTADO</b>', 'telefono' => '<b>TELÉFONO</b>', 'celular' => '<b>CELULAR</b>', 'sueldo' => '<b>SUELDO</b>', 'tipo' => '<b>TIPO</b>');
$pdf->ezText("\n\n\n\n\n", 10);
$pdf->ezTable($data, $titles, '', $options);
//cabecera del pdf (objeto para todas las páginas)
$all = $pdf->openObject();
$pdf->saveState();
$pdf->line($pdf->ez['leftMargin'], $pdf->ez['bottomMargin'] + 10, $pdf->ez['pageWidth'] - $pdf->ez['rightMargin'], $pdf->ez['bottomMargin'] + 10);
//the bottom line
$pdf->addText(200, 790, 12, "<b>Distribuciones y Representaciones Arvizu </b>\n");
$pdf->addText(230, 770, 12, "<i>!Leer Aumenta el Saber! </i>\n");
$pdf->addText(240, 740, 12, "<b>Listado Empleados </b>\n");
$pdf->ezText("\n\n\n", 10);
$pdf->addText(50, 30, 8, "<b>Fecha: </b>\n" . date("d/m/Y"));
$pdf->ezStartPageNumbers($pdf->ez['pageWidth'] - ($pdf->ez['rightMargin'] - 10), $pdf->ez['bottomMargin'], 8, 'PAGINA', '{PAGENUM} de {TOTALPAGENUM}', 1);
$pdf->addText(50, 30, 10);
//bottom text
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all, 'all');
$pdf->ezSetCmMargins(4, 3, 3, 3);
ob_end_clean();
$pdf->ezStream();
Example #4
0
 $cools = array('à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'ß', '\'', ' ', 'à', 'á', 'ã', 'ä', 'å', 'è', 'æ', 'ê', 'ë', 'ì', 'í', 'î', 'Î', 'ï', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ñ', 'ç', 'ý', '<', '>', '&');
 $currencies = new currencies();
 //$pdf->setPreferences(array("HideToolbar" => 'false', "HideWindowUI" => 'false'));
 $pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
 $pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
 // company name and details pulled from the my store address and phone number
 // in admin configuration mystore
 $y = $pdf->ezText(STORE_NAME_ADDRESS, COMPANY_HEADER_FONT_SIZE);
 $y -= 10;
 // logo image  set to right of the above .. change first number to move sideways
 //$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85);
 // extra info boxs to be used by staff
 $pdf->setStrokeColor(0, 0, 0);
 $pdf->setLineStyle(0.5);
 $pdf->Rectangle(300, 745, 250, 70);
 $pdf->addText(310, 785, GENERAL_FONT_SIZE, TEXT_PACKED_BY);
 $pdf->addText(310, 760, GENERAL_FONT_SIZE, TEXT_VERIFIED_BY);
 // line between header order number and order date
 $pdf->setLineStyle(0.5);
 $pdf->line(LEFT_MARGIN, $y, LINE_LENGTH, $y);
 $pdf->ezSetY($y);
 $dup_y = $y;
 // order number
 $y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] . "\n\n", SUB_HEADING_FONT_SIZE);
 // order date
 if ($_POST['show_order_date']) {
     $pdf->ezSetY($dup_y);
     $pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) . "\n\n", SUB_HEADING_FONT_SIZE, array('justification' => 'right'));
 }
 // sold to info in left rectangle
 $pdf->addText(LEFT_MARGIN, $y, SUB_HEADING_FONT_SIZE, "<b>" . ENTRY_SOLD_TO . "</b>");
Example #5
0
 public function pdfObjectsDetails($result)
 {
     global $dateformat, $baseURL, $instDir, $objObserver, $loggedUser, $objLocation, $objInstrument, $objPresentations;
     $result = $this->sortResult($result);
     $pdf = new Cezpdf('a4', 'landscape');
     $pdf->selectFont($instDir . 'lib/fonts/Helvetica.afm');
     $bottom = 40;
     $bottomsection = 30;
     $top = 550;
     $header = 570;
     $footer = 10;
     $xleft = 20;
     $xmid = 431;
     $fontSizeSection = 10;
     $fontSizeText = 8;
     $descriptionLeadingSpace = 20;
     $sectionBarSpace = 3;
     $deltalineSection = 2;
     $deltaline = $fontSizeText + 4;
     $pagenr = 0;
     $y = 0;
     $xbase = $xmid;
     $sectionBarHeight = $fontSizeSection + 4;
     $SectionBarWidth = 400 + $sectionBarSpace;
     $theDate = date('d/m/Y');
     $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
     if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
         $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'firstname') . ' ' . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
     }
     $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
     $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . '1'), 'right');
     while (list($key, $valueA) = each($result)) {
         $con = $valueA['objectconstellation'];
         if ($y < $bottom) {
             $y = $top;
             if ($xbase == $xmid) {
                 if ($pagenr++) {
                     $pdf->newPage();
                     $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
                     if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
                         $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . $objObserver->getObserverProperty($loggedUser, 'firstname') . ' ' . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
                     }
                     $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
                     $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . $pagenr), 'right');
                 }
                 $xbase = $xleft;
             } else {
                 $xbase = $xmid;
             }
         }
         $pdf->addTextWrap($xbase, $y, 30, $fontSizeText, utf8_decode($valueA['objectseen']));
         // seen
         $pdf->addTextWrap($xbase + 30, $y, 40, $fontSizeText, utf8_decode($valueA['objectlastseen']));
         // last seen
         $pdf->addTextWrap($xbase + 70, $y, 85, $fontSizeText, utf8_decode('<b>' . '<c:alink:' . $baseURL . 'index.php?indexAction=detail_object&amp;object=' . urlencode($valueA['objectname']) . '>' . $valueA['showname']));
         // object
         $pdf->addTextWrap($xbase + 150, $y, 30, $fontSizeText, utf8_decode('</c:alink></b>' . $valueA['objecttype']));
         // type
         $pdf->addTextWrap($xbase + 180, $y, 20, $fontSizeText, utf8_decode($valueA['objectconstellation']));
         // constellation
         $pdf->addTextWrap($xbase + 200, $y, 17, $fontSizeText, utf8_decode($objPresentations->presentationInt1($valueA['objectmagnitude'], 99.90000000000001, '')), 'left');
         // mag
         $pdf->addTextWrap($xbase + 217, $y, 18, $fontSizeText, utf8_decode($objPresentations->presentationInt1($valueA['objectsurfacebrightness'], 99.90000000000001, '')), 'left');
         // sb
         $pdf->addTextWrap($xbase + 235, $y, 60, $fontSizeText, utf8_decode($objPresentations->raToStringHM($valueA['objectra']) . ' ' . $objPresentations->decToString($valueA['objectdecl'], 0)));
         // ra - decl
         $pdf->addTextWrap($xbase + 295, $y, 55, $fontSizeText, utf8_decode($valueA['objectsize'] . '/' . $objPresentations->presentationInt($valueA['objectpa'], 999, "-")));
         // size
         $pdf->addTextWrap($xbase + 351, $y, 17, $fontSizeText, utf8_decode($objPresentations->presentationInt1($valueA['objectcontrast'], '', '')), 'left');
         // contrast
         $pdf->addTextWrap($xbase + 368, $y, 17, $fontSizeText, utf8_decode((int) $valueA['objectoptimalmagnification']), 'left');
         // magnification
         $pdf->addTextWrap($xbase + 380, $y, 20, $fontSizeText, utf8_decode('<b>' . $valueA[$loggedUser ? $objObserver->getObserverProperty($loggedUser, 'standardAtlasCode', 'urano') : 'urano'] . '</b>'), 'right');
         // atlas page
         $y -= $deltaline;
         if (array_key_exists('objectlistdescription', $valueA) && $valueA['objectlistdescription']) {
             $theText = $objPresentations->br2nl($valueA['objectlistdescription']);
             $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, '<i>' . utf8_decode($theText));
             $y -= $deltaline;
             while ($theText) {
                 if ($y < $bottomsection) {
                     $y = $top;
                     if ($xbase == $xmid) {
                         if ($pagenr++) {
                             $pdf->newPage();
                             $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
                             if ($objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
                                 $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . $objObserver->getObserverProperty($loggedUser, 'firstname') . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
                             }
                             $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
                             $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . $pagenr), 'right');
                         }
                         $xbase = $xleft;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     } else {
                         $xbase = $xmid;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     }
                 }
                 $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, utf8_decode($theText));
                 $y -= $deltaline;
             }
             $pdf->addText(0, 0, 10, '</i>');
         } elseif (array_key_exists('objectdescription', $valueA) && $valueA['objectdescription']) {
             $theText = $objPresentations->br2nl($valueA['objectdescription']);
             $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, '<i>' . utf8_decode($theText));
             $y -= $deltaline;
             while ($theText) {
                 if ($y < $bottomsection) {
                     $y = $top;
                     if ($xbase == $xmid) {
                         if ($pagenr++) {
                             $pdf->newPage();
                             $pdf->addTextWrap($xleft, $header, 100, 8, utf8_decode($theDate));
                             if ($objObserver->getObserverProperty($loggedUser, 'name') && $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') && $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name')) {
                                 $pdf->addTextWrap($xleft, $footer, $xmid + $SectionBarWidth, 8, utf8_decode(html_entity_decode(LangPDFMessage19 . $objObserver->getObserverProperty($loggedUser, 'name') . ' ' . $objObserver->getObserverProperty($loggedUser, 'firstname') . LangPDFMessage20 . $objInstrument->getInstrumentPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdtelescope'), 'name') . ' ' . LangPDFMessage21 . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name'))), 'center');
                             }
                             $pdf->addTextWrap($xleft, $header, $xmid + $SectionBarWidth, 10, utf8_decode(html_entity_decode($_GET['pdfTitle'])), 'center');
                             $pdf->addTextWrap($xmid + $SectionBarWidth - $sectionBarSpace - 100, $header, 100, 8, utf8_decode(LangPDFMessage22 . $pagenr), 'right');
                         }
                         $xbase = $xleft;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     } else {
                         $xbase = $xmid;
                         if ($sort) {
                             $y -= $deltalineSection;
                             $pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight);
                             $pdf->addText($xbase, $y, $fontSizeSection, utf8_decode($GLOBALS[${$sort}]));
                             $y -= $deltaline + $deltalineSection;
                         }
                     }
                 }
                 $theText = $pdf->addTextWrap($xbase + $descriptionLeadingSpace, $y, $xmid - $xleft - $descriptionLeadingSpace - 10, $fontSizeText, utf8_decode($theText));
                 $y -= $deltaline;
             }
             $pdf->addText(0, 0, 10, '</i>');
         }
     }
     $pdf->Stream();
 }
include 'class.ezpdf.php';
include "rupiah.php";
include "../../Inc/koneksi.php";
include "../../Inc/fungsi_indotgl.php";
include "../../Inc/library.php";
$pdf = new Cezpdf();
// Set margin dan font
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('fonts/Courier.afm');
$all = $pdf->openObject();
$pemilik = mysql_fetch_array(mysql_query("select nm_perusahaan,alamat from bigbook_perusahaan")) or die("gagal");
// Tampilkan logo
$pdf->setStrokeColor(0, 0, 0, 1);
$pdf->addJpegFromFile('logo.jpg', 20, 785, 69);
// Teks di tengah atas untuk judul header
$pdf->addText(150, 820, 16, '<b>Laporan Penjualan Bulan' . tgl_indo(date("Ymd")) . '</b>');
$pdf->addText(200, 800, 14, '<b>' . $pemilik[nm_perusahaan] . '</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Baca input tanggal yang dikirimkan user
$mulai = $_GET[tgl1];
$selesai = $_GET[tgl2];
// Koneksi ke database dan tampilkan datanya
// Query untuk merelasikan kedua tabel di filter berdasarkan tanggal
Example #7
0
    echo "<link href='style.css' rel='stylesheet' type='text/css'>\n <center>Untuk mengakses modul, Anda harus login <br>";
    echo "<a href=../../index.php><b>LOGIN</b></a></center>";
} else {
    include "class.ezpdf.php";
    include "../../../config/koneksi.php";
    include "rupiah.php";
    $pdf = new Cezpdf();
    // Set margin dan font
    $pdf->ezSetCmMargins(3, 3, 3, 3);
    $pdf->selectFont('fonts/Courier.afm');
    $all = $pdf->openObject();
    // Tampilkan logo
    $pdf->setStrokeColor(0, 0, 0, 1);
    $pdf->addJpegFromFile('logo.jpg', 20, 800, 69);
    // Teks di tengah atas untuk judul header
    $pdf->addText(220, 820, 16, '<b>Laporan Penjualan</b>');
    $pdf->addText(200, 800, 18, '<b>Toko Komputer Wincom</b>');
    // Garis atas untuk header
    $pdf->line(10, 795, 578, 795);
    // Garis bawah untuk footer
    $pdf->line(10, 50, 578, 50);
    // Teks kiri bawah
    $pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
    $pdf->closeObject();
    // Tampilkan object di semua halaman
    $pdf->addObject($all, 'all');
    // Baca input tanggal yang dikirimkan user
    $mulai = $_POST[thn_mulai] . '-' . $_POST[bln_mulai] . '-' . $_POST[tgl_mulai];
    $selesai = $_POST[thn_selesai] . '-' . $_POST[bln_selesai] . '-' . $_POST[tgl_selesai];
    // Query untuk merelasikan kedua tabel di filter berdasarkan tanggal
    $sql = mysql_query("SELECT orders.id_orders as faktur,DATE_FORMAT(tgl_order, '%d-%m-%Y') as tanggal,\n                    nama_produk,jumlah,harga \n                    FROM orders, orders_detail, produk  \n                    WHERE (orders_detail.id_produk=produk.id_produk) \n                    AND (orders_detail.id_orders=orders.id_orders) \n                    AND (orders.status_order='Lunas') \n                    AND (orders.tgl_order BETWEEN '{$mulai}' AND '{$selesai}')");
Example #8
0
require_once "../ConectarSolo.php";
$l = Conectarse("webpmm");
$_GET[folio] = 164;
$s = "SELECT gc.folio, gc.consumomensual, DATE_FORMAT(gc.fecha, '%d/%m/%Y') AS fecha, DATE_FORMAT(gc.vigencia, '%d/%m/%Y') AS vigencia,\n\tcs.descripcion AS sucursal, gc.nvendedor, gc.idcliente, gc.rfc, concat_ws(' ',gc.nombre, gc.apaterno, gc.amaterno) as ncliente, gc.calle, gc.numero,\n\tgc.colonia, gc.cp, gc.poblacion, gc.municipio, gc.estado, gc.pais, gc.celular, gc.telefono, gc.email,\n\tgc.precioporkg, gc.precioporcaja, gc.descuentosobreflete, gc.cantidaddescuento, gc.limitekg, gc.costo,\n\tgc.preciokgexcedente, gc.prepagadas, gc.consignacionkg, gc.consignacioncaja, gc.consignaciondescuento, gc.consignaciondescantidad,\n\tgc.valordeclarado, gc.valordeclaradoemp, date_format(current_date, '%d/%m/%Y') as fechaactual\n\tFROM generacionconvenio gc\n\tLEFT JOIN catalogosucursal cs ON gc.sucursal = cs.idsucursal\n\tWHERE gc.folio = '{$_GET['folio']}'";
$r = mysql_query($s, $l) or die("error " . mysql_error($l) . "--" . $s);
$f = mysql_fetch_object($r);
include 'class.ezpdf.php';
$pdf = new Cezpdf('LETTER', 'portrait');
#					 t, b, l, r
$pdf->ezSetMargins(50, 70, 50, 50);
#w = 612 h = 792
$pdf->setColor(0.16, 0.38, 0.61);
$pdf->selectFont('fonts/Helvetica.afm');
$img = ImageCreatefromjpeg('../img/logo.jpg');
$pdf->addImage($img, 50, 697, 47, 50);
$pdf->addText(110, 722, 24, '<b>Paqueteria y Mensajeria en Movimiento</b>');
$pdf->setColor(0.79, 0.67, 0.11);
$pdf->addText(110, 702, 16, '<b>Convenio de venta de guias</b>');
$pdf->line(50, 690, 560, 690);
$pdf->setColor(0.25, 0.25, 0.25);
$pdf->ezText("\n\n\n\n{$f->fechaactual}", 12, array('justification' => 'right'));
$pdf->setColor(0.79, 0.67, 0.11);
$pdf->ezText("<b>DATOS DEL CLIENTE</b>", 12, array('justification' => 'left'));
$pdf->setColor(0.25, 0.25, 0.25);
$pdf->ezText(strtoupper("<b> NOMBRE:</b> {$f->ncliente}"), 10, array('justification' => 'left'));
$pdf->ezText(strtoupper("<b> DIRECCION:</b> {$f->calle} NO. {$f->numero}.    <b>COL:</b> {$f->colonia}.    <b>CP:</b> {$f->cp}"), 10, array('justification' => 'left'));
$pdf->ezText(strtoupper("<b> CIUDAD:</b> {$f->poblacion}.    <b>ESTADO:</b> {$f->estado}.    <b>PAIS:</b> {$f->pais} "), 10, array('justification' => 'left'));
$pdf->ezText(strtoupper("<b> TELEFONO:</b> {$f->telefono}.    <b>CELULAR:</b> {$f->celular}."), 10, array('justification' => 'left'));
$pdf->ezText(strtoupper("<b> EMAIL:</b> {$f->email}"), 10, array('justification' => 'left'));
#$pdf->line(50,590,560,590);
$s = "SELECT (SELECT COUNT(*) FROM cconvenio_servicios WHERE idconvenio = '{$_GET['folio']}' AND tipo = 'CONVENIO') c1,\n\t(SELECT COUNT(*) FROM cconvenio_servicios_sucursales WHERE idconvenio = '{$_GET['folio']}' AND tipo = 'SUCONVENIO') c2,\n\t(SELECT COUNT(*) FROM cconvenio_servicios_sucursales WHERE idconvenio = '{$_GET['folio']}' AND tipo = 'SRCONVENIO') c3";
Example #9
0
//(top, bottom, left, right)
/*
* 		Define page header to be displayed on top of each page
*/
$pdf->saveState();
if ($skip_page) {
    $pdf->ezNewPage();
}
$skip_page++;
$page_header = $pdf->openObject();
$pdf->selectFont("{$font_dir}/Helvetica-Bold.afm");
$ypos = $pdf->ez['pageHeight'] - (30 + $pdf->getFontHeight(12));
$doc_title = strEzPdf($projects[$project_id]['project_name'], UI_OUTPUT_RAW);
$pwidth = $pdf->ez['pageWidth'];
$xpos = round(($pwidth - $pdf->getTextWidth(12, $doc_title)) / 2, 2);
$pdf->addText($xpos, $ypos, 12, $doc_title);
$pdf->selectFont("{$font_dir}/Helvetica.afm");
$date = new w2p_Utilities_Date();
$xpos = round($pwidth - $pdf->getTextWidth(10, $date->format($df)) - $pdf->ez['rightMargin'], 2);
$doc_date = strEzPdf($date->format($df));
$pdf->addText($xpos, $ypos, 10, $doc_date);
$pdf->closeObject($page_header);
$pdf->addObject($page_header, 'all');
$gpdfkey = W2P_BASE_DIR . '/modules/tasks/images/ganttpdf_key.png';
$gpdfkeyNM = W2P_BASE_DIR . '/modules/tasks/images/ganttpdf_keyNM.png';
$pdf->ezStartPageNumbers(802, 30, 10, 'left', 'Page {PAGENUM} of {TOTALPAGENUM}');
for ($i = 0; $i < count($ganttfile); $i++) {
    $gf = $ganttfile[$i];
    $pdf->ezColumnsStart(array('num' => 1, 'gap' => 0));
    $pdf->ezImage($gf, 0, 765, 'width', 'left');
    // No pad, width = 800px, resize = 'none' (will go to next page if image height > remaining page space)
<?php

include 'class.ezpdf.php';
$pdf = new Cezpdf();
// Set margin dan font
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('fonts/Courier.afm');
$all = $pdf->openObject();
// Tampilkan logo
//$pdf->setStrokeColor(0, 0, 0, 1);
//$pdf->addJpegFromFile('logo.jpg',20,800,69);
// Teks di tengah atas untuk judul header
$pdf->addText(30, 820, 16, '<b>TRANSKRIP NILAI</b>');
$pdf->addText(30, 800, 16, '<b>UNIVERSITAS METRO LAMPUNG</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Koneksi ke database dan tampilkan datanya
include "../../../config/koneksi.php";
// Query untuk merelasikan kedua tabel
$nima = $_POST['nim'];
$hts = substr($_POST['tahun'], 0, 4);
$ktr = $_POST['semester'];
$sql = mysql_query("SELECT b.nmmatkul,b.sks,c.nmjur,c.nmketua,d.nama,f.nmkelas,a.* from matakuliah b,jurusan c,mahasiswa d,kelas f,krs a WHERE b.kdmatkul=a.kdmatkul AND c.kdjur=a.kdjur AND d.nim=a.nim AND f.kdkelas = a.kdkelas AND a.nim='{$_POST['nim']}' ORDER BY a.kdmatkul");
$jml = mysql_num_rows($sql);
Example #11
0
session_start();
error_reporting(0);
include "class.ezpdf.php";
include "../../../config/koneksi.php";
include "../../../config/fungsi_indotgl.php";
include "rupiah.php";
$pdf = new Cezpdf();
// Set margin dan font
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('fonts/Courier.afm');
$all = $pdf->openObject();
// Tampilkan logo
$pdf->setStrokeColor(0, 0, 0, 1);
$pdf->addJpegFromFile('logo.jpg', 20, 800, 69);
// Teks di tengah atas untuk judul header
$pdf->addText(190, 820, 16, '<b>Laporan Pemesanan Barang</b>');
$pdf->addText(200, 800, 18, '<b>Toko Komputer Anugrah com</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
$sekarang = date('Y-m-d');
// Query untuk merelasikan kedua tabel di filter berdasarkan tanggal
$sql = mysql_query("SELECT * FROM hubungi");
$jml = mysql_num_rows($sql);
if ($jml > 0) {
    $dir = $datatmp['direccion'];
    $tel = $datatmp['telefono'];
    $cel = $datatmp['celular'];
    $email = $datatmp['email'];
    $data[] = array_merge($datatmp, array('folio'));
}
$options = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'right', 'width' => 70, 'fontSize' => 8, 'xPos' => 480);
$titlef = array('folio' => '<b>Folio</b>');
$titles = array('fecha' => '<b>Fecha</b>');
$titlet = array('total' => '<b>Total</b>');
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titlef, '', $options);
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titles, '', $options);
$pdf->ezText("\n", 10);
$pdf->addText(50, 700, 12, "<b>Proveedor: </b>\n");
$pdf->addText(130, 700, 12, $datos);
$pdf->addText(50, 680, 12, "<b>Dirección: </b>\n");
$pdf->addText(130, 680, 12, $dir);
$pdf->addText(50, 660, 12, "<b>Teléfono: </b>\n");
$pdf->addText(130, 660, 12, $tel);
$pdf->addText(220, 660, 12, "<b>Celular: </b>\n");
$pdf->addText(270, 660, 12, $cel);
$pdf->addText(50, 640, 12, "<b>E-mail: </b>\n");
$pdf->addText(130, 640, 12, $email);
//RECUPERANDO DETALLE DE VENTA
$sql = mysql_query("select dv.cantidad,l.nombre_libro,dv.precio,dv.subtotal \n \t\tfrom detalle_compra dv\n \t\tinner join productos p on p.clave_producto = dv.clave_producto \n \t\tinner join libros l on l.clave_libro = p.nombre_producto \n \t\twhere folio = '" . $folio . "' ");
while ($row = mysql_fetch_array($sql)) {
    $dat[] = array_merge($row);
}
$optionsdv = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 500, 'fontSize' => 10, 'xPos' => 'center', 'cols' => array('cantidad' => array('justification' => 'center'), 'nombre_libro' => array('justification' => 'center'), 'precio' => array('justification' => 'center'), 'subtotal' => array('justification' => 'center')));
Example #13
0
    echo "<a href=../../index.php><b>LOGIN</b></a></center>";
} else {
    error_reporting(0);
    include "class.ezpdf.php";
    include "../../../config/koneksi.php";
    include "rupiah.php";
    $pdf = new Cezpdf();
    // Set margin dan font
    $pdf->ezSetCmMargins(3, 3, 3, 3);
    $pdf->selectFont('fonts/Courier.afm');
    $all = $pdf->openObject();
    // Tampilkan logo
    $pdf->setStrokeColor(0, 0, 0, 1);
    $pdf->addJpegFromFile('logo.jpg', 20, 800, 69);
    // Teks di tengah atas untuk judul header
    $pdf->addText(180, 820, 16, '<b>Laporan Penjualan Harian</b>');
    $pdf->addText(200, 800, 18, '<b>Belanjayuk</b>');
    // Garis atas untuk header
    $pdf->line(10, 795, 578, 795);
    // Garis bawah untuk footer
    $pdf->line(10, 50, 578, 50);
    // Teks kiri bawah
    $pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
    $pdf->closeObject();
    // Tampilkan object di semua halaman
    $pdf->addObject($all, 'all');
    $sekarang = date('Y-m-d');
    // Query untuk merelasikan kedua tabel di filter berdasarkan tanggal
    $sql = mysql_query("SELECT orders.id_orders as faktur,DATE_FORMAT(tgl_order, '%d-%m-%Y') as tanggal,\n                    nama_produk,jumlah,harga \n                    FROM orders, orders_detail, produk  \n                    WHERE (orders_detail.id_produk=produk.id_produk) \n                    AND (orders_detail.id_orders=orders.id_orders)\n                    AND (orders.status_order='Lunas') \n                    AND (orders.tgl_order='{$sekarang}')");
    $jml = mysql_num_rows($sql);
    if ($jml > 0) {
Example #14
0
<?php

require_once "ezpdfclass/class/class.ezpdf.php";
require_once "dbconn.php";
$pdf = new Cezpdf('letter', 'portait');
$stmt = $conn->prepare("SELECT * FROM lot WHERE lotstatus= 'Available'");
$stmt->execute();
$top = 700;
$width = 20;
$pdf->addText($width, $top, 12, "Lot ID");
$width += 50;
$pdf->addText($width + 50, $top, 12, "Sub. Name");
$width += 60;
$pdf->addText($width + 60, $top, 12, "Phase");
$width += 100;
$pdf->addText($width + 50, $top, 12, "Block");
$width += 50;
$pdf->addText($width + 50, $top, 12, "Lot No.");
$width += 50;
$pdf->addText($width + 120, $top, 12, "Price");
while ($rs = $stmt->fetch()) {
    $top -= 12;
    $width = 20;
    $pdf->addText($width, $top, 12, $rs['lot_id']);
    $width += 50;
    $pdf->addText($width + 50, $top, 12, $rs['subdname']);
    $width += 60;
    $pdf->addText($width + 60, $top, 12, $rs['phase']);
    $width += 100;
    $pdf->addText($width + 120, $top, 12, $rs['block']);
    $width += 50;
Example #15
0
 function kosten_einnahmen_pdf($geldkontos_arr, $monat, $jahr)
 {
     $anzahl_konten = count($geldkontos_arr);
     $datum_jahresanfang = "01.01.{$jahr}";
     if ($anzahl_konten) {
         ob_clean();
         // ausgabepuffer leeren
         /* PDF AUSGABE */
         //include_once ('pdfclass/class.ezpdf.php');
         $pdf = new Cezpdf('a4', 'portrait');
         $pdf->selectFont('Helvetica.afm');
         $pdf->ezSetCmMargins(4.5, 0, 0, 0);
         /* Kopfzeile */
         $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100);
         $pdf->setLineStyle(0.5);
         $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de");
         $pdf->line(42, 750, 550, 750);
         /* Footer */
         $pdf->line(42, 50, 550, 50);
         $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG *  Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim");
         $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin * BLZ: 100  800  00 * Konto-Nr.: 05 804 000 00 * Steuernummer: 24/582/61188");
         $pdf->addInfo('Title', "Monatsbericht {$objekt_name} {$monatname} {$jahr}");
         $pdf->addInfo('Author', $_SESSION['username']);
         $pdf->ezStartPageNumbers(100, 760, 8, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1);
         $g_kosten_jahr = 0.0;
         /* Schleife für jedes Geldkonto bzw. Zeilenausgabe */
         for ($a = 0; $a < $anzahl_konten; $a++) {
             $geldkonto_id = $geldkontos_arr[$a]['GELDKONTO_ID'];
             $objekt_name = $geldkontos_arr[$a]['OBJEKT_NAME'];
             $this->kontostand_tagesgenau_bis($geldkonto_id, $datum_jahresanfang);
             $kontostand_jahresanfang = $this->summe_konto_buchungen;
             $this->summe_kontobuchungen_jahr_monat($geldkonto_id, '80001', $jahr, $monat);
             $summe_mieteinnahmen_monat = $this->summe_konto_buchungen;
             $this->summe_miete_jahr($geldkonto_id, '80001', $jahr, $monat);
             $summe_mieteinnahmen_jahr = $this->summe_konto_buchungen;
             $this->summe_kosten_jahr_monat($geldkonto_id, '80001', $jahr, $monat);
             $summe_kosten_monat = $this->summe_konto_buchungen;
             $this->summe_kosten_jahr($geldkonto_id, '80001', $jahr, $monat);
             $summe_kosten_jahr = $this->summe_konto_buchungen;
             /*
              * if($monat < 12){
              * $monat_neu = $monat + 1;
              * $jahr_neu = $jahr;
              * }
              * if($monat == 12){
              * $monat_neu = 1;
              * $jahr_neu = $jahr +1;
              * }
              */
             $monat = sprintf('%02d', $monat);
             $letzter_tag_m = letzter_tag_im_monat($monat, $jahr);
             $datum_bis = "{$letzter_tag_m}.{$monat}.{$jahr}";
             $this->kontostand_tagesgenau_bis($geldkonto_id, $datum_bis);
             $kontostand_heute = $this->summe_konto_buchungen;
             $monatname = monat2name($monat);
             /* Gesamtsummen bilden */
             $g_kontostand_ja = $g_kontostand_ja + $kontostand_jahresanfang;
             $g_me_monat = $g_me_monat + $summe_mieteinnahmen_monat;
             $g_me_jahr = $g_me_jahr + $summe_mieteinnahmen_jahr;
             $g_kosten_monat = $g_kosten_monat + $summe_kosten_monat;
             $g_kosten_jahr += $summe_kosten_jahr;
             $g_kontostand_akt = $g_kontostand_akt + $kontostand_heute;
             $kontostand_jahresanfang = nummer_punkt2komma($kontostand_jahresanfang);
             $summe_mieteinnahmen_monat = nummer_punkt2komma($summe_mieteinnahmen_monat);
             $summe_mieteinnahmen_jahr = nummer_punkt2komma($summe_mieteinnahmen_jahr);
             $summe_kosten_monat = nummer_punkt2komma($summe_kosten_monat);
             $summe_kosten_jahr = nummer_punkt2komma($summe_kosten_jahr);
             $kontostand_heute = nummer_punkt2komma($kontostand_heute);
             // echo "<b>$kontostand_jahresanfang| $summe_mieteinnahmen_monat|$summe_mieteinnahmen_jahr|$summe_kosten_monat|$summe_kosten_jahr|$kontostand_heute</b><br>";
             $table_arr[$a]['OBJEKT_NAME'] = $objekt_name;
             $table_arr[$a]['KONTOSTAND1_1'] = $kontostand_jahresanfang;
             $table_arr[$a]['ME_MONAT'] = $summe_mieteinnahmen_monat;
             $table_arr[$a]['ME_JAHR'] = $summe_mieteinnahmen_jahr;
             $table_arr[$a]['KOSTEN_MONAT'] = $summe_kosten_monat;
             $table_arr[$a]['KOSTEN_JAHR'] = $summe_kosten_jahr;
             $table_arr[$a]['KONTOSTAND_AKTUELL'] = "<b>{$kontostand_heute}</b>";
         }
         // end for
         /* Summenzeile hinzufügen */
         $table_arr[$a]['OBJEKT_NAME'] = "<b>Summe incl. FON</b>";
         $table_arr[$a]['KONTOSTAND1_1'] = '<b>' . nummer_punkt2komma($g_kontostand_ja) . '</b>';
         $table_arr[$a]['ME_MONAT'] = '<b>' . nummer_punkt2komma($g_me_monat) . '</b>';
         $table_arr[$a]['ME_JAHR'] = '<b>' . nummer_punkt2komma($g_me_jahr) . '</b>';
         $table_arr[$a]['KOSTEN_MONAT'] = '<b>' . nummer_punkt2komma($g_kosten_monat) . '</b>';
         $table_arr[$a]['KOSTEN_JAHR'] = '<b>' . nummer_punkt2komma($g_kosten_jahr) . '</b>';
         $table_arr[$a]['KONTOSTAND_AKTUELL'] = '<b>' . nummer_punkt2komma($g_kontostand_akt) . '</b>';
         $pdf->ezTable($table_arr, array('OBJEKT_NAME' => 'Objekt', 'KONTOSTAND1_1' => "Kontostand {$datum_jahresanfang}", 'ME_MONAT' => "Mieten Einnahmen {$monatname}", 'ME_JAHR' => "Mieten Einnahmen {$jahr}", 'KOSTEN_MONAT' => "Kosten {$monatname}", 'KOSTEN_JAHR' => "Kosten {$jahr}", 'KONTOSTAND_AKTUELL' => "Kontostand"), '<b>Kosten & Einnahmen / Objekt (Tabellarische übersicht)</b>', array('shaded' => 0, 'width' => '500', 'justification' => 'right', 'cols' => array('KONTOSTAND1_1' => array('justification' => 'right'), 'ME_MONAT' => array('justification' => 'right'), 'ME_MONAT' => array('justification' => 'right'), 'ME_JAHR' => array('justification' => 'right'), 'KOSTEN_MONAT' => array('justification' => 'right'), 'KOSTEN_JAHR' => array('justification' => 'right'), 'KONTOSTAND_AKTUELL' => array('justification' => 'right'))));
         ob_clean();
         // ausgabepuffer leeren
         header("Content-type: application/pdf");
         // wird von MSIE ignoriert
         $pdf->ezStream();
     } else {
         echo "Keine Daten Error 65922";
     }
 }
 /**
  * Crea un pdf con el estado de cuenta de el cliente especificado
  * @param Array $args,  $args['id_cliente'=>12[,'tipo_venta'=> 'credito | contado | saldo'] ], por default obtiene todas las compras del cliente
  */
 public static function imprimirEstadoCuentaCliente($args)
 {
     //verificamos que se haya especificado el id del cliente
     if (!isset($args['id_cliente'])) {
         Logger::log("Error al obtener el estado de cuenta, no se ha especificado un cliente.");
         die('{"success": false, "reason": "Error al obtener el estado de cuenta, no se ha especificado un cliente."}');
     }
     //verificamos que el cliente exista
     if (!($cliente = ClienteDAO::getByPK($args['id_cliente']))) {
         Logger::log("Error al obtener el estado de cuenta, no se tiene registro del cliente {$args['id_cliente']}.");
         die('{"success": false, "reason": "Error al obtener el estado de cuenta, no se tiene registro del cliente ' . $args['id_cliente'] . '"}');
     }
     //obtenemos los datos del emisor
     $estado_cuenta = estadoCuentaCliente($args);
     //buscar los datos del emisor
     if (!($emisor = PosConfigDAO::getByPK('emisor'))) {
         Logger::log("no encuentro los datos del emisor");
         die("no encuentro los datos del emisor");
     }
     $emisor = json_decode($emisor->getValue())->emisor;
     $sucursal = SucursalDAO::getByPK($_SESSION['sucursal']);
     if (!$sucursal) {
         die("Sucursal invalida");
     }
     include_once 'librerias/ezpdf/class.pdf.php';
     include_once 'librerias/ezpdf/class.ezpdf.php';
     $pdf = new Cezpdf();
     $pdf->selectFont('../server/librerias/ezpdf/fonts/Helvetica.afm');
     //margenes de un centimetro para toda la pagina
     $pdf->ezSetMargins(1, 1, 1, 1);
     /*
      * LOGO
      */
     if (!($logo = PosConfigDAO::getByPK('url_logo'))) {
         Logger::log("Verifique la configuracion del pos_config, no se encontro el camṕo 'url_logo'");
         die("Verifique la configuracion del POS, no se encontro el url del logo");
     }
     //addJpegFromFile(imgFileName,x,y,w,[h])
     //detectamos el tipo de imagen del logo
     if (substr($logo->getValue(), -3) == "jpg" || substr($logo->getValue(), -3) == "JPG" || substr($logo->getValue(), -4) == "jpeg" || substr($logo->getValue(), -4) == "JPEG") {
         $pdf->addJpegFromFile($logo->getValue(), puntos_cm(2), puntos_cm(25.5), puntos_cm(3.5));
     } elseif (substr($logo->getValue(), -3) == "png" || substr($logo->getValue(), -3) == "PNG") {
         $pdf->addPngFromFile($logo->getValue(), puntos_cm(2), puntos_cm(25.5), puntos_cm(3.5));
     } else {
         Logger::log("Verifique la configuracion del pos_config, la extension de la imagen del logo no es compatible");
         die("La extension de la imagen usada para el logo del negocio no es valida.");
     }
     /*     * ************************
      * ENCABEZADO
      * ************************* */
     $e = "<b>" . self::readableText($emisor->nombre) . "</b>\n";
     $e .= formatAddress($emisor);
     $e .= "RFC: " . $emisor->rfc . "\n\n";
     //datos de la sucursal
     $e .= "<b>Lugar de expedicion</b>\n";
     $e .= self::readableText($sucursal->getDescripcion()) . "\n";
     $e .= formatAddress($sucursal);
     $datos = array(array("emisor" => $e));
     $pdf->ezSetY(puntos_cm(28.6));
     $opciones_tabla = array();
     $opciones_tabla['showLines'] = 0;
     $opciones_tabla['showHeadings'] = 0;
     $opciones_tabla['shaded'] = 0;
     $opciones_tabla['fontSize'] = 8;
     $opciones_tabla['xOrientation'] = 'right';
     $opciones_tabla['xPos'] = puntos_cm(7.3);
     $opciones_tabla['width'] = puntos_cm(11);
     $opciones_tabla['textCol'] = array(0, 0, 0);
     $opciones_tabla['titleFontSize'] = 12;
     $opciones_tabla['rowGap'] = 3;
     $opciones_tabla['colGap'] = 3;
     $pdf->ezTable($datos, "", "", $opciones_tabla);
     $cajero = UsuarioDAO::getByPK($_SESSION['userid'])->getNombre();
     $datos = array(array("col" => "<b>Cajero</b>"), array("col" => self::readableText($cajero)), array("col" => "<b>Cliente</b>"), array("col" => self::readableText($cliente->getRazonSocial())), array("col" => "<b>Limite de  Credito</b>"), array("col" => FormatMoney($estado_cuenta->limite_credito, DONT_USE_HTML)), array("col" => "<b>Saldo</b>"), array("col" => FormatMoney($estado_cuenta->saldo, DONT_USE_HTML)));
     $pdf->ezSetY(puntos_cm(28.8));
     $opciones_tabla['xPos'] = puntos_cm(12.2);
     $opciones_tabla['width'] = puntos_cm(6);
     $opciones_tabla['showLines'] = 0;
     $opciones_tabla['shaded'] = 2;
     $opciones_tabla['shadeCol'] = array(1, 1, 1);
     //$opciones_tabla['shadeCol2'] = array(0.054901961, 0.756862745, 0.196078431);
     $opciones_tabla['shadeCol2'] = array(0.8984375, 0.95703125, 0.99609375);
     $pdf->ezTable($datos, "", "", $opciones_tabla);
     //roundRect($pdf, puntos_cm(12.2), puntos_cm(28.8), puntos_cm(6), puntos_cm(4.25));
     /**
      * ESTADO DE CUENTA
      */
     $elementos = array(array('id_venta' => 'Venta', 'fecha' => 'Fecha', 'sucursal' => 'Sucursal', 'cajero' => 'Cajero', 'tipo_venta' => 'Tipo', 'tipo_pago' => 'Pago', 'total' => 'Total', 'pagado' => 'Pagado', 'saldo' => 'Saldo'));
     foreach ($estado_cuenta->array_ventas as $venta) {
         $array_venta = array();
         $array_venta['id_venta'] = $venta['id_venta'];
         $array_venta['fecha'] = $venta['fecha'];
         $array_venta['sucursal'] = self::readableText($venta['sucursal']);
         $array_venta['cajero'] = self::readableText($venta['cajero']);
         $array_venta['cancelada'] = self::readableText($venta['cancelada']);
         $array_venta['tipo_venta'] = self::readableText($venta['tipo_venta']);
         $array_venta['tipo_pago'] = self::readableText($venta['tipo_pago']);
         $array_venta['total'] = FormatMoney($venta['total'], DONT_USE_HTML);
         $array_venta['pagado'] = FormatMoney($venta['pagado'], DONT_USE_HTML);
         $array_venta['saldo'] = FormatMoney($venta['saldo'], DONT_USE_HTML);
         array_push($elementos, $array_venta);
     }
     $pdf->ezText("", 8, array('justification' => 'center'));
     $pdf->ezSetY(puntos_cm(24));
     $opciones_tabla['xPos'] = puntos_cm(2);
     $opciones_tabla['width'] = puntos_cm(16.2);
     $pdf->ezTable($elementos, "", "Estado de Cuenta", $opciones_tabla);
     //roundRect($pdf, puntos_cm(2), puntos_cm(24.3), puntos_cm(16.2), puntos_cm(3.2));
     /*     * ************************
      * notas de abajo
      * ************************* */
     $pdf->setLineStyle(1);
     $pdf->setStrokeColor(0.3359375, 0.578125, 0.89453125);
     $pdf->line(puntos_cm(2), puntos_cm(1.3), puntos_cm(18.2), puntos_cm(1.3));
     $pdf->addText(puntos_cm(2), puntos_cm(1.0), 7, "Fecha de impresion: " . date("d/m/y") . " " . date("H:i:s"));
     //addJpegFromFile(imgFileName,x,y,w,[h])
     //$pdf->addJpegFromFile("../www/media/logo_simbolo.jpg", puntos_cm(15.9), puntos_cm(.25), 25);
     $pdf->addText(puntos_cm(16.7), puntos_cm(0.6), 8, "caffeina.mx");
     $pdf->ezStream();
 }
Example #17
0
        $form->fieldset("Monatsbericht", 'monatsbericht');
        $b->monatsbericht_mit_ausgezogenen();
        $form->fieldset_ende();
        break;
    case "test":
        ob_clean();
        // ausgabepuffer leeren
        //include_once ('pdfclass/class.ezpdf.php');
        $pdf = new Cezpdf('a4', 'portrait');
        $pdf->ezSetCmMargins(4.5, 2.5, 2.5, 2.5);
        $berlus_schrift = 'pdfclass/fonts/Times-Roman.afm';
        $text_schrift = 'pdfclass/fonts/Arial.afm';
        $pdf->addJpegFromFile('includes/logos/hv_logo198_80.jpg', 450, 780, 100, 42);
        $pdf->setLineStyle(0.5);
        $pdf->selectFont($berlus_schrift);
        $pdf->addText(42, 743, 6, "BERLUS HAUSVERWALTUNG - Fontanestr. 1 - 14193 Berlin");
        $pdf->line(42, 750, 550, 750);
        $seite = $pdf->ezGetCurrentPageNumber();
        $alle_seiten = $pdf->ezPageCount;
        $data55 = array(array('num' => 1, 'name' => 'gandalf', 'type' => 'wizard'), array('num' => 2, 'name' => 'bilbo', 'type' => 'hobbit', 'url' => 'http://www.ros.co.
nz/pdf/'), array('num' => 3, 'name' => 'frodo', 'type' => 'hobbit'), array('num' => 4, 'name' => 'saruman', 'type' => 'bad
dude', 'url' => 'http://sourceforge.net/projects/pdf-php'), array('num' => 5, 'name' => 'sauron', 'type' => 'really bad dude'));
        $pdf->ezTable($data55);
        // header('Content-type: application/pdf');
        // header('Content-Disposition: attachment; filename="downloaded.pdf"');
        // $output = $pdf->Output();
        // $len = strlen($output);
        // header("Content-type: application/pdf"); // wird von MSIE ignoriert
        // header("content-length: $len");
        // header("Content-Disposition: inline; filename=test.pdf"); //im fenster
        // header("Content-Disposition: attachment; filename=test.pdf");
Example #18
0
function creaPDF($colname_factura, $tmpName)
{
    global $database_f4, $f4, $interface, $setsProlec, $url_dir;
    $FWK_PDFFONTS = 'pdf/fonts/';
    $FWK_PDFDEFAULTFONT = '/face5/' . $url_dir . '/f4/extensiones/pdf/fonts/Helvetica.afm';
    $FWK_PDFCOURIERFONT = 'pdf/fonts/Courier.afm';
    // Obtener factura y sus anexos
    $TIPOSCOMPROBANTEMXP = array(1 => "Factura", 3 => "Nota de Cr.", 2 => "NOTA DE DEBITO");
    mysql_select_db($database_f4, $f4);
    $query_factura = sprintf("SELECT  facturas.idfactura,  facturas.idempresa,  facturas.idsello,\n\tfacturas.serie, facturas.folio, archivo,\n\tdate_format( facturas.timestampemision, '%%d/%%m/%%Y %%T') as timestampemision,\n\tfacturas.noaprob, facturas.rfccliente, facturas.estatus, facturas.sello, facturas.cadena, facturas.factura,\n\tfacturas.idif, facturas.tipocfd, empresa.bu\n\tFROM facturas inner join empresa on (facturas.idempresa=empresa.idempresa)\n\tWHERE facturas.idfactura = %s", $colname_factura);
    $factura = mysql_query($query_factura, $f4);
    $row_factura = mysql_fetch_assoc($factura);
    $totalRows_factura = mysql_num_rows($factura);
    print_r($row_factura);
    mysql_select_db($database_f4, $f4);
    $query_partida = sprintf("SELECT * FROM face_partidas WHERE face_factura_idface_factura = %s ORDER BY numero ASC", $row_factura['idif']);
    $partidas = mysql_query($query_partida, $f4);
    $partidasArray = array();
    while ($partRow = mysql_fetch_assoc($partidas)) {
        array_push($partidasArray, $partRow);
    }
    $dom = new DOMDocument();
    $dom->loadXML(base64_decode($row_factura['factura']));
    $NS = "http://www.sat.gob.mx/cfd/2";
    $NSP = "";
    $xp = new DOMXPath($dom);
    $nsElems = $dom->getElementsByTagNameNS($NS, 'Comprobante');
    if ($nsElems->item(0) != null) {
        $xp->registerNamespace("C", "http://www.sat.gob.mx/cfd/2");
        $NSP = "C:";
    }
    $comprobanteNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante");
    foreach ($elements as $comprobanteNode) {
    }
    $emisorNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Emisor");
    foreach ($elements as $emisorNode) {
    }
    $emisordomicilioNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Emisor/" . $NSP . "DomicilioFiscal");
    foreach ($elements as $emisordomicilioNode) {
    }
    $expedidoNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Emisor/" . $NSP . "ExpedidoEn");
    foreach ($elements as $expedidoNode) {
    }
    $receptorNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Receptor");
    foreach ($elements as $receptorNode) {
    }
    $receptordomicilioNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Receptor/" . $NSP . "Domicilio");
    foreach ($elements as $receptordomicilioNode) {
    }
    $conceptoNode = null;
    $conceptos = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Conceptos/" . $NSP . "Concepto");
    $impuestosNode = null;
    $elements = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Impuestos");
    foreach ($elements as $impuestosNode) {
    }
    $trasladoNode = null;
    $traslados = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Impuestos/" . $NSP . "Traslados/" . $NSP . "Traslado");
    $retencionNode = null;
    $retenciones = $xp->query("/" . $NSP . "Comprobante/" . $NSP . "Impuestos/" . $NSP . "Retenciones/" . $NSP . "Retencion");
    mysql_select_db($database_f4, $f4);
    $query_empresa = sprintf("SELECT * FROM empresa WHERE idempresa = %s", $row_factura['idempresa']);
    $empresa = mysql_query($query_empresa, $f4);
    $row_empresa = mysql_fetch_assoc($empresa);
    mysql_select_db($database_f4, $f4);
    $query_sello = sprintf("SELECT * FROM sellos WHERE idsello = %s", $row_factura['idsello']);
    $sello = mysql_query($query_sello, $f4);
    $row_sello = mysql_fetch_assoc($sello);
    mysql_select_db($database_f4, $f4);
    $query_sucursal = "SELECT * FROM sucursales WHERE sucursal = '" . $row_sello['sucursal'] . "'";
    $sucursal = mysql_query($query_sucursal, $f4);
    $row_sucursal = mysql_fetch_assoc($sucursal);
    $totalRows_sucursal = mysql_num_rows($sucursal);
    //descuentos
    $desc1 = 0.0;
    $desc2 = 0.0;
    //==================================================================================================================
    // Crea el documento pdf
    $pdf = new Cezpdf('LETTER', 'portrait');
    //'LETTER' (612.00,792.00)
    $pdf->ezSetMargins(100, 30, 30, 30);
    //$pdf->selectFont($FWK_PDFDEFAULTFONT);
    $pdf->setLineStyle(0.7, '', '', '', 0);
    $pdf->openHere('Fit');
    if ($row_factura['tipocfd'] == 3) {
        $pdf->setStrokeColor(255, 0, 0);
    }
    if ($row_factura['tipocfd'] == 2) {
        $pdf->setStrokeColor(0, 255, 0);
    }
    // Inicia numeracin de páginas.
    $pdf->ezStartPageNumbers(400, 50, 10, 'left', '{PAGENUM} of {TOTALPAGENUM}', 1);
    $pagina = 1;
    $primeraPagina = $pdf->currentPage;
    // i. Agrega el logo de la empresa
    $logofile = "logos/prueba_logo.jpg";
    //TENDRA QUE VENIR DE UN PARAMETRO EN LA BD.
    $pdf->addJpegFromFile($logofile, 30, 655, 200);
    // i. Agrega la leyenda "cancelada"
    if ($row_factura['estatus'] == 0) {
        $pdf->setColor(0.9, 0.9, 0.9);
        $pdf->addText(180, 200, 65, "<b>CANCELADA</b>", -45);
        $pdf->setColor(0, 0, 0);
    }
    // ------------------------------------------ENCABEZADO ------------------------------------------
    //ENCABEZADO DE LA FACTURA
    $tipoDocto = $TIPOSCOMPROBANTEMXP[$row_factura['tipocfd']];
    $emisor = utf8_decode($emisorNode->getAttribute('rfc')) . "\n";
    $emisor .= utf8_decode($emisordomicilioNode->getAttribute('calle') . " " . $emisordomicilioNode->getAttribute('noExterior') . " " . $emisordomicilioNode->getAttribute('noInterior')) . "\n";
    $emisor .= utf8_decode($emisordomicilioNode->getAttribute('colonia'));
    if ($emisordomicilioNode->getAttribute('localidad') != "") {
        $emisor .= "\n" . utf8_decode($emisordomicilioNode->getAttribute('localidad'));
    }
    if ($emisordomicilioNode->getAttribute('municipio') != "") {
        $emisor .= "\n" . utf8_decode($emisordomicilioNode->getAttribute('municipio'));
    }
    if ($emisordomicilioNode->getAttribute('estado') != "") {
        $emisor .= ", " . utf8_decode($emisordomicilioNode->getAttribute('estado'));
    }
    if ($emisordomicilioNode->getAttribute('codigoPostal') != "") {
        $emisor .= "\nCP " . utf8_decode($emisordomicilioNode->getAttribute('codigoPostal'));
    }
    $emisor .= " " . utf8_decode($emisordomicilioNode->getAttribute('pais'));
    $sucursal = "";
    if ($row_sucursal['sucursal'] != "Principal_") {
        $sucursal = "Sucursal " . utf8_decode($row_sucursal['sucursal']) . "\n";
        $sucursal .= utf8_decode($expedidoNode->getAttribute('calle') . " " . $expedidoNode->getAttribute('noExterior') . " " . $expedidoNode->getAttribute('noInterior')) . "\n";
        $sucursal .= utf8_decode($expedidoNode->getAttribute('colonia')) . "\n";
        $sucursal .= utf8_decode($expedidoNode->getAttribute('municipio')) . ", " . utf8_decode($expedidoNode->getAttribute('estado')) . "\n";
        $sucursal .= "CP " . utf8_decode($expedidoNode->getAttribute('codigoPostal')) . " " . utf8_decode($expedidoNode->getAttribute('pais'));
    }
    ////////// i. Nombre del emisor
    $tableData = array(array("dato" => "<b>Obintel S.A. de C.V.</b>"));
    $colOptions = array("dato" => array('justification' => 'left', 'width' => 200));
    $options = array('showLines' => 0, 'showHeadings' => 0, 'shaded' => 0, 'shadeCol' => array(1, 1, 1), 'fontSize' => 9, 'textCol' => array(0, 0, 0), 'rowGap' => 0, 'colGap' => 0, 'xPos' => 240, 'xOrientation' => 'right', 'width' => 200, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla nombre del emisor
    $pdf->ezSetY(714);
    $pdf->ezTable($tableData, $colNames, "", $options);
    ////////// i. Datos del emisor y de la sucursal
    $tableData = array(array("emisor" => $emisor, "espacio" => "", "sucursal" => $sucursal));
    $colOptions = array("emisor" => array('justification' => 'left', 'width' => 205), "espacio" => array('justification' => 'left', 'width' => 10), "sucursal" => array('justification' => 'left', 'width' => 120));
    $options = array('showLines' => 0, 'showHeadings' => 0, 'shaded' => 0, 'shadeCol' => array(1, 1, 1), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 0, 'colGap' => 0, 'xPos' => 240, 'xOrientation' => 'right', 'width' => 335, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla
    $pdf->ezSetDy(-6);
    $pdf->ezTable($tableData, "", "", $options);
    ////////// i. Datos del documento
    $foliodocto = rellena("0", 6, $comprobanteNode->getAttribute('folio'));
    $seriedocto = $comprobanteNode->getAttribute('serie');
    if (!empty($seriedocto)) {
        $foliodocto = $seriedocto . "-" . rellena("0", 6, $comprobanteNode->getAttribute('folio'));
    }
    $fechastr = $comprobanteNode->getAttribute('fecha');
    $fechatok = explode("T", $fechastr);
    $toksf = explode("-", $fechatok[0]);
    $fechastr = $toksf[2] . "-" . $toksf[1] . "-" . $toksf[0] . " " . $fechatok[1];
    $ncert = $comprobanteNode->getAttribute('noCertificado');
    $aprob = $comprobanteNode->getAttribute('anoAprobacion') . "-" . $comprobanteNode->getAttribute('noAprobacion');
    $tableData = array(array("dato" => "<b>" . $tipoDocto . "</b>"), array("dato" => "<b>" . $foliodocto . "</b>"), array("dato" => "Fecha"), array("dato" => $fechastr), array("dato" => "Certificado"), array("dato" => $ncert), array("dato" => "Año y No. Aprobación"), array("dato" => $aprob));
    $colOptions = array("dato" => array('justification' => 'left', 'width' => 120));
    $options = array('showLines' => 1, 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.9, 0.9, 0.9), 'fontSize' => 7, 'textCol' => array(1, 1, 1), 'rowGap' => 2, 'colGap' => 5, 'xPos' => 455, 'xOrientation' => 'right', 'width' => 120, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla datos del documento
    //$pdf->ezSetDy(-12);
    $pdf->ezTable($tableData, "", "", $options);
    ////////// i. Datos del cliente
    $tableData = array(array("dato" => "<b>Cliente</b>"), array("dato" => utf8_decode($receptorNode->getAttribute('nombre'))), array("dato" => utf8_decode($receptorNode->getAttribute('rfc'))), array("dato" => utf8_decode($receptordomicilioNode->getAttribute('calle')) . " " . utf8_decode($receptordomicilioNode->getAttribute('noExterior')) . " " . utf8_decode($receptordomicilioNode->getAttribute('noInterior')) . " " . utf8_decode($receptordomicilioNode->getAttribute('colonia'))), array("dato" => utf8_decode($receptordomicilioNode->getAttribute('municipio')) . ", " . utf8_decode($receptordomicilioNode->getAttribute('estado'))), array("dato" => utf8_decode($receptordomicilioNode->getAttribute('estado'))), array("dato" => utf8_decode($receptordomicilioNode->getAttribute('codigoPostal'))));
    $colOptions = array("dato" => array('justification' => 'left', 'width' => 410));
    $options = array('showLines' => 1, 'showHeadings' => 0, 'shaded' => 1, 'shadeCol' => array(0.9, 0.9, 0.9), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 2, 'colGap' => 5, 'xPos' => 35, 'xOrientation' => 'right', 'width' => 410, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla datos del cliente
    $pdf->ezSetDy(84);
    $pdf->ezTable($tableData, "", "", $options);
    $actualY = $pdf->y;
    $pdf->setColor(0, 0, 0);
    $pdf->filledRectangle(30, $actualY - 30, 540, 18);
    $pdf->ezSetY($actualY - 15);
    $pdf->setColor(1, 1, 1);
    $pdf->ezText("<b>Cant</b>", 7, array('left' => 18, 'justification' => 'left'));
    $pdf->ezSetY($actualY - 15);
    $pdf->ezText("<b>Descripción</b>", 7, array('left' => 55, 'justification' => 'left'));
    $pdf->ezSetY($actualY - 15);
    $pdf->ezText("<b>Unitario</b>", 7, array('left' => 448, 'justification' => 'left'));
    $pdf->ezSetY($actualY - 15);
    $pdf->ezText("<b>Importe</b>", 7, array('left' => 513, 'justification' => 'left'));
    ////////// i. Partidas
    $tableData = array();
    $renglones = 0;
    $rowData = array("cantidad" => "", "descripcion" => "", "unitario" => "", "importe" => "");
    $partidaCnt = 0;
    foreach ($conceptos as $conceptoNode) {
        $partidaCnt++;
        $renglones += 2;
        $currentObj = array();
        $currentObj["cantidad"] = number_format(abs(doubleval($conceptoNode->getAttribute('cantidad'))), 0);
        $currentObj["descripcion"] = utf8_decode($conceptoNode->getAttribute('descripcion'));
        $currentObj["unitario"] = number_format($conceptoNode->getAttribute('valorUnitario'), 2);
        $currentObj["importe"] = number_format(doubleval($conceptoNode->getAttribute('importe')), 2);
        array_push($tableData, $currentObj);
    }
    $currentObj = array();
    $currentObj["cantidad"] = "";
    $currentObj["descripcion"] = "";
    $currentObj["unitario"] = "";
    $currentObj["importe"] = "";
    if ($renglones < 10) {
        for ($renglones; $renglones < 10; $renglones++) {
            array_push($tableData, $currentObj);
        }
    }
    $colNames = array("cantidad" => "<b>Cant</b>", "descripcion" => "<b>Descripción</b>", "unitario" => "<b>Unitario</b>", "importe" => "<b>Precio</b>");
    $colOptions = array("cantidad" => array('justification' => 'center', 'width' => 50), "descripcion" => array('justification' => 'left', 'width' => 370), "unitario" => array('justification' => 'right', 'width' => 60), "importe" => array('justification' => 'right', 'width' => 60));
    $options = array('showLines' => 1, 'showHeadings' => 1, 'shaded' => 1, 'shadeCol' => array(0.9, 0.9, 0.9), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 4, 'colGap' => 5, 'xPos' => 35, 'xOrientation' => 'right', 'width' => 410, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla partidas
    $pdf->ezSetDy(11);
    $pdf->ezTable($tableData, $colNames, "", $options);
    ////////// i. Cantidad con letra
    $cadena = covertirNumLetras(number_format($comprobanteNode->getAttribute('total'), 2, ".", ''));
    $tableData = array(array("dato" => "<b>Total con letra</b>\n" . trim($cadena)));
    $colNames = array("dato" => "<b>Cant</b>");
    $colOptions = array("dato" => array('justification' => 'left', 'width' => 420));
    $options = array('showLines' => 1, 'showHeadings' => 0, 'shaded' => 0, 'shadeCol' => array(0.9, 0.9, 0.9), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 10, 'colGap' => 10, 'xPos' => 40, 'xOrientation' => 'right', 'width' => 120, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla cantidad con letra
    $pdf->ezSetDy(0);
    $pdf->ezTable($tableData, $colNames, "", $options);
    ////////// i. Totales
    $f_importe = "\$" . number_format($comprobanteNode->getAttribute('subTotal'), 2);
    $f_iva_T = $impuestosNode->getAttribute('totalImpuestosTrasladados');
    $f_total = "\$" . number_format($comprobanteNode->getAttribute('total'), 2);
    $tableData = array();
    $rowData = array("leyenda" => "", "cantidad" => "");
    $subtotal = array("dato" => "Subtotal", "valor" => $f_importe);
    array_push($tableData, $subtotal);
    foreach ($traslados as $trasladoNode) {
        $tasaImpuesto = array();
        $tasaImpuesto_t = number_format($trasladoNode->getAttribute('tasa'), 0);
        $tasaImpuesto["dato"] = $trasladoNode->getAttribute('impuesto') . " " . $tasaImpuesto_t . "%";
        $tasaImpuesto["valor"] = "\$" . number_format($trasladoNode->getAttribute('importe'), 2);
        array_push($tableData, $tasaImpuesto);
    }
    foreach ($retenciones as $retencionNode) {
        $tasaImpuesto = array();
        $tasaImpuesto_t = number_format($retencionNode->getAttribute('tasa'), 0);
        $tasaImpuesto["dato"] = "Ret. " . $retencionNode->getAttribute('impuesto') . " " . $tasaImpuesto_t . "%";
        $tasaImpuesto["valor"] = "\$" . number_format($retencionNode->getAttribute('importe'), 2);
        array_push($tableData, $tasaImpuesto);
    }
    $total = array("dato" => "<b>Total</b>", "valor" => "<b>" . $f_total . "</b>");
    array_push($tableData, $total);
    $colNames = array("dato" => "<b>Cant</b>", "valor" => "Precio");
    $colOptions = array("dato" => array('justification' => 'right', 'width' => 60), "valor" => array('justification' => 'right', 'width' => 60));
    $options = array('showLines' => 1, 'showHeadings' => 0, 'shaded' => 1, 'shadeCol' => array(0.9, 0.9, 0.9), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 3, 'colGap' => 5, 'xPos' => 455, 'xOrientation' => 'right', 'width' => 120, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla totales
    $pdf->ezSetDy(36);
    $pdf->ezTable($tableData, $colNames, "", $options);
    ////////// i. Sello
    $tableData = array(array("dato" => "<b>Sello Digital</b>\n" . $row_factura['sello']));
    $colNames = array("dato" => "<b>Cant</b>");
    $colOptions = array("dato" => array('justification' => 'left', 'width' => 400));
    $options = array('showLines' => 1, 'showHeadings' => 0, 'shaded' => 0, 'shadeCol' => array(0.8, 0.8, 0.8), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 10, 'colGap' => 10, 'xPos' => 40, 'xOrientation' => 'right', 'width' => 120, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla sello
    $pdf->ezSetDy(-5);
    $pdf->ezTable($tableData, $colNames, "", $options);
    ////////// i. Cadena original
    $tableData = array(array("dato" => "<b>Cadena Original</b>\n" . utf8_decode(utf8_decode($row_factura['cadena']))));
    $colNames = array("dato" => "<b>Cant</b>");
    $colOptions = array("dato" => array('justification' => 'left', 'width' => 400));
    $options = array('showLines' => 1, 'showHeadings' => 0, 'shaded' => 0, 'shadeCol' => array(0.8, 0.8, 0.8), 'fontSize' => 7, 'textCol' => array(0, 0, 0), 'rowGap' => 10, 'colGap' => 10, 'xPos' => 40, 'xOrientation' => 'right', 'width' => 120, 'cols' => $colOptions, 'innerLineThickness' => 0.3, 'outerLineThickness' => 0.3);
    // Dibuja la tabla cadena original
    $pdf->ezSetDy(-5);
    $pdf->ezTable($tableData, $colNames, "", $options);
    // Leyendas
    $pdf->ezSetDy(-12);
    $leyendas = 'EFECTOS FISCALES AL PAGO. PAGO EN UNA SOLA EXHIBICION. ESTE DOCUMENTO ES UNA IMPRESION DE UN COMPROBANTE FISCAL DIGITAL';
    $pdf->setColor(0.5, 0.5, 0.5);
    $pdf->ezText($leyendas, 5, array('left' => 0, 'justification' => 'left'));
    $pdf->setColor(0, 0, 0);
    //REGRESA PARA PONER ENCABEZADO EN PAGINAS 2 ->
    if ($pdf->ezPageCount > 1) {
        $datos = array();
        $datos['logo'] = $logofile;
        $datos['totalPaginas'] = $pdf->ezPageCount;
        $datos['tipoDocto'] = $tipoDocto;
        $datos['foliodocto'] = $foliodocto;
        $datos['fechastr'] = $fechastr;
        for ($pn = 2; $pn <= $pdf->ezPageCount; $pn++) {
            $datos['paginaActual'] = $pn;
            //a partir de la segunda pagina.
            $pdf->reopenObject($pdf->ezPages[$pn]);
            headerDoc($pdf, $datos);
        }
    }
    //ESCRIBE REPORTE AL ARCHIVO.
    //================================================================================
    $pdfcode = $pdf->output();
    //save the file
    if ($tmpName) {
        $nombrePDF = tempnam("tmp/", 'face5') . ".pdf";
        $nombreToks = explode("/", $nombrePDF);
        if (count($nombreToks) < 2) {
            $nombreToks = explode("\\", $nombrePDF);
        }
        $lastTok = count($nombreToks) - 1;
        $nombrePDF = $nombreToks[$lastTok];
        $archivoPDF = "tmp/" . $nombrePDF;
        $archivos = array($nombrePDF, $archivoPDF);
    } else {
        $nombrePDF = $tipoDocto . "_" . $row_factura['serie'] . $row_factura['folio'] . ".pdf";
        $archivoPDF = "tmp/" . $nombrePDF;
        $archivos = array($nombrePDF, $archivoPDF);
    }
    $fp = fopen($archivoPDF, 'w');
    fwrite($fp, $pdfcode);
    fclose($fp);
    return $archivos;
}
<?php

include 'class.ezpdf.php';
$pdf = new Cezpdf();
// Set margin dan font
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('fonts/Courier.afm');
$all = $pdf->openObject();
// Tampilkan logo
//$pdf->setStrokeColor(0, 0, 0, 1);
//$pdf->addJpegFromFile('logo.jpg',20,800,69);
// Teks di tengah atas untuk judul header
$pdf->addText(30, 820, 12, '<b>JADWAL KULIAH</b>');
$pdf->addText(30, 800, 12, '<b>UNIVERSITAS ISLAM NEGERI SUNAN DUNUNG DJATI BANDUNG</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Koneksi ke database dan tampilkan datanya
include "../../../config/koneksi.php";
// Query untuk merelasikan kedua tabel
$nima = @$_POST['nim'];
$hts = substr(@$_POST['tahun'], 0, 4);
$ktr = @$_POST['semester'];
$hts = substr($_POST['tahun'], 0, 4);
$tampiljdwl = mysql_query("SELECT a.*,b.nmmatkul from jadwal a inner join matakuliah b on a.kdmatkul=b.kdmatkul AND a.tahun='{$hts}' order by a.hari desc");
Example #20
0
 /**
  * Creates a PDF document and sends this pricelist to the client
  *
  * Unfortunately, ezpdf does not return anything after printing the
  * document, so there's no way to tell whether it has succeeded.
  * Thus, you should not rely on the return value, except when it is
  * false -- in that case, loading of some data failed.
  * @return  boolean           False on failure, true on supposed success
  */
 function send_as_pdf()
 {
     global $objInit, $_ARRAYLANG;
     if (!$this->load()) {
         return \Message::error($_ARRAYLANG['TXT_SHOP_PRICELIST_ERROR_LOADING']);
     }
     $objPdf = new \Cezpdf('A4');
     $objPdf->setEncryption('', '', array('print'));
     $objPdf->selectFont(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseLibraryPath() . '/ezpdf/fonts/' . $this->font);
     $objPdf->ezSetMargins(0, 0, 0, 0);
     // Reset margins
     $objPdf->setLineStyle(0.5);
     $marginTop = 30;
     $biggerCountTop = $biggerCountBottom = 0;
     $arrHeaderLeft = $arrHeaderRight = $arrFooterLeft = $arrFooterRight = array();
     if ($this->header) {
         // header should be shown
         $arrHeaderLeft = explode("\n", $this->header_left);
         $arrHeaderRight = explode("\n", $this->header_right);
         $countLeft = count($arrHeaderLeft);
         $countRight = count($arrHeaderRight);
         $biggerCountTop = $countLeft > $countRight ? $countLeft : $countRight;
         $marginTop = $biggerCountTop * 14 + 36;
     }
     // Bottom margin
     $marginBottom = 20;
     $arrFooterRight = array();
     if ($this->footer) {
         // footer should be shown
         // Old, obsolete:
         $this->footer_left = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left);
         $this->footer_right = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right);
         // New:
         $this->footer_left = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left);
         $this->footer_right = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right);
         $arrFooterLeft = explode("\n", $this->footer_left);
         $arrFooterRight = explode("\n", $this->footer_right);
         $countLeft = count($arrFooterLeft);
         $countRight = count($arrFooterRight);
         $biggerCountBottom = $countLeft > $countRight ? $countLeft : $countRight;
         $marginBottom = $biggerCountBottom * 20 + 20;
     }
     // Borders
     if ($this->border) {
         $linesForAllPages = $objPdf->openObject();
         $objPdf->saveState();
         $objPdf->setStrokeColor(0, 0, 0, 1);
         $objPdf->rectangle(10, 10, 575.28, 821.89);
         $objPdf->restoreState();
         $objPdf->closeObject();
         $objPdf->addObject($linesForAllPages, 'all');
     }
     // Header
     $headerArray = array();
     $startpointY = 0;
     if ($this->header) {
         $objPdf->ezSetY(830);
         $headerForAllPages = $objPdf->openObject();
         $objPdf->saveState();
         for ($i = 0; $i < $biggerCountTop; ++$i) {
             $headerArray[$i] = array('left' => isset($arrHeaderLeft[$i]) ? $arrHeaderLeft[$i] : '', 'right' => isset($arrHeaderRight[$i]) ? $arrHeaderRight[$i] : '');
         }
         $tempY = $objPdf->ezTable($headerArray, '', '', array('showHeadings' => 0, 'fontSize' => $this->font_size_header, 'shaded' => 0, 'width' => 540, 'showLines' => 0, 'xPos' => 'center', 'xOrientation' => 'center', 'cols' => array('right' => array('justification' => 'right'))));
         $tempY -= 5;
         if ($this->border) {
             $objPdf->setStrokeColor(0, 0, 0);
             $objPdf->line(10, $tempY, 585.28, $tempY);
         }
         $startpointY = $tempY - 5;
         $objPdf->restoreState();
         $objPdf->closeObject();
         $objPdf->addObject($headerForAllPages, 'all');
     }
     // Footer
     $pageNumbersX = $pageNumbersY = $pageNumbersFont = 0;
     if ($this->footer) {
         $footerForAllPages = $objPdf->openObject();
         $objPdf->saveState();
         $tempY = $marginBottom - 5;
         if ($this->border) {
             $objPdf->setStrokeColor(0, 0, 0);
             $objPdf->line(10, $tempY, 585.28, $tempY);
         }
         // length of the longest word
         $longestWord = 0;
         foreach ($arrFooterRight as $line) {
             if ($longestWord < strlen($line)) {
                 $longestWord = strlen($line);
             }
         }
         for ($i = $biggerCountBottom - 1; $i >= 0; --$i) {
             if (empty($arrFooterLeft[$i])) {
                 $arrFooterLeft[$i] = '';
             }
             if (empty($arrFooterRight[$i])) {
                 $arrFooterRight[$i] = '';
             }
             if ($arrFooterLeft[$i] == '<--PAGENUMBER-->' || $arrFooterLeft[$i] == '[PAGENUMBER]') {
                 $pageNumbersX = 65;
                 $pageNumbersY = $tempY - 18 - $i * $this->font_size_footer;
                 $pageNumbersFont = $this->font_size_list;
             } else {
                 $objPdf->addText(25, $tempY - 18 - $i * $this->font_size_footer, $this->font_size_footer, $arrFooterLeft[$i]);
             }
             if ($arrFooterRight[$i] == '<--PAGENUMBER-->' || $arrFooterRight[$i] == '[PAGENUMBER]') {
                 $pageNumbersX = 595.28 - 25;
                 $pageNumbersY = $tempY - 18 - $i * $this->font_size_footer;
                 $pageNumbersFont = $this->font_size_list;
             } else {
                 // Properly align right
                 $width = $objPdf->getTextWidth($this->font_size_footer, $arrFooterRight[$i]);
                 $objPdf->addText(595.28 - $width - 25, $tempY - 18 - $i * $this->font_size_footer, $this->font_size_footer, $arrFooterRight[$i]);
             }
         }
         $objPdf->restoreState();
         $objPdf->closeObject();
         $objPdf->addObject($footerForAllPages, 'all');
     }
     // Page numbers
     if (isset($pageNumbersX)) {
         $objPdf->ezStartPageNumbers($pageNumbersX, $pageNumbersY, $pageNumbersFont, '', $_ARRAYLANG['TXT_SHOP_PRICELIST_FORMAT_PAGENUMBER'], 1);
     }
     // Margins
     $objPdf->ezSetMargins($marginTop, $marginBottom, 30, 30);
     // Product table
     if (isset($startpointY)) {
         $objPdf->ezSetY($startpointY);
     }
     $objInit->backendLangId = $this->lang_id;
     $_ARRAYLANG = $objInit->loadLanguageData('Shop');
     Currency::setActiveCurrencyId($this->currency_id);
     $currency_symbol = Currency::getActiveCurrencySymbol();
     $category_ids = $this->category_ids();
     if ($category_ids == '*') {
         $category_ids = null;
     }
     $count = 1000;
     // Be sensible!
     // Pattern is "%" because all-empty parameters will result in an
     // empty array!
     $arrProduct = Products::getByShopParams($count, 0, null, $category_ids, null, '%', null, null, '`category_id` ASC, `name` ASC');
     $arrCategoryName = ShopCategories::getNameArray();
     $arrOutput = array();
     foreach ($arrProduct as $product_id => $objProduct) {
         $categoryIds = explode(',', $objProduct->category_id());
         $arrCategoryNames = array();
         foreach ($categoryIds as $categoryId) {
             $arrCategoryNames[] = $arrCategoryName[$categoryId];
         }
         //$objProduct = new Product();
         $arrOutput[$product_id] = array('product_name' => self::decode($objProduct->name()), 'category_name' => self::decode(implode(', ', $arrCategoryNames)), 'product_code' => self::decode($objProduct->code()), 'product_id' => self::decode($objProduct->id()), 'price' => ($objProduct->discount_active() ? "S " . Currency::formatPrice($objProduct->discountprice()) : Currency::formatPrice($objProduct->price())) . ' ' . $currency_symbol);
     }
     $objPdf->ezTable($arrOutput, array('product_name' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_PRODUCT_NAME']) . '</b>', 'category_name' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_CATEGORY_NAME']) . '</b>', 'product_code' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_PRODUCT_CODE']) . '</b>', 'product_id' => '<b>' . self::decode($_ARRAYLANG['TXT_ID']) . '</b>', 'price' => '<b>' . self::decode($_ARRAYLANG['TXT_SHOP_PRICE']) . '</b>'), '', array('showHeadings' => 1, 'fontSize' => $this->font_size_list, 'width' => 530, 'innerLineThickness' => 0.5, 'outerLineThickness' => 0.5, 'shaded' => 2, 'shadeCol' => array(hexdec(substr($this->row_color_1, 0, 2)) / 255, hexdec(substr($this->row_color_1, 2, 2)) / 255, hexdec(substr($this->row_color_1, 4, 2)) / 255), 'shadeCol2' => array(hexdec(substr($this->row_color_2, 0, 2)) / 255, hexdec(substr($this->row_color_2, 2, 2)) / 255, hexdec(substr($this->row_color_2, 4, 2)) / 255), 'cols' => array('product_name' => array('width' => 255), 'category_name' => array('width' => 130), 'product_code' => array('width' => 50), 'product_id' => array('width' => 40, 'justification' => 'right'), 'price' => array('width' => 55, 'justification' => 'right'))));
     $objPdf->ezStream();
     // Never reached
     return true;
 }
 function saldenliste_mv_pdf($monat, $jahr)
 {
     ob_clean();
     // ausgabepuffer leeren
     /* PDF AUSGABE */
     //include_once ('pdfclass/class.ezpdf.php');
     $pdf = new Cezpdf('a4', 'portrait');
     $pdf->selectFont('Helvetica.afm');
     $pdf->ezSetCmMargins(4.5, 0, 0, 0);
     /* Kopfzeile */
     $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100);
     $pdf->setLineStyle(0.5);
     $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de");
     $pdf->line(42, 750, 550, 750);
     /* Footer */
     $pdf->line(42, 50, 550, 50);
     $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG *  Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim");
     $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin * BLZ: 100  800  00 * Konto-Nr.: 05 804 000 00 * Steuernummer: 24/582/61188");
     $pdf->addInfo('Title', "Saldenliste {$objekt_name} {$monatname} {$jahr}");
     $pdf->addInfo('Author', $_SESSION[username]);
     $pdf->ezStartPageNumbers(550, 755, 7, '', "Seite {PAGENUM} von {TOTALPAGENUM}");
     // echo "Monatsbericht Mieter - Monatsbericht Kostenkonten<br>";
     // echo "<h3>Aktuelle Mieterstatistik mit ausgezogene Mieter<br></h3>";
     $s = new statistik();
     $jahr = $_REQUEST[jahr];
     if (empty($jahr)) {
         $jahr = date("Y");
     } else {
         if (strlen($jahr) < 4) {
             $jahr = date("Y");
         }
     }
     // $jahr_monat = date("Y-m");
     // $jahr = date("Y");
     $monat = $_REQUEST[monat];
     if (empty($monat)) {
         $monat = date("m");
     } else {
         if (strlen($monat) < 2) {
             $monat = '0' . $monat;
         }
     }
     // $monat = '04';
     $jahr_monat = $jahr . '-' . $monat;
     // $jahr_vormonat = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
     // $jahr_vormonat = date("Y-m",$jahr_vormonat);
     $bg = new berlussimo_global();
     $link = "?daten=mietvertrag_raus&mietvertrag_raus=saldenliste";
     $bg->objekt_auswahl_liste($link);
     $bg->monate_jahres_links($jahr, $link);
     if (isset($_SESSION['objekt_id'])) {
         $objekt_id = $_SESSION['objekt_id'];
         $einheit_info = new einheit();
         $o = new objekt();
         $objekt_name = $o->get_objekt_name($objekt_id);
         $monatname = monat2name($monat);
         $pdf->addText(70, 755, 10, "Saldenliste {$objekt_name} {$monatname} {$jahr}");
         $pdf->ezSetDy(25);
         $pdf->ezSetCmMargins(3, 3, 3, 3);
         $text_options = array(left => 0, justification => 'left');
         $pdf->ezText("<b>Einheit</b>", 8, $text_options);
         $pdf->ezSetDy(9);
         $text_options = array(left => 100, justification => 'left');
         $pdf->ezText("<b>Mieter</b>", 8, $text_options);
         $pdf->ezSetDy(9);
         $text_options = array(left => 270, justification => 'left');
         $pdf->ezText("<b>Einzug</b>", 8, $text_options);
         $pdf->ezSetDy(9);
         $text_options = array(left => 320, justification => 'left');
         $pdf->ezText("<b>Auszug</b>", 8, $text_options);
         $pdf->ezSetDy(9);
         $text_options = array(right => 0, justification => 'right');
         $pdf->ezText("<b>SALDO EUR</b>", 8, $text_options);
         /* Aktuell bzw. gewünschten Monat berechnen */
         $ob = new objekt();
         $einheiten_array = $ob->einheiten_objekt_arr($objekt_id);
         // $einheiten_array = $s->vermietete_monat_jahr($jahr_monat,$objekt_id, '');
         /*
          * echo "<pre>";
          * print_r($einheiten_array);
          * echo "<h1> EINHEITEN: $anzahl_aktuell</h1>";
          * $mv_array = $einheit_info->get_mietvertrag_ids('7');
          * print_r($mv_array);
          */
         $summe_sv = 0;
         $summe_mieten = 0;
         $summe_umlagen = 0;
         $summe_akt_gsoll = 0;
         $summe_g_zahlungen = 0;
         $summe_saldo_neu = 0;
         $anzahl_aktuell = count($einheiten_array);
         $miete = new miete();
         $zeilen_pro_seite = 60;
         $aktuelle_zeile = 0;
         for ($i = 0; $i < $anzahl_aktuell; $i++) {
             $mv_array = $einheit_info->get_mietvertraege_bis("" . $einheiten_array[$i]['EINHEIT_ID'] . "", $jahr, $monat);
             $mv_anzahl = count($mv_array);
             if (is_array($mv_array)) {
                 for ($b = 0; $b < $mv_anzahl; $b++) {
                     $mv_id = $mv_array[$b]['MIETVERTRAG_ID'];
                     $mk = new mietkonto();
                     $mieter_ids = $mk->get_personen_ids_mietvertrag($mv_id);
                     for ($a = 0; $a < count($mieter_ids); $a++) {
                         $mieter_daten_arr[] = $mk->get_person_infos($mieter_ids[$a][PERSON_MIETVERTRAG_PERSON_ID]);
                     }
                     // $miete->mietkonto_berechnung_monatsgenau($mv_id, $jahr, $monat);
                     $end_saldoo = $miete->saldo_berechnen_monatsgenau($mv_id, $monat, $jahr);
                     $zeile = $zeile + 1;
                     $einheit_kurzname = $einheiten_array[$i]['EINHEIT_KURZNAME'];
                     $vn = RTRIM(LTRIM($mieter_daten_arr['0']['0']['PERSON_VORNAME']));
                     $nn = RTRIM(LTRIM($mieter_daten_arr['0']['0']['PERSON_NACHNAME']));
                     $akt_gesamt_soll = $miete->saldo_vormonat_stand + $miete->sollmiete_warm;
                     $this->get_mietvertrag_infos_aktuell($mv_id);
                     $l_tag_akt_monat = letzter_tag_im_monat($monat, $jahr);
                     $l_datum = "{$jahr}-{$monat}-{$l_tag_akt_monat}";
                     if ($this->mietvertrag_bis == '0000-00-00' or $this->mietvertrag_bis > $l_datum) {
                         $mv_bis = 'aktuell';
                     } else {
                         $mv_bis = date_mysql2german($this->mietvertrag_bis);
                     }
                     $mv_von = date_mysql2german($this->mietvertrag_von);
                     $end_saldoo = nummer_punkt2komma($end_saldoo);
                     if ($mv_bis == 'aktuell') {
                         // echo "$zeile. $einheit_kurzname $nn $vn SALDO NEU: $end_saldoo <br>";
                         $pdf->ezSetCmMargins(3, 3, 3, 3);
                         $text_options = array(left => 0, justification => 'left');
                         $pdf->ezText("{$einheit_kurzname}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 100, justification => 'left');
                         $pdf->ezText("{$nn} {$vn}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 270, justification => 'left');
                         $pdf->ezText("{$mv_von}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 320, justification => 'left');
                         $pdf->ezText("", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(right => 0, justification => 'right');
                         $pdf->ezText("{$end_saldoo}", 8, $text_options);
                         $aktuelle_zeile++;
                     } else {
                         // echo "<b>$zeile. $einheit_kurzname $nn $vn SALDO NEU: $end_saldoo € BEENDET AM :$mv_bis €</b><br>";
                         $pdf->ezSetCmMargins(3, 3, 3, 3);
                         $text_options = array(left => 0, justification => 'left');
                         $pdf->ezText("{$einheit_kurzname}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 100, justification => 'left');
                         $pdf->ezText("{$nn} {$vn}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 270, justification => 'left');
                         $pdf->ezText("{$mv_von}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 320, justification => 'left');
                         $pdf->ezText("{$mv_bis}", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(right => 0, justification => 'right');
                         $pdf->ezText("{$end_saldoo}", 8, $text_options);
                         $aktuelle_zeile++;
                     }
                     if ($zeilen_pro_seite == $aktuelle_zeile) {
                         $pdf->ezNewPage();
                         /* Kopfzeile */
                         $pdf->addJpegFromFile('includes/logos/logo_hv_sw.jpg', 220, 750, 175, 100);
                         $pdf->setLineStyle(0.5);
                         $pdf->addText(86, 743, 6, "BERLUS HAUSVERWALTUNG * Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim * Telefon: 89784477 * Fax: 89784479 * Email: info@berlus.de");
                         $pdf->line(42, 750, 550, 750);
                         /* Footer */
                         $pdf->line(42, 50, 550, 50);
                         $pdf->addText(170, 42, 6, "BERLUS HAUSVERWALTUNG *  Fontanestr. 1 * 14193 Berlin * Inhaber Wolfgang Wehrheim");
                         $pdf->addText(150, 35, 6, "Bankverbindung: Dresdner Bank Berlin * BLZ: 100  800  00 * Konto-Nr.: 05 804 000 00 * Steuernummer: 24/582/61188");
                         $pdf->addInfo('Title', "Saldenliste {$objekt_name} {$monatname} {$jahr}");
                         $pdf->addText(70, 755, 10, "Saldenliste  {$objekt_name} {$monatname} {$jahr}");
                         $pdf->ezStartPageNumbers(550, 755, 7, '', "Seite {PAGENUM} von {TOTALPAGENUM}");
                         /* Überschriftzeile */
                         $pdf->ezSetDy(-18);
                         $pdf->ezSetCmMargins(3, 3, 3, 3);
                         $text_options = array(left => 0, justification => 'left');
                         $pdf->ezText("<b>Einheit</b>", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 100, justification => 'left');
                         $pdf->ezText("<b>Mieter</b>", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 270, justification => 'left');
                         $pdf->ezText("<b>Einzug</b>", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(left => 320, justification => 'left');
                         $pdf->ezText("<b>Auszug</b>", 8, $text_options);
                         $pdf->ezSetDy(9);
                         $text_options = array(right => 0, justification => 'right');
                         $pdf->ezText("<b>SALDO EUR</b>", 8, $text_options);
                         $aktuelle_zeile = 0;
                     }
                     unset($mieter_daten_arr);
                     unset($nn);
                     unset($vn);
                 }
                 // end if is_array mv_ids
             }
         }
         // hinweis_ausgeben("Saldenliste mit Vormieter für $objekt_name wurde erstellt<br>");
         ob_clean();
         // ausgabepuffer leeren
         $pdf->ezStopPageNumbers();
         $pdf->ezStream();
         /* Falls kein Objekt ausgewählt */
     } else {
         echo "Objekt auswählen";
     }
 }
    $pdf->stream();
} else {
    include_once $pathvars["libraries"] . "xtra.pdf.php";
    include_once $pathvars["libraries"] . "xtra.ezpdf.php";
    $pdf = new Cezpdf();
    $pdf->selectFont('./fonts/Helvetica.afm');
    $pdf->openHere("Fit");
    // Image
    #ezImage(image,[padding],[width],[resize],[justification],[array border]);
    #$pdf->addPngFromFile($pathvars["fileroot"]."/images/net/wappen.png",20,780,70);
    #$pdf->addPngFromFile($pathvars["fileroot"]."/images/net/auge.png",500,780,70);
    $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/kleines-wappen.png", 30, 780, 46);
    $pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/auge.png", 300, 780, 70);
    // eine linie
    $pdf->line(20, 770, 560, 770);
    $pdf->addText(120, 790, '20', '<b>Vermessungsamt</b>');
    $pdf->addText(380, 790, '20', '<i>Friedberg</i>');
    // seiten nummern
    $pdf->ezStartPageNumbers(300, 20, 12, '', '', 1);
    // hier geht es los
    $pdf->ezSetDy(-60);
    // spaltenweise ausgabe an
    $pdf->ezColumnsStart(array("num" => 2, "gap" => 20));
    // wichtig: damit der die ausgabe am spaltenbeginn steht
    #$pdf->ezSetDy(10);
    // Textblock
    #$pdf->ezText($text,10,array( "justification" => "full" )); // "leading"=>20, "spacing"=>1
    // Tabellen
    $data = array(array('num' => 1, 'name' => 'gandalf', 'type' => 'wizard'), array('num' => 2, 'name' => 'bilbo', 'type' => 'hobbit', 'url' => 'http://www.ros.co. nz/pdf/'), array('num' => 3, 'name' => 'frodo', 'type' => 'hobbit'), array('num' => 4, 'name' => 'saruman', 'type' => 'bad dude', 'url' => 'http://sourceforge.net/projects/pdf-php'), array('num' => 5, 'name' => 'sauron', 'type' => 'really bad dude'));
    for ($i = 0; $i <= 20; $i++) {
        $pdf->ezTable($data, '', '', array("fontSize" => 9, "width" => 260));
$l = Conectarse("webpmm");
ini_set('post_max_size', '512M');
ini_set('upload_max_filesize', '512M');
ini_set('memory_limit', '500M');
ini_set('max_execution_time', 600);
ini_set('limit', -1);
include 'class.ezpdf.php';
$pdf = new Cezpdf('LETTER', 'portrait');
#					 t, b, l, r
$pdf->ezSetMargins(50, 70, 50, 50);
#w = 612 h = 792
$pdf->setColor(0.16, 0.38, 0.61);
$pdf->selectFont('fonts/Helvetica.afm');
$img = ImageCreatefromjpeg('../img/logo.jpg');
$pdf->addImage($img, 50, 697, 47, 50);
$pdf->addText(110, 722, 24, '<b>ENTREGAS PUNTUALES</b>');
$pdf->setColor(0.79, 0.67, 0.11);
$pdf->addText(110, 702, 16, '<b>Soporte de Factura ' . $_GET[folio] . '</b>');
$pdf->line(50, 690, 560, 690);
$pdf->setColor(0.25, 0.25, 0.25);
$pdf->ezText("\n\n\n\n{$f->fechaactual}", 12, array('justification' => 'right'));
#detallado superior
$s = "SELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,gv.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasventanilla gv ON fd.folio=gv.id\n\t\tINNER JOIN catalogocliente cc ON gv.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'\n\t\tUNION\n\t\tSELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,ge.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasempresariales ge ON fd.folio=ge.id\n\t\tINNER JOIN catalogocliente cc ON ge.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'";
$rx = mysql_query($s, $l) or die($s);
$registros = mysql_num_rows($rx);
if ($registros > 0) {
    $pdf->setColor(0.79, 0.67, 0.11);
    $pdf->ezText("<b>DETALLADO DE FACTURA, GUIAS</b>\n", 12, array('justification' => 'left'));
    $pdf->setColor(0.25, 0.25, 0.25);
    $s = "SELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,gv.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasventanilla gv ON fd.folio=gv.id\n\t\tINNER JOIN catalogocliente cc ON gv.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'\n\t\tUNION\n\t\tSELECT fd.*,SUBSTRING(CONCAT(cc.nombre,' ',cc.paterno,' ',cc.materno),1,25) cliente,ge.totalpaquetes,\n\t\tDATE_FORMAT(fd.fecha,'%d/%m/%Y') AS fecha\n\t\tFROM facturadetalle fd\n\t\tINNER JOIN guiasempresariales ge ON fd.folio=ge.id\n\t\tINNER JOIN catalogocliente cc ON ge.iddestinatario=cc.id\n\t\tWHERE fd.factura = '{$_GET['folio']}'";
    $r = mysql_query($s, $l) or die($s);
Example #24
0
<?php

include 'class.ezpdf.php';
$pdf = new Cezpdf();
// Atur margin
$pdf->ezSetCmMargins(2, 3, 3.3, 3);
// Header dan footer didefinisikan diantara openObject dan closeObject
$all = $pdf->openObject();
// Teks di tengah atas untuk judul header
$pdf->addText(240, 820, 16, '<b>Telkomsel Report</b>');
$pdf->addText(150, 800, 14, '<b>Mobile Advertising Customer Regional Bandung</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
$pdf->addText(150, 60, 14, '<b>Telkomsel PDF Report - by Firmansyah Wahyu</b>');
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak pada tanggal: ' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Koneksi ke database dan tampilkan datanya
mysql_connect("localhost", "root", "");
mysql_select_db("drasticdata");
$sql = mysql_query("SELECT * FROM country_map");
$i = 1;
while ($firman = mysql_fetch_array($sql)) {
    $data[$i] = array('No' => $i, 'Code' => $firman[Code], 'Nama Kecamatan' => $firman[nama_kec], 'Luas Area' => $firman[Luas_Area], 'Jumlah Penduduk' => $firman[Jumlah_Penduduk], 'Kepadatan' => $firman[Kepadatan], 'Pelanggan MA' => $firman[Pelanggan_MA], 'Koordinat' => $firman[Coords]);
    $i++;
}
/*
Example #25
0
         $totaltext .= ":";
     }
     $pdf->ezText("<b>" . $totaltext . "</b>", PRODUCT_TOTALS_FONT_SIZE, array('justification' => 'right', 'right' => 80));
 }
 // end for
 //Add in the order totals
 $totalsy = 230;
 $pdf->ezSetY($totalsy);
 for ($j = 0, $n = sizeof($order->totals); $j < $n; $j++) {
     $pdf->ezText(html_entity_decode($order->totals[$j]['text']), PRODUCT_TOTALS_FONT_SIZE, array('justification' => 'right', 'right' => 10));
 }
 $pdf->ezSetY($y);
 // sold to address
 $pos = 720;
 $indent = LEFT_MARGIN + TEXT_BLOCK_INDENT;
 $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['name']);
 if ($order->billing['company'] && $order->billing['company'] != 'NULL') {
     $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['company']);
 }
 if ($order->billing['street_address'] && $order->billing['street_address'] != 'NULL') {
     $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['street_address']);
 }
 if ($order->billing['suburb'] && $order->billing['suburb'] != 'NULL') {
     $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['suburb']);
 }
 if ($order->billing['city'] && $order->billing['city'] != 'NULL') {
     $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['city']);
 }
 if ($order->billing['state'] && $order->billing['state'] != 'NULL') {
     $pdf->addText($indent, $pos -= GENERAL_LEADING, GENERAL_FONT_SIZE, $order->billing['state']);
 }
Example #26
0
 $pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm');
 $pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm');
 // company name and details pulled from the my store address and phone number
 // in admin configuration mystore
 $y = $pdf->ezText(STORE_NAME_ADDRESS, COMPANY_HEADER_FONT_SIZE);
 $y -= 10;
 // logo image  set to right of the above .. change first number to move sideways
 $pdf->addJpegFromFile('../images/' . 'store_logo.jpg', 365, 730, 85, 80);
 // extra info boxs to be used by staff
 $pdf->setStrokeColor(0, 0, 0);
 $pdf->setLineStyle(1);
 $pdf->roundedRectangle(470, 730, 85, 85, 10, $f = 0);
 $pdf->rectangle(535, 748, 10, 10);
 $pdf->rectangle(535, 769, 10, 10);
 $pdf->rectangle(535, 790, 10, 10);
 $pdf->addText(480, 790, GENERAL_FONT_SIZE, TEXT_BANK);
 $pdf->addText(480, 769, GENERAL_FONT_SIZE, TEXT_POST);
 $pdf->addText(480, 748, GENERAL_FONT_SIZE, TEXT_SALES);
 // line between header order number and order date
 $pdf->setLineStyle(1);
 $pdf->line(LEFT_MARGIN, $y, LINE_LENGTH, $y);
 $pdf->ezSetY($y);
 $dup_y = $y;
 // order number
 $y = $pdf->ezText("<b>" . TEXT_ORDER_NUMBER . " </b>" . $orders['orders_prefix'] . $orders['orders_id'] . "\n\n", SUB_HEADING_FONT_SIZE);
 // order date
 if ($_POST['show_order_date']) {
     $pdf->ezSetY($dup_y);
     $pdf->ezText("<b>" . TEXT_ORDER_DATE . " </b>" . date(TEXT_ORDER_FORMAT, strtotime($order->info['date_purchased'])) . "\n\n", SUB_HEADING_FONT_SIZE, array('justification' => 'right'));
 }
 //left rounded rectangle around sold to info
<?php

include 'class.ezpdf.php';
$pdf = new Cezpdf();
// Set margin dan font
$pdf->ezSetCmMargins(3, 3, 3, 3);
$pdf->selectFont('fonts/Courier.afm');
$all = $pdf->openObject();
// Tampilkan logo
//$pdf->setStrokeColor(0, 0, 0, 1);
//$pdf->addJpegFromFile('logo.jpg',20,800,69);
// Teks di tengah atas untuk judul header
$pdf->addText(30, 820, 16, '<b>KARTU HASIL STUDI</b>');
$pdf->addText(30, 800, 16, '<b>UNIVERSITAS ISLAM NEGERI SUNAN GUNUNG DJATI BANDUNG</b>');
// Garis atas untuk header
$pdf->line(10, 795, 578, 795);
// Garis bawah untuk footer
$pdf->line(10, 50, 578, 50);
// Teks kiri bawah
$pdf->addText(30, 34, 8, 'Dicetak tgl:' . date('d-m-Y, H:i:s'));
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Koneksi ke database dan tampilkan datanya
include "../../../config/koneksi.php";
// Query untuk merelasikan kedua tabel
$nima = $_POST['nim'];
$semestera = $_POST['semester'];
$tahuna = $_POST['tahun'];
$hts = substr($_POST['tahun'], 0, 4);
$ktr = $_POST['semester'];
Example #28
0
function dofreePDF()
{
    global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset;
    global $mainframe, $database, $my;
    $id = intval(mosGetParam($_REQUEST, 'id', 1));
    $gid = $my->gid;
    $now = _CURRENT_SERVER_TIME;
    $nullDate = $database->getNullDate();
    // query to check for state and access levels
    $query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n  s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $id . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
    $database->setQuery($query);
    $row = NULL;
    if ($database->loadObject($row)) {
        /*
         * check whether category is published
         */
        if (!$row->cat_pub && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section is published
         */
        if (!$row->sec_pub && $row->sectionid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether category access level allows access
         */
        if ($row->cat_access > $gid && $row->catid) {
            mosNotAuth();
            return;
        }
        /*
         * check whether section access level allows access
         */
        if ($row->sec_access > $gid && $row->sectionid) {
            mosNotAuth();
            return;
        }
        include 'includes/class.ezpdf.php';
        $params = new mosParameters($row->attribs);
        $params->def('author', !$mainframe->getCfg('hideAuthor'));
        $params->def('createdate', !$mainframe->getCfg('hideCreateDate'));
        $params->def('modifydate', !$mainframe->getCfg('hideModifyDate'));
        $row->fulltext = pdfCleaner($row->fulltext);
        $row->introtext = pdfCleaner($row->introtext);
        $pdf = new Cezpdf('a4', 'P');
        //A4 Portrait
        $pdf->ezSetCmMargins(2, 1.5, 1, 1);
        $pdf->selectFont('./fonts/Helvetica.afm');
        //choose font
        $all = $pdf->openObject();
        $pdf->saveState();
        $pdf->setStrokeColor(0, 0, 0, 1);
        // footer
        $pdf->addText(250, 822, 6, $mosConfig_sitename);
        $pdf->line(10, 40, 578, 40);
        $pdf->line(10, 818, 578, 818);
        $pdf->addText(30, 34, 6, $mosConfig_live_site);
        $pdf->addText(250, 34, 6, _PDF_POWERED);
        $pdf->addText(450, 34, 6, _PDF_GENERATED . ' ' . date('j F, Y, H:i', time() + $mosConfig_offset * 60 * 60));
        $pdf->restoreState();
        $pdf->closeObject();
        $pdf->addObject($all, 'all');
        $pdf->ezSetDy(30);
        $txt1 = $row->title;
        $pdf->ezText($txt1, 14);
        $txt2 = AuthorDateLine($row, $params);
        $pdf->ezText($txt2, 8);
        $txt3 = $row->introtext . "\n" . $row->fulltext;
        $pdf->ezText($txt3, 10);
        $pdf->ezStream();
    } else {
        mosNotAuth();
        return;
    }
}
Example #29
0
while ($datatmp = mysql_fetch_array($result)) {
    $datos = $datatmp['nombre_contacto'];
    $total = $datatmp['total'];
    $emp = $datatmp['nombre'];
    $data[] = array_merge($datatmp, array('folio'));
}
$options = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'right', 'width' => 70, 'fontSize' => 8, 'xPos' => 480);
$titlef = array('folio' => '<b>Folio</b>');
$titles = array('fecha' => '<b>Fecha</b>');
$titlet = array('total' => '<b>Total</b>');
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titlef, '', $options);
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titles, '', $options);
$pdf->ezText("\n", 10);
$pdf->addText(50, 700, 12, "<b>Atendio: </b>\n");
$pdf->addText(100, 700, 12, $emp);
$pdf->addText(50, 680, 12, "<b>Cliente: </b>\n");
$pdf->addText(100, 680, 12, $datos);
//RECUPERANDO DETALLE DE VENTA
$sql = mysql_query("select dv.cantidad,p.nombre,dv.precio,dv.subtotal \n \t\tfrom detalle_venta dv\n \t\tinner join platillos p on p.id_platillo = dv.clave_producto \n \t\twhere folio = '" . $folio . "' ");
while ($row = mysql_fetch_array($sql)) {
    $dat[] = array_merge($row);
}
$optionsdv = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 500, 'fontSize' => 10, 'xPos' => 'center', 'cols' => array('cantidad' => array('justification' => 'center'), 'nombre' => array('justification' => 'center'), 'precio' => array('justification' => 'center'), 'subtotal' => array('justification' => 'center')));
$titledv = array('cantidad' => '<b>Cantidad</b>', 'nombre' => '<b>Descripción</b>', 'precio' => '<b>Precio</b>', 'subtotal' => '<b>SubTotal</b>');
$pdf->ezTable($dat, $titledv, '', $optionsdv);
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titlet, '', $options);
//cabecera del pdf (objeto para todas las páginas)
$all = $pdf->openObject();
Example #30
0
function citeRecords($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $citeStyle, $citeOrder, $citeType, $orderBy, $headerMsg, $userID, $viewType)
{
    global $officialDatabaseName;
    // these variables are defined in 'ini.inc.php'
    global $databaseBaseURL;
    global $contentTypeCharset;
    global $pdfPageSize;
    global $client;
    // The array '$transtab_refbase_pdf' contains search & replace patterns for conversion from refbase markup to PDf markup & entities
    global $transtab_refbase_pdf;
    // defined in 'transtab_refbase_pdf.inc.php'
    // Initialize array variables:
    $yearsArray = array();
    $typeTitlesArray = array();
    // Define inline text markup to be used by the 'citeRecord()' function:
    $markupPatternsArray = array("bold-prefix" => "<b>", "bold-suffix" => "</b>", "italic-prefix" => "<i>", "italic-suffix" => "</i>", "underline-prefix" => "<u>", "underline-suffix" => "</u>", "endash" => "¦", "emdash" => "©", "ampersand" => "&", "double-quote" => '"', "double-quote-left" => "ª", "double-quote-right" => "¬", "single-quote" => "'", "single-quote-left" => "®", "single-quote-right" => "¶", "less-than" => "<", "greater-than" => ">", "newline" => "\n");
    // Defines search & replace 'actions' that will be applied upon PDF output to all those refbase fields that are listed
    // in the corresponding 'fields' element:
    $pdfSearchReplaceActionsArray = array(array('fields' => array("title", "publication", "abbrev_journal", "address", "keywords", "abstract", "orig_title", "series_title", "abbrev_series_title", "notes"), 'actions' => $transtab_refbase_pdf));
    // For CLI queries, we'll allow paging thru the result set, i.e. we honour the values of the CLI options '-S|--start' ('$rowOffset')
    // and '-R|--rows' ('$showRows') ('$rowOffset' and '$showRows' are re-assigned in function 'seekInMySQLResultsToOffset()' in 'include.inc.php')
    if (preg_match("/^cli/i", $client)) {
        // if the query originated from a command line client such as the "refbase" CLI client ("cli-refbase-1.0")
        $showMaxRows = $showRows;
    } else {
        $showMaxRows = $rowsFound;
    }
    // otherwise show all rows
    // Setup the basic PDF document structure (PDF functions defined in 'class.ezpdf.php'):
    $pdf = new Cezpdf($pdfPageSize, 'portrait');
    // initialize PDF object
    if (!empty($headerMsg)) {
        // adjust upper page margin if a custom header message was given
        $pageMarginTop = "70";
    } else {
        $pageMarginTop = "50";
    }
    $pdf->ezSetMargins($pageMarginTop, 70, 50, 50);
    // set document margins (top, bottom, left, right)
    // Set fonts:
    $headingFont = 'includes/classes/org/pdf-php/fonts/Helvetica.afm';
    $textBodyFont = 'includes/classes/org/pdf-php/fonts/Times-Roman.afm';
    // Re-map character numbers from the 0->255 range to a named character, i.e. replace an (unused) character for any other PostScript char;
    // see the PDF reference for a list of supported PostScript/PDF character names: <http://www.adobe.com/devnet/pdf/pdf_reference.html>;
    // for the decimal code numbers of the ISO-8859-1 character set, see e.g.: <http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html>
    $diff = array(166 => 'endash', 169 => 'emdash', 170 => 'quotedblleft', 172 => 'quotedblright', 174 => 'quoteleft', 182 => 'quoteright');
    // Select a font:
    $pdf->selectFont($textBodyFont, array('encoding' => 'WinAnsiEncoding', 'differences' => $diff));
    $pdf->openHere('Fit');
    // Put a footer (and optionally a header) on all the pages:
    $all = $pdf->openObject();
    // start an independent object; all further writes to a page will actually go into this object, until a 'closeObject()' call is made
    $pdf->saveState();
    $pdf->setStrokeColor(0, 0, 0, 1);
    // set line color
    $pdf->setLineStyle(0.5);
    // set line width
    // - print header line and header message at the specified x/y position:
    if (!empty($headerMsg)) {
        // Remove any colon (":") from end of header message:
        $headerMsg = trimTextPattern($headerMsg, ":", false, true);
        // function 'trimTextPattern()' is defined in 'include.inc.php'
        // Decode any HTML entities:
        // (these may occur in the header message e.g. if the user's preferred display language is not English but German or French, etc)
        $headerMsg = decodeHTML($contentTypeCharset, $headerMsg);
        // function 'decodeHTML()' is defined in 'include.inc.php', and '$contentTypeCharset' is defined in 'ini.inc.php'
        // Convert refbase markup in the header message into appropriate PDF markup & entities:
        $headerMsg = searchReplaceText($transtab_refbase_pdf, $headerMsg, true);
        // function 'searchReplaceText()' is defined in 'include.inc.php'
        if ($pdfPageSize == 'a4') {
            $pdf->line(20, 800, 575, 800);
            $pdf->addText(50, 805, 10, $headerMsg);
        } elseif ($pdfPageSize == 'letter') {
            $pdf->line(20, 750, 592, 750);
            $pdf->addText(50, 755, 10, $headerMsg);
        }
    }
    // - print footer line and footer text at the specified x/y position:
    if ($pdfPageSize == 'a4') {
        $pdf->line(20, 40, 575, 40);
        $pdf->addText(50, 28, 10, $officialDatabaseName . ' ¦ ' . $databaseBaseURL);
        // w.r.t. the endash, see notes at '$markupPatternsArray' and '$diff' above
    } elseif ($pdfPageSize == 'letter') {
        $pdf->line(20, 40, 592, 40);
        $pdf->addText(50, 28, 10, $officialDatabaseName . ' ¦ ' . $databaseBaseURL);
    }
    $pdf->restoreState();
    $pdf->closeObject();
    // close the currently open object; further writes will now go to the current page
    $pdf->addObject($all, 'all');
    // note that object can be told to appear on just odd or even pages by changing 'all' to 'odd' or 'even'
    // Start printing page numbers:
    if ($pdfPageSize == 'a4') {
        $pdf->ezStartPageNumbers(550, 28, 10, '', '', 1);
    } elseif ($pdfPageSize == 'letter') {
        $pdf->ezStartPageNumbers(567, 28, 10, '', '', 1);
    }
    // LOOP OVER EACH RECORD:
    // Fetch one page of results (or less if on the last page)
    // (i.e., upto the limit specified in $showMaxRows) fetch a row into the $row array and ...
    for ($rowCounter = 0; $rowCounter < $showMaxRows && ($row = @mysql_fetch_array($result)); $rowCounter++) {
        foreach ($row as $rowFieldName => $rowFieldValue) {
            // Apply search & replace 'actions' to all fields that are listed in the 'fields' element of the arrays contained in '$pdfSearchReplaceActionsArray':
            foreach ($pdfSearchReplaceActionsArray as $fieldActionsArray) {
                if (in_array($rowFieldName, $fieldActionsArray['fields'])) {
                    $row[$rowFieldName] = searchReplaceText($fieldActionsArray['actions'], $row[$rowFieldName], true);
                }
            }
        }
        // function 'searchReplaceText()' is defined in 'include.inc.php'
        // Order attributes according to the chosen output style & record type:
        $record = citeRecord($row, $citeStyle, $citeType, $markupPatternsArray, false);
        // function 'citeRecord()' is defined in the citation style file given in '$citeStyleFile' (which, in turn, must reside in the 'cite' directory of the refbase root directory), see function 'generateCitations()'
        // Print out the current record:
        if (!empty($record)) {
            // Print any section heading(s):
            if (preg_match("/year|type/i", $citeOrder)) {
                $headingPrefix = "";
                $headingSuffix = "";
                $sectionMarkupPrefix = "<b>";
                $sectionMarkupSuffix = "</b>\n";
                $subSectionMarkupPrefix = "";
                $subSectionMarkupSuffix = "\n";
                if ($citeOrder == "type-year") {
                    $sectionMarkupSuffix .= "\n";
                }
                list($yearsArray, $typeTitlesArray, $sectionHeading) = generateSectionHeading($yearsArray, $typeTitlesArray, $row, $citeOrder, $headingPrefix, $headingSuffix, $sectionMarkupPrefix, $sectionMarkupSuffix, $subSectionMarkupPrefix, $subSectionMarkupSuffix);
                // function 'generateSectionHeading()' is defined in 'cite.inc.php'
                if (!empty($sectionHeading)) {
                    $pdf->selectFont($headingFont, array('encoding' => 'WinAnsiEncoding', 'differences' => $diff));
                    // use Helvetica
                    $pdf->ezText($sectionHeading, '14', array('justification' => 'left'));
                    // create heading using a font size of 14pt
                }
            }
            // If character encoding is not UTF-8 already, convert record text to UTF-8:
            //				if ($contentTypeCharset != "UTF-8")
            //					$record = convertToCharacterEncoding("UTF-8", "IGNORE", $record); // function 'convertToCharacterEncoding()' is defined in 'include.inc.php'
            // NOTE: Export of cited references to PDF does currently only work with a latin1 database but not with UTF-8 (since I don't know how to write Unicode characters to PDF).
            //       As a workaround, we could convert UTF-8 characters to latin1 if possible (and omit any other higher ASCII chars)
            // TODO: While this workaround indeed fixes display issues with higher ASCII chars that have equivalents in the latin1 charset, this will currently swallow higher ASCII
            //       hyphens/dashes such as endashes (which display correctly without this workaround).
            //				if ($contentTypeCharset == "UTF-8")
            //					$record = convertToCharacterEncoding("ISO-8859-1", "TRANSLIT", $record, "UTF-8"); // function 'convertToCharacterEncoding()' is defined in 'include.inc.php'
            // Set paragraph text options:
            $textOptions = array('justification' => 'full');
            // possible array options:
            // 'left'=> number, gap to leave from the left margin
            // 'right'=> number, gap to leave from the right margin
            // 'aleft'=> number, absolute left position (overrides 'left')
            // 'aright'=> number, absolute right position (overrides 'right')
            // 'justification' => 'left','right','center','centre','full'
            //
            // only set one of the next two items (leading overrides spacing)
            // 'leading' => number, defines the total height taken by the line, independent of the font height.
            // 'spacing' => a real number, though usually set to one of 1, 1.5, 2 (line spacing as used in word processing)
            // Write PDF paragraph:
            $pdf->selectFont($textBodyFont, array('encoding' => 'WinAnsiEncoding'));
            // use Times-Roman
            $pdf->ezText($record . "\n", '12', $textOptions);
            // create text block with record text using "Times Roman" and a font size of 12pt
        }
    }
    return $pdf->ezStream();
}