X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fpdf_report.inc;h=67d23e84cbdca7ce6792646925b5ff888f1ceb96;hb=3ff9ed87cb909f19c8fe3e7dfda5df79d0c01a6c;hp=b9ae9410a22d56d2d8e52f243a3553ae1d55e9a4;hpb=37da0ea920fdff712ccef4e1324aa822e981c8fc;p=fa-stable.git
diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc
index b9ae9410..67d23e84 100644
--- a/reporting/includes/pdf_report.inc
+++ b/reporting/includes/pdf_report.inc
@@ -1,12 +1,20 @@
.
+***********************************************************************/
//include_once($path_to_root . "reporting/includes/class.pdf.inc");
include_once(dirname(__FILE__)."/class.pdf.inc");
include_once(dirname(__FILE__)."/printer_class.inc");
-include_once($path_to_root . "admin/db/company_db.inc");
-include_once($path_to_root . "admin/db/printers_db.inc");
-include_once($path_to_root . "config.php");
+include_once($path_to_root . "/admin/db/company_db.inc");
+include_once($path_to_root . "/admin/db/printers_db.inc");
+include_once($path_to_root . "/config.php");
class FrontReport extends Cpdf
{
var $size;
@@ -42,9 +50,16 @@ class FrontReport extends Cpdf
function FrontReport($title, $filename, $size = 'A4', $fontsize = 9)
{
+ global $page_security;
+ if (!$_SESSION["wa_current_user"]->can_access_page($page_security))
+ {
+ display_error(_("The security settings on your account do not permit you to print this report"));
+ end_page();
+ exit;
+ }
switch ($size)
{
-
+ default:
case 'A4':
case 'a4':
$this->pageWidth=595;
@@ -114,7 +129,7 @@ class FrontReport extends Cpdf
}
$this->size = array(0, 0, $this->pageWidth, $this->pageHeight);
$this->title = $title;
- $this->filename = $filename;
+ $this->filename = $filename.".pdf";
$this->pageNumber = 0;
$this->endLine = $this->pageWidth - $this->rightMargin;
$this->companyCol = $this->endLine - 150;
@@ -140,7 +155,7 @@ class FrontReport extends Cpdf
function Info($params, $cols, $headers, $aligns,
$cols2 = null, $headers2 = null, $aligns2 = null)
{
- global $app_title, $version, $power_by, $power_url, $path_to_root, $db_connections;
+ global $app_title, $version, $power_by, $power_url;
$this->addinfo('Title', $this->title);
$this->addinfo('Subject', $this->title);
@@ -154,7 +169,6 @@ class FrontReport extends Cpdf
$this->fiscal_year = sql2date($year['begin']) . " - " . sql2date($year['end']) . " " . "(" . $how . ")";
$this->company = get_company_prefs();
$this->user = $_SESSION["wa_current_user"]->name;
- //$this->host = $db_connections[$_SESSION["wa_current_user"]->company]["host"];
$this->host = $_SERVER['SERVER_NAME'];
$this->params = $params;
$this->cols = $cols;
@@ -195,6 +209,8 @@ class FrontReport extends Cpdf
$str = _("Print Out Date") . ':';
$this->Text($this->leftMargin, $str, $this->titleCol);
$str = Today() . ' ' . Now();
+ if ($this->company['time_zone'])
+ $str .= ' ' . date('O') . ' GMT';
$this->Text($this->titleCol, $str, $this->companyCol);
$this->Text($this->companyCol, $this->host);
@@ -250,22 +266,22 @@ class FrontReport extends Cpdf
function Header2($myrow, $branch, $sales_order, $bankaccount, $doctype)
{
- global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no;
+ global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no, $packing_slip;
$this->pageNumber++;
if ($this->pageNumber > 1)
$this->newPage();
$header2type = true;
- if ($this->currency != $myrow['curr_code'])
+ if (isset($myrow['curr_code']) && $this->currency != $myrow['curr_code'])
{
- include($path_to_root . "reporting/includes/doctext2.inc");
+ include($path_to_root . "/reporting/includes/doctext2.inc");
}
else
{
- include($path_to_root . "reporting/includes/doctext.inc");
+ include($path_to_root . "/reporting/includes/doctext.inc");
}
- include($path_to_root . "reporting/includes/header2.inc");
+ include($path_to_root . "/reporting/includes/header2.inc");
$this->row = $temp;
}
@@ -310,6 +326,18 @@ class FrontReport extends Cpdf
{
return $this->TextWrap($this->cols[$c], $this->row - $r, $this->cols[$n] - $this->cols[$c] + $corr, $txt, $this->aligns[$c]);
}
+
+ function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0)
+ {
+ return $this->TextCol($c, $n, number_format2($txt, $dec), $corr, $r);
+ }
+
+ function DateCol($c, $n, $txt, $conv=false, $corr=0, $r=0)
+ {
+ if ($conv)
+ $txt = sql2date($txt);
+ return $this->TextCol($c, $n, $txt, $corr, $r);
+ }
function TextCol2($c, $n, $txt, $corr=0, $r=0)
{
@@ -351,7 +379,7 @@ class FrontReport extends Cpdf
function NewLine($l=1, $np=0)
{
$this->row -= ($l * $this->lineHeight);
- if ($np > 0 && $this->row < $this->bottomMargin + ($np * $this->lineHeight))
+ if ($this->row < $this->bottomMargin + ($np * $this->lineHeight))
$this->Header();
}
@@ -361,9 +389,7 @@ class FrontReport extends Cpdf
if ($pdf_debug == 1)
{
- $buf = $this->Output();
- $len = strlen($buf);
- $pdfcode = $buf;
+ $pdfcode = $this->Output('','S');
$pdfcode = str_replace("\n", "\n
", htmlspecialchars($pdfcode));
echo '