3 $this->row = $this->pageHeight - $this->topMargin;
5 $upper = $this->row - 2 * $this->lineHeight;
6 $lower = $this->bottomMargin + 6 * $this->lineHeight;
7 $iline1 = $upper - 4 * $this->lineHeight;
8 $iline2 = $iline1 - 8 * $this->lineHeight;
9 $iline3 = $iline2 - 8 * $this->lineHeight;
10 $iline4 = $iline3 - 2 * $this->lineHeight;
11 $iline5 = $lower + 4 * $this->lineHeight;
12 $icol = $this->pageWidth / 2;
13 $ccol = $this->cols[0] + 4;
16 $mcol2 = $this->pageWidth - $ccol2;
18 $this->SetDrawColor(128, 128, 128);
19 $this->LineTo($this->pageWidth - $this->rightMargin, $upper ,$this->leftMargin, $upper);
20 $this->LineTo($this->leftMargin, $upper ,$this->leftMargin, $lower);
21 $this->LineTo($this->pageWidth - $this->rightMargin, $lower ,$this->leftMargin, $lower);
22 $this->LineTo($this->pageWidth - $this->rightMargin, $lower ,$this->pageWidth - $this->rightMargin, $upper);
28 $this->LineTo($icol, $upper ,$icol, $iline1);
33 $this->Text($mcol, $this->title);
36 if ($this->pageNumber > 1 && !strstr($this->filename, "Bulk"))
37 $this->Text($this->endLine - 35, _("Page") . ' ' . $this->pageNumber);
39 $this->row = $upper - 5;
41 $this->Text($mcol, $doc_Invoice_no, $mcol + 90);
42 $this->Text($mcol + 90, $doc_Cust_no, $mcol + 180);
43 $this->Text($mcol + 180, $doc_Date);
46 $this->row = $upper - 2 * $this->lineHeight - 2;
47 if ($this->company['coy_logo'] != '')
49 $logo = $comp_path .'/'. user_company() . "/images/" . $this->company['coy_logo'];
50 $this->AddImage($logo, $ccol, $iline1 + 5, 0, 40);
56 $this->Text($ccol, $this->company['coy_name'], $icol);
60 if ($doctype == 8 || $doctype == 9) // PO or SO
61 $this->Text($mcol, $myrow['order_no'], $mcol + 90);
62 else if (isset($myrow['trans_no']) && isset($myrow['reference'])) // INV/CRE/STA
64 if ($print_invoice_no == 1)
65 $this->Text($mcol, $myrow['trans_no'], $mcol + 90);
67 $this->Text($mcol, $myrow['reference'], $mcol + 90);
69 if (isset($myrow['debtor_no']))
70 $this->Text($mcol + 90, $myrow['debtor_no'], $mcol + 180);
71 if ($doctype == 8 || $doctype == 9)
72 $this->Text($mcol + 180, sql2date($myrow['ord_date']));
74 $this->Text($mcol + 180, sql2date($myrow['tran_date']));
77 $this->row = $iline1 - 5;
78 $this->Text($ccol, $doc_Charge_To, $icol);
79 $this->Text($mcol, $doc_Delivered_To);
86 $this->Text($ccol, $myrow['name'], $icol);
91 $this->Text($ccol, $myrow['supp_name'], $icol);
93 $this->Text($ccol, $myrow['DebtorName'], $icol);
95 $this->TextWrapLines($ccol, $icol - $ccol, $myrow['address']);
97 if ($sales_order != NULL)
101 $this->Text($mcol, $this->company['coy_name']);
103 $this->Text($mcol, $sales_order['deliver_to']);
105 $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
107 $this->row = $iline2 - 2 * $this->lineHeight;
108 $this->Text($ccol, $doc_Shipping_Company . ":", $ccol2);
109 if ($doctype != 8 && isset($myrow['shipper_name']))
110 $this->Text($ccol2, $myrow['shipper_name'], $mcol);
111 $this->Text($mcol, $doc_Due_Date . ":", $mcol2);
113 $this->Text($mcol2, sql2date($myrow['delivery_date']));
114 else if ($doctype != 8 && isset($myrow['due_date']))
115 $this->Text($mcol2, sql2date($myrow['due_date']));
119 $this->Text($ccol, $doc_Your_Ref . ":", $ccol2);
120 $this->Text($ccol2, $branch['contact_name'], $mcol);
121 $this->Text($mcol, $doc_Our_Ref . ":", $mcol2);
123 $id = $branch['salesman'];
124 $sql = "SELECT salesman_name FROM ".TB_PREF."salesman WHERE salesman_code='$id'";
125 $result = db_query($sql,"could not get sales person");
126 $row = db_fetch($result);
128 $this->Text($mcol2, $row['salesman_name']);
131 $this->Text($ccol, $doc_Your_VAT_no . ":", $ccol2);
132 if ($doctype != 8 && isset($myrow['tax_id']))
133 $this->Text($ccol2, $myrow['tax_id'], $mcol);
134 $this->Text($mcol, $doc_Our_VAT_no . ":", $mcol2);
135 $this->Text($mcol2, $this->company['gst_no']);
137 $this->Text($ccol, $doc_Payment_Terms . ":", $ccol2);
139 $id = $myrow['payment_terms'];
140 $sql = "SELECT terms FROM ".TB_PREF."payment_terms WHERE terms_indicator='$id'";
141 $result = db_query($sql,"could not get paymentterms");
142 $row = db_fetch($result);
144 $this->Text($ccol2, $row["terms"], $mcol);
145 $this->Text($mcol, $doc_Our_Order_No . ":", $mcol2);
146 if (isset($myrow['order_']))
147 $this->Text($mcol2, $myrow['order_']);
148 // 2008-06-16. Added customer's reference
150 $this->Text($ccol, $doc_Customers_Ref, $ccol2);
151 if (isset($sales_order["customer_ref"]))
152 $this->Text($ccol2, $sales_order["customer_ref"], $mcol);
153 $locale = $path_to_root . "lang/" . $_SESSION['language']->code . "/locale.inc";
154 if (file_exists($locale))
156 $header2include = true;
159 $this->row = $iline3 - $this->lineHeight - 2;
161 $count = count($this->headers);
162 for ($i = 0; $i < $count; $i++)
163 $this->TextCol($i, $i + 1, $this->headers[$i], -2);
165 $temp = $this->row - 2 * $this->lineHeight;
166 $this->row = $iline5 - $this->lineHeight - 6;
167 $this->Text($ccol, $doc_Please_Quote . " - " . $myrow['curr_code']);
169 if ($doctype == 10 && $branch['disable_branch'] > 0) // payment links
171 if ($branch['disable_branch'] == 1)
173 $amt = number_format($myrow["ov_freight"] + $myrow["ov_gst"] + $myrow["ov_amount"], user_price_dec());
174 $txt = $doc_Payment_Link . " PayPal: ";
175 $name = urlencode($this->title . " " . $myrow['reference']);
176 $url = "https://www.paypal.com/xclick/business=" . $this->company['email'] . "&item_name=" .
177 $name . "&amount=" . $amt . "¤cy_code=" . $myrow['curr_code'];
178 $this->fontSize -= 2;
179 $this->Text($ccol, $txt);
181 $this->SetTextColor(0, 0, 255);
182 $this->Text($ccol, $url);
183 $this->SetTextColor(0, 0, 0);
184 $this->addLink($url, $ccol, $this->row, $this->pageWidth - $this->rightMargin, $this->row + $this->lineHeight);
185 $this->fontSize += 2;
188 if ($this->params['comments'] != '')
192 $this->Text($ccol, $this->params['comments']);
196 $this->row = $lower - 5;
197 $this->fontSize -= 4;
199 $this->Text($ccol, $doc_Address, $ccol2 + 40);
200 $this->Text($ccol2 + 30, $doc_Phone_Fax_Email, $mcol);
201 $this->Text($mcol , $doc_Bank, $mcol2);
202 $this->Text($mcol2, $doc_Bank_Account);
203 $this->fontSize += 4;
205 $adrline = $this->row;
206 $this->TextWrapLines($ccol, $ccol2 + 40 - $ccol, $this->company['postal_address']);
207 $this->row = $adrline;
208 $this->Text($ccol2 + 30, $this->company['phone'], $mcol);
210 $this->Text($ccol2 + 30, $this->company['fax'], $mcol);
212 $this->Text($ccol2 + 30, $this->company['email'], $mcol);
214 $this->row = $adrline;
215 if (isset($bankaccount['bank_name']))
216 $this->Text($mcol, $bankaccount['bank_name'], $mcol2);
218 if (isset($bankaccount['bank_address']))
219 $this->TextWrapLines($mcol, $mcol2 - $mcol, $bankaccount['bank_address']);
220 $this->row = $adrline;
221 if (isset($bankaccount['bank_account_name']))
222 $this->Text($mcol2, $bankaccount['bank_account_name']);
224 if (isset($bankaccount['bank_account_number']))
225 $this->Text($mcol2, $bankaccount['bank_account_number']);