$listMembers = new request(); $listMembers->openMembers($tmpquery); $comptListMembers = count($listMembers->mem_id); for ($i = 0; $i < $comptListMembers; $i++) { $name = $listMembers->mem_name[$i]; $title = $listMembers->mem_title[$i]; $email = $listMembers->mem_email_work[$i]; $phone = $listMembers->mem_phone_work[$i]; $mobile = $listMembers->mem_mobile[$i]; $fax = $listMembers->mem_fax[$i]; //$ = $listMembers->[$i]; // stuff the array with data $data[] = array('name' => $name, 'title' => $title, 'email' => $email, 'phone' => $phone, 'mobile' => $mobile, 'fax' => $fax); } // print the page number $pdf->ezStartPageNumbers(526, 34, 6, 'right', '', 1); // put a line top and bottom on all the pages and company info on the bottom $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0, 0, 0, 1); $pdf->line(20, 40, 578, 40); $pdf->line(20, 822, 578, 822); $pdf->addText(50, 34, 6, $cn . " - " . $url); $pdf->AddText(510, 34, 6, "Page "); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); // make the table $pdf->ezTable($data, array('name' => 'Name', 'title' => 'Title', 'email' => 'Email', 'phone' => 'Phone', 'mobile' => 'Mobile', 'fax' => 'Fax'), '', array('fontSize' => 10, 'maxWidth' => 550)); // output the PDF $pdf->ezStream();
print("<script language=JavaScript>"); print(" alert('No hay nada que Reportar !!!');"); print(" close();"); print("</script>"); } else { $li_numrows = $io_sql->num_rows($rs_data); if ($li_numrows>0) { error_reporting(E_ALL); set_time_limit(1800); $io_pdf = new Cezpdf('LETTER','portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(5,3,3,3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(550,30,10,'','',1); // Insertar el número de página $li_count = 0; while (($row=$io_sql->fetch_row($rs_data)) && $lb_valido) { $li_count++; if ($li_count>1) { $io_pdf->ezNewPage(); } $ls_codpro = $row["cod_pro"]; $ls_nompro = $row["nompro"]; $ls_dirpro = $row["dirpro"]; $ls_telpro = $row["telpro"]; $ls_obssolcot = $row["obssol"]; $ls_fecsolcot = $row["fecsol"]; $ls_mailpro = $row["email"];
{ $lb_valido=$io_report->uf_select_concursante_concurso($ls_codcondes,$ls_codconhas,$ls_estconper,$ls_orden,$rs_datcon); if ($lb_valido==false) { print("<script language=JavaScript>"); print(" alert('No hay nada que reportar');"); print(" close();"); print("</script>"); } else // Imprimimos el reporte { error_reporting(E_ALL); set_time_limit(1800); $io_pdf=new Cezpdf('LETTER','portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezStartPageNumbers(570,47,8,'','',1); // Insertar el número de página uf_print_encabezado_pagina($ls_titulo,&$io_pdf); $ls_auxcodigo=""; $li_i=0; $li_conact=0; $li_conexc=0; while ((!$rs_datcon->EOF)&&($lb_valido)) { $ls_codigo=$rs_datcon->fields["codcon"]; if (($ls_codigo!=$ls_auxcodigo)&&($ls_auxcodigo!="")) { uf_print_datos_concurso($ls_auxcodigo,$ls_descrip,$ls_cargo,$ls_descar,$ls_fecaper,$ls_feccie, $ls_cantcar,$ls_tipo,$ls_estatus,$io_pdf);
// Cargar el DS con los datos del reporte if ($lb_valido == false) { print "<script language=JavaScript>"; print " alert('No hay nada que Reportar');"; print " close();"; print "</script>"; } else { error_reporting(E_ALL); set_time_limit(1800); $io_pdf = new Cezpdf('LETTER', 'portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(3.6, 5, 3, 3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(570, 47, 8, '', '', 1); // Insertar el número de página $li_totrow = $io_report->DS->getRowCount("numsol"); $li_monretiva = 0; for ($li_i = 1; $li_i <= $li_totrow; $li_i++) { $ls_numsol = $io_report->DS->data["numsol"][$li_i]; $ls_codpro = $io_report->DS->data["cod_pro"][$li_i]; $ls_cedbene = $io_report->DS->data["ced_bene"][$li_i]; $ls_denfuefin = $io_report->DS->data["denfuefin"][$li_i]; $ls_nombre = $io_report->DS->data["nombre"][$li_i]; $ld_fecemisol = $io_report->DS->data["fecemisol"][$li_i]; $ls_consol = $io_report->DS->data["consol"][$li_i]; $ls_obssol = $io_report->DS->data["obssol"][$li_i]; $li_monsol = $io_report->DS->data["monsol"][$li_i]; if ($ls_estretiva == "B") { $li_monretiva = $io_report->uf_select_det_deducciones_solpag($ls_numsol);
$nam = $r['nama']; $ketua = $r['nmketua']; $jur = $r['nmjur']; $ktrg = $r['ket']; $i++; } $pdf->ezText("\nNIM : {$nm}"); $pdf->ezText("\nNama Mahasiswa : {$nam}"); $pdf->ezText("\nJurusan : {$jur}"); $pdf->ezText("\nTahun Ajaran : {$tahuna}"); $pdf->ezText("\nSemester : {$semestera}"); //$pdf->ezText("\nTahun Ajaran : {$tah}/{$tah2}"); //$pdf->ezText("\nSemester : {$ktrg}"); $pdf->ezText("\n"); $ipk = $totalmutu / $totalsks; $pdf->ezTable($data); $pdf->ezText("\nTotal Mutu : {$totalmutu}"); $pdf->ezText("\nTotal SKS : {$totalsks}"); $pdf->ezText("\nIndeks Prestasi Semester (IPS) : {$ipk}"); $pdf->ezText("\n Bandung," . date('d-m-Y')); $pdf->ezText(" Ketua Jurusan"); $pdf->ezText("\n"); $pdf->ezText("\n"); $pdf->ezText("\n"); $pdf->ezText(" {$ketua}"); // Penomoran halaman $pdf->ezStartPageNumbers(320, 15, 8); $pdf->ezStream(); } else { echo "Data Nilai Kosong"; }
case "namen": // name zusammenfassen $name_join = array("abtitel", "abnamra", "abnamvor", "abamtbezkurz", "abad"); //$cfg["db"]["sql"][2] = "SELECT !felder! FROM db_adrb INNER JOIN db_adrb_dienst ON abdienst_id=abdstposten INNER JOIN db_adrb_amtbez ON abamtbez_id=abamtbez WHERE abdststelle = \"". $HTTP_GET_VARS["adid"]."\" AND abanrede !=\"Raum\" ORDER BY abnamra"; // alle sql befehle $cfg["db"]["sql"][1] = "SELECT adkate, adststelle, adtelver, adbnet, adcnet FROM db_adrd WHERE adid =" . $HTTP_GET_VARS["adid"]; $cfg["db"]["sql"][2] = "SELECT !felder! FROM db_adrb INNER JOIN db_adrb_dienst ON abdienst_id=abdstposten INNER JOIN db_adrb_amtbez ON abamtbez_id=abamtbez WHERE abdststelle = " . $HTTP_GET_VARS["adid"] . " ORDER BY abnamra"; #$cfg["db"]["sql"][3] = "SELECT !felder! FROM db_adrb WHERE abdststelle = \"". $HTTP_GET_VARS["adid"]."\" AND abanrede =\"Raum\" ORDER BY abnamra"; #$cfg["db"]["sql"][3] = "SELECT !felder! FROM db_adrb WHERE abdststelle = '". $HTTP_GET_VARS["adid"]."' AND (abdstmobil != '+49-' AND abdstmobil != '') ORDER BY abnamra"; // besondere nicht benötigte felder entfernen $kck_main = $kick; #$tab_left = array( "abtitel", "abnamra", "abnamvor", "abdstmobil"); $pdfkopf = "telint"; break; # case "adrd": # $cfg["sql"][1] = ""; # $cfg["sql"][2] = ""; # break; } 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"); // seiten raender # $pdf->ezSetMargins(80,40,50,40); // top, bottom, left, right $pdf->ezSetMargins(80, 90, 50, 40); // top, bottom, left, right // seiten nummern $pdf->ezStartPageNumbers(330, 20, 12, '', 'Seite {PAGENUM} von {TOTALPAGENUM}', 1); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public function pdfObservations($result) { global $loggedUser, $dateformat, $instDir, $objObservation, $objObserver, $objInstrument, $objLocation, $objPresentations, $objObject, $objFilter, $objEyepiece, $objLens; $result = $this->sortResult($result); $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezStartPageNumbers(300, 30, 10); $pdf->selectFont($instDir . 'lib/fonts/Helvetica.afm'); $pdf->ezText(utf8_decode(html_entity_decode($_GET['pdfTitle'])) . "\n"); $i = 0; while (list($key, $value) = each($result)) { if ($i++ > 0) { $pdf->ezNewPage(); } $obs = $objObservation->getAllInfoDsObservation($value['observationid']); $object = $objObject->getAllInfoDsObject($obs['objectname']); if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'UT')) { $date = sscanf($obs["date"], "%4d%2d%2d"); } else { $date = sscanf($obs["localdate"], "%4d%2d%2d"); } if ($obs['seeing'] > -1) { $seeing = true; } else { $seeing = false; } $formattedDate = date($dateformat, mktime(0, 0, 0, $date[1], $date[2], $date[0])); $temp = array("Name" => html_entity_decode(LangPDFMessage1) . " : " . $obs['objectname'], "altname" => html_entity_decode(LangPDFMessage2) . " : " . $object["altname"], "type" => $GLOBALS[$object['type']] . html_entity_decode(LangPDFMessage12) . $GLOBALS[$object['con']], "visibility" => $obs['visibility'] ? html_entity_decode(LangViewObservationField22) . " : " . $GLOBALS['Visibility' . $obs['visibility']] : '', "seeing" => $seeing ? LangViewObservationField6 . " : " . $GLOBALS['Seeing' . $obs['seeing']] : '', "limmag" => $obs['limmag'] ? LangViewObservationField7 . " : " . $obs['limmag'] : '', "filter" => $obs['filterid'] ? LangViewObservationField31 . " : " . $objFilter->getFilterPropertyFromId($obs['filterid'], 'name') : '', "eyepiece" => $obs['eyepieceid'] ? LangViewObservationField30 . " : " . $objEyepiece->getEyepiecePropertyFromId($obs['eyepieceid'], 'name') : '', "lens" => $obs['lensid'] ? LangViewObservationField32 . " : " . $objLens->getLensPropertyFromId($obs['lensid'], 'name') : '', "observer" => html_entity_decode(LangPDFMessage13) . $objObserver->getObserverProperty($obs['observerid'], 'firstname') . " " . $objObserver->getObserverProperty($obs['observerid'], 'name') . html_entity_decode(LangPDFMessage14) . $formattedDate, "instrument" => html_entity_decode(LangPDFMessage11) . " : " . $objInstrument->getInstrumentPropertyFromId($obs['instrumentid'], 'name'), "location" => html_entity_decode(LangPDFMessage10) . " : " . $objLocation->getLocationPropertyFromId($obs['locationid'], 'name'), "description" => $objPresentations->br2nl(html_entity_decode($obs['description'])), "desc" => html_entity_decode(LangPDFMessage15)); $obs1[] = $temp; $nm = $obs['objectname']; if ($object["altname"]) { $nm = $nm . " (" . $object["altname"] . ")"; } $pdf->ezText($nm, "14"); $tmp = array(array("type" => $temp["type"])); $pdf->ezTable($tmp, array("type" => utf8_decode(html_entity_decode(LangPDFMessage5))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); $tmp = array(array("location" => $temp["location"], "instrument" => $temp["instrument"])); $pdf->ezTable($tmp, array("location" => utf8_decode(html_entity_decode(LangPDFMessage1)), "instrument" => utf8_decode(html_entity_decode(LangPDFMessage2))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); $tmp = array(array("eyepiece" => $temp["eyepiece"])); if ($obs['eyepieceid']) { $pdf->ezTable($tmp, array("eyepiece" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); } $tmp = array(array("filter" => $temp["filter"])); if ($obs['filterid']) { $pdf->ezTable($tmp, array("filter" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); } $tmp = array(array("lens" => $temp["lens"])); if ($obs['lensid']) { $pdf->ezTable($tmp, array("lens" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); } $tmp = array(array("seeing" => $temp["seeing"])); if ($seeing) { $pdf->ezTable($tmp, array("seeing" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); } $tmp = array(array("limmag" => $temp["limmag"])); if ($obs['limmag']) { $pdf->ezTable($tmp, array("limmag" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); } $tmp = array(array("visibility" => $temp["visibility"])); if ($obs['visibility']) { $pdf->ezTable($tmp, array("visibility" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); } $tmp = array(array("observer" => $temp["observer"])); $pdf->ezTable($tmp, array("observer" => utf8_decode(html_entity_decode(LangPDFMessage1))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); $pdf->ezText(utf8_decode(LangPDFMessage15), "12"); $pdf->ezText(""); $tmp = array(array("description" => $temp["description"])); $pdf->ezTable($tmp, array("description" => utf8_decode(html_entity_decode(LangPDFMessage1))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0")); if ($objObservation->getDsObservationProperty($value['observationid'], 'hasDrawing')) { $pdf->ezText(""); $pdf->ezImage($instDir . "deepsky/drawings/" . $value['observationid'] . ".jpg", 0, 500, "none", "left"); } $pdf->ezText(""); } $pdf->ezStream(); }
$GLOBALS["table_layout_vertical"] = array('xPos' => 45, 'width' => $pdf->ez['pageWidth'] - 80, 'xOrientation' => 'right', 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.9, 0.9, 0.9), 'showLines' => 0, 'fontSize' => $GLOBALS["table_body_height"], 'leading' => "20", 'cols' => array('0' => array('width' => 150))); $GLOBALS["table_layout_horizontal"] = array('xPos' => 45, 'width' => $pdf->ez['pageWidth'] - 80, 'xOrientation' => 'right', 'showHeadings' => 1, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.9, 0.9, 0.9), 'showLines' => 0, 'fontSize' => $GLOBALS["table_body_height"], 'leading' => "20"); function header_footer($pdf) { $pdf->addText(30, 25, $GLOBALS["footer_height"], date('l, dS \\of F Y, h:i:s A')); $pdf->addText(470, 25, $GLOBALS["footer_height"], 'http://www.open-audit.org'); $im = imagecreatefrompng("./images/logo.png"); $pdf->addImage($im, 380, $pdf->ez['pageHeight'] - 58, 200); $pdf->addLink("http://www.open-audit.org", 375, $pdf->ez['pageHeight'] - 60, 575, $pdf->ez['pageHeight'] - 20); return $pdf; } //Start PDF ///////////////////////////////////////////////////////////////////////////////// $pdf->ezSetMargins('30', '40', '30', '30'); $pdf->selectFont(FPDF_FONTPATH . 'Helvetica.afm'); $pdf->ezStartPageNumbers(300, 25, $GLOBALS["footer_height"], '', '', 1); //Footer $pdf = header_footer($pdf); //Get the pc's to display //actually only one if (isset($_REQUEST["pc"]) and $_REQUEST["pc"] != "") { $pc = $_REQUEST["pc"]; $_GET["pc"] = $_REQUEST["pc"]; $sql = "SELECT system_uuid, system_timestamp, system_name FROM system WHERE system_uuid = '{$pc}' OR system_name = '{$pc}' "; $result = mysql_query($sql, $db); $i = 0; if ($myrow = mysql_fetch_array($result)) { do { $systems_array[$i] = array("pc" => $myrow["system_uuid"], "system_timestamp" => $myrow["system_timestamp"]); $i++; } while ($myrow = mysql_fetch_array($result));
function mainPdf($itemtype, $tab_id, $save = 0, $saveas = 0) { global $PDF, $DB; $config = new PluginImmobilizationsheetsConfig(); $nb_id = count($tab_id); foreach ($tab_id as $key => $ID) { $itemtable = getTableForItemType($itemtype); $PDF = new Cezpdf(); $PDF->Cezpdf('a4', 'portrait'); $PDF->selectFont(GLPI_ROOT . '/lib/ezpdf/fonts/Helvetica.afm'); $PDF->ezStartPageNumbers(550, 10, 10, 'left', "GLPI PDF export - " . date("Y-m-d H:i:s") . " - " . Toolbox::decodeFromUtf8(__('Items')) . "- {PAGENUM}/{TOTALPAGENUM}"); //items $query = "SELECT *\n FROM `" . $itemtable . "`\n WHERE `id` = '{$ID}'"; $result = $DB->query($query); $number = $DB->numrows($result); if ($number != 0) { while ($data = $DB->fetch_array($result)) { $this->generatePdf($itemtype, $data, $saveas); } } if ($config->getFromDB(1)) { if ($config->fields["use_backup"] != 1) { if ($nb_id != $key + 1) { $PDF->ezNewPage(); } } } } if ($save == 0) { $PDF->ezstream(); } }
$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) if ($showNoMilestones == '1') { $pdf->ezImage($gpdfkeyNM, 0, 765, 'width', 'left'); } else { $pdf->ezImage($gpdfkey, 0, 765, 'width', 'left'); } $pdf->ezColumnsStop(); } // End of project display // Create document body and pdf temp file $pdf->stopObject($page_header);
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; }
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"; } }
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(); }
$lb_valido=$io_report->uf_select_listado_accidentes($ls_fechades,$ls_fechahas,$ls_codperdes,$ls_codperhas,$ls_orden); // Cargar el DS con los datos del reporte if($lb_valido==false) // Existe algún error ó no hay registros { print("<script language=JavaScript>"); print(" alert('No hay nada que Reportar');"); print(" close();"); print("</script>"); } else // Imprimimos el reporte { error_reporting(E_ALL); set_time_limit(1800); $io_pdf=new Cezpdf('LEGAL','landscape'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(6,3,3,3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(950,50,9,'','',1);; // Insertar el número de página $li_totrow=$io_report->ds_detalle->getRowCount("codemp"); for($li_i=1;$li_i<=$li_totrow;$li_i++) { $ls_codigoper=$io_report->ds_detalle->data["codper"][$li_i]; $ls_nroreg=$io_report->ds_detalle->data["nroreg"][$li_i]; $ls_fecha=$io_report->ds_detalle->data["fecacc"][$li_i]; $ls_descripcion=$io_report->ds_detalle->data["descripcion"][$li_i]; $ls_testigos=$io_report->ds_detalle->data["testigos"][$li_i]; $ls_reposo=$io_report->ds_detalle->data["reposo"][$li_i]; $ls_nombreper=$io_report->ds_detalle->data["nomper"][$li_i]; $ls_apellidoper=$io_report->ds_detalle->data["apeper"][$li_i]; $ls_fecha=$io_funciones->uf_formatovalidofecha($ls_fecha); $ls_fecha=$io_funciones->uf_convertirfecmostrar($ls_fecha); $ls_cadena=$ls_nombreper." ".$ls_apellidoper; $la_data[$li_i]=array('codigo'=>$ls_codigoper,'nombre'=>$ls_cadena,'numregistro'=>$ls_nroreg,'fecha'=>$ls_fecha,
$as_fechadesde = $ls_agno . '-' . $li_mes . '-01'; $as_fechahasta = $ls_agno . '-' . $li_mes . '-' . $li_lastday; $ls_periodo = "MES: " . $ls_mes . " " . "AÑO:" . $ls_agno . ""; //-------------------------------------------------------------------------------------------------------------------------------- $arremp = $_SESSION["la_empresa"]; $ls_codemp = $arremp["codemp"]; $lb_valido = $io_report->uf_select_report_libcompra($as_fechadesde, $as_fechahasta, &$rs_resultado); error_reporting(E_ALL); set_time_limit(1800); $io_pdf = new Cezpdf('LETTER', 'portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(6.5, 3, 3, 3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(970, 40, 10, '', '', 1); // Insertar el número de página $ldec_totimp8 = 0; //Variable de tipo acumulador que almacenara el monto total de los impuestos a 8%. $ldec_totimp9 = 0; //Variable de tipo acumulador que almacenara el monto total de los impuestos a 9%. $ldec_totimp25 = 0; //Variable de tipo acumulador que almacenara el monto total de los impuestos a 25%. $ldec_totbasimp8 = 0; $ldec_totbasimp9 = 0; $ldec_totbasimp25 = 0; $ldec_totcomsiniva = 0; $ldec_totbaseimp = 0; if ($lb_valido) { $li = 0; while ($row = $io_report->io_sql->fetch_row($rs_resultado)) {
/** * 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; }
$lb_valido=$io_fun_soc->uf_load_seguridad_reporte("SOC","sigesp_soc_p_registro_orden_compra.php",$ls_descripcion); if($lb_valido) { error_reporting(E_ALL); set_time_limit(1800); $io_pdf=new Cezpdf('LETTER','portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra if ($ls_estcondat=='B') { $io_pdf->ezSetCmMargins(9,7,3.3,3); // Configuración de los margenes en centímetros } elseif($ls_estcondat=='S') { $io_pdf->ezSetCmMargins(9,6.7,3.3,3); // Configuración de los margenes en centímetros } $io_pdf->ezStartPageNumbers(588,760,8,'','',1); if ($row=$io_sql->fetch_row($rs_data)) { $ls_numordcom = $row["numordcom"]; $ls_estcondat = $row["estcondat"]; $ls_coduniadm = $row["coduniadm"]; $ls_denuniadm = $row["denuniadm"]; $ls_codfuefin = $row["codfuefin"]; $ls_denfuefin = $row["denfuefin"]; $ls_diaplacom = $row["diaplacom"]; $ls_forpagcom = $row["forpagcom"]; $ls_codpro = $row["cod_pro"]; $ls_nompro = $row["nompro"]; $ls_rifpro = $row["rifpro"]; $ls_dirpro = $row["dirpro"]; $ls_telpro = $row["telpro"];
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)); } // umbruch $pdf->ezSetDy(-10);
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"; } }
/** * Print generic footer * * @param $type display type (0=HTML, 1=Sylk,2=PDF,3=CSV) * @param $title title of file : used for PDF (default '') * * @return string to display **/ static function showFooter($type, $title = "") { $out = ""; switch ($type) { case self::PDF_OUTPUT_LANDSCAPE: //pdf global $PDF_HEADER, $PDF_ARRAY; $pdf = new Cezpdf('a4', 'landscape'); $pdf->selectFont(GLPI_ROOT . "/lib/ezpdf/fonts/Helvetica.afm"); $nb = count($PDF_ARRAY); $tmptxt = sprintf(_n('%s item', '%s items', $nb), $nb); $pdf->ezStartPageNumbers(750, 10, 10, 'left', "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . Toolbox::decodeFromUtf8($tmptxt, 'windows-1252') . " - {PAGENUM}/{TOTALPAGENUM}"); $options = array('fontSize' => 8, 'colGap' => 2, 'maxWidth' => 800, 'titleFontSize' => 8); $pdf->ezTable($PDF_ARRAY, $PDF_HEADER, Toolbox::decodeFromUtf8($title, 'windows-1252'), $options); $pdf->ezStream(); break; case self::PDF_OUTPUT_PORTRAIT: //pdf global $PDF_HEADER, $PDF_ARRAY; $pdf = new Cezpdf('a4', 'portrait'); $pdf->selectFont(GLPI_ROOT . "/lib/ezpdf/fonts/Helvetica.afm"); $nb = count($PDF_ARRAY); $tmptxt = sprintf(_n('%s item', '%s items', $nb), $nb); $pdf->ezStartPageNumbers(550, 10, 10, 'left', "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . Toolbox::decodeFromUtf8($tmptxt, 'windows-1252') . " - {PAGENUM}/{TOTALPAGENUM}"); $options = array('fontSize' => 8, 'colGap' => 2, 'maxWidth' => 565, 'titleFontSize' => 8); $pdf->ezTable($PDF_ARRAY, $PDF_HEADER, Toolbox::decodeFromUtf8($title, 'windows-1252'), $options); $pdf->ezStream(); break; case self::SYLK_OUTPUT: //sylk global $SYLK_HEADER, $SYLK_ARRAY, $SYLK_SIZE; // largeurs des colonnes foreach ($SYLK_SIZE as $num => $val) { $out .= "F;W" . $num . " " . $num . " " . min(50, $val) . "\n"; } $out .= "\n"; // Header foreach ($SYLK_HEADER as $num => $val) { $out .= "F;SDM4;FG0C;" . ($num == 1 ? "Y1;" : "") . "X{$num}\n"; $out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n"; $out .= "\n"; } // Datas foreach ($SYLK_ARRAY as $row => $tab) { foreach ($tab as $num => $val) { $out .= "F;P3;FG0L;" . ($num == 1 ? "Y" . $row . ";" : "") . "X{$num}\n"; $out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n"; } } $out .= "E\n"; break; case self::CSV_OUTPUT: //csv break; default: $out = "</table></div>\n"; } return $out; }
/* $Id$ osCmax e-Commerce http://www.oscmax.com Copyright 2000 - 2011 osCmax Released under the GNU General Public License */ // set paper type and size if ($pageloop == "0") { $pdf = new Cezpdf(A4, portrait); } else { $pdf->ezStartPageNumbers(300, 500, 20, 'left', '', ''); define('LEFT_MARGIN', '30'); // The small indents in the Sold to: Ship to: Text blocks define('TEXT_BLOCK_INDENT', '5'); define('SHIP_TO_COLUMN_START', '300'); // This changes the 'Total', 'Sub-Total', 'Tax', and 'Shipping Method' text block // position, for example if you choose to make the text a bigger font size you need to // tweak this value in order to prevent the text from clashing together define('PRODUCT_TOTAL_TITLE_COLUMN_START', '400'); define('RIGHT_MARGIN', '30'); define('LINE_LENGTH', '565'); // If you have attributes for certain products, you can have the text wrap // or just be written completely on one line, with the text wrap disabled // it makes the tables smaller appear much better, of course that is only my opinion // so I made this variable if anyone would like it to wrap. define('PRODUCT_ATTRIBUTES_TEXT_WRAP', false);
/** * Indica el momento en el que se comienzan a numerar las páginas. * @param string $posicion Indica la posicion de la numeracion de las paginas (left,right) * @param string $formato Como se visualizará la numeración de las páginas. Los formatos posibles * pueden variar siemrpe respetando el nombre de las variables. Es posible por ejemplo setear * $formato='{PAGENUM}'. Solo se visualizará el número de página. */ function numerar_paginas($posicion = 'right', $formato = '{PAGENUM} de {TOTALPAGENUM}') { $this->pdf->ezStartPageNumbers(500, 20, 8, $posicion, $formato, 1); }
$la_comprobantes = split('-', $ls_comprobantes); $la_datos = array_unique($la_comprobantes); $li_totrow = count($la_datos); sort($la_datos, SORT_STRING); if ($li_totrow <= 0) { print "<script language=JavaScript>"; print " alert('No hay nada que Reportar');"; print " close();"; print "</script>"; } else { error_reporting(E_ALL); set_time_limit(1800); $io_pdf = new Cezpdf("LETTER", "landscape"); $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); $io_pdf->ezSetCmMargins(7, 4, 3, 3); $io_pdf->ezStartPageNumbers(406, 30, 10, '', '', 1); //Insertar el número de página. $lb_valido = true; for ($li_z = 0; $li_z < $li_totrow && $lb_valido; $li_z++) { uf_print_encabezado_pagina($ls_titulo, $io_pdf); $ls_numcom = $la_datos[$li_z]; $lb_valido = $io_report->uf_retencionesmunicipales_proveedor($ls_numcom, $ls_mes, $ls_anio); if ($lb_valido) { $li_total = $io_report->DS->getRowCount("numcom"); for ($li_i = 1; $li_i <= $li_total; $li_i++) { $ls_numcon = $io_report->DS->data["numcom"][$li_i]; $ls_codret = $io_report->DS->data["codret"][$li_i]; $ls_fecrep = $io_funciones->uf_convertirfecmostrar($io_report->DS->data["fecrep"][$li_i]); $ls_perfiscal = $io_report->DS->data["perfiscal"][$li_i]; $ls_codsujret = $io_report->DS->data["codsujret"][$li_i]; $ls_nomsujret = $io_report->DS->data["nomsujret"][$li_i];
print(" alert('No hay nada que Reportar');"); print(" close();"); print("</script>"); } else // Imprimimos el reporte { $ls_descripcion="Generó el Reporte de Orden de Compra"; $lb_valido=$io_fun_soc->uf_load_seguridad_reporte("SOC","sigesp_soc_p_registro_orden_compra.php",$ls_descripcion); if($lb_valido) { error_reporting(E_ALL); set_time_limit(1800); $io_pdf=new Cezpdf('LETTER','portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(5.6,6,3,3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(588,710,7,'','',1); if ($row=$io_sql->fetch_row($rs_data)) { $ls_numordcom = $row["numordcom"]; $ls_estcondat = $row["estcondat"]; $ls_coduniadm = $row["coduniadm"]; $ls_denuniadm = $row["denuniadm"]; $ls_codfuefin = $row["codfuefin"]; $ls_denfuefin = $row["denfuefin"]; $ls_diaplacom = $row["diaplacom"]; $ls_forpagcom = $row["forpagcom"]; $ls_codpro = $row["cod_pro"]; $ls_nompro = $row["nompro"]; $ls_rifpro = $row["rifpro"]; $ls_nitpro = $row["nitpro"]; $ls_dirpro = $row["dirpro"];
$lb_valido=$io_report->uf_select_solicitud($ls_numsol); // Cargar el DS con los datos del reporte if($lb_valido==false) // Existe algún error ó no hay registros { print("<script language=JavaScript>"); print(" alert('No hay nada que Reportar');"); print(" close();"); print("</script>"); } else // Imprimimos el reporte { error_reporting(E_ALL); set_time_limit(1800); $io_pdf=new Cezpdf('LETTER','portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(5.3,6,3,3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(588,715,7,'','',1); // Insertar el número de página $li_totrow=$io_report->DS->getRowCount("numsol"); for($li_i=1;$li_i<=$li_totrow;$li_i++) { $ls_numsol=$io_report->DS->data["numsol"][$li_i]; $ls_dentipsol=$io_report->DS->data["dentipsol"][$li_i]; $ls_denuniadm=$io_report->DS->data["denuniadm"][$li_i]; $ls_denfuefin=$io_report->DS->data["denfuefin"][$li_i]; $ls_codpro=$io_report->DS->data["cod_pro"][$li_i]; $ls_cedbene=$io_report->DS->data["ced_bene"][$li_i]; $ls_nombre=$io_report->DS->data["nombre"][$li_i]; $ld_fecregsol=$io_report->DS->data["fecregsol"][$li_i]; $ls_consol=$io_report->DS->data["consol"][$li_i]; $li_monto=$io_report->DS->data["monto"][$li_i]; $li_monbasimptot=$io_report->DS->data["monbasinm"][$li_i]; $li_montotcar=$io_report->DS->data["montotcar"][$li_i];
function printPDF($p_params) { $pbConfig = new PluginBarcodeConfig(); // create barcodes $ext = 'png'; $type = $p_params['type']; $size = $p_params['size']; $orientation = $p_params['orientation']; $codes = array(); if ($type == 'QRcode') { $codes = $p_params['codes']; } else { if (isset($p_params['code'])) { if (isset($p_params['nb']) and $p_params['nb'] > 1) { $this->create($p_params['code'], $type, $ext); for ($i = 1; $i <= $p_params['nb']; $i++) { $codes[] = $p_params['code']; } } else { if (!$this->create($p_params['code'], $type, $ext)) { Session::addMessageAfterRedirect(__('The generation of some bacodes produced errors.', 'barcode')); } $codes[] = $p_params['code']; } } elseif (isset($p_params['codes'])) { $codes = $p_params['codes']; foreach ($codes as $code) { if ($code != '') { $this->create($code, $type, $ext); } } } else { // TODO : erreur ? // print_r($p_params); return 0; } } // create pdf // x is horizontal axis and y is vertical // x=0 and y=0 in bottom left hand corner $config = $pbConfig->getConfigType($type); require_once GLPI_ROOT . "/plugins/barcode/lib/ezpdf/class.ezpdf.php"; $pdf = new Cezpdf($size, $orientation); $pdf->selectFont(GLPI_ROOT . "/plugins/barcode/lib/ezpdf/fonts/Helvetica.afm"); $pdf->ezStartPageNumbers($pdf->ez['pageWidth'] - 30, 10, 10, 'left', '{PAGENUM} / {TOTALPAGENUM}') . ($width = $config['maxCodeWidth']); $height = $config['maxCodeHeight']; $marginH = $config['marginHorizontal']; $marginV = $config['marginVertical']; $heightimage = $height; if (file_exists(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png')) { // Add logo to barcode $heightLogomax = 20; $imgSize = getimagesize(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png'); $logoWidth = $imgSize[0]; $logoHeight = $imgSize[1]; if ($logoHeight > $heightLogomax) { $ratio = 100 * $heightLogomax / $logoHeight; $logoHeight = $heightLogomax; $logoWidth = $logoWidth * ($ratio / 100); } if ($logoWidth > $width) { $ratio = 100 * $width / $logoWidth; $logoWidth = $width; $logoHeight = $logoHeight * ($ratio / 100); } $heightyposText = $height - $logoHeight; $heightimage = $heightyposText; } $first = true; foreach ($codes as $code) { if ($first) { $x = $pdf->ez['leftMargin']; $y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'] - $height; $first = false; } else { if ($x + $width + $marginH > $pdf->ez['pageWidth']) { // new line $x = $pdf->ez['leftMargin']; if ($y - $height - $marginV < $pdf->ez['bottomMargin']) { // new page $pdf->ezNewPage(); $y = $pdf->ez['pageHeight'] - $pdf->ez['topMargin'] - $height; } else { $y -= $height + $marginV; } } } if ($code != '') { if ($type == 'QRcode') { $imgFile = $code; } else { $imgFile = $this->docsPath . $code . '_' . $type . '.' . $ext; } if (file_exists($imgFile)) { $imgSize = getimagesize($imgFile); $imgWidth = $imgSize[0]; $imgHeight = $imgSize[1]; if ($imgWidth > $width) { $ratio = 100 * $width / $imgWidth; $imgWidth = $width; $imgHeight = $imgHeight * ($ratio / 100); } if ($imgHeight > $heightimage) { $ratio = 100 * $heightimage / $imgHeight; $imgHeight = $heightimage; $imgWidth = $imgWidth * ($ratio / 100); } $image = imagecreatefrompng($imgFile); if ($imgWidth < $width) { $pdf->addImage($image, $x + ($width - $imgWidth) / 2, $y, $imgWidth, $imgHeight); } else { $pdf->addImage($image, $x, $y, $imgWidth, $imgHeight); } if (file_exists(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png')) { $logoimg = imagecreatefrompng(GLPI_PLUGIN_DOC_DIR . '/barcode/logo.png'); $pdf->addImage($logoimg, $x + ($width - $logoWidth) / 2, $y + $heightyposText, $logoWidth, $logoHeight); } if ($p_params['border']) { $pdf->Rectangle($x, $y, $width, $height); } } } $x += $width + $marginH; $y -= 0; } $file = $pdf->ezOutput(); $pdfFile = $_SESSION['glpiID'] . '_' . $type . '.pdf'; file_put_contents($this->docsPath . $pdfFile, $file); return '/files/_plugins/barcode/' . $pdfFile; }
$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();
if (!$lb_valido) { print "<script language=JavaScript>"; print " alert('No hay nada que Reportar');"; print " close();"; print "</script>"; } else { if ($row = $io_sql->fetch_row($rs_data)) { error_reporting(E_ALL); set_time_limit(1800); $io_pdf = new Cezpdf('LETTER', 'portrait'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(5, 3, 3, 3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(550, 30, 10, '', '', 1); // Insertar el número de página $li_count = 0; $ls_cmpmov = $rs_data->fields["cmpmov"]; $ls_feccmp = $io_funcion->uf_convertirfecmostrar($rs_data->fields["feccam"]); $ls_obscam = $rs_data->fields["obstra"]; $ls_codres = $rs_data->fields["codres"]; $ls_codact = $rs_data->fields["codact"]; $ls_ideact = $rs_data->fields["idact"]; $ls_seract = $rs_data->fields["seract"]; $ls_denact = $rs_data->fields["denact"]; $ls_codusureg = $rs_data->fields["codusureg"]; $ls_codnewres = $rs_data->fields["codresnew"]; $ls_nomres = $rs_data->fields["nomres1"]; if (empty($ls_nomres)) { $ls_nomres = $rs_data->fields["nomres2"];
print "close();"; print "</script>"; } else { ///////////////////////////////// SEGURIDAD //////////////////////////////////////////////////// $ls_desc_event = "Generó un reporte de Relacion de Bienes Muebles Faltantes. Desde el activo " . $ls_coddesde . " hasta " . $ls_codhasta; $io_fun_activos->uf_load_seguridad_reporte("SAF", "sigesp_saf_r_activo.php", $ls_desc_event); //////////////////////////////// SEGURIDAD ///////////////////////////////////////////////////// error_reporting(E_ALL); set_time_limit(1800); $io_pdf = new Cezpdf('LEGAL', 'landscape'); // Instancia de la clase PDF $io_pdf->selectFont('../../shared/ezpdf/fonts/Helvetica.afm'); // Seleccionamos el tipo de letra $io_pdf->ezSetCmMargins(3.5, 3, 3, 3); // Configuración de los margenes en centímetros $io_pdf->ezStartPageNumbers(940, 50, 10, '', '', 1); // Insertar el número de página uf_print_encabezado_pagina($ls_titulo, "", $ld_fecha, $io_pdf); // Imprimimos el encabezado de la página $li_totrow = $io_report->ds->getRowCount("cmpmov"); $i = 0; for ($li_i = 1; $li_i <= $li_totrow; $li_i++) { $io_pdf->transaction('start'); // Iniciamos la transacción $li_numpag = $io_pdf->ezPageCount; // Número de página $ls_cmpmov = $io_report->ds->data["cmpmov"][$li_i]; $ls_coduniadm = $io_report->ds->data["coduniadm"][$li_i]; $ld_feccmp = $io_report->ds->data["feccmp"][$li_i]; $ld_feccmp = $io_funciones->uf_convertirfecmostrar($ld_feccmp); $lb_valido = $io_report->uf_saf_load_dt_relbiemuefal($ls_codemp, $ls_coduniadm, $ls_cmpmov, $ld_desde, $ld_hasta, $ls_coddesde, $ls_codhasta, $ls_grupo, $ls_subgrupo, $ls_seccion, $li_orden);
function BuildPDFReport($userid) { $GLOBALS["SartON"] = time(); $q = new mysql(); $sql = "SELECT * FROM quarantine_report_users WHERE userid='{$userid}' and `type`=1 and `enabled`=1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["enabled"] == 0) { return; } $params = unserialize(base64_decode($ligne["parameters"])); $days = $params["days"]; $subject = $params["subject"]; $subject = str_replace("{", "", $subject); $subject = str_replace("}", "", $subject); $session = md5($user->password); if ($days < 1) { $days = 2; } $user = new user($userid); while (list($num, $ligne) = each($user->HASH_ALL_MAILS)) { $recipient_sql[] = "mailto='{$ligne}'"; } $date = date('Y-m-d'); $recipients = implode(" OR ", $recipient_sql); $sql = "SELECT mailfrom,zDate,MessageID,DATE_FORMAT(zdate,'%W %D %H:%i') as tdate,subject FROM quarantine\n\tWHERE (zDate>DATE_ADD('{$date}', INTERVAL -{$days} DAY)) AND ({$recipients}) ORDER BY zDate DESC;"; if ($GLOBALS["VERBOSE"]) { echo "{$sql}\n"; } $datepdf = date('Y-m-d'); $results = $q->QUERY_SQL($sql, "artica_backup"); $num_rows = mysql_num_rows($results); if (!$q->ok) { send_email_events("Build SMTP quarantine report failed for {$uid}", "{$sql}\n{$q->mysql_error}", "postfix"); return null; } if ($num_rows == 0) { return; } $pdf = new Cezpdf('a4', 'portrait'); $pdf->ezSetMargins(50, 70, 50, 50); $all = $pdf->openObject(); $pdf->saveState(); //$pdf->setStrokeColor(0,0,0,1); $pdf->line(20, 40, 578, 40); $pdf->line(20, 822, 578, 822); $pdf->addText(50, 34, 6, $date); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all, 'all'); $mainFont = dirname(__FILE__) . "/ressources/fonts/Helvetica.afm"; $codeFont = dirname(__FILE__) . "/ressources/fonts/Courier.afm"; $pdf->selectFont($mainFont); $pdf->ezText("{$user->DisplayName}\n", 30, array('justification' => 'centre')); $pdf->ezText("{$subject}\n", 20, array('justification' => 'centre')); $pdf->ezText("{$date} ({$num_rows} message(s))", 18, array('justification' => 'centre')); $pdf->ezStartPageNumbers(100, 30, 12, "left", "Page {PAGENUM}/{TOTALPAGENUM}"); $pdf->ezNewPage(); $options = array('showLines' => 2, 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.8, 0.8, 0.8), 'fontSize' => 11, 'textCol' => array(0, 0, 0), 'textCol2' => array(1, 1, 1), 'titleFontSize' => 16, 'titleGap' => 8, 'rowGap' => 5, 'colGap' => 10, 'lineCol' => array(1, 1, 1), 'xPos' => 'left', 'xOrientation' => 'right', 'width' => 500, 'maxWidth' => 500); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $mail_subject = $ligne["subject"]; $from = trim($ligne["mailfrom"]); $zDate = $ligne["tdate"]; $MessageID = $ligne["MessageID"]; if ($from == null) { $from = "unknown"; } $domain = "unknown"; if (preg_match("#(.+?)@(.+)#", $from, $re)) { $domain = $re[2]; } $mail_subject = str_replace("{", "", $mail_subject); $mail_subject = str_replace("}", "", $mail_subject); $uri = "<c:alink:{{$params["URI"]}/user.quarantine.query.php?uid={$user->uid}&session={$session}&mail={$MessageID}>{$mail_subject}</c:alink>"; $data[] = array($zDate, $from, $uri); } $pdf->ezTable($data, $cols, $subject, $options); $pdfcode = $pdf->output(); $fname = "/tmp/" . date('Ymdhi') . "-{$user->mail}-quarantines.pdf"; if ($GLOBALS["VERBOSE"]) { echo "{$pdf->messages}\nbuilding {$fname}\n"; } @unlink($fname); if ($GLOBALS["VERBOSE"]) { echo "Building {$fname}\n"; } $fp = fopen($fname, 'w'); fwrite($fp, $pdfcode); fclose($fp); if (preg_match("#(.+?)@(.+)#", $user->mail, $re)) { $domain = $re[2]; } $PostmasterAdress = "no-reply-quarantine@{$domain}"; $ini = new Bs_IniHandler("/etc/artica-postfix/smtpnotif.conf"); if ($ini->_params["SMTP"]["smtp_sender"] != null) { $PostmasterAdress = $ini->_params["SMTP"]["smtp_sender"]; } if (file_exists('/etc/artica-postfix/settings/Daemons/PostfixPostmaster')) { $PostmasterAdress = trim(@file_get_contents('/etc/artica-postfix/settings/Daemons/PostfixPostmaster')); } $unix = new unix(); $sendmail = $unix->find_program("sendmail"); $mail = new PHPMailer(true); $mail->IsSendmail(); $mail->AddAddress($user->mail, $user->DisplayName); $mail->AddReplyTo($PostmasterAdress, $PostmasterAdress); $mail->From = $PostmasterAdress; $mail->Subject = $subject; $mail->Body = "{$subject}\nSee attached file...\n"; $mail->AddAttachment($fname, basename($fname)); $content = $mail->Send(true); $tmpfile = "/tmp/" . md5(date('Y-m-d H:is') . "-{$user->uid}-msmtp"); file_put_contents($tmpfile, $content); $cmd = "{$sendmail} -bm -t -f {$PostmasterAdress} <{$tmpfile}"; system($cmd); @unlink($tmpfile); @unlink($fname); $SartOff = time(); $time_duration = distanceOfTimeInWords($GLOBALS["SartON"], $SartOff); send_email_events("SMTP quarantine report for {$user->mail} (success) {$num_rows} message(s)", "duration:{$time_duration}\nnothing to say more...", "postfix"); }