1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<?php require_once("check_login.php");
$data = array( "status" => $_POST["order_status"], "room_key" => $_POST["room_key"], "remark" => $_POST["remark"], "lastupdate" => $nowdate, "lastupby" => $_SESSION["cmsloginid"], );
if (!empty($_POST["bank_name"])) { $data["bank_name"] = $_POST["bank_name"]; }
if (!empty($_POST["bank_name2"])) { $data["bank_name2"] = $_POST["bank_name2"]; }
if (!empty($_POST["cheque_num"])) { $data["cheque_num"] = $_POST["cheque_num"]; }
if (!empty($_POST["cheque_num2"])) { $data["cheque_num2"] = $_POST["cheque_num2"]; }
if (!empty($_POST["customer_lastname"])) { $data["customer_lastname"] = rsa_crypt($_POST["customer_lastname"], 1); }
if (!empty($_POST["customer_firstname"])) { $data["customer_firstname"] = rsa_crypt($_POST["customer_firstname"], 1); }
if (!empty($_POST["customer_email"])) { $data["customer_email"] = rsa_crypt($_POST["customer_email"], 1); }
if (!empty($_POST["customer_tel"])) { $data["customer_tel"] = rsa_crypt($_POST["customer_tel"], 1); }
if (!empty($_POST["customer_address"])) { $data["customer_address"] = rsa_crypt($_POST["customer_address"], 1); }
if (!empty($_POST["customer_companyname"])) { $data["customer_companyname"] = $_POST["customer_companyname"]; }
$where = array( "sql" => "id = ?", "parameters" => array((int)$_POST["order_id"]), );
update_record("order", $data, $where);
if ($_POST["order_status"] != "NEW") { //update rented room status to ENDING $order_room_info = get_order_room((int)$_POST["order_id"]); foreach ($order_room_info as $order_room) { $sql = "update room set status = ?, lastupdate =?, lastupby =? where id = ?"; $parameters = array("OPEN", $nowdate, $_SESSION["cmsloginid"], $order_room["room_id"]); bind_pdo($sql, $parameters); } }
if ($_POST["order_status"] == "VOID") { //void deposit and invoice $sql = "update deposit set status = ?, actual_returndate =?, actual_returnamount = amount, lastupdate =?, lastupby =? where order_id = ?"; $parameters = array("RETURNED", date("Y-m-d"), $nowdate, $_SESSION["cmsloginid"], (int)$_POST["order_id"]); $result = bind_pdo($sql, $parameters);
$sql = "update invoice set status = ?, lastupdate =?, lastupby =? where order_id = ?"; $parameters = array("VOID", $nowdate, $_SESSION["cmsloginid"], (int)$_POST["order_id"]); $result = bind_pdo($sql, $parameters); }
$dbh = null;
header("Location: order_index.php?msg=修改成功");
|