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.
181 lines
7.3 KiB
181 lines
7.3 KiB
<?php
|
|
#error_reporting(E_ALL);
|
|
#ini_set('display_errors', "On");
|
|
require_once "./header.php";
|
|
// 載入db.php來連結資料庫
|
|
require_once "../database.php";
|
|
|
|
|
|
|
|
$data = [];
|
|
$data['yyyymm'] = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET['yyyymm'] : $_POST['yyyymm'];
|
|
$form_key = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET['form_key'] : $_POST['form_key'];
|
|
$where_yyyymm = " and yyyymm like '" . $data['yyyymm'] . "%'";
|
|
$where_form_key = empty($form_key) ? "" : " and form_key like '" . $form_key . "'";
|
|
// $sql_get = "select *From ec_purchase_order where 1=1 $where_yyyymm $where_form_key ";
|
|
$sql_get = "select customerid ,customer_name,GROUP_CONCAT(item_no) item_list,
|
|
GROUP_CONCAT(summary_price) summary_list,
|
|
GROUP_CONCAT(salesman) salesman_list
|
|
,max(yyyymm) yyyymm From ec_purchase_order
|
|
where 1=1 $where_yyyymm $where_form_key group by customerid ";
|
|
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
|
|
|
|
|
|
#excel 第一行 从B3-H3
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
<style>
|
|
table {
|
|
table-layout: fixed;
|
|
width: 100%;
|
|
}
|
|
|
|
td {
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
img {
|
|
width: 125px;
|
|
}
|
|
|
|
.width_style_1 {
|
|
width: 125px;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
}
|
|
|
|
#table_index_filter {
|
|
float: right;
|
|
}
|
|
|
|
#table_index_paginate {
|
|
float: right;
|
|
}
|
|
|
|
label {
|
|
display: inline-flex;
|
|
margin-bottom: .5rem;
|
|
margin-top: .5rem;
|
|
|
|
}
|
|
</style>
|
|
<form method='post' action='cal_bonus_submit.php'>
|
|
<input type='submit'>
|
|
<div style="overflow-x:auto;">
|
|
<table id="table_index" class="table table-striped table-bordered display compact" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>年月</th>
|
|
<th>客戶號</th>
|
|
<th>客户名称</th>
|
|
<th>金额</th>
|
|
<th>認列與實際收款</th>
|
|
<th>品項代码</th>
|
|
<th>品項名稱</th>
|
|
<th colspan="2">款項類別</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 = count($item_list);
|
|
$summary = array_sum($summary_list);
|
|
?>
|
|
<tr>
|
|
<?php
|
|
$key1 = $data['yyyymm'] . "_" . $data['customerid'] . '_' . $item_list[0];
|
|
?>
|
|
<td rowspan=<?= $rowspan ?>><?php echo $data['yyyymm']; ?></td>
|
|
<td rowspan=<?= $rowspan ?>><?php echo $data['customerid']; ?></td>
|
|
<td rowspan=<?= $rowspan ?>><?php echo $data['customer_name']; ?></td>
|
|
<td rowspan=<?= $rowspan ?>><?php echo $summary; ?></td>
|
|
<td><input type="text" value='<?= $summary_list[0] ?>' class='form-control' name=<?= "amount[$key1]" ?>></td>
|
|
|
|
<td><?php echo $item_list[0]; ?></td>
|
|
<td>维修保养费</td>
|
|
<td colspan="2">
|
|
<label><input name='<?= "kind[$key1]" ?>' type="radio" value="1" />保養款 </label>
|
|
<label><input name='<?= "kind[$key1]" ?>' type="radio" value="2" />修理款 </label>
|
|
<label><input name='<?= "kind[$key1]" ?>' type="radio" value="3" />訂金 </label>
|
|
<label><input name='<?= "kind[$key1]" ?>' type="radio" value="4" />出貨款 </label>
|
|
<label><input name='<?= "kind[$key1]" ?>' type="radio" value="5" />驗收款 </label>
|
|
</td>
|
|
|
|
<td><input type="text" value='' class='form-control' name=<?= "cost[$key1]" ?>></td>
|
|
|
|
<td>
|
|
<label><input name='<?= "contract_kind[$key1]" ?>' type="radio" value="1" />新签约 </label>
|
|
<label><input name='<?= "contract_kind[$key1]" ?>' type="radio" value="2" />免保转有费 </label>
|
|
<label><input name='<?= "contract_kind[$key1]" ?>' type="radio" value="3" />续签约 </label>
|
|
|
|
</td>
|
|
<td><?php echo $salesman_list[0]; ?>
|
|
<input type="hidden" class='form-control' name=<?= "salesman_list[$key1]" ?> value='<?= $salesman_list[0] ?>'>
|
|
</td>
|
|
|
|
<td><input type="text" value='' class='form-control' name=<?= "remark[$key1]" ?>></td>
|
|
</tr>
|
|
|
|
<?php
|
|
for ($i = 1; $i < count($item_list); $i++) {
|
|
$key1 = $data['yyyymm'] . "_" . $data['customerid'] . "_" . $item_list[$i];
|
|
echo "<tr>
|
|
<td ><input type='text' value='" . $summary_list[$i] . "'
|
|
class='form-control' name='amount[$key1]'></td>
|
|
<td>" . $item_list[$i] . "</td>
|
|
<td>维修保养费</td>
|
|
<td colspan='2'>
|
|
<label><input name='kind[$key1]' type='radio' value='1' />保養款 </label>
|
|
<label><input name='kind[$key1]' type='radio' value='2' />修理款 </label>
|
|
<label><input name='kind[$key1]' type='radio' value='3' />訂金 </label>
|
|
<label><input name='kind[$key1]' type='radio' value='4' />出貨款 </label>
|
|
<label><input name='kind[$key1]' type='radio' value='5' />驗收款 </label>
|
|
</td>
|
|
<td><input type='text' class='form-control'
|
|
name='cost[$key1]' /></td>
|
|
<td>
|
|
<label><input name='contract_kind[$key1]' type='radio' value='1' />新签约 </label>
|
|
<label><input name='contract_kind[$key1]' type='radio' value='2' />免保转有费 </label>
|
|
<label><input name='contract_kind[$key1]' type='radio' value='3' />续签约 </label>
|
|
|
|
</td>
|
|
<td>" . $salesman_list[$i] . "
|
|
<input type='hidden' class='form-control'
|
|
name='salesman_list[" . $key1 . "]' value='" . $salesman_list[$i] . "'>
|
|
</td>
|
|
|
|
<td><input type='text' class='form-control'
|
|
name='remark[$key1]' /></td>
|
|
|
|
|
|
</tr>";
|
|
}
|
|
?>
|
|
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
<?php
|
|
#代錶結束連線
|
|
mysqli_close($link);
|
|
|
|
include "footer.php";
|
|
|
|
?>
|