Exemple #1
1
<?php 
require_once 'class.ezpdf.php';
$pdf = new Cezpdf('a4', 'landscape');
$pdf->selectFont('../fonts/courier.afm');
$pdf->ezSetCmMargins(1, 1, 1.5, 1.5);
$conexion = mysql_connect("localhost", "admin_root", "OW5wP1dnKC");
mysql_select_db("admin_BD_detenidos", $conexion);
$queEmp = "SELECT * FROM vehiculos WHERE id_v='{$_GET['idreg']}'";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
$ixx = 0;
while ($datatmp = mysql_fetch_assoc($resEmp)) {
    if ($ixx == 0) {
    }
    $ixx = $ixx + 1;
    $pdf->ezImage("img/logo.png", 0, 0, 'none', 'left');
    $data[] = array_merge($datatmp, array('num' => $ixx));
}
$titles = array('num' => '<b>Num</b>', 'REGISTRO' => '<b>Registro</b>', 'REALIZO' => '<b>Fecha</b>', 'FECHA' => '<b>Realizo</b>', 'DESCRIPCION' => '<b>Descripción</b>', 'COMENTARIOS' => '<b>Comentarios</b>');
$options = array('shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 750);
$pdf->ezText($txttit, 10);
$pdf->ezTable($data, $titles, '', $options);
$pdf->ezStream();
     if (strstr($key, 'team50_')) {
         $parts = explode('_', $key);
         $tid = $parts[1];
         $teamList[] = $tid;
     }
 }
 $diplomaType = $_POST['diplomaType'];
 //echo("select * from tblSwimmer where id in (" . implode(',', $swimmerList) . ")");
 $rsSwimmers = $db->diplomaSwimmers($id, $swimmerList);
 $pdf = new Cezpdf();
 $pdf->selectFont('./fonts/Times-Roman');
 if ($diplomaType == 'HASI') {
     $logo = $pdf->openObject();
     $pdf->ezSetY(640);
     $pdf->ezSetMargins(0, 0, 200, 200);
     $pdf->ezImage('diploma/logo.jpg', 0, 195, 'none', 'left');
     $pdf->closeObject();
     $border = $pdf->openObject();
     $pdf->ezSetY(803.4);
     $pdf->ezSetMargins(0, 0, 23.8, 0);
     $pdf->ezImage('diploma/border.jpg', 0, 547.4, 'none', 'left');
     $pdf->closeObject();
     $pdf->ezSetMargins(0, 0, 30, 30);
     $firstPage = true;
     $swimmername = '';
     $clubname = '';
     $date = date('d-m-Y', strtotime($aryCompo['date']));
     $currentswimmer = -1;
     while ($swimmer = $db->fetch_array($rsSwimmers)) {
         if ($swimmer['sid'] != $currentswimmer) {
             if ($swimmername != '') {
Exemple #3
0
 /**
  * Inserta una imagen siguiendo el flujo del texto en el documento.
  * @version OJO! ezImage es un método en estado beta de la clase ezpdf y por lo que pude ver
  * solo funciona con archivos jpg. Utilizar con cuidado.
  * @param string $archivo full path de la imagen
  * @param string $alineacion left, right, center
  */
 function insertar_imagen($archivo, $pad = 5, $width = 0, $alineacion = 'left')
 {
     $this->pdf->ezImage("{$archivo}", $pad, $width, 'none', $alineacion);
 }
            $n_complemento = $res['n_complemento'];
            $n_numero = $res['n_numero'];
            $n_bairro = $res['n_bairro'];
            $n_cidade = $res['n_cidade'];
            $n_estado = $res['n_estado'];
            $pdf->ezSetMargins(10, 10, 25, 20);
            $pdf->ezText('Notificação', 16, array('justification' => 'center'));
            $pdf->ezText('
' . $data_atual, 12, array('justification' => 'left'));
            $pdf->ezText('
' . $n_empresa, 14);
            $pdf->ezText('Documento: ' . $n_cpf . '
' . $n_endereco . ', ' . $n_numero . ' ' . $n_complemento . '
' . $n_bairro . ' - ' . $n_cidade . ' - ' . $n_estado . '

' . $texto . '



', 12);
            $pdf->ezImage('../assinaturas/' . $assinatura1, 0, 100, '', 'center');
            $pdf->ezText('Responsável', 12, array('justification' => 'center'));
            $pdf->ezText($empresa . '
' . $cpf . '
' . $tel . ' - ' . $email, 12, array('justification' => 'center'));
            $pdf->ezNewPage();
        }
    }
}
$pdf->ezStream();
$sql = $objQuery->SQLQuery("update vsites_user_notificante as un, vsites_notificado as n set n.data_envio=NOW(), n.status='Enviado' where \n\t\tun.id_empresa='" . $controle_id_empresa . "' and\n\t\tn.id_notificante=un.id_notificante and\n\t\tn.data_envio='0000-00-00' and\n\t\tn.id_notificado in(" . $cont_on . ")");
Exemple #5
0
    }
    $count++;
}
if ($_GET['pdf'] == 1) {
    $pdf = new Cezpdf("LETTER");
    $pdf->ezSetMargins(0, 0, 0, 0);
    // we start with one large image, break it into two pages
    $page1 = imagecreate(imagesx($im) / 2, imagesy($im));
    $page2 = imagecreate(imagesx($im) / 2, imagesy($im));
    imagecopy($page1, $im, 0, 0, 0, 0, imagesx($im) / 2, imagesy($im));
    imagecopy($page2, $im, 0, 0, imagesx($im) / 2, 0, imagesx($im), imagesy($im));
    imagedestroy($im);
    // each page is built
    $tmpfilename = tempnam("/tmp", "oemr");
    imagepng($page1, $tmpfilename);
    imagedestroy($page1);
    $pdf->ezImage($tmpfilename);
    $pdf->ezNewPage();
    imagepng($page2, $tmpfilename);
    imagedestroy($page2);
    $pdf->ezImage($tmpfilename);
    // temporary file is removed
    unlink($tmpfilename);
    // output the PDF
    $pdf->ezStream();
} else {
    // older style chart that is simply a PNG image
    header("Content-type: image/png");
    imagepng($im);
    imagedestroy($im);
}
        //{die ('ERROR AL guardarO'. mysql_error());}
        header("Location:../notificaciones/4.php");
    }
    header("Location:../notificaciones/5.php");
}
/* ***IMPRIMIR*** ***IMPRIMIR*** ***IMPRIMIR*** ***IMPRIMIR*** ***IMPRIMIR*** ***IMPRIMIR***  */
if ($_POST['radio'] == 'Imprimir') {
    require_once 'lib/ezpdf.php';
    $sql = "SELECT * FROM  conductor WHERE cedulaCon='{$_POST['cedulaCon']}'";
    //result
    $resSql = mysql_query($sql) or die("<br>Error consulta</br>" . mysql_error());
    $pdf = new Cezpdf('A3');
    $pdf->selectFont('fonts/Helvetica.afm');
    //$pdf->ezText('<b>Colegio </b>',20,array('justification'=>'left'));
    while ($row = mysql_fetch_row($resSql)) {
        $data[] = array('Nombre' => $row[1], 'Apellido' => $row[2], 'C.I' => $row[3], 'Tipo de Licencia' => $row[4], 'Telefono' => $row[5], 'Modelo de Veh' => $row[6], 'Placa de Veh' => $row[7], 'Año' => $row[8], 'Ruta Asiganada' => $row[9]);
    }
    $options = array('shadeCol' => array(10.2, 10.2, 10.2), 'xOrientation' => 'center', 'width' => 800);
    $titles = array('ID' => array('justification' => 'center'), 'Nombre' => array('justification' => 'center', 'width' => '30'), 'Apellido' => array('justification' => 'center', 'width' => '30'), 'C.I' => array('justification' => 'center', 'width' => '30'), 'Tipo de Licencia' => array('justification' => 'center', 'width' => '30'), 'Modelo de Veh' => array('justification' => 'center', 'width' => '30'), 'Placa del Veh' => array('justification' => 'center', 'width' => '30'), 'Año' => array('justification' => 'center', 'width' => '30'), 'Ruta Asignada' => array('justification' => 'center', 'width' => '30'));
    $txttitle = "Colegio Cardenal JH Quintero" . "\n";
    //$pdf->ezImage($image="../img/logo.png", $pad = 0,$width = 200,$resize = 'none',$just = 'left',$border = '');
    //$pdf->addImage($img="logo.png",$x=80,$y=0,$w=200,$h=0,$quality=75);
    $pdf->ezImage("logo.png", 0, 420, 'none', 'left');
    $pdf->ezText($txttitle, 20);
    $pdf->ezText('Fecha: ' . date('d/m/Y') . "\n", 10);
    $pdf->ezText('Hora: ' . date('H:i:s') . "\n\n", 10);
    $pdf->addImage($img, 120, 300, 400, 400);
    ob_end_clean();
    $pdf->ezTable($data);
    $pdf->ezStream();
}
Exemple #7
0
    $pdf->filledRectangle($pdf->ez['leftMargin'], $pdf->y - $pdf->getFontHeight(12) + $pdf->getFontDecender(12), $pdf->ez['pageWidth'] - $pdf->ez['leftMargin'] - $pdf->ez['rightMargin'], $pdf->getFontHeight(12));
    $pdf->restoreState();
    $pdf->ezText($tmp, 12, array('justification' => 'left'));
    if ($pdf->ezPageCount == $thisPageNum) {
        $pdf->transaction('commit');
        $ok = 1;
    } else {
        // then we have moved onto a new page, bad bad, as the background rectangle will be on the old one
        $pdf->transaction('rewind');
        $pdf->ezNewPage();
    }
}
// begin include gantt graph in pdf
$pdf->ezText("\n\n");
$graphPDF = ganttPDF($reportName, $listTasks);
$pdf->ezImage($graphPDF, -5, 510, "", "left");
unlink("../files/" . $graphPDF);
// end include gantt graph in pdf
// output the PDF
$pdf->ezStream();
function ganttPDF($reportName, $listTasks)
{
    include "../includes/jpgraph/jpgraph.php";
    include "../includes/jpgraph/jpgraph_gantt.php";
    $graph = new GanttGraph();
    $graph->SetBox();
    $graph->SetMarginColor("white");
    $graph->SetColor("white");
    $graph->title->Set($strings["project"] . " " . $reportName);
    //    $graph->subtitle->Set("(".$strings["created"].": "..")");
    $graph->title->SetFont(FF_FONT1);
 function get_printable_timeSheet_file($timeSheetID, $timeSheetPrintMode, $printDesc, $format)
 {
     global $TPL;
     $TPL["timeSheetID"] = $timeSheetID;
     $TPL["timeSheetPrintMode"] = $timeSheetPrintMode;
     $TPL["printDesc"] = $printDesc;
     $TPL["format"] = $format;
     $db = new db_alloc();
     if ($timeSheetID) {
         $timeSheet = new timeSheet();
         $timeSheet->set_id($timeSheetID);
         $timeSheet->select();
         $timeSheet->set_tpl_values();
         $person = $timeSheet->get_foreign_object("person");
         $TPL["timeSheet_personName"] = $person->get_name();
         $timeSheet->set_tpl_values("timeSheet_");
         // Display the project name.
         $project = new project();
         $project->set_id($timeSheet->get_value("projectID"));
         $project->select();
         $TPL["timeSheet_projectName"] = $project->get_value("projectName", DST_HTML_DISPLAY);
         // Get client name
         $client = $project->get_foreign_object("client");
         $client->set_tpl_values();
         $TPL["clientName"] = $client->get_value("clientName", DST_HTML_DISPLAY);
         $TPL["companyName"] = config::get_config_item("companyName");
         $TPL["companyNos1"] = config::get_config_item("companyACN");
         $TPL["companyNos2"] = config::get_config_item("companyABN");
         unset($br);
         $phone = config::get_config_item("companyContactPhone");
         $fax = config::get_config_item("companyContactFax");
         $phone and $TPL["phone"] = "Ph: " . $phone;
         $fax and $TPL["fax"] = "Fax: " . $fax;
         $timeSheet->load_pay_info();
         $db->query(prepare("SELECT max(dateTimeSheetItem) AS maxDate\n                                ,min(dateTimeSheetItem) AS minDate\n                                ,count(timeSheetItemID) as count\n                            FROM timeSheetItem \n                           WHERE timeSheetID=%d ", $timeSheetID));
         $db->next_record();
         $timeSheet->set_id($timeSheetID);
         $timeSheet->select() || alloc_error("Unable to select time sheet, trying to use id: " . $timeSheetID);
         $TPL["period"] = format_date(DATE_FORMAT, $db->f("minDate")) . " to " . format_date(DATE_FORMAT, $db->f("maxDate"));
         $TPL["img"] = config::get_config_item("companyImage");
         $TPL["companyContactAddress"] = config::get_config_item("companyContactAddress");
         $TPL["companyContactAddress2"] = config::get_config_item("companyContactAddress2");
         $TPL["companyContactAddress3"] = config::get_config_item("companyContactAddress3");
         $email = config::get_config_item("companyContactEmail");
         $email and $TPL["companyContactEmail"] = "Email: " . $email;
         $web = config::get_config_item("companyContactHomePage");
         $web and $TPL["companyContactHomePage"] = "Web: " . $web;
         $TPL["footer"] = config::get_config_item("timeSheetPrintFooter");
         $TPL["taxName"] = config::get_config_item("taxName");
         $default_header = "Time Sheet";
         $default_id_label = "Time Sheet ID";
         $default_contractor_label = "Contractor";
         $default_total_label = "TOTAL AMOUNT PAYABLE";
         if ($timeSheetPrintMode == "money") {
             $default_header = "Tax Invoice";
             $default_id_label = "Invoice Number";
         }
         if ($timeSheetPrintMode == "estimate") {
             $default_header = "Estimate";
             $default_id_label = "Estimate Number";
             $default_contractor_label = "Issued By";
             $default_total_label = "TOTAL AMOUNT ESTIMATED";
         }
         if ($format != "html") {
             // Build PDF document
             $font1 = ALLOC_MOD_DIR . "util/fonts/Helvetica.afm";
             $font2 = ALLOC_MOD_DIR . "util/fonts/Helvetica-Oblique.afm";
             $pdf_table_options = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "xPos" => "left", "xOrientation" => "right", "fontSize" => 10, "rowGap" => 0, "fontSize" => 10);
             $cols = array("one" => "", "two" => "", "three" => "", "four" => "");
             $cols3 = array("one" => "", "two" => "");
             $cols_settings["one"] = array("justification" => "right");
             $cols_settings["three"] = array("justification" => "right");
             $pdf_table_options2 = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "width" => 400, "fontSize" => 10, "xPos" => "center", "xOrientation" => "center", "cols" => $cols_settings);
             $cols_settings2["gst"] = array("justification" => "right");
             $cols_settings2["money"] = array("justification" => "right");
             $pdf_table_options3 = array("showLines" => 2, "shaded" => 0, "width" => 400, "xPos" => "center", "fontSize" => 10, "cols" => $cols_settings2, "lineCol" => array(0.8, 0.8, 0.8), "splitRows" => 1, "protectRows" => 0);
             $cols_settings["two"] = array("justification" => "right", "width" => 80);
             $pdf_table_options4 = array("showLines" => 2, "shaded" => 0, "width" => 400, "showHeadings" => 0, "fontSize" => 10, "xPos" => "center", "cols" => $cols_settings, "lineCol" => array(0.8, 0.8, 0.8));
             $pdf = new Cezpdf();
             $pdf->ezSetMargins(90, 90, 90, 90);
             $pdf->selectFont($font1);
             $pdf->ezStartPageNumbers(436, 80, 10, 'right', 'Page {PAGENUM} of {TOTALPAGENUM}');
             $pdf->ezStartPageNumbers(200, 80, 10, 'left', '<b>' . $default_id_label . ': </b>' . $TPL["timeSheetID"]);
             $pdf->ezSetY(775);
             $TPL["companyName"] and $contact_info[] = array($TPL["companyName"]);
             $TPL["companyContactAddress"] and $contact_info[] = array($TPL["companyContactAddress"]);
             $TPL["companyContactAddress2"] and $contact_info[] = array($TPL["companyContactAddress2"]);
             $TPL["companyContactAddress3"] and $contact_info[] = array($TPL["companyContactAddress3"]);
             $TPL["companyContactEmail"] and $contact_info[] = array($TPL["companyContactEmail"]);
             $TPL["companyContactHomePage"] and $contact_info[] = array($TPL["companyContactHomePage"]);
             $TPL["phone"] and $contact_info[] = array($TPL["phone"]);
             $TPL["fax"] and $contact_info[] = array($TPL["fax"]);
             $pdf->selectFont($font2);
             $y = $pdf->ezTable($contact_info, false, "", $pdf_table_options);
             $pdf->selectFont($font1);
             $line_y = $y - 10;
             $pdf->setLineStyle(1, "round");
             $pdf->line(90, $line_y, 510, $line_y);
             $pdf->ezSetY(782);
             $image_jpg = ALLOC_LOGO;
             if (file_exists($image_jpg)) {
                 $pdf->ezImage($image_jpg, 0, sprintf("%d", config::get_config_item("logoScaleX")), 'none');
                 $y = 700;
             } else {
                 $y = $pdf->ezText($TPL["companyName"], 27, array("justification" => "right"));
             }
             $nos_y = $line_y + 22;
             $TPL["companyNos2"] and $nos_y = $line_y + 34;
             $pdf->ezSetY($nos_y);
             $TPL["companyNos1"] and $y = $pdf->ezText($TPL["companyNos1"], 10, array("justification" => "right"));
             $TPL["companyNos2"] and $y = $pdf->ezText($TPL["companyNos2"], 10, array("justification" => "right"));
             $pdf->ezSetY($line_y - 20);
             $y = $pdf->ezText($default_header, 20, array("justification" => "center"));
             $pdf->ezSetY($y - 20);
             $ts_info[] = array("one" => "<b>" . $default_id_label . ":</b>", "two" => $TPL["timeSheetID"], "three" => "<b>Date Issued:</b>", "four" => date("d/m/Y"));
             $ts_info[] = array("one" => "<b>Client:</b>", "two" => $TPL["clientName"], "three" => "<b>Project:</b>", "four" => $TPL["timeSheet_projectName"]);
             $ts_info[] = array("one" => "<b>" . $default_contractor_label . ":</b>", "two" => $TPL["timeSheet_personName"], "three" => "<b>Billing Period:</b>", "four" => $TPL["period"]);
             if ($timeSheetPrintMode == "estimate") {
                 // This line needs to be glued to the above line
                 $temp = array_pop($ts_info);
                 $temp["three"] = "";
                 // Nuke Billing Period for the Estimate version of the pdf.
                 $temp["four"] = "";
                 // Nuke Billing Period for the Estimate version of the pdf.
                 $ts_info[] = $temp;
             }
             $y = $pdf->ezTable($ts_info, $cols, "", $pdf_table_options2);
             $pdf->ezSetY($y - 20);
             if ($timeSheetPrintMode == "money" || $timeSheetPrintMode == "estimate") {
                 list($rows, $info) = $this->get_timeSheetItem_list_money($TPL["timeSheetID"]);
                 $cols2 = array("desc" => "Description", "units" => "Units", "money" => "Charges", "gst" => $TPL["taxName"]);
                 $taxPercent = config::get_config_item("taxPercent");
                 if ($taxPercent === '') {
                     unset($cols2["gst"]);
                 }
                 $rows[] = array("desc" => "<b>TOTAL</b>", "units" => $info["total_units"], "money" => $info["total"], "gst" => $info["total_gst"]);
                 $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3);
                 $pdf->ezSetY($y - 20);
                 if ($taxPercent !== '') {
                     $totals[] = array("one" => "TOTAL " . $TPL["taxName"], "two" => $info["total_gst"]);
                 }
                 $totals[] = array("one" => "TOTAL CHARGES", "two" => $info["total"]);
                 $totals[] = array("one" => "<b>" . $default_total_label . "</b>", "two" => "<b>" . $info["total_inc_gst"] . "</b>");
                 $y = $pdf->ezTable($totals, $cols3, "", $pdf_table_options4);
             } else {
                 if ($timeSheetPrintMode == "units") {
                     list($rows, $info) = $this->get_timeSheetItem_list_units($TPL["timeSheetID"]);
                     $cols2 = array("desc" => "Description", "units" => "Units");
                     $rows[] = array("desc" => "<b>TOTAL</b>", "units" => "<b>" . $info["total"] . "</b>");
                     $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3);
                 } else {
                     if ($timeSheetPrintMode == "items") {
                         list($rows, $info) = $this->get_timeSheetItem_list_items($TPL["timeSheetID"]);
                         $cols2 = array("date" => "Date", "units" => "Units", "multiplier_string" => "Multiplier", "desc" => "Description");
                         $rows[] = array("date" => "<b>TOTAL</b>", "units" => "<b>" . $info["total"] . "</b>");
                         $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3);
                     }
                 }
             }
             $pdf->ezSetY($y - 20);
             $pdf->ezText(str_replace(array("<br>", "<br/>", "<br />"), "\n", $TPL["footer"]), 10);
             $pdf->ezStream(array("Content-Disposition" => "timeSheet_" . $timeSheetID . ".pdf"));
             // Else HTML format
         } else {
             if (file_exists(ALLOC_LOGO)) {
                 $TPL["companyName"] = '<img alt="Company logo" src="' . $TPL["url_alloc_logo"] . '" />';
             }
             $TPL["this_tsp"] = $this;
             $TPL["main_alloc_title"] = "Time Sheet - " . APPLICATION_NAME;
             include_template(dirname(__FILE__) . "/../templates/timeSheetPrintM.tpl");
         }
     }
 }
 function get_printable_file($_FORM = array())
 {
     global $TPL;
     $db = new db_alloc();
     $TPL["companyName"] = config::get_config_item("companyName");
     $TPL["companyNos1"] = config::get_config_item("companyACN");
     $TPL["companyNos2"] = config::get_config_item("companyABN");
     $TPL["img"] = config::get_config_item("companyImage");
     $TPL["companyContactAddress"] = config::get_config_item("companyContactAddress");
     $TPL["companyContactAddress2"] = config::get_config_item("companyContactAddress2");
     $TPL["companyContactAddress3"] = config::get_config_item("companyContactAddress3");
     $email = config::get_config_item("companyContactEmail");
     $email and $TPL["companyContactEmail"] = "Email: " . $email;
     $web = config::get_config_item("companyContactHomePage");
     $web and $TPL["companyContactHomePage"] = "Web: " . $web;
     $phone = config::get_config_item("companyContactPhone");
     $fax = config::get_config_item("companyContactFax");
     $phone and $TPL["phone"] = "Ph: " . $phone;
     $fax and $TPL["fax"] = "Fax: " . $fax;
     $taskPriorities = config::get_config_item("taskPriorities");
     $projectPriorities = config::get_config_item("projectPriorities");
     // Add requested fields to pdf
     $_FORM["showEdit"] = false;
     $fields["taskID"] = "ID";
     $fields["taskName"] = "Task";
     $_FORM["showProject"] and $fields["projectName"] = "Project";
     $_FORM["showPriority"] || $_FORM["showPriorityFactor"] and $fields["priorityFactor"] = "Pri";
     $_FORM["showPriority"] and $fields["taskPriority"] = "Task Pri";
     $_FORM["showPriority"] and $fields["projectPriority"] = "Proj Pri";
     $_FORM["showCreator"] and $fields["creator_name"] = "Creator";
     $_FORM["showManager"] and $fields["manager_name"] = "Manager";
     $_FORM["showAssigned"] and $fields["assignee_name"] = "Assigned To";
     $_FORM["showDate1"] and $fields["dateTargetStart"] = "Targ Start";
     $_FORM["showDate2"] and $fields["dateTargetCompletion"] = "Targ Compl";
     $_FORM["showDate3"] and $fields["dateActualStart"] = "Start";
     $_FORM["showDate4"] and $fields["dateActualCompletion"] = "Compl";
     $_FORM["showDate5"] and $fields["dateCreated"] = "Created";
     $_FORM["showTimes"] and $fields["timeBestLabel"] = "Best";
     $_FORM["showTimes"] and $fields["timeExpectedLabel"] = "Likely";
     $_FORM["showTimes"] and $fields["timeWorstLabel"] = "Worst";
     $_FORM["showTimes"] and $fields["timeActualLabel"] = "Actual";
     $_FORM["showTimes"] and $fields["timeLimitLabel"] = "Limit";
     $_FORM["showPercent"] and $fields["percentComplete"] = "%";
     $_FORM["showStatus"] and $fields["taskStatusLabel"] = "Status";
     $rows = task::get_list($_FORM);
     $taskListRows = array();
     foreach ((array) $rows as $row) {
         $row["taskPriority"] = $taskPriorities[$row["priority"]]["label"];
         $row["projectPriority"] = $projectPriorities[$row["projectPriority"]]["label"];
         $row["taskDateStatus"] = strip_tags($row["taskDateStatus"]);
         $row["percentComplete"] = strip_tags($row["percentComplete"]);
         $taskListRows[] = $row;
     }
     if ($_FORM["format"] != "html" && $_FORM["format"] != "html_plus") {
         // Build PDF document
         $font1 = ALLOC_MOD_DIR . "util/fonts/Helvetica.afm";
         $font2 = ALLOC_MOD_DIR . "util/fonts/Helvetica-Oblique.afm";
         $pdf_table_options = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "xPos" => "left", "xOrientation" => "right", "fontSize" => 10, "rowGap" => 0, "fontSize" => 10);
         $pdf_table_options3 = array("showLines" => 2, "shaded" => 0, "width" => 750, "xPos" => "center", "fontSize" => 10, "lineCol" => array(0.8, 0.8, 0.8), "splitRows" => 1, "protectRows" => 0);
         $pdf = new Cezpdf(null, 'landscape');
         $pdf->ezSetMargins(40, 40, 40, 40);
         $pdf->selectFont($font1);
         $pdf->ezStartPageNumbers(436, 30, 10, 'center', 'Page {PAGENUM} of {TOTALPAGENUM}');
         $pdf->ezSetY(560);
         $TPL["companyContactAddress"] and $contact_info[] = array($TPL["companyContactAddress"]);
         $TPL["companyContactAddress2"] and $contact_info[] = array($TPL["companyContactAddress2"]);
         $TPL["companyContactAddress3"] and $contact_info[] = array($TPL["companyContactAddress3"]);
         $TPL["companyContactEmail"] and $contact_info[] = array($TPL["companyContactEmail"]);
         $TPL["companyContactHomePage"] and $contact_info[] = array($TPL["companyContactHomePage"]);
         $TPL["phone"] and $contact_info[] = array($TPL["phone"]);
         $TPL["fax"] and $contact_info[] = array($TPL["fax"]);
         $pdf->selectFont($font2);
         $y = $pdf->ezTable($contact_info, false, "", $pdf_table_options);
         $pdf->selectFont($font1);
         $line_y = $y - 10;
         $pdf->setLineStyle(1, "round");
         $pdf->line(40, $line_y, 801, $line_y);
         $pdf->ezSetY(570);
         $image_jpg = ALLOC_LOGO;
         if (file_exists($image_jpg)) {
             $pdf->ezImage($image_jpg, 0, sprintf("%d", config::get_config_item("logoScaleX")), 'none');
             $y = 700;
         } else {
             $y = $pdf->ezText($TPL["companyName"], 27, array("justification" => "right"));
         }
         $nos_y = $line_y + 22;
         $TPL["companyNos2"] and $nos_y = $line_y + 34;
         $pdf->ezSetY($nos_y);
         $TPL["companyNos1"] and $y = $pdf->ezText($TPL["companyNos1"], 10, array("justification" => "right"));
         $TPL["companyNos2"] and $y = $pdf->ezText($TPL["companyNos2"], 10, array("justification" => "right"));
         $pdf->ezSetY($line_y - 10);
         $y = $pdf->ezText("Task List", 20, array("justification" => "center"));
         $pdf->ezSetY($y - 20);
         $y = $pdf->ezTable($taskListRows, $fields, "", $pdf_table_options3);
         $pdf->ezSetY($y - 20);
         $pdf->ezStream();
         // Else HTML format
     } else {
         echo task::get_list_html($taskListRows, $_FORM);
     }
 }
Exemple #10
0
 function generate_invoice_file($verbose = false, $getfile = false)
 {
     // Build PDF document
     $font1 = ALLOC_MOD_DIR . "util/fonts/Helvetica.afm";
     $font2 = ALLOC_MOD_DIR . "util/fonts/Helvetica-Oblique.afm";
     $db = new db_alloc();
     // Get client name
     $client = $this->get_foreign_object("client");
     $clientName = $client->get_value("clientName");
     // Get cyber info
     $companyName = config::get_config_item("companyName");
     $companyNos1 = config::get_config_item("companyACN");
     $companyNos2 = config::get_config_item("companyABN");
     $phone = config::get_config_item("companyContactPhone");
     $fax = config::get_config_item("companyContactFax");
     $phone and $phone = "Ph: " . $phone;
     $fax and $fax = "Fax: " . $fax;
     $img = config::get_config_item("companyImage");
     $companyContactAddress = config::get_config_item("companyContactAddress");
     $companyContactAddress2 = config::get_config_item("companyContactAddress2");
     $companyContactAddress3 = config::get_config_item("companyContactAddress3");
     $email = config::get_config_item("companyContactEmail");
     $email and $companyContactEmail = "Email: " . $email;
     $web = config::get_config_item("companyContactHomePage");
     $web and $companyContactHomePage = "Web: " . $web;
     $footer = config::get_config_item("timeSheetPrintFooter");
     $taxName = config::get_config_item("taxName");
     if ($this->get_value("invoiceDateFrom") && $this->get_value("invoiceDateTo") && $this->get_value("invoiceDateFrom") != $this->get_value("invoiceDateTo")) {
         $period = format_date(DATE_FORMAT, $this->get_value("invoiceDateFrom")) . " to " . format_date(DATE_FORMAT, $this->get_value("invoiceDateTo"));
     } else {
         $period = format_date(DATE_FORMAT, $this->get_value("invoiceDateTo"));
     }
     $default_header = "Tax Invoice";
     $default_id_label = "Invoice Number";
     $pdf_table_options = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "xPos" => "left", "xOrientation" => "right", "fontSize" => 10, "rowGap" => 0, "fontSize" => 10);
     $cols = array("one" => "", "two" => "", "three" => "", "four" => "");
     $cols3 = array("one" => "", "two" => "");
     $cols_settings["one"] = array("justification" => "right");
     $cols_settings["three"] = array("justification" => "right");
     $pdf_table_options2 = array("showLines" => 0, "shaded" => 0, "showHeadings" => 0, "width" => 400, "fontSize" => 10, "xPos" => "center", "xOrientation" => "center", "cols" => $cols_settings);
     $cols_settings2["gst"] = array("justification" => "right");
     $cols_settings2["money"] = array("justification" => "right");
     $cols_settings2["unit"] = array("justification" => "right");
     $pdf_table_options3 = array("showLines" => 2, "shaded" => 0, "width" => 400, "xPos" => "center", "fontSize" => 10, "cols" => $cols_settings2, "lineCol" => array(0.8, 0.8, 0.8), "splitRows" => 1, "protectRows" => 0);
     $cols_settings["two"] = array("justification" => "right", "width" => 80);
     $pdf_table_options4 = array("showLines" => 2, "shaded" => 0, "width" => 400, "showHeadings" => 0, "fontSize" => 10, "xPos" => "center", "cols" => $cols_settings, "lineCol" => array(0.8, 0.8, 0.8));
     $pdf = new Cezpdf();
     $pdf->ezSetMargins(90, 90, 90, 90);
     $pdf->selectFont($font1);
     $pdf->ezStartPageNumbers(436, 80, 10, 'right', 'Page {PAGENUM} of {TOTALPAGENUM}');
     $pdf->ezStartPageNumbers(200, 80, 10, 'left', '<b>' . $default_id_label . ': </b>' . $this->get_value("invoiceNum"));
     $pdf->ezSetY(775);
     $companyName and $contact_info[] = array($companyName);
     $companyContactAddress and $contact_info[] = array($companyContactAddress);
     $companyContactAddress2 and $contact_info[] = array($companyContactAddress2);
     $companyContactAddress3 and $contact_info[] = array($companyContactAddress3);
     $companyContactEmail and $contact_info[] = array($companyContactEmail);
     $companyContactHomePage and $contact_info[] = array($companyContactHomePage);
     $phone and $contact_info[] = array($phone);
     $fax and $contact_info[] = array($fax);
     $pdf->selectFont($font2);
     $y = $pdf->ezTable($contact_info, false, "", $pdf_table_options);
     $pdf->selectFont($font1);
     $line_y = $y - 10;
     $pdf->setLineStyle(1, "round");
     $pdf->line(90, $line_y, 510, $line_y);
     $pdf->ezSetY(782);
     $image_jpg = ALLOC_LOGO;
     if (file_exists($image_jpg)) {
         $pdf->ezImage($image_jpg, 0, sprintf("%d", config::get_config_item("logoScaleX")), 'none');
         $y = 700;
     } else {
         $y = $pdf->ezText($companyName, 27, array("justification" => "right"));
     }
     $nos_y = $line_y + 22;
     $companyNos2 and $nos_y = $line_y + 34;
     $pdf->ezSetY($nos_y);
     $companyNos1 and $y = $pdf->ezText($companyNos1, 10, array("justification" => "right"));
     $companyNos2 and $y = $pdf->ezText($companyNos2, 10, array("justification" => "right"));
     $pdf->ezSetY($line_y - 20);
     $y = $pdf->ezText($default_header, 20, array("justification" => "center"));
     $pdf->ezSetY($y - 20);
     $ts_info[] = array("one" => "<b>" . $default_id_label . ":</b>", "two" => $this->get_value("invoiceNum"), "three" => "<b>Date Issued:</b>", "four" => date("d/m/Y"));
     $ts_info[] = array("one" => "<b>Client:</b>", "two" => $clientName, "three" => "<b>Billing Period:</b>", "four" => $period);
     $y = $pdf->ezTable($ts_info, $cols, "", $pdf_table_options2);
     $pdf->ezSetY($y - 20);
     list($rows, $info) = $this->get_invoiceItem_list_for_file($verbose);
     $cols2 = array("desc" => "Description", "quantity" => "Qty", "unit" => "Unit Price", "money" => "Charges", "gst" => $taxName);
     $taxPercent = config::get_config_item("taxPercent");
     if ($taxPercent === '') {
         unset($cols2["gst"]);
     }
     $rows[] = array("desc" => "<b>TOTAL</b>", "money" => $info["total"], "gst" => $info["total_gst"]);
     $y = $pdf->ezTable($rows, $cols2, "", $pdf_table_options3);
     $pdf->ezSetY($y - 20);
     if ($taxPercent !== '') {
         $totals[] = array("one" => "TOTAL " . $taxName, "two" => $info["total_gst"]);
     }
     $totals[] = array("one" => "TOTAL CHARGES", "two" => $info["total"]);
     $totals[] = array("one" => "<b>TOTAL AMOUNT PAYABLE</b>", "two" => "<b>" . $info["total_inc_gst"] . "</b>");
     $y = $pdf->ezTable($totals, $cols3, "", $pdf_table_options4);
     $pdf->ezSetY($y - 20);
     $pdf->ezText(str_replace(array("<br>", "<br/>", "<br />"), "\n", $footer), 10);
     // Add footer
     #$all = $pdf->openObject();
     #$pdf->saveState();
     #$pdf->addText(415,80,12,"<b>".$default_id_label.":</b>".$this->get_value("invoiceNum"));
     #$pdf->restoreState();
     #$pdf->closeObject();
     #$pdf->addObject($all,'all');
     if ($getfile) {
         return $pdf->ezOutput();
     } else {
         $pdf->ezStream(array("Content-Disposition" => "invoice_" . $this->get_id() . ".pdf"));
     }
 }
// viewer from the browser becomes intolerable in a POS environment, and
// printing HTML is much faster and easier if the browser's page setup is
// configured properly.
//
if (false) {
    // if PDF output is desired
    $pdf = new Cezpdf($dconfig['paper_size']);
    $pdf->ezSetMargins($dconfig['top'], $dconfig['bottom'], $dconfig['left'], $dconfig['right']);
    $pdf->selectFont('Helvetica');
    $pdf->ezSetDy(20);
    // dunno why we have to do this...
    $pdf->ezText($header_text, 7, array('justification' => 'center'));
    if (!empty($dconfig['logo'])) {
        $pdf->ezSetDy(-5);
        // add space (move down) before the image
        $pdf->ezImage($dconfig['logo'], 0, 180, '', 'left');
        $pdf->ezSetDy(8);
        // reduce space (move up) after the image
    }
    $pdf->ezText($label_text, 9, array('justification' => 'center'));
    $pdf->ezStream();
} else {
    // HTML output
    ?>
<html>
<script type="text/javascript" src="<?php 
    echo $webroot;
    ?>
/interface/main/tabs/js/include_opener.js"></script>
<head>
<?php 
Exemple #12
0
function buildpdf()
{
    @mkdir("/usr/share/artica-postfix/PDFs", 666, true);
    if ($GLOBALS["RCPT_TO"] == null) {
        echo "No recipient set...\n";
        return;
    }
    if ($GLOBALS["OU"] == null) {
        echo "No organization set...\n";
        return;
    }
    getSommaire();
    sql_domain();
    $date = date("Y-m-d");
    $pdf = new Cezpdf('a4', 'portrait');
    echo __FUNCTION__ . " Creating instance done...\n";
    $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("{$GLOBALS["OU"]}\n", 30, array('justification' => 'centre'));
    $pdf->ezText("Messaging report\n", 20, array('justification' => 'centre'));
    $pdf->ezText("{$date}", 18, array('justification' => 'centre'));
    $pdf->ezText(count($GLOBALS["OU-USERS"]) . " users", 18, array('justification' => 'centre'));
    $pdf->ezStartPageNumbers(100, 30, 12, "left", "Page {PAGENUM}/{TOTALPAGENUM}");
    $pdf->ezNewPage();
    $pdf->ezText("The report:", 28, array('justification' => 'left'));
    $pdf->ezText("");
    $pdf->ezText("The current report is based on " . count($GLOBALS["mydomains"]) . " domains", 12, array('justification' => 'left'));
    $pdf->ezText("Including " . @implode(", ", $GLOBALS["mydomains"]) . " for the last {$GLOBALS["LAST_DAYS"]} days", 12, array('justification' => 'left'));
    $sql = "SELECT COUNT(bounce_error) as tcount,bounce_error FROM smtp_logs WHERE {$GLOBALS["SQL_DOMAINS"]} AND time_stamp>DATE_ADD(NOW(), INTERVAL -{$GLOBALS["LAST_DAYS"]} DAY) GROUP BY bounce_error";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $data[] = array($ligne["tcount"], $ligne["bounce_error"]);
    }
    $pdf->ezText("");
    $title = "Global email status during the period";
    // 005447 = 0,0.32,0.278
    // CCCCCC = 0.8,0.8,0.8
    $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);
    $pdf->ezTable($data, $cols, $title, $options);
    $file = FlowMessages();
    $pdf->ezNewPage();
    echo __FUNCTION__ . " image {$file}\n";
    $pdf->ezImage("/usr/share/artica-postfix/PDFs/graph1.png", 5, 500, "none", 'left', 1);
    $pdf->ezText("");
    $pdf->ezImage("/usr/share/artica-postfix/PDFs/graph2.png", 5, 500, "none", 'left', 1);
    $pdf->ezNewPage();
    //----------------------------------------------------------------------------------------------------------
    $sql = "SELECT COUNT( ID ) AS tcount,delivery_user\nFROM smtp_logs\nWHERE {$GLOBALS["SQL_DOMAINS"]}\nAND time_stamp > DATE_ADD( NOW( ) , INTERVAL -{$GLOBALS["LAST_DAYS"]}\nDAY )\nGROUP BY delivery_user ORDER BY tcount DESC LIMIT 0,10 ";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    echo $sql;
    unset($data);
    $data[] = array("nb", "recipients");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["delivery_user"] == null) {
            continue;
        }
        $data[] = array($ligne["tcount"], $ligne["delivery_user"]);
    }
    $title = "Most active users (recipients) during the period";
    $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);
    $pdf->ezTable($data, $cols, $title, $options);
    //----------------------------------------------------------------------------------------------------------
    $pdf->ezText("\n");
    //----------------------------------------------------------------------------------------------------------
    $sql = "SELECT COUNT( ID ) AS tcount,sender_user\nFROM smtp_logs\nWHERE {$GLOBALS["SQL_OUT_DOMAINS"]}\nAND time_stamp > DATE_ADD( NOW( ) , INTERVAL -{$GLOBALS["LAST_DAYS"]}\nDAY )\nGROUP BY sender_user ORDER BY tcount DESC LIMIT 0,10 ";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    echo $sql;
    unset($data);
    $data[] = array("nb", "senders");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["sender_user"] == null) {
            continue;
        }
        $data[] = array($ligne["tcount"], $ligne["sender_user"]);
    }
    $title = "Most active users (senders) during the period";
    $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);
    $pdf->ezTable($data, $cols, $title, $options);
    //----------------------------------------------------------------------------------------------------------
    $pdf->ezNewPage();
    //----------------------------------------------------------------------------------------------------------
    $sql = "SELECT COUNT( ID ) AS tcount,sender_user\nFROM smtp_logs\nWHERE {$GLOBALS["SQL_DOMAINS"]}\nAND time_stamp > DATE_ADD( NOW( ) , INTERVAL -{$GLOBALS["LAST_DAYS"]}\nDAY )\nGROUP BY sender_user ORDER BY tcount DESC LIMIT 0,32 ";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    echo $sql;
    unset($data);
    $data[] = array("nb", "Internet senders");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["sender_user"] == null) {
            continue;
        }
        $data[] = array($ligne["tcount"], $ligne["sender_user"]);
    }
    $title = "Most active sender internet users during the period";
    $options = array('showLines' => 2, 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.8, 0.8, 0.8), 'fontSize' => 10, '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);
    $pdf->ezTable($data, $cols, $title, $options);
    //----------------------------------------------------------------------------------------------------------
    $pdf->ezNewPage();
    //----------------------------------------------------------------------------------------------------------
    $sql = "SELECT COUNT( ID ) AS tcount,delivery_user\nFROM smtp_logs\nWHERE {$GLOBALS["SQL_OUT_DOMAINS"]}\nAND time_stamp > DATE_ADD( NOW( ) , INTERVAL -{$GLOBALS["LAST_DAYS"]}\nDAY )\nGROUP BY delivery_user ORDER BY tcount DESC LIMIT 0,32 ";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    echo $sql;
    unset($data);
    $data[] = array("nb", "Internet recipients");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["delivery_user"] == null) {
            continue;
        }
        $data[] = array($ligne["tcount"], $ligne["delivery_user"]);
    }
    $title = "Most active internet recipients during the period";
    $options = array('showLines' => 2, 'showHeadings' => 0, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.8, 0.8, 0.8), 'fontSize' => 10, '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);
    $pdf->ezTable($data, $cols, $title, $options);
    //----------------------------------------------------------------------------------------------------------
    $pdf->ezNewPage();
    //----------------------------------------------------------------------------------------------------------;
    $pdf->ezText("Per users report", 28, array('justification' => 'center'));
    $pdf->ezText("");
    $pdf->ezText(count($GLOBALS["OU-USERS"]) . " users detailed report", 18, array('justification' => 'center'));
    //----------------------------------------------------------------------------------------------------------
    $pdf->ezNewPage();
    //----------------------------------------------------------------------------------------------------------;
    while (list($uid) = each($GLOBALS["OU-USERS"])) {
        $u = new user($uid);
        $displayname = $u->DisplayName;
        echo "Generate report for {$u->uid}\n";
        $pdf->ezText("{$displayname}", 22, array('justification' => 'left'));
        $pdf->ezText("");
        $pdf->ezText("The current report is based on " . count($u->HASH_ALL_MAILS) . " email addresses", 10, array('justification' => 'left'));
        $pdf->ezText("Including " . @implode(", ", $u->HASH_ALL_MAILS) . " mails", 10, array('justification' => 'left'));
        $pdf->ezText("\n");
        FlowMessages_users($uid, $u->HASH_ALL_MAILS);
        if (is_file("/usr/share/artica-postfix/PDFs/{$uid}-inbound.png")) {
            $pdf->ezImage("/usr/share/artica-postfix/PDFs/{$uid}-inbound.png", 5, 500, "none", 'left', 1);
            $pdf->ezText("");
        }
        if (is_file("/usr/share/artica-postfix/PDFs/{$uid}-outbound.png")) {
            $pdf->ezImage("/usr/share/artica-postfix/PDFs/{$uid}-outbound.png", 5, 500, "none", 'left', 1);
            $pdf->ezText("");
        }
        if (is_array($GLOBALS[$uid]["RECEIVE"])) {
            $title = "Most Internet senders for  {$displayname} during the period";
            $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);
            $pdf->ezTable($GLOBALS[$uid]["RECEIVE"], $cols, $title, $options);
        }
        if (is_array($GLOBALS[$uid]["SENT"])) {
            $title = "Most Internet recipients for  {$displayname} during the period";
            $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);
            $pdf->ezTable($GLOBALS[$uid]["SENT"], $cols, $title, $options);
        }
        $pdf->ezNewPage();
    }
    $pdfcode = $pdf->output();
    $fname = "/usr/share/artica-postfix/PDFs/report-director-{$GLOBALS["OU"]}.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);
    $users = new usersMenus();
    send_email_events("[ARTICA]: ({$users->hostname}) {$GLOBALS["OU"]}:: weekly report sended to {$GLOBALS["RCPT_TO"]}", "", "mailbox", date('Y-m-d H:i:s'), array($fname), $GLOBALS["RCPT_TO"]);
    if ($GLOBALS["VERBOSE"]) {
        echo "Sending mail\n";
    }
    SendMailNotif("you will find in attached file the weekly report of your {$users->hostname} mail server", "[ARTICA]: ({$users->hostname}) {$GLOBALS["OU"]}:: weekly messaging report", null, $GLOBALS["RCPT_TO"], $GLOBALS["VERBOSE"], array($fname));
}
Exemple #13
0
$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);
$gpdffile = $temp_dir . '/GanttChart_' . md5(time()) . '.pdf';
if ($fp = fopen($gpdffile, 'wb')) {
    fwrite($fp, $pdf->ezOutput());
    fclose($fp);
Exemple #14
0
 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();
 }
Exemple #15
0
                        $sum += $value['content'];
                    }
                    $pdf->ezText("--------", 8);
                    $pdf->ezText($sum, 8);
                }
                $pdf->ezText("", 12);
                $pdf->ezText("", 12);
                $pdf->ezText(xl("Digitally Signed"), 12);
                $query = sqlStatement("select t2.id, t2.fname, t2.lname, t2.title from forms as t1 join users as t2 on " . "(t1.user like t2.username) where t1.pid={$pid} and t1.encounter={$encounter}");
                if ($results = sqlFetchArray($query)) {
                    $name = $results['fname'] . " " . $results['lname'] . ", " . $results['title'];
                    $user_id = $results['id'];
                }
                $path = $GLOBALS['fileroot'] . "/interface/forms/CAMOS";
                if (file_exists($path . "/sig" . $user_id . ".jpg")) {
                    $pdf->ezImage($path . "/sig" . $user_id . ".jpg", '', '72', '', 'left', '');
                }
                $pdf->ezText($name, 12);
            }
        }
        $pdf->ezStream();
    }
}
function getFormData($start_date, $end_date, $lname, $fname)
{
    //dates in sql format
    // All 4 parameters have previously been trimmed, globally validated,
    //  and prepared for database insert
    $name_clause = '';
    $date_clause = "date(t2.date) >= '" . $start_date . "' and date(t2.date) <= '" . $end_date . "' ";
    if ($lname || $fname) {
Exemple #16
0
 $vaKepada[] = array("1" => "Kepada", "2" => ":", "3" => $nRow++ . ".", "4" => "Nama", "5" => ":", "6" => $vaLeader['nama']);
 $vaKepada[] = array("1" => "", "2" => "", "3" => "", "4" => "Pangkat / gol", "5" => ":", "6" => $vaLeader_Gol['Description'] . " / " . $vaLeader_Gol['Title']);
 $vaKepada[] = array("1" => "", "2" => "", "3" => "", "4" => "NIP", "5" => ":", "6" => $vaLeader['nip']);
 $vaKepada[] = array("1" => "", "2" => "", "3" => "", "4" => "Jabatan", "5" => ":", "6" => $vaLeader['jabatan']);
 foreach ($vaPengikut as $key => $vaData) {
     $vaPengikut_Gol = scSys::GetKeterangan("Title,Description", "Id = '{$vaData['golongan']}'", "sc_master");
     $vaKepada[] = array("1" => "", "2" => "", "3" => $nRow++ . ".", "4" => "Nama", "5" => ":", "6" => $vaData['nama']);
     $vaKepada[] = array("1" => "", "2" => "", "3" => "", "4" => "Pangkat / gol", "5" => ":", "6" => $vaPengikut_Gol['Description'] . " / " . $vaPengikut_Gol['Title']);
     $vaKepada[] = array("1" => "", "2" => "", "3" => "", "4" => "NIP", "5" => ":", "6" => $vaData['nip']);
     $vaKepada[] = array("1" => "", "2" => "", "3" => "", "4" => "Jabatan", "5" => ":", "6" => $vaData['jabatan']);
 }
 $vaUntuk = array();
 $vaUntuk[] = array("1" => "Untuk", "2" => ":", "3" => $dbRow['purpose']);
 $nFont = 11;
 $pdf = new Cezpdf("A4", "P", $vaOpt, '0');
 $pdf->ezImage(scSys::GetConfig("sc_header"), false, 100, 600);
 $pdf->ezTable($vaTable1, "", "", array("showLines" => 0, "showHeadings" => 0, "fontSize" => $nFont, "cols" => array("x" => array("width" => 60, "wrap" => 1), "1" => array("width" => 20, "wrap" => 1), "2" => array("width" => 2), "3" => array("width" => 18, "wrap" => 1))));
 $pdf->ezText("");
 $pdf->ezText("<u><b>PERINTAH PERJALANAN DINAS</b></u>", $nFont + 2, array("justification" => "center"));
 $pdf->ezText("(SPPD)", $nFont + 2, array("justification" => "center"));
 $pdf->ezText("");
 $pdf->ezTable($vaTable2, "", "", array("showLines" => 0, "showHeadings" => 0, "fontSize" => $nFont, "cols" => array("1" => array("width" => 4, "wrap" => 1), "2" => array("width" => 40, "wrap" => 1), "3" => array("width" => 56, "wrap" => 1))));
 $pdf->ezText("");
 $pdf->ezText("");
 $pdf->ezTable($vaTanggal, "", "", array("showLines" => 0, "showHeadings" => 0, "fontSize" => $nFont, "cols" => array("x" => array("width" => 50, "wrap" => 1), "1" => array("width" => 25, "wrap" => 1), "2" => array("width" => 2), "3" => array("width" => 23, "wrap" => 1))));
 $pdf->ezText("");
 $pdf->ezTable($vaTtd, "", "", array("showLines" => 0, "showHeadings" => 0, "fontSize" => $nFont, "cols" => array("x" => array("width" => 50, "wrap" => 1, "justification" => "center"), "1" => array("width" => 40, "wrap" => 1, "justification" => "center"))));
 $pdf->ezNewPage();
 $pdf->ezImage(scSys::GetConfig("sc_header"), false, 100, 600);
 $pdf->ezText("<u><b>SURAT PERINTAH TUGAS</b></u>", $nFont + 2, array("justification" => "center"));
 $pdf->ezText("NOMOR : ", $nFont + 2, array("justification" => "center"));
conectarse();
$pdf = new Cezpdf('a4');
$tmp = array('b' => 'Helvetica-Bold', 'i' => 'Helvetica-Oblique', 'bi' => 'Helvetica-BoldOblique', 'ib' => 'Helvetica-BoldOblique', 'bb' => 'Times-Roman');
$pdf->setFontFamily('helvetica', $tmp);
$pdf->selectFont('fonts/helvetica.afm');
$pdf->ezSetCmMargins(1, 1, 1.5, 1.5);
//Data loading
$sql = "select p.clave_producto,p.nombre_producto,prov.nombre,\n    p.cantidad_actual,p.status\n    from productos p\n    inner join proveedores prov on prov.clave_proveedor = p.proveedor \n    GROUP BY nombre \n    ORDER BY p.clave_producto ASC ";
$rs = mysql_query($sql);
if (mysql_num_rows($rs) > 0) {
    $ixx = 0;
    while ($datatmp = mysql_fetch_assoc($rs)) {
        $ixx = $ixx + 1;
        $data[] = array_merge($datatmp, array('clave_producto' => $ixx));
    }
}
$titles = array('clave_producto' => '<b>Id</b>', 'nombre_producto' => '<b>Nombre Producto</b>', 'nombre' => '<b>Proveedor</b>', 'cantidad_actual' => '<b>Cantidad Actual</b>', 'status' => '<b>Estado</b>');
$options = array('shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 580, 'shadeHeadingCol' => array(0.6, 0.6, 0.5), 'justification' => 'center', 'cols' => array('clave_producto' => array('justification' => 'center'), 'nombre_producto' => array('justification' => 'center'), 'nombre' => array('justification' => 'center'), 'cantidad_actual' => array('justification' => 'center')));
$pdf->ezImage('../img/libro.jpg', 0, 60, 'none', 'left');
$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(250, 770, 12, "<i>!Leer Aumenta el Saber! </i>\n");
$pdf->ezText("Estado de Productos\n", 16, array('left' => '200'));
$pdf->ezTable($data, $titles, '', $options);
$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->ezStream();
 function _print_prescription_old($p, &$toFile)
 {
     $pdf = new Cezpdf($GLOBALS['rx_paper_size']);
     $pdf->ezSetMargins($GLOBALS['rx_top_margin'], $GLOBALS['rx_bottom_margin'], $GLOBALS['rx_left_margin'], $GLOBALS['rx_right_margin']);
     $pdf->selectFont('Helvetica');
     if (!empty($this->pconfig['logo'])) {
         $pdf->ezImage($this->pconfig['logo'], "", "", "none", "left");
     }
     $pdf->ezText($p->get_prescription_display(), 10);
     if ($this->pconfig['use_signature']) {
         $pdf->ezImage($this->pconfig['signature'], "", "", "none", "left");
     } else {
         $pdf->ezText("\n\n\n\nSignature:________________________________", 10);
     }
     if (!empty($toFile)) {
         $toFile = $pdf->ezOutput();
     } else {
         $pdf->ezStream();
         // $pdf->ezStream(array('compress' => 0)); // for testing with uncompressed output
     }
     return;
 }