| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/innoutstorage/webadmin/ |
Upload File : |
<?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 = "SELECT * FROM room as r LEFT JOIN order_room as oro on r.id = oro.room_id LEFT JOIN `order` as o on o.id = oro.order_id WHERE o.enddate > ? and oro.room_id = ? and o.id != ? and o.status != 'VOID'";
$parameters = array(date('Y-m-d'), $order_room["room_id"], (int)$_POST["order_id"]);
$orderList = bind_pdo($sql, $parameters, 'selectall');
// print_r($orderList);
$sql = "update room set status = ?, lastupdate =?, lastupby =? where id = ?";
$parameters = array(count($orderList) == 0?"OPEN":"RENTED", $nowdate, $_SESSION["cmsloginid"], $order_room["room_id"]);
bind_pdo($sql, $parameters);
activity_log('order_modify.php', '', $input = array('sql' => $sql, 'parameters' => $parameters), $data_before = array(), $data_after = array(), $step = 1);
}
}
// exit;
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=修改成功");