Browse Source

header

main
Cheng 2 years ago
parent
commit
75a7bf5a5d
  1. 22
      wms/IncludeCommon.php
  2. 99
      wms/T8_APItest_from_bpm.php
  3. 43
      wms/T8_Authorization_from_bpm.php
  4. 27
      wms/account-index.php
  5. 124
      wms/account-receivable-check.php
  6. 51
      wms/account-receivable-excel.php
  7. 388
      wms/account-receivable-index.php
  8. 5
      wms/account-receivable-received-create.php
  9. 21
      wms/account-receivable-received-edit.php
  10. 58
      wms/account-receivable-received-submit.php
  11. BIN
      wms/account-receivable.xlsx
  12. 1
      wms/account_auth-index.php
  13. 57
      wms/board-create.php
  14. 97
      wms/board-index.php
  15. 3
      wms/board-record-submit.php
  16. 59
      wms/fun_global.php
  17. 170
      wms/gary.php
  18. 2
      wms/loginapi.php
  19. 255
      wms/menu-edit.php
  20. 149
      wms/menu-record-update.php
  21. 20
      wms/rib01-create.php
  22. 4
      wms/wipwhole-change-contractdate-function.php
  23. 35
      wms/wipwhole-change-contractdate.php
  24. 22
      wms/wipwhole-change-planning-customer-name.php
  25. 60
      wms/wipwhole-index-function.php
  26. 15
      wms/wipwhole-index-table-html.php
  27. 186
      wms/wipwhole-index.php
  28. 2
      wms/wipwhole-rec-invoice-edit-fileupload.php
  29. 289
      wms/wipwhole-rec-invoice-edit-submit.php
  30. 322
      wms/wipwhole-rec-invoice-edit.php
  31. 1
      wms/wipwhole-rec-invoice.php
  32. 49
      wms/wipwhole-renovate-index-function.php
  33. 15
      wms/wipwhole-renovate-index-table-html.php
  34. 176
      wms/wipwhole-renovate-index.php
  35. 1
      wms/wipwhole-renovate-rec-invoice.php
  36. 16
      wms/wipwholeinstall-index-table-html.php
  37. 17
      wms/wipwholeinstall-renovate-index-table-html.php

22
wms/IncludeCommon.php

@ -1,8 +1,7 @@
<?php <?php
class IncludeCommon class IncludeCommon
{ {
function CheckToken($token) function CheckToken($token) {
{
date_default_timezone_set("Asia/Taipei"); date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***"; $encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s"); $time = date("Y-m-d H:i:s");
@ -42,8 +41,7 @@ class IncludeCommon
} }
} }
//生成登录记录 //生成登录记录
function save_log_response($account, $response_result, $source_flag = 'web') function save_log_response($source_flag='web', $account, $response_result){
{
# 储存纪录并输出 # 储存纪录并输出
#echo date("Y-m-d"); #echo date("Y-m-d");
$file_path = "account_log/" . $account . "-" . date("Y-m-d") . ".ini"; $file_path = "account_log/" . $account . "-" . date("Y-m-d") . ".ini";
@ -73,8 +71,7 @@ class IncludeCommon
} }
//生成token //生成token
function CreateToken($user_id, $user_name) function CreateToken($user_id, $user_name) {
{
date_default_timezone_set("Asia/Taipei"); date_default_timezone_set("Asia/Taipei");
$start_time = date("Y-m-d H:i:s"); $start_time = date("Y-m-d H:i:s");
$end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时 $end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时
@ -90,8 +87,7 @@ class IncludeCommon
/** /**
* 將模擬帳號寫入token * 將模擬帳號寫入token
*/ */
function FakeToken($fake_user_id, $token) function FakeToken($fake_user_id, $token) {
{
date_default_timezone_set("Asia/Taipei"); date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***"; $encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s"); $time = date("Y-m-d H:i:s");
@ -101,8 +97,7 @@ class IncludeCommon
return $token = $info . '.' . $signature; return $token = $info . '.' . $signature;
} }
function menu($type, $from = 'tw') function menu ($from='tw',$type){
{
$function_type = array( $function_type = array(
"tw" => array( "tw" => array(
# F角色菜单 # F角色菜单
@ -120,13 +115,13 @@ class IncludeCommon
return $function_type[$from][$type]; return $function_type[$from][$type];
} }
/** /**
* 依帳號類別檢視功能目錄 * 依帳號類別檢視功能目錄
*/ */
function menu_v2($atype = "") function menu_v2($atype="") {
{
global $link; global $link;
if (!$atype) return; if (!$atype) return;
@ -145,8 +140,7 @@ class IncludeCommon
* 管理者可看到全部選單 * 管理者可看到全部選單
* 其餘人員依account_auth決定可檢視的選單 * 其餘人員依account_auth決定可檢視的選單
*/ */
function menu_v3($accounttype, $aid = "") function menu_v3($aid="", $accounttype) {
{
global $link; global $link;
if (!$aid) return; if (!$aid) return;

99
wms/T8_APItest_from_bpm.php

@ -0,0 +1,99 @@
<?php
ini_set('display_errors', 'on');
date_default_timezone_set('Asia/Taipei');
$referrer = isset($_REQUEST['referer']) ? $_REQUEST['referer'] : "";
$hashReferer = "https://bpm.masada.com.twMasada@2023";
if ($hashReferer == $referrer) {
include "T8_Authorization_from_bpm.php";
$user_id = "M0000";
$user_password = "M012290493119";
$validation = get_Auth("M0000", "M012290493119");
send_data_to_API($validation);
} else {
echo "非法訪問!";
exit;
}
function send_data_to_API($validation)
{
// $apiurl = 'http://60.244.87.101:880//twWebAPI/V1/STKASSY/PostERPData';
$apiurl = 'http://10.10.145.2:880//twWebAPI/V1/STKASSY/PostERPData';
// $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKASSY/PostERPData';
$headerParam = [
'CHI_Authorization: ' . $validation,
'Content-Type: application/json'
];
$body = [
[
"name" => "stkAssyMast",
"rows" => [
[
"BillNo" => "TEST06",
"OrgId" => "1000",
"TypeId" => "CA",
"MaterialId" => "3MH00302",
"PersonId" => "M0122",
"CompId" => "1001",
"DeptId" => "220",
"SQuantity" => 1,
"SUnitId" => "SET",
"CurrentState" => 2,
"CreatorId" => "M0122"
]
]
],
[
"name" => "stkAssySubMatInfo",
"rows" => [
[
"BillNo" => "TEST06",
"MaterialId" => "3MH00302P",
"ComponentBaseQty" => 1,
"UnitQty" => 1,
"SUnitId" => "SET",
"MarkerNo" => "3MH00302",
"CU_MaterialId" => "3MH00302"
],
[
"BillNo" => "TEST06",
"MaterialId" => "MX00000001",
"ComponentBaseQty" => 1,
"UnitQty" => 3,
"SUnitId" => "PCS",
"MarkerNo" => "3MH00302",
"CU_MaterialId" => "3MH00302"
]
]
]
];
$json = json_encode($body);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerParam);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$response = curl_exec($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
$result = json_decode($response, true);
echo $result['Status'] . "\n";
echo $result['ErrorMsg'] . "\n";
print_r($result['Data']);
}
curl_close($ch);
}

43
wms/T8_Authorization_from_bpm.php

@ -0,0 +1,43 @@
<?php
$user_id = "M0000";
$user_password = "M012290493119";
function get_Auth($user_id = "M0000", $user_password = "M012290493119")
{
$now = gmdate("YmdHis");
$data = "$user_id." . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
// $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth';
// $apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
$apiurl = 'http://10.10.145.2:880//twWebAPI/GetAuth';
// $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth';
$headerParam = [
"UserId: $user_id",
"Pwd: $user_password",
"TimestampUTC: $now",
"Sign: $sign"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerParam);
$response = curl_exec($ch);
if ($response === false) {
echo 'Curl error: ' . curl_error($ch);
} else {
// print_r($response);
// exit;
$result = json_decode($response, true);
$validation = $result['Data']['CHI_Authorization'];
return $validation;
}
curl_close($ch);
}

27
wms/account-index.php

@ -63,19 +63,21 @@ img {
table { table {
width: 100%; width: 100%;
} }
#table_index_filter { #table_index_filter {
float: right; float: right;
} }
#table_index_paginate { #table_index_paginate {
float: right; float: right;
} }
label { label {
display: inline-flex; display: inline-flex;
margin-bottom: .5rem; margin-bottom: .5rem;
margin-top: .5rem; margin-top: .5rem;
} }
</style> </style>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
@ -99,6 +101,7 @@ label {
<th>建檔時間</th> <th>建檔時間</th>
<?php if ($user_auth & 2) { ?> <?php if ($user_auth & 2) { ?>
<th>修改</th> <th>修改</th>
<th>新人資料</th>
<!--<th>刪除</th>--> <!--<th>刪除</th>-->
<?php } ?> <?php } ?>
</tr> </tr>
@ -153,12 +156,34 @@ label {
</p> </p>
</td>--> </td>-->
<?php } ?> <?php } ?>
<td>
<button type="button" class="btn" onclick="sendJuniorStaffDoc(<?php echo $data['id']; ?>)">寄送</button>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
<script>
function sendJuniorStaffDoc(id) {
$.ajax({
url: window.location.origin + '/wms/account-index-submit.php',
type: 'POST',
data: {
'method': 'sendJuniorStaffDoc',
'id': id
},
dataType: 'json',
success: function(response) {
alert("寄送成功!");
},
error: function(xhr, status, error) {
alert("寄送失敗!");
}
});
}
</script>
<?php <?php
else : else :

124
wms/account-receivable-check.php

@ -1,17 +1,36 @@
<?php <?php
include "./header.php"; include "./header.php";
//企業名稱 統一編號 聯絡地址
$Bill = $_POST['Bill']; $Bill = $_POST['Bill'];
$Bill = json_decode($Bill, true); $Bill = json_decode($Bill, true);
$sql_received = "SELECT * from account_received where BillNo = '$Bill[0]' ORDER BY `pay_id` ASC"; print_r($Bill);
$pay_received = mysqli_query($link, $sql_received);
$had_received = 0; // $sql_received = "SELECT * from account_received where BillNo = '$Bill[0]' ORDER BY `pay_id` ASC";
if (mysqli_num_rows($pay_received) == 0) { // $pay_received = mysqli_query($link, $sql_received);
foreach ($pay_received as $received) { // $had_received_amount = intval(0);
$had_received += $received['received_amount']; // $had_invoice_amount=intval(0);
} // $status_summary = intval(0);
} // if (mysqli_num_rows($pay_received) > 0) {
$unreceived = $Bill[12] - $had_received; // foreach ($pay_received as $received) {
// $had_received_amount += intval($received['received_amount']);
// $had_invoice_amount += intval($received['invoice_amount']);
// if(in_array(intval($received['status']),array(0,4,5,99))){
// $tem_status = intval(0);
// }else{
// $tem_status = intval($received['status']);
// }
// if($status_summary < $tem_status){
// $status_summary = $tem_status;
// }
// }
// }
// $unreceived_amount = intval($Bill[12]) - intval($had_received_amount);
// $uninvoice_amount = intval($Bill[12]) - intval($had_invoice_amount);
// $Bill[19] =$had_invoice_amount;
// $Bill[20] =$had_received_amount;
// $Bill[21] =$uninvoice_amount;
// $Bill[22] =$unreceived_amount;
// $Bill[23] =$status_summary;
$data = json_encode($Bill); $data = json_encode($Bill);
?> ?>
<style> <style>
@ -40,7 +59,7 @@ $data = json_encode($Bill);
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
<label for="BillNo">合約號</label> <label for="BillNo">合約號</label>
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $Bill[0] ?>" disabled> <input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $Bill[10] ?>" disabled>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="DeptId">部門</label> <label for="DeptId">部門</label>
@ -52,27 +71,27 @@ $data = json_encode($Bill);
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="PersonName">營業員</label> <label for="PersonName">營業員</label>
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $Bill[3] ?>" disabled> <input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $Bill[4] ?>" disabled>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
<label for="EnterpriseName">抬頭</label> <label for="EnterpriseName">抬頭</label>
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $Bill[14] ?>" disabled> <input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $Bill[6] ?>" disabled>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="TaxNo">統一編號</label> <label for="TaxNo">統一編號</label>
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[15] ?>" disabled> <input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[7] ?>" disabled>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label for="ContactAddress">聯絡地址</label> <label for="ContactAddress">聯絡地址</label>
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[16] ?>" disabled> <input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[8] ?>" disabled>
</div> </div>
</div> </div>
<div> <div>
<label for="detail">狀態</label> <label for="detail">狀態</label>
<textarea class="form-control" style="height: 150px; width: 50%;" name="detail" id="detail" disabled><?= str_replace("<br>", "\n", $Bill[13]) ?></textarea> <textarea class="form-control" style="height: 150px; width: 50%;" name="detail" id="detail" disabled><?= str_replace("<br>", "\n", $Bill['facilities']) ?></textarea>
</div> </div>
</form> </form>
<div style="width: auto; margin-top: 30px;"> <div style="width: auto; margin-top: 30px;">
@ -80,20 +99,20 @@ $data = json_encode($Bill);
<thead> <thead>
<tr> <tr>
<th>目前應收</th> <th>目前應收</th>
<th>已開發票金額</th> <!-- <th>已開發票金額</th>
<th>未開發票金額</th> <th>未開發票金額</th>
<th>已收金額</th> <th>已收金額</th>
<th>未收金額</th> <th>未收金額</th> -->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><?= number_format(round($Bill[12])) ?></td> <td><?= number_format(round($Bill['receivable_budget'])) ?></td>
<td><?= number_format(round($Bill[19])) ?></td> <!-- <td><?= number_format(round($Bill[19])) ?></td>
<td><?= number_format(round($Bill[21])) ?></td> <td><?= number_format(round($Bill[21])) ?></td>
<td><?= number_format(round($Bill[20])) ?></td> <td><?= number_format(round($Bill[20])) ?></td>
<td><?= number_format(round($Bill[22])) ?></td> <td><?= number_format(round($Bill[22])) ?></td> -->
</tr> </tr>
</tbody> </tbody>
@ -112,18 +131,20 @@ $data = json_encode($Bill);
<th>試車款</th> <th>試車款</th>
<th>官檢款</th> <th>官檢款</th>
<th>交車款</th> <th>交車款</th>
<th>尾款</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td><?= number_format(round($Bill[5])) ?></td> <td><?= number_format(round($Bill['sign'][1])) ?></td>
<td><?= number_format(round($Bill[6])) ?></td> <td><?= number_format(round($Bill['second'][1])) ?></td>
<td><?= number_format(round($Bill[7])) ?></td> <td><?= number_format(round($Bill['arrive'][1])) ?></td>
<td><?= number_format(round($Bill[8])) ?></td> <td><?= number_format(round($Bill['install'][1])) ?></td>
<td><?= number_format(round($Bill[9])) ?></td> <td><?= number_format(round($Bill['tryrun'][1])) ?></td>
<td><?= number_format(round($Bill[10])) ?></td> <td><?= number_format(round($Bill['check'][1])) ?></td>
<td><?= number_format(round($Bill[11])) ?></td> <td><?= number_format(round($Bill['delivery'][1])) ?></td>
<td><?= number_format(round($Bill['final'][1])) ?></td>
</tr> </tr>
</tbody> </tbody>
@ -135,7 +156,7 @@ include "./footer.php";
?> ?>
<?php <?php
if ($user_id == "M0122") { if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) {
?> ?>
<button type="button" onclick="create('create',0)" class="btn btn-primary btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;"> <button type="button" onclick="create('create',0)" class="btn btn-primary btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;">
新增收款紀錄<span class=" glyphicon glyphicon-plus"></span></button> 新增收款紀錄<span class=" glyphicon glyphicon-plus"></span></button>
@ -148,10 +169,15 @@ if ($user_id == "M0122") {
<tr> <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>
<?php if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) { ?>
<th style="width: 10%;">功能</th> <th style="width: 10%;">功能</th>
<?php } ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -160,17 +186,47 @@ if ($user_id == "M0122") {
<tr> <tr>
<td><?= $received['invoice_date'] ?></td> <td><?= $received['invoice_date'] ?></td>
<td><?= number_format($received['invoice_amount']) ?></td> <td><?= number_format($received['invoice_amount']) ?></td>
<td><?= $received['invoice_no'] ?></td>
<td><?= $received['received_date'] ?></td> <td><?= $received['received_date'] ?></td>
<td><?= number_format($received['received_amount']) ?></td> <td><?= number_format($received['received_amount']) ?></td>
<td><?= $received['remark'] ?></td> <td><?= $received['remark'] ?></td>
<td><?php if (in_array(accountidToDepartId($user_id), array('220', '210'))) { ?> <td style="text-align: center;">
<?php
switch ($received['status']) {
case 0:
echo "<span style='color:blue;'>進行中</span>";
break;
case 1:
echo "<span style='color:brown;'>催收</span>";
break;
case 2:
echo "<span style='color:red;'>法務件 (發函)</span>";
break;
case 3:
echo "<span style='color:red;'>法務件 (訴訟)</span>";
break;
case 4:
echo "折讓";
break;
case 5:
echo "壞帳";
break;
case 99:
echo "完成";
break;
}
?></td>
<?php if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) { ?>
<td>
<button type="button" onclick="create('edit',<?= $received['pay_id'] ?>)" class="btn btn-warning btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;"> <button type="button" onclick="create('edit',<?= $received['pay_id'] ?>)" class="btn btn-warning btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;">
<span class="glyphicon glyphicon-pencil"></span></button> <span class="glyphicon glyphicon-pencil"></span></button>
<a href="account-receivable-received-delete.php?id=<?php echo $received['pay_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm"> <!-- <a href="account-receivable-received-delete.php?id=<?php echo $received['pay_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm">
<span class=" glyphicon glyphicon-trash"></span> <span class=" glyphicon glyphicon-trash"></span>
</a> </a> -->
<?php } ?>
</td> </td>
<?php } ?>
</tr> </tr>
<?php } <?php }
} ?> } ?>

51
wms/account-receivable-excel.php

@ -0,0 +1,51 @@
<?php
include "./header.php";
require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
$Bill = $_POST['Bill'];
$array_data = array();
$Bill = json_decode($Bill, true);
foreach($Bill as $key=>$value){
// for ($i = 0; $i < 17; $i++) {
// $value[$i] = (isset($value[$i])) ? $value[$i] : 0;
// }
$array_data[$key][0] = $key;
$array_data[$key][1] = $value[1];
$array_data[$key][2] = $value[2];
$array_data[$key][3] = $value[4];
$array_data[$key][4] = $value[5];
$array_data[$key][5] = $value[7];
$array_data[$key][6] = $value[8];
$array_data[$key][7] = $value[6];
$array_data[$key][8] = $value['sign'][1];
$array_data[$key][9] = $value['second'][1];
$array_data[$key][10] = $value['arrive'][1];
$array_data[$key][11] = $value['install'][1];
$array_data[$key][12] = $value['tryrun'][1];
$array_data[$key][13] = $value['check'][1];
$array_data[$key][14] = $value['delivery'][1];
$array_data[$key][15] = $value['final'][1];
$array_data[$key][16] = $value['receivable_budget'];
$array_data[$key][17] = str_replace('<br>','; ',$value['facilities']);
}
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$colomnHeader = ['合約號','部門','經理','營業員','客戶名稱','統一編號','聯絡地址','抬頭','簽約款',
'二次款','貨抵工地款','安裝款','試車款','官檢款','交車款','尾款','目前應收','作番狀態'];
$sheet->fromArray($colomnHeader,NULL,'A1');
$rowIndex = 2;
foreach($array_data as $key => $value){
$sheet->fromArray([$value], NULL, 'A' . $rowIndex);
$sheet->getStyle('R' . $rowIndex)->getAlignment()->setWrapText(true);
$rowIndex++;
}
$writer = new Xlsx($spreadsheet);
$excelFileName = 'account-receivable.xlsx';
$writer->save($excelFileName);
?>
<script>
window.location.href = "account-receivable-index.php?<?= $token_link ?>";
</script>

388
wms/account-receivable-index.php

@ -1,60 +1,62 @@
<?php <?php
include "header.php"; include "header.php";
require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls;
//use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
$follower = find_follow($user_id); $follower = find_follow($user_id);
$arrayData = []; $arrayData = [];
$receivable_array = []; $receivable_array = [];
$received_array = []; $sql_received = "SELECT * FROM arWriteOffBillDetail WHERE (DATALENGTH(OrderBillNo) >0)";
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車
//arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交
$sql_received = "SELECT * from account_received";
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName, s.PersonId, $sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId,
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) ";
if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) {
$sql_contract .= "AND (s.PersonId = '$user_id'"; $sql_contract .= "AND (s.PersonId = '$user_id'";
$sql_received .= " WHERE person_id = '$user_id'"; $sql_received .= " AND (PersonId = '$user_id'";
if (count($follower) > 0) { if (count($follower) > 0) {
$column_str = "('$user_id'" . ",'"; $column_str = "('$user_id'" . ",'";
$column_str .= implode("','", $follower); $column_str .= implode("','", $follower);
$column_str .= "')"; $column_str .= "')";
$sql_contract .= " OR s.PersonId IN $column_str)"; $sql_contract .= " OR s.PersonId IN $column_str)";
$sql_received .= " OR person_id IN $column_str)"; $sql_received .= " OR PersonId IN $column_str)";
} else { } else {
$sql_contract .= ")"; $sql_contract .= ")";
$sql_received .= ")";
}; };
} }
$sign60 = array('簽訂後60天', '簽約60日', '簽約後60天', '簽訂後60日內', '訂金支付後60天');
$sign90 = array('簽約後90天', '簽約後90日', '簽訂後90天');
$sign120 = array('簽約後120天', '簽約後120日', '簽訂後120天');
$contract = $conn->query($sql_contract); $contract = $conn->query($sql_contract);
$received_data = mysqli_query($link, $sql_received); $received_array = $conn->query($sql_received);
foreach ($received_data as $received) {
if ($received['BillNo'] == 'SO20230801001') { // 取收款資料 account_received
$BillNo = 'M230947'; // $received_data = mysqli_query($link, $sql_received);
} elseif ($received['BillNo'] == 'SO20230801002') { // foreach ($received_data as $received) {
$BillNo = 'M231067'; // if ($received['BillNo'] == 'SO20230801001') {
} else { // $BillNo = 'M230947';
$BillNo = $received['BillNo']; // } elseif ($received['BillNo'] == 'SO20230801002') {
}; // $BillNo = 'M231067';
if (isset($received_array[$BillNo])) { // } else {
$received_array[$BillNo][0] += $received['invoice_amount']; // $BillNo = $received['BillNo'];
$received_array[$BillNo][1] += $received['received_amount']; // };
} else { // if (isset($received_array[$BillNo])) {
$received_array[$BillNo][0] = $received['invoice_amount']; // $received_array[$BillNo][0] += $received['invoice_amount'];
$received_array[$BillNo][1] = $received['received_amount']; // $received_array[$BillNo][1] += $received['received_amount'];
} // $received['status'] = (intval($received['status']) < 4) ? intval($received['status']) : 0;
} // if ($received_array[$BillNo][2] < intval($received['status'])) {
// $received_array[$BillNo][2] = intval($received['status']);
// }
// } else {
// $received_array[$BillNo][0] = $received['invoice_amount'];
// $received_array[$BillNo][1] = $received['received_amount'];
// $received_array[$BillNo][2] = (intval($received['status']) < 4) ? intval($received['status']) : 0;
// }
// }
// 將T8合約收款階段資料依據款別分類放進arraData裡
foreach ($contract as $cont) { foreach ($contract as $cont) {
// print_r($cont);
// echo "<br>";
if ($cont['BillNo'] == 'SO20230801001') { if ($cont['BillNo'] == 'SO20230801001') {
$BillNo = 'M230947'; $BillNo = 'M230947';
} elseif ($cont['BillNo'] == 'SO20230801002') { } elseif ($cont['BillNo'] == 'SO20230801002') {
@ -63,57 +65,83 @@ foreach ($contract as $cont) {
$BillNo = $cont['BillNo']; $BillNo = $cont['BillNo'];
}; };
$PayStage = $cont['PayStage']; $PayStage = $cont['PayStage'];
$PlanPayDate = $cont['PlanPayDate'];
$PayAmount = $cont['PlanPayAmt']; $PayAmount = $cont['PlanPayAmt'];
$partnerName = $cont['BizPartnerName']; $partnerName = $cont['BizPartnerName'];
$EnterpriseName = $cont['EnterpriseName']; $EnterpriseName = $cont['EnterpriseName'];
$TaxNo = $cont['TaxNo']; $TaxNo = $cont['TaxNo'];
$ContactAddress = $cont['ContactAddress']; $ContactAddress = $cont['ContactAddress'];
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 //['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期
if (isset($arrayData[$BillNo])) { //['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { if (!(isset($arrayData[$BillNo]))) {
$arrayData[$BillNo][5] = $PayAmount; // 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
$arrayData[$BillNo][4] = $PayAmount; $arrayData[$BillNo][5] = $partnerName;
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { $arrayData[$BillNo][6] = $EnterpriseName;
$arrayData[$BillNo][6] = $PayAmount; $arrayData[$BillNo][7] = $TaxNo;
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { $arrayData[$BillNo][8] = $ContactAddress;
$arrayData[$BillNo][8] = $PayAmount; $arrayData[$BillNo]['received']= array();
} elseif (stristr($PayStage, '安裝')) { $arrayData[$BillNo]['sign'][1] = $arrayData[$BillNo]['second'][1] = $arrayData[$BillNo]['arrive'][1] = $arrayData[$BillNo]['install'][1] = $arrayData[$BillNo]['tryrun'][1] = $arrayData[$BillNo]['check'][1] = $arrayData[$BillNo]['delivery'][1] = $arrayData[$BillNo]['final'][1] = 0;
$arrayData[$BillNo][7] = $PayAmount; $arrayData[$BillNo]['facilities'] = "";
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { $arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['receivable_budget'] = 0;
$arrayData[$BillNo][10] = $PayAmount;
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) {
$arrayData[$BillNo][9] = $PayAmount;
} else {
$arrayData[$BillNo][12] = $PayAmount;
} }
} else {
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
$arrayData[$BillNo][3] = $partnerName;
$arrayData[$BillNo][13] = $EnterpriseName;
$arrayData[$BillNo][14] = $TaxNo;
$arrayData[$BillNo][15] = $ContactAddress;
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) {
$arrayData[$BillNo][5] = $PayAmount; $arrayData[$BillNo]['second'][0] = $PayStage;
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { $arrayData[$BillNo]['second'][1] = $PayAmount;
$arrayData[$BillNo][4] = $PayAmount; $arrayData[$BillNo]['second'][2] = $PlanPayDate;
if (isset($arrayData[$BillNo]['sign'][2]) && !is_null($arrayData[$BillNo]['sign'][2])) {
$signtime = strtotime(strval($arrayData[$BillNo]['sign'][2]));
if (in_array($PayStage, $sign60)) {
$secondtime = $signtime + (60 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$BillNo]['second'][2] = intval($secondtime);
} elseif (in_array($PayStage, $sign90)) {
$secondtime = $signtime + (90 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$BillNo]['second'][2] = intval($secondtime);
} elseif (in_array($PayStage, $sign120)) {
$secondtime = $signtime + (120 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$BillNo]['second'][2] = intval($secondtime);
} elseif (stristr($PayStage, '簽訂後30天')) {
$secondtime = $signtime + (30 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$BillNo]['second'][2] = intval($secondtime);
}
}
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工')) {
$arrayData[$BillNo]['sign'][0] = $PayStage;
$arrayData[$BillNo]['sign'][1] = $PayAmount;
$arrayData[$BillNo]['sign'][2] = $PlanPayDate;
} elseif (stristr($PayStage, '試車')) {
$arrayData[$BillNo]['tryrun'][0] = $PayStage;
$arrayData[$BillNo]['tryrun'][1] = $PayAmount;
$arrayData[$BillNo]['tryrun'][2] = $PlanPayDate;
} elseif (stristr($PayStage, '安裝') || stristr($PayStage, '貨抵工地且完工')) {
$arrayData[$BillNo]['install'][0] = $PayStage;
$arrayData[$BillNo]['install'][1] = $PayAmount;
$arrayData[$BillNo]['install'][2] = $PlanPayDate;
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) {
$arrayData[$BillNo][6] = $PayAmount; $arrayData[$BillNo]['arrive'][0] = $PayStage;
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { $arrayData[$BillNo]['arrive'][1] = $PayAmount;
$arrayData[$BillNo][8] = $PayAmount; $arrayData[$BillNo]['arrive'][2] = $PlanPayDate;
} elseif (stristr($PayStage, '安裝')) {
$arrayData[$BillNo][7] = $PayAmount;
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) {
$arrayData[$BillNo][10] = $PayAmount; $arrayData[$BillNo]['delivery'][0] = $PayStage;
$arrayData[$BillNo]['delivery'][1] = $PayAmount;
$arrayData[$BillNo]['delivery'][2] = $PlanPayDate;
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) {
$arrayData[$BillNo][9] = $PayAmount; $arrayData[$BillNo]['check'][0] = $PayStage;
$arrayData[$BillNo]['check'][1] = $PayAmount;
$arrayData[$BillNo]['check'][2] = $PlanPayDate;
} elseif (stristr($PayStage, '驗收完成')) {
$arrayData[$BillNo]['final'][0] = $PayStage;
$arrayData[$BillNo]['final'][1] = $PayAmount;
$arrayData[$BillNo]['final'][2] = $PlanPayDate;
} else { } else {
$arrayData[$BillNo][12] = $PayAmount; $arrayData[$BillNo]['other'][1] = $PayAmount;
} $arrayData[$BillNo]['other'][2] = $PlanPayDate;
} }
} }
foreach ($arrayData as $key => $value) {
$sql = "SELECT $sql = "SELECT
tmp2.*, tmp2.*,
d.name AS depart_name d.name AS depart_name
@ -138,8 +166,7 @@ left join account AS a
ON w.salesid = a.accountid ON w.salesid = a.accountid
left join account AS a2 left join account AS a2
ON a2.accountid = a.manager ON a2.accountid = a.manager
where w.status = '1' AND w.contractno='" . $key . "'" . " where w.status = '1' AND w.contract_type='A'
)AS tmp2 )AS tmp2
left join ( left join (
SELECT DISTINCT SELECT DISTINCT
@ -149,89 +176,106 @@ FROM department
) AS d ) AS d
ON d.department_id = tmp2.department_id"; ON d.department_id = tmp2.department_id";
$facitities = "";
$total_facility_num = 0;
$arrive_num = 0;
$tryrun_num = 0;
$delivery_num = 0;
$official_num = 0;
$wipwhole_array = mysqli_query($link, $sql); $wipwhole_array = mysqli_query($link, $sql);
foreach ($wipwhole_array as $wip) { foreach ($wipwhole_array as $wip) {
$value[0] = $wip['depart_name']; if (isset($arrayData[$wip['contractno']])) {
$value[1] = $wip['manager_name']; $arrayData[$wip['contractno']][0] = $wip['department_id'];;
$value[2] = $wip['name']; $arrayData[$wip['contractno']][1] = $wip['depart_name'];
$value[16] = isset($wip['department_id']) ? $wip['department_id'] : ''; $arrayData[$wip['contractno']][2] = $wip['manager_name'];
$value[17] = isset($wip['salesid']) ? $wip['salesid'] : ''; $arrayData[$wip['contractno']][3] = $wip['salesid'];
$arrayData[$wip['contractno']][4] = $wip['name'];
$arrayData[$wip['contractno']][10] = $wip['contractno'];
if (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前30天')) {
$estimate_delivery_time = strtotime($wip['estimated_shipping_date']);
$secondtime = $estimate_delivery_time - (30 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['second'][2] = intval($secondtime);
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前90天')) {
$estimate_delivery_time = strtotime($wip['estimated_shipping_date']);
$secondtime = $estimate_delivery_time - (90 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['second'][2] = intval($secondtime);
}
if ($wip['delivery_date'] != NULL) { if ($wip['delivery_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrive_num += 1; $arrayData[$wip['contractno']]['delivery_num'] += 1;
$tryrun_num += 1; $arrayData[$wip['contractno']]['check_num'] += 1;
$official_num += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$delivery_num += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} elseif ($wip['official_check_date'] != NULL) { } elseif ($wip['official_check_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrive_num += 1; $arrayData[$wip['contractno']]['check_num'] += 1;
$tryrun_num += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$official_num += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} elseif ($wip['tryrun_end_date'] != NULL) { } elseif ($wip['tryrun_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrive_num += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$tryrun_num += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} elseif ($wip['install_end_date'] != NULL) { } elseif ($wip['install_end_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrive_num += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} elseif ($wip['real_arrival_date'] != NULL) { } elseif ($wip['real_arrival_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrive_num += 1; $arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) {
if ($wip['estimated_shipping_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出貨日) <br>";
$arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} elseif ($wip['actual_tofactory_date'] != NULL) { } elseif ($wip['actual_tofactory_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
} else {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件) <br>";
$arrayData[$wip['contractno']]['total_facility_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1;
}
} elseif ($wip['estimated_shipping_date'] != NULL) { } elseif ($wip['estimated_shipping_date'] != NULL) {
$facitities .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
} else { } else {
$facitities .= $wip['facilityno'] . " (預計到港日待確認) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計到港日待確認) <br>";
$total_facility_num += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
} }
} }
$receivable_budget = 0;
//這是錢 4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車
//這是數量 arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交
if ($total_facility_num > 0) {
$receivable_budget = $value[4] + ($value[5] + $value[6]) * ($arrive_num / $total_facility_num) +
($value[7] + $value[8]) * ($tryrun_num / $total_facility_num) + ($value[9]) * ($official_num / $total_facility_num)
+ ($value[10]) * ($delivery_num / $total_facility_num);
$uninvoice_budget = $receivable_budget;
$unreceived_budget = $receivable_budget;
$received_invoice = 0;
$received_budget = 0;
if (isset($received_array[$key][0])) {
$uninvoice_budget = $receivable_budget - $received_array[$key][0];
$received_invoice = $received_array[$key][0];
}else{
$uninvoice_budget = $receivable_budget;
} }
if (isset($received_array[$key][1])) {
$unreceived_budget = $receivable_budget - $received_array[$key][1];
$received_budget = $received_array[$key][1]; foreach ($arrayData as &$value) {
}else{ if ($value['total_facility_num'] > 0) {
$unreceived_budget = $receivable_budget; $value['receivable_budget'] = $value['sign'][1] + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) +
($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) +
($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) +
(($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num']));
} }
} }
if (isset($value[0]) && ($value[0] != 0)) { // array_push($arrayData[$wip['contractno']]['received'], ['assaaa',123124,'sdrfrqa']);
$receivable_array[$key] = [$key, $value[0], $value[1], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], $value[9],
$value[10], $receivable_budget, $facitities, $value[13], $value[14], $value[15], $value[16], $value[17], $received_invoice, $received_budget, foreach($received_array as $received){
$uninvoice_budget, $unreceived_budget];
if(isset($arrayData[$received['OrderBillNo']])){
array_push($arrayData[$received['OrderBillNo']]['received'], [$received['BillNo'],$received['WriteOffBizPartnerId'],$received['OrderBillNo'],]);
} }
} }
$data = json_encode($receivable_array);
// echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;官檢款;交車款;目前應收;總作番數;貨抵;安裝試車;官檢;移交數;狀態</br>"; $data = json_encode($arrayData);
?> ?>
<style> <style>
table { table {
@ -270,6 +314,8 @@ $data = json_encode($receivable_array);
} }
</style> </style>
<button type="button" onclick="downloadData()" class="btn btn-warning btn-lg pull-right"><span class="glyphicon glyphicon-download-alt"></span></button>
<div style="width:98%;margin:1%"> <div style="width:98%;margin:1%">
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> <table id="table_index" class="table table-striped table-bordered" style="width:100%;">
<thead> <thead>
@ -285,36 +331,38 @@ $data = json_encode($receivable_array);
<th style="width: 100px;">安裝款</th> <th style="width: 100px;">安裝款</th>
<th style="width: 100px;">試車款</th> <th style="width: 100px;">試車款</th>
<th style="width: 100px;">官檢款</th> <th style="width: 100px;">官檢款</th>
<th style="width: 100px;">交車款</th> --> <th style="width: 100px;">交車款</th>
<th style="width: 100px;">尾款</th> -->
<th style="width: 100px;">目前應收</th> <th style="width: 100px;">目前應收</th>
<th style="width: 150px;">未開發票金額</th> <!-- <th style="width: 150px;">未開發票金額</th>
<th style="width: 100px;">未收金額</th> <th style="width: 100px;">未收金額</th> -->
<th>狀態</th> <th>作番狀態</th>
<!-- <th style="width: 100px;">收款狀態</th> -->
<th style="width: 100px;">操作</th> <th style="width: 100px;">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
foreach ($receivable_array as $contract) { foreach ($arrayData as $key =>$value) {
?> ?>
<tr> <tr>
<th><?= $contract[0] ?></th> <th><?= $key ?></th>
<td><?= $contract[1] ?></td> <td><?= $value[1] ?></td>
<td><?= $contract[2] ?></td> <td><?= $value[2] ?></td>
<td><?= $contract[3] ?></td> <td><?= $value[4] ?></td>
<td><?= $contract[4] ?></td> <td><?= $value[5] ?></td>
<!-- <td><?= round($contract[5]) ?></td> <!-- <td style="text-align: end;"><?= number_format(round($value['sign'][1])) ?></td>
<td><?= round($contract[6]) ?></td> <td style="text-align: end;"><?= number_format(round($value['second'][1])) ?></td>
<td><?= round($contract[7]) ?></td> <td style="text-align: end;"><?= number_format(round($value['arrive'][1])) ?></td>
<td><?= round($contract[8]) ?></td> <td style="text-align: end;"><?= number_format(round($value['install'][1])) ?></td>
<td><?= round($contract[9]) ?></td> <td style="text-align: end;"><?= number_format(round($value['tryrun'][1])) ?></td>
<td><?= round($contract[10]) ?></td> <td style="text-align: end;"><?= number_format(round($value['check'][1])) ?></td>
<td><?= round($contract[11]) ?></td> --> <td style="text-align: end;"><?= number_format(round($value['delivery'][1])) ?></td>
<td style="text-align: end;"><?= number_format(round($contract[12])) ?></td> <td style="text-align: end;"><?= number_format(round($value['final'][1])) ?></td> -->
<td style="text-align: end;"><?= number_format(round($contract[21])) ?></td> <td style="text-align: end;"><?= number_format(round($value['receivable_budget'])) ?></td>
<td style="text-align: end;"><?= number_format(round($contract[22])) ?></td> <!-- <td style="text-align: end;"><?= number_format(round($value['total_facility_num'])) ?></td> -->
<td style="text-align: start;"><?= $contract[13] ?></td> <td style="text-align: start;"><?= $value['facilities'] ?></td>
<td><button type="button" onclick="sendData('<?= $contract[0] ?>')" class="btn btn-primary btn-sm"><span class=" glyphicon glyphicon-search"></span></button> <td><button type="button" onclick="sendData('<?= $key ?>')" class="btn btn-primary btn-sm"><span class=" glyphicon glyphicon-search"></span></button>
</td> </td>
</tr> </tr>
<?php <?php
@ -324,12 +372,23 @@ $data = json_encode($receivable_array);
</table> </table>
</div> </div>
<script> <script>
function downloadData() {
var BillData = <?= $data ?>;
var form = document.createElement("form");
form.method = 'POST';
form.action = "account-receivable-excel.php?<?= $token_link ?>";
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(BillData);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
function sendData(BillNo) { function sendData(BillNo) {
console.log(BillNo);
var BillData = <?= $data ?>; var BillData = <?= $data ?>;
var Bill = BillData[BillNo]; var Bill = BillData[BillNo];
console.log(Bill);
console.log(typeof(Bill));
var form = document.createElement("form"); var form = document.createElement("form");
form.method = 'POST'; form.method = 'POST';
form.action = "account-receivable-check.php?<?= $token_link ?>"; form.action = "account-receivable-check.php?<?= $token_link ?>";
@ -340,6 +399,5 @@ $data = json_encode($receivable_array);
form.appendChild(input); form.appendChild(input);
document.body.appendChild(form); document.body.appendChild(form);
form.submit(); form.submit();
} }
</script> </script>

5
wms/account-receivable-received-create.php

@ -81,6 +81,7 @@ $BillData = json_decode($Bill, true);
<input type="hidden" name="DeptId" value="<?= $BillData[17] ?>"> <input type="hidden" name="DeptId" value="<?= $BillData[17] ?>">
<input type="hidden" name="PersonId" value="<?= $BillData[18] ?>"> <input type="hidden" name="PersonId" value="<?= $BillData[18] ?>">
<input type="hidden" name="CustName" value="<?= $BillData[4] ?>"> <input type="hidden" name="CustName" value="<?= $BillData[4] ?>">
<input type="hidden" name="Bill" id="Bill" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
@ -115,7 +116,9 @@ $BillData = json_decode($Bill, true);
$("#DeptName").prop("disabled", false); $("#DeptName").prop("disabled", false);
$("#ManagerName").prop("disabled", false); $("#ManagerName").prop("disabled", false);
$("#PersonName").prop("disabled", false); $("#PersonName").prop("disabled", false);
var Bill = <?= $Bill ?>;
Bill = JSON.stringify(Bill);
$("#Bill").val(Bill);
$("#pay_received").submit(); $("#pay_received").submit();
} }
</script> </script>

21
wms/account-receivable-received-edit.php

@ -16,6 +16,8 @@ $pay = mysqli_fetch_assoc($pay);
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button> <button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<div class="text-center"> <div class="text-center">
<h3><strong><?= $BillData[4] ?></strong></h3> <h3><strong><?= $BillData[4] ?></strong></h3>
@ -83,9 +85,24 @@ $pay = mysqli_fetch_assoc($pay);
<input type="text" class="form-control" id="remark" name="remark" value="<?= $pay['remark'] ?>"> <input type="text" class="form-control" id="remark" name="remark" value="<?= $pay['remark'] ?>">
</div> </div>
</div> </div>
<div class="form-group">
<div class="col-md-3">
<label for="status" style="color: red;">狀態</label>
<select id="status" name="status">
<option value=0 <?php if($pay['status'] == 0) echo "selected" ?>>進行中</option>
<option value=1 <?php if($pay['status'] == 1) echo "selected" ?>>催收</option>
<option value=2 <?php if($pay['status'] == 2) echo "selected" ?>>法務件 (發函)</option>
<option value=3 <?php if($pay['status'] == 3) echo "selected" ?>>法務件 (訴訟)</option>
<option value=4 <?php if($pay['status'] == 4) echo "selected" ?>>折讓</option>
<option value=5 <?php if($pay['status'] == 5) echo "selected" ?>>壞帳</option>
<option value=99 <?php if($pay['status'] == 99) echo "selected" ?>>完成</option>
</select>
</div>
</div>
<input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>"> <input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>">
<input type="hidden" name="Bill" id="Bill" value="">
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
@ -99,6 +116,7 @@ $pay = mysqli_fetch_assoc($pay);
<script> <script>
function backToIndex() { function backToIndex() {
var Bill = <?= $Bill ?>; var Bill = <?= $Bill ?>;
@ -116,6 +134,9 @@ $pay = mysqli_fetch_assoc($pay);
function send() { function send() {
event.preventDefault(); event.preventDefault();
var Bill = <?= $Bill ?>;
Bill = JSON.stringify(Bill);
$("#Bill").val(Bill);
$("#pay_received").submit(); $("#pay_received").submit();
} }
</script> </script>

58
wms/account-receivable-received-submit.php

@ -1,16 +1,18 @@
<?php <?php
include "./header.php"; include "./header.php";
$type = $_GET['type']; $type = $_GET['type'];
$InvoiceNo = empty($_POST['InvoiceNo']) ? NULL : str_replace('-', '', trim($_POST['InvoiceNo'])); $InvoiceNo = empty($_POST['InvoiceNo']) ? '' : str_replace('-', '', trim($_POST['InvoiceNo']));
$InvoiceDate = empty($_POST['InvoiceDate']) ? NULL: $_POST['InvoiceDate']; $InvoiceDate = isset($_POST['InvoiceDate']) ? $_POST['InvoiceDate'] : '';
$Bill = $_POST['Bill'];
$invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount']; $invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount'];
$received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount']; $received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount'];
$received_date = empty($_POST['ReceivedDate']) ? NULL : $_POST['ReceivedDate']; $received_date = isset($_POST['ReceivedDate']) ? $_POST['ReceivedDate'] : '';
$remark = empty($_POST['remark']) ? '' : $_POST['remark']; $remark = isset($_POST['remark']) ? $_POST['remark'] : '';
if ($type == 'edit') { if ($type == 'edit') {
$pay_id = $_POST['pay_id']; $pay_id = $_POST['pay_id'];
$status = $_POST['status'];
$sql_query_pay = "SELECT * from account_received where pay_id = $pay_id"; $sql_query_pay = "SELECT * from account_received where pay_id = $pay_id";
$pay = mysqli_query($link, $sql_query_pay); $pay = mysqli_query($link, $sql_query_pay);
$pay = mysqli_fetch_assoc($pay); $pay = mysqli_fetch_assoc($pay);
@ -19,7 +21,8 @@ if ($type == 'edit') {
if ($InvoiceNo !== $pay['invoice_no']) { if ($InvoiceNo !== $pay['invoice_no']) {
$sql1 .= "invoice_no = '$InvoiceNo',"; $sql1 .= "invoice_no = '$InvoiceNo',";
} }
if($InvoiceDate !== $pay['invoice_date']){ if ($InvoiceDate != $pay['invoice_date']) {
$sql1 .= "invoice_date = '$InvoiceDate',"; $sql1 .= "invoice_date = '$InvoiceDate',";
} }
if ($invoice_amount != $pay['invoice_amount']) { if ($invoice_amount != $pay['invoice_amount']) {
@ -28,16 +31,17 @@ if ($type == 'edit') {
if ($received_amount != $pay['received_amount']) { if ($received_amount != $pay['received_amount']) {
$sql1 .= "received_amount = $received_amount,"; $sql1 .= "received_amount = $received_amount,";
} }
if($received_date !== $pay['received_date']){ if ($received_date != $pay['received_date']) {
$sql1 .= "received_date = '$received_date',"; $sql1 .= "received_date = '$received_date',";
} }
if($remark !== $pay['remark']){ if ($remark != $pay['remark']) {
$sql1 .= "remark = '$remark',"; $sql1 .= "remark = '$remark',";
} }
$sql1=substr($sql1,0,-1); if ($status != $pay['status']) {
$sql = $sql1 . " WHERE pay_id = $pay_id"; $sql1 .= "status = $status,";
echo $sql; }
exit(); // $sql1 = substr($sql1, 0, -1);
$sql = $sql1 . "LastOperatorId = '$user_id' WHERE pay_id = $pay_id";
} else { } else {
$BillNo = $_POST['BillNo']; $BillNo = $_POST['BillNo'];
$dept_id = $_POST['DeptId']; $dept_id = $_POST['DeptId'];
@ -49,36 +53,44 @@ if ($type == 'edit') {
$sql1 = "INSERT INTO account_received ( $sql1 = "INSERT INTO account_received (
BillNo,dept_id,dept_name,manager_name,person_id,person_name,cust_name"; BillNo,dept_id,dept_name,manager_name,person_id,person_name,cust_name";
$sql2 = ",CreatorId) VALUES ('$BillNo','$dept_id','$dept_name','$manager_name','$person_id','$person_name','$cust_name'"; $sql2 = ",CreatorId) VALUES ('$BillNo','$dept_id','$dept_name','$manager_name','$person_id','$person_name','$cust_name'";
if (!empty($InvoiceNo)) { if (isset($InvoiceNo)) {
$sql1 .= ",invoice_no"; $sql1 .= ",invoice_no";
$sql2 .= ",'$InvoiceNo'"; $sql2 .= ",'$InvoiceNo'";
} }
if (isset($InvoiceDate)) { if ((!empty($InvoiceDate))) {
$sql1 .= ",invoice_date"; $sql1 .= ",invoice_date";
$sql2 .= ",'$InvoiceDate'"; $sql2 .= ",'$InvoiceDate'";
} }
if (!empty($invoice_amount)) { if (isset($invoice_amount)) {
$sql1 .= ",invoice_amount"; $sql1 .= ",invoice_amount";
$sql2 .= ",$invoice_amount"; $sql2 .= ",$invoice_amount";
} }
if (!empty($received_amount)) { if (isset($received_amount)) {
$sql1 .= ",received_amount"; $sql1 .= ",received_amount";
$sql2 .= ",$received_amount"; $sql2 .= ",$received_amount";
} }
if (isset($received_date)) { if (!(empty($received_date))) {
$sql1 .= ",received_date"; $sql1 .= ",received_date";
$sql2 .= ",'$received_date'"; $sql2 .= ",'$received_date'";
} }
if (!empty($remark)) { if (!(empty($remark))) {
$sql1 .= ",remark"; $sql1 .= ",remark";
$sql2 .= ",'$remark'"; $sql2 .= ",'$remark'";
} }
$sql = $sql1 . $sql2 . ",'$user_id')"; $sql = $sql1 . $sql2 . ",'$user_id')";
} }
mysqli_query($link, $sql); mysqli_query($link, $sql);
if (mysqli_affected_rows($link)) { ?>
echo '<script>alert("新增/更新 成功")</script>'; <script>
echo $sql; var Bill = <?= $Bill ?>;
} else { var form = document.createElement("form");
echo '<script>alert("新增/更新 失敗")</script>'; form.method = 'POST';
} form.action = "account-receivable-check.php?<?= $token_link ?>";
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(Bill);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
</script>

BIN
wms/account-receivable.xlsx

Binary file not shown.

1
wms/account_auth-index.php

@ -20,7 +20,6 @@ $data = mysqli_query($link,$sql);
--> -->
<?php <?php
if($data): if($data):
?> ?>
<style> <style>
table { table {

57
wms/board-create.php

@ -2,8 +2,7 @@
include "header.php"; include "header.php";
?> ?>
<script> <script>
$(function(){ $(function() {});
});
</script> </script>
<div class="container"> <div class="container">
<?php <?php
@ -20,32 +19,62 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?> ?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> <form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data">
<div> <div class='container'>
<div class='row'>
<div class='col-md-6 col-12'>
<label for="title">主旨</label> <label for="title">主旨</label>
<input type="text" name="title" id="title" size="30" maxlength="25" required> <input type="text" name="title" id="title" size="30" maxlength="25" required>
</div> </div>
<!--<div> <div class='col-md-6 col-12'>
<label for="pin">置頂</label>
<select name="pin" id="pin">
<option value="Y"></option>
<option value="N" selected></option>
</select>
</div>-->
<div>
<label for="attatch1">附件上傳</label> <label for="attatch1">附件上傳</label>
<div> <div>
<input type="file" name="attatch1" id="attatch1"> <input type="file" name="attatch1" id="attatch1">
</div> </div>
</div> </div>
<div> </div>
<div class='row'>
<div class='col-md-3 col-3'>
<label>連結名稱</label>
<input type="text" id="linkName">
</div>
<div class='col-md-9 col-6'>
<label>連結網址</label>
<input type="text" id="linkURL">
</div>
<div class='col-md-2 col-2'>
<button type='button' onclick="insertLink()">插入超連結</button>
</div>
</div>
<div class='row'>
<div class='col-md-12 col-12'>
<label for="content">公告內容</label><br> <label for="content">公告內容</label><br>
<textarea class="form-control2" name="content" id="content" rows="8" cols="100" required></textarea> <textarea class="form-control2" name="content" id="content" rows="8" cols="100" required></textarea>
</div> </div>
<div>
<button type="submit" name="submit" id="submit">確定</button>
</div> </div>
<br />
<div class='row'>
<div class='col-md-12 col-12'>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<button type="submit" name="submit" id="submit">確定</button>
</div>
</div>
</form> </form>
</div> </div>
<script>
function insertLink() {
var linkName = document.getElementById('linkName').value;
var linkURL = document.getElementById('linkURL').value;
if (linkName !== '' && linkURL !== '') {
var textarea = document.getElementById('content');
var link = '<a style="color:blue" href="' + linkURL + '">' + linkName + '</a>';
// 插入超連結到 textarea 中
textarea.value += link;
} else {
alert('請輸入連結名稱和 URL');
}
}
</script>
<?php include "footer.php"; ?> <?php include "footer.php"; ?>

97
wms/board-index.php

@ -9,6 +9,7 @@ $sql = "select * from board where status = 'Y' order by id";
// 用mysqli_query方法執行(sql語法)將結果存在變數中 // 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
$data2 = $data;
?> ?>
<!-- <a href="create.php"><h2>新增</h2></a> --> <!-- <a href="create.php"><h2>新增</h2></a> -->
@ -44,12 +45,15 @@ img {
table { table {
width: 100%; width: 100%;
} }
#table_index_filter { #table_index_filter {
float: right; float: right;
} }
#table_index_paginate { #table_index_paginate {
float: right; float: right;
} }
label { label {
display: inline-flex; display: inline-flex;
margin-bottom: .5rem; margin-bottom: .5rem;
@ -57,6 +61,62 @@ label {
} }
/* The Modal (background) */
.modal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
padding-top: 100px;
/* Location of the box */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
}
.modal .back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
/* Black w/ opacity */
}
/* Modal Content */
.modal-content {
z-index: 9;
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style> </style>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> <table id="table_index" class="table table-striped table-bordered" style="width:100%">
@ -75,9 +135,11 @@ label {
<?php foreach ($data as $data) : ?> <?php foreach ($data as $data) : ?>
<tr> <tr>
<td><?php echo $data['id']; ?></td> <td><?php echo $data['id']; ?></td>
<td><?php echo $data['title']; ?></td> <!-- <td><?php echo $data['title']; ?></td> -->
<td><a onclick="openModal('<?php echo $data['id']; ?>')" href="#"><?php echo $data['title']; ?></button></a>
<td><a href="/wms/board-file.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" target="_blank"><?php echo str_replace("board-attach/", "", $data['attach']); ?></a></td> <td><a href="/wms/board-file.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" target="_blank"><?php echo str_replace("board-attach/", "", $data['attach']); ?></a></td>
<!--<td><?php if ($data['pin'] > 1) echo "是"; else echo "否"; ?></td>--> <!--<td><?php if ($data['pin'] > 1) echo "是";
else echo "否"; ?></td>-->
<td><?php echo $data['creater']; ?></td> <td><?php echo $data['creater']; ?></td>
<td><?php echo $data['create_at']; ?></td> <td><?php echo $data['create_at']; ?></td>
<td> <td>
@ -97,6 +159,37 @@ label {
<?php <?php
foreach ($data2 as $data2) :
?>
<div id="myModal<?php echo $data2['id']; ?>" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close myCloseBtn" id="">X</button>
<div class='col-12' style='text-align:center'>
<h3><?php echo $data2['title']; ?></h3>
<br/>
<?php echo nl2br($data2['content']); ?>
</div>
</div>
</div>
<?php endforeach; ?>
<script>
var modal = document.getElementById("myModal");
function openModal(id) {
$("#myModal" + id).show();
}
$(".myCloseBtn").click(function(e) {
$(".modal").hide();
});
$(".back").click(function(e) {
$(".modal").hide();
});
</script>
<?php
else : else :
echo "<h2>There is no record!</h2>"; echo "<h2>There is no record!</h2>";
endif; endif;

3
wms/board-record-submit.php

@ -3,7 +3,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
//print_r($_POST); //print_r($_POST);
//print_r($_FILES);exit; //print_r($_FILES);exit;
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v))); // $$k = htmlspecialchars(stripslashes(trim($v)));
$$k = trim($v);
} }
function get_basename($filename) { function get_basename($filename) {

59
wms/fun_global.php

@ -1,4 +1,5 @@
<?php <?php
/** /**
* 組sql語法:限制可查詢範圍 * 組sql語法:限制可查詢範圍
* 系統管理員、總經理權限全開 * 系統管理員、總經理權限全開
@ -8,7 +9,8 @@
* *
* @return string * @return string
*/ */
function sql_myself($user_id, $column="creater") { function sql_myself($user_id, $column = "creater")
{
global $link; global $link;
$follower_arr = []; // 下屬列表 $follower_arr = []; // 下屬列表
@ -36,7 +38,8 @@ function sql_myself($user_id, $column="creater") {
* @param array $ret:下屬ID * @param array $ret:下屬ID
* @return array * @return array
*/ */
function find_follow($user_id, &$ret=[]) { function find_follow($user_id, &$ret = [])
{
global $link; global $link;
$sql = "select accountid from account where manager = '$user_id'"; $sql = "select accountid from account where manager = '$user_id'";
@ -56,7 +59,8 @@ function find_follow($user_id, &$ret=[]) {
* @param array $ret:上級主管ID * @param array $ret:上級主管ID
* @return array * @return array
*/ */
function manage_class($user_id, &$ret=[]) { function manage_class($user_id, &$ret = [])
{
global $link; global $link;
$sql = "select manager from account where accountid = '$user_id'"; $sql = "select manager from account where accountid = '$user_id'";
@ -79,7 +83,8 @@ function manage_class($user_id, &$ret=[]) {
* @return array * @return array
* *
*/ */
function pricereview_class($rate, $user_id, &$ret=[]) { function pricereview_class($rate, $user_id, &$ret = [])
{
global $link; global $link;
$sql = "select manager from account where accountid = '$user_id'"; $sql = "select manager from account where accountid = '$user_id'";
@ -108,7 +113,8 @@ function pricereview_class($rate, $user_id, &$ret=[]) {
* @return array * @return array
* *
*/ */
function pricereview_renovate_class($rate, $user_id, $renovate_flag) { function pricereview_renovate_class($rate, $user_id, $renovate_flag)
{
global $link; global $link;
$sql = "select manager from account where accountid = '$user_id'"; $sql = "select manager from account where accountid = '$user_id'";
@ -142,11 +148,20 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag) {
* @param string $token * @param string $token
* @return string * @return string
*/ */
function check_user_permission($user_id, $token) { function check_user_permission($user_id, $token)
{
global $link; global $link;
// 不檢查清單 // 不檢查清單
$ignore_url_arr = ['/wms/index.php', '/wms/notice-index.php', '/wms/notice-edit.php', '/wms/change-password.php', '/wms/wipwhole-change-contractdate.php', '/wms/wipwhole-change-planning-customer-name.php','/wms/test.php', '/wms/mkt/pricereview_mi-api.php']; $ignore_url_arr = [
'/wms/index.php',
'/wms/notice-index.php',
'/wms/notice-edit.php',
'/wms/change-password.php',
'/wms/wipwhole-change-contractdate.php',
'/wms/wipwhole-change-planning-customer-name.php',
'/wms/test.php',
];
if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return; if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return;
$do = ""; $do = "";
@ -169,8 +184,11 @@ function check_user_permission($user_id, $token) {
mysqli_free_result($res); mysqli_free_result($res);
if (!$do) { if (!$do) {
// 判斷是否從藍凌過來
if (!empty($_GET['employee_no'])) {
echo "無權限操作,請洽管理員。"; echo "無權限操作,請洽管理員。";
exit; exit;
}
echo "<script>alert('無權限操作,請洽管理員。');if (history.length==1) location.href='/wms/index.php?token=" . $token . "'; else history.go(-1);</script>"; echo "<script>alert('無權限操作,請洽管理員。');if (history.length==1) location.href='/wms/index.php?token=" . $token . "'; else history.go(-1);</script>";
} else return $do; } else return $do;
} }
@ -179,7 +197,8 @@ function check_user_permission($user_id, $token) {
* 員工編號對應姓名表 * 員工編號對應姓名表
* @return array * @return array
*/ */
function accountid2name() { function accountid2name()
{
global $link; global $link;
$arr = []; $arr = [];
@ -198,7 +217,8 @@ function accountid2name() {
* @param array $uid 員工編號 * @param array $uid 員工編號
* @return array * @return array
*/ */
function accountid2email($uid) { function accountid2email($uid)
{
global $link; global $link;
if (is_array($uid)) $accountid = implode("','", $uid); if (is_array($uid)) $accountid = implode("','", $uid);
@ -224,7 +244,8 @@ function accountid2email($uid) {
* @param string|array $user_id:下位簽核者 * @param string|array $user_id:下位簽核者
* @param string $seq:順序 * @param string $seq:順序
*/ */
function do_assign($flow_id, $id, $content, $user_id, $seq=0) { function do_assign($flow_id, $id, $content, $user_id, $seq = 0)
{
global $link; global $link;
$tds = date("Y-m-d H:i:s"); $tds = date("Y-m-d H:i:s");
@ -279,7 +300,8 @@ function do_assign($flow_id, $id, $content, $user_id, $seq=0) {
* @param string $id:價審單序號 * @param string $id:價審單序號
* @param string $content:卷號 * @param string $content:卷號
*/ */
function end_flow($system_id, $flow_id, $id, $content) { function end_flow($system_id, $flow_id, $id, $content)
{
global $link; global $link;
$tds = date("Y-m-d H:i:s"); $tds = date("Y-m-d H:i:s");
@ -493,15 +515,18 @@ function accountidToRoleName($accountid)
* @param array $arr:[電梯種類,人乘/載重,停數,開門方式,速度] * @param array $arr:[電梯種類,人乘/載重,停數,開門方式,速度]
* @return string 規格名,載重 * @return string 規格名,載重
*/ */
function facility_spec($arr) { function facility_spec($arr)
{
if (empty($arr)) return; if (empty($arr)) return;
list($kind, $seat, $stop, $op, $speed) = $arr; list($kind, $seat, $stop, $op, $speed) = $arr;
if (strlen($speed) == 1) $speed = str_pad($speed, 2, "0", STR_PAD_LEFT); if (strlen($speed) == 1) $speed = str_pad($speed, 2, "0", STR_PAD_LEFT);
$seat2weight_arr = ["A3" => 320, "A8" => 320, "G10" => 320, "G20" => 320, "G5" => 320, "G6" => 320, $seat2weight_arr = [
"A3" => 320, "A8" => 320, "G10" => 320, "G20" => 320, "G5" => 320, "G6" => 320,
"280-1-A" => 280, "280-1-L" => 280, "280-2-A" => 280, "280-2-L" => 280, "280-1-A" => 280, "280-1-L" => 280, "280-2-A" => 280, "280-2-L" => 280,
"320-1-A" => 320, "320-1-L" => 320, "320-2-A" => 320, "320-2-L" => 320, "320-1-A" => 320, "320-1-L" => 320, "320-2-A" => 320, "320-2-L" => 320,
"6" => 450, "8" => 550, "9" => 600, "10" => 700, "11" => 750, "12" => 800, "6" => 450, "8" => 550, "9" => 600, "10" => 700, "11" => 750, "12" => 800,
"13" => 900, "15" => 1000, "17" => 1150, "20" => 1350, "24" => 1600]; "13" => 900, "15" => 1000, "17" => 1150, "20" => 1350, "24" => 1600
];
switch ($kind) { switch ($kind) {
case "MAQ100": case "MAQ100":
$weight = $seat2weight_arr[$seat]; $weight = $seat2weight_arr[$seat];
@ -541,7 +566,8 @@ function facility_spec($arr) {
* @param array $arr:[簽核人1,簽核人2,簽核人3,簽核人4] * @param array $arr:[簽核人1,簽核人2,簽核人3,簽核人4]
* @return array 進度,下位審批人 * @return array 進度,下位審批人
*/ */
function sign_status($arr) { function sign_status($arr)
{
$ret = []; $ret = [];
foreach ($arr as $k => $sign) { foreach ($arr as $k => $sign) {
$sign_nos = 0; $sign_nos = 0;
@ -566,7 +592,8 @@ function sign_status($arr) {
return $ret; return $ret;
} }
function getAccounttype($link,$user_id){ function getAccounttype($link, $user_id)
{
$sql = "SELECT * FROM account where accountid = '$user_id'"; $sql = "SELECT * FROM account where accountid = '$user_id'";
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
$row = mysqli_fetch_array($data, MYSQLI_ASSOC); $row = mysqli_fetch_array($data, MYSQLI_ASSOC);

170
wms/gary.php

@ -1,61 +1,123 @@
<?php <?php
// 接收 referer 參數
if (isset($_GET['referer'])) {
$referer = urldecode($_GET['referer']);
echo "HTTP_REFERER 是: $referer";
echo "<br/>";
date_default_timezone_set('Asia/Taipei');
$currentTimestamp = time();
$hashReferer = "";
for ($i = -3; $i <= 3; $i++) {
$modifiedTimestamp = strtotime("$i seconds", $currentTimestamp);
$formattedTime = date("Y-m-d H:i:s", $modifiedTimestamp);
$hashReferer .= md5("https://bpm.masada.com.twMasada@2023".$formattedTime);
}
echo $hashReferer;
if (strpos($hashReferer, $referer)) {
echo "login";
}
} else {
echo "沒有 HTTP_REFERER 資訊可用";
}
echo "<br/>";
if(isset($_SERVER['HTTP_REFERER'])) {
$referrer = $_SERVER['HTTP_REFERER'];
echo "來自於: $referrer";
} else {
echo "沒有 referrer 資訊可用";
}
echo "<br/>";
if (isset($_SERVER['REMOTE_ADDR'])) {
$visitor_ip = $_SERVER['REMOTE_ADDR'];
echo "訪問者的 IP 地址是: $visitor_ip";
} else {
echo "REMOTE_ADDR : 無法獲取訪問者的 IP 地址";
}
echo "<br/>";
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$visitor_ip = $_SERVER['HTTP_CLIENT_IP'];
echo "訪問者的 IP 地址是: $visitor_ip";
} else {
echo "HTTP_CLIENT_IP : 無法獲取訪問者的 IP 地址";
}
echo "<br/>";
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$visitor_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
echo "訪問者的 IP 地址是: $visitor_ip";
} else {
echo "HTTP_X_FORWARDED_FOR : 法獲取訪問者的 IP 地址";
}
echo "<br/>";
?>
<script>
var referrer = document.referrer;
console.log("前一個網頁是:" + referrer);
</script>
<?php
exit;
ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
echo $referrer = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "抓不到";
exit;
include "fun_global.php"; include "fun_global.php";
include "database.php"; include "database.php";
print_r(manage_class("M0117"));
echo manage_class("M0117")[0];
// account table // // account table
$accounttype = "A"; // $accounttype = "A";
$accountid = ""; // $accountid = "";
$pwd = "123"; // $pwd = "123";
$name = ""; // $name = "";
$creater = ""; // $creater = "";
$create_at = date("Y-m-d H:i:s"); // $create_at = date("Y-m-d H:i:s");
// 檢查 accountid 是否未重複並寫入 account 資料表 // // 檢查 accountid 是否未重複並寫入 account 資料表
$sql = " // $sql = "
SELECT DISTINCT // SELECT DISTINCT
a.accountid, // a.accountid,
w.contractno, // w.contractno,
w.custom // w.custom
FROM wipwholestatus AS w // FROM wipwholestatus AS w
LEFT JOIN ( // LEFT JOIN (
SELECT // SELECT
accountid // accountid
FROM account // FROM account
) AS a // ) AS a
ON a.accountid = w.contractno // ON a.accountid = w.contractno
WHERE a.accountid IS NULL // WHERE a.accountid IS NULL
"; // ";
$data = mysqli_query($link, $sql); // $data = mysqli_query($link, $sql);
$J = 0; // $J = 0;
foreach ($data as $key => $row) : // foreach ($data as $key => $row) :
echo $row['accountid']."<br>"; // echo $row['accountid']."<br>";
echo $J++; // echo $J++;
if (empty($row['accountid'])) { // if (empty($row['accountid'])) {
$accountid = $row['contractno'];
$name = $row['custom'];
echo $sql2 = "
INSERT INTO account (
accounttype,
accountid,
pwd,
name,
creater,
create_at
) VALUES (
'$accounttype',
'$accountid',
'$pwd',
'$name',
'$creater',
'$create_at'
)
";
echo "<br/>";
mysqli_query($link, $sql2);
}
endforeach;
// $accountid = $row['contractno'];
// $name = $row['custom'];
// echo $sql2 = "
// INSERT INTO account (
// accounttype,
// accountid,
// pwd,
// name,
// creater,
// create_at
// ) VALUES (
// '$accounttype',
// '$accountid',
// '$pwd',
// '$name',
// '$creater',
// '$create_at'
// )
// ";
// echo "<br/>";
// mysqli_query($link, $sql2);
// }
// endforeach;

2
wms/loginapi.php

@ -18,7 +18,7 @@ if(!empty($_REQUEST["account"])&& !empty($_REQUEST["password"])) {
$accounttype = $row['accounttype']; $accounttype = $row['accounttype'];
$user_name = $row['name']; $user_name = $row['name'];
// 修正小寫登入 token 會帶入小寫的bug //M0117修改于 2023/07/31 13:45 // 修正小寫登入 token 會帶入小寫的bug //M0117修改于 2023/07/31 13:45
$accountid = $row['accountid']; $accountid = strtoupper($row['accountid']);
if (strlen($accounttype) != 0) { if (strlen($accounttype) != 0) {
// B=保養員 M=永佳捷員工 E=管理員 // B=保養員 M=永佳捷員工 E=管理員
if ($accounttype == "B" || $accounttype == "M" || $accounttype == "E" || $accounttype == "W"){ if ($accounttype == "B" || $accounttype == "M" || $accounttype == "E" || $accounttype == "W"){

255
wms/menu-edit.php

@ -1,29 +1,45 @@
<style>
input,
select {
margin: 0 0 !important;
vertical-align: middle !important;
}
.mybutton {
padding: 3px !important;
}
</style>
<?php <?php
include "header.php"; include "header.php";
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
$data = array();
// sql语法存在变数中 // sql语法存在变数中
$db_query = "SELECT * FROM menu WHERE id = $id"; $db_query = "SELECT * FROM menu WHERE id = $id";
// 用mysqli_query方法执行(sql语法)将结果存在变数中 // 用mysqli_query方法执行(sql语法)将结果存在变数中
$data = mysqli_query($link, $db_query); $result = mysqli_query($link, $db_query);
$data = mysqli_fetch_assoc($result);
mysqli_free_result($result);
$db_query = "
SELECT * FROM department
ORDER BY department_id ASC
";
$result = mysqli_query($link, $db_query);
$data2 = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_free_result($result);
foreach($data as $data) :
//$link_content = str_replace(',', PHP_EOL, $data['link_content']); //$link_content = str_replace(',', PHP_EOL, $data['link_content']);
?> ?>
<script>
$(function () {
});
</script>
<div class="container"> <div class="container">
<form class="form-inline" method="post" action="menu-record-update.php"> <form class="form-inline" method="post" action="menu-record-update.php">
<input type="hidden" name="id" value="<?php echo $id; ?>"> <input type="hidden" name="id" value="<?php echo $id; ?>">
<div> <div class="row col-md-12 col-sm-12">
<div class="col-md-2 col-sm-12">
<label for="main_menu">主功能名稱</label> <label for="main_menu">主功能名稱</label>
<input type="text" name="main_menu" id="main_menu" value="<?php echo $data['main_menu']; ?>" required> <input type="text" name="main_menu" id="main_menu" value="<?php echo $data['main_menu']; ?>" required>
</div> </div>
<div> <div class="col-md-2 col-sm-12">
<label for="main_menu_seq">主功能排序</label> <label for="main_menu_seq">主功能排序</label>
<select name="main_menu_seq" id="main_menu_seq"> <select name="main_menu_seq" id="main_menu_seq">
<?php <?php
@ -35,11 +51,11 @@ $(function () {
?> ?>
</select> </select>
</div> </div>
<div> <div class="col-md-2 col-sm-12">
<label for="sub_menu">子功能名稱</label> <label for="sub_menu">子功能名稱</label>
<input type="text" name="sub_menu" id="sub_menu" value="<?php echo $data['sub_menu']; ?>" required> <input type="text" name="sub_menu" id="sub_menu" value="<?php echo $data['sub_menu']; ?>" required>
</div> </div>
<div> <div class="col-md-2 col-sm-12">
<label for="sub_menu_seq">子功能排序</label> <label for="sub_menu_seq">子功能排序</label>
<select name="sub_menu_seq" id="sub_menu_seq"> <select name="sub_menu_seq" id="sub_menu_seq">
<?php <?php
@ -51,19 +67,15 @@ $(function () {
?> ?>
</select> </select>
</div> </div>
<div> <div class="col-md-2 col-sm-12">
<label for="sub_menu_eng">子功能英文名</label> <label for="sub_menu_eng">子功能英文名</label>
<input type="text" name="sub_menu_eng" id="sub_menu_eng" value="<?php echo $data['sub_menu_eng']; ?>" required> <input type="text" name="sub_menu_eng" id="sub_menu_eng" value="<?php echo $data['sub_menu_eng']; ?>" required>
</div> </div>
<div> <div class="col-md-2 col-sm-12">
<label for="mlink">主網址</label> <label for="mlink">主網址</label>
<input type="text" name="mlink" id="mlink" size="30" value="<?php echo $data['mlink']; ?>" required> <input type="text" name="mlink" id="mlink" size="30" value="<?php echo $data['mlink']; ?>" required>
</div> </div>
<div> <div class="col-md-4 col-sm-12">
<label for="link_content">程式列表</label>
<textarea name="link_content" id="link_content" rows="10" cols="60" class="form-control" required><?php echo $data['link_content']; ?></textarea>
</div>
<div>
<label for="status">狀態</label> <label for="status">狀態</label>
<select name="status" id="status"> <select name="status" id="status">
<option value="N" <?php if ($data["status"] == "N") echo " selected"; ?>>隱藏</option> <option value="N" <?php if ($data["status"] == "N") echo " selected"; ?>>隱藏</option>
@ -71,24 +83,219 @@ $(function () {
<option value="Y" <?php if ($data["status"] == "Y") echo " selected"; ?>>正常</option> <option value="Y" <?php if ($data["status"] == "Y") echo " selected"; ?>>正常</option>
</select> </select>
</div> </div>
<div> <div class="col-md-4 col-sm-12">
<label for="creater">建檔人</label> <label for="creater">建檔人</label>
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> <input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly>
</div> </div>
<div class="col-md-12 col-sm-12" style="margin-top:15px;">
<label class='col-md-12' for="link_content">程式列表</label>
<textarea name="link_content" id="link_content" rows="10" cols="60" class="form-control" required><?php echo $data['link_content']; ?></textarea>
</div>
</div>
<div class="row col-md-12 col-sm-12" style="margin-top:15px;">
<div class="col-md-4 col-sm-12">
<label class='col-md-12' for="selectL1">可讀權限</label>
<select multiple="multiple" id="selectL1" style="width:100%;height:300px; border:4px #A0A0A4 outset; padding:4px; ">
<?php
foreach ($data2 as $row) {
$menu_permission = json_decode($row['permission']);
$status = false;
foreach ($menu_permission as $key => $value) {
if ($key == $data['mlink'] && in_array($value, ['1'])) {
$status = true;
break;
}
}
if (!$status)
echo "<option value='" . $row['id'] . "'>" . $row['name'] . "_" . $row['role'] . "</option>";
}
?>
</select>
</div>
<div class="col-md-1 col-sm-12">
<label class='col-md-12' for="add"> </label>
<button id="add1" type="button" class="btn mybutton">添加</button>
<button id="remove1" type="button" class="btn mybutton">移除</button>
<button id="add_all1" type="button" class="btn mybutton">全部添加</button>
<button id="remove_all1" type="button" class="btn mybutton">全部移除</button>
</div>
<div class="col-md-4 col-sm-12">
<label class='col-md-12' for="selectR1"> </label>
<select multiple="multiple" id="selectR1" name="can_read[]" style="width:100%;height:300px;;border:4px #A0A0A4 outset; padding:4px;">
<?php
foreach ($data2 as $row) {
$menu_permission = json_decode($row['permission']);
foreach ($menu_permission as $key => $value) {
if ($key == $data['mlink'] && in_array($value, ['1'])) {
echo "<option value='" . $row['id'] . "'>" . $row['name'] . "_" . $row['role'] . "</option>";
}
}
}
?>
</select>
</div>
</div>
<div class="row col-md-12 col-sm-12" style="margin-top:15px;">
<div class="col-md-4 col-sm-12">
<label class='col-md-12' for="selectL2">可寫權限</label>
<select multiple="multiple" id="selectL2" style="width:100%;height:300px; border:4px #A0A0A4 outset; padding:4px; ">
<?php
foreach ($data2 as $row) {
$menu_permission = json_decode($row['permission']);
$status = false;
foreach ($menu_permission as $key => $value) {
if ($key == $data['mlink'] && in_array($value, ['2', '3'])) {
$status = true;
break;
}
}
if (!$status)
echo "<option value='" . $row['id'] . "'>" . $row['name'] . "_" . $row['role'] . "</option>";
}
?>
</select>
</div>
<div class="col-md-1 col-sm-12">
<label class='col-md-12' for="add"> </label>
<button id="add2" type="button" class="btn mybutton">添加</button>
<button id="remove2" type="button" class="btn mybutton">移除</button>
<button id="add_all2" type="button" class="btn mybutton">全部添加</button>
<button id="remove_all2" type="button" class="btn mybutton">全部移除</button>
</div>
<div class="col-md-4 col-sm-12">
<label class='col-md-12' for="selectR2"> </label>
<select multiple="multiple" id="selectR2" name="can_write[]" style="width:100%;height:300px;;border:4px #A0A0A4 outset; padding:4px;">
<?php
foreach ($data2 as $row) {
$menu_permission = json_decode($row['permission']);
foreach ($menu_permission as $key => $value) {
if ($key == $data['mlink'] && in_array($value, ['2', '3'])) {
echo "<option value='" . $row['id'] . "'>" . $row['name'] . "_" . $row['role'] . "</option>";
}
}
}
?>
</select>
</div>
</div>
<div> <div class="row col-md-12 col-sm-12">
<br> <div class="col-md-12 col-sm-12">
<button type="submit" name="update">確定</button> <button class="pull-right" type="submit" name="update" id="update_btn" disabled>請先鎖定再提交</button>
<button class="pull-right" type="button" onclick="lockAuthSelect()">鎖定權限</button>
</div>
</div> </div>
<input type="hidden" name="token" value="<?php echo $token; ?>"> <input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> <input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>">
</form> </form>
</div> </div>
<script>
$(function() {
lrSelectChange('selectL', 'selectR', '1');
lrSelectChange('selectL', 'selectR', '2');
});
function lockAuthSelect() {
$("#selectR1 option").prop("selected", true);
$("#selectR2 option").prop("selected", true);
$("#update_btn").text("提交").removeAttr("disabled");
}
function lrSelectChange(lSelect, rSelect, id) {
lSelect = lSelect + id;
rSelect = rSelect + id;
//移到右边
$('#add' + id).click(function() {
//获取选中的选项,删除并追加给对方
for (var i = 0; i < $('#' + lSelect + ' option:selected').length; i++) {
$('#' + lSelect + ' option:selected')[i].text = $('#' + lSelect + ' option:selected')[i].text
$('#' + lSelect + ' option:selected')[i].value = $('#' + lSelect + ' option:selected')[i].value
}
$('#' + lSelect + ' option:selected').appendTo('#' + rSelect);
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
});
//移到左边
$('#remove' + id).click(function() {
for (var i = 0; i < $('#' + rSelect + ' option:selected').length; i++) {
$('#' + rSelect + ' option:selected')[i].text = $('#' + rSelect + ' option:selected')[i].text
$('#' + rSelect + ' option:selected')[i].value = $('#' + rSelect + ' option:selected')[i].value
}
$('#' + rSelect + ' option:selected').appendTo('#' + lSelect + '');
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
});
//全部移到右边
$('#add_all' + id).click(function() {
for (var i = 0; i < $('#' + lSelect + ' option').length; i++) {
$('#' + lSelect + ' option')[i].text = $('#' + lSelect + ' option')[i].text
$('#' + lSelect + ' option')[i].value = $('#' + lSelect + ' option')[i].value
}
//获取全部的选项,删除并追加给对方
$('#' + lSelect + ' option').appendTo('#' + rSelect + '');
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
});
//全部移到左边
$('#remove_all' + id).click(function() {
for (var i = 0; i < $('#' + rSelect + ' option').length; i++) {
$('#' + rSelect + ' option')[i].text = $('#' + rSelect + ' option')[i].text
$('#' + rSelect + ' option')[i].value = $('#' + rSelect + ' option')[i].value
}
$('#' + rSelect + ' option').appendTo('#' + lSelect + '');
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
});
//双击选项,左边到右边
$('#' + lSelect + '').dblclick(function() { //绑定双击事件
for (var i = 0; i < $('#' + lSelect + ' option:selected').length; i++) {
$('#' + lSelect + ' option:selected')[i].text = $('#' + lSelect + ' option:selected')[i].text
$('#' + lSelect + ' option:selected')[i].value = $('#' + lSelect + ' option:selected')[i].value
}
$('#' + lSelect + ' option:selected').appendTo('#' + rSelect + '');
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
});
//双击选项,右边到左边
$('#' + rSelect + '').dblclick(function() {
for (var i = 0; i < $('#selectR1 option:selected').length; i++) {
$('#' + rSelect + ' option:selected')[i].text = $('#' + rSelect + ' option:selected')[i].text
$('#' + rSelect + ' option:selected')[i].value = $('#' + rSelect + ' option:selected')[i].value
}
$('#' + rSelect + ' option:selected').appendTo('#' + lSelect + '');
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
});
$('#' + rSelect + '').click(function() {
$("#update_btn").text("請先鎖定再提交").attr("disabled", "disabled");
if ($('#' + rSelect + ' option:selected').length > 1) { //右侧选中多个时,只允许点击一个使其变序
return;
}
if (($("option:selected", this).text().substring($("option:selected", this).text().length - 4, $("option:selected", this).text().length)) == '(升序)') {
var a = $("option:selected", this).text();
$("option:selected", this).prop('text', a)
var b = $("option:selected", this).val();
b = b.replace("$asc", "$desc")
$("option:selected", this).prop('value', b)
return
}
if (($("option:selected", this).text().substring($("option:selected", this).text().length - 4, $("option:selected", this).text().length)) == '(降序)') {
var a = $("option:selected", this).text();
$("option:selected", this).prop('text', a)
var b = $("option:selected", this).val();
b = b.replace("$desc", "$asc")
$("option:selected", this).prop('value', b)
return
}
});
}
$(function() {
});
</script>
<?php <?php
endforeach;
include "footer.php"; include "footer.php";

149
wms/menu-record-update.php

@ -1,14 +1,153 @@
<?php <?php
ini_set('display_errors', 'on');
include "header.php"; include "header.php";
$auth_change_status = false;
if (isset($_POST['update'])) { if (isset($_POST['update'])) {
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v))); // foreach ($_POST as $k => $v) {
// $$k = htmlspecialchars(stripslashes(trim($v)));
// }
if (!empty($_POST['can_read'])) {
$auth_change_status = true;
$link_content = explode("\r\n", $_POST['link_content']);
foreach ($_POST['can_read'] as $id) {
// 更新部門可寫權限 json
$permission = [];
$department_id = 0;
$role_id = 0;
$sql = "
SELECT
department_id,
role_id,
permission
FROM department
WHERE 1=1
AND id = '$id'
";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_assoc($result);
$department_id = $data['department_id'];
$role_id = $data['role_id'];
mysqli_free_result($result);
$permission = json_decode($data['permission'], true);
foreach ($link_content as $row) {
$permission[$row] = '1';
}
$new_permiccion = json_encode($permission);
// 更改此職位權限
$sql = "
UPDATE department
SET permission = '$new_permiccion'
WHERE 1=1
AND id = '$id'
";
mysqli_query($link, $sql);
// 更改此職位底下所有員工的權限
$sql = "
SELECT accountid
FROM account
WHERE 1=1
AND department_id = '$department_id'
AND role_id = '$role_id'
";
$result = mysqli_query($link, $sql);
$data2 = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_free_result($result);
foreach ($data2 as $row) {
$sql = "
UPDATE account_auth
SET permission = '$new_permiccion'
WHERE 1=1
AND accountid = '" . $row['accountid'] . "'
";
mysqli_query($link, $sql);
}
} }
}
if (!empty($_POST['can_write'])) {
$auth_change_status = true;
$link_content = explode("\r\n", $_POST['link_content']);
foreach ($_POST['can_write'] as $id) {
// 更新部門可寫權限 json
$permission = [];
$department_id = 0;
$role_id = 0;
$sql = "
SELECT
department_id,
role_id,
permission
FROM department
WHERE 1=1
AND id = '$id'
";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_assoc($result);
$department_id = $data['department_id'];
$role_id = $data['role_id'];
mysqli_free_result($result);
$permission = json_decode($data['permission'], true);
foreach ($link_content as $row) {
$permission[$row] = '3';
}
$new_permiccion = json_encode($permission);
// 更改此職位權限
$sql = "
UPDATE department
SET permission = '$new_permiccion'
WHERE 1=1
AND id = '$id'
";
mysqli_query($link, $sql);
// 更改此職位底下所有員工的權限
$sql = "
SELECT accountid
FROM account
WHERE 1=1
AND department_id = '$department_id'
AND role_id = '$role_id'
";
$result = mysqli_query($link, $sql);
$data2 = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_free_result($result);
foreach ($data2 as $row) {
$sql = "
UPDATE account_auth
SET permission = '$new_permiccion'
WHERE 1=1
AND accountid = '" . $row['accountid'] . "'
";
mysqli_query($link, $sql);
}
}
}
$main_menu_seq = empty($_POST['main_menu_seq']) ? '' : $_POST['main_menu_seq'];
$main_menu = empty($_POST['main_menu']) ? '' : $_POST['main_menu'];
$sub_menu_seq = empty($_POST['sub_menu_seq']) ? '' : $_POST['sub_menu_seq'];
$sub_menu = empty($_POST['sub_menu']) ? '' : $_POST['sub_menu'];
$sub_menu_eng = empty($_POST['sub_menu_eng']) ? '' : $_POST['sub_menu_eng'];
$mlink = empty($_POST['mlink']) ? '' : $_POST['mlink'];
$link_content = empty($_POST['link_content']) ? '' : $_POST['link_content'];
$status = empty($_POST['status']) ? '' : $_POST['status'];
$id = empty($_POST['id']) ? '' : $_POST['id'];
$create_at = date('Y-m-d H:i:s');
//$link_content = str_replace(PHP_EOL, ',', $link_content); //$link_content = str_replace(PHP_EOL, ',', $link_content);
$db_query = "UPDATE menu set main_menu_seq = '$main_menu_seq', main_menu = '$main_menu', sub_menu_seq = '$sub_menu_seq', sub_menu = '$sub_menu', "; $db_query = "UPDATE menu set main_menu_seq = '$main_menu_seq', main_menu = '$main_menu', sub_menu_seq = '$sub_menu_seq', sub_menu = '$sub_menu', ";
$db_query .= "sub_menu_eng = '$sub_menu_eng', mlink = '$mlink', link_content = '$link_content', status = '$status', create_at = '$create_at' WHERE id='$id'"; $db_query .= "sub_menu_eng = '$sub_menu_eng', mlink = '$mlink', link_content = '$link_content', status = '$status', create_at = '$create_at' WHERE id='$id'";
mysqli_query($link, $db_query); mysqli_query($link, $db_query);
$affected = mysqli_affected_rows($link); $affected = mysqli_affected_rows($link);
mysqli_close($link); mysqli_close($link);
@ -17,6 +156,11 @@ if(isset($_POST['update'])) {
echo "alert('update成功');"; echo "alert('update成功');";
echo "location.href='menu-index.php?function_name=menu&" . $token_link . "';"; echo "location.href='menu-index.php?function_name=menu&" . $token_link . "';";
echo "</script>"; echo "</script>";
} elseif ($auth_change_status == true) {
echo "<script type ='text/JavaScript'>";
echo "alert('權限調整成功');";
echo "location.href='menu-index.php?function_name=menu&" . $token_link . "';";
echo "</script>";
} elseif ($affected == 0) { } elseif ($affected == 0) {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('無新增資料');"; echo "alert('無新增資料');";
@ -26,4 +170,3 @@ if(isset($_POST['update'])) {
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
} }
} }
?>

20
wms/rib01-create.php

@ -33,7 +33,6 @@ foreach ($deptmem as $mem) {
$username = $mem['Username']; $username = $mem['Username'];
$member["$userid"] = [$username]; $member["$userid"] = [$username];
}; };
// print_r($member);
$sql_dept = "SELECT DeptId, PersonId FROM comPerson WHERE (DeptId!='0001')"; $sql_dept = "SELECT DeptId, PersonId FROM comPerson WHERE (DeptId!='0001')";
$allpeople = $conn->query($sql_dept); $allpeople = $conn->query($sql_dept);
foreach ($allpeople as $man) { foreach ($allpeople as $man) {
@ -124,6 +123,9 @@ if ($MaxBillNo < 10) {
<option value="" style="display:flex" id="WriteOffoption">請選擇報銷人</option> <option value="" style="display:flex" id="WriteOffoption">請選擇報銷人</option>
<?php <?php
foreach ($member as $key => $value) { ?> foreach ($member as $key => $value) { ?>
<!-- <option value="<?php echo $value['UserId']; ?>" style="display:none" id="<?= 'WriteOff' . $value['UserId'] . $key ?>" <?php if ($value['UserId'] == $user_id) {
echo "selected";
} ?>> <?php echo $value['Username']; ?> </option> -->
<option value="<?php echo $key; ?>" id="<?= 'WriteOff' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) { <option value="<?php echo $key; ?>" id="<?= 'WriteOff' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected"; echo "selected";
} ?>> <?php echo $value[0]; ?> </option> } ?>> <?php echo $value[0]; ?> </option>
@ -140,18 +142,15 @@ if ($MaxBillNo < 10) {
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="GatheringPersonId" style="color: red;">收款人</label> <label for="GatheringPersonId" style="color: red;">收款人</label>
<select name="GatheringPersonId" id="GatheringPersonId" class="form-control"> <select name="GatheringPersonId" id="GatheringPersonId" >
<option value="" style="display:flex" id="GatheringOption">請選擇收款人</option> <option value="" style="display:flex" id="GatheringOption">請選擇收款人</option>
<?php <?php
// foreach ($deptmem as $key => $value) {
foreach ($member as $key => $value) { foreach ($member as $key => $value) {
?> ?>
<!-- <option value="<?php echo $value['accountid']; ?>" id="<?= 'Gathering' . $value['department_id'] ?>" <?php if ($value['accountid'] == $user_id) {
echo "selected"; <option value="<?php echo $key; ?>" id="<?= 'Gathering' . $value[1] . "-" . $value[0] ?>" style="display:flex" <?php if ($key == $user_id) {
} ?>> <?php echo $value['name']; ?> </option> -->
<option value="<?php echo $key; ?>" id="<?= 'Gathering' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected"; echo "selected";
} ?>> <?php echo $value[0]; ?> </option> } ?>> <?php echo $key.$value[0]; ?> </option>
<?php }; ?> <?php }; ?>
</select> </select>
</div> </div>
@ -178,7 +177,12 @@ if ($MaxBillNo < 10) {
</div> </div>
</form> </form>
</div> </div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.default.min.css" integrity="sha512-pTaEn+6gF1IeWv3W1+7X7eM60TFu/agjgoHmYhAfLEU8Phuf6JKiiE8YmsNC0aCgQv4192s4Vai8YZ6VNM6vyQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js" integrity="sha512-IOebNkvA/HZjMM7MxL0NYeLYEalloZ8ckak+NDtOViP7oiYzG5vn6WVXyrJDiJPhl4yRdmNAG49iuLmhkUdVsQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script> <script>
$(document).ready(function() {
$('#GatheringPersonId').selectize();
})
$(function() { $(function() {
$("#DeptId").change(function() { $("#DeptId").change(function() {
changeWriteOffId($('#DeptId').val()); changeWriteOffId($('#DeptId').val());

4
wms/wipwhole-change-contractdate-function.php

@ -436,6 +436,7 @@ function getShengguanokOptions($link)
FROM `account` FROM `account`
WHERE `department_id` IN ('250') WHERE `department_id` IN ('250')
AND `role_id` IN ('1','4') AND `role_id` IN ('1','4')
ORDER BY accountid DESC
"; ";
return mysqli_query($link, $sql); return mysqli_query($link, $sql);
} }
@ -598,7 +599,7 @@ function getAssignStatusSelect($link, $user_id, $nowFormStatus)
} else { } else {
$options_str .= "<option value='B'>提出申請</option>"; $options_str .= "<option value='B'>提出申請</option>";
} }
} }else{
if (in_array(checkNowFormStatus($link), ['A', 'D'])) { if (in_array(checkNowFormStatus($link), ['A', 'D'])) {
if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"])) if (accountidToDepartId($user_id) == "250" && in_array(accountidToRoleId($user_id), ["1", "4"]))
$options_str .= "<option value='Z'>通過</option>"; $options_str .= "<option value='Z'>通過</option>";
@ -609,6 +610,7 @@ function getAssignStatusSelect($link, $user_id, $nowFormStatus)
$options_str .= "<option value='D'>通過</option>"; $options_str .= "<option value='D'>通過</option>";
$options_str .= "<option value='C'>取消</option>"; $options_str .= "<option value='C'>取消</option>";
} }
}
$options_str .= "</select>"; $options_str .= "</select>";
return $options_str; return $options_str;
} }

35
wms/wipwhole-change-contractdate.php

@ -1,36 +1,6 @@
<?php <?php
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
function getAccounttype($link,$user_id){
$sql = "SELECT * FROM account where accountid = '$user_id'";
$data = mysqli_query($link, $sql);
$row = mysqli_fetch_array($data, MYSQLI_ASSOC);
return $row['accounttype'];
}
include 'IncludeCommon.php';
require_once "database.php";
$includecommon = new IncludeCommon();
$token = empty($token) ? $_REQUEST["token"] : $token;
$token_link = "token=" . $token;
list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
$user_name = urldecode(base64_decode($enc_user_name));
$accounttype = getAccounttype($link,$user_id);
$data = array();
$login_json = null;
if (strlen($accounttype) != 0) {
$jsonres['menu']=$includecommon->menu_v3($user_id, $accounttype);
$login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE);
}
?>
<script>
res=eval("("+JSON.stringify(<?php echo $login_json; ?>)+")");
window.localStorage.setItem("menu_<?php echo $user_id; ?>",res.menu);
</script>
<?php
/* /*
1. 有 cid 是已申請過的單 1. 有 cid 是已申請過的單
2. 沒有 cid 是新申請單 2. 沒有 cid 是新申請單
@ -41,6 +11,9 @@ if (strlen($accounttype) != 0) {
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
// include 'IncludeCommon.php';
require_once "database.php";
// $includecommon = new IncludeCommon();
include "header.php"; include "header.php";
include "css/view/wipwhole-change-contractdate.php"; include "css/view/wipwhole-change-contractdate.php";
include "wipwhole-change-contractdate-function.php"; include "wipwhole-change-contractdate-function.php";
@ -367,7 +340,7 @@ if (!empty(checkNowFormStatus($link)))
</select> </select>
"; ";
} else if (checkNowFormStatus($link) == 'B') { } else if (checkNowFormStatus($link) == 'B') {
if (getDepartmentId($link, $user_id) == '521' || getDepartmentId($link, $user_id) == '531') { if (in_array(getDepartmentId($link, $user_id), ['521', '531', '541', '542', '543', '544', '545'])){
echo "<select name='next_users' id='next_users'>"; echo "<select name='next_users' id='next_users'>";
foreach ($shengguanok_options as $shengguanok_option) : foreach ($shengguanok_options as $shengguanok_option) :
echo " echo "

22
wms/wipwhole-change-planning-customer-name.php

@ -1,18 +1,18 @@
<?php <?php
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
function getAccounttype($link, $user_id) // function getAccounttype($link, $user_id)
{ // {
$sql = "SELECT * FROM account where accountid = '$user_id'"; // $sql = "SELECT * FROM account where accountid = '$user_id'";
$data = mysqli_query($link, $sql); // $data = mysqli_query($link, $sql);
$row = mysqli_fetch_array($data, MYSQLI_ASSOC); // $row = mysqli_fetch_array($data, MYSQLI_ASSOC);
return $row['accounttype']; // return $row['accounttype'];
} // }
include 'IncludeCommon.php'; // include 'IncludeCommon.php';
require_once "database.php"; require_once "database.php";
// $includecommon = new IncludeCommon();
$includecommon = new IncludeCommon(); include "header.php";
$token = empty($token) ? $_REQUEST["token"] : $token; $token = empty($token) ? $_REQUEST["token"] : $token;
$token_link = "token=" . $token; $token_link = "token=" . $token;
list($user_id, $enc_user_name, $login_dt) = explode(".", $token); list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
@ -40,7 +40,7 @@ if (strlen($accounttype) != 0) {
5. 大日程的 id 新申請過的直接取得 5. 大日程的 id 新申請過的直接取得
*/ */
include "header.php";
include "css/view/wipwhole-change-contractdate.php"; include "css/view/wipwhole-change-contractdate.php";
include "wipwhole-change-planning-customer-name-function.php"; include "wipwhole-change-planning-customer-name-function.php";

60
wms/wipwhole-index-function.php

@ -1,5 +1,22 @@
<?php <?php
/**
* 取得生管主管 options
* @param object $link:資料庫連線
* @param string $id:作番大日程唯一值
* @return object 回傳 mysqli_query
*/
function getWipwholestatusDetail($link, $id)
{
$db_query = "
SELECT * FROM
wipwholestatus WHERE id = '$id'
AND status = '1'
";
$receivabledata = mysqli_query($link, $db_query);
return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC);
}
function getWipwholestatusData($link, $id) function getWipwholestatusData($link, $id)
{ {
$db_query = " $db_query = "
@ -76,7 +93,7 @@ function getEditFlag($department_id, $role_id, $user_id)
if ($department_id == "321") if ($department_id == "321")
return 8; return 8;
// 鍾哥(生管) 部門代碼:250 職位大小:1 4 // 鍾哥(生管) 部門代碼:250 職位大小:1 4
if ($department_id == "250" && in_array($role_id, ["1", "4"])) if ($department_id == "250")
return 8; return 8;
// 許協理 部門代碼:320 職位大小:1 // 許協理 部門代碼:320 職位大小:1
if ($department_id == "320" && $role_id == "1") if ($department_id == "320" && $role_id == "1")
@ -130,6 +147,10 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$sql_cmd = sql_myself($user_id, "salesid"); $sql_cmd = sql_myself($user_id, "salesid");
$sql = " $sql = "
@ -180,7 +201,7 @@ function getDataSql($department_id, $role_id, $user_id)
"; ";
return $sql; return $sql;
} }
if ($department_id == '314' && (in_array($role_id, ['2']))) { if ($department_id == '314' && (in_array($role_id, ['1', '2']))) {
$sql = " $sql = "
SELECT * FROM wipwholestatus SELECT * FROM wipwholestatus
WHERE 1=1 WHERE 1=1
@ -298,7 +319,10 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$flow_code_tmp = explode(',', $flow_code); $flow_code_tmp = explode(',', $flow_code);
$flow_code = implode("','", $flow_code_tmp); $flow_code = implode("','", $flow_code_tmp);
@ -549,7 +573,7 @@ function getYDForm_key($link, $form_id)
ON f.form_key = s.form_key ON f.form_key = s.form_key
WHERE 1=1 WHERE 1=1
AND f.form_id = '$form_id' AND f.form_id = '$form_id'
AND f.flow_code IN ('A','B','C','D') AND f.flow_code IN ('A','B','C','D','I')
AND f.system_id = 'wws' AND f.system_id = 'wws'
AND f.flow_id = 'wws01' AND f.flow_id = 'wws01'
"; ";
@ -748,11 +772,12 @@ function getGongWuokNo($link)
// 取得生管部主管編號 // 取得生管部主管編號
function getShengGuanokLeaderNo($link) function getShengGuanokLeaderNo($link)
{ {
return "M0079";
$sql = " $sql = "
SELECT accountid SELECT accountid
FROM `account` FROM `account`
WHERE `department_id` = '321' WHERE `department_id` = '250'
AND `role_id` = '1'; AND `role_id` = '4';
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result); $row = mysqli_fetch_array($result);
@ -770,7 +795,7 @@ function checkNowFormYDStatus($link)
flow_code flow_code
FROM flow FROM flow
WHERE form_id = '$id' WHERE form_id = '$id'
AND flow_code IN ('A','B','C','D') AND flow_code IN ('A','B','C','D','I')
AND system_id = 'wws' AND system_id = 'wws'
AND flow_id = 'wws01' AND flow_id = 'wws01'
"; ";
@ -820,7 +845,8 @@ function getYewuStatus($link, $user_department_id, $role_id)
// 取得工務的欄位權限 // 取得工務的欄位權限
function getWarehouseStatus($link, $user_department_id, $role_id, $status) function getWarehouseStatus($link, $user_department_id, $role_id, $status)
{ {
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) { // if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
if(getSaveEstimateInstallData($user_department_id, $role_id)){
if ($status == 1) { if ($status == 1) {
return checkNowFormGStatus($link) == 'G' ? "" : "disabled"; return checkNowFormGStatus($link) == 'G' ? "" : "disabled";
} else { } else {
@ -884,7 +910,7 @@ function getForm_key($link, $form_id)
ON f.form_key = s.form_key ON f.form_key = s.form_key
WHERE 1=1 WHERE 1=1
AND f.form_id = '$form_id' AND f.form_id = '$form_id'
AND f.flow_code IN ('A','B','C','D','E') AND f.flow_code IN ('A','B','C','D','E','I')
AND f.system_id = 'wws' AND f.system_id = 'wws'
AND f.flow_id = 'wws01' AND f.flow_id = 'wws01'
"; ";
@ -944,11 +970,11 @@ function getTabNo($user_department_id)
if ($user_department_id == 220) if ($user_department_id == 220)
return 0; return 0;
if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315) if ($user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315)
return 0;
if ($user_department_id == 911)
return 1; return 1;
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])) if ($user_department_id == 911)
return 2; return 2;
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545]))
return 0;
if ($user_department_id == 321 || $user_department_id == 250) if ($user_department_id == 321 || $user_department_id == 250)
return 3; return 3;
if ($user_department_id == 912) if ($user_department_id == 912)
@ -1124,7 +1150,7 @@ function getSaveEstimateInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '521' && in_array($role_id, ['11', '9', '12'])) if ($user_department_id == '521' && in_array($role_id, ['11', '9', '12']))
return true; return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6'])) if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
return true; return true;
@ -1141,11 +1167,11 @@ function saveInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '521' && $role_id == '9') if ($user_department_id == '521' && $role_id == '9')
return true; return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6'])) if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6']))
return true; return true;
if ($user_department_id == '545' && in_array($role_id, ['3', '6'])) if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true; return true;
@ -1176,9 +1202,9 @@ function getAllCustomerPlanningVerify($link, $id)
{ {
$sql = " $sql = "
SELECT SELECT
custom AS custom_name, real_custom_name AS custom_name,
customer_planning_verify_file, customer_planning_verify_file,
create_at date_format(customer_planning_verify_at, '%Y-%m-%d %H:%i:%s') AS create_at
FROM wipwholestatus FROM wipwholestatus
WHERE id = $id WHERE id = $id
AND customer_planning_verify_file != '' AND customer_planning_verify_file != ''

15
wms/wipwhole-index-table-html.php

@ -1,13 +1,4 @@
<?php <?php
$tableArr = array(
"All" => "table_index2",
"A" => "table_index3",
"B" => "table_index4",
"G" => "table_index5",
"CH" => "table_index6",
"Z" => "table_index7"
);
// 暫時可編輯及刪除權限 // 暫時可編輯及刪除權限
$update_delete_status = false; $update_delete_status = false;
if (in_array($user_id, ['M0175', 'M0079'])) { if (in_array($user_id, ['M0175', 'M0079'])) {
@ -15,7 +6,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
} }
?> ?>
<table id="<?php echo $tableArr[$key]; ?>" class="table table-striped table-bordered " style="width:100%;table-layout:fixed;"> <table id="table_index2" class="table table-striped table-bordered " style="width:100%;table-layout:fixed;">
<thead> <thead>
<tr> <tr>
<?php <?php
@ -42,7 +33,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
<tbody> <tbody>
<?php <?php
foreach ($dataDetailsArr as $key => $data) : foreach ($data as $key => $data) :
//規格 //規格
$Specification = $data['facility_kind']; $Specification = $data['facility_kind'];
@ -139,7 +130,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
<td><?php echo $data['facilityno']; ?></td> <td><?php echo $data['facilityno']; ?></td>
<td><?php echo $data['custom']; ?></td> <td><?php echo $data['custom']; ?></td>
<td><?php echo $Specification; ?></td> <td><?php echo $Specification; ?></td>
<td><?php echo $data['address']; ?></td> <td><?php echo empty($data['real_address']) ? $data['address'] : $data['real_address']; ?></td>
<?php <?php
foreach ($site_survey_status as $key => $val) { foreach ($site_survey_status as $key => $val) {
if ((string)$data['site_survey_contact_verify'] == (string)$key) { if ((string)$data['site_survey_contact_verify'] == (string)$key) {

186
wms/wipwhole-index.php

@ -1,3 +1,9 @@
<div id="loadingOverlay" class="hidden">
<div class="loading-icon"></div>
</div>
<script>
document.getElementById('loadingOverlay').classList.remove('hidden');
</script>
<?php <?php
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
/** /**
@ -26,16 +32,14 @@ include "wipwhole-index-function.php";
include "css/view/wipwhole-index.php"; include "css/view/wipwhole-index.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'del_form') { $form_name = empty($_REQUEST['form_name']) ? null : $_REQUEST['form_name'];
$del_seq = $_POST['del_seq']; $del_seq = empty($_REQUEST['del_seq']) ? null : $_REQUEST['del_seq'];
if ($form_name == 'del_form') {
$sql = "UPDATE wipwholestatus SET status = '0' WHERE id = '$del_seq' "; $sql = "UPDATE wipwholestatus SET status = '0' WHERE id = '$del_seq' ";
mysqli_query($link, $sql); mysqli_query($link, $sql);
} }
} }
// 宣告主資料空陣列
$data = array();
// 取得當前使用者所屬部門 // 取得當前使用者所屬部門
$department_id = getDepartmentId($link, $user_id); $department_id = getDepartmentId($link, $user_id);
// 取得當前使用者所屬職位 // 取得當前使用者所屬職位
@ -55,30 +59,27 @@ $site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ?
$real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start']; $real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start'];
$real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end']; $real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end'];
$area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no']; $area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no'];
$sheetNum = empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum'];
$tableArr = array(
"All" => "",
"A" => "A",
"B" => "B",
"G" => "G",
"CH" => "C,H",
"Z" => "Z"
);
// 取得資料 sql if (empty($sheetNum) || $sheetNum == "All") {
$sql = getDataSql($department_id, $role_id, $user_id); $sql = getDataSql($department_id, $role_id, $user_id);
} else {
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, $tableArr[$sheetNum]);
}
// 取得資料 sql
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// 取得資料(營業部門階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "A");
$dataA = mysqli_query($link, $sql);
// 取得資料(設計部門階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "B");
$dataB = mysqli_query($link, $sql);
// 取得資料(工勘部門階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "G");
$dataG = mysqli_query($link, $sql);
// 取得資料(生管階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "C,H");
$dataCH = mysqli_query($link, $sql);
// 取得資料(結案階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "Z");
$dataZ = mysqli_query($link, $sql);
?> ?>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
@ -202,6 +203,8 @@ $dataZ = mysqli_query($link, $sql);
</div> </div>
<nav class="navbar navbar-tabs" style="margin:0;margin-top:5px;"> <nav class="navbar navbar-tabs" style="margin:0;margin-top:5px;">
<div class="container-fluid"> <div class="container-fluid">
<div class="row">
<div class="col-md-9 col-12">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"> <li class="active">
<a href="#" onclick="showAllTable()">全部資料</a> <a href="#" onclick="showAllTable()">全部資料</a>
@ -223,24 +226,87 @@ $dataZ = mysqli_query($link, $sql);
</li> </li>
</ul> </ul>
</div> </div>
<div class="col-md-3 col-12 text-right" id="myBtn">
<button class="btn btn-primary " type="button">欄位維護權限</button>
</div>
</div>
</div>
</nav> </nav>
<div id="myModal" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'>
<h3>欄位維護權限</h3>
<hr>
<div class='row'>
<div class='col-12'>
<table class="table table-bordered" style="width:50%; margin:0 auto;">
<tr>
<th style="text-align:right;">欄位</th>
<th style="text-align:left;">維護單位</th>
</tr>
<tr>
<td style="text-align:right;">合約號</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">電梯編號</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">客戶姓名</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">規格</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">地址</td>
<td style="text-align:left;">業務部(營業人員 or 工勘人員透過申請單)</td>
</tr>
<tr>
<td style="text-align:right;">工勘狀態</td>
<td style="text-align:left;">工勘人員</td>
</tr>
<tr>
<td style="text-align:right;">合約交期(到工地)</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">下單日(普來特富)</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">預計到廠日(觀音廠)</td>
<td style="text-align:left;">生管部門</td>
</tr>
<tr>
<td style="text-align:right;">實際到廠日(觀音廠)</td>
<td style="text-align:left;">生管部門</td>
</tr>
<tr>
<td style="text-align:right;">預計出貨日(到工地)</td>
<td style="text-align:left;">業務部(營業人員 or 工勘人員透過申請單)</td>
</tr>
<tr>
<td style="text-align:right;">實際出貨日(到工地)</td>
<td style="text-align:left;">生管部門</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<?php <?php
$dataArr = array(
"All" => $data, echo "<div id='data_table_div' class='data_table_div' style='overflow-x:auto;'>";
"A" => $dataA,
"B" => $dataB,
"G" => $dataG,
"CH" => $dataCH,
"Z" => $dataZ
);
foreach ($dataArr as $key => $val) {
if ($val) :
$dataDetailsArr = $val;
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-index-table-html.php"; include "wipwhole-index-table-html.php";
echo "</div>"; echo "</div>";
endif;
}
// 結束連線 // 結束連線
@ -263,15 +329,15 @@ mysqli_close($link);
} }
</style> </style>
<script> <script>
var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>"; var sheetNum = "<?php echo $sheetNum; ?>";
$(document).ready(function() { $(document).ready(function() {
$('#site_survey_contact_verify').select2(); $('#site_survey_contact_verify').select2();
}); });
$(function() { $(function() {
$(".data_table_div").hide();
showTable(sheetNum); showTable(sheetNum);
document.getElementById('loadingOverlay').classList.add('hidden');
}) })
const formData = new FormData(); const formData = new FormData();
@ -376,17 +442,15 @@ mysqli_close($link);
"CH": "5", "CH": "5",
"Z": "6", "Z": "6",
} }
$("body > nav.navbar.navbar-tabs > div > ul > li").attr("class", ""); $("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("body > nav.navbar.navbar-tabs > div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active"); $("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
$(".data_table_div").hide();
$("#data_" + code + "_table_div").show();
} }
function estimatedShippingDateReportButton() { function estimatedShippingDateReportButton() {
window.location.href = '<?php echo "/wms/estimated_shipping_date_report.php?$token_link" ?>'; window.location.href = '<?php echo "/wms/estimated_shipping_date_report.php?$token_link" ?>';
} }
$('#table_index2,#table_index3,#table_index4,#table_index5,#table_index6,#table_index7').DataTable({ $('#table_index2').DataTable({
scrollX: true, scrollX: true,
fixedHeader: true, fixedHeader: true,
scrollY: 500, scrollY: 500,
@ -421,11 +485,6 @@ mysqli_close($link);
); );
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋"; document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index3_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index4_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index5_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index6_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index7_filter > label > input").placeholder = "快速搜尋";
// datatable 畫面重整後保留資料 // datatable 畫面重整後保留資料
@ -443,16 +502,7 @@ mysqli_close($link);
var orderColumn = "<?php echo empty($_GET['orderColumn']) ? '' : $_GET['orderColumn']; ?>"; var orderColumn = "<?php echo empty($_GET['orderColumn']) ? '' : $_GET['orderColumn']; ?>";
var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>"; var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>";
var dataArr2 = { var table = $('#table_index2').DataTable();
"All": "table_index2",
"A": "table_index3",
"B": "table_index4",
"G": "table_index5",
"CH": "table_index6",
"Z": "table_index7",
}
var table = $('#' + dataArr2[sheetNum]).DataTable();
// 设置排序信息 // 设置排序信息
if (orderColumn !== '' && orderDirection !== '') { if (orderColumn !== '' && orderDirection !== '') {
@ -481,7 +531,7 @@ mysqli_close($link);
}); });
// 監聽搜尋事件 // 監聽搜尋事件
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() { $("#table_index2_filter > label > input").change(function() {
searchDatatable(table); searchDatatable(table);
}); });
@ -503,6 +553,22 @@ mysqli_close($link);
$("#del_form").submit(); $("#del_form").submit();
} }
</script> </script>
<script>
var modal = document.getElementById("myModal");
$("#myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
console.log(e.target);
$("#myModal").hide();
// modal.style.display = "none"
});
$(".back").click(function(e) {
$("#myModal").hide();
// modal.style.display = "none"
});
</script>
<form id='del_form' method='post'> <form id='del_form' method='post'>
<input type='hidden' id='del_seq' name='del_seq' value='' /> <input type='hidden' id='del_seq' name='del_seq' value='' />
<input type='hidden' id='form_name' name='form_name' value='del_form' /> <input type='hidden' id='form_name' name='form_name' value='del_form' />

2
wms/wipwhole-rec-invoice-edit-fileupload.php

@ -67,3 +67,5 @@ $completion_acceptance_file = fileIUpload("completion_acceptance_file");
$shengguanok_status_file = fileIUpload("shengguanok_status_file"); $shengguanok_status_file = fileIUpload("shengguanok_status_file");
// 工務助理 // 工務助理
$outsourcer_contract_file = fileIUploads("outsourcer_contract_file"); $outsourcer_contract_file = fileIUploads("outsourcer_contract_file");
// 品證
$official_check_file = fileIUpload("official_check_file");

289
wms/wipwhole-rec-invoice-edit-submit.php

@ -1,5 +1,5 @@
<?php <?php
// ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'main_form') { if ($_POST['form_name'] == 'main_form') {
@ -52,6 +52,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at']; $sales_spec_verify_at = $_POST['sales_spec_verify_at'] ?: $row['sales_spec_verify_at'];
$sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner']; $sales_spec_verify_owner = $_POST['sales_spec_verify_owner'] ?: $row['sales_spec_verify_owner'];
//客户计划图确认 //客户计划图确认
$real_custom_name = $_POST['real_custom_name'] ?: $row['real_custom_name'];
$customer_planning_verify = $_POST['customer_planning_verify']; $customer_planning_verify = $_POST['customer_planning_verify'];
$customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at']; $customer_planning_verify_at = $_POST['customer_planning_verify_at'] ?: $row['customer_planning_verify_at'];
$customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner']; $customer_planning_verify_owner = $_POST['customer_planning_verify_owner'] ?: $row['customer_planning_verify_owner'];
@ -152,6 +153,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$official_check_date_owner = $_POST['official_check_date_owner'] ?: $row['official_check_date_owner']; $official_check_date_owner = $_POST['official_check_date_owner'] ?: $row['official_check_date_owner'];
$delivery_date = $_POST['delivery_date'] ?: $row['delivery_date']; $delivery_date = $_POST['delivery_date'] ?: $row['delivery_date'];
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner']; $delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
$qc_official_type = $_POST['qc_official_type'] ?: $row['qc_official_type'];
// 工務助理 // 工務助理
$outsourcer_type = $_POST['outsourcer_type']; $outsourcer_type = $_POST['outsourcer_type'];
@ -174,12 +176,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark']; $warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
$creater = $_POST['creater']; $creater = $_POST['creater'];
$create_at = $_POST['create_at']; $create_at = date("Y-m-fd H:i:s");
// 上傳附件 // 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php"; include "wipwhole-rec-invoice-edit-fileupload.php";
// 工勘變更通知繪圖人員 // 工勘變更通知繪圖人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) { if ($official_check_date !== $old_official_check_date) {
$sql = " $sql = "
SELECT accountid SELECT accountid
@ -219,7 +222,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
mysqli_query($link, $sql); mysqli_query($link, $sql);
} }
} }
}
// 工勘變更通知繪圖人員 // 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) { if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
@ -287,6 +290,30 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
} }
if (!empty($desin_documents_verify_file)) {
echo $sql = "
INSERT INTO notice(
kind,
related_id,
title,
content,
haveread,
permission,
creater,
create_at
)VALUES(
'1',
'$id',
'合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
'合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
null,
'M0168',
'$creater',
'$create_at'
);
";
mysqli_query($link, $sql);
}
$updatesql = " $updatesql = "
UPDATE wipwholestatus UPDATE wipwholestatus
@ -333,6 +360,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
delivery_date = '$delivery_date', delivery_date = '$delivery_date',
delivery_date_owner = '$delivery_date_owner', delivery_date_owner = '$delivery_date_owner',
marketing_remark = '', marketing_remark = '',
real_custom_name = '$real_custom_name',
"; ";
if (!empty(trim($marketing_remark))) { if (!empty(trim($marketing_remark))) {
$updatesql .= " $updatesql .= "
@ -475,6 +503,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} else if ($user_department_id == 912) { } else if ($user_department_id == 912) {
// 品證部 // 品證部
$updatesql .= " $updatesql .= "
qc_official_type = '$qc_official_type',
qc_date = '$qc_date', qc_date = '$qc_date',
qc_date_owner = '$qc_date_owner', qc_date_owner = '$qc_date_owner',
end_qc_date = '$end_qc_date', end_qc_date = '$end_qc_date',
@ -510,8 +539,54 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
// 工務助理 // 工務助理
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188','M0117'])) { if (
in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117'])
|| in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545])
|| $user_id == 'M0054'
) {
$qc_official_type = $_POST['qc_official_type2'] ?: $row['qc_official_type'];
$outsourcer_type = $_POST['outsourcer_type'];
$qc_date = $_POST['qc_date2'] ?: $row['qc_date'];
$qc_date_owner = $_POST['qc_date2_owner'] ?: $row['qc_date_owner'];
$end_qc_date = $_POST['end_qc_date2'] ?: $row['end_qc_date'];
$end_qc_date_owner = $_POST['end_qc_date2_owner'] ?: $row['end_qc_date_owner'];
$official_check_date = $_POST['official_check_date2'] ?: $row['official_check_date'];
$old_official_check_date = $_POST['old_official_check_date2'] ?: $row['old_official_check_date'];
$official_check_date_owner = $_POST['official_check_date2_owner'] ?: $row['official_check_date_owner'];
$delivery_date = $_POST['delivery_date2'] ?: $row['delivery_date'];
$delivery_date_owner = $_POST['delivery_date2_owner'] ?: $row['delivery_date_owner'];
$install_start_date = $_POST['install_start_date2'] ?: $row['install_start_date'];
$install_start_date_owner = $_POST['install_start_date2_owner'] ?: $row['install_start_date_owner'];
$install_end_date = $_POST['install_end_date2'] ?: $row['install_end_date'];
$install_end_date_owner = $_POST['install_end_date2_owner'] ?: $row['install_end_date_owner'];
$tryrun_start_date = $_POST['tryrun_start_date2'] ?: $row['tryrun_start_date'];
$tryrun_start_date_owner = $_POST['tryrun_start_date2_owner'] ?: $row['tryrun_start_date_owner'];
$tryrun_end_date = $_POST['tryrun_end_date2'] ?: $row['tryrun_end_date'];
$tryrun_end_date_owner = $_POST['tryrun_end_date2_owner'] ?: $row['tryrun_end_date_owner'];
$updatesql .= " $updatesql .= "
qc_official_type = '$qc_official_type',
install_start_date = '$install_start_date',
install_start_date_owner = '$install_start_date_owner',
install_end_date = '$install_end_date',
install_end_date_owner = '$install_end_date_owner',
tryrun_start_date = '$tryrun_start_date',
tryrun_start_date_owner = '$tryrun_start_date_owner',
tryrun_end_date = '$tryrun_end_date',
tryrun_end_date_owner = '$tryrun_end_date_owner',
delivery_date = '$delivery_date',
delivery_date_owner = '$delivery_date_owner',
qc_date = '$qc_date',
qc_date_owner = '$qc_date_owner',
end_qc_date = '$end_qc_date',
end_qc_date_owner = '$end_qc_date_owner',
official_check_date = '$official_check_date',
official_check_date_owner = '$official_check_date_owner',
outsourcer_type = '$outsourcer_type', outsourcer_type = '$outsourcer_type',
install_outsourcer = '$install_outsourcer', install_outsourcer = '$install_outsourcer',
install_outsourcer_owner = '$install_outsourcer_owner', install_outsourcer_owner = '$install_outsourcer_owner',
@ -605,8 +680,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));
} }
// 檢查簽核狀態 $id = empty($_POST['id']) ? null : $_POST['id'];
if (checkWwsAssianStatus($link, $user_id)) { // // 檢查簽核狀態
if (checkWwsAssianStatus($link, $user_id, $id)) {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('此表單已進入下個階段');"; echo "alert('此表單已進入下個階段');";
echo "location.href='wipwhole-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';"; echo "location.href='wipwhole-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
@ -919,8 +995,43 @@ function write_note($link, $id, $user_id, $content)
mysqli_query($link, $updatesql); mysqli_query($link, $updatesql);
} }
// function getWipwholestatusDetail($link, $id)
// {
// $sql = "
// SELECT *
// FROM wipwholestatus
// WHERE 1=1
// AND id = '$id'
// AND status = '1'
// ";
// $result = mysqli_query($link, $sql);
// $row = mysqli_fetch_assoc($result);
// return $row;
// }
// 各區營銷(契約)經理判斷程式
function checkUseridIsManager($user_id)
{
// 北區 劉永德
if (in_array($user_id, ['M0137']))
return true;
// 中區 李烘銘
if (in_array($user_id, ['M0086']))
return true;
// 桃竹 張莉凱
if (in_array($user_id, ['M0026']))
return true;
// 宜花東 陳志文
if (in_array($user_id, ['M0054']))
return true;
// 南區 吳育宗
if (in_array($user_id, ['M0033']))
return true;
return false;
}
// 表單簽核狀態檢查主程式 // 表單簽核狀態檢查主程式
function checkWwsAssianStatus($link, $user_id) function checkWwsAssianStatus($link, $user_id, $id = null)
{ {
if (isset($_GET['id']) || isset($_GET['form_key'])) { if (isset($_GET['id']) || isset($_GET['form_key'])) {
@ -929,33 +1040,144 @@ function checkWwsAssianStatus($link, $user_id)
$form_G_key = isset($_GET['form_key']) ? $_GET['form_key'] : getGForm_key($link, $id); $form_G_key = isset($_GET['form_key']) ? $_GET['form_key'] : getGForm_key($link, $id);
} }
// 確認營業階段 進入設計人員(新梯:郭承瑋 M0023)階段 include "./class/Cmail.php";
$cmail = new Cmail();
$data = getWipwholestatusDetail($link, $id);
$data['salesname'] = accountid2name($data['salesid'])[$data['salesid']];
$data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']];
$data['salesmanagername'] = accountid2name(manage_class($data['salesid'])[0])[manage_class($data['salesid'])[0]];
$data['salesmanagermail'] = accountid2email([manage_class($data['salesid'])[0]])[manage_class($data['salesid'])[0]];
$data['designname'] = accountid2name("M0023")["M0023"];
$data['designmail'] = accountid2email(["M0023"])["M0023"];
$data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)];
$data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)];
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
$data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
// 確認營業階段
// 非主管進入主管階段
// 主管進入設計人員(新梯:郭承瑋 M0023)階段
if (checkNowFormYDStatus($link) == 'A' && checkYingYeok($link, $id) == '0') { if (checkNowFormYDStatus($link) == 'A' && checkYingYeok($link, $id) == '0') {
write_note($link, $id, $user_id, "<em>營業提交至設計階段</em>"); if (checkUseridIsManager($user_id)) {
write_note($link, $id, $user_id, "<em>營業經理提交至設計階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['salesname'], $data['salesmail']],
[$data['designname'], $data['designmail']]
],
"永佳捷科技"
);
do_wws_next_assign("M0023", $form_YD_key, 'B');
return true;
} else {
write_note($link, $id, $user_id, "<em>營業提交至營業經理階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至營業經理階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業提交至營業經理階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['salesname'], $data['salesmail']],
[$data['salesmanagername'], $data['salesmanagermail']]
],
"永佳捷科技"
);
do_wws_next_assign(manage_class($data['salesid'])[0], $form_YD_key, 'I');
return true;
}
}
// 確認營業主管階段 進入設計人員(新梯:郭承瑋 M0023)階段
if (checkNowFormYDStatus($link) == 'I' && checkYingYeok($link, $id) == '0') {
if (checkUseridIsManager($user_id)) {
write_note($link, $id, $user_id, "<em>營業經理提交至設計階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-營業經理提交至設計階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['salesname'], $data['salesmail']],
[$data['designname'], $data['designmail']]
],
"永佳捷科技"
);
do_wws_next_assign("M0023", $form_YD_key, 'B'); do_wws_next_assign("M0023", $form_YD_key, 'B');
return true; return true;
} }
}
// 確認設計人員(新梯:郭承瑋 M0023)階段 進入設計主管階段 // 確認設計人員(新梯:郭承瑋 M0023)階段 進入設計主管階段
if (checkNowFormYDStatus($link) == 'B' && checkSheJiok($link, $id) == '0') { if (in_array(checkNowFormYDStatus($link), ['B', 'I']) && checkSheJiok($link, $id) == '0') {
write_note($link, $id, $user_id, "<em>設計提交至設計主管階段</em>"); write_note($link, $id, $user_id, "<em>設計提交至設計主管階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-設計提交至設計主管階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-設計提交至設計主管階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['designleadername'], $data['designleadermail']],
[$data['designname'], $data['designmail']]
],
"永佳捷科技"
);
do_wws_next_assign(getSheJiokLeaderNo($link), $form_YD_key, 'C'); do_wws_next_assign(getSheJiokLeaderNo($link), $form_YD_key, 'C');
return true; return true;
} }
// 確認設計主管階段 進入生管階段 // 確認設計主管階段 進入生管階段
if (checkNowFormYDStatus($link) == 'C' && checkSheJiokLeader($link, $id) == '0') { if (checkNowFormYDStatus($link) == 'C' && checkSheJiokLeader($link, $id) == '0') {
write_note($link, $id, $user_id, "<em>設計主管提交至生管階段</em>"); write_note($link, $id, $user_id, "<em>設計主管提交至生管階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-設計主管提交至生管階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-設計主管提交至生管階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['designleadername'], $data['designleadermail']],
[$data['shengguanname'], $data['shengguanmail']]
],
"永佳捷科技"
);
do_wws_next_assign(getShengGuanokLeaderNo($link), $form_YD_key, 'D'); do_wws_next_assign(getShengGuanokLeaderNo($link), $form_YD_key, 'D');
return true; return true;
} }
// 確認工務階段 進入生管階段 // 確認工務階段 進入生管階段
if (checkNowFormGStatus($link) == 'G' && checkGongWuok($link, $id) == '0') { if (checkNowFormGStatus($link) == 'G' && checkGongWuok($link, $id) == '0') {
write_note($link, $id, $user_id, "<em>工務提交至生管階段</em>"); write_note($link, $id, $user_id, "<em>工務提交至生管階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-工務提交至生管階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-工務提交至生管階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['gongwuname'], $data['gongwumail']],
[$data['shengguanname'], $data['shengguanmail']]
],
"永佳捷科技"
);
do_wws_next_assign(getShengGuanokLeaderNo($link), $form_G_key, 'H'); do_wws_next_assign(getShengGuanokLeaderNo($link), $form_G_key, 'H');
return true; return true;
} }
// 確認生管階段(營業部及設計部) 結束簽核流程 // 確認生管階段(營業部及設計部) 結束簽核流程
if (checkNowFormYDStatus($link) == 'D' && checkNowFormGStatus($link) == 'H' && checkShengGuanok($link, $id) == '0') { if (checkNowFormYDStatus($link) == 'D' && checkNowFormGStatus($link) == 'H' && checkShengGuanok($link, $id) == '0') {
write_note($link, $id, $user_id, "<em>進入結案階段</em>"); write_note($link, $id, $user_id, "<em>進入生產結案階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-進入生產結案階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-進入生產結案階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['shengguanname'], $data['shengguanmail']]
],
"永佳捷科技"
);
do_wws_next_assign('00000', $form_YD_key, 'Z'); do_wws_next_assign('00000', $form_YD_key, 'Z');
do_wws_next_assign('00000', $form_G_key, 'Z'); do_wws_next_assign('00000', $form_G_key, 'Z');
return true; return true;
@ -970,7 +1192,22 @@ function backMarketingSssign($link, $salesid, $user_id)
if (isset($_GET['id']) || isset($_GET['form_key'])) { if (isset($_GET['id']) || isset($_GET['form_key'])) {
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']); $id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
$form_YD_key = isset($_GET['form_key']) ? $_GET['form_key'] : getYDForm_key($link, $id); $form_YD_key = isset($_GET['form_key']) ? $_GET['form_key'] : getYDForm_key($link, $id);
include "./class/Cmail.php";
$cmail = new Cmail();
$data = getWipwholestatusDetail($link, $id);
$data['salesname'] = accountid2name($data['salesid'])[$data['salesid']];
$data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']];
write_note($link, $id, $user_id, "<em>退回營業階段</em>"); write_note($link, $id, $user_id, "<em>退回營業階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-退回營業階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-退回營業階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['salesname'], $data['salesmail']],
],
"永佳捷科技"
);
do_wws_next_assign($salesid, $form_YD_key, 'A'); do_wws_next_assign($salesid, $form_YD_key, 'A');
} }
} }
@ -981,7 +1218,22 @@ function backDesignssign($link, $user_id)
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']); $id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
$form_YD_key = isset($_GET['form_key']) ? $_GET['form_key'] : getYDForm_key($link, $id); $form_YD_key = isset($_GET['form_key']) ? $_GET['form_key'] : getYDForm_key($link, $id);
} }
include "./class/Cmail.php";
$cmail = new Cmail();
$data = getWipwholestatusDetail($link, $id);
$data['designname'] = accountid2name("M0023")["M0023"];
$data['designmail'] = accountid2email(["M0023"])["M0023"];
write_note($link, $id, $user_id, "<em>退回設計階段</em>"); write_note($link, $id, $user_id, "<em>退回設計階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-退回設計階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-退回設計階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['designname'], $data['designmail']],
],
"永佳捷科技"
);
do_wws_next_assign("M0023", $form_YD_key, 'B'); do_wws_next_assign("M0023", $form_YD_key, 'B');
} }
// 退回至工務階段 // 退回至工務階段
@ -991,6 +1243,21 @@ function backWarehouse($link, $user_id)
$id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']); $id = isset($_GET['id']) ? $_GET['id'] : getId($link, $_GET['form_key']);
$form_YD_key = isset($_GET['form_key']) ? $_GET['form_key'] : getYDForm_key($link, $id); $form_YD_key = isset($_GET['form_key']) ? $_GET['form_key'] : getYDForm_key($link, $id);
} }
include "./class/Cmail.php";
$cmail = new Cmail();
$data = getWipwholestatusDetail($link, $id);
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
write_note($link, $id, $user_id, "<em>退回工務階段</em>"); write_note($link, $id, $user_id, "<em>退回工務階段</em>");
$mail_title = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-退回至工務階段";
$mail_content = "作番大日程(新梯)合約號:" . $data['contractno'] . "作番號:" . $data['facilityno'] . "-退回至工務階段";
$cmail->sendx(
$mail_title,
$mail_content,
[
[$data['gongwokname'], $data['gongwokmail']],
],
"永佳捷科技"
);
do_wws_next_assign(getGongWuokNo($link), $form_YD_key, 'G'); do_wws_next_assign(getGongWuokNo($link), $form_YD_key, 'G');
} }

322
wms/wipwhole-rec-invoice-edit.php

@ -2,7 +2,8 @@
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
/** /**
* (新梯)流程規則: * (新梯)流程規則:
* 1. A:營業員確認中 生管建立大日程 (或是系統洗入) * 1. A:營業員確認中 業務建立大日程 (或是系統洗入)
* 6. I:營業主管確認中
* 2. B:設計部門確認中 (郭承瑋) * 2. B:設計部門確認中 (郭承瑋)
* 3. C:設計部門主管確認中 (N0019江京鴻) * 3. C:設計部門主管確認中 (N0019江京鴻)
* 4. D:生管確認中 (M0024伃廷) * 4. D:生管確認中 (M0024伃廷)
@ -50,6 +51,7 @@ $shengguan2 = getShengguanStatus($link, $user_department_id, $role_id, 2);
$pinzheng = getPinzhengStatus($link, $user_department_id, $role_id); $pinzheng = getPinzhengStatus($link, $user_department_id, $role_id);
// 取得分頁頁碼 // 取得分頁頁碼
$user_department_id;
$tab = getTabNo($user_department_id); $tab = getTabNo($user_department_id);
// 工務助理 // 工務助理
@ -239,6 +241,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<?php <?php
$assign_status_YD = array( $assign_status_YD = array(
'A' => '營業員確認中', 'A' => '營業員確認中',
'I' => '營業部門已確認<br/>營業部門主管確認中',
'B' => '營業部門已確認<br/>設計部門確認中', 'B' => '營業部門已確認<br/>設計部門確認中',
'C' => '營業部門已確認<br/>設計部門主管確認中', 'C' => '營業部門已確認<br/>設計部門主管確認中',
'D' => '營業部門已確認<br/>設計部門主管已確認', 'D' => '營業部門已確認<br/>設計部門主管已確認',
@ -283,9 +286,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
<div id="tabs"> <div id="tabs">
<input class="form-control " type="hidden" name="tab" id='tab' value="<?= $tab; ?>"> <input class="form-control " type="hidden" name="tab" id='tab' value="<?= $tab; ?>">
<ul> <ul>
<li><a href="#tabs-3">工務確認項</a></li>
<li><a href="#tabs-1">營業確認項</a></li> <li><a href="#tabs-1">營業確認項</a></li>
<li><a href="#tabs-2">設計確認項</a></li> <li><a href="#tabs-2">設計確認項</a></li>
<li><a href="#tabs-3">工務確認項</a></li>
<li><a href="#tabs-4">生管確認項</a></li> <li><a href="#tabs-4">生管確認項</a></li>
<li><a href="#tabs-5">品證確認項</a></li> <li><a href="#tabs-5">品證確認項</a></li>
<li><a href="#tabs-6">工務助理確認項</a></li> <li><a href="#tabs-6">工務助理確認項</a></li>
@ -293,6 +296,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
<div id="tabs-1"> <div id="tabs-1">
<table class="table table-bordered" style="width:100%"> <table class="table table-bordered" style="width:100%">
<tbody style="font-weight: bolder;margin-bottom: 20px"> <tbody style="font-weight: bolder;margin-bottom: 20px">
<tr>
<td>營業人員確認項</td>
</tr>
<tr> <tr>
<td style="vertical-align: middle;width:auto;">營業/契約確認規格</td> <td style="vertical-align: middle;width:auto;">營業/契約確認規格</td>
<td style="width:150px;"> <td style="width:150px;">
@ -328,31 +334,31 @@ include "wipwhole-rec-invoice-edit-submit.php";
<br /> <br />
(意匠圖) (意匠圖)
<?php <?php
$result2 = getWipwholeChangePlanningCustomerDetailsStatus($link, $id); // $result2 = getWipwholeChangePlanningCustomerDetailsStatus($link, $id);
$row2 = mysqli_fetch_assoc($result2); // $row2 = mysqli_fetch_assoc($result2);
if (empty($row2['change_status'])) { // if (empty($row2['change_status'])) {
$show_tmp_arr = [ // $show_tmp_arr = [
'311', '312', '313', '314', '315', // '311', '312', '313', '314', '315',
'501', '511', '512', '513', '514', // '501', '511', '512', '513', '514',
'220', '320' // '220', '320'
]; // ];
if (in_array($user_department_id, $show_tmp_arr)) // if (in_array($user_department_id, $show_tmp_arr))
echo "<br/>"; // echo "<br/>";
echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>申請上傳</a>"; // echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>申請上傳</a>";
} else { // } else {
if (in_array($row2['change_status'], ['A', 'B', 'D'])) { // if (in_array($row2['change_status'], ['A', 'B', 'D'])) {
echo "<br/>"; // echo "<br/>";
echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>客戶姓名:" . $row2['custom_name'] . "<br/>狀態:審核中</a>"; // echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>客戶姓名:" . $row2['custom_name'] . "<br/>狀態:審核中</a>";
} // }
if ($row2['change_status'] == 'C') { // if ($row2['change_status'] == 'C') {
echo "<br/>"; // echo "<br/>";
echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>客戶姓名:" . $row2['custom_name'] . "<br/>狀態:已取消</a>"; // echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>客戶姓名:" . $row2['custom_name'] . "<br/>狀態:已取消</a>";
} // }
if ($row2['change_status'] == 'Z') { // if ($row2['change_status'] == 'Z') {
echo "<br/>"; // echo "<br/>";
echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>客戶姓名:" . $row2['custom_name'] . "<br/>狀態:審核通過</a>"; // echo "<a target='_blank' style='color:#00F;' href='wipwhole-change-planning-customer-name.php?function_name=wipwholerenstatus&$token_link&id=$id'>客戶姓名:" . $row2['custom_name'] . "<br/>狀態:審核通過</a>";
} // }
} // }
?> ?>
</td> </td>
<td> <td>
@ -365,13 +371,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
</td> </td>
<td style="vertical-align: middle;">附件</td> <td style="vertical-align: middle;">附件</td>
<td style="vertical-align: middle;"> <td style="vertical-align: middle;">
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" <?php 客戶姓名:<input type="text" name="real_custom_name" id="real_custom_name" style="width:70%;display:inline;" value="<?= $row["real_custom_name"]; ?>" <?= $marketing; ?> placeholder="輸入後即可上傳附件" />
if (isset($row2['change_status'])) { <br />
echo $row2['change_status'] === 'Z' ? "" : "disabled"; <input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled>
} else {
echo "disabled";
}
?>>
<?php <?php
// echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : ""; // echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : "";
?> ?>
@ -505,13 +507,25 @@ include "wipwhole-rec-invoice-edit-submit.php";
<input class="form-control " type="hidden" name="creater" value="<?= $user_id; ?>"> <input class="form-control " type="hidden" name="creater" value="<?= $user_id; ?>">
<input class="form-control " type="hidden" name="create_at" value="<?= $row["create_at"]; ?>"> <input class="form-control " type="hidden" name="create_at" value="<?= $row["create_at"]; ?>">
<?php <?php
if (checkNowFormYDStatus($link) == 'A' && ($user_department_id == 220 || $user_department_id == 311 || $user_department_id == 312 || $user_department_id == 313 || $user_department_id == 314 || $user_department_id == 315)) { if (checkNowFormYDStatus($link) == 'A' && in_array($user_department_id, [220, 311, 312, 313, 314, 315])) {
?>
<button onclick="doMarketingAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">
提交至<?php echo checkUseridIsManager($user_id) ? "設計部門" : "營業主管"; ?>
</button>
<?php
} else if (checkNowFormYDStatus($link) == 'I' && checkUseridIsManager($user_id)) {
?> ?>
<button onclick="doMarketingAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">提交至設計部門</button> <button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">
退回營業
</button>
<button onclick="doMarketingAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">
提交至設計部門
</button>
<?php <?php
} }
?> ?>
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button> <button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -1146,13 +1160,16 @@ include "wipwhole-rec-invoice-edit-submit.php";
<button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button> <button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button>
<?php <?php
} else { } else {
// 生管 小雯 預計到貨日(到觀音廠日)權限 // 生管 小雯 預計到貨日(到觀音廠日)權限
if ($user_id == 'M0168') { // if ($user_id == 'M0168') {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <!-- <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> -->
<?php <?php
} // }
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0060')) {
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0060' || $user_id == 'M0168')) {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button>
<?php <?php
@ -1163,12 +1180,12 @@ include "wipwhole-rec-invoice-edit-submit.php";
} }
} }
} }
if (checkNowFormGStatus($link) == 'H' && ($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5'))) { if (checkNowFormGStatus($link) == 'H' && ($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0168')) {
?> ?>
<button onclick="doBackWarhouseAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回工務部門</button> <button onclick="doBackWarhouseAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回工務部門</button>
<?php <?php
} }
if (checkNowFormYDStatus($link) == 'D' && ($user_department_id == 220 || ($user_department_id == 321 && $ro !== '5'))) { if (checkNowFormYDStatus($link) == 'D' && ($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0168')) {
?> ?>
<button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button> <button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button>
<button onclick="doBackDesignAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回設計部門</button> <button onclick="doBackDesignAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回設計部門</button>
@ -1255,12 +1272,12 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr> <tr>
<td style="vertical-align: middle">QC及官檢類型</td> <td style="vertical-align: middle">QC及官檢類型</td>
<td> <td>
<input type='radio' disabled <?php echo $row['qc_official_type'] == 'Q' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_Q" name='qc_official_type' value='Q' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'Q' ? "checked" : ""; ?> />
<label for='outsourcer_type_I'>只需QC</label> <label for='qc_official_type_Q'>只需QC</label>
<input type='radio' disabled <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_O" name='qc_official_type' value='O' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> />
<label for='outsourcer_type_T'>只需官檢</label> <label for='qc_official_type_O'>只需官檢</label>
<input type='radio' disabled <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_QO" name='qc_official_type' value='QO' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> />
<label for='outsourcer_type_IT'>QC+官檢</label> <label for='qc_official_type_QO'>QC+官檢</label>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -1349,6 +1366,96 @@ include "wipwhole-rec-invoice-edit-submit.php";
(工務助理項目) (工務助理項目)
</td> </td>
</tr> </tr>
<?php
if ($user_id == 'M0193') {
?>
<tr>
<td style="vertical-align: middle">QC及官檢類型</td>
<td>
<input type='radio' id="qc_official_type_Q2" name='qc_official_type2' value='Q' <?= $warehouse2; ?> <?php echo $row['qc_official_type'] == 'Q' ? "checked" : ""; ?> />
<label for='qc_official_type_Q2'>只需QC</label>
<input type='radio' id="qc_official_type_O2" name='qc_official_type2' value='O' <?= $warehouse2; ?> <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> />
<label for='qc_official_type_O2'>只需官檢</label>
<input type='radio' id="qc_official_type_QO2" name='qc_official_type2' value='QO' <?= $warehouse2; ?> <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> />
<label for='qc_official_type_QO2'>QC+官檢</label>
</td>
</tr>
<tr>
<td style="vertical-align: middle">內部QC日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" id="qc_date2" name="qc_date2" value="<?= $row['qc_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#qc_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" id="qc_date2_owner" name="qc_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['qc_date_owner']); ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle">QC合格日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" id="end_qc_date2" name="end_qc_date2" value="<?= $row['end_qc_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#end_qc_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" id="end_qc_date2_owner" name="end_qc_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['end_qc_date_owner']); ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle">官檢日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" id="official_check_date2" name="official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>>
<input type="hidden" id="old_official_check_date2" name="old_official_check_date2" value="<?= $row['official_check_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" id="official_check_date2_owner" name="official_check_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['official_check_date_owner']); ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control disabled_select" type="date" id="delivery_date2" name="delivery_date2" value="<?= $row['delivery_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#delivery_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" id="delivery_date2_owner" name="delivery_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['delivery_date_owner']); ?>
</select>
</td>
</tr>
<?php
}
?>
<tr> <tr>
<td style="vertical-align: middle">發包類型</td> <td style="vertical-align: middle">發包類型</td>
<td> <td>
@ -1522,6 +1629,84 @@ include "wipwhole-rec-invoice-edit-submit.php";
</select> </select>
</td> </td>
</tr> </tr>
<?php
if ($user_id == 'M0193') {
?>
<tr>
<td style="vertical-align: middle">實際安裝開工日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" name="install_start_date2" id="install_start_date2" value="<?= $row['install_start_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#install_start_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" name="install_start_date2_owner" id="install_start_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['install_start_date_owner']); ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle">實際安裝完工日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" name="install_end_date2" id="install_end_date2" value="<?= $row['install_end_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#install_end_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" name="install_end_date2_owner" id="install_end_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['install_end_date_owner']); ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle">實際試車開工日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" name="tryrun_start_date2" id="tryrun_start_date2" value="<?= $row['tryrun_start_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#tryrun_start_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" name="tryrun_start_date2_owner" id="tryrun_start_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['tryrun_start_date_owner']); ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle">實際試車完工日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" name="tryrun_end_date2" id="tryrun_end_date2" value="<?= $row['tryrun_end_date']; ?>" <?= $warehouse2; ?>>
<span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#tryrun_end_date2").val("");' <?= $warehouse2; ?>>清除</button>
</span>
</div>
</td>
<td style="vertical-align: middle">確認人</td>
<td>
<select class="disabled_select" name="tryrun_end_date2_owner" id="tryrun_end_date2_owner" disabled>
<option value="">請選擇</option>
<?php echo getSelectOptionHtml($all_users_options, $row['tryrun_end_date_owner']); ?>
</select>
</td>
</tr>
<?php
}
?>
<tr> <tr>
<td>備註</td> <td>備註</td>
<td colspan="3"> <td colspan="3">
@ -1560,16 +1745,20 @@ include "wipwhole-rec-invoice-edit-submit.php";
</form> </form>
<form method="post" id="assign_form" enctype="multipart/form-data"> <form method="post" id="assign_form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="assign_form" /> <input type="hidden" name='form_name' value="assign_form" />
<input type="hidden" name='id' value="<?php echo $id; ?>" />
</form> </form>
<form method="post" id="back_marketing_assign_form" enctype="multipart/form-data"> <form method="post" id="back_marketing_assign_form" enctype="multipart/form-data">
<input type="hidden" name='salesid' value="<?php echo $row['salesid']; ?>" /> <input type="hidden" name='salesid' value="<?php echo $row['salesid']; ?>" />
<input type="hidden" name='form_name' value="back_marketing_assign_form" /> <input type="hidden" name='form_name' value="back_marketing_assign_form" />
<input type="hidden" name='id' value="<?php echo $id; ?>" />
</form> </form>
<form method="post" id="back_design_assign_form" enctype="multipart/form-data"> <form method="post" id="back_design_assign_form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="back_design_assign_form" /> <input type="hidden" name='form_name' value="back_design_assign_form" />
<input type="hidden" name='id' value="<?php echo $id; ?>" />
</form> </form>
<form method="post" id="warehouse_assign_form" enctype="multipart/form-data"> <form method="post" id="warehouse_assign_form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="warehouse_assign_form" /> <input type="hidden" name='form_name' value="warehouse_assign_form" />
<input type="hidden" name='id' value="<?php echo $id; ?>" />
</form> </form>
<form method="post" id="update_contract_date_form" enctype="multipart/form-data"> <form method="post" id="update_contract_date_form" enctype="multipart/form-data">
<input type="hidden" name="contract_type" value="<?= $row["contract_type"]; ?>"> <input type="hidden" name="contract_type" value="<?= $row["contract_type"]; ?>">
@ -1628,7 +1817,34 @@ include "wipwhole-rec-invoice-edit-submit.php";
var taiwan_item_id = <?php echo empty($taiwan_item_id) ? 0 : $taiwan_item_id; ?>; var taiwan_item_id = <?php echo empty($taiwan_item_id) ? 0 : $taiwan_item_id; ?>;
$(document).ready(function() { $(document).ready(function() {
$('#site_survey_contact_verify').select2(); $('#site_survey_contact_verify').select2();
checkCustomerPlanningVerifyFileKeyinStatus();
checkDeliveryDateKeyinStatus();
}); });
function checkCustomerPlanningVerifyFileKeyinStatus() {
checkCustomerPlanningVerifyFileDisabled();
$("#real_custom_name").keyup(function() {
checkCustomerPlanningVerifyFileDisabled();
});
}
function checkCustomerPlanningVerifyFileDisabled() {
if ($("#real_custom_name").val() !== "") {
$("#customer_planning_verify_file").prop("disabled", false);
} else {
$("#customer_planning_verify_file").prop("disabled", true);
}
}
function checkDeliveryDateKeyinStatus() {
$("#delivery_date").prop("disabled", true);
if ($("#end_qc_date").val() !== "") {
$("#delivery_date").prop("disabled", false);
}
if ($("#official_check_date").val() !== "") {
$("#delivery_date").prop("disabled", false);
}
}
$(function() { $(function() {
$("title").text("合約號:<?php echo $row["contractno"]; ?>作番號:<?php echo $row["facilityno"]; ?>"); $("title").text("合約號:<?php echo $row["contractno"]; ?>作番號:<?php echo $row["facilityno"]; ?>");
var tab = $('#tab').val(); var tab = $('#tab').val();
@ -1653,7 +1869,15 @@ include "wipwhole-rec-invoice-edit-submit.php";
'qc_date', 'qc_date',
'end_qc_date', 'end_qc_date',
'official_check_date', 'official_check_date',
'delivery_date' 'qc_date2',
'end_qc_date2',
'official_check_date2',
'delivery_date',
'delivery_date2',
'install_start_date2',
'install_end_date2',
'tryrun_start_date2',
'tryrun_end_date2',
] ]
for (var i = 0; i < catchTime_input_arr.length; i++) { for (var i = 0; i < catchTime_input_arr.length; i++) {
inputChangeCatchTime(catchTime_input_arr[i]); inputChangeCatchTime(catchTime_input_arr[i]);

1
wms/wipwhole-rec-invoice.php

@ -39,6 +39,7 @@ if ($department_id == "321" || $department_id == "220") {
COUNT(*) COUNT(*)
FROM wipwholestatus FROM wipwholestatus
WHERE facilityno = '$facilityno' WHERE facilityno = '$facilityno'
AND status = '1'
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result); $row = mysqli_fetch_array($result);

49
wms/wipwhole-renovate-index-function.php

@ -1,5 +1,21 @@
<?php <?php
/**
* 取得生管主管 options
* @param object $link:資料庫連線
* @param string $id:作番大日程唯一值
* @return object 回傳 mysqli_query
*/
function getWipwholestatusDetail($link, $id)
{
$db_query = "
SELECT * FROM
wipwholestatus WHERE id = '$id'
";
$receivabledata = mysqli_query($link, $db_query);
return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC);
}
// 取得本次簽核的表單id值 // 取得本次簽核的表單id值
function getId($link, $form_key) function getId($link, $form_key)
{ {
@ -26,7 +42,7 @@ function getForm_key($link, $form_id)
ON f.form_key = s.form_key ON f.form_key = s.form_key
WHERE 1=1 WHERE 1=1
AND f.form_id = '$form_id' AND f.form_id = '$form_id'
AND f.flow_code IN ('A','B','C','D','E') AND f.flow_code IN ('A','B','C','D','E','F')
AND f.system_id = 'wws' AND f.system_id = 'wws'
AND f.flow_id = 'wws02' AND f.flow_id = 'wws02'
"; ";
@ -228,11 +244,12 @@ function getGongWuokNo($link)
// 取得生管部主管編號 // 取得生管部主管編號
function getShengGuanokLeaderNo($link) function getShengGuanokLeaderNo($link)
{ {
return "M0079";
$sql = " $sql = "
SELECT accountid SELECT accountid
FROM `account` FROM `account`
WHERE `department_id` = '321' WHERE `department_id` = '250'
AND `role_id` = '1'; AND `role_id` = '4';
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result); $row = mysqli_fetch_array($result);
@ -334,7 +351,7 @@ function getEditFlag($department_id, $role_id, $user_id)
if ($department_id == "321") if ($department_id == "321")
return 8; return 8;
if ($department_id == "250" && in_array($role_id, ["1", "4"])) if ($department_id == "250")
return 8; return 8;
if ($department_id == "320" && $role_id == "1") if ($department_id == "320" && $role_id == "1")
return 8; return 8;
@ -370,6 +387,10 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$contract_type = 'B'; $contract_type = 'B';
// 營業員主管或營業員 // 營業員主管或營業員
@ -427,7 +448,7 @@ function getDataSql($department_id, $role_id, $user_id)
"; ";
return $sql; return $sql;
} }
if ($department_id == '314' && (in_array($role_id, ['2']))) { if ($department_id == '314' && (in_array($role_id, ['1', '2']))) {
$sql = " $sql = "
SELECT * FROM wipwholestatus SELECT * FROM wipwholestatus
WHERE 1=1 WHERE 1=1
@ -545,6 +566,10 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$contract_type = 'B'; $contract_type = 'B';
// 營業員主管或營業員 // 營業員主管或營業員
@ -809,7 +834,8 @@ function getWarehouseStatus($link, $user_department_id, $role_id, $status)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
return ""; return "";
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) { // if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
if(getSaveEstimateInstallData($user_department_id, $role_id)){
if ($status == 1) { if ($status == 1) {
return checkNowFormStatus($link) == 'A' ? "" : "disabled"; return checkNowFormStatus($link) == 'A' ? "" : "disabled";
} else { } else {
@ -818,6 +844,7 @@ function getWarehouseStatus($link, $user_department_id, $role_id, $status)
} }
return "disabled"; return "disabled";
} }
function getMarketingStatus($link, $user_department_id, $role_id, $status) function getMarketingStatus($link, $user_department_id, $role_id, $status)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
@ -1055,7 +1082,7 @@ function getSaveEstimateInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '521' && in_array($role_id, ['11', '9', '12'])) if ($user_department_id == '521' && in_array($role_id, ['11', '9', '12']))
return true; return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6'])) if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '6']))
return true; return true;
@ -1072,11 +1099,11 @@ function getSaveInstallDataButtonStatus($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '521' && $role_id == '9') if ($user_department_id == '521' && $role_id == '9')
return true; return true;
if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6'])) if ($user_department_id == '542' && in_array($role_id, ['1', '5', '6', '8']))
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6']))
return true; return true;
if ($user_department_id == '545' && in_array($role_id, ['3', '6'])) if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true; return true;
@ -1105,9 +1132,9 @@ function getAllCustomerPlanningVerify($link, $id)
{ {
$sql = " $sql = "
SELECT SELECT
custom AS custom_name, real_custom_name AS custom_name,
customer_planning_verify_file, customer_planning_verify_file,
create_at date_format(customer_planning_verify_at, '%Y-%m-%d %H:%i:%s') AS create_at
FROM wipwholestatus FROM wipwholestatus
WHERE id = $id WHERE id = $id
AND customer_planning_verify_file != '' AND customer_planning_verify_file != ''

15
wms/wipwhole-renovate-index-table-html.php

@ -1,13 +1,4 @@
<?php <?php
$tableArr = array(
"All" => "table_index2",
"A" => "table_index3",
"B" => "table_index4",
"C" => "table_index5",
"D" => "table_index6",
"Z" => "table_index7"
);
// 暫時可編輯及刪除權限 // 暫時可編輯及刪除權限
$update_delete_status = false; $update_delete_status = false;
if (in_array($user_id, ['M0175', 'M0079'])) { if (in_array($user_id, ['M0175', 'M0079'])) {
@ -15,7 +6,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
} }
?> ?>
<table id="<?php echo $tableArr[$key]; ?>" class="table table-striped table-bordered dt-responsive nowrap" style="width:98.5%"> <table id="table_index2" class="table table-striped table-bordered dt-responsive nowrap" style="width:98.5%">
<thead> <thead>
<tr> <tr>
<?php <?php
@ -42,7 +33,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
</thead> </thead>
<tbody> <tbody>
<?php <?php
foreach ($dataDetailsArr as $key => $data) : foreach ($data as $key => $data) :
//規格 //規格
$Specification = $data['facility_kind']; $Specification = $data['facility_kind'];
@ -146,7 +137,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
<td><?php echo $data['facilityno']; ?></td> <td><?php echo $data['facilityno']; ?></td>
<td><?php echo $data['custom']; ?></td> <td><?php echo $data['custom']; ?></td>
<td><?php echo $Specification; ?></td> <td><?php echo $Specification; ?></td>
<td><?php echo $data['address']; ?></td> <td><?php echo empty($data['real_address']) ? $data['address'] : $data['real_address']; ?></td>
<?php <?php
foreach ($site_survey_status as $key => $val) { foreach ($site_survey_status as $key => $val) {
if ((string)$data['site_survey_contact_verify'] == (string)$key) { if ((string)$data['site_survey_contact_verify'] == (string)$key) {

176
wms/wipwhole-renovate-index.php

@ -1,3 +1,9 @@
<div id="loadingOverlay" class="hidden">
<div class="loading-icon"></div>
</div>
<script>
document.getElementById('loadingOverlay').classList.remove('hidden');
</script>
<?php <?php
// ini_set('display_errors', 'on'); // ini_set('display_errors', 'on');
/** /**
@ -22,8 +28,9 @@ include "wipwhole-renovate-index-function.php";
include "css/view/wipwhole-renovate-index.php"; include "css/view/wipwhole-renovate-index.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'del_form') { $form_name = empty($_REQUEST['form_name']) ? null : $_REQUEST['form_name'];
$del_seq = $_POST['del_seq']; $del_seq = empty($_REQUEST['del_seq']) ? null : $_REQUEST['del_seq'];
if ($form_name == 'del_form') {
$sql = "UPDATE wipwholestatus SET status = '0' WHERE id = '$del_seq' "; $sql = "UPDATE wipwholestatus SET status = '0' WHERE id = '$del_seq' ";
mysqli_query($link, $sql); mysqli_query($link, $sql);
} }
@ -33,9 +40,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$numberOfDaysToAdd = 45; $numberOfDaysToAdd = 45;
$futureDate = date("Y/m/d", strtotime(date("Y-m-d") . " +{$numberOfDaysToAdd} days")); $futureDate = date("Y/m/d", strtotime(date("Y-m-d") . " +{$numberOfDaysToAdd} days"));
// 主資料陣列
$data = array();
// 取得當前使用者所屬部門 // 取得當前使用者所屬部門
$department_id = getDepartmentId($link, $user_id); $department_id = getDepartmentId($link, $user_id);
// 取得當前使用者所屬職位 // 取得當前使用者所屬職位
@ -53,31 +57,25 @@ $site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ?
$real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start']; $real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start'];
$real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end']; $real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end'];
$area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no']; $area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no'];
$sheetNum = empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum'];
$tableArr = array(
"All" => "",
"A" => "A",
"B" => "B",
"C" => "C",
"D" => "D",
"Z" => "Z"
);
if (empty($sheetNum) || $sheetNum == "All") {
// 取得資料 sql
$sql = getDataSql($department_id, $role_id, $user_id); $sql = getDataSql($department_id, $role_id, $user_id);
} else {
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, $tableArr[$sheetNum]);
}
// 取得資料 sql
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// 取得資料(工勘部門階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "A");
$dataA = mysqli_query($link, $sql);
// 取得資料(營業部門階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "B");
$dataB = mysqli_query($link, $sql);
// 取得資料(設計部門階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "C");
$dataC = mysqli_query($link, $sql);
// 取得資料(生管階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "D");
$dataD = mysqli_query($link, $sql);
// 取得資料(結案階段) sql
$sql = getDataSqlByflowCode($department_id, $role_id, $user_id, "Z");
$dataZ = mysqli_query($link, $sql);
?> ?>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
@ -201,6 +199,7 @@ $dataZ = mysqli_query($link, $sql);
</div> </div>
<nav class="navbar navbar-tabs" style="margin:0;margin-top:5px;"> <nav class="navbar navbar-tabs" style="margin:0;margin-top:5px;">
<div class="container-fluid"> <div class="container-fluid">
<div class="col-md-9 col-12">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"> <li class="active">
<a href="#" onclick="showAllTable()">全部資料</a> <a href="#" onclick="showAllTable()">全部資料</a>
@ -222,24 +221,85 @@ $dataZ = mysqli_query($link, $sql);
</li> </li>
</ul> </ul>
</div> </div>
<div class="col-md-3 col-12 text-right" id="myBtn">
<button class="btn btn-primary " type="button">欄位維護權限</button>
</div>
</div>
</nav> </nav>
<div id="myModal" class="modal">
<div class="back"></div>
<div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'>
<h3>欄位維護權限</h3>
<hr>
<div class='row'>
<div class='col-12'>
<table class="table table-bordered" style="width:50%; margin:0 auto;">
<tr>
<th style="text-align:right;">欄位</th>
<th style="text-align:left;">維護單位</th>
</tr>
<tr>
<td style="text-align:right;">合約號</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">電梯編號</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">客戶姓名</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">規格</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">地址</td>
<td style="text-align:left;">業務部(營業人員 or 工勘人員透過申請單)</td>
</tr>
<tr>
<td style="text-align:right;">工勘狀態</td>
<td style="text-align:left;">工勘人員</td>
</tr>
<tr>
<td style="text-align:right;">合約交期(到工地)</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">下單日(普來特富)</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">預計到廠日(觀音廠)</td>
<td style="text-align:left;">生管部門</td>
</tr>
<tr>
<td style="text-align:right;">實際到廠日(觀音廠)</td>
<td style="text-align:left;">生管部門</td>
</tr>
<tr>
<td style="text-align:right;">預計出貨日(到工地)</td>
<td style="text-align:left;">業務部(營業人員 or 工勘人員透過申請單)</td>
</tr>
<tr>
<td style="text-align:right;">實際出貨日(到工地)</td>
<td style="text-align:left;">生管部門</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<?php <?php
$dataArr = array(
"All" => $data, echo "<div id='data_detail_table_div' class='data_table_div' style='overflow-x:auto;'>";
"A" => $dataA,
"B" => $dataB,
"C" => $dataC,
"D" => $dataD,
"Z" => $dataZ
);
foreach ($dataArr as $key => $val) {
if ($val) :
$dataDetailsArr = $val;
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-renovate-index-table-html.php"; include "wipwhole-renovate-index-table-html.php";
echo "</div>"; echo "</div>";
endif;
}
#結束連線 #結束連線
mysqli_close($link); mysqli_close($link);
@ -261,14 +321,14 @@ mysqli_close($link);
} }
</style> </style>
<script> <script>
var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>"; var sheetNum = "<?php echo $sheetNum; ?>";
$(document).ready(function() { $(document).ready(function() {
$('#site_survey_contact_verify').select2(); $('#site_survey_contact_verify').select2();
}); });
$(function() { $(function() {
$(".data_table_div").hide();
showTable(sheetNum); showTable(sheetNum);
document.getElementById('loadingOverlay').classList.add('hidden');
}) })
const formData = new FormData(); const formData = new FormData();
@ -413,18 +473,11 @@ mysqli_close($link);
"D": "5", "D": "5",
"Z": "6", "Z": "6",
} }
$("body > nav.navbar.navbar-tabs > div > ul > li").attr("class", ""); $("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("body > nav.navbar.navbar-tabs > div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active"); $("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
$(".data_table_div").hide();
$("#data_" + code + "_table_div").show();
} }
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋"; document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index3_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index4_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index5_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index6_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index7_filter > label > input").placeholder = "快速搜尋";
// datatable 畫面重整後保留資料 // datatable 畫面重整後保留資料
@ -444,7 +497,7 @@ mysqli_close($link);
var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>"; var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>";
var dataArr2 = { var dataArr2 = {
"All": "table_index2", "All": "",
"A": "table_index3", "A": "table_index3",
"B": "table_index4", "B": "table_index4",
"C": "table_index5", "C": "table_index5",
@ -453,7 +506,7 @@ mysqli_close($link);
} }
var table = $('#' + dataArr2[sheetNum]).DataTable(); var table = $('#table_index2').DataTable();
// 设置排序信息 // 设置排序信息
if (orderColumn !== '' && orderDirection !== '') { if (orderColumn !== '' && orderDirection !== '') {
@ -482,7 +535,7 @@ mysqli_close($link);
}); });
// 監聽搜尋事件 // 監聽搜尋事件
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() { $("#table_index2_filter > label > input").change(function() {
searchDatatable(table); searchDatatable(table);
}); });
@ -504,6 +557,21 @@ mysqli_close($link);
$("#del_form").submit(); $("#del_form").submit();
} }
</script> </script>
<script>
var modal = document.getElementById("myModal");
$("#myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
console.log(e.target);
$("#myModal").hide();
// modal.style.display = "none"
});
$(".back").click(function(e) {
$("#myModal").hide();
// modal.style.display = "none"
});
</script>
<form id='del_form' method='post'> <form id='del_form' method='post'>
<input type='hidden' id='del_seq' name='del_seq' value='' /> <input type='hidden' id='del_seq' name='del_seq' value='' />
<input type='hidden' id='form_name' name='form_name' value='del_form' /> <input type='hidden' id='form_name' name='form_name' value='del_form' />

1
wms/wipwhole-renovate-rec-invoice.php

@ -41,6 +41,7 @@ if ($department_id == "321" || $department_id == "220") {
COUNT(*) COUNT(*)
FROM wipwholestatus FROM wipwholestatus
WHERE facilityno = '$facilityno' WHERE facilityno = '$facilityno'
AND status = '1'
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result); $row = mysqli_fetch_array($result);

16
wms/wipwholeinstall-index-table-html.php

@ -6,7 +6,8 @@
<th style="vertical-align: middle;text-align:center;width:250px;">合約地址</th> <th style="vertical-align: middle;text-align:center;width:250px;">合約地址</th>
<th style="vertical-align: middle;text-align:center;width:250px;">地工地址</th> <th style="vertical-align: middle;text-align:center;width:250px;">地工地址</th>
<th style="vertical-align: middle;text-align:center;width:140px;">警示</th> <th style="vertical-align: middle;text-align:center;width:140px;">警示</th>
<th style="vertical-align: middle;text-align:center;width:140px;">預計出貨日</th> <th style="text-align:center;width:100px;">實際到廠日(觀音廠)</th>
<th style="text-align:center;width:100px;">預計出貨日(到工地)</th>
<th style="vertical-align: middle;text-align:center;width:140px;">發包廠商(工勘)</th> <th style="vertical-align: middle;text-align:center;width:140px;">發包廠商(工勘)</th>
<th style="vertical-align: middle;text-align:center;width:140px;">發包日期(工勘)</th> <th style="vertical-align: middle;text-align:center;width:140px;">發包日期(工勘)</th>
<th style="vertical-align: middle;text-align:center;width:140px;">預計開工日(工勘)</th> <th style="vertical-align: middle;text-align:center;width:140px;">預計開工日(工勘)</th>
@ -56,7 +57,18 @@
<td><?php echo $data['address']; ?></td> <td><?php echo $data['address']; ?></td>
<td><?php echo $data['real_address']; ?></td> <td><?php echo $data['real_address']; ?></td>
<td style="text-align:left;"><span class="text-danger"><?php echo warningMessage($data); ?></span></td> <td style="text-align:left;"><span class="text-danger"><?php echo warningMessage($data); ?></span></td>
<td><?php echo substr($data['real_contract_arrival_date'], 0, 10); ?></td> <td>
<?php
if (!empty($data['actual_tofactory_date']))
echo date("Y/m/d", strtotime($data['actual_tofactory_date']));
?>
</td>
<td>
<?php
if (!empty($data['real_contract_arrival_date']))
echo date("Y/m/d", strtotime(substr($data['real_contract_arrival_date'], 0, 10)));
?>
</td>
<?php <?php
// foreach ($site_survey_status as $key => $val) { // foreach ($site_survey_status as $key => $val) {
// if ((string)$data['site_survey_contact_verify'] == (string)$key) { // if ((string)$data['site_survey_contact_verify'] == (string)$key) {

17
wms/wipwholeinstall-renovate-index-table-html.php

@ -7,7 +7,8 @@
<th style="vertical-align: middle;text-align:center;width:250px;">合約地址</th> <th style="vertical-align: middle;text-align:center;width:250px;">合約地址</th>
<th style="vertical-align: middle;text-align:center;width:250px;">地工地址</th> <th style="vertical-align: middle;text-align:center;width:250px;">地工地址</th>
<th style="vertical-align: middle;text-align:center;width:250px;">警示</th> <th style="vertical-align: middle;text-align:center;width:250px;">警示</th>
<th style="vertical-align: middle;text-align:center;width:140px;">預計出貨日</th> <th style="text-align:center;width:100px;">實際到廠日(觀音廠)</th>
<th style="text-align:center;width:100px;">預計出貨日(到工地)</th>
<th style="vertical-align: middle;text-align:center;width:140px;">發包廠商(工勘)</th> <th style="vertical-align: middle;text-align:center;width:140px;">發包廠商(工勘)</th>
<th style="vertical-align: middle;text-align:center;width:140px;">發包日期(工勘)</th> <th style="vertical-align: middle;text-align:center;width:140px;">發包日期(工勘)</th>
<th style="vertical-align: middle;text-align:center;width:140px;">預計開工日(工勘)</th> <th style="vertical-align: middle;text-align:center;width:140px;">預計開工日(工勘)</th>
@ -39,7 +40,18 @@
<td><?php echo $data['address']; ?></td> <td><?php echo $data['address']; ?></td>
<td><?php echo $data['real_address']; ?></td> <td><?php echo $data['real_address']; ?></td>
<td style="text-align:left;"><span class="text-danger"><?php echo warningMessage($data); ?></span></td> <td style="text-align:left;"><span class="text-danger"><?php echo warningMessage($data); ?></span></td>
<td><?php echo substr($data['real_contract_arrival_date'], 0, 10); ?></td> <td>
<?php
if (!empty($data['actual_tofactory_date']))
echo date("Y/m/d", strtotime($data['actual_tofactory_date']));
?>
</td>
<td>
<?php
if (!empty($data['real_contract_arrival_date']))
echo date("Y/m/d", strtotime(substr($data['real_contract_arrival_date'], 0, 10)));
?>
</td>
<?php <?php
// foreach ($site_survey_status as $key => $val) { // foreach ($site_survey_status as $key => $val) {
// if ((string)$data['site_survey_contact_verify'] == (string)$key) { // if ((string)$data['site_survey_contact_verify'] == (string)$key) {
@ -181,7 +193,6 @@
</tbody> </tbody>
</table> </table>
<script> <script>
const subContentDiv = document.createElement("div"); const subContentDiv = document.createElement("div");
subContentDiv.style.position = "relative"; subContentDiv.style.position = "relative";
subContentDiv.style.top = 0; subContentDiv.style.top = 0;

Loading…
Cancel
Save