<?php

        $companyCol = $this->endLine - 170;
        $titleCol = $this->leftMargin + 100;

        $start_row = $this->row = $this->pageHeight - $this->topMargin;

        $this->SetDrawColor(128, 128, 128);
        $this->Line($this->row + 5, 1);

        $this->NewLine();
        		
        $logo = company_path() . "/images/" . $this->company['coy_logo'];
	if ($this->company['coy_logo'] != '' && file_exists($logo))
	{
            $this->AddImage($logo, 345, $this->row - 30, 0, 43);
	}

        $this->fontSize += 4;
        $this->Font('bold');
        $this->Text($this->leftMargin, $this->title, $companyCol);
        $this->Text($companyCol, $this->company['coy_name']);
        $this->Font();
        $this->fontSize -= 4;
        $this->NewLine();
        
        $contact_nos = '';
        if (@$this->company['phone'])
        {
            $contact_nos = "(Phone) ".$this->company['phone'];       
        }

        if (@$this->company['fax'])
        {
            $contact_nos .= ", (Fax) ".$this->company['fax'];
        }
        $this->Text($companyCol, $contact_nos);
        $this->NewLine();
        
        $contact_info = '';
        if (@$this->company['email'])
        {
            $contact_info = $this->company['email'].", ";
        }

        $contact_info .= "www.ukengineering.lk";

        $this->Text($companyCol, $contact_info);
        $this->NewLine();
        $this->Line($this->row, 1);
        
        
//        $this->NewLine(2);
//        $this->Text($this->leftMargin + 315, $this->user.'   '.Today() . '   ' . Now());
//        
//        $str = _("Page") . ' ' . $this->pageNumber;
//        $this->Text($this->endLine - 38, $str);
        
        $this->NewLine();
        $this->AliasNbPages();
        $this->Text(500, 'Page:'.$this->pageNumber.' of '.$this->getAliasNbPages());
        
        $content_start_line = $this->row;
        
        if($this->pageNumber == 1){
            $this->row = $start_row - ($this->lineHeight);

            $this->NewLine(5);
            $this->Text($this->leftMargin,Today().".");
            $this->NewLine(2);
            $this->Text($this->leftMargin,"The Manager,");
            $this->NewLine();
    //        $this->Text($this->leftMargin,$this->params['sp_bank_name']);
    //        $this->NewLine();
            //$this->Text($this->leftMargin,$this->params['sp_bank_address']);
            $this->TextWrapLines($this->rightMargin+10, $this->rightMargin + 200, $this->params['sp_bank_address']);
            $this->NewLine(2);

            $this->Text($this->leftMargin,"Dear Sir/Madam,");
            $this->NewLine();

            $this->Font('bold');
            $letter_heading = "Salary Payments - A/C Number ".$this->params['sp_bank_account_no'];
            $this->Text($this->leftMargin + 150,$letter_heading);
            $this->Font();
            $this->NewLine(2);

            $letter_text = "I shall be thankful if you could kindly remit the following payments & debit the above account.";
            $this->Text($this->leftMargin,$letter_text);
            $this->NewLine();
        }
        else{   
            //$this->row = 738;
            $this->NewLine();
        }
//        if($this->row > 638)
//            $this->row = 638;
        
        
        $this->Line($this->row - 5, 1);

        $this->row -= ($this->lineHeight + 6);
        $this->Font('italic');
        if ($this->headers2 != null)
        {
                $count = count($this->headers2);
                for ($i = 0; $i < $count; $i++)
                        $this->TextCol2($i, $i + 1,	$this->headers2[$i]);
                $this->NewLine();
        }
        $count = count($this->headers);
        for ($i = 0; $i < $count; $i++){
                $this->TextCol($i, $i + 1, $this->headers[$i]);
        }
        $this->Font();
        $this->Line($this->row - 5, 1);

        $this->NewLine();
        if($this->pageNumber > 1){
            $this->NewLine();
        }
	
	
?>
