$page_security = 8;
include_once($path_to_root . "reporting/includes/class.pdf.inc");
include_once($path_to_root . "admin/db/company_db.inc");
-
+include_once($path_to_root . "config.php");
class FrontReport extends Cpdf
{
var $size;
function Header2($myrow, $branch, $sales_order, $bankaccount, $doctype)
{
- global $path_to_root, $print_as_quote, $print_invoice_no;
+ global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no;
$this->pageNumber++;
if ($this->pageNumber > 1)
$this->row = $upper - 2 * $this->lineHeight - 2;
if ($this->company['coy_logo'] != '')
{
- $logo = $path_to_root . "themes/default/images/" . $this->company['coy_logo'];
+ $logo = $comp_path .'/'. user_company() . "/images/" . $this->company['coy_logo'];
$this->AddImage($logo, $ccol, $iline1 + 5, 250, 40);
}
else
$this->Text($mcol, $myrow['order_no'], $mcol + 90);
else if ($doctype == 9) // SO
$this->Text($mcol, $myrow['order_no'] ." ".$myrow['customer_ref'], $mcol + 90);
- else // INV/CRE/STA
+ else if (isset($myrow['trans_no']) && isset($myrow['reference'])) // INV/CRE/STA
{
if ($print_invoice_no == 1)
$this->Text($mcol, $myrow['trans_no'], $mcol + 90);
else
$this->Text($mcol, $myrow['reference'], $mcol + 90);
}
- $this->Text($mcol + 90, $myrow['debtor_no'], $mcol + 180);
+ if (isset($myrow['debtor_no']))
+ $this->Text($mcol + 90, $myrow['debtor_no'], $mcol + 180);
if ($doctype == 8 || $doctype == 9)
$this->Text($mcol + 180, sql2date($myrow['ord_date']));
else
if ($doctype == 9)
{
$this->Text($ccol, $myrow['name'], $icol);
- //$adr = ?;
+ $adr = array();
}
else
{
}
$this->row = $iline2 - 2 * $this->lineHeight;
$this->Text($ccol, $doc_Shipping_Company . ":", $ccol2);
- if ($doctype != 8)
+ if ($doctype != 8 && isset($myrow['shipper_name']))
$this->Text($ccol2, $myrow['shipper_name'], $mcol);
$this->Text($mcol, $doc_Due_Date . ":", $mcol2);
if ($doctype == 9)
$this->Text($mcol2, sql2date($myrow['delivery_date']));
- else if ($doctype != 8)
+ else if ($doctype != 8 && isset($myrow['due_date']))
$this->Text($mcol2, sql2date($myrow['due_date']));
if ($branch != null)
{
}
$this->NewLine();
$this->Text($ccol, $doc_Your_VAT_no . ":", $ccol2);
- if ($doctype != 8)
+ if ($doctype != 8 && isset($myrow['tax_id']))
$this->Text($ccol2, $myrow['tax_id'], $mcol);
$this->Text($mcol, $doc_Our_VAT_no . ":", $mcol2);
$this->Text($mcol2, $this->company['gst_no']);
$this->Text($ccol2, $row["terms"], $mcol);
$this->Text($mcol, $doc_Our_Order_No . ":", $mcol2);
- $this->Text($mcol2, $myrow['order_']);
+ if (isset($myrow['order_']))
+ $this->Text($mcol2, $myrow['order_']);
$locale = $path_to_root . "lang/" . $_SESSION['language']->code . "/locale.inc";
if (file_exists($locale))
$this->row = $iline5 - $this->lineHeight - 6;
$this->Text($ccol, $doc_Please_Quote . " - " . $myrow['curr_code']);
$this->NewLine();
- if ($branch['disable_branch'] > 0 && $doctype == 10) // payment links
+ if ($doctype == 10 && $branch['disable_branch'] > 0) // payment links
{
if ($branch['disable_branch'] == 1)
{
$this->Text($ccol2 + 30, $this->company['email'], $mcol);
// fetch this later
$this->row = $adrline;
- $this->Text($mcol, $bankaccount['bank_name'], $mcol2);
- $adr = explode("\n", $bankaccount['bank_address']);
+ if (isset($bankaccount['bank_name']))
+ $this->Text($mcol, $bankaccount['bank_name'], $mcol2);
+ if (isset($bankaccount['bank_address']))
+ $adr = explode("\n", $bankaccount['bank_address']);
+ else
+ $adr = array();
for ($i = 0; $i < count($adr); $i++)
{
$this->NewLine();
}
$this->row = $adrline;
- $this->Text($mcol2, $bankaccount['bank_account_name']);
+ if (isset($bankaccount['bank_account_name']))
+ $this->Text($mcol2, $bankaccount['bank_account_name']);
$this->NewLine();
- $this->Text($mcol2, $bankaccount['bank_account_number']);
+ if (isset($bankaccount['bank_account_number']))
+ $this->Text($mcol2, $bankaccount['bank_account_number']);
$this->row = $temp;
}
function End($email=0, $subject=null, $myrow=null, $doctype = 0)
{
- global $go_debug, $path_to_root;
+ global $go_debug, $path_to_root, $comp_path;
// this is no good in IE so has been replaced, see down under
// but good for debugging purposes in IE
{
$buf = $this->output();
$len = strlen($buf);
- $dir = './pdf_files';
+ $dir = $comp_path.'/'.user_company(). '/pdf_files';
//save the file
if (!file_exists($dir))
{