- if (isset($myrow['order_']))
- $this->TextWrap($col, $this->row, $width, $myrow['order_'], 'C');
- $col += $width;
- $id = $myrow['payment_terms'];
- $sql = "SELECT terms FROM ".TB_PREF."payment_terms WHERE terms_indicator='$id'";
- $result = db_query($sql,"could not get paymentterms");
- $row = db_fetch($result);
- $this->TextWrap($col, $this->row, $width, $row["terms"], 'C');
+ if ($doctype == ST_SALESINVOICE)
+ {
+ $deliveries = get_parent_trans(ST_SALESINVOICE, $this->formData['trans_no']);
+ $line = "";
+ foreach ($deliveries as $delivery)
+ {
+ if ($print_invoice_no == 0)
+ {
+ $ref = get_reference(ST_CUSTDELIVERY, $delivery);
+ if ($ref)
+ $delivery = $ref;
+ }
+ if ($line == "")
+ $line .= "$delivery";
+ else
+ $line .= ",$delivery";
+ }
+ $this->TextWrap($col, $this->row, $width, $line, 'C');
+ }
+ elseif ($doctype == ST_CUSTDELIVERY)
+ {
+ $ref = $this->formData['order_'];
+ if ($print_invoice_no == 0)
+ {
+ $ref = get_reference(ST_SALESORDER, $this->formData['order_']);
+ if (!$ref)
+ $ref = $this->formData['order_'];
+ }
+ $this->TextWrap($col, $this->row, $width, $ref, 'C');
+ }
+ elseif ($doctype == ST_WORKORDER)
+ $this->TextWrap($col, $this->row, $width, $this->formData["location_name"], 'C');
+ elseif (isset($this->formData['order_']) && $this->formData['order_'] != 0)
+ $this->TextWrap($col, $this->row, $width, $this->formData['order_'], 'C');