<?php
$w = "90"; // first column width
$w3 = "90";
$db = $GLOBALS['db'];
$w2 = "20"; // second column width
if ($focus->type == 'normal') $text = 'Faktura nr';
if ($focus->type == 'correct') $text = 'FAKTURA KOREKTA nr';
$w = "35"; // first column width
$w3 = "35";
$w2 = "25"; // second column width


$content = '<p style="text-align: center;"><b>' . $text . ' ' . $focus->document_no . '</b></p>
<table style="width: 100%; font-size: 8pt;">
	<tr>
		<td style="width: ' . $w . '%">
			<b>' . $labels['LBL_PDF_CONTENT_INVOICE_FOR'] . '</b>
		</td>
		<td style="width: ' . $w3 . '%">';
if ($focus->parent_shipping_address_name != '') {
	$content .= '<b>DOSTAWA</b>';
}

$content .= '</td>
		<td style="width: ' . $w2 . '%">';
if ($focus->parent_payer_address_name != '') {
	$content .= '<b>PŁATNIK</b>';
}
$content .= '</td>
		<td style="text-align: right"></td>
	</tr>
	<tr>
		<td style="width: ' . $w . '%">
			' . $focus->parent_name . '
		</td>
		<td style="width: ' . $w3 . '%">
			' . $focus->parent_shipping_address_name . '
		</td>
		<td style="width: ' . $w2 . '%">' . $focus->parent_payer_address_name . '</td>
		<td style="text-align: right"></td>
	</tr>
	<tr>
		<td style="width: ' . $w . '%">
			' . $focus->parent_address_street . '
		</td>
		<td style="width: ' . $w3 . '%">
			' . $focus->parent_shipping_address_street . '
		</td>
		<td style="width: ' . $w2 . '%">
		' . $focus->parent_payer_address_street . '
        </td>
		<td style="text-align: right">
		</td>
	</tr>
	<tr>
		<td style="width: ' . $w . '%">
			' . $focus->parent_address_postalcode . ' ' . $focus->parent_address_city;
if (!is_null($focus->parent_address_country) & $focus->parent_address_country != '')
	$content .= ', ' . $focus->parent_address_country;
$content .= '
		</td>
		<td style="width: ' . $w3 . '%">
			' . $focus->parent_shipping_address_postalcode . ' ' . $focus->parent_shipping_address_city;
if (!is_null($focus->parent_shipping_address_country) & $focus->parent_shipping_address_country != '')
	$content .= ', ' . $focus->parent_shipping_address_country;
$content .= '
		</td>
		<td style="width: ' . $w2 . '%">
				' . $focus->parent_payer_address_postalcode . ' ' . $focus->parent_payer_address_city;
if (!is_null($focus->parent_payer_address_country) & $focus->parent_payer_address_country != '')
	$content .= ', ' . $focus->parent_payer_address_country;
$content .= '
		</td>
		<td style="text-align: right">
					
		</td>
	</tr>';
$content .= '
		<tr>
			<td valign="top" style="width: ' . $w . '%">';
if (!is_null($focus->parent_nip) && $focus->parent_nip) {
	$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_nip;
	$nip = true;
}
if (!is_null($focus->parent_iln) && $focus->parent_iln) {
	if ($nip) $content . '<br>';
	$nip = false;
	$content .= '<br>ILN: ' . $focus->parent_iln;
}
$content .= '
			</td>';
$content .= '
			<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_shipping_nip) && $focus->parent_shipping_nip) {
	$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_shipping_nip;
	$nip = true;
}
if (!is_null($focus->parent_shipping_iln) && $focus->parent_shipping_iln) {
	if ($nip) $content . '<br>';
	$nip = false;
	$content .= '<br>ILN: ' . $focus->parent_shipping_iln;
}
$content .= '
			</td>';
$content .= '
			<td valign="top" style="width: ' . $w3 . '%">';
if (!is_null($focus->parent_payer_nip) && $focus->parent_payer_nip) {
	$content .= $labels['LBL_PDF_CONTENT_NIP'] . ' ' . $focus->parent_payer_nip;
	$nip = true;
}
if (!is_null($focus->parent_payer_iln) && $focus->parent_payer_iln) {
	if ($nip) $content . '<br>';
	$nip = false;
	$content .= '<br>ILN: ' . $focus->parent_payer_iln;
}
$content .= '</td>
		<td colspan="0" valign="top" style="text-align: right">
					
		</td>
		</tr>';
$content .= '
</table>
';
if ($focus->name && $focus->name != '') {
	$content .= '
		<table style="width: 100%; text-align: center">
			<tr><td>
				<b>' . $focus->name . '</b>
			</td></tr>
		</table>
';
}

$content .= '<br><table width="100%" style="font-size: 7pt;text-align:left;vertical-align:top;">
		<tr><td width="28%">' . $labels['LBL_PDF_CONTENT_REGISTER_DATE'] . '</td><td width="25%"><b>' . $focus->register_date . '</b></td>
		        <td width="22%" style="text-align:right;">Miejsce wystawienia: </td><td style="text-align:right;" width="25%"><b>Obrowo</b></td></tr>
		        <tr><td width="29%">Data sprzedaży:</td><td width="25%"><b>' . $focus->sell_date . '</b>
		                <td width="21%" style="text-align:right;">Termin płatności:</td><td style="text-align:right;" width="25%"><b>' . $focus->payment_date . '</b></td></td></tr>';



$content .= '		<tr><td width="28%">' .		($focus->order_no != '' ? 'Numer zamówienia klienta:' : '') . '</td><td width="25%"><b>' . ($focus->order_no != '' ? $focus->order_no : '') . '</b></td>
		        <td width="22%" style="text-align:right;">Metoda płatności:</td><td style="text-align:right;" width="25%"><b>' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method] . '</b></td></tr>';


$content .= '		<tr><td width="28%">' .		($focus->supplier_code != '' ? 'Kod dostawcy:' : '') . '</td><td width="25%"><b>' . ($focus->supplier_code != '' ? $focus->supplier_code : '') . '</b></td>
		        <td width="22%" style="text-align:right;">' .		($focus->wz_name != '' || true ? 'Nr dokumentu WZ:' : '') . '</td><td style="text-align:right;" width="25%"><b>' .		($focus->wz_name != '' ? $focus->wz_name : '') . '</b></td></tr>';


if ($focus->ecminvoiceout_id != '') {
	$tmp = new EcmInvoiceOut();
	$tmp->retrieve($focus->ecminvoiceout_id);
	$a = '<b>' . $tmp->document_no . '</b> z dnia ' . date('d.m.Y', strtotime($tmp->register_date)) . '<br>';
	$content .= '		<tr><td width="28%">Korekta do Faktury nr:</td><td width="25%"><b>' . $a . '</b></td>
		        <td width="22%" style="text-align:right;"></td><td style="text-align:right;" width="25%"><b></b></td></tr>';
}

$content .= '</table><br>';
// start items table
$columns = array();

$columns['position'] = array(
	'field' => array(
		'position'
	),
	'label' => 'Lp.',
	'align' => 'center'
);
//$pk_avaiable = true;
if ($pk_avaiable) {
	$name_label = '
	<table style="width:100%">
		<tr>
			<td style="width:90%;text-align:left"><b>Nazwa</b></td>
			<td style="width:10%;"></td>
		</tr>
	<tr>
	<td style="width:90%;text-align:left"><b>Indeks</b></td>
	<td style="width:10%;text-align:right"><b>EAN</b></td>
	</tr>
	</table>';
} else {
	$name_label = 'Nazwa<br>Indeks';
}

$columns['name'] = array(
	'field' => array(
		'name',

	),
	'label' => $name_label,
	'align' => 'left'
);
if (!$pk_avaiable) {
	$columns['name']['field'][] = 'product_code';
}
/*
if($pk_avaiable==true){
	$columns ['pkwiu'] = array (
			'field' => array (
					'pkwiu',
			),
			'label' => 'PKWiU',
			'align' => 'left'
	);
} */
$columns['recipient_code'] = array(
	'field' => array(
		'recipient_code',
		'pkwiu'
	),
	'label' => 'Kod odbiorcy<br>PKWiU',
	'align' => 'right'
);
$columns['qty'] = array(
	'field' => array(
		'quantity',
		'unit_name'
	),
	'label' => 'Ilość<br>J.m.',
	'align' => 'right'
);

if ($discount_avaiable) {
	$columns['price_start'] = array(
		'field' => array(
			'price_start',
			'discount'
		),
		'label' => 'Cena pocz<br>Upust',
		'align' => 'right'
	);
}
/*

*/

$columns['price_netto'] = array(
	'field' => array(
		'price_netto'
	),
	'label' => 'Cena netto',
	'align' => 'right'
);

$columns['total_netto'] = array(
	'field' => array(
		'total_netto'
	),
	'label' => 'Wartość<br>netto',
	'align' => 'right'
);
$columns['ecmvat_name'] = array(
	'field' => array(
		'ecmvat_name'
	),
	'label' => 'VAT<br>(%)',
	'align' => 'center'
);
$columns['total_vat'] = array(
	'field' => array(
		'total_vat'
	),
	'label' => 'Wartość<br>VAT',
	'align' => 'right'
);

$columns['total_brutto'] = array(
	'field' => array(
		'total_brutto'
	),
	'label' => 'Wartość<br>brutto',
	'align' => 'right'
);

// set widths
$totals = array();

$columns['position']['width'] = '3';
$columns['name']['width'] = '31';
$columns['recipient_code']['width'] = '10';
/*
if($pk_avaiable==true){
	$columns ['pkwiu'] ['width'] = '10';
} */
$columns['qty']['width'] = '7';

if ($discount_avaiable == true) {
	$columns['price_start']['width'] = '10';
}
//$columns ['unit_name'] ['width'] = '7';
$columns['price_netto']['width'] = '10';
$columns['total_netto']['width'] = '10';
$columns['ecmvat_name']['width'] = '4';
$columns['total_vat']['width'] = '10';
$columns['total_brutto']['width'] = '10';

// rysujemy :)
$content .= '
	<table style="width: 100%; font-size: 7pt; border: 0.5 solid black; border-collapse: collapse;"><thead>
		<tr>
';

foreach ($columns as $col) {
	$content .= '
		<th style="border: 0.5 solid black; width: ' . $col['width'] . '%;background-color: #E9E9E9;">' . $col['label'] . '</th>		
	';
}
$content .= '
	</tr></thead><tbody>
';
$counter = 1;
if ($focus->type == 'normal') {
	foreach ($positions as $pos) {
		$content .= '<tr>';
		foreach ($columns as $col) {
			$content .= '<td style="border: 0.5 solid black; text-align: ' . $col['align'] . ';">';
			foreach ($col['field'] as $f) {
				if ($pk_avaiable && $f == 'product_code') {
					continue;
				}

				if ($f == 'name' && $pk_avaiable) {
					$pr = new EcmProduct();
					$pr->retrieve($pos['ecmproduct_id']);
					//$pos[$f] = $pr->pkwiu;


					$content .= '
					<table>
						<tr>
							<td style="width:90%;text-align:left" colspan="2">' . $pos['name'] . '</td>
						</tr>
						<tr>
							<td style="width:90%;text-align:left">' . $pos['product_code'] . '</td>
							<td style="width:10%;text-align:right">' . $pr->ean . '</td>
						</tr>
					</table>';
					continue;
				} else if ($f == 'recipient_code') {
					$pr = new EcmProduct();
					$pr->retrieve($pos['ecmproduct_id']);
					$content .= $pos[$f] . '<br>' . $pr->pkwiu . '<br>';
				} else {
					$content .= $pos[$f] . '<br>';
				}
				/*	if ($f == 'pkwiu'){ 
					
				
				
				} else
					if (! $pos [$f] || $pos [$f] == '')
						$pos [$f] = '-'; */
			}
			$content .= '</td>';
		}
		$content .= '</tr>';
	}
} else {
	foreach ($positions as $pos) {
		$content .= '<tr>';

		foreach ($columns as $col) {

			$content .= '<td style="border: 0.5 solid black; text-align: ' . $col['align'] . ';">';
			foreach ($col['field'] as $f) {

				if ($pk_avaiable && $f == 'product_code') {
					continue;
				}

				if ($f == 'name' && $pk_avaiable) {
					$pr = new EcmProduct();
					$pr->retrieve($pos['ecmproduct_id']);
					//$pos[$f] = $pr->pkwiu;


					$content .= '
					<table>
						<tr>
							<td style="width:90%;text-align:left">' . $pos['name'] . '</td>
							<td style="width:10%;"></td>
						</tr>
						<tr>
							<td style="width:90%;text-align:left">' . $pos['product_code'] . '</td>
							<td style="width:10%;text-align:right">' . $pr->ean . '</td>
						</tr>
					</table>';
					continue;
				} else if ($f == 'recipient_code') {
					$pr = new EcmProduct();
					$pr->retrieve($pos['ecmproduct_id']);
					$content .= $pos[$f] . '<br>' . $pr->pkwiu . '<br>';
				} else {
					$content .= $pos[$f] . '<br>';
				}
			}
			$content .= '</td>';
		}
		$content .= '</tr><tr>';
		// old correct item
		$pos['name'] = 'było';
		$pos['total_netto'] = format_number($pos['old_total_netto']);
		$pos['total_brutto'] = format_number($pos['old_total_brutto']);
		$pos['total_vat'] = format_number($pos['old_total_vat']);
		$pos['price_netto'] = format_number($pos['old_price_netto']);
		$pos['quantity'] = $pos['old_quantity'];

		$pos['position'] = '';
		$pos['product_code'] = ' ';

		foreach ($columns as $col) {

			$content .= '<td style="border: 0.5 solid black; text-align: ' . $col['align'] . ';">';
			foreach ($col['field'] as $f) {

				if (!$pos[$f] || $pos[$f] == '')
					$pos[$f] = '-';
				$content .= $pos[$f] . '<br>';
			}
			$content .= '</td>';
		}
		$content .= '</tr>';
	}
}
$content .= '
	</tbody></table>
';
// summary table
// get currency symbol
$c = new Currency();
$c->retrieve($focus->currency_id);
$symbol = $c->symbol;
unset($c);
$content .= '
	<br>
	<table style="font-size: 9pt; border: 0.5 solid black; border-collapse: collapse; width: 300px; margin-left: 60%">
';

$content .= '
		<tr>
			<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
				<b>VAT (%)</b>
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
				<b>Wartość netto</b>
			</td>   
        <td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: center;">
				<b>Wartość VAT</b>
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: center;">
				<b>Wartość brutto</b>
			</td>';

$content .= '</tr>
		';
$vats = explode(",", $focus->vats_summary);
foreach ($vats as $v) {
	if ($v == '') continue;
	$v2 = explode(":", $v);

	$content .= '
		<tr>
			<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
				' . $v2[0] . '
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
			' . format_number($v2[1]) . '
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
				' . format_number($v2[2]) . '
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
				' . format_number($v2[3]) . '
			</td></tr>';
}

$total_paid_vat = 0;
$total_paid_netto = 0;
if ($focus->prepaid > 0) {

	$vat_value = substr($k, 0, -1) + '';
	if (strlen($vat_value) == 1) $vat_value = '0' . $vat_value;
	$paid_netto = round($focus->prepaid / 1.23, 2);
	$paid_vat = $focus->prepaid - $paid_netto;
	$total_paid_netto += $paid_netto;
	$total_paid_vat += $paid_vat;
	$content .= '
		<tr>
			<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
				23%
			</td>
		<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
			-' . format_number($paid_netto) . '
			</td>
		<td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
				-' . format_number($paid_vat) . '
			</td>
		<td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
				-' . format_number($focus->prepaid) . '
			</td></tr>';
}


if ($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20') {
	$content .= '
		<tr>
			<td style="font-size: 7pt; border: 0.5 solid black; width: 23%;text-align: center;">
				' . $v2[0] . '
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
			-' . format_number($v2[1]) . '
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 25%;text-align: right;">
				-' . format_number($v2[2]) . '
			</td>
        <td style="font-size: 7pt; border: 0.5 solid black; width: 27%;text-align: right;">
				-' . format_number($v2[3]) . '
			</td></tr>';
}
// totals
$content .= '
		<tr>
			<td style="font-size: 6.5pt; border: 0.5 solid black; width: 23%;text-align: center;background-color: #E9E9E9;">
				<b>Razem</b>
			</td>
        <td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
				<b>' . format_number($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_netto - $total_paid_netto) . '</b>
			</td>
        <td style="font-size: 6.5pt; border: 0.5 solid black; width: 25%;text-align: right;background-color: #E9E9E9;">
			<b>' . format_number($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_vat - $total_paid_vat) . '</b>
			</td>
        <td style="font-size: 6.5pt; border: 0.5 solid black; width: 27%;text-align: right;background-color: #E9E9E9;">
				<b>' . format_number($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20' ? 0 : $focus->total_brutto - $focus->prepaid) . '</b>
			</td></tr>';
$left_to_paid = $focus->total_brutto - $focus->paid_val - $focus->prepaid;
$content .= '
</table>
<table style="font-size: 7pt;">
';
if ($focus->prepaid > 0) {
	$content .= '<tr><td>FV Przedpłatowa</td><td style="text-align: right;"><b>' . $focus->prepaid_nr . '</b></td></tr>';
}
if ($focus->total_brutto > 0) {
	$content .= '
		<tr><td>' . $labels['LBL_PDF_TO_PAY'] . '</td><td style="text-align: right;"><b>' . format_number($focus->total_brutto) . ' ' . $symbol . '</b></td><td></td></tr>';
} else {
	$content .= '
		<tr><td>' . $labels['LBL_PDF_PAID_RETURN'] . '</td><td style="text-align: right;"><b>' . format_number(abs($focus->total_brutto)) . ' ' . $symbol . '</b></td><td></td></tr>';
}
if ($focus->id == 'c2d7473a-c0b8-6718-0947-54993423de20') {
	$left_to_paid = '0';
	$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>8.610,00 ' . $symbol . '</b> </td><td>Nr FK 001/14</td></tr>';
}
if ($focus->prepaid > 0) {
	$content .= '<tr><td>Przedpłata</td><td style="text-align: right;"><b>' . format_number($focus->prepaid) . ' ' . $symbol . '</b></td></tr>';
}


if ($focus->paid_val != '' && $focus->id != 'c2d7473a-c0b8-6718-0947-54993423de20') {
	if ($focus->paid_val != 0) $pay_text = $GLOBALS['app_list_strings']['ecmpaymentconditions_payment_method_dom'][$focus->payment_method_paid];
	if ($focus->type == 'normal') {
		$content .= '<tr><td>' . $labels['LBL_PDF_PAID'] . '</td><td style="text-align: right;"><b>' . format_number(abs($focus->paid_val)) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . $pay_text . '</td></tr>';
	} else {
		$content .= '<tr><td>Zwrócono:</td><td style="text-align: right;"><b>' . format_number(abs($focus->paid_val)) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . $pay_text . '</td></tr>';
	}
}

if ($focus->ecmpaymentcondition_id != '') {

	$q = $db->query("select name from ecmpaymentconditions where id='$focus->ecmpaymentcondition_id'");
	$r = $db->fetchByAssoc($q);
	$paid_text = 'w Terminie <b>' . $r['name'] . '</b> do <b>' . date('d.m.Y', strtotime($focus->payment_date)) . '</b> ' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
} else {
	if ($focus->payment_date != '') {

		$dni = (strtotime($focus->payment_date) - strtotime($focus->register_date)) / (3600 * 24);
		$paid_text = 'w Terminie <b>' . round($dni) . ' dni</b> do <b>' . date('d.m.Y', strtotime($focus->payment_date)) . '</b> ' . $GLOBALS['app_list_strings']['payment_method_dom'][$focus->payment_method];
	}
}

if ($_REQUEST['pdf_type'] == '1')
	$focus->pdf_text .= PHP_EOL . "<br>Duplikat wystawiony dnia: " . ($focus->id == '2f55c9e1-1b0d-3856-2552-57f34edef340' ? date('30.09.Y') : date('d.m.Y'));

if (abs($left_to_paid) >= 0) $content .= '<tr><td>' . $labels['LBL_PDF_LEFT_TO_PAID'] . '</td><td style="text-align: right;"><b>' . format_number(abs($left_to_paid)) . ' ' . $symbol . '</b></td><td style="text-align:left;">' . (round(abs($left_to_paid)) == 0 ? "" : $paid_text) . '</td></tr>
	';
if ($focus->pdf_type != "K") {
	$z = $db->query("select * from currency_nbp_archive where nbp_table_name='" . $focus->currency_table . "'");
	$dddd = $db->fetchByAssoc($z);
	$content .= '<tr><td>Kurs: </td><td colspan="2"><b>' . $focus->currency_value_nbp . '</b> z dnia <b>' . date("d.m.Y", strtotime($dddd['date'])) . '</b> wg tabeli kursu NBP <b>' . $focus->currency_table . '</b></td></tr>
	';
}
$z = $focus->db->query("select value2 from operating_values where value0='bankAccount' and value9='" . $focus->bankaccount . "'");
$dan2 = $focus->db->fetchByAssoc($z);

$accc = new Account();
$accc->retrieve($focus->parent_id);

if ($accc->parent_id == 1249) {
	$content .= '<tr><td>Konto bankowe nr:</td><td  colspan="2" style="text-align:right"><b>ING Bank Śląski S.A. PL49 1050 1025 1000 0090 3129 6339</b></td></tr>';
} else {
	if ($focus->bankaccount != "" && $focus->payment_method == 'PRZELEW') {
		$content .= '<tr><td>Konto bankowe nr:</td><td  colspan="2" style="text-align:right"><b>' . ($dan2['value2'] != "" ? $dan2['value2'] . " " : "") . $focus->bankaccount . '</b></td></tr>';
	}
}


$u = new User();

$u->retrieve($focus->assigned_user_id);
if ($focus->type == 'normal') {
	$content .= '<tr><td>' . $labels['LBL_PDF_CONTENT_ISSUED_BY'] . '</td><td><b>' . $u->first_name . ' ' . $u->last_name . '</b></td></tr>';
}



$content .= '</table>';

if ($focus->pdf_text != '' && $focus->type == 'correct') {
	$content .=	'<table style="font-size: 12pt;vertical-align: top;">';
	$content .= "<tr><td>Tytułem:</td><td>" . $focus->pdf_text . "</td></tr>";
	$content .= '</table>';
} else {
	if ($focus->pdf_text != '') {
		$content .=	'<table style="font-size: 8pt;">';
		$content .= "<tr><td>" . $focus->pdf_text . "</td></tr>";
		$content .= '</table>';
	}
}



if ($focus->type == 'correct') {
	$content .= '<br>
	<table style="width:100%;font-size: 7pt;">
		<tr>
			<td style="text-align:center;"><b>' . $focus->assigned_user_name . '</b></td>
			<td style="text-align:center;"></td>
			<td style="text-align:center;"></td>
			<td style="text-align:center;"></td>
			<td style="text-align:center;"></td>
		</tr>
		<tr>
			<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do wystawienia faktury</td>
			<td style="width:10%;text-align:center"></td>
			<td style="width:20%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Data odbioru</td>
			<td style="width:10%;text-align:center"></td>
			<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do obioru faktury</td>
		</tr>
	</table>';
} else {
	$EcmSysInfo = new EcmSysInfo();
	if ($EcmSysInfo->getDatabaseName() == 'preDb_5d9477918f845c6fdc25532d415f9e73') {
		$content .= '<br>
	<table style="width:100%;font-size: 7pt;">
		<tr>
			<td style="text-align:center;"><b>' . $focus->assigned_user_name . '</b></td>
			<td style="text-align:center;"></td>
			<td style="text-align:center;"></td>
			<td style="text-align:center;"></td>
			<td style="text-align:center;"></td>
		</tr>
		<tr>
			<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do wystawienia faktury</td>
			<td style="width:10%;text-align:center"></td>
			<td style="width:20%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Data odbioru</td>
			<td style="width:10%;text-align:center"></td>
			<td style="width:27%;text-align:center;border-top: 1px solid #c2c2c2;font-size:10">Podpis osoby uprawnionej do obioru faktury</td>
		</tr>
	</table>';
	}
}

//echo $content; die();