function printDoc($name,$table_id,$seat,$id,$device,$db_conn) {  
//shell_exec('osk');
$sql = "UPDATE " . DB_USER_TABLE_NAME .
" SET print_count = 1, ipad_id='" . $device .
"' WHERE id =" . $id;
//print_json(format_array("success", "CloudParamPrintWorker.exe " . $name . " " . $table_id . " " . $device));
$res = mysql_query($sql);
if (mysql_affected_rows($db_conn) > 0) {
if ($seat == " ") {
$tid1 = $table_id . "号桌";
$tid2 = "Table " . $table_id;
shell_exec("C:\\CloudParamPrintWorker.exe localhost:5055 DeviceID \"" . $device . "\" name \"" . mb_convert_encoding($name,"gbk","utf8") . 
"\" table_id \"" . mb_convert_encoding($tid1,"gbk","utf8") . "\" seat \"" . mb_convert_encoding($tid2,"gbk","utf8") . "\"");
}
else {
$tid1 = $table_id . "号桌" . $seat . "座";
$tid2 = $table_id . " " . $seat;
shell_exec("C:\\CloudParamPrintWorker.exe localhost:5055 DeviceID \"" . $device . "\" name \"" . mb_convert_encoding($name,"gbk","utf8") . 
"\" table_id \"" . mb_convert_encoding($tid1,"gbk","utf8") . "\" seat \"" . mb_convert_encoding($tid2,"gbk","utf8") . "\"");
}

print_json(format_array("success", "CloudParamPrintWorker.exe " . $name . " " . $table_id . " " . $device)); $filename = 'plog.txt';
$fh = fopen($filename, "a");
echo fwrite($fh, "CloudParamPrintWorker.exe " . $name . " " . $table_id . " |" . $seat . "| " . $device);
fclose($fh);
//mb_convert_encoding($company,"gbk","utf8")
//print_json(format_array("success", "[" . $name . "]" . "[" . $company . "]" . "[" . $device . "]"));
} else {
//print_json(format_array("error",mysql_error($db_conn)));
}
}