| 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");
require_once("Zebra_Pagination/Zebra_Pagination.php");
$_SESSION["index_url_parameter"] = get_index_url_parameter();
$order_info = array();
$filter_sql = "";
$parameters = array();
if (!empty($_GET["filter"])) {
if (!empty($_GET["startdate_min"]) && !empty($_GET["startdate_max"])) {
$filter_sql .= " and startdate >= ? and startdate <= ?";
$parameters[] = $_GET["startdate_min"];
$parameters[] = $_GET["startdate_max"];
}
if (!empty($_GET["createdate_min"]) && !empty($_GET["createdate_max"])) {
$filter_sql .= " and createdate >= ? and createdate <= ?";
$parameters[] = $_GET["createdate_min"];
$parameters[] = $_GET["createdate_max"];
}
if (!empty($_GET["code"])) {
$filter_sql .= " and id = ?";
$parameters[] = $_GET["code"];
}
if (!empty($_GET["customer_code"]) || !empty($_GET["customer_name"]) || !empty($_GET["customer_tel"])) {
$filter_sql .= " and customer_id IN (?)";
$ids = array($_GET["customer_code"], $_GET["customer_name"], $_GET["customer_tel"]);
$parameters[] = implode(",", array_filter($ids));
}
if (!empty($_GET["order_room"])) {
$room_ids = array();
$room_list = get_order_by_room_id($_GET["order_room"]);
foreach ($room_list as $rl) {
$room_ids[] = $rl['order_id'];
}
$filter_sql .= " and id IN (" . implode(",", $room_ids) . ")";
}
if (!empty($_GET["status"])) {
$filter_sql .= " and status = ?";
$parameters[] = $_GET["status"];
}
} else if (empty($_GET["all"])) { // no filter when all = 1
$filter_sql .= " and createdate >= DATE_SUB(CURRENT_DATE(), INTERVAL 2 WEEK) AND createdate <= '".date('Y-m-d 23:59:59')."'";
}
//pagination
// how many records should be displayed on a page?
$records_per_page = 20;
// instantiate the pagination object
$pagination = new Zebra_Pagination();
// records per page
$pagination->records_per_page($records_per_page);
try{
$sql = "select count(*) as count from `order` where deleted = 0 " . $filter_sql;
$order_info = bind_pdo($sql, $parameters, "selectone");
}catch(Exception $e){
header('Location: http://www.hkosl.com/innoutstorage/webadmin/order_index.php?msg=租用單位不存在');
exit;
}
// the number of total records is the number of records in the array
$pagination->records($order_info['count']);
$sql = "select * from `order` where deleted = 0 " . $filter_sql . " order by id DESC";
$sql .= ' LIMIT ' . (($pagination->get_page() - 1) * $records_per_page) . ', ' . $records_per_page ;
$order_info = bind_pdo($sql, $parameters, "selectall");
foreach ($order_info as $key => $order) {
$order_id = $order["id"];
$order_info[$key]["order_code"] = $order["code"];
/*$customer_info = get_customer($order["customer_id"]);
$order_info[$key]["customer_code"] = $customer_info["code"];
$order_info[$key]["customer_name"] = $customer_info["customer_name"];*/
$customer_name = get_customer_name(rsa_crypt($order["customer_firstname"], 2), rsa_crypt($order["customer_lastname"], 2));
$order_info[$key]["customer_code"] = $order["customer_code"];
$order_info[$key]["customer_name"] = $customer_name;
$order_info[$key]["customer_tel"] = rsa_crypt($order_info[$key]["customer_tel"], 2);
}
$filter_order_code = "";
$filter_customer_code = "";
$filter_customer_name = "";
$filter_customer_tel = "";
$filter_status = "";
$filter_startfrom = "";
$filter_room = "";
$all_order_info = get_order2();
foreach ($all_order_info as $key => $order) {
$filter_order_code[$key][0] = $order["id"];
$filter_order_code[$key][1] = $order["code"];
}
$all_order_info = get_customer2();
foreach ($all_order_info as $key => $customer) {
$filter_customer_code[$key][0] = $customer["id"];
$filter_customer_code[$key][1] = $customer["code"];
$filter_customer_name[$key][0] = $customer["id"];
$filter_customer_name[$key][1] = $customer["customer_name"];
$filter_customer_tel[$key][0] = $customer["id"];
$filter_customer_tel[$key][1] = $customer["tel"];
}
$all_room_info = get_room();
foreach ($all_room_info as $key => $room) {
$filter_room[$key][0] = $room["id"];
$filter_room[$key][1] = $room["code"];
}
$status_info = get_master_type_code("ORDER_STATUS");
foreach ($status_info as $key => $status) {
$filter_status[$key][0] = $status["code"];
$filter_status[$key][1] = $status["name_tc"];
}
$filter2_info = array(0 => $filter_order_code, 1 => $filter_customer_code, 2 => $filter_customer_name, 3 => "user_input", 4 => $filter_status, 5 => "user_input", 6 => $filter_customer_tel, 7 => $filter_room);
?>
<!DOCTYPE html>
<html>
<head>
<?php require_once("html_head.php"); ?>
<link rel="stylesheet" href="Zebra_Pagination/css/zebra_pagination.css" type="text/css">
<script src="Zebra_Pagination/js/zebra_pagination.js"></script>
<script type="text/javascript" src="js/chosen_v1.4.1/chosen.jquery.min.js"></script>
<link rel="stylesheet" href="js/chosen_v1.4.1/chosen.min.css">
<script type="text/javascript">
function switch_order(order_id) {
if (!isNaN(order_id)) {
var r = confirm("你確定要為這張合約進入轉倉程序?");
if (r == true) {
window.location.href = '_ajax.php?for=switch_order&order_id=' + order_id;
}
}
}
function terminate_order(order_id) {
if (!isNaN(order_id)) {
var r = confirm("你確定要為這張合約進入退倉程序?");
if (r == true) {
window.location.href = 'terminate_order.php?order_id=' + order_id;
}
}
}
$(function () {
$(".selectbox").chosen({width: "150px", search_contains: true});
});
</script>
</head>
<body>
<table width="1200" height="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" align="left" valign="top">
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="70" align="left" valign="middle"> </td>
</tr>
<tr>
<td width="200" align="left" valign="top"><!-- Main Menu -->
<?php require("menu.php"); ?><!-- End Main Menu --></td>
</tr>
</table>
</td>
<td width="1000" align="left" valign="top">
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="70" class="pagetitletxt"> </td>
<td width="50" align="center" class="icontxt">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="pagetitletxt">
<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/>
合約
</b></td>
</tr>
<tr>
<td height="25" align="left" valign="middle" class="msg"><?php if (isset($_GET["msg"])) echo $_GET['msg']; ?></td>
</tr>
<tr>
<td align="left" valign="middle">
<div>
<form method="get" action="">
搜尋
<br>
<select name="code" class="selectbox">
<option value="">---合約編號---</option>
<?php
foreach ($filter2_info[0] as $data) {
if (isset($_GET["code"]))
$selected = matched_option($data[0], $_GET["code"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="customer_code" class="selectbox">
<option value="">---客戶編號---</option>
<?php
foreach ($filter2_info[1] as $data) {
if (isset($_GET["customer_code"]))
$selected = matched_option($data[0], $_GET["customer_code"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="customer_name" class="selectbox">
<option value="">---客戶姓名---</option>
<?php
foreach ($filter2_info[2] as $data) {
if (isset($_GET["customer_name"]))
$selected = matched_option($data[0], $_GET["customer_name"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="customer_tel" class="selectbox">
<option value="">---聯絡電話---</option>
<?php
foreach ($filter2_info[6] as $data) {
if (isset($_GET["customer_tel"]))
$selected = matched_option($data[0], $_GET["customer_tel"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="order_room" class="selectbox">
<option value="">---租用單位---</option>
<?php
foreach ($filter2_info[7] as $data) {
if (isset($_GET["order_room"]))
$selected = matched_option($data[0], $_GET["order_room"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="status" class="selectbox">
<option value="">---狀態---</option>
<?php
foreach ($filter2_info[4] as $data) {
if (isset($_GET["status"]))
$selected = matched_option($data[0], $_GET["status"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<br>
<p>生效日期</p>
<input type="date" name="startdate_min"
value="<?= isset($_GET["startdate_min"]) ? $_GET["startdate_min"] : ""; ?>" style="width: 100px;" />
至
<input type="date" name="startdate_max"
value="<?= isset($_GET["startdate_max"]) ? $_GET["startdate_max"] : ""; ?>" style="width: 100px;" />
<br>
<p>建立日期</p>
<input type="date" name="createdate_min"
value="<?= isset($_GET["createdate_min"]) ? $_GET["createdate_min"] : ""; ?>" style="width: 100px;" />
至
<input type="date" name="createdate_max"
value="<?= isset($_GET["createdate_max"]) ? $_GET["createdate_max"] : ""; ?>" style="width: 100px;" />
<br><br>
<button type="submit" name="filter" value="1">送出</button>
<button type="button" onclick="window.location.href='order_index.php?all=1';" style="margin-left: 15px;">
全部合約
</button>
</form>
</div>
<br>
<table width="1150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" class="listtitletxt"></td>
<td width="100" class="listtitletxt">合約編號</td>
<td width="100" class="listtitletxt">門卡號碼</td>
<!--<td width="150" class="listtitletxt">客戶類別</td>-->
<td width="150" class="listtitletxt">客戶姓名</td>
<td width="80" class="listtitletxt">聯絡電話</td>
<td width="200" class="listtitletxt">租用單位</td>
<td width="70" class="listtitletxt" style="white-space: nowrap">租用期(月)</td>
<td width="80" class="listtitletxt">生效日期</td>
<td width="80" class="listtitletxt">結束日期</td>
<td width="50" class="listtitletxt">狀態</td>
<td width="50" class="listtitletxt">轉倉</td>
<td width="50" class="listtitletxt">退倉</td>
<td width="50" class="listtitletxt">詳情</td>
</tr>
<?php
foreach ($order_info as $order) {
print "<tr>";
print "<td class='listtxt' style='padding-left:5'> </td>";
print "<td class='listtxt' style='padding-left:5; white-space: nowrap'>" . $order['order_code'] . "</td>";
print "<td class='listtxt' style='padding-left:5'>" . $order['room_key'] . "</td>";
/*$customer_type = get_master_type_code("CUSTOMER_TYPE", $order["customer_typeid"]);
if($order["customer_typeid"] == "BUSINESS"){
print "<td class='listtxt' style='padding-left:5'>" . $customer_type["name_tc"] . "<br>".$order["customer_companyname"]."</td>";
}else if($order["customer_typeid"] == "PERSONAL"){
print "<td class='listtxt' style='padding-left:5'>" . $customer_type["name_tc"] . "</td>";
}*/
print "<td class='listtxt' style='padding-left:5'>" . $order['customer_name'] . "<br>(" . $order['customer_code'] . ")</td>";
print "<td class='listtxt' style='padding-left:5'>" . $order['customer_tel'] . "</td>";
$order_room_info = get_order_room($order["id"]);
$order_room_list = "";
$deposit_info = get_order_deposit($order["id"]);
foreach ($order_room_info as $detail) {
$room_info = get_room($detail["room_id"]);
$order_room_list .= check_combine_room($room_info["code"]) . ", ";
}
$order_room_list = substr_replace($order_room_list, "", -2);
print "<td class='listtxt' style='padding-left:5'>" . $order_room_list . "</td>";
print "<td class='listtxt' style='padding-left:5'>" . $order['rent_month'] . "</td>";
print "<td class='listtxt' style='padding-left:5'>" . $order['startdate'] . "</td>";
print "<td class='listtxt' style='padding-left:5'>" . $order['enddate'] . "</td>";
$order_status = get_master_type_code("ORDER_STATUS", $order["status"]);
print "<td class='listtxt' style='padding-left:5'>" . $order_status["name_tc"] . "</td>";
if ($order["status"] == "NEW") {
print "<td class='listtxt' style='padding-left:5'><button type='button' onclick='switch_order(" . $order["id"] . ");'>轉倉</button></td>";
} else {
print "<td class='listtxt' style='padding-left:5'>不適用</td>";
}
if ($order["status"] == "NEW") {
print "<td class='listtxt' style='padding-left:5'><button type='button' onclick='terminate_order(" . $order["id"] . ");'>退倉</button></td>";
} elseif ($deposit_info["deposit_id"]) {
// print "<td class='listtxt' style='padding-left:5'>不適用</td>";
// print "<td class='listtxt' style='padding-left:5'><a style='color:blue' href='http://www.hkosl.com/innoutstorage/webadmin/deposit_modifyform.php?id=". $deposit_info["deposit_id"] ."' >已退倉</a></td>";
print "<td class='listtxt' style='padding-left:5'>
<a style='color:blue' href='#' onClick=\"window.location='deposit_modifyform.php?id=" . $deposit_info["deposit_id"] . "'\">已退倉</a></td>";
} else {
print "<td class='listtxt' style='padding-left:5'>
<a style='color:blue' href='#' onClick=\"window.location='deposit_modifyform_no_deposit.php?id=" . $order['id'] . "'\">已退倉</a></td>";
}
// Modify
print "<td class='listtxt' align='center'><a href='#' onClick=\"window.location='order_modifyform.php?order_id=" . $order['id'] . "'\"><img src='images/btnModify.png' title='Modify' alt='Modify' hspace='2' border='0'></a></td>";
print "</tr>";
}
?>
</table>
<br>
<?php
// render the pagination links
$pagination->render();
?>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>