212 lines
10 KiB
PHP
Executable File
212 lines
10 KiB
PHP
Executable File
<?
|
|
$pdf->SetAutoPageBreak(true,50);
|
|
$pdf->Ln(2);
|
|
|
|
$pdf->SetFont('arialpl', '', 20);
|
|
$pdf->MultiCell(150,0,$this->document_no,0,'C');
|
|
|
|
$pdf->Ln(2);
|
|
$pdf->SetFont('arialpl', '', 10);
|
|
$current = $pdf->GetY();
|
|
//$pdf->MultiCell(0,4,$address,0,'L');
|
|
$current2 = $pdf->GetY();
|
|
|
|
//$current = $pdf->GetY();
|
|
//$pdf->Ln(7);
|
|
$pdf->SetXY($pdf->fw-$pdf->rMargin-30,36);
|
|
$table = array();
|
|
$table [0]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_NUMBER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
|
|
$table [1]['data'] = array('width' => 30, 'value' => $this->document_no, 'border' => 0, 'overflow' => 1, 'align' => 'L');
|
|
$table [2]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_DATE_REGISTER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
|
|
$table [3]['data'] = array('width' => 30, 'value' => $this->register_date, 'border' => 0, 'overflow' => 1, 'align' => 'L');
|
|
$table [4]['data'] = array('width' => 30, 'value' => "Data dostawy", 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
|
|
$table [5]['data'] = array('width' => 30, 'value' => $this->delivery_date, 'border' => 0, 'overflow' => 1, 'align' => 'L');
|
|
|
|
$next = 6;
|
|
if(isset($this->validtill_date) && $this->validtill_date != '') {
|
|
$table [$next++]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_VALIDTILL_DATE'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
|
|
$table [$next++]['data'] = array('width' => 30, 'value' => $this->validtill_date, 'border' => 0, 'overflow' => 1, 'align' => 'L');
|
|
}
|
|
|
|
|
|
$table [$next++]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_OWNER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9);
|
|
$table [$next++]['data'] = array('width' => 30, 'value' => $this->setUser()->full_name, 'border' => 0, 'overflow' => 1, 'align' => 'L');
|
|
$pdf->DrawTable($table, null, 0.5, 0.5, 3);
|
|
|
|
$pdf->SetY($current2);
|
|
|
|
$pdf->Ln(12);
|
|
|
|
$pdf->SetFont('arialpl','','22');
|
|
|
|
//$pdf->SetY(28);
|
|
//$pdf->SetX(65);
|
|
//$pdf->MultiCell(90,10,$this->name,70,'C');
|
|
$yaftername=$pdf->GetY()+7;
|
|
|
|
|
|
if(isset($this->validtill_date) && $this->validtill_date != '') $pdf->Ln(9);
|
|
|
|
|
|
//$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);
|
|
|
|
//wystawca
|
|
$pdf->SetXY(25,15);
|
|
$pdf->SetFont('arialpl', '', 8);
|
|
$pdf->MultiCell(60,4,$pdf->edt->header_text,0,'L');
|
|
|
|
|
|
|
|
//Odbiorca:
|
|
|
|
$pdf->Ln(20);
|
|
|
|
$pdf->SetFont('arialpl','B','10');
|
|
|
|
$pdf->SetY(36);
|
|
$pdf->MultiCell(0,4,"Odbiorca",0,'J');
|
|
$pdf->Ln(1);
|
|
$pdf->SetFont('arialpl','','10');
|
|
$pdf->MultiCell(0,4,$this->parent_name,0,'J');
|
|
if($this->parent_address_street) $pdf->MultiCell(0,4,$this->parent_address_street,0,'J');
|
|
if($this->parent_address_postalcode) $city = $this->parent_address_postalcode;
|
|
if($this->parent_address_city) $city.=" ".$this->parent_address_city;
|
|
if ($city) $pdf->MultiCell(0,4,$city,0,'J');
|
|
|
|
|
|
$pdf->Ln(20);
|
|
$pdf->SetY($yaftername);
|
|
|
|
|
|
|
|
|
|
//********************
|
|
global $mod_strings;
|
|
if(!isset($this->position_list) || !is_array($this->position_list))
|
|
$this->position_list = $this->getPositionList(true);
|
|
$calc = $this->calculate($this->position_list,true);
|
|
$this->position_list = $this->formatPositions($this->position_list);
|
|
|
|
$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;
|
|
|
|
|
|
|
|
$pdf->Ln(7);
|
|
$name_w = 43;
|
|
$table = array();
|
|
|
|
$table [0]['image'] = array('width' => 10, 'value' => $mod_strings['LBL_PDF_LIST_IMAGE'], 'border' => 0,'background' => array(233,233,233), 'overflow' => 1, 'align' => 'R');
|
|
$table [0]['position'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_POSITION'], 'border' => 0,'background' => array(233,233,233),'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['code'] = array('width' => 16, 'value' => "Index\nEAN\nVendor index", 'border' => 0,'background' => array(233,233,233),'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['description'] = array('width' => 31, 'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'], 'border' => 0,'background' => array(233,233,233),'font-style'=>'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['quantity'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'], 'border' => 0,'background' => array(233,233,233),'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['unit'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_UNIT'], 'border' => 0,'background' => array(233,233,233),'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['unit_price'] = array('width' => 12, 'value' => $mod_strings['LBL_PDF_LIST_PRICE'], 'border' => 0,'background' => array(233,233,233),'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['total'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_TOTAL'], 'border' => 0,'background' => array(233,233,233),'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$pdf->SetY(70);
|
|
$pdf->DrawTable($table,array(0));
|
|
$pdf->Ln(0);
|
|
|
|
$table=array();
|
|
$i = 1;
|
|
$ii =1;
|
|
$lv=return_app_list_strings_language($this->ecmlanguage);
|
|
|
|
if($this->position_list != '')
|
|
foreach($this->position_list as $p) {
|
|
|
|
$p_image=$this->getProductImage($p['id']);
|
|
|
|
if(file_exists($p_image)){$table [$i]['image'] = array('width' => 10, 'value' => '', 'border' => 0, 'align' => 'R', 'image_path' => $p_image);
|
|
}
|
|
else $table [$i]['image'] = array('width' => 10, 'value' => '', 'border' => 0, 'align' => 'R');
|
|
|
|
|
|
$table [$i]['position'] = array('width' => 5, 'value' => $ii, 'border' => 0, 'align' => 'C', );
|
|
|
|
$query = "SELECT ean FROM ecmproduct_language WHERE ecmproduct_id='".$p['id']."' AND language='".substr($this->ecmlanguage, 0, 2)."';";
|
|
$result = $GLOBALS['db']->query($query);
|
|
$ean = $GLOBALS['db']->fetchByAssoc($result);
|
|
if (empty($ean['ean'])) {
|
|
// try only pl
|
|
$query = "SELECT ean FROM ecmproduct_language WHERE ecmproduct_id='".$p['id']."' AND language='pl';";
|
|
$result = $GLOBALS['db']->query($query);
|
|
$ean = $GLOBALS['db']->fetchByAssoc($result);
|
|
}
|
|
if (empty($ean['ean'])) $ean='-'; else $ean=$ean['ean'];
|
|
$query = "SELECT vendor_part_no FROM ecmproducts WHERE id='".$p['id']."';";
|
|
$result = $GLOBALS['db']->query($query);
|
|
$vpn = $GLOBALS['db']->fetchByAssoc($result);
|
|
if (empty($vpn['vendor_part_no'])) $vpn='-'; else $vpn=$vpn['vendor_part_no'];
|
|
|
|
$table [$i]['code'] = array('width' => 16, 'value' => $p['code']."\n".$ean."\n".$vpn, 'border' => 0, 'align' => 'C', );
|
|
$table [$i]['description'] = array('width' => 31, 'value' => htmlspecialchars_decode($p['name']), 'border' => 0, 'align' => 'L', );
|
|
$table [$i]['quantity'] = array('width' => 8, 'value' => $p['quantity'], 'border' => 0, 'align' => 'C', );
|
|
$table [$i]['unit'] = array('width' => 5, 'value' => $lv['ecmproducts_unit_dom'][$p['unit_id']], 'border' => 0, 'align' => 'C', 'font-size' => 7 );
|
|
$table [$i]['unit_price'] = array('width' => 12, 'value' => $p['price'], 'border' => 0, 'align' => 'C', );
|
|
$table [$i]['total'] = array('width' => 14, 'value' => $p['total'], 'border' => 0, 'align' => 'R', );
|
|
$i++;
|
|
$table [$i]['image'] = array('width' => 100, 'font-style'=>'b', 'value' => '___________________________________________________________________________________________________________','border'=>'0', 'align' => 'R',);
|
|
$i++;
|
|
$ii++;
|
|
}
|
|
$pdf->DrawTable($table,array(0));
|
|
|
|
$endtab=$pdf->GetY();
|
|
$pdf->SetY($endtab);
|
|
|
|
$pdf->SetAutoPageBreak(true,45);
|
|
|
|
$pdf->Ln(4);
|
|
$pr = ($pdf->fw-$pdf->lMargin-$pdf->rMargin)/100;
|
|
$table = array();
|
|
|
|
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'], '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, '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'], 'border' => 0, 'background' => array(233,233,233), 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b'),
|
|
);
|
|
|
|
//if($pdf->GetY()+30>$pdf->fh-$pdf->bMargin)$pdf->AddPage();
|
|
//$pdf->SetX(127);
|
|
$pdf->DrawTable($table);
|
|
|
|
//show ads text
|
|
$pdf->SetY($pdf->GetY()+20);
|
|
$pdf->SetFont('arialpl', '', 10);
|
|
$pdf->MultiCell(0,4,$this->ads_text,0,'J');
|
|
|
|
|
|
$pdf->SetAutoPageBreak(true,50);
|
|
|
|
?>
|