Esempio n. 1
0
 public function output($name = '', $dest = '')
 {
     foreach ($this->_documents as $document) {
         $pageCount = $this->setSourceFile($document);
         for ($i = 1; $i <= $pageCount; $i++) {
             $tplidx = $this->ImportPage($i);
             $this->AddPage();
             $this->useTemplate($tplidx);
         }
     }
     foreach ($this->_tmpDocuments as $document) {
         unlink($document);
     }
     parent::Output($name, $dest);
 }
Esempio n. 2
0
 function pdf_write_value(&$value)
 {
     switch ($value[0]) {
         case PDF_TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_RC4($this->_objectkey($this->current_obj_id), $value[1]);
                 $value[1] = $this->_escape($value[1]);
             }
             break;
         case PDF_TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_RC4($this->_objectkey($this->current_obj_id), $value[2][1]);
             }
             break;
         case PDF_TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_RC4($this->_objectkey($this->current_obj_id), $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
     parent::pdf_write_value($value);
 }
     $time_submit_end = time();
 }
 $format_bg_r = "220";
 $format_bg_g = "220";
 $format_bg_b = "220";
 if ($settings_pdffont != NULL) {
     $format_font = $settings_pdffont;
     $format_font_2 = $settings_pdffont . ".php";
 } else {
     $format_font = "franklingothicbook";
     $format_font_2 = "franklingothicbook.php";
 }
 //  Use FDPI to get the template
 define('FPDF_FONTPATH', 'fpdf/font/');
 require 'fpdf/fpdi.php';
 $pdf = new fpdi();
 $pagecount = $pdf->setSourceFile("pdf/template.pdf");
 $tplidx = $pdf->ImportPage(1);
 $pdf->addPage();
 $pdf->useTemplate($tplidx, 0, 0, 210, 297);
 $pdf->AddFont($format_font, '', $format_font_2);
 $pdf->SetY(50);
 $pdf->SetFont($format_font, '', 14);
 // Determine name of project
 $sql = "SELECT proj_num, proj_name FROM intranet_projects WHERE proj_id = '{$proj_submit}'";
 $result = mysql_query($sql, $conn) or die(mysql_error());
 $array = mysql_fetch_array($result);
 $proj_num = $array['proj_num'];
 $proj_name = $array['proj_name'];
 $print_submit_begin = date("l, jS F Y", $_POST[submit_begin]);
 $print_submit_begin = "from " . $print_submit_begin;
<?php

include "inc_files/inc_checkcookie.php";
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_font = "century";
$format_font_2 = "Century.php";
$user_id = intval($_GET[user_id]);
if ($user_id == NULL) {
    header("Location: index2.php");
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$pdf->AddFont($format_font, '', $format_font_2);
// Begin creating the page
//Page Title
$sql_name = "SELECT user_name_first, user_name_second, user_initials FROM intranet_user_details WHERE user_id = {$user_id} LIMIT 1";
$result_name = mysql_query($sql_name, $conn) or die(mysql_error());
$array_name = mysql_fetch_array($result_name);
$user_name_first = $array_name['user_name_first'];
$user_name_second = $array_name['user_name_second'];
$user_initials = $array_name['user_initials'];
$sheet_title = "Expenses Claim, " . date("j F Y", time());
$user_name = $user_name_first . " " . $user_name_second . " (" . $user_initials . ")";
<?php

include "inc_files/inc_checkcookie.php";
if ($_GET[proj_id] == NULL) {
    header("Location: index2.php");
}
if ($user_usertype_current < 2) {
    header("Location: index2.php");
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_ln_r = "220";
$format_ln_g = "220";
$format_ln_b = "220";
$current_date = TimeFormat(time());
$proj_id = CleanUp($_GET[proj_id]);
// Begin creating the page
//Page Title
$sql_proj = "SELECT * FROM intranet_projects WHERE proj_id = {$proj_id} LIMIT 1";
Esempio n. 6
0
             Debug::Text('Clearing Column: ' . $static_column_key, __FILE__, __LINE__, __METHOD__, 10);
             $rows[$last_row][Misc::trimSortPrefix($static_column_key)] = NULL;
         }
         unset($static_column_key, $static_column_val);
     }
 }
 foreach ($filter_data['column_ids'] as $column_key) {
     $filter_columns[Misc::trimSortPrefix($column_key)] = $columns[$column_key];
 }
 if ($action == 'display_form' or $action == 'print_form') {
     Debug::Text('Generating PDF: ', __FILE__, __LINE__, __METHOD__, 10);
     //Get company information
     $clf = TTnew('CompanyListFactory');
     $company_obj = $clf->getById($current_company->getId())->getCurrent();
     $border = 0;
     $pdf = new fpdi();
     $pdf->setMargins(5, 5, 5, 5);
     $pdf->SetAutoPageBreak(FALSE);
     $pdf->SetFont('freeserif', '', 10);
     if ($show_background == TRUE) {
         //Import original Gov't supplied PDF.
         $pagecount = $pdf->setSourceFile(Environment::getBasePath() . 'interface' . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'us' . DIRECTORY_SEPARATOR . 'tax' . DIRECTORY_SEPARATOR . 'w3.pdf');
         $tplidx_summary = $pdf->ImportPage(1);
     }
     $pdf->AddPage();
     if (isset($tplidx_summary)) {
         $pdf->useTemplate($tplidx_summary, 0, 0);
     }
     //Form year
     if ($show_background == TRUE) {
         $pdf->SetFont('freeserif', '', 18);
$label_l = $label_line[12];
// Margin
$font = $_POST[font];
// Set the cell margins
$cell_margin_top = $label_l;
$cell_margin_bottom = $label_l;
$cell_margin_left = $label_l;
$cell_margin_right = $label_l;
$count_across = 1;
$count_down = 1;
$x = $label_e;
$y = $label_f;
// Set up the page
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
// Determine if there's to be an uploaded template
$label_file = "library/background.pdf";
if (file_exists($label_file)) {
    $import_template = "1";
} else {
    $import_template = NULL;
}
if ($import_template == "1") {
    $pdf->setSourceFile("library/background.pdf");
    $tplidx = $pdf->ImportPage(1);
}
// Now add the first page
$pdf->addPage();
if ($import_template == "1") {
    $pdf->useTemplate($tplidx, 0, 0, 210, 297);
    $viewall = "yes";
} else {
    header("Location: ../index2.php");
}
if ($_POST[order_by] != NULL) {
    $order_by = CleanUp($_POST[order_by]);
} else {
    $order_by = "invoice_id";
}
if ($_POST[account_id] != NULL) {
    $account_test = "AND invoice_account = " . CleanNumber($_POST[account_id]);
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->AddFont($format_font, '', $format_font_2);
$counter = 1;
if ($viewall == "yes") {
    $nowtime = time();
    $sql_complete = "SELECT invoice_id FROM intranet_timesheet_invoice WHERE invoice_date < {$nowtime} {$account_test} ORDER BY {$order_by}";
    $result_complete = mysql_query($sql_complete, $conn) or die(mysql_error());
} else {
    $nowtime = time();
    $sql_complete = "SELECT invoice_id FROM intranet_timesheet_invoice WHERE invoice_id = {$invoice_id} LIMIT 1";
    $result_complete = mysql_query($sql_complete, $conn) or die(mysql_error());
}
while ($array_complete = mysql_fetch_array($result_complete)) {
    $invoice_id = $array_complete['invoice_id'];
Esempio n. 9
0
     }
 }
 //
 //Figure out state/locality wages/taxes.
 //
 $cdlf = new CompanyDeductionListFactory();
 $cdlf->getByCompanyIdAndStatusIdAndTypeId($current_company->getId(), array(10, 20), 10);
 if ($cdlf->getRecordCount() > 0) {
     foreach ($cdlf as $cd_obj) {
         $tax_deductions[] = array('id' => $cd_obj->getId(), 'province' => $cd_obj->getProvince(), 'district' => $cd_obj->getDistrict(), 'pay_stub_entry_account_id' => $cd_obj->getPayStubEntryAccount(), 'include' => $cd_obj->getIncludePayStubEntryAccount(), 'exclude' => $cd_obj->getExcludePayStubEntryAccount(), 'user_ids' => $cd_obj->getUser());
     }
 }
 $border = 0;
 $adjust_x = 0;
 $adjust_y = 0;
 $pdf = new fpdi();
 $pdf->SetFont('freeserif', '', 10);
 if ($show_background == TRUE) {
     $pagecount = $pdf->setSourceFile(Environment::getBasePath() . 'interface' . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'us' . DIRECTORY_SEPARATOR . 'tax' . DIRECTORY_SEPARATOR . 'f1099misc.pdf');
     //Import original Gov't supplied PDF.
     $tplidx[1] = $pdf->ImportPage(1);
     $tplidx[2] = $pdf->ImportPage(2);
     $tplidx[3] = $pdf->ImportPage(3);
     $tplidx[4] = $pdf->ImportPage(4);
     $tplidx[5] = $pdf->ImportPage(5);
     $tplidx[6] = $pdf->ImportPage(6);
 }
 if (isset($raw_rows)) {
     $ulf = new UserListFactory();
     $x = 0;
     foreach ($raw_rows as $user_id => $raw_row) {
} else {
    $date_type = "invoice_date";
}
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_font = "century";
$format_font_2 = "Century.php";
include "inc_files/inc_checkcookie.php";
if ($user_usertype_current <= 3) {
    header("Location: index2.php");
} else {
    //  Use FDPI to get the template
    define('FPDF_FONTPATH', 'fpdf/font/');
    require 'fpdf/fpdi.php';
    $pdf = new fpdi();
    $pagecount = $pdf->setSourceFile("pdf/template.pdf");
    $tplidx = $pdf->ImportPage(1);
    $pdf->addPage();
    $pdf->useTemplate($tplidx, 0, 0, 210, 297);
    $pdf->AddFont($format_font, '', $format_font_2);
    // Begin creating the page
    $project_counter = 1;
    $page_count = 1;
    $month_count = 1;
    $x = 10;
    $y = 50;
    $pdf->SetXY($x, $y);
    // Reset all the counters
    $invoice_value_novat_month_all = 0;
    $invoice_value_vat_month_all = 0;
} else {
    $user_id = $_COOKIE[user];
    $timesheet_datum = $format_bg_r = "220";
    $format_bg_g = "220";
    $format_bg_b = "220";
    if ($settings_pdffont != NULL) {
        $format_font = $settings_pdffont;
        $format_font_2 = $settings_pdffont . ".php";
    } else {
        $format_font = "franklingothicbook";
        $format_font_2 = "franklingothicbook.php";
    }
    //  Use FDPI to get the template
    define('FPDF_FONTPATH', 'fpdf/font/');
    require 'fpdf/fpdi.php';
    $pdf = new fpdi();
    $pagecount = $pdf->setSourceFile("pdf/template.pdf");
    $tplidx = $pdf->ImportPage(1);
    $pdf->addPage();
    $pdf->useTemplate($tplidx, 0, 0, 210, 297);
    $pdf->AddFont($format_font, '', $format_font_2);
    $pdf->SetY(50);
    $pdf->SetFont($format_font, '', 16);
    // Printed by, and on...
    $pdf->SetTextColor(180, 180, 180);
    $ts_print_title = "Timesheets";
    $pdf->MultiCell(0, 6, $ts_print_title, 0, L, 0);
    $sql = "SELECT user_name_first, user_name_second FROM intranet_user_details WHERE user_id = {$user_id}";
    $result = mysql_query($sql, $conn) or die(mysql_error());
    $array = mysql_fetch_array($result);
    $user_name_first = $array['user_name_first'];
<?php

include "inc_files/inc_checkcookie.php";
if ($_GET[proj_id] == NULL) {
    header("Location: index2.php");
}
if ($user_usertype_current < 2) {
    header("Location: index2.php");
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_ln_r = "220";
$format_ln_g = "220";
$format_ln_b = "220";
$current_date = TimeFormat(time());
$proj_id = CleanUp($_GET[proj_id]);
// Begin creating the page
//Page Title
$sql_proj = "SELECT * FROM intranet_projects WHERE proj_id = {$proj_id} LIMIT 1";
<?php

include "inc_files/inc_checkcookie.php";
if ($_GET[proj_id] == NULL) {
    header("Location: index2.php");
} elseif ($_GET[issue_set] == NULL) {
    header("Location: index2.php?proj_id={$_GET['proj_id']}");
} else {
    $issue_set = $_GET[issue_set];
    $proj_id = $_GET[proj_id];
}
include "secure/prefs.php";
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
if ($settings_pdffont != NULL) {
    $format_font = $settings_pdffont;
    $format_font_2 = $settings_pdffont . ".php";
} else {
    $format_font = "franklingothicbook";
    $format_font_2 = "franklingothicbook.php";
}
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
<?php

include "inc_files/inc_checkcookie.php";
if ($_GET[proj_id] == NULL) {
    header("Location: index2.php");
}
if ($user_usertype_current < 2) {
    header("Location: index2.php");
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_ln_r = "220";
$format_ln_g = "220";
$format_ln_b = "220";
$current_date = TimeFormat(time());
$proj_id = CleanUp($_GET[proj_id]);
// Begin creating the page
//Page Title
$sql_proj = "SELECT * FROM intranet_projects WHERE proj_id = {$proj_id} LIMIT 1";
Esempio n. 15
0
<?php

include "inc_files/inc_checkcookie.php";
include_once "secure/prefs.php";
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
function NewPage()
{
    global $pdf;
    $pdf->addPage();
    $current_y = $pdf->GetY();
    $new_y = $current_y + 50;
    $pdf->SetY($new_y);
}
function Paragraph($input)
{
    global $pdf;
    global $format_font;
    $text_array = explode("\n", $input);
    $header = 1;
    foreach ($text_array as $para) {
        $para = trim($para);
        $pdf->SetTextColor(0);
        if (substr($para, 0, 2) == "- ") {
            $pdf->SetFont('ZapfDingbats', '', 4);
            $para = trim($para, "- ");
            $pdf->SetX(0);
            $pdf->Cell(30, 5, 'l', 0, 0, R, 0);
            $pdf->SetX(30);
<?php

include "inc_files/inc_checkcookie.php";
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_ln_r = "220";
$format_ln_g = "220";
$format_ln_b = "220";
// Begin creating the page
//Page Title
$sql_project = "SELECT * FROM intranet_projects_blog, intranet_user_details, intranet_projects WHERE blog_id = {$blog_id} AND blog_proj = proj_id AND blog_user = user_id LIMIT 1";
$result_project = mysql_query($sql_project, $conn) or die(mysql_error());
$array_project = mysql_fetch_array($result_project);
$proj_num = $array_project['proj_num'];
$proj_name = $array_project['proj_name'];
$blog_title = $array_project['blog_title'];
$blog_date = $array_project['blog_date'];
$blog_type = $array_project['blog_type'];
$blog_text = strip_tags(nl2br(RemoveShit($array_project['blog_text'])));
<?php

$format_bg_r = "150";
$format_bg_g = "150";
$format_bg_b = "150";
if ($_GET[proj_id] != NULL) {
    $proj_id = $_GET[proj_id];
} else {
    header("Location: ../index2.php");
}
include "inc_files/inc_checkcookie_logincheck.php";
include "inc_files/inc_checkcookie.php";
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx);
// Functions
function StyleBody($input)
{
    global $pdf;
    global $format_font;
    $pdf->SetFont($format_font, '', $input);
    $pdf->SetTextColor(0, 0, 0);
}
$format_bg_g = "220";
$format_bg_b = "220";
$format_font = "century";
$format_font_2 = "Century.php";
if ($_GET[time] != NULL) {
    $ts_expense_verified = $_GET[time];
} else {
    $ts_expense_verified = time();
}
if ($user_usertype_current <= 3) {
    header("Location: index2.php");
}
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$pdf->AddFont($format_font, '', $format_font_2);
// Begin creating the page
//Page Title
$sheet_title = "Verified Expenses, " . date("j F Y, g:i a", $ts_expense_verified);
$pdf->SetXY(10, 45);
$pdf->SetFont($format_font, '', 26);
$pdf->SetTextColor(200, 200, 200);
$pdf->Cell(0, 10, $sheet_title);
$pdf->SetXY(10, 55);
$pdf->SetFont($format_font, '', 12);
// Columnn Headings
     }
     $current_y = $pdf->GetY() + 4;
     $pdf->SetX(0);
     $pdf->SetY($current_y);
 }
 //if ($settings_pdffont != NULL) {
 //$format_font = $settings_pdffont;
 //$format_font_2 = $settings_pdffont.".php";
 //} else {
 $format_font = "Helvetica";
 $format_font_2 = "franklingothicbook.php";
 //}
 //  Use FDPI to get the template
 define('FPDF_FONTPATH', 'fpdf/font/');
 require 'fpdf/fpdi.php';
 $pdf = new fpdi();
 $pagecount = $pdf->setSourceFile("pdf/template.pdf");
 $tplidx = $pdf->ImportPage(1);
 $pdf->addPage();
 $pdf->useTemplate($tplidx);
 $pdf->SetAutoPageBreak(0, 1.5);
 $pdf->AddFont($format_font, '', $format_font_2);
 // Page headers
 $project_counter = 1;
 $page_count = 1;
 $pdf->SetY(35);
 $pdf->SetFont('Helvetica', 'b', 24);
 $pdf->SetTextColor($format_bg_r, $format_bg_g, $format_bg_b);
 $pdf->Cell(0, 10, "Timesheet Analysis");
 $pdf->SetTextColor(0, 0, 0);
 $pdf->SetY(50);
Esempio n. 20
0
<?php

error_reporting(E_ALL);
define('FPDF_FONTPATH', 'font/');
require 'fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdfdoc.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 10, 10, 90);
$pdf->Output("newpdf.pdf", "F");
$pdf->closeParsers();
<?php

$format_bg_r = "0";
$format_bg_g = "0";
$format_bg_b = "0";
if ($_GET[proj_id] != NULL) {
    $proj_id = $_GET[proj_id];
} else {
    header("Location: ../index2.php");
}
include_once "inc_files/inc_checkcookie.php";
include_once "secure/prefs.php";
//  Use FDPI to get the template
define('FPDF_FONTPATH', 'fpdf/font/');
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx);
// Functions
function StyleBody($input)
{
    global $pdf;
    global $format_font;
    $pdf->SetFont($format_font, '', $input);
    $pdf->SetTextColor(0, 0, 0);
}
Esempio n. 22
0
             $lines_arr[$quarter_id]['p1_6'] = bcmul($lines_arr[$quarter_id]['p1_5'], 0.008);
         }
         unset($user_id);
         //var_dump($user_ps_entries);
     }
     unset($pay_period_ids, $ps_entries);
 }
 //Calc Part 1, Line 3 here.
 if (isset($lines_arr)) {
     $lines_arr['total'] = Misc::ArrayAssocSum($lines_arr, NULL, 6);
     Debug::Arr($lines_arr, 'Lines Array: ', __FILE__, __LINE__, __METHOD__, 10);
     //Line 8
     $p1_line8 = $lines_arr['total']['p1_6'] - 0;
 }
 $border = 0;
 $pdf = new fpdi();
 //Import original Gov't supplied PDF.
 if ($show_background == TRUE) {
     $pagecount = $pdf->setSourceFile(Environment::getBasePath() . 'interface' . DIRECTORY_SEPARATOR . 'forms' . DIRECTORY_SEPARATOR . 'us' . DIRECTORY_SEPARATOR . 'tax' . DIRECTORY_SEPARATOR . 'f940ez.pdf');
     $tplidx = $pdf->ImportPage(1);
 }
 $pdf->setMargins(0, 0, 0, 0);
 $pdf->SetAutoPageBreak(FALSE);
 $pdf->SetFont('freeserif', '', 10);
 $pdf->AddPage();
 if (isset($tplidx)) {
     $pdf->useTemplate($tplidx, 0, 0);
 }
 $pdf->setXY(40, 39);
 $pdf->Cell(75, 6, $current_company->getName(), $border, 0, 'L');
 $pdf->setXY(157, 39);
 $colwidth = 10;
 $rowheight = 4;
 if ($_GET[timestart] == NULL) {
     $timestart = time();
 } else {
     $timestart = $_GET[timestart];
 }
 $current_time = BeginMonth($timestart, 1, 2);
 $capture_start = $current_time;
 $format_bg_r = "0";
 $format_bg_g = "0";
 $format_bg_b = "0";
 //  Use FDPI to get the template
 define('FPDF_FONTPATH', 'fpdf/font/');
 require 'fpdf/fpdi.php';
 $pdf = new fpdi();
 //$pagecount = $pdf->setSourceFile("pdf/template.pdf");
 //$tplidx = $pdf->ImportPage(1);
 $pdf->addPage(L);
 //$pdf->useTemplate($tplidx);
 // Functions
 function Colors($ratio, $factor)
 {
     $output = round(255 * $ratio);
     $diff = 255 - $output;
     $add = $factor * $diff;
     $output = 255 - $add;
     return $output;
 }
 function DrawGrid()
 {