X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fpdf_report.inc;h=b5ce162cdeced7fa42cbf8c1b3dbb19bab886ce4;hb=902dc617093bacaa492899be36484fe4f3dc16a6;hp=4ccd6b4b75b9e1a7ebe7a6db79a4318a823e3a9c;hpb=1b77725d52b62a154ef2ea579621ba7a02178996;p=fa-stable.git diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 4ccd6b4b..b5ce162c 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -3,7 +3,7 @@ $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; @@ -265,7 +265,7 @@ class FrontReport extends Cpdf 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) @@ -325,7 +325,7 @@ class FrontReport extends Cpdf $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 @@ -340,14 +340,15 @@ class FrontReport extends Cpdf $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 @@ -364,7 +365,7 @@ class FrontReport extends Cpdf if ($doctype == 9) { $this->Text($ccol, $myrow['name'], $icol); - //$adr = ?; + $adr = array(); } else { @@ -395,12 +396,12 @@ class FrontReport extends Cpdf } $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) { @@ -418,7 +419,7 @@ class FrontReport extends Cpdf } $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']); @@ -432,7 +433,8 @@ class FrontReport extends Cpdf $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)) @@ -450,7 +452,7 @@ class FrontReport extends Cpdf $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) { @@ -502,8 +504,12 @@ class FrontReport extends Cpdf $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(); @@ -511,9 +517,11 @@ class FrontReport extends Cpdf } $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; } @@ -604,7 +612,7 @@ class FrontReport extends Cpdf 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 @@ -631,7 +639,7 @@ class FrontReport extends Cpdf { $buf = $this->output(); $len = strlen($buf); - $dir = './pdf_files'; + $dir = $comp_path.'/'.user_company(). '/pdf_files'; //save the file if (!file_exists($dir)) {