Merged changes from main trunk up to 2.2.5
[fa-stable.git] / reporting / includes / header2.inc
index e09df98175a81322dbdbe858a358e2f46e58e687..5602afee84f50a5241098612de8567b4dee1474d 100644 (file)
                        $this->Text($c2col, $this->company['gst_no'], $mcol);
                        $this->NewLine();
                }
-               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['domicile'] != "")
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['domicile'] != "")
                {
                        $this->Text($ccol, $doc_Domicile, $c2col);
                        $this->Text($c2col, $this->company['domicile'], $mcol);
                        $this->row = $temp;
                        if ($doctype == ST_PURCHORDER)
                                $this->Text($mcol, $this->company['coy_name']);
-                       elseif ($doctype != ST_SUPPAYMENT)
+                       elseif ($doctype != ST_SUPPAYMENT && isset($sales_order['deliver_to']))
                                $this->Text($mcol, $sales_order['deliver_to']);
                        $this->NewLine();
-                       if ($doctype != ST_SUPPAYMENT)
+                       if ($doctype != ST_SUPPAYMENT && isset($sales_order['deliver_to']))
                                $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
                }
                $this->row = $iline2 - $this->lineHeight - 1;
                        $this->TextWrap($col, $this->row, $width, $myrow['wo_ref'], 'C');
                elseif (isset($sales_order["customer_ref"]))
                        $this->TextWrap($col, $this->row, $width, $sales_order["customer_ref"], 'C');
+               elseif (isset($myrow["debtor_ref"]))
+                       $this->TextWrap($col, $this->row, $width, $myrow["debtor_ref"], 'C');
                $col += $width; 
                if ($branch != null)
                {
                        //$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)
+               elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
                        $this->TextWrap($col, $this->row, $width, $systypes_array[$myrow["type"]], 'C');
                elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C');
                }
                elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow["location_name"], 'C');
-               elseif (isset($myrow['order_']))
+               elseif (isset($myrow['order_']) && $myrow['order_'] != 0)
                        $this->TextWrap($col, $this->row, $width, $myrow['order_'], 'C');
                $col += $width; 
                if ($doctype == ST_SALESORDER || $doctype == ST_SALESQUOTE)
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['delivery_date']), 'C');
                elseif ($doctype == ST_WORKORDER)       
                        $this->TextWrap($col, $this->row, $width, $myrow["units_issued"], 'C');
-               elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && isset($myrow['due_date']))
+               elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && $doctype != ST_CUSTPAYMENT &&
+                       $doctype != ST_SUPPAYMENT && isset($myrow['due_date']))
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['due_date']), 'C');
                if (!isset($packing_slip) || $packing_slip == 0)
                {
                                $this->row -= $this->lineHeight;
                        }
                }
+               if ($doc_Extra != "")
+               {
+                       $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Extra, 'C');
+                       $this->row -= $this->lineHeight;
+               }
                if ($this->params['comments'] != '')
                {
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C');
                        $this->row -= $this->lineHeight;
                }
-               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['legal_text'] != "") 
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['legal_text'] != "") 
                {
                        $this->TextWrapLines($ccol, $right - $ccol, $this->company['legal_text'], 'C');
                }