<?php

	//  Copyright (c) 2004-2007 randshop
	//  http://www.randshop.com
	//
	//  Unter Lizenz von randshop
	//	
	//	Letzte Bearbeitung: 25.04.2007
	
	// Source = 

	// Action ermitteln
	if ($_POST["action"]) { $Action = $_POST["action"]; };
	if ($_GET["action"]) { $Action = $_GET["action"]; };

	// ID des Kunden ermitteln
	if ($_POST["kundenid"]) { $KundenID = $_POST["kundenid"]; };
	if ($_GET["kundenid"]) { $KundenID = $_GET["kundenid"]; };

	// ID der Bestellung ermitteln
	if ($_POST["bestellid"]) { $BestellID = $_POST["bestellid"]; };
	if ($_GET["bestellid"]) { $BestellID  = $_GET["bestellid"]; };

	// Kundendaten einlesen
	$KundenObject = GetKundenDetail($_SESSION["mail"]);
	
	// Bestellung einlesen
	$BestellObject = GetBestellenDetail($BestellID);
	
	if ($KundenObject->id == $BestellObject->kunden_id) {
	
	// Kundendaten
	$tpl_anrede = $BestellObject->anrede;
	$tpl_titel = $BestellObject->titel;
	$tpl_vorname = $BestellObject->vorname;
	$tpl_nachname = $BestellObject->nachname;
	$tpl_firma = $BestellObject->firma;
	$tpl_strasse = $BestellObject->strasse;
	$tpl_hausnummer = $BestellObject->hausnummer;
	$tpl_plz = $BestellObject->plz;
	$tpl_ort = $BestellObject->ort;
	$tpl_land = $BestellObject->land;
	$tpl_la_anrede = $BestellObject->la_anrede;
	$tpl_la_titel = $BestellObject->la_titel;
	$tpl_la_vorname = $BestellObject->la_vorname;
	$tpl_la_nachname = $BestellObject->la_nachname;
	$tpl_la_firma = $BestellObject->la_firma;
	$tpl_la_strasse = $BestellObject->la_strasse;
	$tpl_la_hausnummer = $BestellObject->la_hausnummer;
	$tpl_la_plz = $BestellObject->la_plz;
	$tpl_la_ort = $BestellObject->la_ort;
	$tpl_la_land = $BestellObject->la_land;
	$tpl_lieferung = $BestellObject->wohin_liefern;
	
	// Kundenname
	if ($tpl_vorname) {
		
		if ($tpl_titel) {
			$RechnungsanschriftName = $tpl_anrede . " " . $tpl_titel . " " . $tpl_vorname . " " . $tpl_nachname;
			
		}
		else 
		{ 
			$RechnungsanschriftName = $tpl_anrede . " " . $tpl_vorname . " " . $tpl_nachname;
			
		}
	} else {
		
		if ($tpl_titel) {
			$RechnungsanschriftName = $tpl_anrede . " " . $tpl_titel . " " . $tpl_nachname;
		
		} else {
			$RechnungsanschriftName = $tpl_anrede . " " . $tpl_nachname;
		
		}
	}
    
	if ($tpl_la_vorname) {
			if ($tpl_la_titel) {
			$LieferanschriftName = $tpl_la_anrede . " " . $tpl_la_titel . " " . $tpl_la_vorname . " " . $tpl_la_nachname;
			
			}
			else {
			$LieferanschriftName = $tpl_la_anrede . " " . $tpl_la_vorname . " " . $tpl_la_nachname;	
			
			}
	} else {
		if($tpl_la_titel) {
			$LieferanschriftName =  $tpl_la_anrede . " " . $tpl_la_titel . " " . $tpl_la_nachname;
			
		}
		else {
			$LieferanschriftName = $tpl_la_anrede .  " " . $tpl_la_nachname;
			
		}
	}
	// Bestelldaten
	$tpl_auftragsnummer = $BestellObject->auftragsnummer;
	$tpl_auftragsdatum = $BestellObject->auftragsdatum_format;
	$tpl_versandtdatum = $BestellObject->versandtdatum_format;
	$tpl_paketnummer = $BestellObject->paketnummer;

	// Versanddatum
	if ($tpl_versandtdatum == 0) {
		$tpl_versandtdatum = "<i>" . $a_bs_nochnichtverschickt . "</i>";
	} else {
		$tpl_versandtdatum = "<b>" . $tpl_versandtdatum . "</b>";
	}

	// Warenkorb
	$tpl_warenkorbarray = $BestellObject->warenkorbdataarray["warenkorbarray"];

	// MwSt-Satz f�r Versandart
	$tpl_versandmwst = $BestellObject->versand_mwst_format;

	// MwSt
	$tpl_mwstarray = $BestellObject->warenkorbdataarray["mwstarray"];

	// Warenwert
	$tpl_warenwert = $BestellObject->warenwert_format_einfach;
	$tpl_warenwert_text = $BestellObject->warenwert_text;
	
	// Zahlungsart
	$tpl_zahlungsart_name = $BestellObject->zahlungsart_name;
	$tpl_zahlungsart_preis = $BestellObject->zahlungsart_preis_format_einfach;

	// Versandart
	$tpl_versandart_name = $BestellObject->versandart_name;
	$tpl_versandart_preis = $BestellObject->versandart_preis_format_einfach;
	
	// Rabatt
	$tpl_rabatt_name = $BestellObject->rabatt_name;
	$tpl_rabatt_prozent = $BestellObject->rabatt_prozent;
	$tpl_rabatt_betrag = $BestellObject->rabatt_betrag_format_einfach;

    // Gutschein
    $tpl_gutschein_text = $BestellObject->gutschein_text;
    $tpl_gutschein_betrag = $BestellObject->gutschein_betrag_format_einfach;
	
	// Summen
	$tpl_gesamtsumme = $BestellObject->gesamtsumme_format_einfach;
	$tpl_gesamtsumme_text = $BestellObject->gesamtsumme_text;
	$tpl_gesamtsumme_alternativ = $BestellObject->gesamtsumme_alternativ_format_einfach;
	$tpl_gesamtsumme_alternativ_text = $BestellObject->gesamtsumme_alternativ_text;
	
	}

	// Template
	$contentFile = DATEIPFAD . "templates/" . $rowTemp->name . "/website/user/bestelldetail.tpl";

?>
