<?php include_once 'init.php';?>
<?php
	echo '<hr>开新单号<hr>';
			$NewOrdersql_OID="SELECT max(OrderID)+1 FROM Orders";// where  RequiredDate='".date('Y-m-j')."'";
	 
	$values = $orders->query($NewOrdersql_OID);
if (is_iterable($values)){
  foreach ($values as $pNewOrder)
	{ 
		$NewOrderID=$pNewOrder[0]; 
				if (!is_numeric($pNewOrder[0])) $NewOrderID=date('Ymd')*10000+1;
	}
		if (empty($NewOrderID)) $NewOrderID=date('Ymd')*10000+1;
		$sql_new="INSERT INTO [Orders] ([OrderID],[ShipCity],[TaxInclude],[CustomerID], [Status],RequiredDate,OrderDate) VALUES (". $NewOrderID . ",'" . $_REQUEST['MyComputerName']. "','True','" . $_REQUEST['CustomerID']. "','服务中','".date('Y-m-j')."','".date('Y-m-j')."')";
		$orders->query($sql_new);
		//echo $sql_new.'<hr>';
		//echo ("台号:  ".$_POST['CustomerID']."      流水号:  ".$OrderID."");
	} 	
?>