Browse Source

1.修正安裝大日程 edit 按鈕

2.出貨日調整單 地址新增縣市下拉式選單
3.出貨地區預定明細 新增全部作番 的表
4.index 狀態新增營業經理確認中 的選項
5.大日程新增 林靜雯 檢視權限
gary
gary_chen\gary_chen 1 year ago
parent
commit
b4b5778f16
  1. 1
      .gitignore
  2. 143
      wms/estimated_shipping_date_report.php
  3. 20
      wms/wipwhole-change-contractdate-function.php
  4. 3
      wms/wipwhole-change-contractdate-submit.php
  5. 8
      wms/wipwhole-change-contractdate.php
  6. 9
      wms/wipwhole-index-function.php
  7. 20
      wms/wipwhole-index.php
  8. 6
      wms/wipwhole-rec-invoice-edit.php
  9. 23
      wms/wipwhole-renovate-index-function.php
  10. 18
      wms/wipwhole-renovate-index.php
  11. 6
      wms/wipwhole-renovate-rec-invoice-edit.php
  12. 2
      wms/wipwholeinstall-index-function.php
  13. 2
      wms/wipwholeinstall-renovate-index-function.php

1
.gitignore

@ -25,3 +25,4 @@ wms/mkt/WriteOffRepair.xlsx
wms/contract/images/contracts
wms/test.php
app/account_log/
wms/gary2.php

143
wms/estimated_shipping_date_report.php

@ -148,6 +148,27 @@ while ($row = $result->fetch_assoc()) {
$data2[] = $row;
}
$sql = "
SELECT
new_order.facility_kind,
COUNT(new_order.facility_kind) AS facility_count
FROM(
SELECT
w.facility_kind
FROM wipwholestatus AS w
WHERE 1=1
AND status = '1'
AND contract_type = 'A'
) AS new_order
WHERE 1 = 1
GROUP BY new_order.facility_kind
";
$result = mysqli_query($link, $sql);
$data4 = [];
while ($row = $result->fetch_assoc()) {
$data4[] = $row;
}
function findFacilityTypeAllCount($data2)
{
$count = 0;
@ -187,6 +208,20 @@ while ($row = $result->fetch_assoc()) {
$data3[] = $row;
}
$sql = "
SELECT
w.renovate_type
FROM wipwholestatus AS w
WHERE 1=1
AND status = '1'
AND contract_type = 'B'
";
$result = mysqli_query($link, $sql);
$data5 = [];
while ($row = $result->fetch_assoc()) {
$data5[] = $row;
}
// 分開計算
// $M1 = 0;
@ -222,6 +257,16 @@ foreach ($data3 as $row) {
$m_type_arr[implode("+", json_decode($row['renovate_type']))]++;
}
$M_count2 = count($data5);
$m_type_arr2 = [];
$m_type_arr2[''] = 0;
foreach ($data5 as $row) {
$m_type_arr2[implode("+", json_decode($row['renovate_type']))] = 0;
}
foreach ($data5 as $row) {
$m_type_arr2[implode("+", json_decode($row['renovate_type']))]++;
}
//數字轉英文(0=>A、1=>B、26=>AA...以此類推)
function num2alpha($n)
@ -1183,13 +1228,13 @@ if($_SERVER["REQUEST_METHOD"] == 'POST'){
</table>
</div>
<br /><br />
<div class="row">
<div class="col-12 col-md-8">
<table class="table table-striped">
<thead>
<tr>
<td colsapn="<?php echo count($data2); ?>">受定規格分析</td>
<td colsapn="<?php echo count($data2); ?>">受定規格分析(時間區間)</td>
</tr>
</thead>
<tbody>
@ -1233,13 +1278,12 @@ if($_SERVER["REQUEST_METHOD"] == 'POST'){
</table>
</div>
<br /><br />
<div class="col-12 col-md-4">
<table class="table table-striped">
<thead>
<tr>
<td>舊改受訂規格分析</td>
<td colspan='3'>舊改受訂規格分析(時間區間)</td>
</tr>
</thead>
<tbody>
@ -1274,6 +1318,97 @@ if($_SERVER["REQUEST_METHOD"] == 'POST'){
</tbody>
</table>
</div>
</div>
<br /><br />
<div class="row">
<div class="col-12 col-md-8">
<table class="table table-striped">
<thead>
<tr>
<td colsapn="<?php echo count($data4); ?>">受定規格分析(全部)</td>
</tr>
</thead>
<tbody>
<tr>
<th>代碼</th>
<?php
foreach ($data4 as $row) {
echo "<td>" . $row['facility_kind'] . "</td>";
}
?>
<th></th>
</tr>
<tr>
<th>機種</th>
<?php
foreach ($data4 as $row) {
echo "<td>" . getFacilityNamebyType($row['facility_kind']) . "</td>";
}
?>
<th>合計</th>
</tr>
<tr>
<th>數量</th>
<?php
foreach ($data4 as $row) {
echo "<td>" . $row['facility_count'] . "</td>";
}
?>
<th><?php echo findFacilityTypeAllCount($data4); ?></th>
</tr>
<tr>
<th>百分比</th>
<?php
foreach ($data4 as $row) {
echo "<td>" . (round($row['facility_count'] / findFacilityTypeAllCount($data4), 4) * 100) . "%" . "</td>";
}
?>
<th><?php echo "100%"; ?></th>
</tr>
</tbody>
</table>
</div>
<div class="col-12 col-md-4">
<table class="table table-striped">
<thead>
<tr>
<td colspan='3'>舊改受訂規格分析(全部)</td>
</tr>
</thead>
<tbody>
<tr>
<th>類型</th>
<?php
foreach ($m_type_arr2 as $key => $val) {
$title_tmp = empty($key) ? '未分類' : $key;
echo "<th>" . $title_tmp . "</th>";
}
?>
<th>合計</th>
</tr>
<tr>
<th>數量</th>
<?php
foreach ($m_type_arr2 as $key => $val) {
echo "<th>" . $val . "</th>";
}
?>
<th><?php echo $M_count2; ?></th>
</tr>
<tr>
<th>百分比</th>
<?php
foreach ($m_type_arr2 as $key => $val) {
echo "<th>" . round($val / $M_count2, 4) * 100 . "%" . "</th>";
}
?>
<th>100%</th>
</tr>
</tbody>
</table>
</div>
</div>
<script>
const formData = new FormData();
formData.append("start_month", $("#start_month").val());

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

@ -674,3 +674,23 @@ function checkStatus($link, $cid, $user_id)
$res = mysqli_query($link, $sql);
return $res->num_rows > 0 ? false : true;
}
/**
* 取台灣縣市select
* @param object $link:資料庫連線
* @return object 回傳 mysqli_fetch_all
*/
function getCity($link)
{
$sql = "
SELECT
content,
code_name
FROM code
WHERE field_name = 'taiwan_city'
";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
mysqli_free_result($result);
return $data;
}

3
wms/wipwhole-change-contractdate-submit.php

@ -8,7 +8,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$all_contractno_change = empty($_POST['all_contractno_change']) ? null : $_POST['all_contractno_change'];
$real_contract_arrival_date = $_POST['real_contract_arrival_date'];
$contract_arrival_date = $_POST['contract_arrival_date'];
$real_address = $_POST['real_address'];
$city = $_POST['city'];
$real_address = $city.$_POST['real_address'];
$old_real_address = $_POST['old_real_address'];
$estimated_shipping_schedule_date = $_POST['estimated_shipping_schedule_date'];
$contractno = $_POST['contractno'];

8
wms/wipwhole-change-contractdate.php

@ -283,7 +283,13 @@ if (!empty(checkNowFormStatus($link)))
<td colspan="3">
<?php
if (empty(checkNowFormStatus($link))) {
echo "<input type='text' name='real_address' />";
echo "<select id='city' name='city' required>";
$citys = getCity($link);
print_r($citys);
foreach ($citys as $city)
echo "<option value='" . $city['content'] . "'>" . $city['content'] . "</option>";
echo "</select>";
echo "<input type='text' id='real_address' name='real_address' />";
} else {
echo $row2["real_address"];
echo "<input type='hidden' name='real_address' value='" . $row2["real_address"] . "' />";

9
wms/wipwhole-index-function.php

@ -147,11 +147,20 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
// 補丁 許馨文 權限 = 李烘銘
if (in_array($user_id, ['M0115'])) {
$user_id = 'M0086';
}
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
// 補丁 林靜雯 權限 = 劉永德 新梯 北區+桃竹
if (in_array($user_id, ['M0189'])) {
$user_id = 'M0137';
}
$sql_cmd = sql_myself($user_id, "salesid");
$sql = "
SELECT * FROM wipwholestatus $sql_cmd

20
wms/wipwhole-index.php

@ -67,7 +67,8 @@ $tableArr = array(
"B" => "B",
"G" => "G",
"CH" => "C,H",
"Z" => "Z"
"Z" => "Z",
"I" => "I",
);
if (empty($sheetNum) || $sheetNum == "All") {
@ -212,6 +213,9 @@ $data = mysqli_query($link, $sql);
<li>
<a href="#" onclick="showATable()">營業確認中</a>
</li>
<li>
<a href="#" onclick="showITable()">營業主管確認中</a>
</li>
<li>
<a href="#" onclick="showBTable()">設計確認中</a>
</li>
@ -433,14 +437,20 @@ mysqli_close($link);
window.location.href = "<?php echo "wipwhole-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
}
function showITable() {
sheetNum = "I";
window.location.href = "<?php echo "wipwhole-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
}
function showTable(code) {
var tmp_arr = {
"All": "1",
"A": "2",
"B": "3",
"G": "4",
"CH": "5",
"Z": "6",
"I": "3",
"B": "4",
"G": "5",
"CH": "6",
"Z": "7",
}
$("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");

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

@ -158,6 +158,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
521, 531, 220, 250,
541, 542, 543, 544, 545
];
if ($user_id !== 'M0115')
if (in_array($user_department_id, $show_tmp_arr))
echo "<a target='_blank' href='wipwhole-change-contractdate.php?function_name=wipwholerenstatus&$token_link&id=$id'>工地地址調整</a>";
?>
@ -227,6 +228,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
521, 531, 220, 250,
541, 542, 543, 544, 545
];
if ($user_id !== 'M0115')
if (in_array($user_department_id, $show_tmp_arr))
echo "<a target='_blank' href='wipwhole-change-contractdate.php?function_name=wipwholerenstatus&$token_link&id=$id'>出貨日調整</a>";
?>
@ -507,6 +509,7 @@ 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="create_at" value="<?= $row["create_at"]; ?>">
<?php
if ($user_id !== 'M0115') {
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;">
@ -526,6 +529,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
?>
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span>
<?php
}
?>
</td>
</tr>
</tbody>

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

@ -387,6 +387,12 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086';
}
// 補丁 許馨文 權限 = 李烘銘
if (in_array($user_id, ['M0115'])) {
$user_id = 'M0086';
}
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
@ -407,6 +413,18 @@ function getDataSql($department_id, $role_id, $user_id)
$sql .= getWipwholeSearchSql();
$sql .= "ORDER BY real_contract_arrival_date DESC ";
// 補丁 林靜雯 權限 = 劉永德 新梯 桃竹
if($user_id == 'M0189'){
$sql_cmd = sql_myself("M0137", "salesid");
$sql = "
SELECT * FROM wipwholestatus $sql_cmd
";
$sql .= empty($sql_cmd) ? " WHERE 1=1 AND status = '1' AND contract_type = '$contract_type' " : " AND status = '1' AND contract_type = '$contract_type'";
$sql .= getWipwholeSearchSql();
$sql .= "ORDER BY real_contract_arrival_date DESC ";
return $sql;
}
if (in_array($department_id, $department_arr)) {
// 北區營銷部 營銷專案經理 311 1
// 新梯營銷經理 311 3
@ -414,8 +432,7 @@ function getDataSql($department_id, $role_id, $user_id)
// 中區營銷部 新梯營銷經理 313 1
// 南區營銷部 銷售專案經理 314 2
// 花東區營銷部 營銷專案經理 315 1
if ($department_id == '311' && (in_array($role_id, ['1', '3'])) || $user_id = "M0013") {
if (($department_id == '311' && in_array($role_id, ['1', '3'])) || $user_id == "M0013") {
$sql = "
SELECT * FROM wipwholestatus
WHERE 1=1
@ -426,6 +443,7 @@ function getDataSql($department_id, $role_id, $user_id)
";
return $sql;
}
if ($department_id == '312' && (in_array($role_id, ['1']))) {
$sql = "
SELECT * FROM wipwholestatus
@ -556,6 +574,7 @@ function getDataSql($department_id, $role_id, $user_id)
";
return $sql;
}
return $sql;
}

18
wms/wipwhole-renovate-index.php

@ -65,7 +65,8 @@ $tableArr = array(
"B" => "B",
"C" => "C",
"D" => "D",
"Z" => "Z"
"Z" => "Z",
"F" => "F",
);
if (empty($sheetNum) || $sheetNum == "All") {
@ -210,6 +211,9 @@ $data = mysqli_query($link, $sql);
<li>
<a href="#" onclick="showBTable()">營業確認中</a>
</li>
<li>
<a href="#" onclick="showFTable()">營業主管確認中</a>
</li>
<li>
<a href="#" onclick="showCTable()">設計確認中</a>
</li>
@ -444,6 +448,11 @@ mysqli_close($link);
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
}
function showFTable() {
sheetNum = "F";
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
}
function showBTable() {
sheetNum = "B";
window.location.href = "<?php echo "wipwhole-renovate-index.php?function_name=wipinstall&$token_link"; ?>" + "&sheetNum=" + sheetNum;
@ -469,9 +478,10 @@ mysqli_close($link);
"All": "1",
"A": "2",
"B": "3",
"C": "4",
"D": "5",
"Z": "6",
"F": "4",
"C": "5",
"D": "6",
"Z": "7",
}
$("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");

6
wms/wipwhole-renovate-rec-invoice-edit.php

@ -154,6 +154,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">預計交期(到工地)
<br />
<?php
if ($user_id !== 'M0115')
if (getWipwholeChangeButtonStatus($user_department_id))
echo "<a target='_blank' href='wipwhole-change-contractdate.php?function_name=wipwholerenstatus&$token_link&id=$id'>出貨日調整</a>";
?>
@ -177,6 +178,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
</td>
<td style="vertical-align: middle">工地地址<br />
<?php
if ($user_id !== 'M0115')
if (getWipwholeChangeButtonStatus($user_department_id))
echo "<a target='_blank' href='wipwhole-change-contractdate.php?function_name=wipwholerenstatus&$token_link&id=$id'>工地地址調整</a>";
?>
@ -709,6 +711,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<input class="form-control " type="hidden" name="creater" value="<?= $user_id; ?>">
<input class="form-control " type="hidden" name="create_at" value="<?= $row["create_at"]; ?>">
<?php
if ($user_id !== 'M0115') {
if (checkNowFormStatus($link) == 'B' && in_array($user_department_id, [220, 311, 312, 313, 314, 315, 511, 512, 513, 514])) {
?>
<button onclick="doMarketingAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">
@ -727,6 +730,9 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
?>
<button onclick="savedata()" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;" <?= $marketing2; ?>>存檔</button>
<span class="text-danger pull-right">若無工勘資料請勿移交至設計階段!</span>
<?php
}
?>
</td>
</tr>
</tbody>

2
wms/wipwholeinstall-index-function.php

@ -92,7 +92,7 @@ function getEditFlag($department_id, $role_id, $user_id)
return 4;
// 設計
if ($department_id == "911")
return 2;
return 4;
// 宜蘭工務
if ($user_id == 'M0087')
return 4;

2
wms/wipwholeinstall-renovate-index-function.php

@ -92,7 +92,7 @@ function getEditFlag($department_id, $role_id, $user_id)
return 4;
// 設計
if ($department_id == "911")
return 2;
return 4;
// 品証
if ($department_id == "912")
return 4;

Loading…
Cancel
Save