Ln(10); //$this->SetY($this->tMargin); //from address $this->template->setAccount(); $address = $this->template->account->name; if($this->template->account->billing_address_street) $address .= " - ".$this->template->account->billing_address_street; if($this->template->account->billing_address_postalcode) $address .= " - ".$this->template->account->billing_address_postalcode; if($this->template->account->billing_address_city) $address .= " ".$this->template->account->billing_address_city; $pdf->SetFont('arialpl', 'u', 8); */ $pdf->Ln(2); //$pdf->MultiCell(0,5,$address,0,'L'); //to address $address = $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; } if($this->parent_address_street) $address .= "\n".$this->parent_address_street; if($this->parent_address_postalcode) $address .= "\n\n".$this->parent_address_postalcode; if($this->parent_address_city) $address .= " ".$this->parent_address_city; if($this->to_vatid) $address .= "\n\n".$mod_strings['LBL_PDF_VATID']." ".$this->to_vatid; $pdf->SetFont('arialpl', '', 10); $pdf->Ln(2); $current = $pdf->GetY(); //$pdf->MultiCell(0,4,$address,0,'L'); $current2 = $pdf->GetY(); // $pdf->Ln(7); $pdf->SetXY($pdf->fw-$pdf->rMargin-30,$current); $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' => $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'); $table [6]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_STOCK_FROM'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9); $table [7]['data'] = array('width' => 30, 'value' => $this->stock_from_name, 'border' => 0, 'overflow' => 1, 'align' => 'L'); $table [8]['data'] = array('width' => 30, 'value' => $mod_strings['LBL_PDF_STOCK_TO'], 'border' => 0, 'overflow' => 1, 'align' => 'L', 'font-style' => 'b', 'font-size' => 9); $table [9]['data'] = array('width' => 30, 'value' => $this->stock_to_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','','24'); $pdf->MultiCell(0,3,$mod_strings['LBL_PDF_DOCUMENT_NAME'],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 $pdf->Ln(12); $pdf->SetFont('arialpl','','10'); $pdf->MultiCell(0,4,$this->header_text,0,'J'); $pdf->Ln(30); 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(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C'); if($this->show_images_on_offers) $table [0]['image'] = array('width' => $image_w, 'value' => $mod_strings['LBL_PDF_LIST_IMAGE'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'R'); $table [0]['quantity'] = array('width' => 12, 'value' => $mod_strings['LBL_PDF_LIST_QUANTITY'],'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C'); //$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+28), 'value' => $mod_strings['LBL_PDF_LIST_DESCRIPTION'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C'); /*$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($calc['draw_discount']) $table [0]['discount'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_DISCOUNT'], 'background' => array(233,233,233), 'border' => 0, 'overflow' => 1, 'align' => 'C'); if($calc['draw_vat']) $table [0]['vat_id'] = array('width' => 8, 'value' => $mod_strings['LBL_PDF_LIST_VAT'], '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' => 'C');*/ $i = 1; if($this->position_list != '') foreach($this->position_list as $p) { $table [$i]['position'] = array('width' => 5, 'value' => $i, 'border' => 0, 'align' => 'R', ); 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'])); else $table [$i]['image'] = array('width' => $image_w, 'value' => '', 'border' => 0, 'align' => 'R'); } $table [$i]['quantity'] = array('width' => 12, 'value' => $p['quantity'], 'border' => 0, 'align' => 'C', ); //$table [$i]['unit'] = array('width' => 10, 'value' => $p['unit_id'], 'border' => 0, 'align' => 'C', ); $table [$i]['description'] = array('width' => ($name_w+28), 'value' => htmlspecialchars_decode($p['name']), 'border' => 0, 'align' => 'L', ); /*$table [$i]['unit_price'] = array('width' => 14, 'value' => $p['price'], 'border' => 0, 'align' => 'R', ); if($calc['draw_discount']) $table [$i]['discount'] = array('width' => 8, 'value' => $p['discount'], 'border' => 0, 'align' => 'R', ); if($calc['draw_vat']) $table [$i]['vat_id'] = array('width' => 8, 'value' => $p['vat_name'], 'border' => 0, 'align' => 'R', ); $table [$i]['total'] = array('width' => 14, 'value' => $p['total'], 'border' => 0, 'align' => 'R', );*/ $i++; } $pdf->DrawTable($table,array(0)); //total, vat, subtotal $pdf->Ln(4); $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), '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), ); } } 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'), 'total22' => array('width' => 34, 'value' => $calc['total2'], 'border' => 0, 'overflow' => 1, 'align' => 'R' , 'font-size' => 9), ); $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'), 'discount2' => array('width' => 34, 'value' => $calc['discount']['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'), );*/ $pdf->DrawTable($table); ?>