This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,343 @@
<?php
$pdf->WriteHtml('</table>');
$pdf->SetAutoPageBreak(true, 20);
//$pdf->AddFont('arialgr', '', 'arialgr.php');
//$pdf->SetFont('arialgr','','8');
//$pdf->MultiCell(0,4,"TEST",0,'J');
$lv = return_app_list_strings_language($this->ecmlanguage);
//echo $this->invoice_type . ' - ' . $this->currency_symbol;
//exit;
//if ($this->currency_symbol != 'EUR') {
$c = new Currency();
$c->retrieve('6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf');
if ($this->invoice_type == 'K') {
if($this->currency_symbol != 'EUR') {
$pdf->SetFont('arialpl', '', 8);
$pdf->setX(11);
$pdf->WriteHtml(sprintf('Podana wartość zamówienia wg aktualnego kursu sprzedaży walut w banku Citi Handlowym: 1 EUR = %s %s.', format_number($c->conversion_rate, 4, 4), $this->currency_symbol));
$pdf->Ln(4);
$pdf->setX(11);
$pdf->WriteHtml('Ceny zostaną przeliczone wg odpowiedniego kursu obowiązującego w chwili wystawienia faktury.');
$pdf->Ln(4);
} else {
$pdf->SetFont('arialpl', '', 8);
$pdf->setX(11);
$pdf->WriteHtml('Faktura zostanie wystawiona w walucie EURO i płatność nastąpi w walucie EURO.');
$pdf->Ln(4);
}
}
if ($this->payment_method && $this->payment_method != 'INNY') {
$table = array();
$pm = $lv['payment_method_dom'][$this->payment_method];
if ($this->payment_deadline && $this->payment_deadline != '')
$pm.=', ' . $this->payment_deadline . ' dni';
$table [0][] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_PAYMENT'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table [0][] = array(
'width' => 70,
'value' => $pm,
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => '',
'font-size' => 9,
);
$pdf->Ln(5);
$pdf->DrawTable($table, null, 0, 0, 3);
} elseif ($this->payment_description != '' && $this->payment_method == '') {
$table = array();
$table [0][] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_PAYMENT'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table [0][] = array(
'width' => 70,
'value' => $this->payment_description,
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => '',
'font-size' => 9,
);
$pdf->Ln(5);
$pdf->DrawTable($table, null, 0, 0, 3);
}
if ($this->realization_description && $this->realization_description != '') {
$table = array();
$table [0][] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_REALIZATION'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [0][] = array('width' => 70, 'value' => $this->realization_description, 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => '', 'font-size' => 9);
$pdf->Ln(1);
$pdf->DrawTable($table, null, 0, 0, 3);
}
if ($this->delivery_description && $this->delivery_description != '') {
$table = array();
$table [0][] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_DELIVERY'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [0][] = array('width' => 70, 'value' => $this->delivery_description, 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => '', 'font-size' => 9);
$pdf->Ln(1);
$pdf->DrawTable($table, null, 0, 0, 3);
}
//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 (mysql_num_rows($res) > 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);
$table [0][] = array('width' => 100, 'value' => html_entity_decode($r['shipping_address_street']) . ', ' . html_entity_decode($r['shipping_address_postalcode']) . ' ' . html_entity_decode($r['shipping_address_city']), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => '', 'font-size' => 9);
$pdf->Ln(1);
$pdf->DrawTable($table, null, 0, 0, 3);
}
//echo '<pre>'. var_export($this->currency_symbol, true); exit;
/*
$pdf->SetX(10);
$pdf->SetFont('arialpl', 'b', 8);
$pdf->Cell(25, 4, 'Metoda płatności: ', 0, 0, 'L', 1);
global $app_list_strings;
$pdf->SetFont('arialpl', '', 8);
//echo '<pre>' . var_export($this->payment_method, true);
//echo '<pre>' . var_export($app_list_strings['payment_method_dom'], true);exit;
if($this->payment_method != '' && $this->payment_method != 'INNY') {
$pdf->Cell(50, 4, $app_list_strings['payment_method_dom'][$this->payment_method] . ($this->payment_deadline ? (', ' . $this->payment_deadline . ' dni') : '') , 0, 0, 'L', 1);
} else {
$pdf->Cell(50, 4, $this->payment_description, 0, 0, 'L', 1);
}
$pdf->Ln(4);
*/
if ($this->footer_text != '') {
//footer text
$pdf->Ln(4);
$pdf->SetFont('arialpl', '', '8');
$pdf->MultiCell(0, 4, $this->footer_text, 0, 'J');
}
//payment conditions
$pdf->SetFont('arialpl', 'B', '8');
/*
// if($this->payment_method)$pm.=$mod_strings['LBL_PDF_PAYMENT_METHOD'].$GLOBALS['app_list_strings']['payment_method_dom'][$this->payment_method]." ";
// if($this->payment_deadline)$pm.=$mod_strings['LBL_PDF_PAYMENT_DEADLINE'].$this->payment_deadline.$mod_strings['LBL_PDF_PAYMENT_DEADLINE2']." ";
$pm.="\n";
// if($this->payment_description)$pm.=$mod_strings['LBL_PDF_PAYMENT_DESCRIPTION'].$this->payment_description." ";
if($pm){
$pdf->Ln();
$pdf->MultiCell(0,4,$pm,0,'L');
}
if($this->validtill_date){
$pdf->Ln();
$pdf->MultiCell(0,4,$mod_strings['LBL_PDF_VALIDTILL_DATE'].": ".$this->validtill_date,0,'L');
}
*/
if ($this->ads_text != '') {
//ads text
$pdf->Ln(4);
$pdf->SetFont('arialpl', '', '8');
$pdf->MultiCell(0, 4, $this->ads_text, 0, 'J');
}
/*
if($this->show_primary_params){
$pdf->AddPage();
$pdf->SetFont('arialpl','B','14');
$pdf->MultiCell(0,8,$mod_strings['LBL_PDF_PARAMS_HEADER'],0,'J');
$pdf->Ln(6);
$tab_header = array(
'name' => array(
'width' => 44,
'value' => $mod_strings['LBL_PDF_PARAMS_HEADER_NAME'],
'background' => array(233,233,233),
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-size' => 7,
'font-style' => 'b'
),
'symbol' => array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_PARAMS_HEADER_SYMBOL'],
'background' => array(233,233,233),
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-size' => 7,
'font-style' => 'b'
),
'value' => array(
'width' => 12,
'value' => $mod_strings['LBL_PDF_PARAMS_HEADER_VALUE'],
'background' => array(233,233,233),
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-size' => 7,
'font-style' => 'b'
),
'unit' => array(
'width' => 12,
'value' => $mod_strings['LBL_PDF_PARAMS_HEADER_UNIT'],
'background' => array(233,233,233),
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-size' => 7,
'font-style' => 'b'
),
);
$i=0;
foreach($this->position_list as $p) {
$i++;
$pdf->SetFont('arialpl','B','11');
$lv=return_app_list_strings_language($this->ecmlanguage);
$tablen = array();
$tablen [0]['position'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_POSITION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
$tablen [0]['description'] = array('width' => 95, 'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
$tablen [1]['position'] = array('width' => 5, 'value' => $i, 'border' => 0, 'align' => 'C' );
$tablen [1]['description'] = array('width' => 95, 'value' => htmlspecialchars_decode($p['name']), 'border' => 0, 'align' => 'L' );
//$pdf->SetFont('arialpl','B','9');
$pdf->SetFont('arialgr','','8');
//$pdf->Ln();
$table = array();
$table_advanced = array();
$table[]=$tab_header;
$table_advanced[]=$tab_header;
$w_p=$GLOBALS['db']->query("select * from ecmquoteitemsparams where ecmquote_id='".$this->id."' and item_id='".$p['iid']."' and deleted='0' order by position asc");
$pom=0;
while($r_p=$GLOBALS['db']->fetchByAssoc($w_p)){
$pom=1;
$tab_item=array(
'name' => array(
'width' => 44,
'value' => $r_p['name'],
'background' => array(255,255,255),
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-size' => 7,
'font-style' => ''
),
'symbol' => array(
'width' => 30,
'value' => $r_p['symbol'],
'background' => array(255,255,255),
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-size' => 7,
'font-style' => ''
),
'value' => array(
'width' => 12,
'value' => $r_p['value'],
'background' => array(255,255,255),
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-size' => 7,
'font-style' => ''
),
'unit' => array(
'width' => 12,
'value' => $r_p['unit'],
'background' => array(255,255,255),
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-size' => 7,
'font-style' => ''
),
);
if ($r_p['value']!='') {
if($r_p['type']=="P" || $r_p['type']==""){
$table[]=$tab_item;
$table_advanced[]=$tab_item;
}
else $table_advanced[]=$tab_item;
}
}
if($pom){
$pdf->DrawTable($tablen);
if(!$this->show_advanced_params)$pdf->DrawTable($table);
if($this->show_advanced_params){
$pdf->SetFont('arialpl','B','9');
$pdf->DrawTable($table_advanced);
}
$pdf->Ln(10);
}
}
}
*/

View File

@@ -0,0 +1,670 @@
<?php
global $db;
$mod_strings['LBL_PDF_FOOTER_DOCUMENT_NAME'] = 'Potwierdzenie zamówienia';
$pdf->focus = $this;
$pdf->Ln(2);
$pdf->SetY($pdf->GetY() + 2);
$current = $pdf->GetY();
$pdf->SetFont('arialpl', '', 9);
//$p_name = html_entity_decode($this->parent_name);
//$p_name = explode(' ', $p_name);
//
//$name = array();
//
//if (sizeof($p_name) > 4) {
// for ($i = 0; $i < sizeof($p_name); $i++) {
// $n.=$p_name[$i] . ' ';
// //$pdf->Cell(40,5, $n,0,1,'L');
// if (($i % 5 == 0) && ($i != 0)) {
// $name[] = $n;
// $n = '';
// }
// }
// $name[] = $n;
//}
//
//if ($this->parent_name) {
// if (sizeof($p_name) > 4)
// foreach ($name as $n)
// $pdf->Cell(40, 5, $n, 0, 1, 'L');
// else
// $pdf->Cell(40, 5, html_entity_decode($this->parent_name), 0, 1, 'L');
//}
$pdf->MultiCell(100, 5, html_entity_decode($this->parent_name), 0, 1, 'L');
//$pdf->SetFont('arialpl', '', 10);
if ($this->parent_address_street)
$pdf->Cell(20, 5, html_entity_decode($this->parent_address_street), 0, 1, 'L');
if (($this->parent_address_postalcode) || ($this->parent_address_city))
$pdf->Cell(20, 5, html_entity_decode($this->parent_address_postalcode) . ' ' . html_entity_decode($this->parent_address_city), 0, 1, 'L');
if ($this->to_vatid)
$pdf->Cell(20, 5, $mod_strings['LBL_PDF_VATID'] . ' ' . html_entity_decode($this->to_vatid), 0, 1, 'L');
$title = '';
if ($this->parent_contact_title) {
$title.=$this->parent_contact_title . ' ';
}
if ($this->parent_contact_name) {
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20, 5, $title . $this->parent_contact_name, 0, 1, 'L');
$pdf->SetFont('arialpl', 'b', 10);
}
if ($this->parent_shipping_address_name || $this->parent_shipping_address_street) {
$x = $pdf->getX();
$y = $pdf->getY();
$pdf->setY($current);
$pdf->setX(100);
$pdf->Cell(100, 5, $mod_strings['LBL_PDF_DELIVERY_TO'], 0, 1, 'L');
$pdf->setX(100);
$pdf->MultiCell(100, 5, html_entity_decode($this->parent_shipping_address_name), 0, 1, 'L');
$pdf->setX(100);
if ($this->parent_shipping_address_street)
$pdf->Cell(100, 5, html_entity_decode($this->parent_shipping_address_street), 0, 1, 'L');
$pdf->setX(100);
if (($this->parent_shipping_address_postalcode) || ($this->parent_shipping_address_city))
$pdf->Cell(20, 5, html_entity_decode($this->parent_address_postalcode) . ' ' . html_entity_decode($this->parent_address_city), 0, 1, 'L');
$pdf->setY($y);
$pdf->setX($x);
}
//if ($this->name) {
// $pdf->Cell(20, 5, '', 0, 1, 'L');
// $pdf->SetFont('arialpl', 'b', 10);
// $pdf->Cell(20, 5, $mod_strings['LBL_PDF_NAME'], 0, 1, 'L');
// $pdf->SetFont('arialpl', '', 10);
// $pdf->Cell(20, 5, html_entity_decode($this->name), 0, 1, 'L');
//}
$pdf->SetFont('arialpl', '', 10);
$pdf->Ln(2);
//$current = $pdf->GetY();
//$pdf->MultiCell(120,4,$address,0,'L');
//$pdf->SetFont('arialpl','B','10');
//$pdf->MultiCell(0,4,$address_cnt,0,'L');
if ($this->parent_type = "Contacts")
$pdf->Ln(14);
$current2 = $pdf->GetY();
$pdf->SetFont('arialpl', '', '10');
$subFontSizeold = $pdf->FontSizePt;
$pdf->SetFontSize($subFontSize);
//// reposition y
//$subOffset = ((($subFontSize - $subFontSizeold) / $pdf->k) * 0.3) + ($subOffset / $pdf->k);
//$subX = $pdf->x;
//$subY = $pdf->y;
//$pdf->SetXY($subX, $subY - $subOffset);
//
////Output text
//$pdf->Write(5, 'test', '');
//
//// restore y position
//$subX = $pdf->x;
//$subY = $pdf->y;
//$pdf->SetXY($subX, $subY + $subOffset);
//
//// restore font size
//$pdf->SetFontSize($subFontSizeold);
//$pdf->Ln(7);
$pdf->SetXY($pdf->fw - $pdf->rMargin - 37, $current);
$table = array();
$table[0]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_DATE_REGISTER'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table[1]['data'] = array(
'width' => 30,
'value' => date("d.m.Y"),
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
$table[2]['data'] = array(
'width' => 30,
'value' => "",
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
$r_created_by = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select first_name, last_name from users where id='" . $this->modified_user_id . "'"));
$table[4]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_OWNER'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table[4]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_OWNER'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table[5]['data'] = array(
'width' => 30,
'value' => $r_created_by['first_name'] . " " . $r_created_by['last_name'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
$table[6]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_ASSIGNED_TO'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$tmp = '';
$tmp .= $this->setUser()->full_name . PHP_EOL;
$tmp .= 'tel.: ' . $this->setUser()->phone_work . PHP_EOL;
$tmp .= 'kom.: ' . $this->setUser()->phone_mobile . PHP_EOL;
$tmp .= 'e-mail: ' . $this->setUser()->email1;
$table[7]['data'] = array(
'width' => 30,
'value' => $tmp,
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
$pdf->DrawTable($table, null, 0, 0, 3);
$pdf->SetY($current2 - 10);
$pdf->Ln(2);
$pdf->SetFont('arialpl', '', '14');
$pdf->MultiCell(0, 0, $mod_strings['LBL_PDF_CONFIRM'] . " " . $this->document_no, 0, 'L');
$pdf->SetFont('arialpl', '', '9');
$pdf->Ln(7);
$table = array();
$table[0][0] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_PARENT_DOCUMENT_NO'],
'background' => array(255, 255, 255),
'border' => 0,
'overflow' => '1',
'align' => 'L',
);
$table[0][1] = array(
'width' => 80,
'value' => $this->parent_document_no,
'background' => array(255, 255, 255),
'border' => 0,
'overflow' => '1',
'align' => 'L',
);
$pdf->DrawTable($table);
//$pdf->MultiCell(0,0,'Szablon dokumentu jest aktualnie przebudowywany.',0,'L');
//$pdf->SetY($current2 + 5);
//$pdf->MultiCell(0,0,'Spróbuj za 30 min.',0,'L');
$this->loadParser();
$this->header_text = $this->template->mfp->parseText($this->header_text);
$this->footer_text = $this->template->mfp->parseText($this->footer_text);
$this->ads_text = $this->template->mfp->parseText($this->ads_text);
//header text
if ($this->header_text) {
$pdf->Ln(4);
$pdf->SetFont('arialpl', '', '10');
$pdf->MultiCell(0, 4, $this->header_text, 0, 'J');
}
$pdf->Ln(4);
//**************************************************
global $mod_strings;
$currency = new Currency();
$currency->retrieve($this->currency_id);
$this->currency_symbol = $currency->iso4217;
if (!isset($this->position_list) || !is_array($this->position_list)) {
$this->position_list = $this->getPositionList(true);
}
//echo '<pre>' . var_export($this->currency_id, true) . '</pre>'; exit;
// $calc = $this->calculate_currency($this->position_list, $this->currency_symbol, null);
$calc = $this->calculate_currency($this->position_list, $this->currency_id, $this->currency_value);
//$this->position_list = $this->formatPositions($this->position_list, $this->currency_id, $this->currency_value);
//$this->position_list = $this->getPositionList(true);
//$calc['total'] .= ' ' . $this->currency_symbol;
//$calc['subtotal'] .= ' ' . $this->currency_symbol;
//if ($calc['discount']) {
// $calc['total2'] .= ' ' . $this->currency_symbol;
// $calc['discount']['value'] .= ' ' . $this->currency_symbol;
//}
//
//if (isset($calc['vats']) && is_array($calc['vats']) && count($calc['vats']) > 0)
// foreach ($calc['vats'] as $key => $value)
// $calc['vats'][$key] .= ' ' . $this->currency_symbol;
$widths = array(
'position' => 5,
'description' => 64,
'quantity' => 8,
'unit_price' => 15,
'discount' => 7,
'total' => 15,
//
'fix' => 73 - 8 +4,
'subtotal1' => 15 + 8, // 66
'subtotal2' => 15, // 34
);
//$calc['draw_discount'] = false;
//echo '<pre>' . var_export($calc, true); exit;
$image_w = 10;
$recipient_code_w = 10;
if ($this->show_images_on_offers) {
$widths['description'] -= $image_w;
}
if ($this->show_recipient_code) {
$widths['description'] -= $recipient_code_w;
}
/*
if ($calc['draw_discount']) {
$widths['description'] -= 8;
}
if ($calc['draw_vat']) {
$widths['description'] -= 8;
}
*/
//jest rabat?
$rabat = false;
foreach ($this->position_list as $p) {
if ($p['discount'] != 0)
$rabat = true;
}
if($rabat) {
$widths['description'] -= $widths['discount'];
$widths['fix'] -= $widths['discount'];
$widths['subtotal2'] += $widths['discount'];
}
if ($this->total_netto != '')
$widths['description'] +=35;
$table = array();
$table[0]['position'] = array(
'width' => $widths['position'],
'value' => $mod_strings['LBL_PDF_LIST_POSITION'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
$table[0]['description'] = array(
'width' => $widths['description'],
'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
$table[0]['quantity'] = array(
'width' => $widths['quantity'],
'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
if ($this->total_netto == '') {
$table[0]['unit_price'] = array(
'width' => $widths['unit_price'],
'value' => $mod_strings['LBL_PDF_LIST_PRICE'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
if ($rabat == true) {
$table[0]['discount'] = array(
'width' => $widths['discount'],
'value' => 'Rabat (%)', $mod_strings['LBL_PDF_LIST_DISCOUNT'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
}
$table[0]['total'] = array(
'width' => $widths['total'],
'value' => $mod_strings['LBL_PDF_LIST_TOTAL'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'R',
);
}
$i = 1;
$netto_weight = $brutto_weight = 0;
$lv = return_app_list_strings_language($this->ecmlanguage);
if ($this->position_list != '') {
//$p = array_pop($this->position_list);
//$this->position_list = array_fill(0, 100, $p);
//$result = $db->query("SELECT total_netto from ecmquotes where id=$p['id']");
foreach ($this->position_list as $p) {
//$p['price'] = unformat_number(substr($p['price'], 0, -4));
//$p['total'] = unformat_number(substr($p['total'], 0, -4));
//echo '<pre>' . var_export($p, true); exit;
$table[$i]['position'] = array(
'width' => $widths['position'],
'value' => $i,
'border' => 1,
'align' => 'C',
);
$name = str_replace('', '-', htmlspecialchars_decode($p['name']));
$table[$i]['description'] = array(
'width' => $widths['description'],
'value' => $name,
'border' => 1,
'align' => 'L',
);
$netto_weight += $p['netto_weight'];
//$brutto_weight += $p['brutto_weight'];
$brutto_weight += ($p['quantity'] * $p['netto_weight']);
$table[$i]['quantity'] = array(
'width' => $widths['quantity'],
'value' => format_number($p['quantity']),
'border' => 1,
'align' => 'C',
);
$price_total = $p['price'] * $p['quantity'];
$discount = ((100 * $p['price']) / (100 - $p['discount']));
//echo '<pre>' . var_export($price_total, true);
//echo '<pre>' . var_export($discount, true);
//exit;
if ($this->total_netto == '') {
$table[$i]['unit_price'] = array(
'width' => $widths['unit_price'],
// 'value' => format_number($p['price']). ' ' . $this->currency_symbol,
'value' => format_number($p['price']). ' ' . $p['currency_name'],
'border' => 1,
'align' => 'R',
);
if ($rabat == true) {
if ($p['discount'] == 0) {
$tmp = '---';
} else {
$tmp = format_number($p['discount']) . '%';
}
$table[$i]['discount'] = array(
'width' => $widths['discount'],
'value' => $tmp,
'border' => 1,
'align' => 'C',
);
}
$table[$i]['total'] = array(
'width' => $widths['total'],
// 'value' => format_number($p['total']) . ' '. $this->currency_symbol,
'value' => format_number($p['total']) . ' '. $p['currency_name'],
'border' => 1,
'align' => 'R',
);
}
$tmp_sep = ereg_replace('[^0-9.,]', '', $p['total']);
$len = strlen($tmp_sep);
$separator = substr($tmp_sep, $len - 3, 1);
if ($separator == '.') {
$tmp = (float) ereg_replace('[^0-9.]', '', $p['total']);
}
if ($separator == ',') {
$tmp = (float) ereg_replace('[^0-9,]', '', $p['total']);
}
if ($p['currency_id'] == 'PLN') {
if (isset($total_price_pln)) {
$total_price_pln += $tmp;
} else {
$total_price_pln = $tmp;
}
}
if ($p['currency_id'] == '6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf') {
if (isset($total_price_eur)) {
$total_price_eur+= $tmp;
} else {
$total_price_eur = $tmp;
}
}
$i++;
}
}
$starttab = $pdf->GetY() + 10;
$pdf->DrawTable($table, array(0));
$endtab = $pdf->GetY();
$pdf->SetY($endtab);
//mz
$table = array();
//echo '<pre>'. var_export($calc, true); exit;
//EURO
if ($calc['vats']) {
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_TOTAL'],
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
// 'value' => format_number($calc['subtotal']) . ' ' . $calc['currency_symbol'],
'value' => format_number($calc['subtotal']) . ' ' . $this->currency_symbol,
//'value' => 'test',
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
foreach ($calc['vats'] as $key => $value) {
$r = mysql_fetch_array(mysql_query("select name from ecmvats where id='" . $key . "'"));
$vvn = $r['name'];
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_VAT'] . ' (' . $vvn . ')',
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9),
'subtotal2' => array(
'width' => $widths['subtotal2'],
// 'value' => format_number($value) . ' ' . $calc['currency_symbol'],
'value' => format_number($value) . ' ' . $this->currency_symbol,
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
}
}
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'total1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_END_TOTAL'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
'font-style' => 'b',
),
'total2' => array(
'width' => $widths['subtotal2'],
// 'value' => format_number(unformat_number($calc['total'])) . ' ' . $calc['currency_symbol'],
'value' => format_number(unformat_number($calc['total'])) . ' ' . $this->currency_symbol,
'border' => 1,
'background' => array(233, 233, 233),
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
'font-style' => 'b',
),
);
//echo '<pre>' . var_export($widths['subtotal2'], true); exit;
$pdf->Ln(4);
$pdf->DrawTable($table);
//PLN
//$starttab = $pdf->GetY() + 1;
//$pdf->SetY($starttab);
//
//$table = array();
//if ($calc['vats_pln']) {
// $table[] = array(
// 'subtotal1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_TOTAL'], 'background' => array(255, 255, 255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
// 'subtotal2' => array('width' => 34, 'value' => $calc['subtotal_pln'] . ' PLN', 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9),);
//
// foreach ($calc['vats_pln'] as $key => $value) {
// $r = mysql_fetch_array(mysql_query("select name from ecmvats where id='" . $key . "'"));
// $vvn = $r['name'];
// $table[] = array(
// 'vat1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_VAT'] . ' (' . $vvn . ')', 'background' => array(255, 255, 255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
// 'vat2' => array('width' => 34, 'value' => $value . ' PLN', 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9),);
// }
//}
//
//$table[] = array(
// 'total1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_END_TOTAL'], 'background' => array(233, 233, 233), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b'),
// 'total2' => array('width' => 34, 'value' => $calc['subtotal_pln'] . ' PLN', 'border' => 0, 'background' => array(233, 233, 233), 'overflow' => 1, 'align' => 'R', 'font-size' => 9, 'font-style' => 'b'),);
//
//$pdf->DrawTable($table);

View File

@@ -0,0 +1,334 @@
<?php
global $db;
$pdf->focus=$this;
$pdf->Ln(2);
$pdf->SetY($pdf->GetY()+2);
$current = $pdf->GetY();
$pdf->SetFont('arialpl', '', 9);
/*
$p_name = html_entity_decode($this->parent_name);
$p_name = explode(' ', $p_name);
$name = array();
if (sizeof($p_name)>4) {
for ($i=0; $i<sizeof($p_name); $i++) {
$n.=$p_name[$i].' ';
//$pdf->Cell(40,5, $n,0,1,'L');
if (($i%5==0) && ($i!=0)) {
$name[] = $n;
$n='';
}
}
$name[] = $n;
}
if($this->parent_name) {
if (sizeof($p_name)>4)
foreach ($name as $n)
$pdf->Cell(40,5, $n,0,1,'L');
else
$pdf->Cell(40,5, html_entity_decode($this->parent_name),0,1,'L');
}
*/
$pdf->MultiCell(100,5, html_entity_decode($this->parent_name),0,1,'L');
//$pdf->SetFont('arialpl', '', 10);
if($this->parent_address_street) $pdf->Cell(20,5,html_entity_decode($this->parent_address_street),0,1,'L');
if (($this->parent_address_postalcode) || ($this->parent_address_city))
$pdf->Cell(20,5,html_entity_decode($this->parent_address_postalcode).' '.html_entity_decode($this->parent_address_city),0,1,'L');
if($this->to_vatid) $pdf->Cell(20,5,$mod_strings['LBL_PDF_VATID'].' '.html_entity_decode($this->to_vatid),0,1,'L');
$title='';
if($this->parent_contact_title) $title.=$this->parent_contact_title.' ';
if($this->parent_contact_name) {
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20,5,$title.$this->parent_contact_name,0,1,'L');
$pdf->SetFont('arialpl', 'b', 10);
}
if ($this->parent_shipping_address_name || $this->parent_shipping_address_street) {
$x = $pdf->getX();
$y = $pdf->getY();
$pdf->setY($current);
$pdf->setX(100);
$pdf->Cell(100,5,$mod_strings['LBL_PDF_DELIVERY_TO'],0,1,'L');
$pdf->setX(100);
$pdf->MultiCell(100,5, html_entity_decode($this->parent_shipping_address_name),0,1,'L');
$pdf->setX(100);
if($this->parent_shipping_address_street) $pdf->Cell(100,5,html_entity_decode($this->parent_shipping_address_street),0,1,'L');
$pdf->setX(100);
if (($this->parent_shipping_address_postalcode) || ($this->parent_shipping_address_city))
$pdf->Cell(20,5,html_entity_decode($this->parent_address_postalcode).' '.html_entity_decode($this->parent_address_city),0,1,'L');
$pdf->setY($y);
$pdf->setX($x);
}
/*
if($this->name) {
$pdf->Cell(20,5,'',0,1,'L');
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20,5,$mod_strings['LBL_PDF_NAME'],0,1,'L');
$pdf->SetFont('arialpl', '', 10);
$pdf->Cell(20,5,html_entity_decode($this->name),0,1,'L');
}
*/
$pdf->SetFont('arialpl', '', 10);
$pdf->Ln(2);
// $current = $pdf->GetY();
//$pdf->MultiCell(120,4,$address,0,'L');
//$pdf->SetFont('arialpl','B','10');
//$pdf->MultiCell(0,4,$address_cnt,0,'L');
if($this->parent_type="Contacts")$pdf->Ln(14);
$current2 = $pdf->GetY();
$pdf->SetFont('arialpl','','10');
$subFontSizeold = $pdf->FontSizePt;
$pdf->SetFontSize($subFontSize);
/*
// reposition y
$subOffset = ((($subFontSize - $subFontSizeold) / $pdf->k) * 0.3) + ($subOffset / $pdf->k);
$subX = $pdf->x;
$subY = $pdf->y;
$pdf->SetXY($subX, $subY - $subOffset);
//Output text
$pdf->Write(5, 'test','');
// restore y position
$subX = $pdf->x;
$subY = $pdf->y;
$pdf->SetXY($subX, $subY + $subOffset);
// restore font size
$pdf->SetFontSize($subFontSizeold);
*/
// $pdf->Ln(7);
$pdf->SetXY($pdf->fw-$pdf->rMargin-37,$current);
$table = array();
$table [0]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_DATE_REGISTER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [1]['data'] = array('width' => 30, 'value' => date("d.m.Y"), 'border' => 0, 'overflow' => 1, 'align' => 'L');
$table [2]['data'] = array('width' => 30, 'value' => "", 'border' => 0, 'overflow' => 1, 'align' => 'L');
$r_created_by = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select first_name, last_name from users where id='".$this->modified_user_id."'"));
$table [4]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_OWNER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9); $table [4]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_OWNER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [5]['data'] = array('width' => 30, 'value' => $r_created_by['first_name']." ".$r_created_by['last_name'] , 'border' => 0, 'overflow' => 1, 'align' => 'L');
$table [6]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_ASSIGNED_TO'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [7]['data'] = array('width' => 30, 'value' => $this->setUser()->full_name.'
tel.: '.$this->setUser()->phone_work.'
kom.: '.$this->setUser()->phone_mobile.'
e-mail: '.$this->setUser()->email1, 'border' => 0, 'overflow' => 1, 'align' => 'L');
$pdf->DrawTable($table, null, 0, 0, 3);
$pdf->SetY($current2-10);
$pdf->Ln(2);
$pdf->SetFont('arialpl','','14');
$pdf->MultiCell(0,0,$mod_strings['LBL_PDF_CONFIRM']." ".$this->document_no,0,'L');
$pdf->SetFont('arialpl','','9');
$pdf->Ln(5);
$table = array();
$table[0][0] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_PARENT_DOCUMENT_NO'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => '1', 'align' => 'L');
$table[0][1] = array('width' => 80, 'value' => $this->parent_document_no, 'background' => array(255,255,255), 'border' => 0, 'overflow' => '1', 'align' => 'L');
$pdf->DrawTable($table);
//$pdf->MultiCell(0,0,'Szablon dokumentu jest aktualnie przebudowywany.',0,'L');
$pdf->SetY($current2+5);
//$pdf->MultiCell(0,0,'Spróbuj za 30 min.',0,'L');
$this->loadParser();
$this->header_text = $this->template->mfp->parseText($this->header_text);
$this->footer_text = $this->template->mfp->parseText($this->footer_text);
$this->ads_text = $this->template->mfp->parseText($this->ads_text);
//header text
if($this->header_text){
$pdf->Ln(8);
$pdf->SetFont('arialpl','','10');
$pdf->MultiCell(0,4,$this->header_text,0,'J');
}
$pdf->Ln(8);
//**************************************************
global $mod_strings;
if(!isset($this->position_list) || !is_array($this->position_list))
$this->position_list = $this->getPositionList(true);
$calc = $this->calculate_currency($this->position_list,$this->currency_id, $this->currency_value);
$this->position_list = $this->formatPositions($this->position_list, $this->currency_id, $this->currency_value);
/*
$calc['total'] .= ' '.$this->currency_symbol;
$calc['subtotal'] .= ' '.$this->currency_symbol;
if($calc['discount']) {
$calc['total2'] .= ' '.$this->currency_symbol;
$calc['discount']['value'] .= ' '.$this->currency_symbol;
}
if(isset($calc['vats']) && is_array($calc['vats']) && count($calc['vats']) > 0)
foreach($calc['vats'] as $key => $value) $calc['vats'][$key] .= ' '.$this->currency_symbol;
*/
$name_w = 59;
$image_w = 10;
$recipient_code_w = 10;
if($this->show_images_on_offers){
$name_w -= $image_w;
}
if($this->show_recipient_code){
$name_w -= $recipient_code_w;
}
if($calc['draw_discount']){
$name_w -= 8;
}
if($calc['draw_vat']){
$name_w -= 8;
}
//jest rabat?
$rabat = false;
foreach($this->position_list as $p) {
if ($p['discount']!=0) $rabat=true;
}
if ($this->total_netto!='') $name_w+=35;
$table = array();
$table [0]['position'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_POSITION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
$table [0]['description'] = array('width' => $name_w, 'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
$table [0]['quantity'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'],'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
if ($this->total_netto=='') {
$table [0]['unit_price'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_PRICE'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
if ($rabat==true) {
$table [0]['discount'] = array('width' => 7, 'value' => $mod_strings['LBL_PDF_LIST_DISCOUNT'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
}
$table [0]['total'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_TOTAL'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'R');
}
$i = 1;
$lv=return_app_list_strings_language($this->ecmlanguage);
if($this->position_list != '')
// $result = $db->query("SELECT total_netto from ecmquotes where id=$p['id']");
foreach($this->position_list as $p) {
$table [$i]['position'] = array('width' => 5, 'value' => $i, 'border' => 0, 'align' => 'C', );
$name = str_replace('','-',htmlspecialchars_decode($p['name']));
$table [$i]['description'] = array('width' => $name_w, 'value' => $name, 'border' => 0, 'align' => 'L', );
$table [$i]['quantity'] = array('width' => 8, 'value' => $p['quantity'], 'border' => 0, 'align' => 'C', );
if ($this->total_netto=='') {
$table [$i]['unit_price'] = array('width' => 14, 'value' => $p['price'], 'border' => 0, 'align' => 'C', );
if ($rabat==true) {
if ($p['discount']==0) $tmp='---'; else $tmp=$p['discount'];
$table [$i]['discount'] = array('width' => 7, 'value' => $tmp, 'border' => 0, 'align' => 'R', );
}
$table [$i]['total'] = array('width' => 14, 'value' => $p['total'], 'border' => 0, 'align' => 'R', );
}
$tmp_sep = ereg_replace('[^0-9.,]', '', $p['total']);
$len = strlen($tmp_sep);
$separator = substr($tmp_sep, $len-3, 1);
if ($separator == '.') $tmp = (float) ereg_replace('[^0-9.]', '', $p['total']);
if ($separator == ',') $tmp = (float) ereg_replace('[^0-9,]', '', $p['total']);
if ($p['currency_id'] == 'PLN') {
if (isset($total_price_pln)) $total_price_pln += $tmp;
else $total_price_pln = $tmp;
}
if ($p['currency_id'] == '6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf') {
if (isset($total_price_eur)) $total_price_eur+= $tmp;
else $total_price_eur= $tmp;
}
$i++;
}
$starttab=$pdf->GetY()+10;
$pdf->DrawTable($table,array(0));
$endtab=$pdf->GetY();
$pdf->SetY($endtab);
//mz
$table = array();
//EURO
if($calc['vats']) {
$table [] = array(
'subtotal1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'subtotal2' => array('width' => 34, 'value' => $calc['subtotal'].' '.$calc['currency_symbol'], 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
foreach($calc['vats'] as $key => $value){
$r=mysql_fetch_array(mysql_query("select name from ecmvats where id='".$key."'"));
$vvn=$r['name'];
$table [] = array(
'vat1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_VAT'].' ('.$vvn.')', 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'vat2' => array('width' => 34, 'value' => $value.' '.$calc['currency_symbol'], 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
}
}
$table [] = array(
'total1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_END_TOTAL'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b'),
'total2' => array('width' => 34, 'value' => $calc['total'].' '.$calc['currency_symbol'], 'border' => 0, 'background' => array(233,233,233), 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b'), );
$pdf->DrawTable($table);
//PLN
/*
$starttab=$pdf->GetY()+1;
$pdf->SetY($starttab);
$table = array();
if($calc['vats_pln']) {
$table [] = array(
'subtotal1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'subtotal2' => array('width' => 34, 'value' => $calc['subtotal_pln'].' PLN', 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
foreach($calc['vats_pln'] as $key => $value){
$r=mysql_fetch_array(mysql_query("select name from ecmvats where id='".$key."'"));
$vvn=$r['name'];
$table [] = array(
'vat1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_VAT'].' ('.$vvn.')', 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'vat2' => array('width' => 34, 'value' => $value.' PLN', 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
}
}
$table [] = array(
'total1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_END_TOTAL'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b'),
'total2' => array('width' => 34, 'value' => $calc['subtotal_pln'].' PLN', 'border' => 0, 'background' => array(233,233,233), 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b'), );
$pdf->DrawTable($table);
*/
?>

View File

@@ -0,0 +1,84 @@
<?
error_reporting ( 0 );
$r = mysql_fetch_array ( mysql_query ( "select document_no, ecmlanguage from " . strtolower ( $_REQUEST ['module'] ) . " where id='" . $_REQUEST ['record'] . "'" ) );
$this->SetFont ( 'arialpl', '', 8 );
$this->SetY ( $this->fh - 15 );
$this->SetDrawColor ( 0, 0, 0 );
$this->SetFillColor ( 255, 255, 255 );
$this->Rect ( 0, $this->getBreakLine (), $this->fw, $this->bMargin + 1, "F" );
$this->SetDrawColor ( 0, 0, 0 );
$this->Cell ( 0, 10, $this->PageNo () . '/{nb}' );
$this->Ln ( 5 );
$this->AliasNbPages ();
$this->SetLineWidth ();
$this->SetDrawColor ( 0, 0, 0 );
$this->Line ( $this->lMargin, - 17 - 16 + 1, $this->fw - $this->rMargin, - 17 - 16 + 1 );
if ($this->edt->show_footer_on_all_pages == 0 && $this->page > 1) {
return;
}
$this->SetXY ( $this->lMargin, - 20 - 16 );
$this->Line(10,$this->fh-37,200,$this->fh-37);
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, 'e5 Polska Sp. z o.o.' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'Bank: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, 'BANK MILLENIUM', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, 'ul. Wąwozowa 11, 02-796 Warszawa, Poland' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'Bank IBAN: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, 'PL36116022020000000064080587', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, '22 228 20 90');
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'Bank SWIFT: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, "BIGBPLPW", 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, '+ 48 (56) 674 60 47' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'KRS: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, '28207', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, 'www.e5.pl' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'NIP: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, 'PL 525-21-73-990', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, '' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'REGON: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, '016280234', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( "arialpl", "B", 8 );
$this->SetXY ( 40, $this->GetY () + 1 );
$this->Cell ( 45, 4, $r ['document_no'], 0, 0, 'L' );
?>

View File

@@ -0,0 +1,93 @@
<?
error_reporting(0);
$r=mysql_fetch_array(mysql_query("select document_no, ecmlanguage from ".strtolower($_REQUEST['module'])." where id='".$_REQUEST['record']."'"));
$this->SetFont('arialpl', '', 8);
$this->SetY($this->fh-15);
$this->SetDrawColor(0,0,0);
$this->SetFillColor(255,255,255);
$this->Rect(0, $this->getBreakLine(), $this->fw, $this->bMargin+1, "F");
$this->SetDrawColor(0,0,0);
$this->Cell(0, 10, $this->PageNo().'/{nb}');
$this->Ln(5);
$this->AliasNbPages();
$this->SetLineWidth(0);
$this->SetDrawColor(0,0,0);
$this->Line($this->lMargin,-17-16+1,$this->fw-$this->rMargin,-17-16+1);
if($this->edt->show_footer_on_all_pages == 0 && $this->page > 1) {
return;
}
$this->SetXY($this->lMargin,-20-16);
$this->SetFont('arialpl','','7');
$this->Cell(110,4,$this->edt->footer_account);
$this->SetFont('arialpl','B','7');
$this->Cell(20,4,'Bank: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,$this->edt->footer_bankname,0,0,'L');
$this->Ln();
$this->SetFont('arialpl','','7');
if ($r['ecmlanguage']=='pl_pl')
$this->Cell(110,4,$this->edt->footer_address);
else
$this->Cell(110,4,$this->edt->footer_address.', Poland');
$this->SetFont('arialpl','B','7');
if ($r['ecmlanguage']=='pl_pl')
$this->Cell(20,4,'Numer konta: ');
else
$this->Cell(20,4,'Bank IBAN: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,$this->edt->account_number,0,0,'L');
$this->Ln();
$this->SetFont('arialpl','','7');
$this->Cell(110,4,$this->edt->footer_phone);
if ($r['ecmlanguage']=='pl_pl') {
$this->SetFont('arialpl','B','7');
$this->Cell(20,4,'Numer GIOS: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,"E0006254W",0,0,'L');
} else {
$this->SetFont('arialpl','B','7');
$this->Cell(20,4,'Bank SWIFT: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,"BIGBPLPW",0,0,'L');
}
$this->Ln();
$this->SetFont('arialpl','','7');
$this->Cell(110,4,$this->edt->footer_fax);
$this->SetFont('arialpl','B','7');
$this->Cell(20,4,'KRS: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,$this->edt->footer_krs,0,0,'L');
$this->Ln();
$this->SetFont('arialpl','','7');
$this->Cell(110,4,'www.e5.pl');
$this->SetFont('arialpl','B','7');
$this->Cell(20,4,'NIP: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,$this->edt->footer_nip,0,0,'L');
$this->Ln();
$this->SetFont('arialpl','','7');
$this->Cell(110,4,'');
$this->SetFont('arialpl','B','7');
$this->Cell(20,4,'REGON: ');
$this->SetFont('arialpl','','7');
$this->Cell(45,4,$this->edt->footer_regon,0,0,'L');
$this->Ln();
$this->SetFont("arialpl","B",8);
$this->SetXY(40,$this->GetY()+1);
$this->Cell(45,4,$r['document_no'],0,0,'L');
?>

View File

@@ -0,0 +1,83 @@
<?
error_reporting ( 0 );
$r = mysql_fetch_array ( mysql_query ( "select document_no, ecmlanguage from " . strtolower ( $_REQUEST ['module'] ) . " where id='" . $_REQUEST ['record'] . "'" ) );
$this->SetFont ( 'arialpl', '', 8 );
$this->SetY ( $this->fh - 15 );
$this->SetDrawColor ( 0, 0, 0 );
$this->SetFillColor ( 255, 255, 255 );
$this->Rect ( 0, $this->getBreakLine (), $this->fw, $this->bMargin + 1, "F" );
$this->SetDrawColor ( 0, 0, 0 );
$this->Cell ( 0, 10, $this->PageNo () . '/{nb}' );
$this->Ln ( 5 );
$this->AliasNbPages ();
$this->SetLineWidth ();
$this->SetDrawColor ( 0, 0, 0 );
$this->Line ( $this->lMargin, - 17 - 16 + 1, $this->fw - $this->rMargin, - 17 - 16 + 1 );
if ($this->edt->show_footer_on_all_pages == 0 && $this->page > 1) {
return;
}
$this->SetXY ( $this->lMargin, - 20 - 16 );
$this->Line(10,$this->fh-37,200,$this->fh-37);
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, 'e5 Polska Sp. z o.o.' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'Bank: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, 'BANK MILLENIUM', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, 'ul. Wąwozowa 11, 02-796 Warszawa' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'Numer konta: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, '35 1160 2202 0000 0000 6408 0411', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, '22 228 20 90');
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'Numer GIOŚ: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, "E0006254W", 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, '+ 48 (56) 674 60 47' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'KRS: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, '28207', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, 'www.e5.pl' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'NIP: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, 'PL 525-21-73-990', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 110, 4, '' );
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 20, 4, 'REGON: ' );
$this->SetFont ( 'arialpl', '', '7' );
$this->Cell ( 45, 4, '016280234', 0, 0, 'L' );
$this->Ln ();
$this->SetFont ( "arialpl", "B", 8 );
$this->SetXY ( 40, $this->GetY () + 1 );
$this->Cell ( 45, 4, $r ['document_no'], 0, 0, 'L' );
?>

View File

@@ -0,0 +1,30 @@
<?
set_time_limit(99999);
error_reporting(0);
if(!$this->blnShowHeader) return;
if($this->edt->show_header_on_all_pages == 0 && $this->page > 1) return;
if(isset($this->edt->logo_path) && $this->edt->logo_path != '' && file_exists($this->edt->logo_path)){
$this->Image($this->edt->logo_path,$this->lMargin,$this->tMargin,0,15);
}
$this->SetFont('arialpl', '', 8);
$this->SetXY($this->lMargin+135,$this->tMargin+2);
$this->SetFont ( 'arialpl', 'B', '7' );
$this->Cell ( 110, 4, 'e5 Polska Sp. z o.o.');
$this->Ln ();
$this->SetX($this->lMargin+135);
$this->Cell ( 110, 4, 'ul. Wąwozowa 11' );
$this->Ln ();
$this->SetX($this->lMargin+135);
$this->Cell ( 110, 4, '02-796 Warszawa' );
$this->Ln ();
$this->SetX($this->lMargin+135);
$this->Cell ( 20, 4, 'NIP: PL 525-21-73-990' );
$this->Ln ();
$this->Line(10,30,200,30);
?>

View File

@@ -0,0 +1,251 @@
<?php
$pdf->writeHTML('</table>'); // fix background-color overflowing FROM table ... why ? //
// Payment conditions.
//if (!empty($this->ecmpaymentcondition_text)) {
// $pdf->Ln(4);
// $pdf->SetFont('arialpl', '', 8);
// $pdf->MultiCell(0, 4, $this->ecmpaymentcondition_text, 0, 'L');
// $pdf->Ln();
//}
//
//if ($this->type == "correct") {
// $pdf->SetFont('arialpl', 'b', '12');
// $pdf->Ln(3);
// $pdf->MultiCell(0, 4, $mod_strings['LBL_PDF_DOCUMENT_CORRECT_DIFFERENCE'] . " " . format_number(abs(unformat_number($this->total) + unformat_number($this->ecminvoiceout->total))) . ' ' . $this->currency_symbol);
// $pdf->Ln(3);
//}
/*
if ($this->type == "correct") {
$qw = "SELECT price, ecmvat_value, quantity, ecminvoiceoutitem_id FROM ecminvoiceoutitems WHERE ecminvoiceout_id = '" . $this->id . "'";
$w = $GLOBALS['db']->query($qw);
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
$qrr = "SELECT price, quantity, ecmvat_value FROM ecminvoiceoutitems WHERE id = '" . $r['ecminvoiceoutitem_id'] . "'";
$rr_prepayment = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query($qrr));
$total += $r['price'] * $r['quantity'] + round($r['price'] * $r['quantity'] * $r['ecmvat_value'] / 100, 2);
$total -= $rr_prepayment['price'] * $rr_prepayment['quantity'] + round($rr_prepayment['price'] * $rr_prepayment['quantity'] * $rr_prepayment['ecmvat_value'] / 100, 2);
}
$total -= $this->paid_val;
if ($total > 0) {
$string = $mod_strings['LBL_PDF_TO_PAID'];
} else {
$string = $mod_strings['LBL_PDF_TO_PAID_BACK'];
}
$total = format_number(abs($total));
$pdf->SetX(10);
$pdf->SetFont('arialpl', '', 8);
$pdf->Cell(50, 4, 'Razem do zapłaty:', 0, 0, 'L', 1);
$pdf->SetFont('arialpl', 'B', 8);
$pdf->Cell(30, 4, format_number($brutto) . ' ' . $this->currency_symbol, 0, 0, 'L', 1);
} else {
$total = 0;
$qw = "SELECT price, ecmvat_value, quantity, ecminvoiceoutitem_id FROM ecminvoiceoutitems WHERE ecminvoiceout_id = '" . $this->id . "'";
$w = $GLOBALS['db']->query($qw);
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
$total+=$r['price'] * $r['quantity'] + round($r['price'] * $r['quantity'] * $r['ecmvat_value'] / 100, 2);
}
$total-=floatval(str_replace(",", ".", str_replace(".", "", $this->discount)));
//$total -= $this->paid_val;
if ($total > 0) {
$string = $mod_strings['LBL_PDF_TO_PAID'];
} else {
$string = $mod_strings['LBL_PDF_TO_PAID_BACK'];
}
$total = format_number(abs($total));
$pdf->SetX(10);
$pdf->SetFont('arialpl', '', 8);
$pdf->Cell(50, 4, 'Razem do zapłaty:', 0, 0, 'L', 1);
$pdf->SetFont('arialpl', 'B', 8);
$pdf->Cell(30, 4, format_number($brutto) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
}
$pdf->Ln(4);
$pdf->SetFont('arialpl', '', 8);
if ($this->prepaid) {
// $pdf->Cell(50, 4, $mod_strings['LBL_PDF_PREPAID_DOCUMENTS'] . ':', 0, 0, 'L', 1);
// $pdf->Cell(30, 4, implode(', ', $rr_prepayment), 0, 0, 'L', 1);
//
// $pdf->Ln(4);
$pdf->SetX(10);
$pdf->Cell(50, 4, $mod_strings['LBL_PDF_PREPAID'] . ':', 0, 0, 'L', 1);
$pdf->SetFont('arialpl', 'B', 8);
$pdf->Cell(30, 4, format_number($this->prepaid) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
$pdf->Ln(4);
}
//$pdf->Ln(4);
$pdf->SetX(10);
$pdf->SetFont('arialpl', '', 8);
$pdf->Cell(50, 4, $mod_strings['LBL_PDF_PAID'] . ':', 0, 0, 'L', 1);
$pdf->SetFont('arialpl', 'B', 8);
$pdf->Cell(30, 4, format_number($this->paid_val) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
if($this->paid_val > 0) {
$pdf->SetX(100);
$pdf->SetFont('arialpl', '', 8);
$pdf->WriteHtml($app_list_strings['payment_method_dom'][$this->payment_method_paid]);
}
$pdf->Ln(4);
//if ($pdf->GetY() > 240) {
// $pdf->AddPage();
//}
$total -= ($this->paid_val);
if(($pleft = $brutto - $this->prepaid - $this->paid_val) > 0) {
$pdf->SetX(10);
$pdf->SetFont('arialpl', '', 8);
$pdf->Cell(50, 4, 'Pozostało do zapłaty:', 0, 0, 'L', 1);
$pdf->SetFont('arialpl', 'B', 8);
$pdf->Cell(30, 4, format_number($pleft) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
$pdf->SetX(100);
$pdf->SetFont('arialpl', '', 8);
$pdf->WriteHtml(sprintf($mod_strings['LBL_PDF_PAYMENT_METHOD_PATTERN'], $this->payment_date_d, $this->payment_date, $app_list_strings['payment_method_dom'][$this->payment_method]));
//$pdf->Ln(4);
//$pdf->SetX(90);
//$pdf->SetFont('arialpl', '', 8);
//$pdf->WriteHtml(sprintf($mod_strings2['LBL_PDF_PAYMENT_METHOD_PATTERN'], $this->payment_date_d, $this->payment_date, $this->payment_method));
//echo '<pre>' . var_export($cx, true) . '</pre>';
//echo '<pre>' . var_export($cy, true) . '</pre>'; exit;
}
*/
//$pdf->Ln(4);
//$pdf->SetFont('arialpl', '', 8);
//
//if (false == is_null($pc)) {
// $pdf->Cell(50, 4, $mod_strings['LBL_PDF_PAYMENT_METHOD'] . ':', 0, 0, 'L', 1);
// $pdf->Cell(50, 4, $pc->name ? : '-', 0, 0, 'L', 1);
//
// $pdf->Ln(4);
//}
//
//$pdf->Cell(50, 4, $mod_strings['LBL_PDF_PAYMENT_TERMIN'] . ':', 0, 0, 'L', 1);
//$pdf->Cell(50, 4, $this->payment_date ? : '-', 0, 0, 'L', 1);
//
//$pdf->Ln(4);
//
//$pdf->SetFont('arialpl', '', 8);
//$pdf->Cell(30, 4, "Słownie:", 0, 0, 'L', 1);
//$pdf->SetFont('arialpl', 'B', 8);
//
//if ($this->type == "correct") {
// $tot = format_number(abs((float) $total - array_sum($inv_value)));
// $tot = str_replace(".", "", $tot);
// //$tot=str_replace(",",".",$tot);
// $sl = $this->slowniePL($tot);
//} else {
// $tot = str_replace(".", "", str_replace("PLN", "", $total - array_sum($inv_value)));
// $sl = $this->slowniePL($tot);
//}
//
//if ($this->document_no == "FV 1421/10") {
// $sl = "one thousand one hundred six EUR 41/100";
//}
//
//$pdf->Cell(150, 4, $sl, 0, 0, 'L', 1);
//echo '<pre>' . var_export($this->currency_symbol, true); exit;
if ($this->currency_symbol != 'EUR') {
$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT conversion_rate FROM currencies WHERE id='6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf'"));
$this->currency_value = $r['conversion_rate'];
//if ($this->invoice_type != 'K') {
$pdf->SetFont('arialpl', '', 8);
//$pdf->Ln(4);
$pdf->SetX(11);
$pdf->WriteHtml(sprintf('Wartość przeliczona na PLN wg aktualnego kursu sprzedaży walut w banku Citi Handlowym: 1 EUR = %s %s.', format_number($this->currency_value, 4, 4), $this->currency_symbol));
$pdf->Ln(8);
}
$pdf->SetX(10);
$pdf->SetFont('arialpl', 'b', 8);
$pdf->Cell(25, 4, 'Metoda płatności: ', 0, 0, 'L', 1);
$pdf->SetFont('arialpl', '', 8);
//echo '<pre>' . var_export($this->payment_method, true);exit;
if($this->payment_method != '' && $this->payment_method != 'INNY') {
$pdf->Cell(50, 4, $app_list_strings['payment_method_dom'][$this->payment_method] . ($this->payment_deadline ? (', ' . $this->payment_deadline . ' dni') : '') , 0, 0, 'L', 1);
} else {
$pdf->Cell(50, 4, $this->payment_description, 0, 0, 'L', 1);
}
// Signatures.
$pdf->Ln(20);
$pdf->SetFont('arialpl', '', 7);
$pdf->SetX(12);
$pdf->Cell(95, 1, '...............................................................', 0, 0, 'L', 1);
$pdf->Cell(95, 1, '...............................................................', 0, 0, 'R', 1);
$pdf->Ln(4);
$pdf->SetX(10);
$pdf->Cell(43, 1, $mod_strings['LBL_PDF_OWNER_SIGNATURE'], 0, 0, 'C', 1);
$pdf->SetX(162);
$pdf->Cell(35, 1, $mod_strings['LBL_PDF_RECEIVER_SIGNATURE'], 0, 0, 'C', 1);
$pdf->Ln(4);
$pdf->SetX(10);
$pdf->Cell(43, 1, $this->setUser()->full_name, 0, 0, 'C', 1);
/*
// Footer text.
$pdf->Ln(18);
$pdf->SetFont('arialpl', '', 8);
$pdf->MultiCell(0, 4, $this->footer_text, 0, 'J');
*/
/*
// Ads text.
$pdf->Ln(6);
$pdf->SetFont('arialpl', 'B', 8);
$pdf->MultiCell(0, 4, $this->ads_text, 0, 'J');
*/

View File

@@ -0,0 +1,4 @@
<?
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,316 @@
<?php
global $db;
$pdf->focus=$this;
$pdf->Ln(2);
$pdf->SetY($pdf->GetY()+2);
$current = $pdf->GetY();
$pdf->SetFont('arialpl', '', 9);
/*
$p_name = html_entity_decode($this->parent_name);
$p_name = explode(' ', $p_name);
$name = array();
if (sizeof($p_name)>4) {
for ($i=0; $i<sizeof($p_name); $i++) {
$n.=$p_name[$i].' ';
//$pdf->Cell(40,5, $n,0,1,'L');
if (($i%5==0) && ($i!=0)) {
$name[] = $n;
$n='';
}
}
$name[] = $n;
}
if($this->parent_name) {
if (sizeof($p_name)>4)
foreach ($name as $n)
$pdf->Cell(40,5, $n,0,1,'L');
else
$pdf->Cell(40,5, html_entity_decode($this->parent_name),0,1,'L');
}
*/
$pdf->MultiCell(100,5, html_entity_decode($this->parent_name),0,1,'L');
//$pdf->SetFont('arialpl', '', 10);
if($this->parent_address_street) $pdf->Cell(20,5,html_entity_decode($this->parent_address_street),0,1,'L');
if (($this->parent_address_postalcode) || ($this->parent_address_city))
$pdf->Cell(20,5,html_entity_decode($this->parent_address_postalcode).' '.html_entity_decode($this->parent_address_city),0,1,'L');
if($this->to_vatid) $pdf->Cell(20,5,$mod_strings['LBL_PDF_VATID'].' '.html_entity_decode($this->to_vatid),0,1,'L');
$title='';
if($this->parent_contact_title) $title.=$this->parent_contact_title.' ';
if($this->parent_contact_name) {
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20,5,$title.$this->parent_contact_name,0,1,'L');
$pdf->SetFont('arialpl', 'b', 10);
}
/*
if($this->name) {
$pdf->Cell(20,5,'',0,1,'L');
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20,5,$mod_strings['LBL_PDF_NAME'],0,1,'L');
$pdf->SetFont('arialpl', '', 10);
$pdf->Cell(20,5,html_entity_decode($this->name),0,1,'L');
}
*/
$pdf->SetFont('arialpl', '', 10);
$pdf->Ln(2);
// $current = $pdf->GetY();
//$pdf->MultiCell(120,4,$address,0,'L');
//$pdf->SetFont('arialpl','B','10');
//$pdf->MultiCell(0,4,$address_cnt,0,'L');
if($this->parent_type="Contacts")$pdf->Ln(14);
$current2 = $pdf->GetY();
$pdf->SetFont('arialpl','','10');
$subFontSizeold = $pdf->FontSizePt;
$pdf->SetFontSize($subFontSize);
/*
// reposition y
$subOffset = ((($subFontSize - $subFontSizeold) / $pdf->k) * 0.3) + ($subOffset / $pdf->k);
$subX = $pdf->x;
$subY = $pdf->y;
$pdf->SetXY($subX, $subY - $subOffset);
//Output text
$pdf->Write(5, 'test','');
// restore y position
$subX = $pdf->x;
$subY = $pdf->y;
$pdf->SetXY($subX, $subY + $subOffset);
// restore font size
$pdf->SetFontSize($subFontSizeold);
*/
// $pdf->Ln(7);
$pdf->SetXY($pdf->fw-$pdf->rMargin-37,$current);
$table = array();
$table [0]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_DATE_REGISTER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [1]['data'] = array('width' => 30, 'value' => date("d.m.Y"), 'border' => 0, 'overflow' => 1, 'align' => 'L');
$table [2]['data'] = array('width' => 30, 'value' => "", 'border' => 0, 'overflow' => 1, 'align' => 'L');
$r_created_by = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select first_name, last_name from users where id='".$this->modified_user_id."'"));
$table [4]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_OWNER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9); $table [4]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_OWNER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [5]['data'] = array('width' => 30, 'value' => $r_created_by['first_name']." ".$r_created_by['last_name'] , 'border' => 0, 'overflow' => 1, 'align' => 'L');
$table [6]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_ASSIGNED_TO'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
$table [7]['data'] = array('width' => 30, 'value' => $this->setUser()->full_name.'
tel.: '.$this->setUser()->phone_work.'
kom.: '.$this->setUser()->phone_mobile.'
e-mail: '.$this->setUser()->email1, 'border' => 0, 'overflow' => 1, 'align' => 'L');
$pdf->DrawTable($table, null, 0, 0, 3);
$pdf->SetY($current2-10);
$pdf->Ln(2);
$pdf->SetFont('arialpl','','14');
$pdf->MultiCell(0,0,"Proforma nr ".$this->document_no,0,'L');
$pdf->SetFont('arialpl','','9');
$pdf->Ln(5);
//$table = array();
// $table[0][0] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_PARENT_DOCUMENT_NO'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => '1', 'align' => 'L');
//$table[0][1] = array('width' => 80, 'value' => $this->parent_document_no, 'background' => array(255,255,255), 'border' => 0, 'overflow' => '1', 'align' => 'L');
// $pdf->DrawTable($table);
//$pdf->MultiCell(0,0,'Szablon dokumentu jest aktualnie przebudowywany.',0,'L');
$pdf->SetY($current2+5);
//$pdf->MultiCell(0,0,'Spróbuj za 30 min.',0,'L');
$this->loadParser();
$this->header_text = $this->template->mfp->parseText($this->header_text);
$this->footer_text = $this->template->mfp->parseText($this->footer_text);
$this->ads_text = $this->template->mfp->parseText($this->ads_text);
//header text
if($this->header_text){
$pdf->Ln(8);
$pdf->SetFont('arialpl','','10');
$pdf->MultiCell(0,4,$this->header_text,0,'J');
}
$pdf->Ln(8);
//**************************************************
global $mod_strings;
if(!isset($this->position_list) || !is_array($this->position_list))
$this->position_list = $this->getPositionList(true);
$calc = $this->calculate_currency($this->position_list,$this->currency_id, $this->currency_value);
$this->position_list = $this->formatPositions($this->position_list, $this->currency_id, $this->currency_value);
/*
$calc['total'] .= ' '.$this->currency_symbol;
$calc['subtotal'] .= ' '.$this->currency_symbol;
if($calc['discount']) {
$calc['total2'] .= ' '.$this->currency_symbol;
$calc['discount']['value'] .= ' '.$this->currency_symbol;
}
if(isset($calc['vats']) && is_array($calc['vats']) && count($calc['vats']) > 0)
foreach($calc['vats'] as $key => $value) $calc['vats'][$key] .= ' '.$this->currency_symbol;
*/
$name_w = 59;
$image_w = 10;
$recipient_code_w = 10;
if($this->show_images_on_offers){
$name_w -= $image_w;
}
if($this->show_recipient_code){
$name_w -= $recipient_code_w;
}
if($calc['draw_discount']){
$name_w -= 8;
}
if($calc['draw_vat']){
$name_w -= 8;
}
//jest rabat?
$rabat = false;
foreach($this->position_list as $p) {
if ($p['discount']!=0) $rabat=true;
}
if ($this->total_netto!='') $name_w+=35;
$table = array();
$table [0]['position'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_POSITION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
$table [0]['description'] = array('width' => $name_w, 'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
$table [0]['quantity'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'],'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
if ($this->total_netto=='') {
$table [0]['unit_price'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_PRICE'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
if ($rabat==true) {
$table [0]['discount'] = array('width' => 7, 'value' => $mod_strings['LBL_PDF_LIST_DISCOUNT'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C');
}
$table [0]['total'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_TOTAL'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'R');
}
$i = 1;
$lv=return_app_list_strings_language($this->ecmlanguage);
if($this->position_list != '')
// $result = $db->query("SELECT total_netto from ecmquotes where id=$p['id']");
foreach($this->position_list as $p) {
$table [$i]['position'] = array('width' => 5, 'value' => $i, 'border' => 0, 'align' => 'C', );
$name = str_replace('','-',htmlspecialchars_decode($p['name']));
$table [$i]['description'] = array('width' => $name_w, 'value' => $name, 'border' => 0, 'align' => 'L', );
$table [$i]['quantity'] = array('width' => 8, 'value' => $p['quantity'], 'border' => 0, 'align' => 'C', );
if ($this->total_netto=='') {
$table [$i]['unit_price'] = array('width' => 14, 'value' => $p['price'], 'border' => 0, 'align' => 'C', );
if ($rabat==true) {
if ($p['discount']==0) $tmp='---'; else $tmp=$p['discount'];
$table [$i]['discount'] = array('width' => 7, 'value' => $tmp, 'border' => 0, 'align' => 'R', );
}
$table [$i]['total'] = array('width' => 14, 'value' => $p['total'], 'border' => 0, 'align' => 'R', );
}
$tmp_sep = ereg_replace('[^0-9.,]', '', $p['total']);
$len = strlen($tmp_sep);
$separator = substr($tmp_sep, $len-3, 1);
if ($separator == '.') $tmp = (float) ereg_replace('[^0-9.]', '', $p['total']);
if ($separator == ',') $tmp = (float) ereg_replace('[^0-9,]', '', $p['total']);
if ($p['currency_id'] == 'PLN') {
if (isset($total_price_pln)) $total_price_pln += $tmp;
else $total_price_pln = $tmp;
}
if ($p['currency_id'] == '6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf') {
if (isset($total_price_eur)) $total_price_eur+= $tmp;
else $total_price_eur= $tmp;
}
$i++;
}
$starttab=$pdf->GetY()+10;
$pdf->DrawTable($table,array(0));
$endtab=$pdf->GetY();
$pdf->SetY($endtab);
//mz
$table = array();
//EURO
if($calc['vats']) {
$table [] = array(
'subtotal1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'subtotal2' => array('width' => 34, 'value' => $calc['subtotal'].' '.$calc['currency_symbol'], 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
foreach($calc['vats'] as $key => $value){
$r=mysql_fetch_array(mysql_query("select name from ecmvats where id='".$key."'"));
$vvn=$r['name'];
$table [] = array(
'vat1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_VAT'].' ('.$vvn.')', 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'vat2' => array('width' => 34, 'value' => $value.' '.$calc['currency_symbol'], 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
}
}
$table [] = array(
'total1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_END_TOTAL'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b'),
'total2' => array('width' => 34, 'value' => $calc['total'].' '.$calc['currency_symbol'], 'border' => 0, 'background' => array(233,233,233), 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b'), );
$pdf->DrawTable($table);
//PLN
/*
$starttab=$pdf->GetY()+1;
$pdf->SetY($starttab);
$table = array();
if($calc['vats_pln']) {
$table [] = array(
'subtotal1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'subtotal2' => array('width' => 34, 'value' => $calc['subtotal_pln'].' PLN', 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
foreach($calc['vats_pln'] as $key => $value){
$r=mysql_fetch_array(mysql_query("select name from ecmvats where id='".$key."'"));
$vvn=$r['name'];
$table [] = array(
'vat1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_VAT'].' ('.$vvn.')', 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9),
'vat2' => array('width' => 34, 'value' => $value.' PLN', 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9), );
}
}
$table [] = array(
'total1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_END_TOTAL'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b'),
'total2' => array('width' => 34, 'value' => $calc['subtotal_pln'].' PLN', 'border' => 0, 'background' => array(233,233,233), 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b'), );
$pdf->DrawTable($table);
*/
?>

View File

@@ -0,0 +1,72 @@
<?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');
}

View File

@@ -0,0 +1,793 @@
<?php
global $db;
$mod_strings['LBL_PDF_FOOTER_DOCUMENT_NAME'] = 'Zamówienie';
$pdf->focus = $this;
$pdf->Ln(2);
$pdf->SetY($pdf->GetY() + 2);
$current = $pdf->GetY();
$pdf->SetFont('arialpl', '', 9);
$pdf->MultiCell(100, 5, html_entity_decode($this->parent_name), 0, 1, 'L');
//$pdf->SetFont('arialpl', '', 10);
if ($this->parent_address_street) {
$pdf->Cell(20, 5, html_entity_decode($this->parent_address_street), 0, 1, 'L');
}
if (($this->parent_address_postalcode) || ($this->parent_address_city)) {
$pdf->Cell(20, 5, html_entity_decode($this->parent_address_postalcode) . ' ' . html_entity_decode($this->parent_address_city), 0, 1, 'L');
}
if ($this->to_vatid) {
$pdf->Cell(20, 5, $mod_strings['LBL_PDF_VATID'] . ' ' . html_entity_decode($this->to_vatid), 0, 1, 'L');
}
$title = '';
if ($this->parent_contact_title) {
$title.=$this->parent_contact_title . ' ';
}
if ($this->parent_contact_name) {
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20, 5, $title . $this->parent_contact_name, 0, 1, 'L');
$pdf->SetFont('arialpl', '', 10);
}
if ($this->parent_shipping_address_name || $this->parent_shipping_address_street) {
$x = $pdf->getX();
$y = $pdf->getY();
$pdf->setY($current+20);
$pdf->setX(25);
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(100, 5, $mod_strings['LBL_PDF_DELIVERY_TO'], 0, 1, 'L');
$pdf->SetFont('arialpl', '', 10);
$pdf->setX(25);
$pdf->MultiCell(100, 5, html_entity_decode($this->parent_shipping_address_name), 0, 1, 'L');
$pdf->setX(25);
if ($this->parent_shipping_address_street) {
$pdf->Cell(100, 5, html_entity_decode($this->parent_shipping_address_street), 0, 1, 'L');
}
$pdf->setX(25);
if (($this->parent_shipping_address_postalcode) || ($this->parent_shipping_address_city)) {
$pdf->Cell(20, 5, html_entity_decode($this->parent_shipping_address_postalcode) . ' ' . html_entity_decode($this->parent_shipping_address_city), 0, 1, 'L');
}
$pdf->setY($y);
$pdf->setX($x);
}
if ($this->name) {
$pdf->Cell(20, 5, '', 0, 1, 'L');
$pdf->SetFont('arialpl', 'b', 10);
$pdf->Cell(20, 5, $mod_strings['LBL_PDF_NAME'], 0, 1, 'L');
$pdf->SetFont('arialpl', '', 10);
$pdf->Cell(20, 5, html_entity_decode($this->name), 0, 1, 'L');
}
$pdf->SetFont('arialpl', '', 10);
$pdf->Ln(5);
if ($this->parent_type = "Contacts") {
$pdf->Ln(14);
}
$current2 = $pdf->GetY();
$pdf->SetFont('arialpl', '', '10');
$subFontSizeold = $pdf->FontSizePt;
$pdf->SetFontSize($subFontSize);
$pdf->SetXY($pdf->fw - $pdf->rMargin - 37, $current);
$table = array();
$table [0]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_DATE_REGISTER'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table [1]['data'] = array(
'width' => 30,
'value' => $this->register_date,
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
$table [2]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_VALIDTILL_DATE'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table [3]['data'] = array(
'width' => 30,
'value' => $this->delivery_date,
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
$table [4]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_OWNER'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table [5]['data'] = array(
'width' => 30,
'value' => $this->setUser()->full_name,
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
if ($this->parent_document_no && $this->parent_document_no!='') {
$table [6]['data'] = array(
'width' => 30,
'value' => $mod_strings['LBL_PDF_NUMBER'],
'border' => 0,
'overflow' => 1,
'align' => 'L',
'font-style' => 'b',
'font-size' => 9,
);
$table [7]['data'] = array(
'width' => 30,
'value' => $this->parent_document_no,
'border' => 0,
'overflow' => 1,
'align' => 'L',
);
}
$pdf->DrawTable($table, null, 0, 0, 3);
$pdf->SetY($current+10);
$pdf->SetX(70);
//$pdf->Ln(8);
$pdf->SetFont('arialpl', '', '18');
$pdf->MultiCell(0, 0, $mod_strings['LBL_PDF_DOCUMENT_NAME'] . " " . $this->document_no, 0, 'L');
//$pdf->MultiCell(0,0,'Szablon dokumentu jest aktualnie przebudowywany.',0,'L');
$pdf->SetY($current2 + 15);
//$pdf->MultiCell(0,0,'Spróbuj za 30 min.',0,'L');
//$this->loadParser();
$this->header_text = $this->template->mfp->parseText($this->header_text);
$this->footer_text = $this->template->mfp->parseText($this->footer_text);
$this->ads_text = $this->template->mfp->parseText($this->ads_text);
//header text
if ($this->header_text) {
$pdf->Ln(8);
$pdf->SetFont('arialpl', '', '10');
$pdf->MultiCell(0, 4, $this->header_text, 0, 'J');
}
$pdf->Ln(8);
//**************************************************
global $mod_strings;
$currency = new Currency();
$currency->retrieve($this->currency_id);
$this->currency_symbol = $currency->iso4217;
if (!isset($this->position_list) || !is_array($this->position_list)) {
//$this->position_list = $this->formatPositions($this->position_list, $this->currency_id , $this->currency_value );
$this->position_list = $this->getPositionList(true);
}
//$calc = $this->calculate_currency($this->position_list, $this->currency_id , $this->currency_value );
//$this->position_list = $this->formatPositions($this->position_list, $this->currency_id , $this->currency_value );
$calc = $this->calculate($this->position_list, true );
/*
$calc['total'] .= ' ' . $this->currency_symbol;
$calc['subtotal'] .= ' ' . $this->currency_symbol;
*/
/*
if ($calc['discount']) {
$calc['total2'] .= ' ' . $this->currency_symbol;
$calc['discount']['value'] .= ' ' . $this->currency_symbol;
}
*/
/*
if (isset($calc['vats']) && is_array($calc['vats']) && count($calc['vats']) > 0) {
foreach ($calc['vats'] as $key => $value) {
$calc['vats'][$key] .= ' ' . $this->currency_symbol;
}
}
*/
/*
echo '<pre>' . var_export($calc, true);
echo '<pre>' . var_export($this->position_list, true);
exit;
*/
$widths = array(
'position' => 5,
'description' => 60,
'quantity' => 8,
'unit_price' => 15,
'discount' => 8,
'total' => 15,
//
'fix' => 73 - 8,
'subtotal1' => 15 + 8, // 66
'subtotal2' => 15, // 34
);
$image_w = 10;
$recipient_code_w = 10;
if ($this->show_images_on_offers) {
$widths['description'] -= $image_w;
}
if ($this->show_recipient_code) {
$widths['description'] -= $recipient_code_w;
}
/*
if ($calc['draw_discount']) {
//$widths['description'] -= 8;
}
if ($calc['draw_vat']) {
$widths['description'] -= 8;
}
*/
//jest rabat?
$rabat = false;
foreach ($this->position_list as $p) {
if ($p['discount'] != 0)
$rabat = true;
}
if ($rabat) {
$widths['description'] -= $widths['discount'];
$widths['fix'] -= $widths['discount'];
$widths['subtotal2'] += $widths['discount'];
}
if ($this->total_netto != '') {
$widths['description']+=35;
}
$widths['description'] = $widths['description'] - 20;
$widths['code'] = 20;
$table = array();
$table [0]['position'] = array(
'width' => $widths['position'],
'value' => $mod_strings['LBL_PDF_LIST_POSITION'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
$table [0]['code'] = array(
'width' => $widths['code'],
'value' => $mod_strings['LBL_PDF_LIST_CODE'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
$table [0]['description'] = array(
'width' => $widths['description'],
'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
$table [0]['quantity'] = array(
'width' => $widths['quantity'],
'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
if ($this->total_netto == '') {
$table [0]['unit_price'] = array(
'width' => $widths['unit_price'],
'value' => $mod_strings['LBL_PDF_LIST_PRICE'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
if ($rabat == true) {
$table [0]['discount'] = array(
'width' => $widths['discount'],
'value' => $mod_strings['LBL_PDF_LIST_DISCOUNT'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'C',
);
}
$table [0]['total'] = array(
'width' => $widths['total'],
'value' => $mod_strings['LBL_PDF_LIST_TOTAL'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'R',
);
}
$i = 1;
$lv = return_app_list_strings_language($this->ecmlanguage);
if ($this->position_list != '') {
// $p = array_pop($this->position_list);
// $this->position_list = array_fill(0, 100, $p);
//
// $result = $db->query("SELECT total_netto from ecmquotes where id=$p['id']");
foreach ($this->position_list as $p) {
$table [$i]['position'] = array(
'width' => $widths['position'],
'value' => $i,
'border' => 1,
'align' => 'C',
);
$name = str_replace('', '-', htmlspecialchars_decode($p['name']));
$table [$i]['code'] = array(
'width' => $widths['code'],
'value' => $p['code'],
'border' => 1,
'align' => 'L',
);
$table [$i]['description'] = array(
'width' => $widths['description'],
'value' => $name,
'border' => 1,
'align' => 'L',
);
$table [$i]['quantity'] = array(
'width' => $widths['quantity'],
'value' =>format_number($p['quantity'],null,null,null,0),
'border' => 1,
'align' => 'C',
);
if ($this->total_netto == '') {
$table [$i]['unit_price'] = array(
'width' => $widths['unit_price'],
//'value' => format_number($p['price']) . ' ' . $this->currency_symbol,
'value' => format_number($p['price']),
'border' => 1,
'align' => 'R',
);
if ($rabat == true) {
if ($p['discount'] == 0) {
$tmp = '---';
} else {
$tmp = $p['discount'];
}
$table [$i]['discount'] = array(
'width' => $widths['discount'],
'value' => format_number($tmp) . '%',
'border' => 1,
'align' => 'R',
);
}
$table [$i]['total'] = array(
'width' => $widths['total'],
//'value' => format_number($p['total']) . ' ' . $this->currency_symbol,
'value' => format_number($p['total']),
'border' => 1,
'align' => 'R',
);
}
$tmp_sep = ereg_replace('[^0-9.,]', '', $p['total']);
$len = strlen($tmp_sep);
$separator = substr($tmp_sep, $len - 3, 1);
if ($separator == '.') {
$tmp = (float) ereg_replace('[^0-9.]', '', $p['total']);
}
if ($separator == ',') {
$tmp = (float) ereg_replace('[^0-9,]', '', $p['total']);
}
if ($p['currency_id'] == 'PLN') {
if (isset($total_price_pln)) {
$total_price_pln += $tmp;
} else {
$total_price_pln = $tmp;
}
}
if ($p['currency_id'] == '6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf') {
if (isset($total_price_eur)) {
$total_price_eur+= $tmp;
} else {
$total_price_eur = $tmp;
}
}
$i++;
}
}
$starttab = $pdf->GetY() + 10;
$pdf->DrawTable($table, array(0));
//EURO
/*
if ($calc['vats_eur']) {
$endtab = $pdf->GetY();
$pdf->SetY($endtab);
$table = array();
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_TOTAL'],
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $calc['subtotal_eur'] . ' EUR',
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
foreach ($calc['vats_eur'] as $key => $value) {
$r = mysql_fetch_array(mysql_query("select name from ecmvats where id='" . $key . "'"));
$vvn = $r['name'];
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_VAT'] . ' (' . $vvn . ')',
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $value . ' EUR',
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
}
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_END_TOTAL'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
'font-style' => 'b',
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $calc['subtotal_eur'] . ' EUR',
'border' => 1,
'background' => array(233, 233, 233),
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
'font-style' => 'b',
),
);
$pdf->Ln(4);
$pdf->DrawTable($table);
}
if ($calc['vats_pln']) {
//PLN
$starttab = $pdf->GetY() + 4;
$pdf->SetY($starttab);
$table = array();
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_TOTAL'],
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $calc['subtotal_pln'] . ' PLN',
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
foreach ($calc['vats_pln'] as $key => $value) {
$r = mysql_fetch_array(mysql_query("select name from ecmvats where id='" . $key . "'"));
$vvn = $r['name'];
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_VAT'] . ' (' . $vvn . ')',
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $value . ' PLN',
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
}
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_END_TOTAL'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
'font-style' => 'b',
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $calc['subtotal_pln'] . ' PLN',
'border' => 1,
'background' => array(233, 233, 233),
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
'font-style' => 'b',
),
);
$pdf->DrawTable($table);
}
*/
if ($calc['vats']) {
$starttab = $pdf->GetY() + 4;
$pdf->SetY($starttab);
$table = array();
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_TOTAL'],
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $calc['subtotal'] . ' ' . $this->currency_symbol,
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
if ($this->invoice_type!='U') {
foreach ($calc['vats'] as $key => $value) {
$r = mysql_fetch_array(mysql_query("select name from ecmvats where id='" . $key . "'"));
$vvn = $r['name'];
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_VAT'] . ' (' . $vvn . ')',
'background' => array(255, 255, 255),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $value . ' ' . $this->currency_symbol,
'border' => 1,
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
),
);
}
$table[] = array(
'fix' => array(
'width' => $widths['fix'],
'value' => '',
'border' => 0,
'overflow' => 1,
'align' => 'C',
'font-style' => 'b',
'font-size' => 7,
),
'subtotal1' => array(
'width' => $widths['subtotal1'],
'value' => $mod_strings['LBL_PDF_END_TOTAL'],
'background' => array(233, 233, 233),
'border' => 1,
'overflow' => 1,
'align' => 'L',
'font-size' => 9,
'font-style' => 'b',
),
'subtotal2' => array(
'width' => $widths['subtotal2'],
'value' => $calc['total'] . ' ' . $this->currency_symbol ,
'border' => 1,
'background' => array(233, 233, 233),
'overflow' => 1,
'align' => 'R',
'font-size' => 9,
'font-style' => 'b',
),
);
}
$pdf->DrawTable($table);
}