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.
 
 
 
 
 
 

265 lines
13 KiB

<?php
// 暫時可編輯及刪除權限
$update_delete_status = false;
if (in_array($user_id, ['M0175', 'M0079'])) {
$update_delete_status = true;
}
?>
<table id="table_index2" class="table table-striped table-bordered " style="width:100%;table-layout:fixed;">
<thead>
<tr>
<?php
echo $update_delete_status ? "<th style='text-align:center;width:80px;'>刪除</th>" : "";
?>
<th style="text-align:center;width:80px;">序號</th>
<th style="text-align:center;width:120px;">合約號</th>
<th style="text-align:center;width:120px;">電梯編號</th>
<th style="text-align:center;width:150px;">客戶姓名</th>
<th style="text-align:center;width:150px;">規格</th>
<th style="text-align:center;width:150px;">地址</th>
<th style="text-align:center;width:80px;">工勘狀態</th>
<th style="text-align:center;width:100px;">合約交期(到工地)</th>
<th style="text-align:center;width:100px;">下單日(普來特富)</th>
<th style="text-align:center;width:100px;">預計到廠日(觀音廠)</th>
<th style="text-align:center;width:100px;">實際到廠日(觀音廠)</th>
<th style="text-align:center;width:100px;">預計出貨日(到工地)</th>
<th style="text-align:center;width:100px;">實際出貨日(到工地)</th>
<th style="text-align:center;width:100px;">營業確認</th>
<th style="text-align:center;width:100px;">設計確認</th>
<th style="text-align:center;width:100px;">工務確認</th>
<th style="text-align:center;width:120px;">生管(業務)確認</th>
</tr>
</thead>
<tbody>
<?php
foreach ($data as $key => $data) :
//規格
$Specification = $data['facility_kind'];
$Specification .= !empty($data['numberofpassenger']) ? "-" . $data['numberofpassenger'] : "";
$Specification .= !empty($data['weight']) ? "-" . $data['weight'] : "";
$Specification .= !empty($data['numberofstop']) ? "-" . $data['numberofstop'] : "";
$Specification .= !empty($data['numberoffloor']) ? "/" . $data['numberoffloor'] : "";
$Specification .= !empty($data['opentype']) ? "-" . $data['opentype'] : "";
$Specification .= !empty($data['speed']) ? $data['speed'] : "";
//工務
$data['gongwuok'] = 0;
// 營業
$data['yingyeok'] = 0;
// 設計
$data['shejiok'] = 0;
// 生管
$data['shengguanok'] = 0;
// 財務
// $caiwuok = 0;
// 工務統計已確認
if ($data['building_heigh_verify'] == 0 || $data['building_heigh_verify'] == 2)
$data['gongwuok'] += 1;
if (!in_array($data['site_survey_contact_verify'], ['1', 'A']))
$data['gongwuok'] += 1;
// 營業統計已確認
if ($data['sales_spec_verify'] == 0 || $data['sales_spec_verify'] == 2)
$data['yingyeok'] += 1;
if ($data['customer_planning_verify'] == 0 || $data['customer_planning_verify'] == 2)
$data['yingyeok'] += 1;
if ($data['customer_color_verify'] == 0 || $data['customer_color_verify'] == 2)
$data['yingyeok'] += 1;
if ($data['customer_style_verify'] == 0 || $data['customer_style_verify'] == 2)
$data['yingyeok'] += 1;
if ($data['site_survey_contact_form_verify'] == 0 || $data['site_survey_contact_form_verify'] == 2)
$data['yingyeok'] += 1;
// 設計統計已確認
if ($data['desin_spec_verify'] == 0 || $data['desin_spec_verify'] == 2)
$data['shejiok'] += 1;
if ($data['desin_planning_verify'] == 0 || $data['desin_planning_verify'] == 2)
$data['shejiok'] += 1;
if ($data['desin_color_verify'] == 0 || $data['desin_color_verify'] == 2)
$data['shejiok'] += 1;
if ($data['desin_style_verify'] == 0 || $data['desin_style_verify'] == 2)
$data['shejiok'] += 1;
if ($data['desin_leader_verify'] == 0 || $data['desin_leader_verify'] == 2)
$data['shejiok'] += 1;
// 生管統計已確認
if ($data['shengguanok_status'] == 0 || $data['shengguanok_status'] == 2)
$data['shengguanok'] += 1;
if ($data['prattford_order_date_verify'] == 0 || $data['prattford_order_date_verify'] == 2)
$data['shengguanok'] += 1;
if ($data['estimated_shipping_date_verify'] == 0 || $data['estimated_shipping_date_verify'] == 2)
$data['shengguanok'] += 1;
if ($data['estimated_shipping_schedule_date_verify'] == 0 || $data['estimated_shipping_schedule_date_verify'] == 2)
$data['shengguanok'] += 1;
if ($data['goods_type'] == 'A' || $data['goods_type'] == 'C')
$data['shengguanok'] += 1;
if ($data['taiwan_goods_type'] == 'A' || $data['taiwan_goods_type'] == 'C')
$data['shengguanok'] += 1;
if ($data['arrival_date_verify'] == 'A')
$data['shengguanok'] += 1;
?>
<tr>
<?php echo $update_delete_status ? "<td><button type='button' class='btn btn-danger' onclick='delete_wipwholestatus(" . $data['id'] . ")'>刪除</button></td>" : ""; ?>
<td><?php echo $data['id']; ?></td>
<td>
<?php
if (in_array($department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 513, 220, 911])) {
$sql = "
SELECT
mid,
pr_item_id,
version
FROM specsurvey_main
WHERE contractno = '" . $data['contractno'] . "'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result);
if (empty($row['mid'])) {
echo $data['contractno'];
} else {
echo "<a target='_blank' href='/wms/mkt/specsurvey-view.php?pa=" . $row['mid'] . "," . $row['pr_item_id'] . "," . $row['version'] . "&$token_link'>" . $data['contractno'] . "</a>";
}
} else {
echo $data['contractno'];
}
?>
</td>
<td><?php echo $data['facilityno']; ?></td>
<td><?php echo $data['custom']; ?></td>
<td><?php echo $Specification; ?></td>
<td><?php echo empty($data['real_address']) ? $data['address'] : $data['real_address']; ?></td>
<?php
foreach ($site_survey_status as $key => $val) {
if ((string)$data['site_survey_contact_verify'] == (string)$key) {
if (in_array($data['site_survey_contact_verify'], ['1', 'A'])) {
echo "<td style='color:#F00;'>$val</td>";
} else {
echo "<td>$val</td>";
}
}
}
?>
<td>
<?php
if (!empty($data['contract_arrival_date']))
echo date("Y/m/d", strtotime($data['contract_arrival_date']));
?>
</td>
<td>
<?php
if (!empty($data['prattford_order_date']))
echo date("Y/m/d", strtotime($data['prattford_order_date']));
?>
</td>
<td>
<?php
if (!empty($data['estimated_shipping_schedule_date']))
echo date("Y/m/d", strtotime($data['estimated_shipping_schedule_date']));
?>
</td>
<td>
<?php
if (!empty($data['actual_tofactory_date']))
echo date("Y/m/d", strtotime($data['actual_tofactory_date']));
?>
</td>
<?php
if (!empty($data['real_contract_arrival_date'])) {
if ($futureDate >= date("Y/m/d", strtotime($data['real_contract_arrival_date']))) {
if ($data['yingyeok'] != '5' && $data['shejiok'] != '5' && $data['gongwuok'] != '2' && $data['shengguanok'] != '1') {
echo "<td style='color:#f00;'>" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
} else {
echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
}
} else {
echo "<td >" . date("Y/m/d", strtotime($data['real_contract_arrival_date'])) . "</td>";
}
} else {
echo "<td></td>";
}
?>
<td>
<?php
if (!empty($data['real_arrival_date']))
echo date("Y/m/d", strtotime($data['real_arrival_date']));
?>
</td>
<td>
<?php
$str = $data['yingyeok'] . "/5";
if ($edit_flag & 1 && ($user_auth & 2)) {
?>
<p>
<?php echo $str; ?>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<?php echo accountidToName($data['salesid']); ?>
</a>
</p>
<?php
} else echo $str . " " . accountidToName($data['salesid']);
?>
</td>
<td>
<?php
$str = $data['shejiok'] . "/5";
if ($edit_flag & 2 && ($user_auth & 2)) {
?>
<p>
<?php echo $str; ?>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
郭承瑋
</a>
</p>
<?php
} else echo $str . " 郭承瑋";
?>
</td>
<td>
<?php
$str = $data['gongwuok'] . "/2";
if ($edit_flag & 4 && ($user_auth & 2)) {
?>
<p>
<?php
echo $str;
?>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<?php
echo accountidToName($data['warehouseid']);
// echo getGunwuName($data['address']);
?>
</a>
</p>
<?php
} else {
echo $str;
// echo getGunwuName($data['address']);
echo accountidToName($data['warehouseid']);
}
?>
</td>
<td>
<?php
$str = $data['shengguanok'] . "/7";
if ($edit_flag & 8 && ($user_auth & 2)) {
?>
<p>
<?php echo $str; ?>
<a target='_blank' href="wipwhole-rec-invoice-edit.php?function_name=wipwholestatus&<?php echo $token_link; ?>&id=<?php echo $data['id']; ?>" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</p>
<?php
} else echo $str . " ";
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>