<?php
include_once 'init-lite.php';
?>
 <?php

if (!isset($_REQUEST['oid']))
    die('xxx');

$HaveOrderID     = $_REQUEST['oid'];

//console_log("菜 Remark :  HaveOrderID :  " . $HaveOrderID);

//$sql_Update="Update Orders set ShipCity='' where Orders.OrderID=".$HaveOrderID;
//$orders->exec($sql_Update); 
//********如果有菜单号，调入资料  Start
$orders->beginTransaction();
if (isset($_REQUEST['UserCode'])) {
    $SQL_OrderID     = $HaveOrderID;
    $SQL_UserCode    = $_REQUEST['UserCode'];
    $SQL_Remark = $_REQUEST['Remark'];
    $SQL_Action = $_REQUEST['Action'];
    

    $is_existProduct        = 0;
    $query_RecordsetProduct = "SELECT  Quantity FROM [Order Details] where OrderID=" . $HaveOrderID . " and  UserCode = '" . $SQL_UserCode . "' ";
    $values                 = $orders->query($query_RecordsetProduct);
    if (is_iterable($values)) {
        foreach ($values as $row_RecordsetProduct) {
 			//console_log("菜 Remark update :  UserCode :  " . $SQL_UserCode . "  Remark " . $SQL_Remark);
            $is_existProduct = 1;
            $updateSQL       = sprintf("UPDATE [Order Details] SET Remark=%s,Action=%s WHERE UserCode=%s and OrderID=%s", 
			GetSQLValueStringGBK($SQL_Remark, "text"), 
			GetSQLValueStringGBK($SQL_Action, "text"), 
			GetSQLValueStringGBK($SQL_UserCode, "text"),
			GetSQLValueString($SQL_OrderID, "long")
			);
			//echo $updateSQL;
		   //console_log("菜 Remark update  :	" .  $updateSQL );
            $orders->exec($updateSQL);
			echo "OK";
        }
    }else{
		echo "FALSE";
	}
	
 
	
}
$orders->commit();
/* 提交更改 */
?>