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.
 
 
 
 
 
 

254 lines
9.1 KiB

<?php
require_once "../header.php";
// 載入db.php來連結資料庫
$table = 'con_maintance_examine_apply';
#可編輯的列
$editableColumn = [
'apply_key' => [
'label' => "評審單號", "value" => "", "tag" => 'text',
'attr' => [
'readonly=true ',
'class' => 'form-control form-control-sm'
]
],
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']],
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
'num' => ['label' => "電梯臺數", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']],
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']],
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']],
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']],
'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']],
'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']],
//'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt],
];
// 設置一個空陣列來放資料
$data = array();
$salesman = empty($_GET['salesman']) ? $user_id : $_GET['salesman'];
//$where = " and salesman like '%'";
$where = " and salesman = '$salesman'";
// 可瀏覽全部資料的部門
$depart_arr = ["220"];
$sql = "select department_id from account where accountid = '$user_id'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
$user_department_id = $row[0];
mysqli_free_result($res);
if (in_array($user_department_id, $depart_arr) || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0006" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "M0225") $where = "";
// 電梯廠牌
$elevator_brand_arr = [];
$sql = "select code_name ,content from code where field_name='elevator_brand'";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
$elevator_brand_arr[$row[0]] = $row[1];
}
mysqli_free_result($res);
$sql = "SELECT
apply_key,
vol_no,
address,
case_name,
brand ,
num ,
f_return_name(salesman) salesman,
f_return_content('maintain_kind',maintain_kind ) maintain_kind,
date_format(contract_begin_date,'%Y/%m/%d') contract_begin_date,
date_format(contract_end_date,'%Y/%m/%d') contract_end_date ,
f_return_content('contract_kind',contract_kind ) contract_kind,
platform_company,
platforom_company_tel,
form_key,
f_return_content('payment_kind',payment_kind ) payment_kind FROM $table
where 1=1 $where ORDER BY vol_no";
// echo $sql;
$data = mysqli_query($link, $sql);
?>
<?php
if ($data) :
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) {
echo "<p class='error'>Please fill up the required field!</p>";
} else {
header("Location:repair-index.php");
}
}
?>
<!-- <link rel="stylesheet" href="common.css"> -->
<style>
#table_index2 {
table-layout: fixed;
width: 100%;
}
#table_index2_filter {
float: right;
}
#table_index2_paginate {
float: right;
}
div.dataTables_scrollHead table.dataTable {
margin-bottom: 0 !important;
border-bottom-width: 0;
}
div.dataTables_scrollBody table.dataTable {
border-top-width: 0;
}
/*
.col-sm-12 {
width: auto;
}
*/
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
div a:hover {
text-decoration: none;
}
.btn-sm {
font-size: 14px;
margin: 2px 0;
line-height: 90%;
}
.glyphicon-ok,
.glyphicon-ban-circle {
font-size: 130%;
}
.btn-secondary {
color: #fff;
background-color: #6c757d;
border-color: #6c757d;
}
.btn-secondary:hover {
color: #fff;
background-color: #5a6268;
border-color: #545b62;
}
</style>
<script>
$(function() {
$('#table_index2').DataTable({
"scrollX": true,
"pageLength": 50
});
/*
var api = $('#table_index').dataTable().api();
//var order = api.order();
//console.log(order);
api
.order([0, "desc"])
.draw();
*/
});
</script>
<link rel="stylesheet" href="common.css">
<div style="overflow-x:auto;">
<!-- <form method='get' action='#'> -->
<!-- <table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>(契約)價審單查詢</h3>
</td>
</tr>
</thead>
</table> -->
<div style=" white-space:nowrap;">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>評審單號</th>
<th>卷號</th>
<th>現場地址</th>
<th>現場名稱</th>
<th>電梯品牌</th>
<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 foreach ($data as $row) : ?>
<tr>
<td><?php echo $row['apply_key'] ?></td>
<td><?php echo $row['vol_no'] ?></td>
<td><?php echo $row['address'] ?></td>
<td><?php echo $row['case_name'] ?></td>
<td><?php echo $row['brand'] ?></td>
<td><?php echo $row['num'] ?></td>
<td><?php echo $row['salesman'] ?></td>
<td><?php echo $row['maintain_kindd'] ?></td>
<td><?php echo $row['contract_begin_date'] ?></td>
<td><?php echo $row['contract_end_date'] ?></td>
<td><?php echo $row['contract_kind'] ?></td>
<td><?php echo $row['platform_company'] ?></td>
<td><?php echo $row['platforom_company_tel'] ?></td>
<?php list($signer) = mysqli_fetch_array(mysqli_query($link, "select max(f_return_name(current_assigner) ) signer from subflow where form_key='" . $row['form_key'] . "'")); ?>
<td><?php echo empty($signer) ? '結案' : 'N' ?></td>
<td>
<button>下載</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "../footer.php";
?>