+ }
+ // if you need the company name in purchase order then write it as first line in location addresss.
+ if ($doctype != ST_SUPPAYMENT && isset($sales_order['delivery_address']))
+ $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
+ }
+ $this->row = $iline2 - $this->lineHeight - 1;
+ $col = $this->leftMargin;
+ $this->TextWrap($col, $this->row, $width, $doc_Customers_Ref, 'C');
+ $col += $width;
+ $this->TextWrap($col, $this->row, $width, $doc_Our_Ref, 'C');
+ $col += $width;
+ $this->TextWrap($col, $this->row, $width, $doc_Your_VAT_no, 'C');
+ $col += $width;
+ if ($doctype == ST_SALESINVOICE)
+ $this->TextWrap($col, $this->row, $width, $doc_Delivery_no, 'C');
+ else
+ $this->TextWrap($col, $this->row, $width, $doc_Our_Order_No, 'C');
+ $col += $width;
+ $this->TextWrap($col, $this->row, $width, $doc_Due_Date, 'C');
+ $this->row = $iline3 - $this->lineHeight - 1;
+ $col = $this->leftMargin;
+ if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT)
+ $this->TextWrap($col, $this->row, $width, $this->formData['supp_account_no'], 'C');
+ elseif ($doctype == ST_WORKORDER)
+ $this->TextWrap($col, $this->row, $width, $this->formData['wo_ref'], 'C');
+ elseif (isset($this->formData["customer_ref"]))
+ $this->TextWrap($col, $this->row, $width, $this->formData["customer_ref"], 'C');
+ elseif (isset($this->formData["debtor_ref"]))
+ $this->TextWrap($col, $this->row, $width, $this->formData["debtor_ref"], 'C');
+ $col += $width;
+ if (isset($this->formData['salesman']))
+ {
+ $id = $this->formData['salesman'];
+ //$sql = "SELECT salesman_name FROM ".TB_PREF."salesman WHERE salesman_code='$id'";
+ //$result = db_query($sql,"could not get sales person");
+ //$row = db_fetch($result);
+ //$this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C');
+ $this->TextWrap($col, $this->row, $width, get_salesman_name($id), 'C');
+ }
+ elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
+ $this->TextWrap($col, $this->row, $width, $systypes_array[$this->formData["type"]], 'C');
+ elseif ($doctype == ST_WORKORDER)
+ $this->TextWrap($col, $this->row, $width, $wo_types_array[$this->formData["type"]], 'C');
+ $col += $width;
+ if ($doctype == ST_WORKORDER)
+ $this->TextWrap($col, $this->row, $width, $this->formData["StockItemName"], 'C');
+ elseif ($doctype != ST_PURCHORDER && isset($this->formData['tax_id']))
+ $this->TextWrap($col, $this->row, $width, $this->formData['tax_id'], 'C');
+ $col += $width;
+ if ($doctype == ST_SALESINVOICE)
+ {
+ $deliveries = get_sales_parent_numbers(ST_SALESINVOICE, $this->formData['trans_no']);
+ if ($print_invoice_no == 0)
+ {
+ foreach($deliveries as $n => $delivery) {
+ $deliveries[$n] = get_reference(ST_CUSTDELIVERY, $delivery);
+ }