<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php
require('load_this/load_bigware_11.php');   
$attendee_id = go_db_producing_input($_POST['attendees_id']);
$attendee_group_id = go_db_producing_input($_POST['attendees_group_id']);
$gender = go_db_producing_input($_POST['gender']);
$firstname = go_db_producing_input($_POST['firstname']);
$lastname = go_db_producing_input($_POST['lastname']);
$dob = go_db_producing_input($_POST['dob']);
$email_address = go_db_producing_input($_POST['email_address']);
$telephone = go_db_producing_input($_POST['telephone']);
$fax = go_db_producing_input($_POST['fax']);
$newsletter = go_db_producing_input($_POST['newsletter']);
$password = go_db_producing_input($_POST['password']);
$confirmation = go_db_producing_input($_POST['confirmation']);
$street_address = go_db_producing_input($_POST['street_address']);
$company = go_db_producing_input($_POST['company']);
$suburb = go_db_producing_input($_POST['suburb']);
$postcode = go_db_producing_input($_POST['postcode']);
$city = go_db_producing_input($_POST['city']);
$zone_id = go_db_producing_input($_POST['zone_id']);
$state = go_db_producing_input($_POST['state']);
$land = go_db_producing_input($_POST['land']);
$format_id = "5";
$size = "1";
$payment_method = "Change";
$new_value = "1";
$error = false; 
$temp_amount = "0";
$temp_amount = number_format($currency, 2, '.', '');
$currency = DEFAULT_CURRENCY;
$currency_value = "1";


include(FOLDER_RELATIV_LANGUAGES . $language . '/' . NAME_OF_FILE_CREATE_ORDER_PROCESS);
?>
<?php
$sql_data_array = array('attendees_id' => $attendee_id,
		'attendees_group_id' => $attendee_group_id,
		'attendees_name' => $firstname . ' ' . $lastname,
		'attendees_company' => $company,
		'attendees_street_address' => $street_address,
		'attendees_suburb' => $suburb,
		'attendees_city' => $city,
		'attendees_postcode' => $postcode,
		'attendees_state' => $state,
		'attendees_land' => $land,
		'attendees_telephone' => $telephone,
		'attendees_email_address' => $email_address,
		'attendees_form_of_address_id' => $format_id,
		'delivery_name' => $firstname . ' ' . $lastname,
		'delivery_company' => $company,
		'delivery_street_address' => $street_address,
		'delivery_suburb' => $suburb,
		'delivery_city' => $city,
		'delivery_postcode' => $postcode,
		'delivery_state' => $state,
		'delivery_land' => $land,
		'delivery_form_of_address_id' => $format_id,
		'billing_name' => $firstname . ' ' . $lastname,
		'billing_company' => $company,
		'billing_street_address' => $street_address,
		'billing_suburb' => $suburb,
		'billing_city' => $city,
		'billing_postcode' => $postcode,
		'billing_state' => $state,
		'billing_land' => $land,
		'billing_form_of_address_id' => $format_id,
		'date_purchased' => 'now()', 
		'orders_status' => DEFAULT_ORDERS_STATUS_ID,
		'currency' => $currency,
		'currency_value' => $currency_value);  
go_db_carry(DB_TBL_ORDERS, $sql_data_array);
$insert_id = go_db_insert_id();


$sql_data_array = array('orders_id' => $insert_id,
		'orders_status_id' => $new_value,
		'date_added' => 'now()');
go_db_carry(DB_TBL_ORDERS_STATUS_HISTORY, $sql_data_array);

$order_total_modules_array = array();
$order_total_modules_query = go_db_query("SELECT set_it_up_key,set_it_up_value FROM set_it_up WHERE set_it_up_key LIKE 'CONSTITUENT_ORDER_TOTAL_%'");
while ($order_total_modules = go_db_fetch_array($order_total_modules_query)) {
	$order_total_modules_array[$order_total_modules['set_it_up_key']] = $order_total_modules['set_it_up_value'];
}

if ($order_total_modules_array['CONSTITUENT_ORDER_TOTAL_SUBTOTAL_STATUS'] == 'true') {
	$sql_data_array = array('orders_id' => $insert_id,
			'title' => TEXT_AMMOUNT_BETWEEN,
			'text' => $temp_amount,
			'value' => "0.00", 
			'class' => "ot_subtotal", 
			'sort_order' => $order_total_modules_array['CONSTITUENT_ORDER_TOTAL_SUBTOTAL_SORT_ORDER']);
	go_db_carry(DB_TBL_ORDERS_TOTAL, $sql_data_array);
}

if ($order_total_modules_array['CONSTITUENT_ORDER_TOTAL_TAX_STATUS'] == 'true') {
	$tax_rates_query = go_db_query("SELECT tax_rate, concat(tax_description,':') as description FROM tax_rates");
	while ($tax_rates = go_db_fetch_array($tax_rates_query)) {
		$sql_data_array = array('orders_id' => $insert_id,
				'title' => $tax_rates['description'], 
				'text' => $temp_amount,
				'value' => "0.00", 
				'class' => "ot_tax", 
				'sort_order' => $order_total_modules_array['CONSTITUENT_ORDER_TOTAL_TAX_SORT_ORDER']);
		go_db_carry(DB_TBL_ORDERS_TOTAL, $sql_data_array);
	}
}

if ($order_total_modules_array['CONSTITUENT_ORDER_TOTAL_SHIPPING_STATUS'] == 'true') {
	$sql_data_array = array('orders_id' => $insert_id,
			'title' => TEXT_AMMOUNT_SHIPPING,
			'text' => $temp_amount,
			'value' => "0.00", 
			'class' => "ot_shipping", 
			'sort_order' => $order_total_modules_array['CONSTITUENT_ORDER_TOTAL_SHIPPING_SORT_ORDER']);
	go_db_carry(DB_TBL_ORDERS_TOTAL, $sql_data_array);
}

if ($order_total_modules_array['CONSTITUENT_ORDER_TOTAL_TOTAL_STATUS'] == 'true') {
	$sql_data_array = array('orders_id' => $insert_id,
			'title' => TEXT_AMMOUNT_TOTAL,
			'text' => $temp_amount,
			'value' => "0.00", 
			'class' => "ot_total", 
			'sort_order' => $order_total_modules_array['CONSTITUENT_ORDER_TOTAL_TOTAL_SORT_ORDER']);
	go_db_carry(DB_TBL_ORDERS_TOTAL, $sql_data_array);
}

go_forward(go_href_link(NAME_OF_FILE_CHANGE_ORDERS, 'oID=' . $insert_id, 'SSL'));  
require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php');
?>
