Initial import: Carteasy Shop (Dev-Stand)
This commit is contained in:
@@ -0,0 +1,504 @@
|
||||
<?php
|
||||
// packing slip
|
||||
include_once './core/order.class.php';
|
||||
include_once './core/customergroups.class.php';
|
||||
|
||||
include_once './libs/tcpdf/tcpdf.php';
|
||||
include_once './core/config.class.php';
|
||||
|
||||
class bopPDF extends TCPDF {
|
||||
|
||||
private $order_id = NULL;
|
||||
public $data = array();
|
||||
|
||||
private $_image_path = NULL;
|
||||
|
||||
private $_fill_r = 102;
|
||||
private $_fill_g = 102;
|
||||
private $_fill_b = 102;
|
||||
|
||||
private $_border_r = 0;
|
||||
private $_border_g = 0;
|
||||
private $_border_b = 0;
|
||||
|
||||
private $_stripe_r = 249;
|
||||
private $_stripe_g = 249;
|
||||
private $_stripe_b = 249;
|
||||
|
||||
private $_text_r = 0;
|
||||
private $_text_g = 0;
|
||||
private $_text_b = 0;
|
||||
|
||||
private $_light_text_r = 128;
|
||||
private $_light_text_g = 128;
|
||||
private $_light_text_b = 128;
|
||||
|
||||
private $_line_width = 0.2;
|
||||
|
||||
private $fontfamily = 'Arial';
|
||||
|
||||
public function __construct($order_id) {
|
||||
$this->order_id=$order_id;
|
||||
$this->load();
|
||||
$this->writeBOPPDF();
|
||||
}
|
||||
|
||||
private function load() {
|
||||
$db = Registry::get('base')->db;
|
||||
$order = new Order(Registry::get('base'));
|
||||
$order->set_id($this->order_id);
|
||||
|
||||
$this->data['order'] = $order->get_data();
|
||||
if (sizeof($this->data['order']->items) > 0 ) {
|
||||
foreach ($this->data['order']->items As $index => $row) {
|
||||
if (sizeof($row->attribute_array) > 0) {
|
||||
foreach ($row->attribute_array AS $indece => $att) {
|
||||
|
||||
if ($this->data['order']->items[$index]->variant1 && $att->value && $att->name && $this->data['order']->items[$index]->variant1 == $att->value) {
|
||||
$this->data['order']->items[$index]->vn1 = $att->name;
|
||||
}
|
||||
|
||||
if ($this->data['order']->items[$index]->variant2 && $att->value && $att->name && $this->data['order']->items[$index]->variant2 == $att->value) {
|
||||
$this->data['order']->items[$index]->vn2 = $att->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT os.name AS status_bez, d.name AS deliverers, pm.name AS pm, ps.name AS ps, cb.name AS billing_country, cs.name AS shipping_country
|
||||
FROM order_status AS os
|
||||
LEFT JOIN deliverers AS d ON(d.id = '".$this->data['order']->shipping_method."')
|
||||
LEFT JOIN payment_methods AS pm ON(pm.id = '".$this->data['order']->payment_method."')
|
||||
LEFT JOIN payment_status AS ps ON(ps.id = '".$this->data['order']->payment_status."')
|
||||
LEFT JOIN countries AS cb ON(cb.id = '".$this->data['order']->billing_country."')
|
||||
LEFT JOIN countries AS cs ON(cs.id = '".$this->data['order']->shipping_country."')
|
||||
WHERE os.id = '".$this->data['order']->order_status."'";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
while ($row = $result->fetch_object()) {
|
||||
$this->data['order_data']['status_bez']=$row->status_bez;
|
||||
$this->data['order_data']['deliverers']=$row->deliverers;
|
||||
$this->data['order_data']['pm']=$row->pm;
|
||||
$this->data['order_data']['ps']=$row->ps;
|
||||
$this->data['order_data']['billing_country']=$row->billing_country;
|
||||
$this->data['order_data']['shipping_country']=$row->shipping_country;
|
||||
}
|
||||
$result->free();
|
||||
|
||||
$this->customer_group_object = new CustomerGroups(Registry::get('base'));
|
||||
$this->data['customer_groups'] = $this->customer_group_object->get_by_user($this->data['order']->customer_id);
|
||||
}
|
||||
|
||||
private function writeBOPPDF() {
|
||||
$this->pdfSettings();
|
||||
|
||||
$this->writeOrderData();
|
||||
$this->writeCustomerData();
|
||||
$this->writePaymentsData();
|
||||
$this->writeBillingData();
|
||||
$this->writeBilingAddress();
|
||||
$this->writeShippingAddress();
|
||||
$this->writeItemData();
|
||||
$this->writebopUser();
|
||||
|
||||
$this->getPdf();
|
||||
}
|
||||
|
||||
private function pdfSettings() {
|
||||
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
$this->_image_path = ROOT_DIR.'web/'.SHOP_SYSTEM.'/documents/';
|
||||
$this->SetMargins(6, 5, 5);
|
||||
$this->startPage();
|
||||
}
|
||||
|
||||
public function Header() {}
|
||||
|
||||
public function Footer() {}
|
||||
|
||||
private function writeOrderData() {
|
||||
$order_dt = list($y,$m,$d)=explode('-',$this->data['order']->order_date);
|
||||
|
||||
$orderdata = 'Bst. Nr.: '.$this->data['order']->order_number.PHP_EOL;
|
||||
|
||||
if ($this->data['order_data']['status_bez']) {
|
||||
$orderdata.= 'Bst. Status: '.$this->data['order_data']['status_bez'].PHP_EOL;
|
||||
}
|
||||
|
||||
$orderdata.= 'Bst. Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(40,15, $orderdata, 0, 'L',0,1,5,10);
|
||||
}
|
||||
|
||||
private function writeCustomerData() {
|
||||
$customerdata = 'Kde. Nr.: '.$this->data['order']->customer_number.PHP_EOL;
|
||||
$customerdata.= 'Kde. Name: '.$this->data['order']->customer_name.PHP_EOL;
|
||||
if ($this->data['customer_groups']->name) {
|
||||
$customerdata.= 'Kde. Gruppe: '.$this->data['customer_groups']->name.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,20, $customerdata, 0, 'L',0,1,50,10);
|
||||
}
|
||||
|
||||
private function writePaymentsData() {
|
||||
$paymentdata='';
|
||||
|
||||
if ($this->data['order_data']['pm']) {
|
||||
$paymentdata.= 'Zahlungsart: '.$this->data['order_data']['pm'].PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order_data']['ps']) {
|
||||
$paymentdata.= 'Zahlungsstatus: '.$this->data['order_data']['ps'].PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->payment_date) {
|
||||
$pay_dt = list($y,$m,$d)=explode('-',$this->data['order']->payment_date);
|
||||
$paymentdata.= 'Zahlungs Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
}
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,35, $paymentdata, 0, 'L',0,1,105,10);
|
||||
}
|
||||
|
||||
private function writeBillingData() {
|
||||
$billing_dt = list($y,$m,$d)=explode('-',$this->data['order']->billing_date);
|
||||
|
||||
$billingdata.= 'Rechnungs Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
if ($this->data['order']->invoice_number) {
|
||||
$billingdata.= 'Rechnungs Nr.: '.$this->data['order']->invoice_number.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order_data']['deliverers']) {
|
||||
$billingdata.= 'Lieferant.: '.$this->data['order_data']['deliverers'].PHP_EOL;
|
||||
}
|
||||
if ($this->data['order']->trackingcode) {
|
||||
$billingdata.= 'Tracking-Code: '.$this->data['order']->trackingcode.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,35, $billingdata, 0, 'L',0,1,155,10);
|
||||
}
|
||||
|
||||
private function writeBilingAddress() {
|
||||
$bill_address='Rechnungsadresse:'.PHP_EOL;
|
||||
|
||||
switch($this->data['order']->billing_honorific) {
|
||||
case '0': $bill_address.="Herr".PHP_EOL; break;
|
||||
case '1': $bill_address.="Frau".PHP_EOL; break;
|
||||
case '2': $bill_address.="Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['order']->billing_company) {
|
||||
$bill_address.=$this->data['order']->billing_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->billing_firstname || $this->data['order']->billing_surname) {
|
||||
if ($this->data['order']->billing_firstname) {
|
||||
$bill_address.=$this->data['order']->billing_firstname." ";
|
||||
}
|
||||
if ($this->data['order']->billing_surname) {
|
||||
$bill_address.=$this->data['order']->billing_surname;
|
||||
}
|
||||
$bill_address.=PHP_EOL;
|
||||
}
|
||||
|
||||
$bill_address.=$this->data['order']->billing_street.' '.$this->data['order']->billing_house_number.PHP_EOL;
|
||||
$bill_address.=$this->data['order']->billing_zip_code.' '.$this->data['order']->billing_city.PHP_EOL;
|
||||
$bill_address.=$this->data['order_data']['billing_country'].PHP_EOL;
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,20, $bill_address, 0, 'L',0,1,5,32);
|
||||
}
|
||||
|
||||
private function writeShippingAddress() {
|
||||
$ship_address='Lieferadresse:'.PHP_EOL;
|
||||
|
||||
switch($this->data['order']->shipping_honorific) {
|
||||
case '0': $ship_address.="Herr".PHP_EOL; break;
|
||||
case '1': $ship_address.="Frau".PHP_EOL; break;
|
||||
case '2': $ship_address.="Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['order']->shipping_company) {
|
||||
$ship_address.=$this->data['order']->shipping_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->shipping_firstname || $this->data['order']->shipping_surname) {
|
||||
if ($this->data['order']->shipping_firstname) {
|
||||
$ship_address.=$this->data['order']->shipping_firstname." ";
|
||||
}
|
||||
if ($this->data['order']->shipping_surname) {
|
||||
$ship_address.=$this->data['order']->shipping_surname;
|
||||
}
|
||||
$ship_address.=PHP_EOL;
|
||||
}
|
||||
|
||||
$ship_address.=$this->data['order']->shipping_street.' '.$this->data['order']->shipping_house_number.PHP_EOL;
|
||||
$ship_address.=$this->data['order']->shipping_zip_code.' '.$this->data['order']->shipping_city.PHP_EOL;
|
||||
$ship_address.=$this->data['order_data']['shipping_country'].PHP_EOL;
|
||||
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,20, $ship_address, 0, 'L',0,1,105,32);
|
||||
}
|
||||
|
||||
private function writeItemData() {
|
||||
if (sizeof($this->data['order']->items) > 0) {
|
||||
|
||||
$this->header_width = array(5, 5, 75, 10, 30, 25, 10, 40);
|
||||
$this->writeItemHeader();
|
||||
|
||||
$i = 1;
|
||||
$fill = 0;
|
||||
foreach ($this->data['order']->items as $row) {
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($this->header_width[0], 0, $i, 'L', 0, 'C', $fill); // Pos.
|
||||
$this->Cell($this->header_width[1], 0, $row->amount, 0, 0, 'C', $fill); // St.
|
||||
if (strlen($row->item_name) < 50) {
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner($row->item_name), 0, 0, 'L', $fill); // Beschreibung
|
||||
} else {
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner(substr($row->item_name,0,50)), 0, 0, 'L', $fill); // Beschreibung
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[3], 0, $this->_stringCleaner(number_format($row->tax_rate, 2, ',', ' ').' %'), 0, 0, 'L', $fill); // mwst
|
||||
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$gross_price = $row->price + $row->taxes;
|
||||
$gross_total = $row->amount * $gross_price;
|
||||
$this->sum += $gross_total;
|
||||
$this->taxes[$row->tax_rate] = $this->taxes[$row->tax_rate]+($row->taxes * $row->amount);
|
||||
$this->taxsum += $row->taxes * $row->amount;
|
||||
$this->Cell($this->header_width[4], 0, $this->_stringCleaner(number_format($gross_price, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($gross_total, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Gesamtpreis
|
||||
} else {
|
||||
$net_price = $row->price;
|
||||
$net_total = $row->amount * $net_price;
|
||||
$this->sum += $net_total;
|
||||
$this->taxes[$row->tax_rate] = $this->taxes[$row->tax_rate] + ($row->taxes * $row->amount);
|
||||
$this->taxsum += $row->taxes * $row->amount;
|
||||
$this->Cell($this->header_width[4], 0, $this->_stringCleaner(number_format($net_price, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($net_total, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Gesamtpreis
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
foreach (array(50, 100, 150, 200) as $i) {
|
||||
if (strlen($row->item_name) > $i) {
|
||||
$c = $i - 1;
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner(substr($row->item_name,$c, 50)), '', 0, 'L', $fill); // Beschreibung
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
}
|
||||
$this->SetFont('', '', 2);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2]+$this->header_width[3]+$this->header_width[4]+$this->header_width[5], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[7], 0, '', 'R', 0, 'C', $fill);
|
||||
$this->Ln();
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
$artikelnr ="Art-Nr.: ".$row->item_number;
|
||||
if ($row->variant1) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn1) {
|
||||
$artikelnr.=$row->vn1.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant1;
|
||||
}
|
||||
if ($row->variant2) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn2) {
|
||||
$artikelnr.=$row->vn2.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($row->item_status == 2) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// nachliefern
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($width, 0, $text, 'BR', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
} else if ($row->item_status == 3) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// infotext
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($width, 0, $row->item_status_text, 'BR', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, 'B', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->writeItemFooter();
|
||||
}
|
||||
}
|
||||
|
||||
private function writeItemHeader($header_width = 0) {
|
||||
$this->SetY($this->gety()+5);
|
||||
$this->SetFont('', 'B', 18);
|
||||
$this->Cell(120, 0, "Packschein", '', 0, 'L');
|
||||
$this->Ln();
|
||||
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
// draw header
|
||||
$this->Cell($this->header_width[0], 0, 'P', 'LTB', 0, 'C', 1); // Pos.
|
||||
$this->Cell($this->header_width[1], 0, 'St.', 'TB', 0, 'C', 1); // St.
|
||||
$this->Cell($this->header_width[2], 0, 'Beschreibung/Art-Nr.', 'TB', 0, 'L', 1); // Art-Nr./Beschreibung
|
||||
$this->Cell($this->header_width[3], 0, 'MwSt.', 'TB', 0, 'L', 1); //
|
||||
$this->Cell($this->header_width[4], 0, 'Stückpreis', 'TB', 0, 'R', 1); //
|
||||
$this->Cell($this->header_width[5], 0, 'Gesamtpreis', 'RTB', 0, 'R', 1); //
|
||||
$this->Cell($this->header_width[6], 0, 'St.', 'LTB', 0, 'R', 1); // stückzahl lager
|
||||
$this->Cell($this->header_width[7], 0, 'Kommentar', 'LRTB', 0, 'R', 1); // comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writeItemFooter() {
|
||||
$fill = 0;
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, 'Summe aller Artikel:', 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->sum, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('Zahlungsgebühren:'), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->data['order']->payment_method_charges, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, 'Versandkosten:', 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->data['order']->shipping_charges, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
foreach ($this->taxes as $key => $value) {
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('darin enthaltene Mwst.: '.number_format($key, 2, ',', ' ').' %'), 0, 0, 'L', $fill);
|
||||
} else {
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('zzgl.: '.number_format($key, 2, ',', ' ').' % Mwst.'), 0, 0, 'L', $fill);
|
||||
}
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($value, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
// invoice total fat
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$total = $this->sum + $this->data['order']->shipping_charges + $this->data['order']->payment_method_charges;
|
||||
} else {
|
||||
$total = $this->sum + $this->data['order']->shipping_charges + $this->data['order']->payment_method_charges + $this->taxsum;
|
||||
}
|
||||
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4],0,$this->_stringCleaner('zu zahlender Betrag:'), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(array_sum($this->header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writebopUser() {
|
||||
$this->SetFont('', '', 10);
|
||||
$this->SetY($this->gety()+10);
|
||||
$this->Cell(10, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / gepackt von', 'T', 0, 'C');
|
||||
$this->Cell(15, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / geprüft von', 'T', 0, 'C');
|
||||
}
|
||||
|
||||
protected function _stringCleaner($string) {
|
||||
$search = array('€', 'ß', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü');
|
||||
$replace = array(TCPDF_FONTS::unichr(8364), TCPDF_FONTS::unichr(223), TCPDF_FONTS::unichr(228), TCPDF_FONTS::unichr(246), TCPDF_FONTS::unichr(252), TCPDF_FONTS::unichr(196), TCPDF_FONTS::unichr(214), TCPDF_FONTS::unichr(220));
|
||||
return str_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
private function getPdf() {
|
||||
$this->Output('Packschein-'.$this->data['order']->invoice_number.'.pdf', 'D');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
||||
* @package Carteasy
|
||||
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
||||
* @license proprietary
|
||||
* @author Thomas Bartelt
|
||||
* Carteasy is a web shop system
|
||||
*/
|
||||
|
||||
class DeliveryItemsHTML {
|
||||
|
||||
private $smarty;
|
||||
private $order;
|
||||
private $items;
|
||||
private $footer;
|
||||
|
||||
public function __construct($order) {
|
||||
$this->smarty = Registry::get('layout_object');
|
||||
$this->order = $order;
|
||||
$this->MakeItems();
|
||||
$this->MakeFooter();
|
||||
}
|
||||
|
||||
public function PrintOrder() {
|
||||
$this->smarty->assign('order_items', $this->items);
|
||||
$this->smarty->assign('showtaxes', $this->order->cg_show_taxes);
|
||||
$this->smarty->assign('footer', $this->footer);
|
||||
$this->smarty->assign('order_data', $this->order);
|
||||
return $this->smarty->fetch(ROOT_DIR.'/core/output/templates/order_items.tpl');
|
||||
}
|
||||
|
||||
private function MakeFooter() {
|
||||
$footer = new stdClass();
|
||||
|
||||
$footer->sub = 0.0;
|
||||
$footer->sub_with_taxes = 0.0;
|
||||
$footer->taxes = array();
|
||||
$footer->shipping_charges = $this->order->shipping_charges;
|
||||
$footer->payment_method_charges = $this->order->payment_method_charges;
|
||||
|
||||
foreach ($this->order->items as $item) {
|
||||
$footer->sub += $item->total;
|
||||
$footer->sub_with_taxes += $item->total_with_taxes;
|
||||
|
||||
if (isset($footer->taxes[$item->tax_rate])) {
|
||||
$footer->taxes[$item->tax_rate] += $item->total_taxes;
|
||||
} else {
|
||||
$footer->taxes[$item->tax_rate] = $item->total_taxes;
|
||||
}
|
||||
|
||||
if (isset($footer->taxes_netto_sum[$item->tax_rate])) {
|
||||
$footer->taxes_netto_sum[$item->tax_rate] += $item->total;
|
||||
} else {
|
||||
$footer->taxes_netto_sum[$item->tax_rate] = $item->total;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->order->is_eu_order != 1) {
|
||||
//$footer->order_total = $footer->sub_with_taxes + $footer->shipping_charges + $footer->payment_method_charges;
|
||||
// brutto
|
||||
if ($this->order->cg_show_taxes) {
|
||||
$footer->order_total = $footer->sub_with_taxes + $footer->shipping_charges + $footer->payment_method_charges;
|
||||
} else { // netto
|
||||
if ($footer->shipping_charges > 0) {
|
||||
$footer->shipping_charges = $this->order->shipping_charges / 119.0 * 100.0;
|
||||
}
|
||||
if ($footer->payment_method_charges > 0) {
|
||||
$footer->payment_method_charges = $this->order->payment_method_charges / 119.0 * 100.0;
|
||||
}
|
||||
$footer->order_total = $footer->sub + $footer->shipping_charges + $footer->payment_method_charges;
|
||||
$footer->order_total = $footer->order_total / 100 * 119;
|
||||
$footer->taxes['19.00'] = ($footer->taxes_netto_sum['19.00'] + $footer->shipping_charges + $footer->payment_method_charges) / 100 * 19;
|
||||
}
|
||||
} else {
|
||||
if ($footer->shipping_charges > 0) {
|
||||
$footer->shipping_charges = $this->order->shipping_charges / 119.0 * 100.0;
|
||||
}
|
||||
if ($footer->payment_method_charges > 0) {
|
||||
$footer->payment_method_charges = $this->order->payment_method_charges / 119.0 * 100.0;
|
||||
}
|
||||
$footer->order_total = $footer->sub + $footer->shipping_charges + $footer->payment_method_charges;
|
||||
}
|
||||
|
||||
// gift certificates
|
||||
if ($this->order->gift_certificate_id) {
|
||||
$footer->gift_certificate_id = $this->order->gift_certificate_id;
|
||||
$footer->gift_certificate_code = $this->order->gift_certificate_code;
|
||||
$footer->gift_certificate_total = $this->order->gift_certificate_total;
|
||||
}
|
||||
|
||||
$this->footer = $footer;
|
||||
}
|
||||
|
||||
private function MakeItems() {
|
||||
$items = array();
|
||||
|
||||
foreach ($this->order->items as $item) {
|
||||
|
||||
$item->price_with_taxes = $item->price + $item->taxes;
|
||||
$item->total = $item->price * $item->amount;
|
||||
$item->total_with_taxes = $item->price_with_taxes * $item->amount;
|
||||
$item->total_taxes = $item->taxes * $item->amount;
|
||||
/*if (isset($item->attribute_array[0])) {
|
||||
$item->attribute_1_text = $item->attribute_array[0]->name.': '.$item->attribute_array[0]->value;
|
||||
}
|
||||
|
||||
if (isset($item->attribute_array[1])) {
|
||||
$item->attribute_2_text = $item->attribute_array[1]->name.': '.$item->attribute_array[1]->value;
|
||||
}*/
|
||||
if (isset($item->attribute_array[0]) && isset($item->attribute_array[0]->variant)) {
|
||||
$item->attribute_1_text = $item->attribute_array[0]->name.': '.$item->attribute_array[0]->value;
|
||||
}
|
||||
|
||||
if (isset($item->attribute_array[1]) && isset($item->attribute_array[1]->variant)) {
|
||||
$item->attribute_2_text = $item->attribute_array[1]->name.': '.$item->attribute_array[1]->value;
|
||||
}
|
||||
|
||||
// intelectra start
|
||||
$db = Registry::get('base')->db;
|
||||
$sql = "SELECT
|
||||
attribute_7
|
||||
FROM
|
||||
items
|
||||
WHERE
|
||||
id=".$db->real_escape_string($item->item_id);
|
||||
$result = $db->query($sql);
|
||||
$item->attribute_7 = '';
|
||||
if ($result->num_rows > 0) {
|
||||
$item->attribute_7 = $result->fetch_object()->attribute_7;
|
||||
}
|
||||
|
||||
//intelectra end
|
||||
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
$this->items = $items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
||||
* @package Carteasy
|
||||
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
||||
* @license proprietary
|
||||
* @author Thomas Bartelt
|
||||
* Carteasy is a web shop system
|
||||
*/
|
||||
|
||||
include_once './libs/tcpdf/tcpdf.php';
|
||||
include_once './core/config.class.php';
|
||||
|
||||
class DeliveryNotePDF extends TCPDF {
|
||||
|
||||
private $_image_path;
|
||||
|
||||
// fill color for header
|
||||
private $_fill_r = 102;
|
||||
private $_fill_g = 102;
|
||||
private $_fill_b = 102;
|
||||
|
||||
// table border color
|
||||
private $_border_r = 0;
|
||||
private $_border_g = 0;
|
||||
private $_boerder_b = 0;
|
||||
|
||||
// stripe color for items list
|
||||
private $_stripe_r = 249;
|
||||
private $_stripe_g = 249;
|
||||
private $_stripe_b = 249;
|
||||
|
||||
// normal text color
|
||||
private $_text_r = 0;
|
||||
private $_text_g = 0;
|
||||
private $_text_b = 0;
|
||||
|
||||
// light text color
|
||||
private $_light_text_r = 128;
|
||||
private $_light_text_g = 128;
|
||||
private $_light_text_b = 128;
|
||||
|
||||
private $_line_width = 0.2;
|
||||
|
||||
|
||||
// new page
|
||||
private $new_page_lines = 260;
|
||||
|
||||
// header image
|
||||
private $header_image_x = 5;
|
||||
private $header_image_y = 5;
|
||||
|
||||
// footer image
|
||||
private $footer_image_x = 5;
|
||||
private $footer_image_y = 260;
|
||||
|
||||
// invoice data
|
||||
private $invoice_data_y = 53;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
|
||||
$this->_image_path = ROOT_DIR.'web/'.SHOP_SYSTEM.'/documents/';
|
||||
|
||||
$this->SetMargins(6, 5, 5);
|
||||
|
||||
if (Config::has_key('bill_new_page_lines')) {
|
||||
$this->new_page_lines = Config::get_value('bill_new_page_lines');
|
||||
}
|
||||
if (Config::has_key('bill_invoice_data_y')) {
|
||||
$this->invoice_data_y = Config::get_value('bill_invoice_data_y');
|
||||
}
|
||||
if (Config::has_key('bill_header_image_x')) {
|
||||
$this->header_image_x = Config::get_value('bill_header_image_x');
|
||||
}
|
||||
if (Config::has_key('bill_header_image_y')) {
|
||||
$this->header_image_y = Config::get_value('bill_header_image_y');
|
||||
}
|
||||
if (Config::has_key('bill_footer_image_x')) {
|
||||
$this->footer_image_x = Config::get_value('bill_footer_image_x');
|
||||
}
|
||||
if (Config::has_key('bill_footer_image_y')) {
|
||||
$this->footer_image_y = Config::get_value('bill_footer_image_y');
|
||||
}
|
||||
}
|
||||
|
||||
private function CheckForNewPage($lines = false) {
|
||||
if ($lines && ($this->GetY() + $lines * 3.52778) > $this->new_page_lines) {
|
||||
$this->addPage('', '', true, true);
|
||||
} else if ($this->GetY() > $this->new_page_lines) {
|
||||
$this->addPage('', '', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function Header() {
|
||||
if (Config::has_key('bill_header_image')) {
|
||||
$this->Image($this->_image_path.(string)Config::get_value('bill_header_image'), $this->header_image_x, $this->header_image_y, 200, 0);
|
||||
}
|
||||
|
||||
if (Config::has_key('bill_header_text_window')) {
|
||||
$this->SetXY(7, 50);
|
||||
$this->SetFont('', '', 6);
|
||||
$this->Cell(50, 0, Config::get_value('bill_header_text_window'), 0, 0, 'L', 0);
|
||||
}
|
||||
|
||||
if (Config::has_key('bill_header_text_address')) {
|
||||
$address = Config::get_value('bill_header_text_address');
|
||||
if (Config::has_key('bill_header_alignment_address')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_header_alignment_address'));
|
||||
} else {
|
||||
$alignment = 'L';
|
||||
}
|
||||
|
||||
$this->SetXY(125, 50);
|
||||
$this->SetFont('', '', 7);
|
||||
$this->MultiCell(70, 20, $address, 0, $alignment);
|
||||
}
|
||||
|
||||
$this->setTopMargin(60 + 5);
|
||||
}
|
||||
|
||||
public function Footer() {
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
if (Config::has_key('bill_footer_image')) {
|
||||
$this->Image($this->_image_path.(string)Config::get_value('bill_footer_image'), $this->footer_image_x, $this->footer_image_y, 200, 0);
|
||||
}
|
||||
|
||||
$footer_position_y = -25;
|
||||
if (Config::has_key('bill_footer_text_margin_bottom')) {
|
||||
$footer_position_y = (int)Config::get_value('bill_footer_text_margin_bottom');
|
||||
}
|
||||
|
||||
// left
|
||||
if (Config::has_key('bill_footer_text_left')) {
|
||||
$footer_left_text = (string)Config::get_value('bill_footer_text_left');
|
||||
if ($footer_left_text != '') {
|
||||
if (Config::has_key('bill_footer_alignment_left')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_footer_alignment_left'));
|
||||
} else {
|
||||
$alignment = 'L';
|
||||
}
|
||||
$this->SetXY(5, $footer_position_y);
|
||||
$this->MultiCell(65, 20, $footer_left_text, 0, $alignment);
|
||||
}
|
||||
}
|
||||
|
||||
// center
|
||||
if (Config::has_key('bill_footer_text_center')) {
|
||||
$footer_center_text = (string)Config::get_value('bill_footer_text_center');
|
||||
if ($footer_center_text != '') {
|
||||
if (Config::has_key('bill_footer_alignment_center')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_footer_alignment_center'));
|
||||
} else {
|
||||
$alignment = 'L';
|
||||
}
|
||||
$this->SetXY(70, $footer_position_y);
|
||||
$this->MultiCell(70, 20, $footer_center_text, 0, $alignment);
|
||||
}
|
||||
}
|
||||
|
||||
// right
|
||||
if (Config::has_key('bill_footer_text_right')) {
|
||||
$footer_right_text = (string)Config::get_value('bill_footer_text_right');
|
||||
if ($footer_right_text != '') {
|
||||
if (Config::has_key('bill_footer_alignment_right')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_footer_alignment_right'));
|
||||
} else {
|
||||
$alignment = 'R';
|
||||
}
|
||||
$this->SetXY(140, $footer_position_y);
|
||||
$this->MultiCell(65, 20, $footer_right_text, 0, $alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function PrintCustomerAddress($data) {
|
||||
$this->SetX(5);
|
||||
$this->SetY(53);
|
||||
$this->SetFont('', '', 10);
|
||||
|
||||
$this->MultiCell(80,35, $data, 0, 'L');
|
||||
}
|
||||
|
||||
public function PrintInvoiceData($data) {
|
||||
$this->SetFont('', '', 10);
|
||||
$key_string = '';
|
||||
$value_string = '';
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key_string == '') {
|
||||
$key_string = $key;
|
||||
$value_string = $value;
|
||||
} else {
|
||||
$key_string .= "\n".$key;
|
||||
$value_string .= "\n".$value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->SetXY(125, $this->invoice_data_y);
|
||||
$this->MultiCell(40, 35, $key_string, 0, 'L');
|
||||
|
||||
$this->SetXY(165, $this->invoice_data_y);
|
||||
$this->MultiCell(40, 35, $value_string, 0, 'R');
|
||||
}
|
||||
|
||||
public function PrintInvoiceOrder($data) {
|
||||
$this->SetFont('', 'B', 18);
|
||||
$this->Cell(120, 0, "Lieferschein", '', 0, 'L');
|
||||
$this->Ln();
|
||||
|
||||
$this->SetX(5);
|
||||
$this->SetY($this->tMargin + 40);
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
// conf header
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
$header_width = array(15, 10, 100, 20, 30, 25);
|
||||
$length = count($header_width);
|
||||
|
||||
// draw header
|
||||
$this->Cell($header_width[0], 0, 'Pos.', 'LTB', 0, 'C', 1); // Pos.
|
||||
$this->Cell($header_width[1], 0, 'St.', 'TB', 0, 'C', 1); // St.
|
||||
$this->Cell($header_width[2], 0, 'Beschreibung/Art-Nr.', 'TB', 0, 'L', 1); // Art-Nr./Beschreibung
|
||||
$this->Cell($header_width[3], 0, '', 'TB', 0, 'R', 1); //
|
||||
$this->Cell($header_width[4], 0, '', 'TB', 0, 'R', 1); //
|
||||
$this->Cell($header_width[5], 0, '', 'RTB', 0, 'R', 1); // mwst
|
||||
$this->Ln();
|
||||
|
||||
// conf data
|
||||
$this->SetFillColor($this->_stripe_r, $this->_stripe_g, $this->_stripe_b);
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
$fill = 0;
|
||||
|
||||
// draw data
|
||||
$i = 1;
|
||||
foreach ($data->items as $row) {
|
||||
$this->CheckForNewPage();
|
||||
|
||||
// first row
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($header_width[0], 0, $i, 'L', 0, 'C', $fill); // Pos.
|
||||
$this->Cell($header_width[1], 0, $row->amount, 0, 0, 'C', $fill); // St.
|
||||
$this->Cell($header_width[2], 0, $this->_stringCleaner($row->item_name), 0, 0, 'L', $fill); // Beschreibung
|
||||
$this->Cell($header_width[3], 0, '', 0, 0, 'R', $fill); //
|
||||
$this->Cell($header_width[4], 0, '', 0, 0, 'R', $fill); //
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'R', $fill); // mwst
|
||||
$this->Ln();
|
||||
|
||||
//$this->SetTextColor($this->_light_text_r, $this->_light_text_g, $this->_light_text_b);
|
||||
$this->Cell($header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($header_width[1], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[2], 0, 'Art-Nr.: '.$row->item_number, 0, 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($header_width[3], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[4], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
if ($row->variant1) {
|
||||
$this->Cell($header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($header_width[1], 0, '', 0, 0, 'R', $fill);
|
||||
if ($row->vn1) {
|
||||
$txt=$row->vn1.': ';
|
||||
} else {
|
||||
$txt='Attr: ';
|
||||
}
|
||||
$this->Cell($header_width[2], 0,$txt.$row->variant1, 0, 0, 'L', $fill); // Varieant1
|
||||
$this->Cell($header_width[3], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[4], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
}
|
||||
if ($row->variant2) {
|
||||
$this->Cell($header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($header_width[1], 0, '', 0, 0, 'R', $fill);
|
||||
if ($row->vn2) {
|
||||
$txt=$row->vn2.': ';
|
||||
} else {
|
||||
$txt='Attr: ';
|
||||
}
|
||||
$this->Cell($header_width[2], 0,$txt.$row->variant2, 0, 0, 'L', $fill); // Varieant1
|
||||
$this->Cell($header_width[3], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[4], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
}
|
||||
// last row
|
||||
if ($row->item_status) {
|
||||
$this->SetFont('', '', 8);
|
||||
//$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($header_width[0] + $header_width[1], 0, '', 'L', 0, 'C', $fill);
|
||||
|
||||
$text = '';
|
||||
if ($row->item_status == 1) {
|
||||
// nicht lieferbar
|
||||
|
||||
if ($row->item_status_text) {
|
||||
$text = $row->item_status_text;
|
||||
} else {
|
||||
$text = 'nicht lieferbar';
|
||||
}
|
||||
} else if ($row->item_status == 2) {
|
||||
// nachliefern
|
||||
|
||||
if ($row->backorder_quantity) {
|
||||
$text .= $row->backorder_quantity ;
|
||||
}
|
||||
if ($text == '' && $row->item_status_text) {
|
||||
$text .= $row->item_status_text;
|
||||
} else if ($row->item_status_text) {
|
||||
$text .= ' '.$row->item_status_text;
|
||||
} else {
|
||||
$text .= ' nachliefern';
|
||||
}
|
||||
if ($row->delivery_date) {
|
||||
if ($text != '') {
|
||||
$date = explode(' ', $row->delivery_date);
|
||||
$text .= ' - '.$date[2].'.'.$date[1].'.'.$date[0];
|
||||
}
|
||||
}
|
||||
} else if ($row->item_status == 3) {
|
||||
// info
|
||||
|
||||
if ($row->backorder_quantity) {
|
||||
$text .= $row->backorder_quantity ;
|
||||
}
|
||||
if ($text == '' && $row->item_status_text) {
|
||||
$text .= $row->item_status_text;
|
||||
} else if ($row->item_status_text) {
|
||||
$text .= ' '.$row->item_status_text;
|
||||
} else {
|
||||
$text .= ' info';
|
||||
}
|
||||
if ($row->delivery_date) {
|
||||
if ($text != '') {
|
||||
$date = explode(' ', $row->delivery_date);
|
||||
$text .= ' - '.$date[2].'.'.$date[1].'.'.$date[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($header_width[2] + $header_width[3] + $header_width[4], 0, $this->_stringCleaner($text), 0, 0, 'L', $fill);
|
||||
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'L', $fill);
|
||||
$this->Ln();
|
||||
}
|
||||
$fill = !$fill;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->Cell(array_sum($header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
public function PrintNotice($title, $notice) {
|
||||
$this->CheckForNewPage(substr_count($notice, "\n") + 1);
|
||||
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
$this->Cell(200, 1, $title, 1, 0, 'L', 1);
|
||||
|
||||
$this->Ln();
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
|
||||
$this->MultiCell(200, 1, $notice, 'LRB', 'L', 0);
|
||||
$this->Ln(4);
|
||||
}
|
||||
|
||||
protected function _getAlignment($num) {
|
||||
if ($num == 0) {
|
||||
return 'L';
|
||||
} else if ($num == 1) {
|
||||
return 'C';
|
||||
} else if ($num == 2) {
|
||||
return 'R';
|
||||
}
|
||||
|
||||
return 'C';
|
||||
}
|
||||
|
||||
protected function _stringCleaner($sting) {
|
||||
$search = array('€', 'ß', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü');
|
||||
$replace = array($this->unichr(8364), $this->unichr(223), $this->unichr(228), $this->unichr(246), $this->unichr(252), $this->unichr(196), $this->unichr(214), $this->unichr(220));
|
||||
|
||||
return str_replace($search, $replace, $sting);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
<?php
|
||||
/*
|
||||
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
||||
* @package Carteasy
|
||||
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
||||
* @license proprietary
|
||||
* @author Thomas Bartelt
|
||||
* Carteasy is a web shop system
|
||||
*/
|
||||
|
||||
include_once './libs/tcpdf/tcpdf.php';
|
||||
include_once './core/config.class.php';
|
||||
include_once './core/money.class.php';
|
||||
|
||||
class InvoicePDF extends TCPDF {
|
||||
|
||||
private $_image_path;
|
||||
|
||||
// fill color for header
|
||||
private $_fill_r = 102;
|
||||
private $_fill_g = 102;
|
||||
private $_fill_b = 102;
|
||||
|
||||
// table border color
|
||||
private $_border_r = 0;
|
||||
private $_border_g = 0;
|
||||
private $_border_b = 0;
|
||||
|
||||
// stripe color for items list
|
||||
private $_stripe_r = 249;
|
||||
private $_stripe_g = 249;
|
||||
private $_stripe_b = 249;
|
||||
|
||||
// normal text color
|
||||
private $_text_r = 0;
|
||||
private $_text_g = 0;
|
||||
private $_text_b = 0;
|
||||
|
||||
// light text color
|
||||
private $_light_text_r = 128;
|
||||
private $_light_text_g = 128;
|
||||
private $_light_text_b = 128;
|
||||
|
||||
private $_line_width = 0.2;
|
||||
|
||||
// new page
|
||||
private $new_page_lines = 260;
|
||||
|
||||
// header image
|
||||
private $header_image_x = 5;
|
||||
private $header_image_y = 5;
|
||||
|
||||
// footer image
|
||||
private $footer_image_x = 5;
|
||||
private $footer_image_y = 260;
|
||||
|
||||
// invoice data
|
||||
private $invoice_data_y = 53;
|
||||
|
||||
private $total;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
|
||||
$this->_image_path = ROOT_DIR.'web/'.SHOP_SYSTEM.'/documents/';
|
||||
|
||||
$this->SetMargins(15, 5, 5);
|
||||
|
||||
$this->total = false;
|
||||
|
||||
if (Config::has_key('bill_new_page_lines')) {
|
||||
$this->new_page_lines = Config::get_value('bill_new_page_lines');
|
||||
}
|
||||
if (Config::has_key('bill_invoice_data_y')) {
|
||||
$this->invoice_data_y = Config::get_value('bill_invoice_data_y');
|
||||
}
|
||||
if (Config::has_key('bill_header_image_x')) {
|
||||
$this->header_image_x = Config::get_value('bill_header_image_x');
|
||||
}
|
||||
if (Config::has_key('bill_header_image_y')) {
|
||||
$this->header_image_y = Config::get_value('bill_header_image_y');
|
||||
}
|
||||
if (Config::has_key('bill_footer_image_x')) {
|
||||
$this->footer_image_x = Config::get_value('bill_footer_image_x');
|
||||
}
|
||||
if (Config::has_key('bill_footer_image_y')) {
|
||||
$this->footer_image_y = Config::get_value('bill_footer_image_y');
|
||||
}
|
||||
}
|
||||
|
||||
public function Header() {
|
||||
if (Config::has_key('bill_header_image')) {
|
||||
$header_image = (string)Config::get_value('bill_header_image');
|
||||
if ($header_image != '') {
|
||||
$this->Image($this->_image_path.$header_image, $this->header_image_x, $this->header_image_y, 200, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Config::has_key('bill_header_text_window')) {
|
||||
$this->SetXY(16, 50);
|
||||
$this->SetFont('', '', 6);
|
||||
$this->Cell(50, 0, Config::get_value('bill_header_text_window'), 0, 0, 'L', 0);
|
||||
}
|
||||
|
||||
if (Config::has_key('bill_header_text_address')) {
|
||||
$address = Config::get_value('bill_header_text_address');
|
||||
if (Config::has_key('bill_header_alignment_address')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_header_alignment_address'));
|
||||
} else {
|
||||
$alignment = 'L';
|
||||
}
|
||||
|
||||
$this->SetXY(125, 50);
|
||||
$this->SetFont('', '', 7);
|
||||
$this->MultiCell(70, 20, $address, 0, $alignment);
|
||||
}
|
||||
|
||||
$this->setTopMargin(60 + 5);
|
||||
}
|
||||
|
||||
public function Footer() {
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
if (Config::has_key('bill_footer_image')) {
|
||||
$footer_image = (string)Config::get_value('bill_footer_image');
|
||||
if ($footer_image != '') {
|
||||
$this->Image($this->_image_path.$footer_image, $this->footer_image_x, $this->footer_image_y, 200, 0);
|
||||
}
|
||||
}
|
||||
|
||||
$footer_position_y = -25;
|
||||
if (Config::has_key('bill_footer_text_margin_bottom')) {
|
||||
$footer_position_y = (int)Config::get_value('bill_footer_text_margin_bottom');
|
||||
}
|
||||
|
||||
// left
|
||||
if (Config::has_key('bill_footer_text_left')) {
|
||||
$footer_left_text = (string)Config::get_value('bill_footer_text_left');
|
||||
if ($footer_left_text != '') {
|
||||
if (Config::has_key('bill_footer_alignment_left')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_footer_alignment_left'));
|
||||
} else {
|
||||
$alignment = 'L';
|
||||
}
|
||||
$this->SetXY(15, $footer_position_y);
|
||||
$this->MultiCell(67, 20, $footer_left_text, 0, $alignment);
|
||||
}
|
||||
}
|
||||
|
||||
// center
|
||||
if (Config::has_key('bill_footer_text_center')) {
|
||||
$footer_center_text = (string)Config::get_value('bill_footer_text_center');
|
||||
if ($footer_center_text != '') {
|
||||
if (Config::has_key('bill_footer_alignment_center')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_footer_alignment_center'));
|
||||
} else {
|
||||
$alignment = 'L';
|
||||
}
|
||||
$this->SetXY(70, $footer_position_y);
|
||||
$this->MultiCell(66, 20, $footer_center_text, 0, $alignment);
|
||||
}
|
||||
}
|
||||
|
||||
// right
|
||||
if (Config::has_key('bill_footer_text_right')) {
|
||||
$footer_right_text = (string)Config::get_value('bill_footer_text_right');
|
||||
if ($footer_right_text != '') {
|
||||
if (Config::has_key('bill_footer_alignment_right')) {
|
||||
$alignment = $this->_getAlignment(Config::get_value('bill_footer_alignment_right'));
|
||||
} else {
|
||||
$alignment = 'R';
|
||||
}
|
||||
$this->SetXY(140, $footer_position_y);
|
||||
$this->MultiCell(67, 20, $footer_right_text, 0, $alignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function PrintCustomerAddress($data) {
|
||||
$this->SetX(5);
|
||||
$this->SetY(53);
|
||||
$this->SetFont('', '', 10);
|
||||
|
||||
$this->MultiCell(80,35, $data, 0, 'L');
|
||||
}
|
||||
|
||||
public function PrintInvoiceData($data) {
|
||||
$this->SetFont('', '', 10);
|
||||
$key_string = '';
|
||||
$value_string = '';
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key_string == '') {
|
||||
$key_string = $key;
|
||||
$value_string = $value;
|
||||
} else {
|
||||
$key_string .= "\n".$key;
|
||||
$value_string .= "\n".$value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->SetXY(125, $this->invoice_data_y);
|
||||
$this->MultiCell(40, 35, $key_string, 0, 'L');
|
||||
|
||||
$this->SetXY(165, $this->invoice_data_y);
|
||||
$this->MultiCell(40, 35, $value_string, 0, 'R');
|
||||
}
|
||||
|
||||
private function checkForNewPage($lines = false) {
|
||||
if ($lines && ($this->GetY() + $lines * 3.52778) > $this->new_page_lines) {
|
||||
$this->addPage('', '', true, true);
|
||||
} else if ($this->GetY() > $this->new_page_lines) {
|
||||
$this->addPage('', '', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function PrintInvoiceOrder($data) {
|
||||
$this->SetFont('', 'B', 18);
|
||||
$this->Cell(120, 0, "Rechnung", '', 0, 'L');
|
||||
$this->Ln();
|
||||
|
||||
$this->SetX(5);
|
||||
$this->SetY($this->tMargin + 40);
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
// conf header
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
$header_width = array(15, 10, 90, 20, 30, 25);
|
||||
$length = count($header_width);
|
||||
|
||||
// draw header
|
||||
$this->Cell($header_width[0], 0, 'Pos.', 'LTB', 0, 'C', 1); // Pos.
|
||||
$this->Cell($header_width[1], 0, 'St.', 'TB', 0, 'C', 1); // St.
|
||||
$this->Cell($header_width[2], 0, 'Beschreibung/Art-Nr.', 'TB', 0, 'L', 1); // Art-Nr./Beschreibung
|
||||
if ($data['header']->is_eu_order == 1) {
|
||||
$this->Cell($header_width[3], 0, '', 'TB', 0, 'R', 1); // no mwst .. eu bill
|
||||
} else {
|
||||
$this->Cell($header_width[3], 0, 'MwSt.', 'TB', 0, 'R', 1); // mwst
|
||||
}
|
||||
|
||||
$this->Cell($header_width[4], 0, $this->_stringCleaner('Stückpreis'), 'TB', 0, 'R', 1); // Stueckpreis
|
||||
$this->Cell($header_width[5], 0, 'Gesamtpreis', 'RTB', 0, 'R', 1); // Gesamtpreis
|
||||
$this->Ln();
|
||||
|
||||
// conf data
|
||||
$this->SetFillColor($this->_stripe_r, $this->_stripe_g, $this->_stripe_b);
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
$fill = 0;
|
||||
|
||||
// draw data
|
||||
$i = 1;
|
||||
$sum = 0.0;
|
||||
$taxsum = 0.0;
|
||||
foreach ($data['items'] as $row) {
|
||||
$this->checkForNewPage();
|
||||
|
||||
// first row
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($header_width[0], 0, $i, 'L', 0, 'C', $fill); // Pos.
|
||||
$this->Cell($header_width[1], 0, $row->amount, 0, 0, 'C', $fill); // St.
|
||||
if (strlen($row->item_name) > 70) {
|
||||
$this->Cell($header_width[2], 0, $this->_stringCleaner(substr($row->item_name,0,71)), 0, 0, 'L', $fill); // Beschreibung
|
||||
$this->Ln();
|
||||
$this->Cell($header_width[0], 0, '', 'L', 0, 'C', $fill); // Pos.
|
||||
$this->Cell($header_width[1], 0, '', 0, 0, 'C', $fill); // St.
|
||||
$this->Cell($header_width[2], 0, $this->_stringCleaner(substr($row->item_name,70)), 0, 0, 'L', $fill); // Beschreibung
|
||||
} else {
|
||||
$this->Cell($header_width[2], 0, $this->_stringCleaner($row->item_name), 0, 0, 'L', $fill); // Beschreibung
|
||||
}
|
||||
|
||||
if ($data['header']->is_eu_order == 1) {
|
||||
$this->Cell($header_width[3], 0, '', 0, 0, 'R', $fill); // no mwst .. eu bill
|
||||
} else {
|
||||
$this->Cell($header_width[3], 0, $this->_stringCleaner(number_format($row->tax_rate, 2, ',', ' ').' %'), 0, 0, 'R', $fill); // mwst
|
||||
}
|
||||
|
||||
$sum += $row->shown_total;
|
||||
$item_taxes = $row->taxes * $row->amount;
|
||||
$taxes[$row->tax_rate] += $item_taxes;
|
||||
$taxsum += $item_taxes;
|
||||
$this->Cell($header_width[4], 0, $this->_stringCleaner(number_format($row->shown_amount, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($header_width[5], 0, $this->_stringCleaner(number_format($row->shown_total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill); // Gesamtpreis
|
||||
|
||||
$this->Ln();
|
||||
// middle row
|
||||
$this->Cell($header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($header_width[1], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[2], 0, 'Art-Nr.: '.$row->item_number, 0, 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($header_width[3], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[4], 0, '', 0, 0, 'R', $fill);
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
// last row
|
||||
if ($row->item_status) {
|
||||
$this->Cell($header_width[0] + $header_width[1], 0, '', 'L', 0, 'C', $fill);
|
||||
|
||||
$text = '';
|
||||
if ($row->item_status == 1) {
|
||||
// nicht lieferbar
|
||||
|
||||
if ($row->item_status_text) {
|
||||
$text = $row->item_status_text;
|
||||
} else {
|
||||
$text = 'nicht lieferbar';
|
||||
}
|
||||
} else if ($row->item_status == 2) {
|
||||
// nachliefern
|
||||
|
||||
if ($row->backorder_quantity) {
|
||||
$text .= $row->backorder_quantity;
|
||||
}
|
||||
if ($text == '' && $row->item_status_text) {
|
||||
$text .= $row->item_status_text;
|
||||
} else if ($row->item_status_text) {
|
||||
$text .= ' '.$row->item_status_text;
|
||||
} else {
|
||||
$text .= ' nachliefern';
|
||||
}
|
||||
if ($row->delivery_date) {
|
||||
if ($text != '') {
|
||||
$date = explode(' ', $row->delivery_date);
|
||||
$text .= ' - '.$date[2].'.'.$date[1].'.'.$date[0];
|
||||
}
|
||||
}
|
||||
} else if ($row->item_status == 3) {
|
||||
// nachliefern
|
||||
|
||||
if ($row->backorder_quantity) {
|
||||
$text .= $row->backorder_quantity;
|
||||
}
|
||||
if ($text == '' && $row->item_status_text) {
|
||||
$text .= $row->item_status_text;
|
||||
} else if ($row->item_status_text) {
|
||||
$text .= ' '.$row->item_status_text;
|
||||
} else {
|
||||
$text .= ' info';
|
||||
}
|
||||
if ($row->delivery_date) {
|
||||
if ($text != '') {
|
||||
$date = explode(' ', $row->delivery_date);
|
||||
$text .= ' - '.$date[2].'.'.$date[1].'.'.$date[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($header_width[2] + $header_width[3] + $header_width[4], 0, $this->_stringCleaner($text), 0, 0, 'L', $fill);
|
||||
|
||||
$this->Cell($header_width[5], 0, '', 'R', 0, 'L', $fill);
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
$fill = !$fill;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// conf footer
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
|
||||
// draw footer
|
||||
// total sum
|
||||
$this->checkForNewPage();
|
||||
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, 'Summe aller Artikel', 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($sum, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
|
||||
// payment method cost
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner('Zahlungsgebühren'), 0, 0, 'L', $fill);
|
||||
|
||||
$method_charges_gross = $data['header']->payment_method_charges;
|
||||
$method_charges_net = $data['header']->payment_method_charges / 119.0 * 100.0;
|
||||
$method_charges_vat = $data['header']->payment_method_charges / 119.0 * 19.0;
|
||||
if ($data['header']->cg_show_taxes) {
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($method_charges_gross, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
} else {
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($method_charges_net, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
}
|
||||
$this->Ln();
|
||||
|
||||
// delivery cost
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, 'Versandkosten', 0, 0, 'L', $fill);
|
||||
|
||||
$shipping_charges_gross = $data['header']->shipping_charges;
|
||||
$shipping_charges_net = $data['header']->shipping_charges / 119.0 * 100.0;
|
||||
$shipping_charges_vat = $data['header']->shipping_charges / 119.0 * 19.0;
|
||||
if ($data['header']->cg_show_taxes) {
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($shipping_charges_gross, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
} else {
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($shipping_charges_net, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
}
|
||||
$this->Ln();
|
||||
|
||||
if ($data['header']->is_eu_order && !$data['header']->cg_show_taxes) {
|
||||
$this->checkForNewPage();
|
||||
|
||||
//$subtotal = $sum + $net_shipping_charges + $net_method_charges;
|
||||
$subtotal = $sum + $shipping_charges_net + $method_charges_net;
|
||||
|
||||
if (isset($data['footer']->gift_certificate_id)) {
|
||||
$subtotal -= $data['footer']->gift_certificate_total;
|
||||
}
|
||||
|
||||
// TODO: HACK HACK HACK
|
||||
$this->total = $subtotal;
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner('Bruttosumme'), 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($subtotal, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner('zu zahlender Betrag'), 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($subtotal, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
// line
|
||||
$this->Cell(array_sum($header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
} else {
|
||||
if (!$data['footer']->taxes['19.00'] && ($method_charges_vat || $shipping_charges_vat)) {
|
||||
$data['footer']->taxes['19.00'] = 0;
|
||||
}
|
||||
foreach ($data['footer']->taxes as $key => $value) {
|
||||
if ($key == '19.00') {
|
||||
$value += ($method_charges_vat + $shipping_charges_vat);
|
||||
}
|
||||
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
if ($data['header']->cg_show_taxes) {
|
||||
$this->Cell(40, 0, $this->_stringCleaner('darin enthaltene Mwst. '.number_format($key, 2, ',', ' ').' %'), 0, 0, 'L', $fill);
|
||||
} else {
|
||||
// richard hack!!! muss geprüft werden!
|
||||
$taxsum .= $value;
|
||||
/*echo "taxsum: $taxsum <br>value: $value <br>sum: $sum <br>";
|
||||
echo "shipping: ".$data['header']->shipping_charges;
|
||||
echo "<br>payment: ".$data['header']->payment_method_charges;
|
||||
exit();*/
|
||||
|
||||
$this->Cell(40, 0, $this->_stringCleaner('zzgl. '.number_format($key, 2, ',', ' ').' % Mwst.'), 0, 0, 'L', $fill);
|
||||
}
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($value, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
// invoice total fat
|
||||
if ($data['header']->cg_show_taxes) {
|
||||
$total = $sum + $data['header']->shipping_charges + $data['header']->payment_method_charges;
|
||||
} else {
|
||||
// rk update hack!!!
|
||||
//$total = $sum + $shipping_charges_net + $method_charges_net + $taxsum;
|
||||
//$total = $sum + $data['header']->shipping_charges + $data['header']->payment_method_charges + $taxsum;
|
||||
$total = $data['footer']->order_total_with_tax;
|
||||
}
|
||||
|
||||
// gift certificate
|
||||
if (isset($data['footer']->gift_certificate_id)) {
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner('Zwischen Betrag'), 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
|
||||
$this->checkForNewPage();
|
||||
|
||||
$gift_certificate_text = 'abzgl. Gutschein '.$data['footer']->gift_certificate_code;
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner($gift_certificate_text), 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format(-$data['footer']->gift_certificate_total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
|
||||
$this->Ln();
|
||||
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner('zu zahlender Betrag'), 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format(($total - $data['footer']->gift_certificate_total), 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
|
||||
// line
|
||||
$this->Cell(array_sum($header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
|
||||
$this->total = $total - $data['footer']->gift_certificate_total;
|
||||
} else {
|
||||
$this->checkForNewPage();
|
||||
|
||||
$fill = !$fill;
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell(90, 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell(40, 0, $this->_stringCleaner('zu zahlender Betrag'), 0, 0, 'L', $fill);
|
||||
$this->Cell(60, 0, $this->_stringCleaner(number_format($total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Ln();
|
||||
// line
|
||||
$this->Cell(array_sum($header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
|
||||
$this->total = $total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function PrintEarlyPaymentRebate($rebate) {
|
||||
$earlyPayersRebate = $this->total * $rebate;
|
||||
|
||||
$text = 'Bei Bezahlung innerhalb von 14 Tagen gewähren wir '.
|
||||
(int)($rebate * 100).' % Skonto ('.number_format(($this->total - $earlyPayersRebate), 2, ',', '.').
|
||||
' anstelle von '.number_format(($this->total), 2, ',', '.').
|
||||
', eine Ersparnis von '.number_format(($earlyPayersRebate), 2, ',', '.').' €)';
|
||||
|
||||
$this->PrintNotice('Zahlungshinweis', $text);
|
||||
} // end PrintEarlyPaymentRebate
|
||||
|
||||
public function PrintNotice($title, $notice) {
|
||||
$this->checkForNewPage(substr_count($notice, "\n") + 1);
|
||||
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
$this->Cell(190, 1, $title, 1, 0, 'L', 1);
|
||||
|
||||
$this->Ln();
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
|
||||
$this->MultiCell(190, 1, $notice, 'LRB', 'L', 0);
|
||||
$this->Ln(4);
|
||||
}
|
||||
|
||||
protected function _getAlignment($num) {
|
||||
if ($num == 0) {
|
||||
return 'L';
|
||||
} else if ($num == 1) {
|
||||
return 'C';
|
||||
} else if ($num == 2) {
|
||||
return 'R';
|
||||
}
|
||||
|
||||
return 'C';
|
||||
}
|
||||
|
||||
protected function _stringCleaner($sting) {
|
||||
$search = array('€', 'ß', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü');
|
||||
$replace = array($this->unichr(8364), $this->unichr(223), $this->unichr(228), $this->unichr(246), $this->unichr(252), $this->unichr(196), $this->unichr(214), $this->unichr(220));
|
||||
|
||||
return str_replace($search, $replace, $sting);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
// packing slip
|
||||
include_once './core/order.class.php';
|
||||
include_once './core/customergroups.class.php';
|
||||
|
||||
include_once './libs/tcpdf/tcpdf.php';
|
||||
include_once './libs/tcpdf/include/tcpdf_fonts.php';
|
||||
include_once './core/config.class.php';
|
||||
|
||||
|
||||
class orderPDF extends TCPDF {
|
||||
|
||||
private $order_id = NULL;
|
||||
public $data = array();
|
||||
|
||||
private $_image_path = NULL;
|
||||
|
||||
private $_fill_r = 102;
|
||||
private $_fill_g = 102;
|
||||
private $_fill_b = 102;
|
||||
|
||||
private $_border_r = 0;
|
||||
private $_border_g = 0;
|
||||
private $_border_b = 0;
|
||||
|
||||
private $_stripe_r = 249;
|
||||
private $_stripe_g = 249;
|
||||
private $_stripe_b = 249;
|
||||
|
||||
private $_text_r = 0;
|
||||
private $_text_g = 0;
|
||||
private $_text_b = 0;
|
||||
|
||||
private $_light_text_r = 128;
|
||||
private $_light_text_g = 128;
|
||||
private $_light_text_b = 128;
|
||||
|
||||
private $_line_width = 0.2;
|
||||
|
||||
private $fontfamily = 'Arial';
|
||||
|
||||
public function __construct($order_ids) {
|
||||
$this->pdfSettings();
|
||||
$first_page = true;
|
||||
foreach ($order_ids as $order_id) {
|
||||
if (!$first_page) {
|
||||
$this->addPage('', '', true, true);
|
||||
}
|
||||
$this->order_id = $order_id;
|
||||
$this->load();
|
||||
$this->writeBOPPDF();
|
||||
$first_page = false;
|
||||
}
|
||||
$this->getPdf();
|
||||
}
|
||||
|
||||
private function load() {
|
||||
$db = Registry::get('base')->db;
|
||||
$order = new Order(Registry::get('base'));
|
||||
$order->set_id($this->order_id);
|
||||
|
||||
$this->data['order'] = $order->get_data();
|
||||
if ($this->data['order'] != null && sizeof($this->data['order']->items) > 0 ) {
|
||||
foreach ($this->data['order']->items As $index => $row) {
|
||||
if (sizeof($row->attribute_array) > 0) {
|
||||
foreach ($row->attribute_array AS $indece => $att) {
|
||||
|
||||
if ($this->data['order']->items[$index]->variant1 && $att->value && $att->name && $this->data['order']->items[$index]->variant1 == $att->value) {
|
||||
$this->data['order']->items[$index]->vn1 = $att->name;
|
||||
}
|
||||
|
||||
if ($this->data['order']->items[$index]->variant2 && $att->value && $att->name && $this->data['order']->items[$index]->variant2 == $att->value) {
|
||||
$this->data['order']->items[$index]->vn2 = $att->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT os.name AS status_bez, d.name AS deliverers, pm.name AS pm, ps.name AS ps, cb.name AS billing_country, cs.name AS shipping_country
|
||||
FROM order_status AS os
|
||||
LEFT JOIN deliverers AS d ON(d.id = '".$this->data['order']->shipping_method."')
|
||||
LEFT JOIN payment_methods AS pm ON(pm.id = '".$this->data['order']->payment_method."')
|
||||
LEFT JOIN payment_status AS ps ON(ps.id = '".$this->data['order']->payment_status."')
|
||||
LEFT JOIN countries AS cb ON(cb.id = '".$this->data['order']->billing_country."')
|
||||
LEFT JOIN countries AS cs ON(cs.id = '".$this->data['order']->shipping_country."')
|
||||
WHERE os.id = '".$this->data['order']->order_status."'";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
while ($row = $result->fetch_object()) {
|
||||
$this->data['order_data']['status_bez']=$row->status_bez;
|
||||
$this->data['order_data']['deliverers']=$row->deliverers;
|
||||
$this->data['order_data']['pm']=$row->pm;
|
||||
$this->data['order_data']['ps']=$row->ps;
|
||||
$this->data['order_data']['billing_country']=$row->billing_country;
|
||||
$this->data['order_data']['shipping_country']=$row->shipping_country;
|
||||
}
|
||||
//$result->free();
|
||||
|
||||
$this->customer_group_object = new CustomerGroups(Registry::get('base'));
|
||||
$this->data['customer_groups'] = $this->customer_group_object->get_by_user($this->data['order']->customer_id);
|
||||
}
|
||||
|
||||
private function writeBOPPDF() {
|
||||
$this->writeOrderData();
|
||||
$this->writeCustomerData();
|
||||
$this->writePaymentsData();
|
||||
$this->writeBillingData();
|
||||
$this->writeBilingAddress();
|
||||
$this->writeShippingAddress();
|
||||
$this->writeItemData();
|
||||
$this->write_customer_info();
|
||||
}
|
||||
|
||||
private function pdfSettings() {
|
||||
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
$this->_image_path = ROOT_DIR.'web/'.SHOP_SYSTEM.'/documents/';
|
||||
$this->SetMargins(6, 5, 5);
|
||||
$this->startPage();
|
||||
}
|
||||
|
||||
public function Header() {}
|
||||
|
||||
public function Footer() {}
|
||||
|
||||
private function writeOrderData() {
|
||||
$order_dt = list($y,$m,$d)=explode('-',$this->data['order']->order_date);
|
||||
|
||||
$orderdata = 'Bst. Nr.: '.$this->data['order']->order_number.PHP_EOL;
|
||||
|
||||
if ($this->data['order_data']['status_bez']) {
|
||||
$orderdata.= 'Status: '.$this->data['order_data']['status_bez'].PHP_EOL;
|
||||
}
|
||||
|
||||
$orderdata.= 'Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(40,15, $orderdata, 0, 'L',0,1,5,10);
|
||||
}
|
||||
|
||||
private function writeCustomerData() {
|
||||
$customerdata = 'K-Nr.: '.$this->data['order']->customer_number.PHP_EOL;
|
||||
$customerdata.= 'Kunde: '.$this->data['order']->customer_name.PHP_EOL;
|
||||
// get customer email
|
||||
$customer_object = new Customer(Registry::get('base'));
|
||||
$customer_data = $customer_object->get_data($this->data['order']->customer_id);
|
||||
if ($customer_data) {
|
||||
$customerdata.= 'E-Mail: '.$customer_data->email.PHP_EOL;
|
||||
$customerdata.= 'Tel: '.$customer_data->phone.PHP_EOL;
|
||||
$customerdata.= 'Fax: '.$customer_data->fax.PHP_EOL;
|
||||
}
|
||||
if ($this->data['customer_groups']->name) {
|
||||
//$customerdata.= 'Gruppe: '.$this->data['customer_groups']->name.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(50,20, $customerdata, 0, 'L',0,1,50,10);
|
||||
$this->SetFont('', '',10);
|
||||
}
|
||||
|
||||
private function writePaymentsData() {
|
||||
$paymentdata='';
|
||||
|
||||
if ($this->data['order_data']['pm']) {
|
||||
$paymentdata.= 'Zahlungsart: '.$this->data['order_data']['pm'].PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order_data']['ps']) {
|
||||
$paymentdata.= 'Zahlungsstatus: '.$this->data['order_data']['ps'].PHP_EOL;
|
||||
}
|
||||
|
||||
// get customer payment data
|
||||
$sql = "SELECT freetextfield3 FROM customers WHERE id = '".$this->data['order']->customer_id."'";
|
||||
$db = Registry::get('base')->db;
|
||||
$result = $db->query($sql);
|
||||
while ($row = $result->fetch_object()) {
|
||||
$paymentdata .= $row->freetextfield3.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->payment_date) {
|
||||
$pay_dt = list($y,$m,$d)=explode('-',$this->data['order']->payment_date);
|
||||
$paymentdata.= 'Zahlungs Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
}
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(50,35, $paymentdata, 0, 'L',0,1,105,10);
|
||||
$this->SetFont('', '',10);
|
||||
}
|
||||
|
||||
private function writeBillingData() {
|
||||
$billing_dt = list($y,$m,$d)=explode('-',$this->data['order']->billing_date);
|
||||
|
||||
$billingdata.= 'Rechnungs Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
if ($this->data['order']->invoice_number) {
|
||||
$billingdata.= 'Rechnungs Nr.: '.$this->data['order']->invoice_number.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order_data']['deliverers']) {
|
||||
$billingdata.= 'Lieferant.: '.$this->data['order_data']['deliverers'].PHP_EOL;
|
||||
}
|
||||
if ($this->data['order']->trackingcode) {
|
||||
$billingdata.= 'Tracking-Code: '.$this->data['order']->trackingcode.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,35, $billingdata, 0, 'L',0,1,155,10);
|
||||
}
|
||||
|
||||
private function writeBilingAddress() {
|
||||
$bill_address='Rechnungsadresse:'.PHP_EOL;
|
||||
|
||||
switch($this->data['order']->billing_honorific) {
|
||||
case '0': $bill_address.="Herr".PHP_EOL; break;
|
||||
case '1': $bill_address.="Frau".PHP_EOL; break;
|
||||
case '2': $bill_address.="Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['order']->billing_company) {
|
||||
$bill_address.=$this->data['order']->billing_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->billing_firstname || $this->data['order']->billing_surname) {
|
||||
if ($this->data['order']->billing_firstname) {
|
||||
$bill_address.=$this->data['order']->billing_firstname." ";
|
||||
}
|
||||
if ($this->data['order']->billing_surname) {
|
||||
$bill_address.=$this->data['order']->billing_surname;
|
||||
}
|
||||
$bill_address.=PHP_EOL;
|
||||
}
|
||||
|
||||
$bill_address.=$this->data['order']->billing_street.' '.$this->data['order']->billing_house_number.PHP_EOL;
|
||||
$bill_address.=$this->data['order']->billing_zip_code.' '.$this->data['order']->billing_city.PHP_EOL;
|
||||
$bill_address.=$this->data['order_data']['billing_country'].PHP_EOL;
|
||||
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(80,20, $bill_address, 0, 'L',0,1,5,32);
|
||||
$this->SetFont('', '',10);
|
||||
}
|
||||
|
||||
private function writeShippingAddress() {
|
||||
$ship_address='Lieferadresse:'.PHP_EOL;
|
||||
|
||||
switch($this->data['order']->shipping_honorific) {
|
||||
case '0': $ship_address.="Herr".PHP_EOL; break;
|
||||
case '1': $ship_address.="Frau".PHP_EOL; break;
|
||||
case '2': $ship_address.="Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['order']->shipping_company) {
|
||||
$ship_address.=$this->data['order']->shipping_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->shipping_firstname || $this->data['order']->shipping_surname) {
|
||||
if ($this->data['order']->shipping_firstname) {
|
||||
$ship_address.=$this->data['order']->shipping_firstname." ";
|
||||
}
|
||||
if ($this->data['order']->shipping_surname) {
|
||||
$ship_address.=$this->data['order']->shipping_surname;
|
||||
}
|
||||
$ship_address.=PHP_EOL;
|
||||
}
|
||||
|
||||
$ship_address2 =$this->data['order']->shipping_street.' '.$this->data['order']->shipping_house_number.PHP_EOL;
|
||||
$ship_address2 .=$this->data['order']->shipping_zip_code.' '.$this->data['order']->shipping_city.PHP_EOL;
|
||||
$ship_address3 =$this->data['order_data']['shipping_country'].PHP_EOL;
|
||||
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,10, $ship_address, 0, 'L',0,1,105,32);
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(80,10, $ship_address2, 0, 'L',0,1,105,50);
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,10, $ship_address3, 0, 'L',0,1,105,59);
|
||||
}
|
||||
|
||||
private function writeItemData() {
|
||||
$this->sum = 0;
|
||||
$this->taxsum = 0;
|
||||
$this->taxes = array();
|
||||
if ($this->data['order'] != null && sizeof($this->data['order']->items) > 0) {
|
||||
|
||||
$this->header_width = array(5, 5, 75, 10, 30, 25, 10, 40);
|
||||
$this->writeItemHeader();
|
||||
|
||||
$i = 1;
|
||||
$fill = 0;
|
||||
foreach ($this->data['order']->items as $row) {
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill); // Pos.
|
||||
$this->SetFont('', 'B', 10);
|
||||
$this->Cell($this->header_width[1], 0, $row->amount, 0, 0, 'C', $fill); // St.
|
||||
$this->SetFont('', '', 8);
|
||||
if (strlen($row->item_name) < 50) {
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner($row->item_name), 0, 0, 'L', $fill); // Beschreibung
|
||||
}
|
||||
else {
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner(substr($row->item_name,0,50)), 0, 0, 'L', $fill); // Beschreibung
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[3], 0, $this->_stringCleaner(number_format($row->tax_rate, 2, ',', ' ').' %'), 0, 0, 'L', $fill); // mwst
|
||||
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$gross_price = $row->price + $row->taxes;
|
||||
$gross_total = $row->amount * $gross_price;
|
||||
$this->sum += $gross_total;
|
||||
$this->taxes[$row->tax_rate] = $this->taxes[$row->tax_rate]+($row->taxes * $row->amount);
|
||||
$this->taxsum += $row->taxes * $row->amount;
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[4], 0, $this->_stringCleaner(number_format($gross_price, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($gross_total, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Gesamtpreis
|
||||
$this->SetFont('', '', 8);
|
||||
} else {
|
||||
$net_price = $row->price;
|
||||
$net_total = $row->amount * $net_price;
|
||||
$this->sum += $net_total;
|
||||
$this->taxes[$row->tax_rate] = $this->taxes[$row->tax_rate] + ($row->taxes * $row->amount);
|
||||
$this->taxsum += $row->taxes * $row->amount;
|
||||
$this->SetFont('', 'B', 10);
|
||||
$this->Cell($this->header_width[4], 0, $this->_stringCleaner(number_format($net_price, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($net_total, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Gesamtpreis
|
||||
$this->SetFont('', '', 8);
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
foreach (array(50, 100, 150, 200) as $i) {
|
||||
if (strlen($row->item_name) > $i) {
|
||||
$c = $i - 1;
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner(substr($row->item_name,$c, 50)), '', 0, 'L', $fill); // Beschreibung
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
}
|
||||
$this->SetFont('', '', 2);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2]+$this->header_width[3]+$this->header_width[4]+$this->header_width[5], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[7], 0, '', 'R', 0, 'C', $fill);
|
||||
$this->Ln();
|
||||
$this->SetFont('', 'B', 10);
|
||||
|
||||
$artikelnr ="Art-Nr.: ".$row->item_number;
|
||||
if ($row->variant1) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn1) {
|
||||
$artikelnr.=$row->vn1.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant1;
|
||||
}
|
||||
if ($row->variant2) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn2) {
|
||||
$artikelnr.=$row->vn2.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($row->item_status == 2) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// nachliefern
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($width, 0, $text, 'BR', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
} else if ($row->item_status == 3) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// infotext
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($width, 0, $row->item_status_text, 'BR', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, 'B', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->writeItemFooter();
|
||||
}
|
||||
}
|
||||
|
||||
private function writeItemHeader($header_width = false) {
|
||||
$this->SetY($this->gety()+5);
|
||||
$this->SetFont('', 'B', 18);
|
||||
$this->Cell(120, 0, "Bestellschein", '', 0, 'L');
|
||||
$this->Ln();
|
||||
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
// draw header
|
||||
$this->Cell($this->header_width[0], 0, 'P', 'LTB', 0, 'C', 1); // Pos.
|
||||
$this->Cell($this->header_width[1], 0, 'St.', 'TB', 0, 'C', 1); // St.
|
||||
$this->Cell($this->header_width[2], 0, 'Beschreibung/Art-Nr.', 'TB', 0, 'L', 1); // Art-Nr./Beschreibung
|
||||
$this->Cell($this->header_width[3], 0, 'MwSt.', 'TB', 0, 'L', 1); //
|
||||
$this->Cell($this->header_width[4], 0, 'Stückpreis', 'TB', 0, 'R', 1); //
|
||||
$this->Cell($this->header_width[5], 0, 'Gesamtpreis', 'RTB', 0, 'R', 1); //
|
||||
$this->Cell($this->header_width[6], 0, 'St.', 'LTB', 0, 'R', 1); // stückzahl lager
|
||||
$this->Cell($this->header_width[7], 0, 'Kommentar', 'LRTB', 0, 'R', 1); // comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writeItemFooter() {
|
||||
$fill = 0;
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, 'Summe aller Artikel:', 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->sum, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('Zahlungsgebühren:'), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->data['order']->payment_method_charges, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, 'Versandkosten:', 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->data['order']->shipping_charges, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
foreach ($this->taxes as $key => $value) {
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('darin enthaltene Mwst.: '.number_format($key, 2, ',', ' ').' %'), 0, 0, 'L', $fill);
|
||||
} else {
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('zzgl.: '.number_format($key, 2, ',', ' ').' % Mwst.'), 0, 0, 'L', $fill);
|
||||
}
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($value, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
// invoice total fat
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$total = $this->sum + $this->data['order']->shipping_charges + $this->data['order']->payment_method_charges;
|
||||
} else {
|
||||
$total = $this->sum + $this->data['order']->shipping_charges + $this->data['order']->payment_method_charges + $this->taxsum;
|
||||
}
|
||||
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 5, '', 'L', 0, 'C', $fill);
|
||||
$this->SetFont('', 'B', 10);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4],5,$this->_stringCleaner('zu zahlender Betrag:'), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 5, $this->_stringCleaner(number_format($total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 5, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(array_sum($this->header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writebopUser() {
|
||||
$this->SetFont('', '', 10);
|
||||
$this->SetY($this->gety()+10);
|
||||
$this->Cell(10, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / gepackt von', 'T', 0, 'C');
|
||||
$this->Cell(15, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / geprüft von', 'T', 0, 'C');
|
||||
}
|
||||
|
||||
public function write_customer_info() {
|
||||
//$this->CheckForNewPage(substr_count($notice, "\n") + 1);
|
||||
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
$this->Cell(200, 1, "Kundentext", 1, 0, 'L', 1);
|
||||
|
||||
$this->Ln();
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
|
||||
$this->MultiCell(200, 1, $this->data['order']->customer_info, 'LRB', 'L', 0);
|
||||
$this->Ln(4);
|
||||
}
|
||||
|
||||
|
||||
protected function _stringCleaner($sting) {
|
||||
$search = array('€', 'ß', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü');
|
||||
$replace = array(TCPDF_FONTS::unichr(8364), TCPDF_FONTS::unichr(223), TCPDF_FONTS::unichr(228), TCPDF_FONTS::unichr(246), TCPDF_FONTS::unichr(252), TCPDF_FONTS::unichr(196), TCPDF_FONTS::unichr(214), TCPDF_FONTS::unichr(220));
|
||||
return str_replace($search, $replace, $sting);
|
||||
}
|
||||
|
||||
private function getPdf() {
|
||||
$this->Output('Bestellschein-'.$this->data['order']->invoice_number.'.pdf', 'D');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,568 @@
|
||||
<?php
|
||||
// packing slip
|
||||
include_once './core/order.class.php';
|
||||
include_once './core/customergroups.class.php';
|
||||
|
||||
include_once './libs/tcpdf/tcpdf.php';
|
||||
include_once './libs/tcpdf/include/tcpdf_fonts.php';
|
||||
include_once './core/config.class.php';
|
||||
|
||||
|
||||
class orderPDF extends TCPDF {
|
||||
|
||||
private $order_id = NULL;
|
||||
public $data = array();
|
||||
|
||||
private $_image_path = NULL;
|
||||
|
||||
private $_fill_r = 102;
|
||||
private $_fill_g = 102;
|
||||
private $_fill_b = 102;
|
||||
|
||||
private $_border_r = 0;
|
||||
private $_border_g = 0;
|
||||
private $_border_b = 0;
|
||||
|
||||
private $_stripe_r = 249;
|
||||
private $_stripe_g = 249;
|
||||
private $_stripe_b = 249;
|
||||
|
||||
private $_text_r = 0;
|
||||
private $_text_g = 0;
|
||||
private $_text_b = 0;
|
||||
|
||||
private $_light_text_r = 128;
|
||||
private $_light_text_g = 128;
|
||||
private $_light_text_b = 128;
|
||||
|
||||
private $_line_width = 0.2;
|
||||
|
||||
private $fontfamily = 'Arial';
|
||||
|
||||
public function __construct($order_ids) {
|
||||
$this->pdfSettings();
|
||||
$first_page = true;
|
||||
foreach ($order_ids as $order_id) {
|
||||
if (!$first_page) {
|
||||
$this->addPage('', '', true, true);
|
||||
}
|
||||
$this->order_id = $order_id;
|
||||
$this->load();
|
||||
$this->writeBOPPDF();
|
||||
$first_page = false;
|
||||
}
|
||||
$this->getPdf();
|
||||
}
|
||||
|
||||
private function load() {
|
||||
$db = Registry::get('base')->db;
|
||||
$order = new Order(Registry::get('base'));
|
||||
$order->set_id($this->order_id);
|
||||
|
||||
$this->data['order'] = $order->get_data();
|
||||
if ($this->data['order'] != null && sizeof($this->data['order']->items) > 0 ) {
|
||||
foreach ($this->data['order']->items As $index => $row) {
|
||||
if (sizeof($row->attribute_array) > 0) {
|
||||
foreach ($row->attribute_array AS $indece => $att) {
|
||||
|
||||
if ($this->data['order']->items[$index]->variant1 && $att->value && $att->name && $this->data['order']->items[$index]->variant1 == $att->value) {
|
||||
$this->data['order']->items[$index]->vn1 = $att->name;
|
||||
}
|
||||
|
||||
if ($this->data['order']->items[$index]->variant2 && $att->value && $att->name && $this->data['order']->items[$index]->variant2 == $att->value) {
|
||||
$this->data['order']->items[$index]->vn2 = $att->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT os.name AS status_bez, d.name AS deliverers, pm.name AS pm, ps.name AS ps, cb.name AS billing_country, cs.name AS shipping_country
|
||||
FROM order_status AS os
|
||||
LEFT JOIN deliverers AS d ON(d.id = '".$this->data['order']->shipping_method."')
|
||||
LEFT JOIN payment_methods AS pm ON(pm.id = '".$this->data['order']->payment_method."')
|
||||
LEFT JOIN payment_status AS ps ON(ps.id = '".$this->data['order']->payment_status."')
|
||||
LEFT JOIN countries AS cb ON(cb.id = '".$this->data['order']->billing_country."')
|
||||
LEFT JOIN countries AS cs ON(cs.id = '".$this->data['order']->shipping_country."')
|
||||
WHERE os.id = '".$this->data['order']->order_status."'";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
while ($row = $result->fetch_object()) {
|
||||
$this->data['order_data']['status_bez']=$row->status_bez;
|
||||
$this->data['order_data']['deliverers']=$row->deliverers;
|
||||
$this->data['order_data']['pm']=$row->pm;
|
||||
$this->data['order_data']['ps']=$row->ps;
|
||||
$this->data['order_data']['billing_country']=$row->billing_country;
|
||||
$this->data['order_data']['shipping_country']=$row->shipping_country;
|
||||
}
|
||||
//mysql_free_result($result);
|
||||
|
||||
$this->customer_group_object = new CustomerGroups(Registry::get('base'));
|
||||
$this->data['customer_groups'] = $this->customer_group_object->get_by_user($this->data['order']->customer_id);
|
||||
}
|
||||
|
||||
private function writeBOPPDF() {
|
||||
$this->writeOrderData();
|
||||
$this->writeCustomerData();
|
||||
$this->writePaymentsData();
|
||||
$this->writeBillingData();
|
||||
$this->writeBilingAddress();
|
||||
$this->writeShippingAddress();
|
||||
$this->writeItemData();
|
||||
$this->write_customer_info();
|
||||
}
|
||||
|
||||
private function pdfSettings() {
|
||||
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
$this->_image_path = ROOT_DIR.'web/'.SHOP_SYSTEM.'/documents/';
|
||||
$this->SetMargins(6, 5, 5);
|
||||
$this->startPage();
|
||||
}
|
||||
|
||||
public function Header() {}
|
||||
|
||||
public function Footer() {}
|
||||
|
||||
private function writeOrderData() {
|
||||
$order_dt = list($y,$m,$d)=explode('-',$this->data['order']->order_date);
|
||||
|
||||
$orderdata = 'Bst. Nr.: '.$this->data['order']->order_number.PHP_EOL;
|
||||
|
||||
if ($this->data['order_data']['status_bez']) {
|
||||
$orderdata.= 'Status: '.$this->data['order_data']['status_bez'].PHP_EOL;
|
||||
}
|
||||
|
||||
$orderdata.= 'Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(40,15, $orderdata, 0, 'L',0,1,5,10);
|
||||
}
|
||||
|
||||
private function writeCustomerData() {
|
||||
$customerdata = 'K-Nr.: '.$this->data['order']->customer_number.PHP_EOL;
|
||||
$customerdata.= 'Kunde: '.$this->data['order']->customer_name.PHP_EOL;
|
||||
// get customer email
|
||||
$customer_object = new Customer(Registry::get('base'));
|
||||
$customer_data = $customer_object->get_data($this->data['order']->customer_id);
|
||||
if ($customer_data) {
|
||||
$customerdata.= 'E-Mail: '.$customer_data->email.PHP_EOL;
|
||||
$customerdata.= 'Tel: '.$customer_data->phone.PHP_EOL;
|
||||
$customerdata.= 'Fax: '.$customer_data->fax.PHP_EOL;
|
||||
}
|
||||
if ($this->data['customer_groups']->name) {
|
||||
//$customerdata.= 'Gruppe: '.$this->data['customer_groups']->name.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(50,20, $customerdata, 0, 'L',0,1,50,10);
|
||||
$this->SetFont('', '',10);
|
||||
}
|
||||
|
||||
private function writePaymentsData() {
|
||||
$paymentdata='';
|
||||
|
||||
if ($this->data['order_data']['pm']) {
|
||||
$paymentdata.= 'Zahlungsart: '.$this->data['order_data']['pm'].PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order_data']['ps']) {
|
||||
$paymentdata.= 'Zahlungsstatus: '.$this->data['order_data']['ps'].PHP_EOL;
|
||||
}
|
||||
|
||||
// get customer payment data
|
||||
$sql = "SELECT freetextfield3 FROM customers WHERE id = '".$this->data['order']->customer_id."'";
|
||||
$db = Registry::get('base')->db;
|
||||
$result = $db->query($sql);
|
||||
while ($row = $result->fetch_object()) {
|
||||
$paymentdata .= $row->freetextfield3.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->payment_date) {
|
||||
$pay_dt = list($y,$m,$d)=explode('-',$this->data['order']->payment_date);
|
||||
$paymentdata.= 'Zahlungs Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
}
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(50,35, $paymentdata, 0, 'L',0,1,105,10);
|
||||
$this->SetFont('', '',10);
|
||||
}
|
||||
|
||||
private function writeBillingData() {
|
||||
$billing_dt = list($y,$m,$d)=explode('-',$this->data['order']->billing_date);
|
||||
|
||||
$billingdata.= 'Rechnungs Datum: '.$d.'.'.$m.'.'.$y.PHP_EOL;
|
||||
if ($this->data['order']->invoice_number) {
|
||||
$billingdata.= 'Rechnungs Nr.: '.$this->data['order']->invoice_number.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order_data']['deliverers']) {
|
||||
$billingdata.= 'Lieferant.: '.$this->data['order_data']['deliverers'].PHP_EOL;
|
||||
}
|
||||
if ($this->data['order']->trackingcode) {
|
||||
$billingdata.= 'Tracking-Code: '.$this->data['order']->trackingcode.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,35, $billingdata, 0, 'L',0,1,155,10);
|
||||
}
|
||||
|
||||
private function writeBilingAddress() {
|
||||
$bill_address='Rechnungsadresse:'.PHP_EOL;
|
||||
|
||||
switch($this->data['order']->billing_honorific) {
|
||||
case '0': $bill_address.="Herr".PHP_EOL; break;
|
||||
case '1': $bill_address.="Frau".PHP_EOL; break;
|
||||
case '2': $bill_address.="Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['order']->billing_company) {
|
||||
$bill_address.=$this->data['order']->billing_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->billing_firstname || $this->data['order']->billing_surname) {
|
||||
if ($this->data['order']->billing_firstname) {
|
||||
$bill_address.=$this->data['order']->billing_firstname." ";
|
||||
}
|
||||
if ($this->data['order']->billing_surname) {
|
||||
$bill_address.=$this->data['order']->billing_surname;
|
||||
}
|
||||
$bill_address.=PHP_EOL;
|
||||
}
|
||||
|
||||
$bill_address.=$this->data['order']->billing_street.' '.$this->data['order']->billing_house_number.PHP_EOL;
|
||||
$bill_address.=$this->data['order']->billing_zip_code.' '.$this->data['order']->billing_city.PHP_EOL;
|
||||
$bill_address.=$this->data['order_data']['billing_country'].PHP_EOL;
|
||||
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(80,20, $bill_address, 0, 'L',0,1,5,32);
|
||||
$this->SetFont('', '',10);
|
||||
}
|
||||
|
||||
private function writeShippingAddress() {
|
||||
$ship_address='Lieferadresse:'.PHP_EOL;
|
||||
|
||||
switch($this->data['order']->shipping_honorific) {
|
||||
case '0': $ship_address.="Herr".PHP_EOL; break;
|
||||
case '1': $ship_address.="Frau".PHP_EOL; break;
|
||||
case '2': $ship_address.="Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['order']->shipping_company) {
|
||||
$ship_address.=$this->data['order']->shipping_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['order']->shipping_firstname || $this->data['order']->shipping_surname) {
|
||||
if ($this->data['order']->shipping_firstname) {
|
||||
$ship_address.=$this->data['order']->shipping_firstname." ";
|
||||
}
|
||||
if ($this->data['order']->shipping_surname) {
|
||||
$ship_address.=$this->data['order']->shipping_surname;
|
||||
}
|
||||
$ship_address.=PHP_EOL;
|
||||
}
|
||||
|
||||
$ship_address2 =$this->data['order']->shipping_street.' '.$this->data['order']->shipping_house_number.PHP_EOL;
|
||||
$ship_address2 .=$this->data['order']->shipping_zip_code.' '.$this->data['order']->shipping_city.PHP_EOL;
|
||||
$ship_address3 =$this->data['order_data']['shipping_country'].PHP_EOL;
|
||||
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,10, $ship_address, 0, 'L',0,1,105,32);
|
||||
$this->SetFont('', 'B',10);
|
||||
$this->MultiCell(80,10, $ship_address2, 0, 'L',0,1,105,50);
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,10, $ship_address3, 0, 'L',0,1,105,59);
|
||||
}
|
||||
|
||||
private function writeItemData() {
|
||||
$this->sum = 0;
|
||||
$this->taxsum = 0;
|
||||
$this->taxes = array();
|
||||
if ($this->data['order'] != null && sizeof($this->data['order']->items) > 0) {
|
||||
|
||||
$this->header_width = array(5, 5, 75, 10, 30, 25, 10, 40);
|
||||
$this->writeItemHeader();
|
||||
|
||||
$i = 1;
|
||||
$fill = 0;
|
||||
foreach ($this->data['order']->items as $row) {
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill); // Pos.
|
||||
$this->SetFont('', 'B', 10);
|
||||
$this->Cell($this->header_width[1], 0, $row->amount, 0, 0, 'C', $fill); // St.
|
||||
$this->SetFont('', '', 8);
|
||||
if (strlen($row->item_name) < 50) {
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner($row->item_name), 0, 0, 'L', $fill); // Beschreibung
|
||||
}
|
||||
else {
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner(substr($row->item_name,0,50)), 0, 0, 'L', $fill); // Beschreibung
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[3], 0, $this->_stringCleaner(number_format($row->tax_rate, 2, ',', ' ').' %'), 0, 0, 'L', $fill); // mwst
|
||||
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$gross_price = $row->price + $row->taxes;
|
||||
$gross_total = $row->amount * $gross_price;
|
||||
$this->sum += $gross_total;
|
||||
$this->taxes[$row->tax_rate] = $this->taxes[$row->tax_rate]+($row->taxes * $row->amount);
|
||||
$this->taxsum += $row->taxes * $row->amount;
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[4], 0, $this->_stringCleaner(number_format($gross_price, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($gross_total, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Gesamtpreis
|
||||
$this->SetFont('', '', 8);
|
||||
} else {
|
||||
$net_price = $row->price;
|
||||
$net_total = $row->amount * $net_price;
|
||||
$this->sum += $net_total;
|
||||
$this->taxes[$row->tax_rate] = $this->taxes[$row->tax_rate] + ($row->taxes * $row->amount);
|
||||
$this->taxsum += $row->taxes * $row->amount;
|
||||
$this->SetFont('', 'B', 10);
|
||||
$this->Cell($this->header_width[4], 0, $this->_stringCleaner(number_format($net_price, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Stückpreis
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($net_total, 2, ',', ' ').' €'), 0, 0, 'R', $fill); // Gesamtpreis
|
||||
$this->SetFont('', '', 8);
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
foreach (array(50, 100, 150, 200) as $i) {
|
||||
if (strlen($row->item_name) > $i) {
|
||||
$c = $i - 1;
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $this->_stringCleaner(substr($row->item_name,$c, 50)), '', 0, 'L', $fill); // Beschreibung
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
}
|
||||
$this->SetFont('', '', 2);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2]+$this->header_width[3]+$this->header_width[4]+$this->header_width[5], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[7], 0, '', 'R', 0, 'C', $fill);
|
||||
$this->Ln();
|
||||
$this->SetFont('', 'B', 10);
|
||||
|
||||
$artikelnr ="Art-Nr.: ".$row->item_number;
|
||||
if ($row->variant1) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn1) {
|
||||
$artikelnr.=$row->vn1.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant1;
|
||||
}
|
||||
if ($row->variant2) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn2) {
|
||||
$artikelnr.=$row->vn2.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($row->item_status == 2) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// nachliefern
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($width, 0, $text, 'BR', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
} else if ($row->item_status == 3) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// infotext
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($width, 0, $row->item_status_text, 'BR', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2], 0, $artikelnr, 'B', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[3], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[4], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[5], 0, '', 'B', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LB', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LBR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->writeItemFooter();
|
||||
}
|
||||
}
|
||||
|
||||
private function writeItemHeader($header_width = false) {
|
||||
$this->SetY($this->gety()+5);
|
||||
$this->SetFont('', 'B', 18);
|
||||
$this->Cell(120, 0, "Bestellschein", '', 0, 'L');
|
||||
$this->Ln();
|
||||
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
// draw header
|
||||
$this->Cell($this->header_width[0], 0, 'P', 'LTB', 0, 'C', 1); // Pos.
|
||||
$this->Cell($this->header_width[1], 0, 'St.', 'TB', 0, 'C', 1); // St.
|
||||
$this->Cell($this->header_width[2], 0, 'Beschreibung/Art-Nr.', 'TB', 0, 'L', 1); // Art-Nr./Beschreibung
|
||||
$this->Cell($this->header_width[3], 0, 'MwSt.', 'TB', 0, 'L', 1); //
|
||||
$this->Cell($this->header_width[4], 0, 'Stückpreis', 'TB', 0, 'R', 1); //
|
||||
$this->Cell($this->header_width[5], 0, 'Gesamtpreis', 'RTB', 0, 'R', 1); //
|
||||
$this->Cell($this->header_width[6], 0, 'St.', 'LTB', 0, 'R', 1); // stückzahl lager
|
||||
$this->Cell($this->header_width[7], 0, 'Kommentar', 'LRTB', 0, 'R', 1); // comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writeItemFooter() {
|
||||
$fill = 0;
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, 'Summe aller Artikel:', 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->sum, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('Zahlungsgebühren:'), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->data['order']->payment_method_charges, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, 'Versandkosten:', 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($this->data['order']->shipping_charges, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
foreach ($this->taxes as $key => $value) {
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 0, '', 'L', 0, 'C', $fill);
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('darin enthaltene Mwst.: '.number_format($key, 2, ',', ' ').' %'), 0, 0, 'L', $fill);
|
||||
} else {
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4], 0, $this->_stringCleaner('zzgl.: '.number_format($key, 2, ',', ' ').' % Mwst.'), 0, 0, 'L', $fill);
|
||||
}
|
||||
$this->Cell($this->header_width[5], 0, $this->_stringCleaner(number_format($value, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 0, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
// invoice total fat
|
||||
if ($this->data['customer_groups']->show_tax) {
|
||||
$total = $this->sum + $this->data['order']->shipping_charges + $this->data['order']->payment_method_charges;
|
||||
} else {
|
||||
$total = $this->sum + $this->data['order']->shipping_charges + $this->data['order']->payment_method_charges + $this->taxsum;
|
||||
}
|
||||
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2], 5, '', 'L', 0, 'C', $fill);
|
||||
$this->SetFont('', 'B', 10);
|
||||
$this->Cell($this->header_width[3]+$this->header_width[4],5,$this->_stringCleaner('zu zahlender Betrag:'), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[5], 5, $this->_stringCleaner(number_format($total, 2, ',', ' ').' €'), 'R', 0, 'R', $fill);
|
||||
$this->SetFont('', 'B', 8);
|
||||
$this->Cell($this->header_width[6]+$this->header_width[7], 5, '', 'R', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->Cell(array_sum($this->header_width), 0, '', 'T');
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writebopUser() {
|
||||
$this->SetFont('', '', 10);
|
||||
$this->SetY($this->gety()+10);
|
||||
$this->Cell(10, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / gepackt von', 'T', 0, 'C');
|
||||
$this->Cell(15, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / geprüft von', 'T', 0, 'C');
|
||||
}
|
||||
|
||||
public function write_customer_info() {
|
||||
//$this->CheckForNewPage(substr_count($notice, "\n") + 1);
|
||||
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
$this->Cell(200, 1, "Kundentext", 1, 0, 'L', 1);
|
||||
|
||||
$this->Ln();
|
||||
$this->SetTextColor(0);
|
||||
$this->SetFont('');
|
||||
|
||||
$this->MultiCell(200, 1, $this->data['order']->customer_info, 'LRB', 'L', 0);
|
||||
$this->Ln(4);
|
||||
}
|
||||
|
||||
|
||||
protected function _stringCleaner($sting) {
|
||||
$search = array('€', 'ß', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü');
|
||||
$replace = array(TCPDF_FONTS::unichr(8364), TCPDF_FONTS::unichr(223), TCPDF_FONTS::unichr(228), TCPDF_FONTS::unichr(246), TCPDF_FONTS::unichr(252), TCPDF_FONTS::unichr(196), TCPDF_FONTS::unichr(214), TCPDF_FONTS::unichr(220));
|
||||
return str_replace($search, $replace, $sting);
|
||||
}
|
||||
|
||||
private function getPdf() {
|
||||
$this->Output('Bestellschein-'.$this->data['order']->invoice_number.'.pdf', 'D');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
// packing slip
|
||||
include_once './core/order.class.php';
|
||||
include_once './core/customergroups.class.php';
|
||||
|
||||
include_once './libs/tcpdf/tcpdf.php';
|
||||
include_once './core/config.class.php';
|
||||
|
||||
|
||||
class PackingSlipPDF extends TCPDF {
|
||||
|
||||
private $order_id = NULL;
|
||||
public $data = array();
|
||||
|
||||
private $_image_path = NULL;
|
||||
|
||||
private $_fill_r = 102;
|
||||
private $_fill_g = 102;
|
||||
private $_fill_b = 102;
|
||||
|
||||
private $_border_r = 0;
|
||||
private $_border_g = 0;
|
||||
private $_border_b = 0;
|
||||
|
||||
private $_stripe_r = 249;
|
||||
private $_stripe_g = 249;
|
||||
private $_stripe_b = 249;
|
||||
|
||||
private $_text_r = 0;
|
||||
private $_text_g = 0;
|
||||
private $_text_b = 0;
|
||||
|
||||
private $_light_text_r = 128;
|
||||
private $_light_text_g = 128;
|
||||
private $_light_text_b = 128;
|
||||
|
||||
private $_line_width = 0.2;
|
||||
|
||||
private $fontfamily = 'Arial';
|
||||
|
||||
public function __construct($order_id) {
|
||||
$this->order_id = $order_id;
|
||||
|
||||
$db = Registry::get('base')->db;
|
||||
$order = new Order(Registry::get('base'));
|
||||
$this->data = $order->get_order_by_id($order_id);
|
||||
|
||||
$this->writePackingSlipPDF();
|
||||
}
|
||||
|
||||
private function writePackingSlipPDF() {
|
||||
$this->pdfSettings();
|
||||
|
||||
$this->writeOrderData();
|
||||
$this->writeCustomerData();
|
||||
$this->writePaymentsData();
|
||||
$this->writeBillingData();
|
||||
$this->writeBilingAddress();
|
||||
$this->writeShippingAddress();
|
||||
$this->writeItemData();
|
||||
$this->writebopUser();
|
||||
|
||||
$this->getPdf();
|
||||
}
|
||||
|
||||
private function pdfSettings() {
|
||||
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
$this->_image_path = ROOT_DIR.'web/'.SHOP_SYSTEM.'/documents/';
|
||||
$this->SetMargins(6, 5, 5);
|
||||
$this->startPage();
|
||||
}
|
||||
|
||||
public function Header() {}
|
||||
|
||||
public function Footer() {}
|
||||
|
||||
private function writeOrderData() {
|
||||
$order_dt = explode('-', $this->data['header']->order_date);
|
||||
|
||||
$orderdata = 'Bst. Nr.: '.$this->data['header']->order_number.PHP_EOL;
|
||||
|
||||
if ($this->data['header']->order_status_text) {
|
||||
$orderdata.= 'Bst. Status: '.$this->data['header']->order_status_text.PHP_EOL;
|
||||
}
|
||||
|
||||
$orderdata.= 'Bst. Datum: '.$order_dt[2].'.'.$order_dt[1].'.'.$order_dt[0].PHP_EOL;
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(40,15, $orderdata, 0, 'L',0,1,5,10);
|
||||
}
|
||||
|
||||
private function writeCustomerData() {
|
||||
$customerdata = 'Kde. Nr.: '.$this->data['header']->customer_number.PHP_EOL;
|
||||
$customerdata.= 'Kde. Name: '.$this->data['header']->customer_name.PHP_EOL;
|
||||
|
||||
if ($this->data['header']->customer_group_text) {
|
||||
$customerdata.= 'Kde. Gruppe: '.$this->data['header']->customer_group_text.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,20, $customerdata, 0, 'L',0,1,50,10);
|
||||
}
|
||||
|
||||
private function writePaymentsData() {
|
||||
$paymentdata='';
|
||||
|
||||
if ($this->data['header']->payment_method_text) {
|
||||
$paymentdata .= 'Zahlungsart: '.$this->data['header']->payment_method_text.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['header']->payment_status_text) {
|
||||
$paymentdata .= 'Zahlungsstatus: '.$this->data['header']->payment_status_text.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['header']->payment_date) {
|
||||
$pay_dt = list($y,$m,$d)=explode('-', $this->data['header']->payment_date);
|
||||
$paymentdata.= 'Zahlungs Datum: '.$pay_dt[2].'.'.$pay_dt[1].'.'.$pay_dt[0].PHP_EOL;
|
||||
}
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,35, $paymentdata, 0, 'L',0,1,105,10);
|
||||
}
|
||||
|
||||
private function writeBillingData() {
|
||||
$billing_dt = explode('-', $this->data['header']->billing_date);
|
||||
|
||||
$billingdata .= 'Rechnungs Datum: '.$billing_dt[2].'.'.$billing_dt[1].'.'.$billing_dt[0].PHP_EOL;
|
||||
if ($this->data['header']->invoice_number) {
|
||||
$billingdata .= 'Rechnungs Nr.: '.$this->data['header']->invoice_number.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['header']->shipping_method_tesxt) {
|
||||
$billingdata .= 'Lieferant.: '.$this->data['header']->shipping_method_tesxt.PHP_EOL;
|
||||
}
|
||||
if ($this->data['header']->trackingcode) {
|
||||
$billingdata.= 'Tracking-Code: '.$this->data['header']->trackingcode.PHP_EOL;
|
||||
}
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(50,35, $billingdata, 0, 'L',0,1,155,10);
|
||||
}
|
||||
|
||||
private function writeBilingAddress() {
|
||||
$bill_address = 'Rechnungsadresse:'.PHP_EOL;
|
||||
|
||||
switch ($this->data['header']->billing_honorific) {
|
||||
case '0': $bill_address .= "Herr".PHP_EOL; break;
|
||||
case '1': $bill_address .="Frau".PHP_EOL; break;
|
||||
case '2': $bill_address .= "Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['header']->billing_company) {
|
||||
$bill_address .= $this->data['header']->billing_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['header']->billing_firstname || $this->data['order']->billing_surname) {
|
||||
if ($this->data['header']->billing_firstname) {
|
||||
$bill_address .= $this->data['header']->billing_firstname." ";
|
||||
}
|
||||
if ($this->data['header']->billing_surname) {
|
||||
$bill_address .= $this->data['header']->billing_surname;
|
||||
}
|
||||
$bill_address .= PHP_EOL;
|
||||
}
|
||||
|
||||
$bill_address .= $this->data['header']->billing_street.' '.$this->data['header']->billing_house_number.PHP_EOL;
|
||||
$bill_address .= $this->data['header']->billing_zip_code.' '.$this->data['header']->billing_city.PHP_EOL;
|
||||
$bill_address .= $this->data['header']->billing_country_text.PHP_EOL;
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,20, $bill_address, 0, 'L',0,1,5,32);
|
||||
}
|
||||
|
||||
private function writeShippingAddress() {
|
||||
$ship_address = 'Lieferadresse:'.PHP_EOL;
|
||||
|
||||
switch ($this->data['header']->shipping_honorific) {
|
||||
case '0': $ship_address .= "Herr".PHP_EOL; break;
|
||||
case '1': $ship_address .= "Frau".PHP_EOL; break;
|
||||
case '2': $ship_address .= "Firma".PHP_EOL; break;
|
||||
}
|
||||
|
||||
if ($this->data['header']->shipping_company) {
|
||||
$ship_address .= $this->data['header']->shipping_company.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($this->data['header']->shipping_firstname || $this->data['header']->shipping_surname) {
|
||||
if ($this->data['header']->shipping_firstname) {
|
||||
$ship_address.=$this->data['header']->shipping_firstname." ";
|
||||
}
|
||||
if ($this->data['header']->shipping_surname) {
|
||||
$ship_address.=$this->data['header']->shipping_surname;
|
||||
}
|
||||
$ship_address .= PHP_EOL;
|
||||
}
|
||||
|
||||
$ship_address .= $this->data['header']->shipping_street.' '.$this->data['header']->shipping_house_number.PHP_EOL;
|
||||
$ship_address .= $this->data['header']->shipping_zip_code.' '.$this->data['header']->shipping_city.PHP_EOL;
|
||||
$ship_address .= $this->data['header']->shipping_country_text.PHP_EOL;
|
||||
|
||||
|
||||
$this->SetFont('', '',10);
|
||||
$this->MultiCell(80,20, $ship_address, 0, 'L',0,1,105,32);
|
||||
}
|
||||
|
||||
private function writeItemData() {
|
||||
if (sizeof($this->data['items']) > 0) {
|
||||
|
||||
$this->header_width = array(5, 5, 75, 10, 30, 25, 10, 40);
|
||||
$this->writeItemHeader();
|
||||
|
||||
$i = 1;
|
||||
$fill = 0;
|
||||
foreach ($this->data['items'] as $row) {
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetTextColor($this->_text_r, $this->_text_g, $this->_text_b);
|
||||
$this->Cell($this->header_width[0], 0, $i, 'L', 0, 'C', $fill); // Pos.
|
||||
$this->Cell($this->header_width[1], 0, $row->amount, 0, 0, 'C', $fill); // St.
|
||||
$this->Cell($this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5], 0, $this->_stringCleaner($row->item_name), 0, 0, 'L', $fill); // Beschreibung
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
$this->SetFont('', '', 2);
|
||||
$this->Cell($this->header_width[0]+$this->header_width[1]+$this->header_width[2]+$this->header_width[3]+$this->header_width[4]+$this->header_width[5], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'LR', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[7], 0, '', 'R', 0, 'C', $fill);
|
||||
$this->Ln();
|
||||
$this->SetFont('', '', 8);
|
||||
|
||||
$artikelnr ="Art-Nr.: ".$row->item_number;
|
||||
if ($row->variant1) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn1) {
|
||||
$artikelnr.=$row->vn1.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant1;
|
||||
}
|
||||
if ($row->variant2) {
|
||||
$artikelnr.=" / ";
|
||||
if ($row->vn2) {
|
||||
$artikelnr.=$row->vn2.': ';
|
||||
} else {
|
||||
$artikelnr.='Attr: ';
|
||||
}
|
||||
$artikelnr.=$row->variant2;
|
||||
}
|
||||
|
||||
if ($row->item_status == 2) {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
|
||||
// nachliefern
|
||||
$text = $row->amount.' bestellt '.$row->backorder_quantity.' auf nachlieferung';
|
||||
$width = 0;
|
||||
foreach ($this->header_width as $header_width) {
|
||||
$width += $header_width;
|
||||
}
|
||||
|
||||
$width -= ($this->header_width[0] + $this->header_width[1] + $this->header_width[6] + $this->header_width[7]);
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5], 0, $text, 'R', 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
} else {
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5], 0, $artikelnr, '', 0, 'L', $fill); // Art-Nr.
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
if (isset($row->children)) {
|
||||
foreach ($row->children as $child) {
|
||||
$childtext = $child->item_name;
|
||||
if ($child->variant1 != '') {
|
||||
$childtext .= ' '.$child->variant1;
|
||||
}
|
||||
if ($child->variant2 != '') {
|
||||
$childtext .= ' '.$child->variant2;
|
||||
}
|
||||
if ($child->user_data != '') {
|
||||
$childtext .= " '".$child->user_data."'";
|
||||
}
|
||||
$thildtext .= ' '.$child->item_number;
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'L', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1], 0, '', '', 0, 'R', $fill);
|
||||
$this->Cell($this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5], 0, $this->_stringCleaner($childtext), 0, 0, 'L', $fill);
|
||||
$this->Cell($this->header_width[6], 0, '', 'L', 0, 'R', $fill); // Lagerist Anzahl
|
||||
$this->Cell($this->header_width[7], 0, '', 'LR', 0, 'R', $fill); // Lagerist Comment
|
||||
$this->Ln();
|
||||
}
|
||||
}
|
||||
|
||||
$this->Cell($this->header_width[0], 0, '', 'LB', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[1] + $this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5] + $this->header_width[6], 0, '', 'B', 0, 'C', $fill);
|
||||
$this->Cell($this->header_width[7], 0, '', 'R', 0, 'C', $fill);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function writeItemHeader($header_width) {
|
||||
$this->SetY($this->gety()+5);
|
||||
$this->SetFont('', 'B', 18);
|
||||
$this->Cell(120, 0, "Packschein", '', 0, 'L');
|
||||
$this->Ln();
|
||||
|
||||
$this->SetFont('', '', 8);
|
||||
$this->SetFillColor($this->_fill_r, $this->_fill_g, $this->_fill_b);
|
||||
$this->SetTextColor(255);
|
||||
$this->SetDrawColor($this->_border_r, $this->_border_g, $this->_border_b);
|
||||
$this->SetLineWidth($this->_line_width);
|
||||
$this->SetFont('', 'B');
|
||||
|
||||
// draw header
|
||||
$this->Cell($this->header_width[0], 0, 'P', 'LTB', 0, 'C', 1); // Pos.
|
||||
$this->Cell($this->header_width[1], 0, 'St.', 'TB', 0, 'C', 1); // St.
|
||||
$this->Cell($this->header_width[2] + $this->header_width[3] + $this->header_width[4] + $this->header_width[5], 0, 'Beschreibung/Art-Nr.', 'TB', 0, 'L', 1); // Art-Nr./Beschreibung
|
||||
$this->Cell($this->header_width[6], 0, 'St.', 'LTB', 0, 'R', 1);
|
||||
$this->Cell($this->header_width[7], 0, 'Kommentar', 'LRTB', 0, 'R', 1); // comment
|
||||
$this->Ln();
|
||||
}
|
||||
|
||||
private function writebopUser() {
|
||||
$this->SetFont('', '', 10);
|
||||
$this->SetY($this->gety()+10);
|
||||
$this->Cell(10, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / gepackt von', 'T', 0, 'C');
|
||||
$this->Cell(15, 0, '', 0, 0, 'C');
|
||||
$this->Cell(80, 0, 'Datum / gepr�ft von', 'T', 0, 'C');
|
||||
}
|
||||
|
||||
protected function _stringCleaner($sting) {
|
||||
$search = array('€', 'ß', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü');
|
||||
$replace = array($this->unichr(8364), $this->unichr(223), $this->unichr(228), $this->unichr(246), $this->unichr(252), $this->unichr(196), $this->unichr(214), $this->unichr(220));
|
||||
return str_replace($search, $replace, $sting);
|
||||
}
|
||||
|
||||
private function getPdf() {
|
||||
$this->Output('Packschein-'.$this->data['order']->invoice_number.'.pdf', 'D');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
<table class="order">
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<th class="pos">Pos.</th>
|
||||
<th class="quantity">St.</th>
|
||||
<th class="item">Beschreibung/Art-Nr.</th>
|
||||
<th class="tax_rate">MwSt.</th>
|
||||
<th class="price">Stückpreis</th>
|
||||
<th class="total">Gesamtpreis</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="6"><hr /></th>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{if $order_items}
|
||||
{foreach from=$order_items item=item}
|
||||
<tr class="item_data_row">
|
||||
|
||||
<td class="pos">
|
||||
{$item@index + 1}
|
||||
</td>
|
||||
|
||||
<td class="quantity">
|
||||
<span>{$item->amount}</span>
|
||||
</td>
|
||||
|
||||
<td class="item">
|
||||
<span>{$item->item_name}</span>
|
||||
<div>
|
||||
{if $item->attribute_7 && $item->item_number != $item->attribute_7}
|
||||
Art-Nr.:{$item->attribute_7} ({$template_text.item_details.old_item_number_title} {$item->item_number})
|
||||
{else}
|
||||
Art-Nr.: {$item->item_number}
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="tax_rate">
|
||||
<span>{$item->tax_rate} %</span>
|
||||
</td>
|
||||
|
||||
<td class="price">
|
||||
{if $showtaxes == '0'}
|
||||
<span>{$item->price|number_format:2:",":" "} €</span>
|
||||
{else}
|
||||
<span>{$item->price_with_taxes|number_format:2:",":" "} €</span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="total">
|
||||
{if $showtaxes == '0'}
|
||||
<span>{$item->total|number_format:2:",":" "} €</span>
|
||||
{else}
|
||||
<span>{$item->total_with_taxes|number_format:2:",":" "} €</span>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
{if $item->item_status == '1' or $item->item_status == '2' or $item->item_status == '3'}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</td>
|
||||
|
||||
<td colspan="3">
|
||||
<div>
|
||||
{if $item->item_status == '1'}
|
||||
{if $item->item_status_text}
|
||||
{$item->item_status_text}
|
||||
{else}
|
||||
nicht lieferbar
|
||||
{/if}
|
||||
{elseif $item->item_status == '2'}
|
||||
{if $item->backorder_quantity}
|
||||
{$item->backorder_quantity}
|
||||
{/if}
|
||||
|
||||
{if $item->item_status_text}
|
||||
{$item->item_status_text}
|
||||
{else}
|
||||
nachliefern
|
||||
{/if}
|
||||
|
||||
{if $item->delivery_date}
|
||||
{$item->delivery_date}
|
||||
{/if}
|
||||
{elseif $item->item_status == '3'}
|
||||
{if $item->backorder_quantity}
|
||||
{$item->backorder_quantity}
|
||||
{/if}
|
||||
|
||||
{if $item->item_status_text}
|
||||
{$item->item_status_text}
|
||||
{else}
|
||||
info
|
||||
{/if}
|
||||
|
||||
{if $item->delivery_date}
|
||||
{$item->delivery_date}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{if $item->attribute_1_text}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</td>
|
||||
|
||||
<td colsapn="3">
|
||||
{$item->attribute_1_text}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{if $item->attribute_2_text}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</td>
|
||||
|
||||
<td colsapn="3">
|
||||
{$item->attribute_2_text}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{if $item->user_data}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</td>
|
||||
|
||||
<td colsapn="3">
|
||||
"{$item->user_data}"
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
|
||||
<tr>
|
||||
<td colspan="6"><hr /></td>
|
||||
</tr>
|
||||
|
||||
<tr class="item_total">
|
||||
<td colspan="3"></td>
|
||||
<td colspan="3">
|
||||
Summe aller Artikel
|
||||
<span class="total">
|
||||
{if $showtaxes == '0'}
|
||||
<span>
|
||||
{if $footer->sub}
|
||||
{$footer->sub|number_format:2:",":" "}
|
||||
{/if}
|
||||
</span>
|
||||
€
|
||||
{else}
|
||||
<span>
|
||||
{if $footer->sub_with_taxes}
|
||||
{$footer->sub_with_taxes|number_format:2:",":" "}
|
||||
{/if}
|
||||
</span>
|
||||
€
|
||||
{/if}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{if $order_data->is_eu_order != 1}
|
||||
<tr class="tax">
|
||||
<td colspan="3"></td>
|
||||
{if $order_items}
|
||||
{if $showtaxes == '0'}
|
||||
<td colspan="3" id="tax_target">
|
||||
{foreach $footer->taxes as $key => $value}
|
||||
<div class="{$key} without_tax">zzgl. {$key|number_format:2:",":" "}% Mwst. <span class="total"><span>{$value|number_format:2:",":" "}</span> €</span></div>
|
||||
{/foreach}
|
||||
</td>
|
||||
{else}
|
||||
<td colspan="4" id="tax_target">
|
||||
{foreach $footer->taxes as $key => $value}
|
||||
<div class="{$key} with_tax">darin enthaltene Mwst. {$key|number_format:2:",":" "}% <span class="total"><span>{$value|number_format:2:",":" "}</span> €</span></div>
|
||||
{/foreach}
|
||||
</td>
|
||||
{/if}
|
||||
{else}
|
||||
<td colspan="3" id="tax_target">
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
{if $footer->shipping_charges != 0}
|
||||
<tr class="shipping">
|
||||
<td colspan="3"></td>
|
||||
<td colspan="3">
|
||||
Versandkosten
|
||||
<span class="total">
|
||||
<span>
|
||||
{if $footer->shipping_charges}
|
||||
{$footer->shipping_charges|number_format:2:",":" "}
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
€
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $footer->payment_method_charges != 0}
|
||||
<tr class="payment_method">
|
||||
<td colspan="3"></td>
|
||||
<td colspan="3">
|
||||
Zahlungsgebühren
|
||||
<span class="total">
|
||||
<span>
|
||||
{if $footer->payment_method_charges}
|
||||
{$footer->payment_method_charges|number_format:2:",":" "}
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
€
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $footer->gift_certificate_id}
|
||||
<tr class="order_total">
|
||||
<td colspan="3"></td>
|
||||
<td colspan="4">
|
||||
<span style="font-weight:bold;">Zwischen Betrag</span>
|
||||
<span class="total">
|
||||
<span>
|
||||
{if $footer->order_total}
|
||||
{$footer->order_total|number_format:2:",":" "}
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
€
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="gift_certificate">
|
||||
<td colspan="4">
|
||||
abzgl. Gutschein {$footer->gift_certificate_code}
|
||||
<span class="total">
|
||||
<span>
|
||||
- {$footer->gift_certificate_total|number_format:"2":".":""}
|
||||
</span>
|
||||
|
||||
€
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="order_total_after_gift">
|
||||
<td colspan="3"></td>
|
||||
<td colspan="4">
|
||||
<span style="font-weight:bold;">Fälliger Betrag</span>
|
||||
<span class="total">
|
||||
<span>
|
||||
{($footer->order_total - $footer->gift_certificate_total)|number_format:"2":".":""}
|
||||
</span>
|
||||
|
||||
€
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{else}
|
||||
<tr class="order_total">
|
||||
<td colspan="3"></td>
|
||||
<td colspan="3">
|
||||
<b>zu zahlender Betrag
|
||||
<span class="total">
|
||||
<span>
|
||||
{if $footer->order_total}
|
||||
{$footer->order_total|number_format:2:",":" "}
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
€
|
||||
</span></b>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
Reference in New Issue
Block a user