You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

168 lines
5.6 KiB

<?php
#error_reporting(E_ALL);
#ini_set('display_errors', "On");
include "../header.php";
// 載入db.php來連結資料庫
require_once "../database.php";
$data = [];
$yyyymm = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET['yyyymm'] : $_POST['yyyymm'];
$salesman = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET['salesman'] : $_POST['salesman'];
$item_no = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET['item_no'] : $_POST['item_no'];
$amount_kind = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET['amount_kind'] : $_POST['amount_kind'];
$where_yyyymm = " and yyyymm like '" . $yyyymm ."%'";
$where_salesman = empty($salesman) ? "" : " and salesman like '" . $salesman . "'";
$where_item_no = " and item_no like '" . $item_no . "%'";
$where_amount_kind= " and amount_kind like '" . $account_kind . "%'";
$sql_get = "select customer_id ,customer_name,item_no,
amount,salesman,
amount_kind,cost,contract_kind ,remark, yyyymm From salesman_bonus_detail
where 1=1 $where_yyyymm $where_salesman $where_item_no $where_amount_kind ";
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
?>
<style>
table {
table-layout: fixed;
width: 90%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
vertical-align: middle !important;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
table.query-table th {
text-align: right;
}
</style>
<form method='post' action='#'>
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>獎金查詢</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='width:50px'>年月</th>
<td><input type="text" class='form-control' name='yyyymm'></td>
<th>营业员</th>
<td><input type="text" class='form-control' name='salesman'></td>
<th>品項代码</th>
<td><input type="text" class='form-control' name='item_no'></td>
<th>款项类别</th>
<td><input type="text" class='form-control' name='amount_kind'></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="8" style='text-align:center'>
<button type="submit" style='text-align:center; margin:0 auto;width:50px' class="btn btn-primary">查询</button>
<button type="button" class="btn btn-primary">列印</button>
</td>
</tr>
</tfoot>
</table>
<div style="overflow-x:auto;width:92%;margin:0 auto">
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact">
<thead>
<tr>
<th>年月</th>
<th>客戶號</th>
<th>客户名称</th>
<th>認列與實際收款</th>
<th>品項代码</th>
<th>品項名稱</th>
<th>款項類別</th>
<th>修理成本</th>
<th>銷售人員</th>
<th>奖金</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<?php
$rowspan = 1;
foreach ($res_get as $key => $data) :
$item_list = explode(",", $data['item_list']);
$summary_list = explode(",", $data['summary_list']);
$salesman_list = explode(",", $data['salesman_list']);
$rowspan = 1;
$summary = array_sum($summary_list);
?>
<tr>
<?php
$key1 = $data['yyyymm'] . "_" . $data['customerid'] . '_' . $item_list[0];
?>
<td><?php echo $data['yyyymm']; ?></td>
<td><?php echo $data['customer_id']; ?></td>
<td><?php echo $data['customer_name']; ?></td>
<td><?= $data['amount'] ?></td>
<td><?= $data['item_no'] ?></td>
<td>维修保养费</td>
<td>
<?php
$sql_get_opt = "select code_name,content From code where field_name='amount_kind'";
$res_get_opt = mysqli_fetch_all(mysqli_query($link, $sql_get_opt), MYSQLI_ASSOC);
foreach ($res_get_opt as $opt) {
if ($data['amount_kind'] == $opt['code_name']) echo ' <label>' . $opt['code_name'] . '-' . $opt['content'] . ' </label>';
}
?>
</td>
<td><?= $data['cost'] ?></td>
<td><?= $data['salesman'] ?></td>
<td><?= $data['remark'] ?></td>
<td><?= $data['remark'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</form>
<?php
#代錶結束連線
mysqli_close($link);
include "../footer.php";
?>