Johannes Zellner 5 жил өмнө
parent
commit
aaed0aab1f

+ 0 - 110
app/DataBase/Bill_Import.php

@@ -1,110 +0,0 @@
-<?php
-
-require_once("DataBase/database.php");
-
-class Bill_Import
-{
-	function Bill_Import()
-	{
-		$this->db = new Database();
-	}
-
-	function create($bill_id, $value)
-	{
-		$query = "INSERT INTO ".$this->db->bill_import_table." VALUES('".$bill_id."'";
-		for($i = 0; $i < count($value); $i++)
-			$query .= ", '".$value[$i]."'";
-		$query .= ")";
-
-		$this->db->query($query);
-
-		$query = "SELECT bill_id from ".$this->db->bill_import_table." ORDER BY bill_id DESC";
-		$tmp = $this->db->fetchRows($this->db->query($query));
-		return $tmp[0][0];
-	}
-
-	function delete($bill_id)
-	{
-		$query = "DELETE FROM ".$this->db->bill_import_table." WHERE bill_id='$bill_id'";
-
-		$this->db->query($query);
-	}
-
-	function get($bill_id = "")
-	{
-		if($bill_id == "")
-		{
-			$query = "SELECT * FROM ".$this->db->bill_import_table;
-
-			$query .= " ORDER BY bill_number ASC";
-
-			return $this->db->fetchRows($this->db->query($query));
-		}
-		else
-		{
-			$query = "SELECT * FROM ".$this->db->bill_import_table." WHERE bill_id='".$bill_id."'";
-			$query .= " ORDER BY bill_number ASC";
-
-			return $this->db->fetchRows($this->db->query($query));
-		}
-	}
-
-	function clearTable()
-	{
-		$query = "TRUNCATE TABLE ".$this->db->bill_import_table;
-		$this->db->query($query);
-	}
-
-	function hasTimestamp($timestamp)
-	{
-		$query = "SELECT * FROM ".$this->db->bill_import_table." WHERE timestamp='".$timestamp."'";
-
-		if(count($this->db->fetchRows($this->db->query($query))) > 0)
-			return True;
-		else
-			return False;
-	}
-
-	function import($path)
-	{
-		$file_access_ok = true;
-		$file_open = false;
-		$file_handle = false;
-		$data = "";
-
-		clearstatcache();
-
-		try
-		{
-			if (!$file_handle = @fopen($path, "r"))
-				return -1;
-
-			if($file_handle)
-			{
-				while( $zeile = fgets($file_handle, 1024))
-				{
-					$values = explode("|", $zeile);
-					for($i = 0; $i < count($values); $i++)
-						$values[$i] = trim($values[$i]);
-					if(!$this->hasTimestamp($values[6]))
-						$this->create($values[0], array(	$values[1],
-											$values[2],
-											$values[3],
-											$values[4],
-											$values[5],
-											$values[6]));
-				}
-
-				fclose($file_handle);
-			}
-
-			return 0;
-		}
-		catch (Exception $e)
-		{
-			return -1;
-		}
-	}
-}
-
-?>

+ 0 - 132
app/DataBase/Bill_Product_Import.php

@@ -1,132 +0,0 @@
-<?php
-
-require_once("DataBase/database.php");
-
-require_once("DataBase/Customer.php");
-require_once("DataBase/Bill.php");
-require_once("DataBase/Product.php");
-require_once("DataBase/Price.php");
-require_once("DataBase/Tax.php");
-
-class Bill_Product_Import
-{
-	function Bill_Product_Import()
-	{
-		$this->db = new Database();
-	}
-
-	function create($value)
-	{
-		$query = "INSERT INTO ".$this->db->bill_product_import_table." VALUES(''";
-		for($i = 0; $i < count($value); $i++)
-			$query .= ", '".$value[$i]."'";
-		$query .= ")";
-
-		$this->db->query($query);
-	}
-
-	function delete($bill_product_id)
-	{
-		$query = "DELETE FROM ".$this->db->bill_product_import_table." WHERE bill_product_id='$bill_product_id'";
-
-		$this->db->query($query);
-	}
-
-	function get($bill_product_id = "", $row_names = array(), $search = "")
-	{
-		if($bill_product_id == "")
-		{
-			if(count($row_names) == 0)
-				$query = "SELECT * FROM ".$this->db->bill_product_import_table;
-			else
-			{
-				$query = "SELECT ".$row_names[0];
-				for($i = 1; $i < count($row_names); $i++)
-					$query .= ", ".$row_names[$i];
-				$query .= " FROM ".$this->db->bill_product_import_table;
-			}
-
-			if($search != "")
-				$query .= " WHERE ".$search;
-
-			$query .= " ORDER BY product_id ASC";
-
-			return $this->db->fetchRows($this->db->query($query));
-		}
-		else
-		{
-			$query = "SELECT * FROM ".$this->db->bill_product_import_table." WHERE bill_product_id='".$bill_product_id."'";
-
-			return $this->db->fetchRows($this->db->query($query));
-		}
-	}
-
-	function getByBillId($bill_id)
-	{
-		$query = "SELECT * FROM ".$this->db->bill_product_import_table." WHERE bill_id='".$bill_id."'";
-		$query .= " ORDER BY product_id ASC";
-
-		return $this->db->fetchRows($this->db->query($query));
-	}
-
-	function clearTable()
-	{
-		$query = "TRUNCATE TABLE ".$this->db->bill_product_import_table;
-		$this->db->query($query);
-	}
-
-	function hasTimestampProductPair($timestamp, $product_id)
-	{
-		$query = "SELECT * FROM ".$this->db->bill_product_import_table." WHERE timestamp='".$timestamp."' and product_id='".$product_id."'";
-
-		if(count($this->db->fetchRows($this->db->query($query))) > 0)
-			return True;
-		else
-			return False;
-	}
-
-	function import($path)
-	{
-		$file_access_ok = true;
-		$file_open = false;
-		$file_handle = false;
-		$data = "";
-
-		clearstatcache();
-
-		try
-		{
-			if (!$file_handle = @fopen($path, "r"))
-				return -1;
-
-			if($file_handle)
-			{
-				while( $zeile = fgets($file_handle, 1024))
-				{
-					$values = explode("|", $zeile);
-					for($i = 0; $i < count($values); $i++)
-						$values[$i] = trim($values[$i]);
-					if(!$this->hasTimestampProductPair($values[8], $values[2]))
-						$this->create(array(	$values[1],
-									$values[2],
-									$values[3],
-									$values[4],
-									$values[5],
-									$values[6],
-									$values[7],
-									$values[8]));
-				}
-
-				fclose($file_handle);
-			}
-
-			return 0;
-		}
-		catch (Exception $e)
-		{
-			return -1;
-		}
-	}
-}
-
-?>

+ 0 - 12
app/DataBase/Category.php

@@ -65,18 +65,6 @@ class Category
 			return $this->db->fetchRows($this->db->query($query));
 		}
 	}
-
-	function export($path)
-	{
-		$csv_data = "";
-
-		$query = "SELECT * FROM ".$this->db->category_table;
-		$result = $this->db->query($query);
-		while ($row = mysqli_fetch_assoc($result))
-			$csv_data .= implode('|', $row)."\n";
-
-		$this->db->writeToFile($path, $csv_data);
-	}
 }
 
 ?>

+ 0 - 12
app/DataBase/Customer.php

@@ -103,18 +103,6 @@ class Customer
 			return $this->db->fetchRows($this->db->query($query));
 		}
 	}
-
-	function export($path)
-	{
-		$csv_data = "";
-
-		$query = "SELECT * FROM ".$this->db->customer_table;
-		$result = $this->db->query($query);
-		while ($row = mysqli_fetch_assoc($result))
-			$csv_data .= implode('|', $row)."\n";
-
-		$this->db->writeToFile($path, $csv_data);
-	}
 }
 
 ?>

+ 12 - 12
app/DataBase/Group.php

@@ -8,34 +8,34 @@ class Group
 	{
 		$this->db = new Database();
 	}
-	
+
 	function create($group_id, $value)
 	{
 		$query = "INSERT INTO ".$this->db->group_table." VALUES('".$group_id."'";
 		for($i = 0; $i < count($value); $i++)
 			$query .= ", '".$value[$i]."'";
 		$query .= ")";
-		
+
 		$this->db->query($query);
 	}
-	
+
 	function update($group_id, $value)
 	{
 		$query = "UPDATE ".$this->db->group_table." SET ";
 		$query .= "name='".$value[0]."' ";
-		
+
 		$query .= "WHERE group_id='".$group_id."'";
-		
+
 		$this->db->query($query);
 	}
-	
+
 	function delete($group_id)
 	{
 		$query = "DELETE FROM ".$this->db->group_table." WHERE group_id='$group_id'";
-		
+
 		$this->db->query($query);
 	}
-	
+
 	function get($group_id = "", $row_names = array(), $search = "")
 	{
 		if($group_id == "")
@@ -49,18 +49,18 @@ class Group
 					$query .= ", ".$row_names[$i];
 				$query .= " FROM ".$this->db->group_table;
 			}
-			
+
 			if($search != "")
 				$query .= " WHERE ".$search;
-				
+
 			$query .= " ORDER BY group_id ASC";
-			
+
 			return $this->db->fetchRows($this->db->query($query));
 		}
 		else
 		{
 			$query = "SELECT * FROM ".$this->db->group_table." WHERE group_id='".$group_id."' ORDER BY group_id ASC";
-			
+
 			return $this->db->fetchRows($this->db->query($query));
 		}
 	}

+ 0 - 12
app/DataBase/Price.php

@@ -82,18 +82,6 @@ class Price
 
 		return $this->db->fetchRows($this->db->query($query));
 	}
-
-	function export($path)
-	{
-		$csv_data = "";
-
-		$query = "SELECT * FROM ".$this->db->price_table;
-		$result = $this->db->query($query);
-		while ($row = mysqli_fetch_assoc($result))
-			$csv_data .= implode('|', $row)."\n";
-
-		$this->db->writeToFile($path, $csv_data);
-	}
 }
 
 ?>

+ 0 - 12
app/DataBase/Priceset.php

@@ -88,18 +88,6 @@ class Priceset
 			return $this->db->fetchRows($this->db->query($query));
 		}
 	}
-
-	function export($path)
-	{
-		$csv_data = "";
-
-		$query = "SELECT * FROM ".$this->db->priceset_table;
-		$result = $this->db->query($query);
-		while ($row = mysqli_fetch_assoc($result))
-			$csv_data .= implode('|', $row)."\n";
-
-		$this->db->writeToFile($path, $csv_data);
-	}
 }
 
 ?>

+ 0 - 12
app/DataBase/Product.php

@@ -146,18 +146,6 @@ class Product
 
 		return $this->db->fetchRows($this->db->query($query));
 	}
-
-	function export($path)
-	{
-		$csv_data = "";
-
-		$query = "SELECT * FROM ".$this->db->product_table." WHERE available=1";
-		$result = $this->db->query($query);
-		while ($row = mysqli_fetch_assoc($result))
-			$csv_data .= implode('|', $row)."\n";
-
-		$this->db->writeToFile($path, $csv_data);
-	}
 }
 
 ?>

+ 12 - 12
app/DataBase/Tax.php

@@ -8,35 +8,35 @@ class Tax
 	{
 		$this->db = new Database();
 	}
-	
+
 	function create($tax_id, $value)
 	{
 		$query = "INSERT INTO ".$this->db->tax_table." VALUES('".$tax_id."'";
 		for($i = 0; $i < count($value); $i++)
 			$query .= ", '".$value[$i]."'";
 		$query .= ")";
-		
+
 		$this->db->query($query);
 	}
-	
+
 	function update($tax_id, $value)
 	{
 		$query = "UPDATE ".$this->db->tax_table." SET ";
 		$query .= "name='".$value[0]."', ";
 		$query .= "tax_rate='".$value[1]."' ";
-		
+
 		$query .= "WHERE tax_id='".$tax_id."'";
-		
+
 		$this->db->query($query);
 	}
-	
+
 	function delete($tax_id)
 	{
 		$query = "DELETE FROM ".$this->db->tax_table." WHERE tax_id='$tax_id'";
-		
+
 		$this->db->query($query);
 	}
-	
+
 	function get($tax_id = "", $row_names = array(), $search = "")
 	{
 		if($tax_id == "")
@@ -50,19 +50,19 @@ class Tax
 					$query .= ", ".$row_names[$i];
 				$query .= " FROM ".$this->db->tax_table;
 			}
-			
+
 			if($search != "")
 				$query .= " WHERE ".$search;
-				
+
 			$query .= " ORDER BY tax_id ASC";
-			
+
 			return $this->db->fetchRows($this->db->query($query));
 		}
 		else
 		{
 			$query = "SELECT * FROM ".$this->db->tax_table." WHERE tax_id='".$tax_id."'";
 			$query .= " ORDER BY tax_id ASC";
-			
+
 			return $this->db->fetchRows($this->db->query($query));
 		}
 	}

+ 0 - 26
app/DataBase/database.php

@@ -63,32 +63,6 @@ class Database
 
 		return $all_rows;
 	}
-
-	function writeToFile($path, $data)
-	{
-		$file_access_ok = true;
-		$file_open = false;
-
-		clearstatcache();
-
-		if (file_exists($path))
-		if (!is_writable($path))
-			$file_access_ok = false;
-
-		if ($file_access_ok and (!$file_handle = @fopen($path, "w+b")))
-			$file_access_ok = false;
-
-		if ($file_access_ok)
-		{
-			if (!fwrite($file_handle, $data) and ($data != ''))
-			$file_access_ok = false;
-			else
-				$file_open = true;
-		}
-
-		if ($file_open)
-			fclose($file_handle);
-	}
 }
 
 ?>

+ 0 - 43
app/Modules/Websync/BillSync.php

@@ -1,43 +0,0 @@
-<?php
-
-require_once("DataBase_Net/Bill_Net.php");
-require_once("DataBase_Net/Bill_Product_Net.php");
-require_once("DataBase/Bill.php");
-require_once("DataBase/Bill_Product.php");
-
-// sync Bill database
-$bill = new Bill();
-$bill_net = new Bill_Net();
-$bill_product = new Bill_Product();
-$bill_product_net = new Bill_Product_Net();
-
-$new_bills_count = 0;
-$new_position_count = 0;
-
-// fetch all remote bills
-$remote_bills = $bill_net->getPlainBills();
-foreach($remote_bills as $tmp)
-{
-	$new_bill_id = $bill->create("", array_slice($tmp, 1));
-	$new_bills_count++;
-	
-	// check for bill_products
-	$remote_bill_products =  $bill_product_net->getByBillId($tmp[0]);
-	foreach($remote_bill_products as $tmp1)
-	{
-		$tmp1[1] = $new_bill_id;
-		$bill_product->create(array_slice($tmp1, 1));
-		$new_position_count++;
-	}
-}
-
-$main_box->add(new NTKLabel("", "neue Rechnungen: ".$new_bills_count), 200, 0, "background-color: #dfe7f3;");
-$main_box->add(new NTKLabel("", "neue Positionen: ".$new_position_count), 200, 0, "background-color: #dfe7f3;");
-
-// now we should have added all bills let's delete them remote
-$bill_net->clearTable();
-$bill_product_net->clearTable();
-
-
-
-?>

+ 0 - 72
app/Modules/Websync/CustomerSync.php

@@ -1,72 +0,0 @@
-<?php
-
-require_once("DataBase_Net/Customer_Net.php");
-require_once("DataBase/Customer.php");
-
-// sync Customer database
-$customer = new Customer();
-$customer_net = new Customer_Net();
-
-$new_customer_count = 0;
-$del_customer_count = 0;
-
-// fetch all remote customers
-$remote_customers = $customer_net->get('', array('customer_id'));
-foreach($remote_customers as $tmp)
-{
-	if($customer->exists($tmp[0]) == false)
-	{
-		$customer_net->delete($tmp[0]);
-		$del_customer_count++;
-	}
-}
-
-$remote_customers = $customer_net->get('', array('customer_id'));
-$local_customers = $customer->get('', array('customer_id'));
-foreach($local_customers as $tmp)
-{
-	$found = false;
-	
-	foreach($remote_customers as $remote_tmp)
-	{
-		if($remote_tmp[0] == $tmp[0])
-		{
-			$found = true;
-			break;
-		}
-	}
-	
-	$tmp_data = $customer->get($tmp[0], array(	"password",
-							"prename",
-							"postname",
-							"street",
-							"streetnumber",
-							"plz",
-							"city",
-							"telephone",
-							"telefax",
-							"email",
-							"pricelist_id",
-							"tour_id",
-							"rabatt",
-							"details",
-							"bank_name",
-							"bank_account",
-							"blz"));
-	
-	if(!$found)
-	{
-		$customer_net->create($tmp[0], $tmp_data[0]);
-		$new_customer_count++;
-	}
-	else
-	{
-		$customer_net->update($tmp[0], $tmp_data[0]);
-	}
-}
-
-$main_box->add(new NTKLabel("", "neue Kunden online: ".$new_customer_count), 200, 0, "background-color: #dfe7f3;");
-$main_box->add(new NTKLabel("", "Kunden online gel&ouml;scht: ".$del_customer_count), 200, 0, "background-color: #dfe7f3;");
-
-
-?>

+ 0 - 55
app/Modules/Websync/PricesetSync.php

@@ -1,55 +0,0 @@
-<?php
-
-require_once("DataBase_Net/Priceset_Net.php");
-require_once("DataBase/Priceset.php");
-
-// sync Priceset database
-$priceset = new Priceset();
-$priceset_net = new Priceset_Net();
-
-$new_priceset_count = 0;
-$del_priceset_count = 0;
-
-$remote_pricesets = $priceset_net->get('', array('priceset_id'));
-foreach($remote_pricesets as $tmp)
-{
-	if($priceset->exists($tmp[0]) == false)
-	{
-		$priceset_net->delete($tmp[0]);
-		$del_priceset_count++;
-	}
-}
-
-$remote_pricesets = $priceset_net->get('', array('priceset_id'));
-$local_pricesets = $priceset->get('', array('priceset_id'));
-foreach($local_pricesets as $tmp)
-{
-	$found = false;
-	
-	foreach($remote_pricesets as $remote_tmp)
-	{
-		if($remote_tmp[0] == $tmp[0])
-		{
-			$found = true;
-			break;
-		}
-	}
-	
-	$tmp_data = $priceset->get($tmp[0], array(	"name",
-							"netto"));
-	
-	if(!$found)
-	{
-		$priceset_net->create($tmp[0], $tmp_data[0]);
-		$new_priceset_count++;
-	}
-	else
-	{
-		$priceset_net->update($tmp[0], $tmp_data[0]);
-	}
-}
-
-$main_box->add(new NTKLabel("", "neue Pricesets online: ".$new_priceset_count), 200, 0, "background-color: #dfe7f3;");
-$main_box->add(new NTKLabel("", "online Pricesets gel&ouml;scht: ".$del_priceset_count), 200, 0, "background-color: #dfe7f3;");
-
-?>

+ 0 - 98
app/Modules/Websync/ProductSync.php

@@ -1,98 +0,0 @@
-<?php
-
-require_once("DataBase_Net/Product_Net.php");
-require_once("DataBase/Product.php");
-require_once("DataBase_Net/Price_Net.php");
-require_once("DataBase/Price.php");
-require_once("DataBase/Priceset.php");
-
-// sync Product database
-$product = new Product();
-$product_net = new Product_Net();
-$price = new Price();
-$price_net = new Price_Net();
-$priceset = new Priceset();
-
-$new_product_count = 0;
-$del_product_count = 0;
-
-// delete remote products if not locally available anymore
-$remote_product = $product_net->get('', array('product_id'));
-foreach($remote_product as $tmp)
-{
-	if($product->exists($tmp[0], " available=1 ") == false)
-	{
-		$product_net->delete($tmp[0]);
-		
-		// delete also the prices
-		$local_pricesets = $priceset->get('');
-		foreach($local_pricesets as $tmp_priceset)
-		{
-			$tmp_price = $price_net->getPrice($tmp_priceset[0], $tmp[0]);
-			if(count($tmp_price) > 0)
-				$price_net->delete($tmp_price[0][0]);
-		}
-		$del_product_count++;
-	}
-}
-
-// add products remote if newly available locally
-$remote_products = $product_net->get('', array('product_id'));
-$local_products = $product->get('', array('product_id'), " available=1 ");
-foreach($local_products as $tmp)
-{
-	$found = false;
-	
-	foreach($remote_products as $remote_tmp)
-	{
-		if($remote_tmp[0] == $tmp[0])
-		{
-			$found = true;
-			break;
-		}
-	}
-	
-	$tmp_data = $product->get($tmp[0], array(	"name",
-							"details",
-							"category_id",
-							"tax_id",
-							"available",
-							"group_id",
-							"order_number",
-							"anmerkung"));
-	
-	if(!$found)
-	{
-		$product_net->create($tmp[0], $tmp_data[0]);
-		$new_product_count++;
-	}
-	else
-	{
-		$product_net->update($tmp[0], $tmp_data[0]);
-	}
-}
-
-$main_box->add(new NTKLabel("", "neue Produkte online: ".$new_product_count), 200, 0, "background-color: #dfe7f3;");
-$main_box->add(new NTKLabel("", "online Produkte gel&ouml;scht: ".$del_product_count), 200, 0, "background-color: #dfe7f3;");
-
-// check for prices on products
-$local_products = $product->get('', array('product_id'), " available=1 ");
-$local_pricesets = $priceset->get('');
-
-foreach($local_products as $tmp)
-{
-	foreach($local_pricesets as $tmp_priceset)
-	{
-		$tmp_price = $price->getPrice($tmp_priceset[0], $tmp[0]);
-		
-		if(count($tmp_price) <= 0)
-			continue;
-		
-		if($price_net->exists($tmp_priceset[0], $tmp[0]))
-			$price_net->update($tmp_priceset[0], $tmp[0], array_slice($tmp_price[0], 3));
-		else
-			$price_net->create($tmp_priceset[0], $tmp[0], array_slice($tmp_price[0], 3));
-	}
-}
-
-?>

+ 0 - 16
app/Modules/Websync/toolbar.php

@@ -1,16 +0,0 @@
-<?php
-
-$small_toolbar = new NTKHBox("small_toolbar", 5, 0, False);
-
-$download_button = new NTKButton("download_button", "Neue Rechnungen herunterladen", "location.replace('websync.php?action=download_0');"); //"location.replace('bill.php?action=new');");
-$small_toolbar->add($download_button, 500);
-
-$small_toolbar->add($spacer);
-
-$upload_button = new NTKButton("upload_button", "Neue Produkte / Preise online stellen", "ntk_show_splash('bitte warten ...'); location.replace('websync.php?action=upload_0');");
-$small_toolbar->add($upload_button, 500);
-
-$main_box->add($small_toolbar, True, False, "background-color: #dfe7f3;");
-
-
-?>

+ 0 - 7
app/Modules/toolbar.php

@@ -57,13 +57,6 @@ else $style = "";
 $configuration_button = new NTKImageButton("configuration_button", "Icons/configuration.png", "Einstellungen", "location.replace('configuration.php');", "Einstellungen");
 $toolbar_box->add($configuration_button, 60, 60, $style);
 
-$toolbar_box->add($spacer);
-
-if($page == "websync") $style = "background-color: #dfe7f3;";
-else $style = "";
-$configuration_button = new NTKImageButton("websync_button", "Icons/sync.png", "Internet Synchronisation", "location.replace('websync.php');", "Internet Synchronisation");
-$toolbar_box->add($configuration_button, 60, 60, $style);
-
 $main_box->add($toolbar_box, True, False);
 
 ?>

+ 0 - 239
app/websync.php

@@ -1,239 +0,0 @@
-<?php
-
-require_once("util.php");
-require_once("NTK/NTK.php");
-
-?>
-
-<html>
-<head>
-	<title> Index </title>
-
-<?php
-
-echo getHead();
-
-?>
-
-</head>
-
-<body>
-
-<?php
-
-$action = var_get_post("action", "");
-
-$main_box = new NTKVBox("main_box", 0, 0, False);
-
-// Toolbar
-$page = "websync";
-$printfile = "";
-include("Modules/toolbar.php");
-
-// if($action == "upload_0")
-// {
-// 	$main_box->add(new NTKLabel("", "Neue Produkte / Preise online stellen"), 200, 10, "font-style: bold; background-color: #dfe7f3;");
-//
-// 	$button_next = new NTKButton("button_next", "Weiter", "location.replace('websync.php?action=upload_1');");
-// 	$main_box->add($button_next);
-// }
-
-if($action == "upload_0")
-{
-	require_once("DataBase/Priceset.php");
-	require_once("DataBase/Customer.php");
-	require_once("DataBase/Product.php");
-	require_once("DataBase/Price.php");
-	require_once("DataBase/Category.php");
-
-	$priceset = new Priceset();
-	$customer = new Customer();
-	$product = new Product();
-	$price = new Price();
-	$category = new Category();
-
-	$priceset->export("mysql_export/priceset.csv");
-	$customer->export("mysql_export/customer.csv");
-	$product->export("mysql_export/product.csv");
-	$price->export("mysql_export/price.csv");
-	$category->export("mysql_export/category.csv");
-
-	// upload all db-files "mysql_export"
-	$handle = popen("/var/www/ursprung/bin/upload.sh", "r");
-	pclose($handle);
-
-	$main_box->add(new NTKLabel("", "Schritt erfolgreich"), 200, -1, "color: #00ff00; background-color: #dfe7f3;");
-	$button_next = new NTKButton("button_next", "Weiter", "location.replace('websync.php?action=upload_1');");
-	$main_box->add($button_next, 500);
-}
-elseif($action == "upload_1")
-{
-	$iframe = new NTKIFrame("upload_frame", "http://www.natuerlich-grobi.de/db_import.php", "width: 300px; height: 200px; background-color: #dfe7f3;");
-	$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-	$main_box->add(new NTKLabel("", "Serverausgabe (dauert etwas):"), False, False, "font-style: bold; background-color: #dfe7f3;");
-	$main_box->add($iframe, False, False, "background-color: #dfe7f3;");
-	$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-}
-elseif($action == "download_0")
-{
-	$iframe = new NTKIFrame("download_frame", "http://www.natuerlich-grobi.de/db_export.php", "width: 300px; height: 200px; background-color: #dfe7f3;");
-// 	$iframe = new NTKIFrame("download_frame", "http://localhost/ursprung/db_export.php", "width: 300px; height: 200px; background-color: #dfe7f3;");
-	$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-	$main_box->add(new NTKLabel("", "Serverausgabe (dauert etwas):"), False, False, "font-style: bold; background-color: #dfe7f3;");
-	$main_box->add($iframe, False, False, "background-color: #dfe7f3;");
-	$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-	$main_box->add(new NTKButton("button_next", "Weiter", "ntk_show_splash('bitte warten ...'); location.replace('websync.php?action=download_1');"), 500);
-}
-elseif($action == "download_1")
-{
-	// download all db-files "mysql_import"
-	$handle = popen("/var/www/ursprung/bin/download.sh", "r");
-	pclose($handle);
-
-	require_once("DataBase/Bill.php");
-	require_once("DataBase/Bill_Product.php");
-	require_once("DataBase/Bill_Import.php");
-	require_once("DataBase/Bill_Product_Import.php");
-	require_once("DataBase/Customer.php");
-	require_once("DataBase/Tour.php");
-
-	// import new bills
-	$bill = new Bill();
-	$bill_product = new Bill_Product();
-	$bill_import = new Bill_Import();
-	$bill_product_import = new Bill_Product_Import();
-	$customer = new Customer();
-	$tour = new Tour();
-
-	if(	$bill_import->import("mysql_import/bill.csv") == 0 &&
-		$bill_product_import->import("mysql_import/bill_product.csv") == 0)
-	{
-
-		/* import bills from bill_import and products from bill_product_import */
-		$bills = $bill_import->get();
-		for($i = 0; $i < count($bills); $i++)
-		{
-			if(!$bill->hasTimestamp($bills[$i][6]))
-			{
-				$customer_data = $customer->get($bills[$i][1]);
-				if(count($customer_data) == 0)
-				{
-					echo "Fehler: websync.php import bills from bill_import no customer data";
-					continue;
-				}
-				$tour_data = $tour->get($customer_data[0][12]);
-				$date = getdate(time());
-
-				$new_bill_id = $bill->create("", array($bills[$i][1],  $customer_data[0][12], $date['year']."-".$date['mon']."-".$date['mday'], $tour_data[0][2], -2, $bills[$i][6]));
-
-				$bill_products = $bill_product_import->getByBillId($bills[$i][0]);
-				for($j = 0; $j < count($bill_products); $j++)
-				{
-					$bill_product->create(array($new_bill_id, $bill_products[$j][2], $bill_products[$j][3], $bill_products[$j][4], 0, 0, 0));
-				}
-			}
-		}
-
-		$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-		$main_box->add(new NTKLabel("", "Fertig"), False, False, "font-style: bold; background-color: #dfe7f3;");
-		$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-	}
-	else
-	{
-		$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-		$main_box->add(new NTKLabel("", "neue Bestellungen laden schlug fehl.<br>In ein paar Minuten nochmal versuchen."), False, False, "color: #ff0000; font-style: bold; background-color: #dfe7f3;");
-		$main_box->add($spacer, True, True, "background-color: #dfe7f3;");
-	}
-}
-else
-{
-	// small Toolbar
-	include("Modules/Websync/toolbar.php");
-
-	// main content
-	$main_box->add(new NTKLabel("", "Internet Synchronisation"), 200, -1, "background-color: #dfe7f3;");
-
-}
-
-// tools
-// $tool_box = new NTKVBox("online_box", 5, 0, False);
-//
-// $online_export_button = new NTKButton("", "online export", "window.open('http://www.natuerlich-grobi.de/db_export.php', 'Online Export', 'width=300,height=200');");
-// $tool_box->add($online_export_button, 60, 60, $style);
-//
-// $download_button = new NTKButton("", "download", "");
-// $tool_box->add($download_button, 60, 60, $style);
-//
-// $local_import_button = new NTKButton("", "Local Import", "location.replace('websync.php?action=local_import');");
-// $tool_box->add($local_import_button, 60, 60, $style);
-//
-// $local_sync_button = new NTKButton("", "Local Sync", "location.replace('websync.php?action=local_sync');");
-// $tool_box->add($local_sync_button, 60, 60, $style);
-//
-// $local_export_button = new NTKButton("", "Local Export", "location.replace('websync.php?action=local_export');");
-// $tool_box->add($local_export_button, 60, 60, $style);
-//
-// $upload_button = new NTKButton("", "upload", "");
-// $tool_box->add($upload_button, 60, 60, $style);
-//
-// $online_import_button = new NTKButton("", "online import", "window.open('http://www.natuerlich-grobi.de/db_import.php', 'Online Import', 'width=300,height=200');");
-// $tool_box->add($online_import_button, 60, 60, $style);
-//
-// // add toolbars
-// $main_box->add($tool_box, True, True);
-
-
-
-// if($action == "local_import")
-// {
-// 	require_once("DataBase_Net/Bill_Net.php");
-// 	require_once("DataBase_Net/Bill_Product_Net.php");
-//
-// 	$bill_net = new Bill_Net();
-// 	$bill_product_net = new Bill_Product_Net();
-//
-// 	$bill_net->import("mysql_import/bill.csv");
-// 	$bill_product_net->import("mysql_import/bill_product.csv");
-//
-// 	$main_box->add(new NTKLabel("", "Local Import erfolgreich"), 200, -1, "background-color: #dfe7f3;");
-// }
-// elseif($action == "local_sync")
-// {
-// 	include("Modules/Websync/PricesetSync.php");
-// 	include("Modules/Websync/CustomerSync.php");
-// 	include("Modules/Websync/ProductSync.php");
-// 	include("Modules/Websync/BillSync.php");
-//
-// 	$main_box->add(new NTKLabel("", "Local Sync erfolgreich"), 200, -1, "background-color: #dfe7f3;");
-// }
-// elseif($action == "local_export")
-// {
-// 	require_once("DataBase_Net/Priceset_Net.php");
-// 	require_once("DataBase_Net/Customer_Net.php");
-// 	require_once("DataBase_Net/Product_Net.php");
-// 	require_once("DataBase_Net/Price_Net.php");
-// 	require_once("DataBase_Net/Category_Net.php");
-//
-//
-// 	$priceset_net = new Priceset_Net();
-// 	$customer_net = new Customer_Net();
-// 	$product_net = new Product_Net();
-// 	$price_net = new Price_Net();
-// 	$category_net = new Category_Net();
-//
-// 	$priceset_net->export("mysql_export/priceset.csv");
-// 	$customer_net->export("mysql_export/customer.csv");
-// 	$product_net->export("mysql_export/product.csv");
-// 	$price_net->export("mysql_export/price.csv");
-// 	$category_net->export("mysql_export/category.csv");
-//
-// 	$main_box->add(new NTKLabel("", "Local Export erfolgreich"), 200, -1, "background-color: #dfe7f3;");
-// }
-
-
-echo $main_box->getHtml();
-
-?>
-
-</body>
-</html>