function event_espresso_generat_pdf($name = "Invoice", $content) { require_once 'html2fpdf.php'; //exit($content); $pdf = new HTML2FPDF('P', 'mm', 'Letter'); $pdf->AddPage(); $pdf->WriteHTML($content); $pdf->Output($name . '.pdf', 'D'); }
function Create() { $this->content = utf8_decode($this->_ParseHTML($this->content)); $pdf = new HTML2FPDF(); $pdf->ShowNOIMG_GIF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($this->content); $pdf->Output(\Cx\Lib\FileSystem\FileSystem::replaceCharacters($this->title)); }
function PDF_html_2_pdf($data) { global $auth; $pdf = new HTML2FPDF(); $pdf->UseCSS(); $pdf->UseTableHeader(); $pdf->AddPage(); $pdf->WriteHTML(AdjustHTML($data)); $pdf->Output(); }
public function createPDF($url) { $url = 'http://clients.skiify.com/eximagen/en/boligrafos-plasticos/430-boligrafo-pilot.html'; require_once '/html2pdf/html2fpdf.php'; // Create new HTML2PDF class for an A4 page, measurements in mm $pdf = new HTML2FPDF('P', 'mm', 'A4'); $buffer = file_get_contents($url); var_dump($buffer); // Optional top margin $pdf->SetTopMargin(1); $pdf->AddPage(); // Control the x-y position of the html $pdf->SetXY(0, 0); $pdf->WriteHTML($buffer); // The 'D' arg forces the browser to download the file $pdf->Output('MyFile.pdf', 'D'); }
function getContent($pageId, $action, $userId, $permission, $recursed = 0) { if ($action == "login") { if ($userId == 0) { ///Commented the requirement of login.lib.php because it is already included in /index.php //require_once("login.lib.php"); $newUserId = login(); if (is_numeric($newUserId)) { return getContent($pageId, "view", $newUserId, getPermissions($newUserId, $pageId, "view"), 0); } else { return $newUserId; } ///<The login page } else { displayinfo("You are logged in as " . getUserName($userId) . "! Click <a href=\"./+logout\">here</a> to logout."); } return getContent($pageId, "view", $userId, getPermissions($userId, $pageId, "view"), $recursed = 0); } if ($action == "profile") { if ($userId != 0) { require_once "profile.lib.php"; return profile($userId); } else { displayinfo("You need to <a href=\"./+login\">login</a> to view your profile.!"); } } if ($action == "logout") { if ($userId != 0) { $newUserId = resetAuth(); displayinfo("You have been logged out!"); global $openid_enabled; if ($openid_enabled == 'true') { displaywarning("If you logged in via Open ID, make sure you also log out from your Open ID service provider's website. Until then your session in this website will remain active !"); } return getContent($pageId, "view", $newUserId, getPermissions($newUserId, $pageId, "view"), 0); } else { displayinfo("You need to <a href=\"./+login\">login</a> first to logout!"); } } if ($action == "search") { require_once "search.lib.php"; $ret = getSearchBox(); if (isset($_POST['query'])) { $ret .= getSearchResultString($_POST['query']); } elseif (isset($_GET['query'])) { $ret .= getSearchResultString($_GET['query']); } return $ret; } if (isset($_GET['subaction']) && $_GET['subaction'] == 'getchildren') { if (isset($_GET['parentpath'])) { global $urlRequestRoot; require_once 'menu.lib.php'; $pidarr = array(); parseUrlReal(escape($_GET['parentpath']), $pidarr); $pid = $pidarr[count($pidarr) - 1]; $children = getChildren($pid, $userId); $response = array(); $response['path'] = escape($_GET['parentpath']); $response['items'] = array(); foreach ($children as $child) { $response['items'][] = array($urlRequestRoot . '/home' . escape($_GET['parentpath']) . $child[1], $child[2]); } //echo json_encode($response); exit; } } if ($permission != true) { if ($userId == 0) { $suggestion = "(Try <a href=\"./+login\">logging in?</a>)"; } else { $suggestion = ""; } displayerror("You do not have the permissions to view this page. {$suggestion}<br /><input type=\"button\" onclick=\"history.go(-1)\" value=\"Go back\" />"); return ''; } if ($action == "admin") { require_once "admin.lib.php"; return admin($pageId, $userId); } ///default actions also to be defined here (and not outside) /// Coz work to be done after these actions do involve the page $pagetype_query = "SELECT page_module, page_modulecomponentid FROM " . MYSQL_DATABASE_PREFIX . "pages WHERE page_id='" . escape($pageId) . "'"; $pagetype_result = mysql_query($pagetype_query); $pagetype_values = mysql_fetch_assoc($pagetype_result); if (!$pagetype_values) { displayerror("The requested page does not exist."); return ""; } $moduleType = $pagetype_values['page_module']; $moduleComponentId = $pagetype_values['page_modulecomponentid']; if ($action == "settings") { ///<done here because we needed to check if the page exists for sure. require_once "pagesettings.lib.php"; return pagesettings($pageId, $userId); } if ($action == "widgets") { return handleWidgetPageSettings($pageId); } if ($recursed == 0) { $pagetypeupdate_query = "UPDATE " . MYSQL_DATABASE_PREFIX . "pages SET page_lastaccesstime=NOW() WHERE page_id='" . escape($pageId) . "'"; $pagetypeupdate_result = mysql_query($pagetypeupdate_query); if (!$pagetypeupdate_result) { return '<div class="cms-error">Error No. 563 - An error has occured. Contact the site administators.</div>'; } } if ($moduleType == "link") { return getContent($moduleComponentId, $action, $userId, true, 1); } if ($action == "grant") { return grantPermissions($userId, $pageId); } if ($moduleType == "menu") { return getContent(getParentPage($pageId), $action, $userId, true, 1); } if ($moduleType == "external") { $query = "SELECT `page_extlink` FROM `" . MYSQL_DATABASE_PREFIX . "external` WHERE `page_modulecomponentid` =\n\t\t\t\t\t(SELECT `page_modulecomponentid` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_id`= '" . escape($pageId) . "')"; $result = mysql_query($query); $values = mysql_fetch_array($result); $link = $values[0]; header("Location: {$link}"); } global $sourceFolder; global $moduleFolder; require_once $sourceFolder . "/" . $moduleFolder . "/" . $moduleType . ".lib.php"; $page = new $moduleType(); if (!$page instanceof module) { displayerror("The module \"{$moduleType}\" does not implement the inteface module</div>"); return ""; } $createperms_query = " SELECT * FROM " . MYSQL_DATABASE_PREFIX . "permissionlist where perm_action = 'create' AND page_module = '" . $moduleType . "'"; $createperms_result = mysql_query($createperms_query); if (mysql_num_rows($createperms_result) < 1) { displayerror("The action \"create\" does not exist in the module \"{$moduleType}\"</div>"); return ""; } $availableperms_query = "SELECT * FROM " . MYSQL_DATABASE_PREFIX . "permissionlist where perm_action != 'create' AND page_module = '" . $moduleType . "'"; $availableperms_result = mysql_query($availableperms_query); $permlist = array(); while ($value = mysql_fetch_assoc($availableperms_result)) { array_push($permlist, $value['perm_action']); } array_push($permlist, "view"); $class_methods = get_class_methods($moduleType); foreach ($permlist as $perm) { if (!in_array("action" . ucfirst($perm), $class_methods)) { displayerror("The action \"{$perm}\" does not exist in the module \"{$moduleType}\"</div>"); return ""; } } if ($action == "pdf") { if (isset($_GET['depth'])) { $depth = $_GET['depth']; } else { $depth = 0; } if (!is_numeric($depth)) { $depth = 0; } global $TITLE; global $sourceFolder; require_once "{$sourceFolder}/modules/pdf/html2fpdf.php"; $pdf = new HTML2FPDF(); $pdf->setModuleComponentId($moduleComponentId); $pdf->AddPage(); $pdf->WriteHTML($page->getHtml($userId, $moduleComponentId, "view")); $cp = array(); $j = 0; if ($depth == -1) { $cp = child($pageId, $userId, $depth); if ($cp[0][0]) { for ($i = 0; $cp[$i][0] != NULL; $i++) { require_once $sourceFolder . "/" . $moduleFolder . "/" . $cp[$i][2] . ".lib.php"; $page1 = new $cp[$i][2](); $modCompId = $cp[$i][5]; $pdf->setModuleComponentId($modCompId); $pdf->AddPage(); $pdf->WriteHTML($page1->getHtml($userId, $modCompId, "view")); } } } else { if ($depth > 0) { $cp = child($pageId, $userId, $depth); --$depth; while ($depth > 0) { $count = count($cp); for ($j; $j < $count; $j++) { $cp = array_merge((array) $cp, (array) child($cp[$j][0], $userId, $depth)); } --$depth; } if ($cp[0][0]) { for ($i = 0; isset($cp[$i]); $i++) { require_once $sourceFolder . "/" . $moduleFolder . "/" . $cp[$i][2] . ".lib.php"; $page1 = new $cp[$i][2](); $modCompId = $cp[$i][5]; $pdf->setModuleComponentId($modCompId); $pdf->AddPage(); $pdf->WriteHTML($page1->getHtml($userId, $modCompId, "view")); } } } } $filePath = $sourceFolder . "/uploads/temp/" . $TITLE . ".pdf"; while (file_exists($filePath)) { $filePath = $sourceFolder . "/uploads/temp/" . $TITLE . "-" . rand() . ".pdf"; } $pdf->Output($filePath); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/pdf"); header("Content-Disposition: attachment; filename=\"" . basename($filePath) . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($filePath)); @readfile("{$filePath}"); unlink($filePath); } return $page->getHtml($userId, $moduleComponentId, $action); }
"",//如果要直接清除不安全的标签,这里可以留空 "", ); $str = preg_replace( $farr,$tarr,$str); return $str; } $pdf=new HTML2FPDF(); $pdf->AddGBFont('GB','仿宋_GB2312'); $pdf->SetFontSize('8'); $pdf->AddPage(); $fp = fopen("sample.html","r"); $strContent = fread($fp, filesize("sample.html")); fclose($fp); $msg=urldecode($_POST['userdefine']); $msg=str_replace("class=TableBlock", "border=1", $msg); $msg=str_replace("class=TableHeader", "bgcolor=#DDDDDD", $msg); $msg=str_replace("class=TableContent", "bgcolor=#EEEEEE", $msg); $msg=str_replace("class=TableDatat", "bgcolor=#FFFFFF", $msg); $msg=str_replace("<tr>", "<TR>", $msg); $msg=str_replace("</tr>", "</TR>", $msg); $msg=str_replace("<td", "<TD", $msg); $msg=str_replace("</td>", "</TD>", $msg); $msg=str_replace("nowrap", " ", $msg); $strContent.=uhtml($msg); //$strContent="测试"; $pdf->WriteHTML(iconv("UTF-8","GB2312",$strContent)); ob_clean(); $pdf->Output("tmp.pdf",true); //print $strContent; //echo "PDF file is generated successfully!"; ?>
function createPDF() { global $smarty; $smarty = new Smarty(); templateAssignInvoice('smarty', $this); templateAssignSystemvars('smarty'); $smarty->assign('invoice_heading', 'Faktura'); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($smarty->fetch('file:invoice.tpl')); $pdf->Output('invoice/invoice' . $this->invoice_id . '.pdf'); $smarty->assign('invoice_heading', 'Fakturakopi'); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($smarty->fetch('file:invoice.tpl')); $pdf->Output('invoice/invoice' . $this->invoice_id . '_copy.pdf'); }
public function OutputReport($szOutputBuffer, &$szErrorStr) { global $gl_root_path; // Helper variable, init with buffer $szFinalOutput = $szOutputBuffer; $res = SUCCESS; // Simple HTML Output! if ($this->_outputFormat == REPORT_OUTPUT_HTML) { // do nothing } else { if ($this->_outputFormat == REPORT_OUTPUT_PDF) { // Convert into PDF! include_once $gl_root_path . 'classes/html2fpdf/html2fpdf.php'; // $pdf=new HTML2FPDF('landscape'); $pdf = new HTML2FPDF(); $pdf->UseCss(true); $pdf->AddPage(); // $pdf->SetFontSize(12); $pdf->WriteHTML($szOutputBuffer); $szFinalOutput = $pdf->Output('', 'S'); // Output to STANDARD Input! } } // Simple HTML Output! if ($this->_outputTarget == REPORT_TARGET_STDOUT) { // Check if we need another header if ($this->_outputFormat == REPORT_OUTPUT_PDF) { Header('Content-Type: application/pdf'); } // Kindly output to browser echo $szFinalOutput; $res = SUCCESS; } else { if ($this->_outputTarget == REPORT_TARGET_FILE) { // Get Filename first if (isset($this->_arrOutputTargetDetails['filename'])) { // Get Filename property $szFilename = $this->_arrOutputTargetDetails['filename']; // Create file and Write Report into it! $handle = @fopen($szFilename, "w"); if ($handle === false) { $szErrorStr = "Could not create '" . $szFilename . "'!"; $res = ERROR; } else { fwrite($handle, $szFinalOutput); fflush($handle); fclose($handle); // For result $szErrorStr = "Results were saved into '" . $szFilename . "'"; $res = SUCCESS; } } else { $szErrorStr = "The parameter 'filename' was missing."; $res = ERROR; } } } // return result return $res; }
<tr class="fil"> <td><span>5.2 PRESUPUESTO DEL PROYECTO : <?php echo strtoupper(utf8_encode($value[39])); ?> </span> </td> </tr> <tr class="fil"> <td><span>5.3 FINANCIAMIENTO : <?php echo strtoupper(utf8_encode($value[41])); ?> </strong></span> </td> </tr> <?php } ?> </tbody></table> </div> <?php $content = ob_get_clean(); $pdf = new HTML2FPDF('P', 'mm', 'A4', 'UTF-8'); $pdf->UseCSS($opt == true); $pdf->AddPage(); $pdf->WriteHTML($content); $pdf->ReadCSS($content); $pdf->Output('proyecto.pdf'); ?>
public function executeInvoice(sfWebRequest $request) { sfLoader::loadHelpers(array("Asset", "Tag")); $job = $this->getRoute()->getObject(); $pdf = new HTML2FPDF(); $img = "<img src='http://photo.tufts.edu/images/tufts_logo_226x78.jpg'></a>"; $date = date("F d, Y"); $jobId = $job->getId(); $publicationName = $job->getPublicationId() ? $job->getPublication()->getName() : ""; $jobDate = $job->getDate() ? $job->getDate("F d, Y") : ""; $total = $job->getEstimate() + $job->getProcessing(); $clients = ""; $photographers = ""; foreach ($job->getClients() as $i) { $clients .= $i->getName() . "<br />"; $clients .= $i->getDepartment() . "<br />"; $clients .= $i->getAddress() . "<br />"; } foreach ($job->getPhotographers() as $i) { $photographers .= $i->getName() . ", " . $i->getAffiliation() . "<br><br>"; } $invoiceHTML = <<<EOF \t\t<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> \t\t<html> \t\t <head><title></title></head> \t\t <body> <div style="width:600px;height:800px;"> <p style="margin-left:50px; float: left;"> {$img} </p> <p align="right" style="padding-right:50px;margin-top:-30px;font-family:arial;"> <b>University Relations</b> <br><br> University Photography </p> <div style="padding-left:20px;"> <p>({$date})</p> <p><b>INVOICE #{$jobId}</b></p> <p><b>Client (Bill to)</b></p> {$clients} <p><b>Job</b></p> <p>Job #{$jobId}<br> {$job->getEvent()}<br> {$publicationName}<br> </p> <p>{$jobDate}<br> {$job->getStartTime()} - {$job->getEndTime()}<br> {$job->getPrettyAddress()} </p> <p><b>Charges</b></p> <p>{$photographers}</p> <p> Shoot Fee: \${$job->getEstimate()}<br> Processing: \${$job->getProcessing()}<br> </p> <b>TOTAL: \${$total}</b></div> <div style="margin-top:75px;margin-left:10px;"> <p style="font-family:arial; color:#cccccc;"> 80 George Street, Medford, MA 02155 | TEL: 617.627.3549 | FAX: 617.627.3549 </p> </div> </div> </body> </html> EOF; // $this->renderText($invoiceHTML); $pdf->AddPage(); $pdf->WriteHTML($invoiceHTML); $pdf->Output("", "I"); return sfView::NONE; }
$xtpl->assign("dividerSpan", 4); //Assign DetailView Fileds $xtpl->assign('name', $focus->name); $xtpl->assign('account_name', $focus->account_name); $xtpl->assign('account_id', $focus->account_id); $xtpl->assign('contact_name', $focus->contact_name); $xtpl->assign('contact_id', $focus->contact_id); $xtpl->assign('assigned_user_name', $focus->assigned_user_name); $xtpl->assign('description', nl2br(url2html($focus->description))); $xtpl->assign('vision', $focus->vision); $xtpl->assign('period', $app_list_strings['clientorders_period_options'][$focus->period]); $xtpl->assign('pnum', $focus->number); $xtpl->assign('category', $app_list_strings['clientorders_category_options'][$focus->category]); $xtpl->assign('note', $focus->note); $xtpl->assign('quantity', $focus->quantity); $xtpl->assign('status', $app_list_strings['clientorder_component_status'][$focus->status]); $xtpl->assign('samples', $focus->samples); $xtpl->assign('file', $focus->file); $xtpl->assign('deadline', $focus->deadline); $xtpl->assign('date_entered', $focus->date_entered); $xtpl->assign('date_modified', $focus->date_modified); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $xtpl->parse("main"); $html = $xtpl->pdf_out('main'); $html_encoded = iconv('utf-8', 'CP1251', $html); $pdf->UseCSS(true); $pdf->DisableTags(); $pdf->WriteHTML($html_encoded); //echo $html_encoded; $pdf->Output("{$focus->number}.pdf", 'D');
<?php /* ob_start(); include("../../view/template/receipt.php"); $content = ob_get_clean();*/ $htmlfile = "http://localhost/source/view/template/receipt.php"; require "html2pdf.class.php"; try { $html2pdf = new HTML2FPDF('P', 'mm', 'Letter'); // $fp = fopen("../../view/template/receipt.php", "r"); $contents = file_get_contents($htmlfile); // fclose($fp); // echo $contents; $html2pdf->WriteHTML($contents); $html2pdf->Output('receipt.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; }
if ($pfDebug) { echo @"\n<style type=\"text/css\">\n#debugdiv {\nfloat: none;\nposition: absolute;\n/*top: 120;\nleft: 500;*/\ndisplay: none;\n}\n</style>\n<script language=\"javascript\">\nfunction toggleDebugDiv() {\n var dbgdiv = document.getElementById('debugdiv'); \n var displ = dbgdiv.style.display;\n if ((displ == 'none') || (displ == '')) {\n dbgdiv.style.display = 'block';\n } else {\n dbgdiv.style.display = 'none'; \n }\n}\n</script>\n"; echo '<div style="text-align: left;"><a href="javascript: toggleDebugDiv();" />DEBUG:</a></div><div id="debugdiv"><table style="background-color: aliceblue; padding: 8pt; border: thick dotted khaki; width: 700px; margin-top: 24pt;"><tr><td><h2>performs.php</h2></td></tr><tr><td>'; $tabs = new mosTabs(0); //startTab (joomla.php line 4318 version 1.0.11) only ever adds tabs to tabPane1 ... $tabs->startPane("session"); report_env($tabs, 1); // $tabs->startTab("MAKE", 'session'); } /*============================================================================*/ $strResult = $objMyForm->make(); if ($pfDebug) { $tabs->endTab(); $tabs->endPane(); } if ($printpdf) { $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($strResult); ob_end_clean(); $pdf->Output('doc.pdf', 'D'); } else { echo $strResult; } } function die2($dietxt) { global $pfDebug; die($dietxt); }
<?php require 'html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->AddGBFont('GB', 'GB2312'); $pdf->AddPage(); $fp = fopen("../../index2.html", "r"); $html = fread($fp, filesize("../../index2.html")); fclose($fp); $pdf->WriteHTML(iconv("UTF-8", "GB2312", $html)); ob_clean(); $pdf->Output("tmp.pdf", true); //echo "PDF file is generated successfully!";
function EmailInvoice($id, $invoice_type = 1) { //getpost_ifset(array('customer', 'posted', 'Period', 'cardid','exporttype','choose_billperiod','id','invoice_type')); if ($invoice_type == "") { $invoice_type = 1; } if ($invoice_type == 1) { $cardid = $id; if ($cardid == "") { exit("Invalid ID"); } } if ($invoice_type == 2) { if ($id == "" || !is_numeric($id)) { exit(gettext("Invalid ID")); } } if ($invoice_type == 1) { $invoice_heading = gettext("Unbilled Details"); $invocie_top_heading = gettext("Unbilled Invoice Details for Card Number"); } else { $invoice_heading = gettext("Billed Details"); $invocie_top_heading = gettext("Billed Invoice Details for Card Number"); } $DBHandle = DbConnect(); $num = 0; if ($invoice_type == 1) { $QUERY = "Select username, vat, t1.id from cc_card t1 where t1.id = {$cardid}"; } else { $QUERY = "Select username, vat, t1.id from cc_card t1, cc_invoices t2 where t1.id = t2.cardid and t2.id = {$id}"; } $res_user = $DBHandle->Execute($QUERY); if ($res_user) { $num = $res_user->RecordCount(); } if ($num > 0) { $userRecord = $res_user->fetchRow(); $customer = $userRecord[0]; $vat = $userRecord[1]; $customerID = $userRecord[2]; } else { exit(gettext("No User found")); } if (!isset($current_page) || $current_page == "") { $current_page = 0; } // this variable specifie the debug type (0 => nothing, 1 => sql result, 2 => boucle checking, 3 other value checking) $FG_DEBUG = 0; // The variable FG_TABLE_NAME define the table name to use $FG_TABLE_NAME = "cc_call t1"; // The variable Var_col would define the col that we want show in your table // First Name of the column in the html page, second name of the field $FG_TABLE_COL = array(); $FG_TABLE_COL[] = array(gettext("Calldate"), "starttime", "18%", "center", "SORT", "19", "", "", "", "", "", "display_dateformat"); $FG_TABLE_COL[] = array(gettext("Source"), "src", "10%", "center", "SORT", "30"); $FG_TABLE_COL[] = array(gettext("Callednumber"), "calledstation", "18%", "right", "SORT", "30", "", "", "", "", "", ""); $FG_TABLE_COL[] = array(gettext("Destination"), "destination", "18%", "center", "SORT", "30", "", "", "", "", "", "remove_prefix"); $FG_TABLE_COL[] = array(gettext("Duration"), "sessiontime", "8%", "center", "SORT", "30", "", "", "", "", "", "display_minute"); if (!(isset($customer) && $customer > 0) && !(isset($entercustomer) && $entercustomer > 0)) { $FG_TABLE_COL[] = array(gettext("Cardused"), "username", "11%", "center", "SORT", "30"); } $FG_TABLE_COL[] = array(gettext("Cost"), "sessionbill", "9%", "center", "SORT", "30", "", "", "", "", "", "display_2bill"); $FG_TABLE_DEFAULT_ORDER = "t1.starttime"; $FG_TABLE_DEFAULT_SENS = "DESC"; // This Variable store the argument for the SQL query $FG_COL_QUERY = 't1.starttime, t1.src, t1.calledstation, t1.destination, t1.sessiontime '; if (!(isset($customer) && $customer > 0) && !(isset($entercustomer) && $entercustomer > 0)) { $FG_COL_QUERY .= ', t1.username'; } $FG_COL_QUERY .= ', t1.sessionbill'; if (LINK_AUDIO_FILE == 'YES') { $FG_COL_QUERY .= ', t1.uniqueid'; } $FG_COL_QUERY_GRAPH = 't1.callstart, t1.duration'; // The variable LIMITE_DISPLAY define the limit of record to display by page $FG_LIMITE_DISPLAY = 500; // Number of column in the html table $FG_NB_TABLE_COL = count($FG_TABLE_COL); //This variable will store the total number of column $FG_TOTAL_TABLE_COL = $FG_NB_TABLE_COL; if ($FG_DELETION || $FG_EDITION) { $FG_TOTAL_TABLE_COL++; } if ($FG_DEBUG == 3) { echo "<br>Table : {$FG_TABLE_NAME} \t- \tCol_query : {$FG_COL_QUERY}"; } $instance_table = new Table($FG_TABLE_NAME, $FG_COL_QUERY); $instance_table_graph = new Table($FG_TABLE_NAME, $FG_COL_QUERY_GRAPH); if (is_null($order) || is_null($sens)) { $order = $FG_TABLE_DEFAULT_ORDER; $sens = $FG_TABLE_DEFAULT_SENS; } if ($posted == 1) { $SQLcmd = ''; $SQLcmd = do_field($SQLcmd, 'src', 'src'); $SQLcmd = do_field($SQLcmd, 'dst', 'calledstation'); } $date_clause = ''; // Period (Month-Day) if (DB_TYPE == "postgres") { $UNIX_TIMESTAMP = ""; } else { $UNIX_TIMESTAMP = "UNIX_TIMESTAMP"; } $lastdayofmonth = date("t", strtotime($tostatsmonth . '-01')); if ($Period == "Month") { if ($frommonth && isset($fromstatsmonth)) { $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) >= {$UNIX_TIMESTAMP}('{$fromstatsmonth}-01')"; } if ($tomonth && isset($tostatsmonth)) { $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) <= {$UNIX_TIMESTAMP}('" . $tostatsmonth . "-{$lastdayofmonth} 23:59:59')"; } } else { if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday) && isset($fromstatsmonth_shour) && isset($fromstatsmonth_smin)) { $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) >= {$UNIX_TIMESTAMP}('{$fromstatsmonth_sday}-{$fromstatsday_sday} {$fromstatsmonth_shour}:{$fromstatsmonth_smin}')"; } if ($today && isset($tostatsday_sday) && isset($tostatsmonth_sday) && isset($tostatsmonth_shour) && isset($tostatsmonth_smin)) { $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) <= {$UNIX_TIMESTAMP}('{$tostatsmonth_sday}-" . sprintf("%02d", intval($tostatsday_sday)) . " {$tostatsmonth_shour}:{$tostatsmonth_smin}')"; } } if (strpos($SQLcmd, 'WHERE') > 0) { $FG_TABLE_CLAUSE = substr($SQLcmd, 6) . $date_clause; } elseif (strpos($date_clause, 'AND') > 0) { $FG_TABLE_CLAUSE = substr($date_clause, 5); } if (isset($customer) && $customer > 0) { if (strlen($FG_TABLE_CLAUSE) > 0) { $FG_TABLE_CLAUSE .= " AND "; } $FG_TABLE_CLAUSE .= "t1.username='******'"; } else { if (isset($entercustomer) && $entercustomer > 0) { if (strlen($FG_TABLE_CLAUSE) > 0) { $FG_TABLE_CLAUSE .= " AND "; } $FG_TABLE_CLAUSE .= "t1.username='******'"; } } if (strlen($FG_TABLE_CLAUSE) > 0) { $FG_TABLE_CLAUSE .= " AND "; } if ($invoice_type == 1) { $FG_TABLE_CLAUSE .= "t1.starttime >(Select CASE WHEN max(cover_enddate) IS NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices WHERE cardid = '{$cardid}')"; } else { $FG_TABLE_CLAUSE .= "t1.starttime >(Select cover_startdate from cc_invoices where id ='{$id}') AND t1.stoptime <(Select cover_enddate from cc_invoices where id ='{$id}') "; } if (!$nodisplay) { $list = $instance_table->Get_list($DBHandle, $FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page * $FG_LIMITE_DISPLAY); } $_SESSION["pr_sql_export"] = "SELECT {$FG_COL_QUERY} FROM {$FG_TABLE_NAME} WHERE {$FG_TABLE_CLAUSE}"; /************************/ $QUERY = "SELECT substring(t1.starttime,1,10) AS day, sum(t1.sessiontime) AS calltime, sum(t1.sessionbill) AS cost, count(*) as nbcall FROM {$FG_TABLE_NAME} WHERE " . $FG_TABLE_CLAUSE . " GROUP BY substring(t1.starttime,1,10) ORDER BY day"; //extract(DAY from calldate) if (!$nodisplay) { $list_total_day = $instance_table->SQLExec($DBHandle, $QUERY); $nb_record = $instance_table->Table_count($DBHandle, $FG_TABLE_CLAUSE); } // GROUP BY DESTINATION FOR THE INVOICE $QUERY = "SELECT destination, sum(t1.sessiontime) AS calltime, \n\tsum(t1.sessionbill) AS cost, count(*) as nbcall FROM {$FG_TABLE_NAME} WHERE " . $FG_TABLE_CLAUSE . " GROUP BY destination"; if (!$nodisplay) { $list_total_destination = $instance_table->SQLExec($DBHandle, $QUERY); } //end IF nodisplay /************************************************ DID Billing Section *********************************************/ // Fixed + Dial = 0 ; Fixed = 1 ; Dail = 2 ; Free = 3 // 1. Billing Type:: All DID Calls that have DID Type 0 and 2 if ($invoice_type == 1) { $QUERY = "SELECT t1.amount, t1.creationdate, t1.description, t3.countryname, t2.did, t1.currency " . " FROM cc_charge t1 LEFT JOIN (cc_did t2, cc_country t3 ) ON ( t1.id_cc_did = t2.id AND t2.id_cc_country = t3.id ) " . " WHERE (t1.chargetype = 1 OR t1.chargetype = 2) AND t1.id_cc_card = " . $cardid . " AND t1.creationdate >(Select CASE WHEN max(cover_enddate) IS NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices)"; } else { $QUERY = "SELECT t1.amount, t1.creationdate, t1.description, t3.countryname, t2.did, t1.currency " . " FROM cc_charge t1 LEFT JOIN (cc_did t2, cc_country t3 ) ON ( t1.id_cc_did = t2.id AND t2.id_cc_country = t3.id ) " . " WHERE (t1.chargetype = 2 OR t1.chargetype = 1) AND t1.id_cc_card = " . $customerID . " AND t1.creationdate > (Select cover_startdate from cc_invoices where id ='{$id}') AND t1.creationdate <(Select cover_enddate from cc_invoices where id ='{$id}')"; } if (!$nodisplay) { $list_total_did = $instance_table->SQLExec($DBHandle, $QUERY); } /*************************************************CHARGES SECTION START ************************************************/ // Charge Types // Connection charge for DID setup = 1 // Monthly Charge for DID use = 2 // Subscription fee = 3 // Extra charge = 4 if ($invoice_type == 1) { $QUERY = "SELECT t1.id_cc_card, t1.iduser, t1.creationdate, t1.amount, t1.chargetype, t1.id_cc_did, t1.currency, t1.description" . " FROM cc_charge t1, cc_card t2 WHERE (t1.chargetype <> 1 AND t1.chargetype <> 2) " . " AND t2.username = '******' AND t1.id_cc_card = t2.id AND t1.creationdate >= (Select CASE WHEN max(cover_enddate) is NULL " . " THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices) Order by t1.creationdate"; } else { $QUERY = "SELECT t1.id_cc_card, t1.iduser, t1.creationdate, t1.amount, t1.chargetype, t1.id_cc_did, t1.currency, t1.description" . " FROM cc_charge t1, cc_card t2 WHERE (t1.chargetype <> 2 AND t1.chargetype <> 1)" . " AND t2.username = '******' AND t1.id_cc_card = t2.id AND " . " t1.creationdate >(Select cover_startdate from cc_invoices where id ='{$id}') " . " AND t1.creationdate <(Select cover_enddate from cc_invoices where id ='{$id}')"; } if (!$nodisplay) { $list_total_charges = $instance_table->SQLExec($DBHandle, $QUERY); } /*************************************************CHARGES SECTION END ************************************************/ if ($nb_record <= $FG_LIMITE_DISPLAY) { $nb_record_max = 1; } else { if ($nb_record % $FG_LIMITE_DISPLAY == 0) { $nb_record_max = intval($nb_record / $FG_LIMITE_DISPLAY); } else { $nb_record_max = intval($nb_record / $FG_LIMITE_DISPLAY) + 1; } } /*************************************************************/ if (isset($customer) && $customer > 0 || isset($entercustomer) && $entercustomer > 0) { $FG_TABLE_CLAUSE = ""; if (isset($customer) && $customer > 0) { $FG_TABLE_CLAUSE = " username='******' "; } elseif (isset($entercustomer) && $entercustomer > 0) { $FG_TABLE_CLAUSE = " username='******' "; } $instance_table_customer = new Table("cc_card", "id, username, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, activated, creationdate"); $info_customer = $instance_table_customer->Get_list($DBHandle, $FG_TABLE_CLAUSE, "id", "ASC", null, null, null, null); } if ($invoice_type == 1) { $QUERY = "Select CASE WHEN max(cover_enddate) is NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices WHERE cardid = " . $cardid; } else { $QUERY = "Select cover_enddate,cover_startdate from cc_invoices where id ='{$id}'"; } if (!$nodisplay) { $invoice_dates = $instance_table->SQLExec($DBHandle, $QUERY); if ($invoice_dates[0][0] == '0001-01-01 01:00:00') { $invoice_dates[0][0] = $info_customer[0][13]; } } require '../Public/pdf-invoices/html2pdf/html2fpdf.php'; ob_start(); $currencies_list = get_currencies(); //For DID DIAL & Fixed + Dial $totalcost = 0; if (is_array($list_total_destination) && count($list_total_destination) > 0) { $mmax = 0; $totalcall = 0; $totalminutes = 0; foreach ($list_total_destination as $data) { if ($mmax < $data[1]) { $mmax = $data[1]; } $totalcall += $data[3]; $totalminutes += $data[1]; $totalcost += $data[2]; } } ?> <table cellpadding="0" align="center"> <tr> <td align="center"> <img src="<?php echo Images_Path; ?> /asterisk01.jpg" align="middle"> </td> </tr> </table> <br> <center><h4><font color="#FF0000"><?php echo $invocie_top_heading; ?> <?php echo $info_customer[0][1]; ?> </font></h4></center> <br> <br> <table cellspacing="0" cellpadding="2" align="center" width="80%" > <tr> <td colspan="2" bgcolor="#FFFFCC"><font size="5" color="#FF0000"><?php echo $invoice_heading; ?> </font></td> </tr> <tr> <td valign="top" colspan="2"></td> </tr> <tr> <td width="35%"> </td> <td > </td> </tr> <tr> <td width="35%" ><font color="#003399"><?php echo gettext("Name"); ?> :</font> </td> <td ><font color="#003399"><?php echo $info_customer[0][3] . " " . $info_customer[0][2]; ?> </font></td> </tr> <tr> <td width="35%" ><font color="#003399"><?php echo gettext("Card Number"); ?> :</font></td> <td ><font color="#003399"><?php echo $info_customer[0][1]; ?> </font> </td> </tr> <?php if ($invoice_type == 1) { ?> <tr> <td width="35%" ><font color="#003399"><?php echo gettext("From Date"); ?> :</font></td> <td><font color="#003399"><?php echo display_dateonly($invoice_dates[0][0]); ?> </font></td> </tr> <?php } else { ?> <tr> <td width="35%" ><font color="#003399"><?php echo gettext("From Date"); ?> :</font></td> <td ><font color="#003399"><?php echo display_dateonly($invoice_dates[0][1]); ?> </font></td> </tr> <tr> <td width="35%" ><font color="#003399"><?php echo gettext("To Date"); ?> :</font></td> <td><font color="#003399"><?php echo display_dateonly($invoice_dates[0][0]); ?> </font></td> </tr> <?php } ?> </table> <table align="center" width="80%"> <?php if (is_array($list_total_destination) && count($list_total_destination) > 0) { ?> <tr> <td colspan="4" align="center"><font> <b><?php echo gettext("By Destination"); ?> </b></font> </td> </tr> <tr bgcolor="#CCCCCC"> <td width="29%"><font color="#003399"><b><?php echo gettext("Destination"); ?> </b></font></td> <td width="38%" ><font color="#003399"><b><?php echo gettext("Duration"); ?> </b></font> </td> <td width="12%" align="center" ><font color="#003399"><b><?php echo gettext("Calls"); ?> </b></font></td> <td align="right"><font color="#003399"><b><?php echo gettext("Amount") . " (" . BASE_CURRENCY . ")"; ?> </b></font></td> </tr> <?php $i = 0; foreach ($list_total_destination as $data) { $i = ($i + 1) % 2; $tmc = $data[1] / $data[3]; if (!isset($resulttype) || $resulttype == "min") { $tmc = sprintf("%02d", intval($tmc / 60)) . ":" . sprintf("%02d", intval($tmc % 60)); } else { $tmc = intval($tmc); } if (!isset($resulttype) || $resulttype == "min") { $minutes = sprintf("%02d", intval($data[1] / 60)) . ":" . sprintf("%02d", intval($data[1] % 60)); } else { $minutes = $data[1]; } if ($mmax > 0) { $widthbar = intval($data[1] / $mmax * 200); } ?> <tr class="invoice_rows"> <td width="29%" ><font color="#003399"><?php echo $data[0]; ?> </font></td> <td width="38%" ><font color="#003399"><?php echo $minutes; ?> </font></td> <td width="12%" align="right" ><font color="#003399"><?php echo $data[3]; ?> </font> </td> <td align="right" ><font color="#003399"><?php display_2bill($data[2]); ?> </font></td> </tr> <?php } if (!isset($resulttype) || $resulttype == "min") { $total_tmc = sprintf("%02d", intval($totalminutes / $totalcall / 60)) . ":" . sprintf("%02d", intval($totalminutes / $totalcall % 60)); $totalminutes = sprintf("%02d", intval($totalminutes / 60)) . ":" . sprintf("%02d", intval($totalminutes % 60)); } else { $total_tmc = intval($totalminutes / $totalcall); } ?> <tr > <td width="29%" > </td> <td width="38%" > </td> <td width="12%" > </td> <td > </td> </tr> <tr bgcolor="#CCCCCC"> <td width="29%" ><font color="#003399"><?php echo gettext("TOTAL"); ?> </font></td> <td width="38%" ><font color="#003399"><?php echo $totalminutes; ?> </font></td> <td width="12%" align="right"><font color="#003399"><?php echo $totalcall; ?> </font></td> <td align="right" ><font color="#003399"><?php display_2bill($totalcost - $totalcost_did); ?> </font> </td> </tr> <tr > <td width="29%"> </td> <td width="38%"> </td> <td width="12%"> </td> <td > </td> </tr> <?php } ?> </table> <table align="center" width="80%"> <!-- Start Here ****************************************--> <?php $mmax = 0; $totalcall = 0; $totalminutes = 0; $totalcost_day = 0; if (is_array($list_total_day) && count($list_total_day) > 0) { foreach ($list_total_day as $data) { if ($mmax < $data[1]) { $mmax = $data[1]; } $totalcall += $data[3]; $totalminutes += $data[1]; $totalcost_day += $data[2]; } ?> <tr> <td colspan="4" align="center"><b><?php echo gettext("By Date"); ?> </b> </td> </tr> <tr bgcolor="#CCCCCC"> <td width="29%"><font color="#003399"><b><?php echo gettext("Date"); ?> </b> </font></td> <td width="38%" ><font color="#003399"><b><?php echo gettext("Duration"); ?> </b> </font></td> <td width="12%" align="center" ><font color="#003399"><b><?php echo gettext("Calls"); ?> </b> </font></td> <td width="21%" align="right"><font color="#003399"><b><?php echo gettext("Amount") . " (" . BASE_CURRENCY . ")"; ?> </b> </font></td> </tr> <?php $i = 0; foreach ($list_total_day as $data) { $i = ($i + 1) % 2; $tmc = $data[1] / $data[3]; if (!isset($resulttype) || $resulttype == "min") { $tmc = sprintf("%02d", intval($tmc / 60)) . ":" . sprintf("%02d", intval($tmc % 60)); } else { $tmc = intval($tmc); } if (!isset($resulttype) || $resulttype == "min") { $minutes = sprintf("%02d", intval($data[1] / 60)) . ":" . sprintf("%02d", intval($data[1] % 60)); } else { $minutes = $data[1]; } if ($mmax > 0) { $widthbar = intval($data[1] / $mmax * 200); } ?> <tr class="invoice_rows"> <td width="29%" ><font color="#003399"><?php echo $data[0]; ?> </font></td> <td width="38%" ><font color="#003399"><?php echo $minutes; ?> </font></td> <td width="12%" align="right"><font color="#003399"><?php echo $data[3]; ?> </font></td> <td width="21%" align="right" ><font color="#003399"><?php display_2bill($data[2]); ?> </font></td> </tr> <?php } if (!isset($resulttype) || $resulttype == "min") { $total_tmc = sprintf("%02d", intval($totalminutes / $totalcall / 60)) . ":" . sprintf("%02d", intval($totalminutes / $totalcall % 60)); $totalminutes = sprintf("%02d", intval($totalminutes / 60)) . ":" . sprintf("%02d", intval($totalminutes % 60)); } else { $total_tmc = intval($totalminutes / $totalcall); } ?> <tr > <td width="29%" > </td> <td width="38%" > </td> <td width="12%" > </td> <td width="21%" > </td> </tr> <tr bgcolor="#CCCCCC"> <td width="29%" ><font color="#003399"><?php echo gettext("TOTAL"); ?> </font></td> <td width="38%" ><font color="#003399"><?php echo $totalminutes; ?> </font></td> <td width="12%" align="right" ><font color="#003399"><?php echo $totalcall; ?> </font> </td> <td width="21%" align="right" ><font color="#003399"><?php display_2bill($totalcost_day); ?> </font></td> </tr> <tr > <td width="29%"> </td> <td width="38%"> </td> <td width="12%"> </td> <td width="21%"> </td> </tr> <?php } ?> <!-- END HERE ******************************************--> </table> <table align="center" width="80%"> <?php if (is_array($list_total_did) && count($list_total_did) > 0) { ?> <tr> <td> <table width="100%" align="left" cellpadding="0" cellspacing="0"> <tr> <td colspan="5" align="center"><font><b><?php echo gettext("DID Billing"); ?> </b></font> </td> </tr> <tr bgcolor="#CCCCCC"> <td width="20%"> <font color="#003399"><b><?php echo gettext("Charge Date"); ?> </b></font></td> <td width="13%" ><font color="#003399"><b><?php echo gettext("DID"); ?> </b></font></td> <td width="14%" ><font color="#003399"><b><?php echo gettext("Country"); ?> </b></font> </td> <td width="41%" ><font color="#003399"><b><?php echo gettext("Description"); ?> </b></font></td> <td width="12%" align="right"><font color="#003399"><b><?php echo gettext("Amount") . " (" . BASE_CURRENCY . ")"; ?> </b></font> </td> </tr> <?php $i = 0; $totaldidcost = 0; foreach ($list_total_did as $data) { $totaldidcost = $totaldidcost + convert_currency($currencies_list, $data[0], $data[5], BASE_CURRENCY); ?> <tr class="invoice_rows"> <td width="20%" ><font color="#003399"><?php echo $data[1]; ?> </font></td> <td width="13%" ><font color="#003399"> <?php echo $data[4]; ?> </font> </td> <td width="14%" ><font color="#003399"> <?php echo $data[3]; ?> </font></td> <td width="41%" ><font color="#003399"><?php echo $data[2]; ?> </font> </td> <td width="12%" align="right" ><font color="#003399"><?php convert_currency($currencies_list, $data[0], $data[5], BASE_CURRENCY) . " " . BASE_CURRENCY; ?> </font></td> </tr> <?php } $totalcost = $totalcost + $totaldidcost; ?> <tr > <td width="20%" > </td> <td width="13%" > </td> <td width="14%" > </td> <td width="41%" > </td> <td width="12%" > </td> </tr> <tr bgcolor="#CCCCCC" > <td width="20%" ><font color="#003399"><?php echo gettext("TOTAL"); ?> </font></td> <td ><font color="#003399"> </font></td> <td width="14%" ><font color="#003399"> </font> </td> <td width="41%" ><font color="#003399"> </font> </td> <td width="12%" align="right" ><font color="#003399"><?php display_2bill($totaldidcost); ?> </font> </td> </tr> <tr> <td width="20%"> </td> <td width="13%"> </td> <td width="14%"> </td> <td width="41%"> </td> <td width="12%"> </td> </tr> </table> </td> </tr> <?php } ?> <tr> <td> <!-------------------------EXTRA CHARGE START HERE ----------------------------------> <?php $i = 0; $extracharge_total = 0; if (is_array($list_total_charges) && count($list_total_charges) > 0) { ?> <table width="100%" align="left" cellpadding="0" cellspacing="0"> <tr> <td colspan="4" align="center"><font><b><?php echo gettext("Extra Charges"); ?> </b></font> </td> </tr> <tr bgcolor="#CCCCCC"> <td width="20%"> <font color="#003399"><b><?php echo gettext("Date"); ?> </b></font></td> <td width="19%" ><font color="#003399"><b><?php echo gettext("Type"); ?> </b></font></td> <td width="43%" ><font color="#003399"><b><?php echo gettext("Description"); ?> </b></font> </td> <td width="18%" align="right"><font color="#003399"><b><?php echo gettext("Amount") . " (" . BASE_CURRENCY . ")"; ?> </b></font> </td> </tr> <?php foreach ($list_total_charges as $data) { $extracharge_total = $extracharge_total + convert_currency($currencies_list, $data[3], $data[6], BASE_CURRENCY); ?> <tr class="invoice_rows"> <td width="20%" ><font color="#003399"><?php echo $data[2]; ?> </font></td> <td width="19%" ><font color="#003399"> <?php if ($data[4] == 1) { echo gettext("Setup Charges"); } if ($data[4] == 2) { echo gettext("DID Montly Use"); } if ($data[4] == 3) { echo gettext("Subscription Fee"); } if ($data[4] == 4) { echo gettext("Extra Charges"); } ?> </font> </td> <td width="43%" ><font color="#003399"><?php echo $data[7]; ?> </font></td> <td width="18%" align="right" ><font color="#003399"><?php echo convert_currency($currencies_list, $data[3], $data[6], BASE_CURRENCY) . " " . BASE_CURRENCY; ?> </font></td> </tr> <?php } //for loop end here ?> <tr > <td width="20%" > </td> <td width="19%" > </td> <td width="43%" > </td> <td width="18%" > </td> </tr> <tr bgcolor="#CCCCCC" > <td width="20%" ><font color="#003399"><?php echo gettext("TOTAL"); ?> </font></td> <td ><font color="#003399"> </font></td> <td width="43%" ><font color="#003399"> </font> </td> <td width="18%" align="right" ><font color="#003399"><?php echo display_2bill($extracharge_total); ?> </font> </td> </tr> <tr > <td width="20%"> </td> <td width="19%"> </td> <td width="43%"> </td> <td width="18%"> </td> </tr> </table> <?php } //if check end here $totalcost = $totalcost + $extracharge_total; ?> <!-----------------------------EXTRA CHARGE END HERE -------------------------------> </td> </tr> <tr> <td><img src="<?php echo Images_Path; ?> /spacer.jpg" align="middle" height="30px"></td> </tr> <tr bgcolor="#CCCCCC" > <td align="right" width="100%"><font color="#003399"><b><?php echo gettext("Total"); ?> = <?php display_2bill($totalcost); ?> </b></font></td> </tr> <tr bgcolor="#CCCCCC" > <td align="right" width="100%"><font color="#003399"><b><?php echo gettext("VAT"); ?> = <?php $prvat = $vat / 100 * $totalcost; display_2bill($prvat); ?> </b></font></td> </tr> <tr> <td><img src="<?php echo Images_Path; ?> /spacer.jpg" align="middle" height="30px"></td> </tr> <tr bgcolor="#CCCCCC" > <td align="right" width="100%"><font color="#003399"><b><?php echo gettext("Grand Total"); ?> = <?php echo display_2bill($totalcost + $prvat); ?> </b></font></td> </tr> <tr> <td><img src="<?php echo Images_Path; ?> /spacer.jpg" align="middle" height="30px"></td> </tr> </table> <table cellspacing="0" cellpadding="2" width="80%" align="center"> <tr> <td colspan="3"> </td> </tr> <tr> <td align="left">Status : <?php if ($info_customer[0][12] == 't') { ?> <img src="<?php echo Images_Path; ?> /connected.jpg"> <?php } else { ?> <img src="<?php echo Images_Path; ?> /terminated.jpg"> <?php } ?> </td> </tr> <tr> <td align="left"> <img src="<?php echo Images_Path; ?> /connected.jpg"> <?php echo gettext("Connected"); ?> <img src="<?php echo Images_Path; ?> /terminated.jpg"> <?php echo gettext("Disconnected"); ?> </td> </table> <?php $html = ob_get_contents(); // delete output-Buffer ob_end_clean(); $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($html); $stream = $pdf->Output('UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', 'S'); //================================Email Template Retrival Code =================================== $QUERY = "SELECT mailtype, fromemail, fromname, subject, messagetext, messagehtml FROM cc_templatemail WHERE mailtype='invoice' "; $res = $DBHandle->Execute($QUERY); $num = 0; if ($res) { $num = $res->RecordCount(); } if (!$num) { echo "<br>Error : No email Template Found"; exit; } for ($i = 0; $i < $num; $i++) { $listtemplate[] = $res->fetchRow(); } list($mailtype, $from, $fromname, $subject, $messagetext, $messagehtml) = $listtemplate[0]; if ($FG_DEBUG == 1) { echo "<br><b>mailtype : </b>{$mailtype}</br><b>from:</b> {$from}</br><b>fromname :</b> {$fromname}</br><b>subject</b> : {$subject}</br><b>ContentTemplate:</b></br><pre>{$messagetext}</pre></br><hr>"; } //================================================================================================ $ok = send_email_attachment($from, $info_customer[0][10], $subject, $messagetext, 'UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', $stream); return $ok; }
<?php require_once dirname(__FILE__) . '/../../includes/global.inc.php'; // pdf was breaking define(RELATIVE_PATH, ''); switch ($_GET['action']) { case 'word': require_once dirname(__FILE__) . '/HTML2Doc.php'; $doc = new HTML_TO_DOC(); $doc->setTitle(iBeginShare::quoteSmart($_GET['title'])); $doc->createDoc($raw_content, (strlen(iBeginShare::quoteSmart($_GET['title'])) > 0 ? str_replace(' ', '-', strip_tags($_GET['title'])) : 'Document-' . date('Y-m-d')) . '.doc'); break; case 'pdf': require_once dirname(__FILE__) . '/html2fpdf/html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->DisplayPreferences($_GET['title']); $pdf->AddPage(); $pdf->WriteHTML(html_entity_decode($raw_content)); $pdf->Output((strlen(iBeginShare::quoteSmart($_GET['title'])) > 0 ? str_replace(' ', '-', strip_tags($_GET['title'])) : 'Document-' . date('Y-m-d')) . '.pdf', 'D'); break; }
static function html2pdf($html, $encode = "SJIS") { //echo 1;exit; //$html=self::pdf_change_encode($html,$encode); define('FPDF_FONTPATH', ROOT . 'lib/html2fpdf/font/'); include ROOT . 'lib/html2fpdf/jphtml2fpdf.php'; $pdf = new HTML2FPDF("l", "mm", "A4"); $pdf->Open(); $pdf->SetCompression(false); $pdf->SetDisplayMode("real"); $pdf->UseCSS(); $pdf->UsePRE(); $pdf->AddSJISFont(); $pdf->setBasePath(""); $pdf->AddPage(); //ファイル情報 $pdf->SetAuthor("HPX"); $pdf->Bookmark("HPX"); $pdf->SetTitle("HPX"); $pdf->SetCreator("HPX"); // 本文 $pdf->SetMargins(10, 10); $pdf->DisplayPreferences('HideWindowUI'); //$pdf->SetFont( HideWindowUI,"",8); $pdf->WriteHTML($html); // 出力 $pdf->Output('doc.pdf', 'D'); exit; }
function send_conf7_attachment_file($cf7) { //check if this is the right form ID // ... if ($cf7->mail['use_html'] == true) { $nl = "<br/>"; } else { $nl = "\n"; } // getting all submitted data $submission = WPCF7_Submission::get_instance(); $data = $submission->get_posted_data(); unset($data[_wpcf7]); unset($data[_wpcf7_version]); unset($data[_wpcf7_locale]); unset($data[_wpcf7_is_ajax_call]); unset($data[_wpcf7_unit_tag]); // making the html $in_db = get_page_by_title($cf7->id, OBJECT, 'cnf_mail_template'); $html .= $in_db->post_content; foreach ($data as $key => $value) { if (is_array($value)) { $html = str_replace('#' . $key, $value[0], $html); } else { $html = str_replace('#' . $key, $value, $html); } } // library for genrating the pdf file require 'pdflib/html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->AddPage(); $strContent = $html; $pdf->WriteHTML($strContent); $pdf->Output("wp-content/uploads/form-" . $cf7->id . ".pdf"); //I omitted all the stuff used to create //the pdf file, you have just to know that //$pdf_filename contains the filename to attach //Let'go to the file attachment! // $pdf_filename with the extenstion not just the filename $pdf_filename = "form-" . $cf7->id . ".pdf"; // geting the real mail ///// $mail = $cf7->prop('mail'); // giving the attachment path//// $mail['attachments'] = 'uploads/' . $pdf_filename; $cf7->set_properties(array("mail" => $mail)); }
function DisplayPDF($smarty, $invoicetype, $template) { require_once 'pdf-invoices/html2pdf/html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->DisplayPreferences('HideWindowUI'); $pdf->AddPage(); $pdf->WriteHTML($this->GetHTML($smarty, $invoicetype, $template)); // TODO: find a better name return $pdf->Output('Invoice_' . date("d/m/Y-H:i") . '.pdf', 'I'); }
function getAdvancedReportPDF($resultid) { global $g_db, $G_SESSION, $DOCUMENT_FPDF, $lngstr, $srv_settings, $i_rSet2, $i_rSet3, $i_rSet4, $i_rSet5, $i_rSet6; ob_start(); include_once $DOCUMENT_FPDF . 'html2fpdf.php'; $i_pdf = false; $i_can_access = false; if ($G_SESSION['access_reportsmanager'] > 1) { $i_can_access = true; } else { $i_rSet1 = $g_db->Execute("SELECT resultid FROM " . $srv_settings['table_prefix'] . "results WHERE id=" . $G_SESSION['id'] . " AND resultid=" . $resultid); if (!$i_rSet1) { showDBError(__FILE__, 1); } else { $i_can_access = $i_rSet1->RecordCount() > 0; } } $i_isok = $i_can_access; if ($i_isok) { $i_isok = $i_rSet2 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "results WHERE resultid=" . $resultid, 1); } if ($i_isok) { $i_isok = !$i_rSet2->EOF; } if ($i_isok) { $i_isok = $i_rSet3 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "tests WHERE testid=" . $i_rSet2->fields['testid'], 1); } if ($i_isok) { $i_isok = !$i_rSet3->EOF; } if ($i_isok) { $i_isok = $i_rSet3->fields['rtemplateid'] > 0 && ($i_rSet3->fields['test_reportgradecondition'] == 0 || $i_rSet3->fields['test_reportgradecondition'] >= $i_rSet2->fields['gscale_gradeid']); } if ($i_isok) { $i_isok = $i_rSet6 = $g_db->SelectLimit("SELECT * FROM " . $srv_settings['table_prefix'] . "users WHERE id=" . $i_rSet2->fields['id'], 1); } if ($i_isok) { $i_isok = !$i_rSet6->EOF; } $i_result_detailed_1_items = array(); $i_result_detailed_2_items = array(); $i_result_detailed_3_items = array(); $i_result_detailed_4_items = array(); if ($i_isok) { $i_isok = $i_rSet7 = $g_db->Execute("SELECT * FROM " . $srv_settings['table_prefix'] . "results_answers, " . $srv_settings['table_prefix'] . "questions WHERE resultid=" . $resultid . " AND " . $srv_settings['table_prefix'] . "results_answers.questionid=" . $srv_settings['table_prefix'] . "questions.questionid ORDER BY result_answerid"); } if ($i_isok) { $i_questionno = 0; while (!$i_rSet7->EOF) { $i_questionno++; $i_answers = array(); $i_rSet5 = $g_db->Execute("SELECT answer_text, answer_correct FROM " . $srv_settings['table_prefix'] . "answers WHERE questionid=" . $i_rSet7->fields['questionid'] . " ORDER BY answerid"); if (!$i_rSet5) { showDBError(__FILE__, 5); } else { $i_answerno = 1; while (!$i_rSet5->EOF) { $i_answers[$i_answerno] = $i_rSet5->fields['answer_text']; $i_answers_correct[$i_answerno] = $i_rSet5->fields['answer_correct']; $i_answerno++; $i_rSet5->MoveNext(); } $i_rSet5->Close(); } $i_detailed_correct = $i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT; $i_result_detailed_3_items[$i_questionno] = $i_questionno . '. ' . getTruncatedHTML($i_rSet7->fields['question_text'], 0); $i_result_detailed_1_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno] . '<br />'; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_iscorrect'] . ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_UNDEFINED ? $lngstr['label_undefined'] : ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_CORRECT ? $lngstr['label_yes'] : ($i_rSet7->fields['result_answer_iscorrect'] == IGT_ANSWER_IS_PARTIALLYCORRECT ? $lngstr['label_partially'] : $lngstr['label_no']))) . '<br />'; $i_result_detailed_1_items[$i_questionno] .= $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '<br />'; if (!$i_detailed_correct) { $i_result_detailed_2_items[$i_questionno] = $i_result_detailed_1_items[$i_questionno]; } $i_result_detailed_3_items[$i_questionno] = '<tr><td>' . $i_result_detailed_3_items[$i_questionno] . '</td></tr>'; for ($i = 1; $i < $i_answerno; $i++) { switch ($i_rSet7->fields['question_type']) { case QUESTION_TYPE_MULTIPLECHOICE: case QUESTION_TYPE_TRUEFALSE: $i_answers_given = (int) $i_rSet7->fields['result_answer_text']; $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : ($i == $i_answers_given ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>'; break; case QUESTION_TYPE_MULTIPLEANSWER: $i_answers_given = explode(QUESTION_TYPE_MULTIPLEANSWER_BREAK, $i_rSet7->fields['result_answer_text']); $i_result_detailed_3_items[$i_questionno] .= '<tr><td><img src="images/button-checkbox-' . ($i_answers_correct[$i] ? '2' : (in_array($i, $i_answers_given) ? '4' : '0')) . '.gif" width=13 height=13> ' . $i_answers[$i] . '</tr>'; break; case QUESTION_TYPE_FILLINTHEBLANK: $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_answers[$i]) . '</td></tr>'; break; } } if ($i_rSet7->fields['question_type'] == QUESTION_TYPE_ESSAY) { $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . nl2br($i_rSet7->fields['result_answer_text']) . '</td></tr>'; } $i_result_detailed_3_items[$i_questionno] .= '<tr><td>' . $lngstr['email_answer_points'] . $i_rSet7->fields['result_answer_points'] . '</td></tr>'; if (!$i_detailed_correct) { $i_result_detailed_4_items[$i_questionno] = $i_result_detailed_3_items[$i_questionno]; } $i_rSet7->MoveNext(); } $i_rSet7->Close(); $i_result_detailed_1_text = implode('<br />', $i_result_detailed_1_items); $i_result_detailed_2_text = implode('<br />', $i_result_detailed_2_items); $i_result_detailed_3_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_3_items) . '</table>'; $i_result_detailed_4_text = '<table cellpadding=0 cellspacing=0 border=0 width="100%">' . implode("\n", $i_result_detailed_4_items) . '</table>'; $i_result_detailed_5_text = ''; $i_result_detailed_6_text = ''; $i_pdf = eventOnQueryCustomReportPDF(); if (empty($i_pdf)) { $i_pdf = new HTML2FPDF(); $i_pdf->AddPage(); $i_pdf->SetFont('Arial', '', 11); $i_pdf->SetTextColor(0, 0, 0); $g_vars['page']['grade'] = getGradeData($i_rSet2->fields['gscaleid'], $i_rSet2->fields['gscale_gradeid']); $g_vars['page']['subjects'] = getTestResultSubjectsData($resultid); $i_template_body = getReportTemplate(array('rtemplateid' => $i_rSet3->fields['rtemplateid'], 'username' => $i_rSet6->fields['username'], 'email' => $i_rSet6->fields['email'], 'title' => $i_rSet6->fields['user_title'], 'firstname' => $i_rSet6->fields['user_firstname'], 'lastname' => $i_rSet6->fields['user_lastname'], 'middlename' => $i_rSet6->fields['user_middlename'], 'address' => $i_rSet6->fields['user_address'], 'city' => $i_rSet6->fields['user_city'], 'state' => $i_rSet6->fields['user_state'], 'zip' => $i_rSet6->fields['user_zip'], 'country' => $i_rSet6->fields['user_country'], 'phone' => $i_rSet6->fields['user_phone'], 'fax' => $i_rSet6->fields['user_fax'], 'mobile' => $i_rSet6->fields['user_mobile'], 'pager' => $i_rSet6->fields['user_pager'], 'ipphone' => $i_rSet6->fields['user_ipphone'], 'webpage' => $i_rSet6->fields['user_webpage'], 'icq' => $i_rSet6->fields['user_icq'], 'msn' => $i_rSet6->fields['user_msn'], 'aol' => $i_rSet6->fields['user_aol'], 'gender' => $i_rSet6->fields['user_gender'], 'birthday' => $i_rSet6->fields['user_birthday'], 'husbandwife' => $i_rSet6->fields['user_husbandwife'], 'children' => $i_rSet6->fields['user_children'], 'trainer' => $i_rSet6->fields['user_trainer'], 'photo' => $i_rSet6->fields['user_photo'], 'company' => $i_rSet6->fields['user_company'], 'cposition' => $i_rSet6->fields['user_cposition'], 'department' => $i_rSet6->fields['user_department'], 'coffice' => $i_rSet6->fields['user_coffice'], 'caddress' => $i_rSet6->fields['user_caddress'], 'ccity' => $i_rSet6->fields['user_ccity'], 'cstate' => $i_rSet6->fields['user_cstate'], 'czip' => $i_rSet6->fields['user_czip'], 'ccountry' => $i_rSet6->fields['user_ccountry'], 'cphone' => $i_rSet6->fields['user_cphone'], 'cfax' => $i_rSet6->fields['user_cfax'], 'cmobile' => $i_rSet6->fields['user_cmobile'], 'cpager' => $i_rSet6->fields['user_cpager'], 'cipphone' => $i_rSet6->fields['user_cipphone'], 'cwebpage' => $i_rSet6->fields['user_cwebpage'], 'cphoto' => $i_rSet6->fields['user_cphoto'], 'ufield1' => $i_rSet6->fields['user_ufield1'], 'ufield2' => $i_rSet6->fields['user_ufield2'], 'ufield3' => $i_rSet6->fields['user_ufield3'], 'ufield4' => $i_rSet6->fields['user_ufield4'], 'ufield5' => $i_rSet6->fields['user_ufield5'], 'ufield6' => $i_rSet6->fields['user_ufield6'], 'ufield7' => $i_rSet6->fields['user_ufield7'], 'ufield8' => $i_rSet6->fields['user_ufield8'], 'ufield9' => $i_rSet6->fields['user_ufield9'], 'ufield10' => $i_rSet6->fields['user_ufield10'], 'test_name' => $i_rSet3->fields['test_name'], 'result_id' => $resultid, 'result_date' => getDateLocal($lngstr['language']['date_format_full'], $i_rSet2->fields['result_datestart']), 'result_time_spent' => getTimeFormatted($i_rSet2->fields['result_timespent']), 'result_time_exceeded' => $i_rSet2->fields['result_timeexceeded'] > 0 ? $lngstr['label_yes'] : $lngstr['label_no'], 'result_points_scored' => $i_rSet2->fields['result_points'], 'result_points_possible' => $i_rSet2->fields['result_pointsmax'], 'result_percents' => $i_rSet2->fields['result_pointsmax'] > 0 ? round($i_rSet2->fields['result_points'] * 100 / $i_rSet2->fields['result_pointsmax']) : 0, 'result_grade' => $g_vars['page']['grade']['name'], 'result_grade_feedback' => $g_vars['page']['grade']['feedback'], 'result_subjects' => $g_vars['page']['subjects'], 'result_detailed_1' => $i_result_detailed_1_text, 'result_detailed_2' => $i_result_detailed_2_text, 'result_detailed_3' => $i_result_detailed_3_text, 'result_detailed_4' => $i_result_detailed_4_text, 'result_detailed_5' => $i_result_detailed_5_text, 'result_detailed_6' => $i_result_detailed_6_text)); $i_pdf->WriteHTML($i_template_body); } } else { $i_pdf = false; } ob_end_clean(); return $i_pdf; }
function _print_pdf($file, $data) { require_once 'h2p/html2fpdf.php'; // agar dapat menggunakan fungsi-fungsi html2pdf ob_start(); // memulai buffer error_reporting(1); // turn off warning for deprecated functions $pdf = new HTML2FPDF(); // membuat objek HTML2PDF $pdf->DisplayPreferences('Fullscreen'); $html = $data; // mengambil data dengan format html, dan disimpan di variabel ob_end_clean(); // mengakhiri buffer dan tidak menampilkan data dalam format html $pdf->addPage(); // menambah halaman di file pdf $pdf->WriteHTML($html); // menuliskan data dengan format html ke file pdf return $pdf->Output($file, 'D'); }
function HandlePDF($pagename) { global $WikiTitle; // modify WikiTitle $WikiTitle = str_replace(' ', '_', $WikiTitle); $WikiTitle = html_entity_decode($WikiTitle); // read wiki page ! //$page = ReadPage($pagename); $page = RetrieveAuthPage($pagename, 'read', true, READPAGE_CURRENT); //$date['modif'] = filemtime($_SERVER['DOCUMENT_ROOT'].'/wiki.d/'.$pagename); // define variable $xyz['author'] = 'by ' . $page['author']; // pdf author $xyz['name']['page'] = str_replace('.', '_', $pagename); // page name $xyz['name']['pdf'] = $WikiTitle . '_' . $xyz['name']['page'] . '.pdf'; // pdf name $xyz['text'] = mv_breakpage($page['text']); // to transform breakpage markup $xyz['title'] = $WikiTitle . ' : page ' . $xyz['name']['page']; // pdf title $xyz['path'] = $_SERVER["DOCUMENT_ROOT"]; // return root path of your site web $xyz['url'] = 'http://' . HOST . URI; // pdf URL // transform text to html ! $html = change_code(MarkupToHTML($pagename, $xyz['text'])); /*** for test ! *** echo $xyz['text']; echo "\n HTML : ".$html; /** */ //out pass memory server ini_set('memory_limit', '24M'); ini_set('max_execution_time', 0); // declare a new object pdf $pdf = new HTML2FPDF(); // Disactive elements HTML ... cause bad support ! $pdf->DisableTags('<span>'); $pdf->DisableTags('<dl>'); $pdf->DisableTags('<dt>'); $pdf->DisableTags('<dd>'); // generals informations $pdf->SetCompression(1); $pdf->SetAuthor($xyz['author']); $pdf->SetTitle($xyz['title']); // method implemented by me to return in footer pdf generated. $pdf->PutHREF($xyz['url']); // method implemented by html2pdf author ! $pdf->setBasePath($xyz['path']); // to implement path of your site ; need it for include correctly the image on pdf ! $pdf->UseCSS(false); // to recognize CSS ... run correctly ? $pdf->UsePRE(false); // to recognize element PRE in your code HTML ... but, really bad support ! // build the page PDF $pdf->AddPage(); $pdf->WriteHTML($html); $pdf->Output($xyz['name']['pdf'], I); /**/ // retabli valeur serveur ini_set('memory_limit', MEM); ini_set('max_execution_time', MAX_TIME); }
function pdf() { exit("deactivated for now..."); if ($ID = Director::urlParam("ID")) { if ($invoice = DataObject::get_one("ShopInvoice", "PublicURL = '" . Convert::Raw2SQL($ID) . "'")) { $this->Invoice = $invoice; if (!isset($_REQUEST['view'])) { //generate pdf require dirname(__FILE__) . '/Thirdparty/html2fpdf/html2fpdf.php'; //to get work HTML2PDF error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED)); $pdf = new HTML2FPDF(); $pdf->AddPage(); $pdfPath = $invoice->generatePDF(); $outputPath = TEMP_FOLDER . "/shopsystem/"; $outputFile = $outputPath . $invoice->PublicURL . ".pdf"; $fp = fopen($pdfPath, "r"); $strContent = fread($fp, filesize($pdfPath)); fclose($fp); $pdf->WriteHTML($strContent); $pdf->Output($outputFile); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="invoice.pdf"'); echo file_get_contents($outputFile); //PDF file is generated successfully! exit; } if (isset($_REQUEST['remove'])) { //remove invoice from public by generating a new public url $invoice->PublicURL = ShopInvoice::generatePublicURL(); $invoice->write(); } } } return array(); }
' . $arrNichesRecord[0]["Section"] . ' </td> <td> ' . $arrNichesRecord[0]["row"] . ' </td> <td> ' . $arrNichesRecord[0]["columns"] . ' </td> </tr> </table> <br /> <label> <strong>Extra 1</strong></label> <label class="text"> ' . $UrnExtra1 . '</label> <br/> <br/> <label> <strong>Extra 2</strong></label> <label class="text">' . $UrnExtra2 . '</label> <br/> <br /> </body> </html> '; $pdf = new HTML2FPDF(); $pdf->AliasNbPages(); //$pdf->Footer($varFooter); $pdf->AddPage(); $pdf->WriteHTML($varStrContent); $pdf->Output('urns_detail.pdf', 'D');
$result2 = mysql_query("SELECT * FROM secondhs WHERE admno='{$adm}'") or die(mysql_error()); $row2 = mysql_fetch_array($result2); $result3 = mysql_query("SELECT * FROM thirdhs WHERE admno='{$adm}'") or die(mysql_error()); $row3 = mysql_fetch_array($result3); $str = "<html>\n\t\t\t <head>\n\t\t\t </head>\n\t\t\t <body>\n\t\t\t <center><h1>Salvation Army Higher Secondary School</h1></center>\n\t\t\t <center><h2>Kowdiar</h2></center>\n\t\t\t <br><br><br><br>\n\t\t\t \n\t\t\t <table align='center' border='1'>\n\t\t\t <tr>\n\t\t\t <th align='left'> Admission No. </th><td>" . $row['admno'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> First Name </th><td>" . $row['fname'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Last Name </th><td>" . $row['lname'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Fathers Name </th><td>" . $row['father'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Mothers Name </th><td>" . $row['mother'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Guardian Name </th><td>" . $row['guardian'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Sex </th><td>" . $row['sex'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Category </th><td>" . $row['category'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Class </th><td>" . $row['std'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Division </th><td>" . $row['division'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Address </th><td maxwidth='500'>" . $row['address'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'> Identification Marks </th><td>1. " . $row['ident1'] . "<br>2. " . $row['ident2'] . "</td>\n\t\t\t </tr>\n\t\t\t </table>\n\t\t\t <br>\n\t\t\t <br>\n\t\t\t <table align='center' border='1'>\n\t\t\t <tr>\n\t\t\t <th rowspan='2'>Mark Details</th>\n\t\t\t <th colspan='2'>First Term</th>\n\t\t\t <th colspan='2'>Second Term</th>\n\t\t\t <th colspan='2'>Third Term</th>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th>Mark</th><th>Grade</th>\n\t\t\t <th>Mark</th><th>Grade</th>\n\t\t\t <th>Mark</th><th>Grade</th>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Malayalam 1</th>\n\t\t\t <td align='center'>" . $row1['malayalam1'] . "</td><td align='center'>" . $row1['malayalam1g'] . "</td>\n\t\t\t <td align='center'>" . $row2['malayalam1'] . "</td><td align='center'>" . $row2['malayalam1g'] . "</td>\n\t\t\t <td align='center'>" . $row3['malayalam1'] . "</td><td align='center'>" . $row3['malayalam1g'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Malayalam 2</th>\n\t\t\t <td align='center'>" . $row1['malayalam2'] . "</td><td align='center'>" . $row1['malayalam2g'] . "</td>\n\t\t\t <td align='center'>" . $row2['malayalam2'] . "</td><td align='center'>" . $row2['malayalam2g'] . "</td>\n\t\t\t <td align='center'>" . $row3['malayalam2'] . "</td><td align='center'>" . $row3['malayalam2g'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Sanskrit</th>\n\t\t\t <td align='center'>" . $row1['sanskrit'] . "</td><td align='center'>" . $row1['sanskritg'] . "</td>\n\t\t\t <td align='center'>" . $row2['sanskrit'] . "</td><td align='center'>" . $row2['sanskritg'] . "</td>\n\t\t\t <td align='center'>" . $row3['sanskrit'] . "</td><td align='center'>" . $row3['sanskritg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>English</th>\n\t\t\t <td align='center'>" . $row1['english'] . "</td><td align='center'>" . $row1['englishg'] . "</td>\n\t\t\t <td align='center'>" . $row2['english'] . "</td><td align='center'>" . $row2['englishg'] . "</td>\n\t\t\t <td align='center'>" . $row3['english'] . "</td><td align='center'>" . $row3['englishg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Hindi</th>\n\t\t\t <td align='center'>" . $row1['hindi'] . "</td><td align='center'>" . $row1['hindig'] . "</td>\n\t\t\t <td align='center'>" . $row2['hindi'] . "</td><td align='center'>" . $row2['hindig'] . "</td>\n\t\t\t <td align='center'>" . $row3['hindi'] . "</td><td align='center'>" . $row3['hindig'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Physics</th>\n\t\t\t <td align='center'>" . $row1['physics'] . "</td><td align='center'>" . $row1['physicsg'] . "</td>\n\t\t\t <td align='center'>" . $row2['physics'] . "</td><td align='center'>" . $row2['physicsg'] . "</td>\n\t\t\t <td align='center'>" . $row3['physics'] . "</td><td align='center'>" . $row3['physicsg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Chemistry</th>\n\t\t\t <td align='center'>" . $row1['chemistry'] . "</td><td align='center'>" . $row1['chemistryg'] . "</td>\n\t\t\t <td align='center'>" . $row2['chemistry'] . "</td><td align='center'>" . $row2['chemistryg'] . "</td>\n\t\t\t <td align='center'>" . $row3['chemistry'] . "</td><td align='center'>" . $row3['chemistryg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Biology</th>\n\t\t\t <td align='center'>" . $row1['biology'] . "</td><td align='center'>" . $row1['biologyg'] . "</td>\n\t\t\t <td align='center'>" . $row2['biology'] . "</td><td align='center'>" . $row2['biologyg'] . "</td>\n\t\t\t <td align='center'>" . $row3['biology'] . "</td><td align='center'>" . $row3['biologyg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Social Science</th>\n\t\t\t <td align='center'>" . $row1['socialscience'] . "</td><td align='center'>" . $row1['socialscienceg'] . "</td>\n\t\t\t <td align='center'>" . $row2['socialscience'] . "</td><td align='center'>" . $row2['socialscienceg'] . "</td>\n\t\t\t <td align='center'>" . $row3['socialscience'] . "</td><td align='center'>" . $row3['socialscienceg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Maths</th>\n\t\t\t <td align='center'>" . $row1['maths'] . "</td><td align='center'>" . $row1['mathsg'] . "</td>\n\t\t\t <td align='center'>" . $row2['maths'] . "</td><td align='center'>" . $row2['mathsg'] . "</td>\n\t\t\t <td align='center'>" . $row3['maths'] . "</td><td align='center'>" . $row3['mathsg'] . "</td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Information Technology</th>\n\t\t\t <td align='center'>" . $row1['informationtechnology'] . "</td><td align='center'>" . $row1['informationtechnologyg'] . "</td>\n\t\t\t <td align='center'>" . $row2['informationtechnology'] . "</td><td align='center'>" . $row2['informationtechnologyg'] . "</td>\n\t\t\t <td align='center'>" . $row3['informationtechnology'] . "</td><td align='center'>" . $row3['informationtechnologyg'] . "</td>\n\t\t\t </tr>"; $total1 = $row1['malayalam1'] + $row1['malayalam2'] + $row1['sanskrit'] + $row1['english'] + $row1['hindi'] + $row1['physics'] + $row1['physics'] + $row1['biology'] + $row1['socialscience'] + $row1['maths'] + $row1['informationtechnology']; $avg1 = round($total1 / 11, 3); $total2 = $row2['malayalam1'] + $row2['malayalam2'] + $row2['sanskrit'] + $row2['english'] + $row2['hindi'] + $row2['physics'] + $row2['physics'] + $row2['biology'] + $row2['socialscience'] + $row2['maths'] + $row2['informationtechnology']; $avg2 = round($total2 / 11, 3); $total3 = $row3['malayalam1'] + $row3['malayalam2'] + $row3['sanskrit'] + $row3['english'] + $row3['hindi'] + $row3['physics'] + $row3['physics'] + $row3['biology'] + $row3['socialscience'] + $row3['maths'] + $row3['informationtechnology']; $avg3 = round($total3 / 11, 3); $str .= "<tr>\n\t\t\t <th align='left'>Total</th>\n\t\t\t <td align='center'>" . $total1 . "</td><td align='center'></td>\n\t\t\t <td align='center'>" . $total2 . "</td><td align='center'></td>\n\t\t\t <td align='center'>" . $total3 . "</td><td align='center'></td>\n\t\t\t </tr>\n\t\t\t <tr>\n\t\t\t <th align='left'>Average</th>\n\t\t\t <td align='center'>" . $avg1 . "</td><td align='center'>" . grade($avg1) . "</td>\n\t\t\t <td align='center'>" . $avg2 . "</td><td align='center'>" . grade($avg2) . "</td>\n\t\t\t <td align='center'>" . $avg3 . "</td><td align='center'>" . grade($avg3) . "</td>\n\t\t\t </tr>\n\t\t\t </table>\n\t\t\t </body>\n\t\t\t </html>"; } fwrite($handle, $str); include 'html\\html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->AddPage(); $fp = fopen("textcheck.html", "r"); $strContent = fread($fp, filesize("textcheck.html")); fclose($fp); $pdf->WriteHTML($strContent); $pdf->Output("sample.pdf"); ?> <html> <head> <title>Salvation Army</title> </head> <body> <iframe src="sample.pdf" width="100%" height="100%" ></iframe> </body> </html>
} $plink = '<a href="' . $PHP_SELF . "?id=" . $_SESSION['id_ff_anp'][$i] . "&pga=" . $cPga . '">' . $cPgan . '</a>' . "\n"; echo " " . $plink; } echo " >>"; } } //pdf ?> </td> </tr> </table> </body> </html> <?php if ($_GET[pdf] == 'ok') { $htmlbuffer = ob_get_contents(); ob_end_clean(); header("Content-type: application/pdf"); $pdf = new HTML2FPDF(); $pdf->ubic_css = "../../style.css"; //agreg mio $pdf->DisplayPreferences('HideWindowUI'); //$pdf->SetAutoPageBreak(false); //$pdf->usetableheader=true; $pdf->Header('Objetivos Estrategicos'); //titulo $pdf->AddPage(); //$pdf->SetFont('Arial','',12); // $pdf->setBasePath("../../../"); $pdf->WriteHTML($htmlbuffer); $pdf->Output('ficha_subactividad.pdf', 'D'); }
$pdf->SetFont('Arial','B',16); $pdf->AddPage(); //$pdf->Cell(40,10,'This one is my Testing.I hate this code. It is very tough code.Creating the pdf but not generated automatically.'); //$pdf->WriteHTML2($contentfile); $pdf2->WriteHTML($contentfile); echo $docs = $_SERVER['DOCUMENT_ROOT']."/rao/mayo-admin/welcome/includes/pdf-generator/caseno-".$_REQUEST['fid']."-".date('d-m-y-s').".pdf"; $pdf->Output($docs);*/ require 'html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->AddPage(); //echo $fp = fopen("$contentfile","r"); //$strContent = fread($fp, filesize("$contentfile")); //fclose($fp); //$pdf = new HTML2PDF(); $pdf->WriteHTML($contentfile); echo $docs = $_SERVER['DOCUMENT_ROOT'] . "/rao/mayo-admin/welcome/includes/pdf-generator/caseno-" . $_REQUEST['fid'] . "-" . date('d-m-y-s') . ".pdf"; $pdf->Output($docs); echo "PDF file is generated successfully!"; echo $sql = "INSERT INTO `final_billing` (`user_id`,`form_id`,`pdf_name`) VALUES ('{$_REQUEST['uid']}','{$_REQUEST['fid']}','caseno-" . $_REQUEST['fid'] . "-" . date('d-m-y-s') . ".pdf')"; $data = mysql_query($sql); $page = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; // header("Refresh: 2; url=$page"); } echo $query = "SELECT * FROM `final_billing` WHERE `user_id` = '{$_REQUEST['uid']}' && `form_id`='{$_REQUEST['fid']}' && id = (SELECT MAX(id))"; $getPdf = mysql_query($query) or die(mysql_error()); echo $count = mysql_num_rows($getPdf); if (mysql_num_rows($getPdf) >= 1) { $pdfOfUser = mysql_fetch_object($getPdf); ?> <h1><a href="../includes/pdf-generator/<?php
echo gettext("No calls in your selection"); ?> .</h3></center> <?php } ?> </center> <?php if ($exporttype != "pdf") { ?> <?php include "PP_footer.php"; ?> <?php } else { // EXPORT TO PDF $html = ob_get_contents(); // delete output-Buffer ob_end_clean(); $pdf = new HTML2FPDF(); $pdf->imgpath = "../../"; $pdf->DisplayPreferences('HideWindowUI'); $pdf->ShowNOIMG_GIF(); $pdf->AddPage(); $pdf->WriteHTML($html); $html = ob_get_contents(); $pdf->Output('CC_invoice_' . date("d/m/Y-H:i") . '.pdf', 'I'); }
public function onPreInit($param) { $myPDF = new HTML2FPDF(); $myPDF->setBasePath(Prado::getFrameworkPath()); $url = "http://" . $this->Application->Parameters['PDFHost'] . "/rliq/index.php?page=reports.protokoll.a_Protokoll&idtm_protokoll=2&idtm_termin=0"; $html = ""; $html = file_get_contents($url); $myPDF->WriteHTML($html); $myPDF->Output(); $this->getResponse()->appendHeader("Content-Type:" . $this->header); $this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $this->docName . '.' . $this->ext); $writer->save('php://output'); exit; }
public function Pdf_do($config = array()) { $source_name = $config['name']; $task_name = $config['output']; require 'htmlofpdf/html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->AddGBFont('GB', 'GB2312'); $pdf->AddPage(); $fp = fopen($source_name, "r"); $strContent = fread($fp, filesize($source_name)); fclose($fp); $pdf->WriteHTML(iconv("UTF-8", "GB2312", $strContent)); ob_clean(); $pdf->Output($task_name, true); }