| 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");
$_SESSION["index_url_parameter"] = get_index_url_parameter();
$_SESSION["_payment_type"] = $_GET["type"];
if (!isset($_GET["filter1"]) && !isset($_GET["filter2"]) && !isset($_GET["all"])) {
$payment_info = array();
$filter_sql = " and payment.createdate BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 2 WEEK) AND DATE_SUB(CURRENT_DATE(), INTERVAL -1 DAY) ";
$parameters = NULL;
} else {
$filter_sql = "";
if (isset($_GET["all"]) && (int)$_GET["all"] == 1) {
$filter_sql = "";
$parameters = NULL;
} else {
if (isset($_GET["filter1"]) && isset($_GET["filter2"])) {
if ($_GET["filter1"] == 0) { //customer_id
$filter_sql = "and payment.customer_id = ?";
}
if ($_GET["filter1"] == 1) { //deposit status
$filter_sql = "and payment.status = ?";
}
if ($_GET["filter1"] == 2) { //deposit status
$filter_sql = "and payment.code = ?";
}
$parameters = array($_GET["filter2"]);
}
}
}
$sql = "select *,
payment.id as payment_id,
payment.status as payment_status,
payment.code as payment_code,
payment.docdate as payment_docdate,
payment.lastupdate as payment_lastupdate,
payment.lastupby as payment_lastupby
from `payment` payment
INNER JOIN `customer` cust ON payment.customer_id = cust.id
where payment.deleted = ? and (payment.payfor = ? or payment.payfor = 'ALL') " . $filter_sql . " order by payment.id DESC";
if (!empty($parameters)) {
$parameters = array_merge(array(0, $_GET["type"]), $parameters);
} else {
$parameters = array(0, $_GET["type"]);
}
$payment_info = bind_pdo($sql, $parameters, "selectall");
foreach ($payment_info as $key => $payment) {
$customer_id = $payment["customer_id"];
$payment_info[$key]["customer_id"] = $payment["customer_id"];
$customer_info = get_customer($customer_id);
$payment_info[$key]["customer_code"] = $customer_info["code"];
//$customer_name = get_customer_name(rsa_crypt($customer_info["firstname"], 2), rsa_crypt($customer_info["lastname"], 2));
$payment_info[$key]["customer_name"] = $customer_info["customer_name"];
/*$payment_type = get_master_type_code("PAYMENT_TYPE", $payment["payable_type"]);
$payment_info[$key]["payable_type"] = $payment_type["name_tc"];*/
$payment_status = get_master_type_code("PAYMENT_STATUS", $payment["payment_status"]);
$payment_info[$key]["payment_status"] = $payment_status["name_tc"];
}
$filter_customer = "";
$filter_status = "";
$filter_payment = "";
$all_customer_info = get_customer();
$status_info = get_master_type_code("PAYMENT_STATUS");
$sql = "select id, payfor, code from payment where deleted = ? and (payfor = ? or payfor='ALL') order by code ASC";
$parameters = array(0, $_GET["type"]);
$all_payment = bind_pdo($sql, $parameters, "selectall");
foreach ($all_customer_info as $key => $customer) {
$filter_customer[$key][0] = $customer["id"];
$filter_customer[$key][1] = $customer['customer_name'] . " (" . $customer["code"] . ")";
}
foreach ($status_info as $key => $status) {
$filter_status[$key][0] = $status["code"];
$filter_status[$key][1] = $status["name_tc"];
}
foreach ($all_payment as $key => $payment) {
$filter_payment[$key][0] = $payment["code"];
$filter_payment[$key][1] = $payment["code"];
}
$filter1_info = array("客戶", "狀態", "收據編號");
$filter2_info = array(0 => $filter_customer, 1 => $filter_status, 2 => $filter_payment);
?>
<!DOCTYPE html>
<html>
<head>
<?php require_once("html_head.php"); ?>
<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 () {
$("#filter1").chosen({width: "100px", search_contains: true});
$("#filter2_0").chosen({width: "250px", search_contains: true});
$("#filter2_1").chosen({width: "250px", search_contains: true});
$("#filter2_2").chosen({width: "250px", search_contains: true});
$("#filter2_0_chosen").css("display", "none");
$("#filter2_1_chosen").css("display", "none");
$("#filter2_2_chosen").css("display", "none");
<?php
if (isset($_GET["filter1"])) {
echo '$("#filter2_"+' . $_GET["filter1"] . '+"_chosen").css("display", "inline-block");';
}
?>
$("#filter1").change(function () {
var filter_1_key = $(this).val();
$(".filter2").css("display", "none");
$("#filter2_0_chosen").css("display", "none");
$("#filter2_1_chosen").css("display", "none");
$("#filter2_2_chosen").css("display", "none");
$("#filter2_" + filter_1_key + "_chosen").css("display", "inline-block");
});
});
function filter() {
var filter1 = $("select[name='filter1']").val();
var filter2 = $("#filter2_" + filter1).val();
if (filter1 != "" && filter2 != "") {
top.location.href = 'payment_index.php?type=<?=$_GET["type"]?>&filter1=' + filter1 + '&filter2=' + filter2;
} else {
alert("請選擇篩選方式。");
}
}
</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">
<a href="payment_addform.php?type=<?= $_GET["type"] ?>"><img src="images/iconNew.png" alt="Add" width="32" height="32" border="0"/><br/> 新增
</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="pagetitletxt">
<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/>
<?= $_GET["type"] == "DEPOSIT" ? "按金收據" : "正式收據" ?>
</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>篩選: <select name="filter1" id="filter1">
<option value="">---請選擇---</option>
<?php
foreach ($filter1_info as $key => $filter1) {
if (isset($_GET["filter1"]))
$selected = matched_option($key, $_GET["filter1"], "select");
echo '<option value="' . $key . '" ' . $selected . '>' . $filter1 . '</option>';
}
?>
</select>
<select name="filter2" id="filter2_0" class="filter2 ">
<option value="">---請選擇---</option>
<?php
foreach ($filter2_info[0] as $data) {
if (isset($_GET["filter2"]))
$selected = matched_option($data[0], $_GET["filter2"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="filter2" id="filter2_1" class="filter2 ">
<option value="">---請選擇---</option>
<?php
foreach ($filter2_info[1] as $data) {
if (isset($_GET["filter2"]))
$selected = matched_option($data[0], $_GET["filter2"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<select name="filter2" id="filter2_2" class="filter2">
<option value="">---請選擇---</option>
<?php
foreach ($filter2_info[2] as $data) {
if (isset($_GET["filter2"]))
$selected = matched_option($data[0], $_GET["filter2"], "select");
echo '<option value="' . $data[0] . '" ' . $selected . ' class="' . $key . '">' . $data[1] . '</option>';
}
?>
</select>
<button type="button" onclick="filter();">送出</button>
<button type="button" onclick="window.location.href='payment_index.php?all=1&type=<?= $_GET["type"] ?>';" style="margin-left: 15px;">
全部記錄
</button>
</div>
<br>
<table width="1000" 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="100" class="listtitletxt">合約編號</td>-->
<td width="80" class="listtitletxt">客戶編號</td>
<td width="100" class="listtitletxt">客戶姓名</td>
<td width="80" class="listtitletxt">付款日期</td>
<td width="100" class="listtitletxt">金額</td>
<td width="50" class="listtitletxt">狀態</td>
<td width="20" class="listtitletxt"></td>
</tr>
<?php
foreach ($payment_info as $payment) {
/*$payment_dtl_info = get_payment_dtl($payment["payment_id"]);
$this_payment_type_total_amt = 0;
foreach ($payment_dtl_info as $key => $payment_dtl) {
if ($payment_dtl["payable_type"] == $_GET["type"]) {
$this_payment_type_total_amt += $payment_dtl["amount"];
}
}
if ($this_payment_type_total_amt <= 0)
continue;*/
//pay for
//$deposit_payment = get_deposit($payment["payment_code"]);
//$invoice_payment = get_invoice($payment["payment_code"]);
print "<tr>";
print "<td class='listtxt' style='padding-left:5'> </td>";
print "<td class='listtxt' style='padding-left:5'>" . $payment{'payment_code'} . "</td>";
/*print "<td class='listtxt' style='padding-left:5'>" . $payment{'payable_type'} . "</td>";*/
/*print "<td class='listtxt' style='padding-left:5'><a href='order_modifyform.php?order_id=" . $payment["order_id"] . "' target='_blank'> " . $payment{'order_code'} . "</a></td>";*/
print "<td class='listtxt' style='padding-left:5'><a href='customer_modifyform.php?id=" . $payment["customer_id"] . "' target='_blank'> " . $payment{'customer_code'} . "</a></td>";
print "<td class='listtxt' style='padding-left:5'><a href='customer_modifyform.php?id=" . $payment["customer_id"] . "' target='_blank'>" . $payment{'customer_name'} . "</a></td>";
print "<td class='listtxt' style='padding-left:5'>" . $payment{'payment_docdate'} . "</td>";
print "<td class='listtxt' style='padding-left:5'>$" . numberformat($payment{'amount'}) . "</td>";
//print "<td class='listtxt' style='padding-left:5'>$" . numberformat($this_payment_type_total_amt) . "</td>";
print "<td class='listtxt' style='padding-left:5'>" . $payment["payment_status"] . "</td>";
// Modify
print "<td class='listtxt' align='center'><a href='#' onClick=\"window.location='payment_modifyform.php?id=" . $payment{'payment_id'} . "&type=" . $_GET["type"] . "'\"><img src='images/btnModify.png' title='Modify' alt='Modify' hspace='2' border='0'></a></td>";
print "</tr>";
}
?>
</table>
<br> <br> <br> <br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>