Files
crm.e5.pl/modules/templates/EcmQuotes/hoffmann/subheader.php
2024-04-27 09:23:34 +02:00

223 lines
12 KiB
PHP
Executable File

<?php
$pdf->SetXY(135,37); $pdf->SetFont('courier','',10); $pdf->Cell(30,0,"Angebot-Nr."); $pdf->SetFont('courier','B',10); $pdf->Cell(30,0,trim($this->document_no));
$pdf->SetXY(135,41.5); $pdf->SetFont('courier','',10); $pdf->Cell(30,0,"vom"); $pdf->SetFont('courier','B',10); $pdf->Cell(30,0,$this->register_date);
$pdf->SetXY(135,46); $pdf->SetFont('courier','',10); $pdf->Cell(30,0,"Kunde-Nr."); $pdf->SetFont('courier','B',10); $pdf->Cell(30,0,$this->getAccount()->customerno_c);
$pdf->SetFont('courier','',10);
$pdf->SetXY(135,53); $pdf->Cell(30,0,"Außendienst"); //$pdf->Cell(30,0,"");
$pdf->SetXY(135,57.5); $pdf->Cell(30,0,"Mobil"); //$pdf->Cell(30,0,"");
$pdf->SetXY(135,63); $pdf->Cell(30,0,"Innendienst"); $pdf->Cell(30,0,$this->setUser()->full_name);
$pdf->SetXY(135,66.5); $pdf->Cell(30,0,"Telefon"); $pdf->Cell(30,0,$this->setUser()->phone_work);
$pdf->SetXY(135,71); $pdf->Cell(30,0,"Unser Zeichen"); $pdf->Cell(30,0,"mh/an");
$pdf->SetXY(135,78); $pdf->Cell(30,0,"Anfrage vom"); //$pdf->Cell(30,0,"");
$pdf->SetXY(135,82.5); $pdf->Cell(30,0,"durch"); //$pdf->Cell(30,0,"");
$pdf->SetXY(135,87); $pdf->Cell(30,0,"Ihre Anfrage"); //$pdf->Cell(30,0,"");
$pdf->SetXY(135,91.5); $pdf->Cell(30,0,"Seite:"); $pdf->Cell(30,0,$pdf->PageNo());
$pdf->SetFont('courier','b',14);
$pdf->SetXY(20,89);
$pdf->Cell(0,0,"A N G E B O T");
$pdf->SetFont('courier','',10);
$pdf->SetXY(20,96);
$pdf->Cell(0,0,"Lieferanschrift");
$pdf->SetFont('courier','',10);
$addr_pos = 102;
$pdf->SetXY(25,$addr_pos);
$pdf->Cell(0,0,$this->parent_name);
if($this->parent_contact_name) {
$addr_pos += 4;
$pdf->SetXY(25,$addr_pos);
$pdf->Cell(0,0,$this->parent_contact_name);
if($this->parent_contact_title) {
$addr_pos += 4;
$pdf->SetXY(25,$addr_pos);
$pdf->Cell(0,0,$this->parent_contact_title);
}
}
if($this->parent_address_street) {
$addr_pos += 4;
$pdf->SetXY(25,$addr_pos);
$pdf->Cell(0,0,$this->parent_address_street);
}
if($this->parent_address_postalcode) {
$addr_pos += 6;
$pdf->SetXY(25,$addr_pos);
$pdf->Cell(0,0,$this->parent_address_postalcode.($this->parent_address_city ? (" ".$this->parent_address_city) : ""));
}
if($this->to_vatid) {
$addr_pos += 6;
$pdf->SetXY(25,$addr_pos);
$pdf->Cell(0,0,$mod_strings['LBL_PDF_VATID']." ".$this->to_vatid);
}
$addr_pos += 3;
$pdf->SetXY(25,$addr_pos);
$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);
if($this->header_text != '') {
//header text
$pdf->Ln(8);
$pdf->SetFont('courier','','10');
$pdf->MultiCell(0,4,$this->header_text,0,'J');
}
$pdf->Ln(10);
//*************
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;
$name_w = 47;
$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;
}
$table = array();
$table [0]['position'] = array('width' => 5, 'value' => $mod_strings['LBL_PDF_LIST_POSITION'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-family' => 'courier');
if($this->show_images_on_offers)
$table [0]['image'] = array('width' => $image_w, 'value' => $mod_strings['LBL_PDF_LIST_IMAGE'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-family' => 'courier');
$table [0]['code'] = array('width' => 12, 'value' => $mod_strings['LBL_PDF_LIST_CODE'],'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-family' => 'courier');
if($this->show_recipient_code)
$table [0]['recipient_code'] = array('width' => 10, 'value' => $mod_strings['LBL_PDF_LIST_RECIPIENT_CODE'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'C', 'font-family' => 'courier');
//$table [0]['unit'] = array('width' => 10, 'value' => $mod_strings['LBL_PDF_LIST_UNIT'],'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(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-family' => 'courier');
$table [0]['quantity'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'],'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'C', 'font-family' => 'courier');
$table [0]['unit_price'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_PRICE'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'C', 'font-family' => 'courier');
if($calc['draw_discount']) $table [0]['discount'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_DISCOUNT'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-family' => 'courier');
if($calc['draw_vat']) $table [0]['vat_id'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_VAT'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-family' => 'courier');
$table [0]['total'] = array('width' => 14, 'value' => $mod_strings['LBL_PDF_LIST_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-family' => 'courier');
$pdf->DrawTable($table,array(0));
$pdf->SetLineWidth(0);
$pdf->SetDrawColor(0,0,0);
$pdf->Line($pdf->lMargin,$pdf->getY(),$pdf->fw-$pdf->rMargin,$pdf->getY());
$pdf->Ln(1);
$table = array();
$i = 1;
$lv=return_app_list_strings_language($this->ecmlanguage);
if($this->position_list != '')
foreach($this->position_list as $p) {
$table [$i]['position'] = array('width' => 5, 'value' => $i, 'border' => 0, 'align' => 'L', 'font-family' => 'courier');
if($this->show_images_on_offers){
if(file_exists($this->getProductImage($p['id']))){
$table [$i]['image'] = array('width' => $image_w, 'value' => '', 'border' => 0, 'align' => 'R', 'image_path' => $this->getProductImage($p['id']));
//$iarr[]=$this->getProductImage($p['id']);
}
else $table [$i]['image'] = array('width' => $image_w, 'value' => '', 'border' => 0, 'align' => 'R', 'font-family' => 'courier');
}
$table [$i]['code'] = array('width' => 12, 'value' => $p['code'], 'border' => 0, 'align' => 'L', 'font-family' => 'courier');
if($this->show_recipient_code)
$table [$i]['recipient_code'] = array('width' => $recipient_code_w, 'value' => $p['recipient_code'], 'border' => 0, 'align' => 'C', 'font-family' => 'courier');
//$table [$i]['unit'] = array('width' => 10, 'value' => $p['unit_id'], 'border' => 0, 'align' => 'C', );
/*
if($this->ecmlanguage=="en_us"){
$r=mysql_fetch_array(mysql_query("select short_description from ecmproduct_language_en_view where ecmproduct_id='".$p['id']."'"));
$dname=$r['short_description'];
}
elseif($this->ecmlanguage=="ge_ge"){
$r=mysql_fetch_array(mysql_query("select short_description from ecmproduct_language_de_view where ecmproduct_id='".$p['id']."'"));
$dname=$r['short_description'];
}
else $dname=$p['name'];
*/
$table [$i]['description'] = array('width' => $name_w, 'value' => htmlspecialchars_decode($p['name']), 'border' => 0, 'align' => 'L', 'font-family' => 'courier');
$table [$i]['quantity'] = array('width' => 8, 'value' => $p['quantity'], 'border' => 0, 'align' => 'C', 'font-family' => 'courier');
$table [$i]['unit_price'] = array('width' => 14, 'value' => $p['price'], 'border' => 0, 'align' => 'C', 'font-family' => 'courier');
if($calc['draw_discount']) $table [$i]['discount'] = array('width' => 8, 'value' => $p['discount'], 'border' => 0, 'align' => 'R', 'font-family' => 'courier');
if($calc['draw_vat']) $table [$i]['vat_id'] = array('width' => 8, 'value' => $p['vat_name'], 'border' => 0, 'align' => 'R', 'font-family' => 'courier');
$table [$i]['total'] = array('width' => 14, 'value' => $p['total'], 'border' => 0, 'align' => 'R', 'font-family' => 'courier');
$i++;
}
//$starttab=$pdf->GetY()+10;
$pdf->DrawTable($table);
//$endtab=$pdf->GetY();
//for($n=0;$n<$i;$n++){
//if(file_exists($iarr[$n]))$pdf->Image($iarr[$n],$pdf->GetX()+1,$starttab+$n*18+1,15,0);
//}
//$pdf->SetY($endtab);
//total, vat, subtotal
$pdf->Ln(4);
$pdf->Line($pdf->lMargin,$pdf->getY(),$pdf->fw-$pdf->rMargin,$pdf->getY());
$pdf->Ln(1);
$pr = ($pdf->fw-$pdf->lMargin-$pdf->rMargin)/100;
//$pdf->SetX($pdf->fw-$pdf->rMargin-$pr*34);
$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, 'font-family' => 'courier'),
'subtotal2' => array('width' => 34, 'value' => $calc['subtotal'], 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9, 'font-family' => 'courier'), );
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, 'font-family' => 'courier'),
'vat2' => array('width' => 34, 'value' => $value, 'border' => 0, 'overflow' => 1, 'align' => 'R', 'font-size' => 9, 'font-family' => 'courier'), );
}
}
if(isset($calc['discount'])) {
$table [] = array(
'total21' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b', 'font-family' => 'courier'),
'total22' => array('width' => 34, 'value' => $calc['total2'], 'border' => 0, 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-family' => 'courier'), );
$table [] = array(
'discount1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_DISCOUNT'].' '.$calc['discount']['procent'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b', 'font-family' => 'courier'),
'discount2' => array('width' => 34, 'value' => $calc['discount']['value'], 'border' => 0, 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-family' => 'courier'), );
}
$table [] = array(
'total1' => array('width' => 66, 'value' => $mod_strings['LBL_PDF_END_TOTAL'], 'background' => array(255,255,255), 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-size' => 9, 'font-style' => 'b', 'font-family' => 'courier'),
'total2' => array('width' => 34, 'value' => $calc['total'], 'border' => 0, 'background' => array(255,255,255), 'overflow' => 1, 'align' => 'R' , 'font-size' => 9, 'font-style' => 'b', 'font-family' => 'courier'), );
$pdf->DrawTable($table);