191 lines
9.1 KiB
PHP
Executable File
191 lines
9.1 KiB
PHP
Executable File
<?
|
|
global $app_list_strings;
|
|
|
|
|
|
$address = str_replace("<","<",str_replace(">",">",$this->parent_name));
|
|
if($this->parent_contact_name) {
|
|
$address .= "\n".$this->parent_contact_name;
|
|
if($this->parent_contact_title) {
|
|
$address .= "\n".$this->parent_contact_title;
|
|
}
|
|
$personplus=5;
|
|
}
|
|
else $personplus=0;
|
|
|
|
if($this->parent_address_street) $address .= "\n".str_replace("\n","",$this->parent_address_street);
|
|
if($this->parent_address_postalcode) $address .= "\n".$this->parent_address_postalcode;
|
|
if($this->parent_address_city) $address .= " ".$this->parent_address_city;
|
|
if($this->to_nip) $address .= "\n".$mod_strings['LBL_PDF_NIP'].": ".$this->to_nip;
|
|
elseif(!$this->to_nip && $this->to_vatid) $address .= "\n".$mod_strings['LBL_PDF_NIP'].": ".$this->to_vatid;
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select iln from accounts where id='".$this->parent_id."'"));
|
|
if($r['iln'])$address .= "\nILN: ".$r['iln'];
|
|
|
|
//to address
|
|
$old_x=$pdf->GetX();
|
|
$old_y=$pdf->GetY();
|
|
|
|
$pdf->SetXY(25,37);
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
|
$pdf->Cell(35,1,"WYSTAWCA:",0,0,'L',1);
|
|
$pdf->Ln(3);
|
|
$pdf->SetX(25);
|
|
$pdf->SetFont('arialpl', '', 8);
|
|
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select vatid from accounts where id='".$pdf->edt->account_id."'"));
|
|
if($r['vatid'])$pdf->edt->header_text .= "\nNip: ".$r['vatid'];
|
|
if($r['iln'])$pdf->edt->header_text .= "\nILN: ".$r['iln'];
|
|
$pdf->MultiCell(60,4,$pdf->edt->header_text,0,'L');
|
|
|
|
$pdf->SetXY(81,37);
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
|
$pdf->Cell(35,1,"ODBIORCA:",0,0,'L',1);
|
|
$pdf->Ln(3);
|
|
$pdf->SetX(81);
|
|
$pdf->SetFont('arialpl', '', 8);
|
|
$pdf->MultiCell(60,4,$address,0,'L');
|
|
|
|
|
|
$pdf->SetXY(160,$old_y+10+$personplus);
|
|
|
|
$table = array();
|
|
|
|
$table [1]['date_reg'] = array('width' => 20, 'value' => $mod_strings['LBL_PDF_DATE_REGISTER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 8);
|
|
$table [1]['date_reg_value'] = array('width' => 36, 'value' => $this->register_date, 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 8);
|
|
$table [2]['date_end'] = array('width' => 20, 'value' => "Data zakonczenia", 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 8);
|
|
$table [2]['date_end_value'] = array('width' => 36, 'value' => $this->end_date, 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 8);
|
|
|
|
$table [3]['data'] = array('width' => 20, 'value' => $mod_strings['LBL_PDF_OWNER'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 8);
|
|
$table [3]['data_value'] = array('width' => 36, 'value' => $this->setUser()->full_name, 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 8);
|
|
|
|
$rs=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$this->pw_stock_id."'"));
|
|
$table [4]['pw'] = array('width' => 20, 'value' => "Magazyn dokumentu PW", 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 8);
|
|
$table [4]['pw_value'] = array('width' => 36, 'value' => $rs['name'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 8);
|
|
|
|
$rs=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$this->rw_stock_id."'"));
|
|
$table [5]['rw'] = array('width' => 20, 'value' => "Magazyn dokumentu RW", 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 8);
|
|
$table [5]['rw_value'] = array('width' => 36, 'value' => $rs['name'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 8);
|
|
|
|
$emp=str_replace("|","
|
|
",$this->employers);
|
|
$table [6]['data'] = array('width' => 20, 'value' => "Osoby", 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 8);
|
|
$table [6]['data_value'] = array('width' => 36, 'value' => $emp, 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 8);
|
|
|
|
$pdf->SetXY(143,$pdf->tMargin);
|
|
$pdf->DrawTable($table, null, 0.5, 0.5, 3);
|
|
|
|
|
|
$pdf->Ln(9);
|
|
|
|
$pdf->SetFont('arialpl','','18');
|
|
$pdf->SetXY(60,$pdf->tMargin+10);
|
|
|
|
$pdf->MultiCell(80,7,$mod_strings['LBL_PDF_DOCUMENT_NAME']." ".$this->document_no,0,'C');
|
|
$pdf->SetFont('arialpl', 'B', 7);
|
|
$pdf->Ln(3);
|
|
|
|
$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);
|
|
|
|
$pdf->SetY($ynew);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$pdf->SetFont('arialpl','','7');
|
|
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);
|
|
$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;
|
|
|
|
|
|
|
|
$pdf->Ln(7);
|
|
$name_w = 41;
|
|
$table = array();
|
|
|
|
$table [0]['position'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_POSITION'], 'border' => 1,'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['code'] = array('width' => 12, 'value' => "Index", 'border' => 1,'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['description'] = array('width' => $name_w, 'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'], 'border' => 1, 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['quantity'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'], 'border' => 1,'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['prod_quantity'] = array('width' => 8, 'value' => "Il. prod", 'border' => 1,'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['unit_price'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_PRICE'], 'border' => 1,'font-style' => 'b', 'overflow' => 1, 'align' => 'C');
|
|
$table [0]['total'] = array('width' => 14, 'value' => "Suma netto", 'border' => 1,'font-style' => 'b', 'overflow' => 1, 'align' => 'R');
|
|
$pdf->SetY(60);
|
|
if($this->header_text){
|
|
$pdf->MultiCell(80,4,$this->header_text,0,'L');$pdf->Ln();
|
|
}
|
|
$pdf->DrawTable($table,array(0));
|
|
$pdf->Ln(0);
|
|
|
|
$table=array();
|
|
$i = 1;
|
|
|
|
if($this->position_list != '')
|
|
foreach($this->position_list as $p) {
|
|
if($p['component']!=1){
|
|
$no++;
|
|
$n=$no;
|
|
$up=format_number($p['price']).' '.$this->currency_symbol;
|
|
$tot=format_number($p['total']).' '.$this->currency_symbol;
|
|
}
|
|
else {
|
|
$n="";
|
|
$up="";
|
|
$tot="";
|
|
}
|
|
if($p['prod_quantity']==0)$pq="";
|
|
else $pq=$p['prod_quantity'];
|
|
$table [$i]['position'] = array('width' => 5, 'value' => $n, 'border' => 1, 'align' => 'C', );
|
|
$table [$i]['code'] = array('width' => 12, 'value' => $p['code'], 'border' => 1, 'align' => 'C', );
|
|
$table [$i]['description'] = array('width' => $name_w, 'value' => htmlspecialchars_decode($p['name']), 'border' => 1, 'align' => 'L', );
|
|
$table [$i]['quantity'] = array('width' => 8, 'value' => $p['quantity'], 'border' => 1, 'align' => 'C', );
|
|
$table [$i]['prod_quantity'] = array('width' => 8, 'value' => $pq, 'border' => 1, 'align' => 'C', );
|
|
$table [$i]['unit_price'] = array('width' => 14, 'value' => $up, 'border' => 1, 'align' => 'C');
|
|
$table [$i]['total'] = array('width' => 14, 'value' => $tot, 'border' => 1, 'align' => 'R', );
|
|
$i++;
|
|
}
|
|
$pdf->DrawTable($table,array(0));
|
|
|
|
|
|
$pdf->Ln(4);
|
|
$pr = ($pdf->fw-$pdf->lMargin-$pdf->rMargin)/100;
|
|
$table = array();
|
|
|
|
$table [] = array(
|
|
'total1' => array('width' => 16,'font-style' => 'b', 'value' => "Suma netto",'border' => 1, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b'),
|
|
'total2' => array('width' => 28, 'value' => $calc['total'], 'border' => 1, 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b'),
|
|
);
|
|
|
|
if($pdf->GetY()+30>$pdf->fh-$pdf->bMargin)$pdf->AddPage();
|
|
$pdf->SetX(124);
|
|
$pdf->DrawTable($table);
|
|
$pdf->Ln(10);
|
|
|
|
$pdf->Cell(85,1,".........................................................",0,0,'L',1);
|
|
$pdf->Cell(85,1,".........................................................",0,0,'R',1);
|
|
$pdf->Ln(3);
|
|
$pdf->SetFont('arialpl','','5');
|
|
$pdf->Cell(85,1," (podpis produkujacego)",0,0,'L',1);
|
|
$pdf->Cell(85,1,"(podpis kontrolujacego) ",0,0,'R',1);
|
|
|
|
?>
|