<?php

$pdf->SetAutoPageBreak(true, 50);

//$pdf->AddFont('arialgr', '', 'arialgr.php');
//$pdf->SetFont('arialgr','','8');
//$pdf->MultiCell(0,4,"TEST",0,'J');
$lv = return_app_list_strings_language($this->ecmlanguage);

//check delivery address
$q = "
	select
		shipping_address_street,
		shipping_address_city,
		shipping_address_postalcode,
		shipping_address_state,
		shipping_address_country
	from accounts where
		(shipping_address_street!=billing_address_street OR
		shipping_address_city!=billing_address_city OR
		shipping_address_postalcode!=billing_address_postalcode OR
		shipping_address_state!=billing_address_state OR
		shipping_address_country!=billing_address_country) AND
		id='" . $this->parent_id . "';
	";

$res = $GLOBALS['db']->query($q);
if ($res->num_rows > 0) {
    $r = $GLOBALS['db']->fetchByAssoc($res);
    $table = array();

    $table [0][] = array('width' => 30,
        'value' => $mod_strings['LBL_PDF_SHIP_TO'],
        'border' => 0,
        'overflow' => 1,
        'align' => 'L',
        'font-style' => 'b',
        'font-size' => 9,
    );

    $tmp= html_entity_decode($r['shipping_address_street']) . ', ' . html_entity_decode($r['shipping_address_postalcode']) . ' ' . html_entity_decode($r['shipping_address_city']);

    $table [0][] = array(
        'width' => 100,
        'value' => $tmp,
        'border' => 0,
        'overflow' => 1,
        'align' => 'L',
        'font-style' => '',
        'font-size' => 9,
    );
    
    $pdf->Ln(1);
    $pdf->DrawTable($table, null, 0, 0, 3);
}

if ($this->footer_text != '') {
    //footer text
    $pdf->Ln(8);
    $pdf->SetFont('arialpl', '', '8');
    $pdf->MultiCell(0, 4, $this->footer_text, 0, 'J');
}

//payment conditions
$pdf->SetFont('arialpl', 'B', '8');

if ($this->ads_text != '') {
    //ads text
    $pdf->Ln(8);
    $pdf->SetFont('arialpl', '', '8');
    $pdf->MultiCell(0, 4, $this->ads_text, 0, 'J');
}