Antwort #15 am: 14. Juli 2010, 17:21:18
Hallo nochmal
Noch immer suche ich nach einer Lösung, um die Umsatzsteuer-ID des Kunden in die PDF-Rechnung zu bekommen.
Die geänderte "print_order.php" lautet:
<?// PdfRechnung geschrieben von Leonid Lezner. leolezner@yahoo.de// Version 1.0if(!defined('PDF_LIEFERSCHEIN')) define('PDF_LIEFERSCHEIN', false);require('includes/application_top.php');define('FPDF_FONTPATH', DIR_FS_ADMIN
.'PdfBriefe/font/');require_once(DIR_FS_INC
.'xtc_get_order_data.inc.php');require_once(DIR_FS_INC
.'xtc_get_attributes_model.inc.php');require_once(DIR_FS_INC
.'xtc_not_null.inc.php');require_once(DIR_FS_INC
.'xtc_format_price_order.inc.php');require_once (DIR_FS_INC
.'xtc_validate_vatid_status.inc.php');include(DIR_WS_CLASSES
. 'order.php');$order = new order
($_GET['oID']);// Sprache der Rechnung einstellen$sprache = $order->info['language'];require('PdfBriefe/PdfRechnung.php');// Objekte initiallisieren$pdf = new PdfRechnung
();$pdf->Init("Rechnung");// Kunden ID abfragen$order_query_check = xtc_db_query
("SELECT customers_id FROM ".TABLE_ORDERS
." WHERE orders_id='".(int
)$_GET['oID']."'");$order_check = xtc_db_fetch_array
($order_query_check);$customers_id = $order_check['customers_id'];$order_query_check = xtc_db_query
("SELECT customers_gender FROM ".TABLE_CUSTOMERS
." WHERE customers_id='".(int
)$customers_id."'");$customer_gender = xtc_db_fetch_array
($order_query_check);$kundenadresse = xtc_address_format
($order->customer['format_id'], $order->billing, 1, '', '<br>');// Ausgabe des Adressenfeldes und des Logos$pdf->Adresse(str_replace("<br>", "\n", $kundenadresse), TEXT_PDF_SHOPADRESSEKLEIN
);$pdf->Logo(DIR_FS_CATALOG
.'templates/'.CURRENT_TEMPLATE
.'/img/logo_big.png');// Datum in das Format tt.mm.jj umwandelnpreg_match("/(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})/", $order->info['date_purchased'], $dt);$date_purchased = time();//mktime($dt[4], $dt[5], $dt[6], $dt[2], $dt[3], $dt[1]);// Zahlungsweise abfragenif ($order->info['payment_method']!='' && $order->info['payment_method']!='no_payment'){ include(DIR_FS_CATALOG
.'lang/'.$sprache.'/modules/payment/'.$order->info['payment_method'].'.php'); $payment_method = constant(strtoupper('MODULE_PAYMENT_'.$order->info['payment_method'].'_TEXT_TITLE'));}$order_info_query = xtc_db_query
("SELECT bill_nr FROM ".TABLE_ORDERS
." WHERE orders_id='".$_GET['oID']."';");$order_info_data = xtc_db_fetch_array
($order_info_query);$order_bill = $order_info_data['bill_nr'];$pdf->Rechnungsdaten($order->customer['csID'], $order_bill, $_GET['oID'], date("d.m.y", $date_purchased), $payment_method, PDF_LIEFERSCHEIN
);$pdf->RechnungStart($order->customer['lastname'], $customer_gender['customers_gender'], PDF_LIEFERSCHEIN
);$pdf->ListeKopf();// Produktinfos$order_query=xtc_db_query
("SELECT
products_id,
orders_products_id,
products_model,
products_name,
products_price,
final_price,
products_quantity
FROM ".TABLE_ORDERS_PRODUCTS
."
WHERE orders_id='".(int
)$_GET['oID']."'");$order_data=array();// Ausgabe der Produktewhile ($order_data_values = xtc_db_fetch_array
($order_query)){ $attributes_query = xtc_db_query
("SELECT
products_options,
products_options_values,
price_prefix,
options_values_price
FROM ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES
."
WHERE orders_products_id='".$order_data_values['orders_products_id']."'"); $attributes_data=''; $attributes_model=''; while ($attributes_data_values = xtc_db_fetch_array
($attributes_query)) { $attributes_data .= $attributes_data_values['products_options'].': '.$attributes_data_values['products_options_values']."\n"; $attributes_model .= xtc_get_attributes_model
($order_data_values['products_id'],$attributes_data_values['products_options_values'],$attributes_data_values['products_options'])."\n"; } $pdf->ListeProduktHinzu($order_data_values['products_quantity'], $order_data_values['products_name'], trim($attributes_data), $order_data_values['products_model'], trim($attributes_model), xtc_format_price_order
($order_data_values['products_price'],1,$order->info['currency']), xtc_format_price_order
($order_data_values['final_price'],1,$order->info['currency']));}// Ausgabe der Summe$oder_total_query=xtc_db_query
("SELECT
title,
text,
class,
value,
sort_order
FROM ".TABLE_ORDERS_TOTAL
."
WHERE orders_id='".$_GET['oID']."'
ORDER BY sort_order ASC");$order_data = array();while ($oder_total_values = xtc_db_fetch_array
($oder_total_query)) $order_data[]=array('title' => $oder_total_values['title'], 'class'=> $oder_total_values['class'], 'value'=> $oder_total_values['value'], 'text' => $oder_total_values['text']);$pdf->Betrag($order_data);$pdf->RechnungEnde();$pdf->Kommentar($order->info['comments']);$pdf->Output(STORE_NAME
.'_Order_'.$_GET['oID'].'.pdf' , 'D');?> dabei sticht mir folgendes ins Auge:
// Kunden ID abfragen
$order_query_check = xtc_db_query("SELECT customers_id FROM ".TABLE_ORDERS." WHERE orders_id='".(int)$_GET['oID']."'");
$order_check = xtc_db_fetch_array($order_query_check);
$customers_id = $order_check['customers_id'];
$order_query_check = xtc_db_query("SELECT customers_gender FROM ".TABLE_CUSTOMERS." WHERE customers_id='".(int)$customers_id."'");
So als totaler Laie würde ich nun vermuten, das die Abfrage der Kunden-ID einer evtl. einzufügenden UST-ID recht ähnlich sein muß. - doch wie genau müsste sie denn lauten, oder aber befinde ich mich hier komplett auf dem Holzweg.
Vielen Dank für Eure Zeit !
Viele Grüße Shakira