9 changed files with 1119 additions and 147 deletions
@ -1,95 +1,302 @@ |
|||||
|
<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语法)将结果存在变数中 |
$result = mysqli_query($link, $db_query); |
||||
$data = mysqli_query($link, $db_query); |
$data = mysqli_fetch_assoc($result); |
||||
|
mysqli_free_result($result); |
||||
|
|
||||
foreach($data as $data) : |
$db_query = " |
||||
//$link_content = str_replace(',', PHP_EOL, $data['link_content']); |
SELECT * FROM department |
||||
?> |
ORDER BY department_id ASC |
||||
<script> |
"; |
||||
$(function () { |
$result = mysqli_query($link, $db_query); |
||||
|
$data2 = mysqli_fetch_all($result, MYSQLI_ASSOC); |
||||
|
mysqli_free_result($result); |
||||
|
|
||||
}); |
//$link_content = str_replace(',', PHP_EOL, $data['link_content']); |
||||
</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 |
||||
for ($i=1;$i<21;$i++) { |
for ($i = 1; $i < 21; $i++) { |
||||
echo '<option value="'.$i.'"'; |
echo '<option value="' . $i . '"'; |
||||
if ($i == $data["main_menu_seq"]) echo " selected"; |
if ($i == $data["main_menu_seq"]) echo " selected"; |
||||
echo '>'.$i.'</option>'; |
echo '>' . $i . '</option>'; |
||||
} |
} |
||||
?> |
?> |
||||
</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 |
||||
for ($i=1;$i<21;$i++) { |
for ($i = 1; $i < 21; $i++) { |
||||
echo '<option value="'.$i.'"'; |
echo '<option value="' . $i . '"'; |
||||
if ($i == $data["sub_menu_seq"]) echo " selected"; |
if ($i == $data["sub_menu_seq"]) echo " selected"; |
||||
echo '>'.$i.'</option>'; |
echo '>' . $i . '</option>'; |
||||
} |
} |
||||
?> |
?> |
||||
</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> |
||||
<!--<option value="T"<?php if ($data["status"]=="T") echo " selected"; ?>>測試</option>--> |
<!--<option value="T"<?php if ($data["status"] == "T") echo " selected"; ?>>測試</option>--> |
||||
<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> |
<div class="row col-md-12 col-sm-12" style="margin-top:15px;"> |
||||
<br> |
<div class="col-md-4 col-sm-12"> |
||||
<button type="submit" name="update">確定</button> |
<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 class="row col-md-12 col-sm-12"> |
||||
|
<div class="col-md-12 col-sm-12"> |
||||
|
<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"; |
||||
|
|
||||
?> |
?> |
@ -0,0 +1,673 @@ |
|||||
|
<?php |
||||
|
// ini_set('display_errors', 'on'); |
||||
|
|
||||
|
// 新梯 |
||||
|
// $Adata |
||||
|
// 出貨台數 = 有實際出貨日期 |
||||
|
// $Adata2 |
||||
|
// 在裝台數 = 已出貨且官檢日跟移交日都沒填日期 |
||||
|
// $Adata3 |
||||
|
// 工收台數 = 已出貨且官檢日或移交日其中一個有日期 |
||||
|
|
||||
|
// 合計 |
||||
|
// $data |
||||
|
// 出貨台數 = 有實際出貨日期 |
||||
|
// $data2 |
||||
|
// 在裝台數 = 已出貨且官檢日跟移交日都沒填日期 |
||||
|
// $data3 |
||||
|
// 工收台數 = 已出貨且官檢日或移交日其中一個有日期 |
||||
|
|
||||
|
$real_arrival_date_start = empty($_REQUEST['real_arrival_date_start']) ? date("Y") . '-01' : $_REQUEST['real_arrival_date_start']; |
||||
|
$real_arrival_date_end = empty($_REQUEST['real_arrival_date_end']) ? date("Y-m") : $_REQUEST['real_arrival_date_end']; |
||||
|
$radsY = SUBSTR($real_arrival_date_start, 0, 4); |
||||
|
$radsM = SUBSTR($real_arrival_date_start, 5, 2); |
||||
|
$radeY = SUBSTR($real_arrival_date_end, 0, 4); |
||||
|
$radeM = SUBSTR($real_arrival_date_end, 5, 2); |
||||
|
|
||||
|
include "header.php"; |
||||
|
|
||||
|
// 新梯-出貨台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'A' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$Adata = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// 新梯-在裝台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'A' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND ( |
||||
|
delivery_date IS NULL |
||||
|
OR delivery_date = '' |
||||
|
)AND ( |
||||
|
official_check_date IS NULL |
||||
|
OR official_check_date = '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$Adata2 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// 新梯-工收台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'A' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND (( |
||||
|
delivery_date IS NOT NULL |
||||
|
AND delivery_date != '' |
||||
|
)OR ( |
||||
|
official_check_date IS NOT NULL |
||||
|
AND official_check_date != '' |
||||
|
)) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$Adata3 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
|
||||
|
// M1-出貨台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'B' |
||||
|
AND renovate_type like '%M1%' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$M1data = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// M1-在裝台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'B' |
||||
|
AND renovate_type like '%M1%' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND ( |
||||
|
delivery_date IS NULL |
||||
|
OR delivery_date = '' |
||||
|
)AND ( |
||||
|
official_check_date IS NULL |
||||
|
OR official_check_date = '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$M1data2 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// M1-工收台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'B' |
||||
|
AND renovate_type like '%M1%' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND (( |
||||
|
delivery_date IS NOT NULL |
||||
|
AND delivery_date != '' |
||||
|
)OR ( |
||||
|
official_check_date IS NOT NULL |
||||
|
AND official_check_date != '' |
||||
|
)) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$M1data3 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
|
||||
|
// MA-出貨台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'B' |
||||
|
AND renovate_type like '%MA%' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$Madata = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// MA-在裝台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'B' |
||||
|
AND renovate_type like '%MA%' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND ( |
||||
|
delivery_date IS NULL |
||||
|
OR delivery_date = '' |
||||
|
)AND ( |
||||
|
official_check_date IS NULL |
||||
|
OR official_check_date = '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$Madata2 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// MA-工收台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND contract_type = 'B' |
||||
|
AND renovate_type like '%MA%' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND (( |
||||
|
delivery_date IS NOT NULL |
||||
|
AND delivery_date != '' |
||||
|
)OR ( |
||||
|
official_check_date IS NOT NULL |
||||
|
AND official_check_date != '' |
||||
|
)) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$Madata3 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
|
||||
|
// 合計-出貨台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$data = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// 合計-在裝台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND ( |
||||
|
delivery_date IS NULL |
||||
|
OR delivery_date = '' |
||||
|
)AND ( |
||||
|
official_check_date IS NULL |
||||
|
OR official_check_date = '' |
||||
|
) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$data2 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
// 合計-工收台數 |
||||
|
$sql = " |
||||
|
SELECT |
||||
|
SUBSTR(real_arrival_date,1,4) AS year, |
||||
|
SUBSTR(real_arrival_date,6,2) AS month, |
||||
|
COUNT(real_arrival_date) AS all_count |
||||
|
FROM wipwholestatus |
||||
|
WHERE status = '1' |
||||
|
AND ( |
||||
|
real_arrival_date IS NOT NULL |
||||
|
AND real_arrival_date != '' |
||||
|
)AND (( |
||||
|
delivery_date IS NOT NULL |
||||
|
AND delivery_date != '' |
||||
|
)OR ( |
||||
|
official_check_date IS NOT NULL |
||||
|
AND official_check_date != '' |
||||
|
)) |
||||
|
GROUP BY year, month |
||||
|
"; |
||||
|
$result = mysqli_query($link, $sql); |
||||
|
$data_count = $result->num_rows; |
||||
|
$data3 = $result->fetch_all(MYSQLI_ASSOC); |
||||
|
|
||||
|
?> |
||||
|
<form id='myForm' method='post' action='wipwhole-wipinstallstatus-index.php?<?= $token_link ?>'> |
||||
|
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<h3 style='text-align:center'>在裝中統計表</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td style='text-align:center'> |
||||
|
<?php |
||||
|
if ((int)$radsY . $radsM > (int)$radeY . $radeM) { |
||||
|
echo "<span class='text-danger'>結束時間不可小於開始時間</span>"; |
||||
|
} |
||||
|
?> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style='text-align:center'> |
||||
|
<input type="month" class='form-control' id='real_contract_arrival_date_start' name='real_arrival_date_start' value="<?php echo $real_arrival_date_start; ?>" style='width:20%;display:inline;'> |
||||
|
~ |
||||
|
<input type="month" class='form-control' id='real_arrival_date_end' name='real_arrival_date_end' value="<?php echo $real_arrival_date_end; ?>" style='width:20%;display:inline;'> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style='text-align:center'> |
||||
|
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button> |
||||
|
<button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='clean_all_input()'>清除</button> |
||||
|
<!-- <button type="button" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm" onclick='generateButton()'>匯出excel</button> --> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tfoot> |
||||
|
</table> |
||||
|
</form> |
||||
|
<?php |
||||
|
if ((int)$radsY . $radsM > (int)$radeY . $radeM) { |
||||
|
exit; |
||||
|
} |
||||
|
?> |
||||
|
<table class="table table-striped table-bordered" style="width:98.5%;overflow-x:auto"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style="width:150px;" rowspan="2">出貨年月</th> |
||||
|
<?php |
||||
|
$start_y = $radsY; |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
?> |
||||
|
<th style='text-align:center;' colspan="<?php echo $end_month * 3 ?>"><?php echo $radsYi . '年'; ?></th> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
<th style='width:200px' colspan="3" rowspan="2">總計(全部)</th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<!-- <th style="width:150px;"></th> --> |
||||
|
<?php |
||||
|
$start_y = $radsY; |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
|
||||
|
for ($start_month; $start_month <= $end_month; $start_month++) { |
||||
|
?> |
||||
|
<th style='width:200px' colspan="3"><?php echo (int)$start_month . '月'; ?></th> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
<!-- <th style='width:200px' colspan="3" rowspan="2"></th> --> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>種類</th> |
||||
|
<?php |
||||
|
$start_y = $radsY; |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
|
||||
|
for ($start_month; $start_month <= $end_month; $start_month++) { |
||||
|
?> |
||||
|
<th style="background-color:#CECECE;">出貨</th> |
||||
|
<th style="background-color:#DEDEDE;">工收</th> |
||||
|
<th>在裝</th> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
<th style="background-color:#FF8040;">出貨</th> |
||||
|
<th style="background-color:#FFAF60;">工收</th> |
||||
|
<th style="background-color:#9D9D9D;">在裝</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td>新梯</td> |
||||
|
<?php |
||||
|
$a_count = 0; |
||||
|
$b_count = 0; |
||||
|
$c_count = 0; |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
|
||||
|
for ($start_month; $start_month <= $end_month; $start_month++) { |
||||
|
$all_count = 0; |
||||
|
foreach ($Adata as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$a_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#CECECE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($Adata3 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$b_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($Adata2 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$c_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td>$all_count</td>"; |
||||
|
} |
||||
|
?> |
||||
|
<?php |
||||
|
} |
||||
|
echo "<td style='background-color:#FF8040;'>$a_count</td>"; |
||||
|
echo "<td style='background-color:#FFAF60;'>$b_count</td>"; |
||||
|
echo "<td style='background-color:#9D9D9D;'>$c_count</td>"; |
||||
|
?> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>M1</td> |
||||
|
<?php |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
|
||||
|
for ($start_month; $start_month <= $end_month; $start_month++) { |
||||
|
$all_count = 0; |
||||
|
foreach ($M1data as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$a_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#CECECE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($M1data3 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$b_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($M1data2 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$c_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td>$all_count</td>"; |
||||
|
} |
||||
|
?> |
||||
|
<?php |
||||
|
} |
||||
|
echo "<td style='background-color:#FF8040;'>$a_count</td>"; |
||||
|
echo "<td style='background-color:#FFAF60;'>$b_count</td>"; |
||||
|
echo "<td style='background-color:#9D9D9D;'>$c_count</td>"; |
||||
|
?> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>MA</td> |
||||
|
<?php |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
|
||||
|
for ($start_month; $start_month <= $end_month; $start_month++) { |
||||
|
$all_count = 0; |
||||
|
foreach ($Madata as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$a_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#CECECE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($Madata3 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$b_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($Madata2 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$c_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td>$all_count</td>"; |
||||
|
} |
||||
|
?> |
||||
|
<?php |
||||
|
} |
||||
|
echo "<td style='background-color:#FF8040;'>$a_count</td>"; |
||||
|
echo "<td style='background-color:#FFAF60;'>$b_count</td>"; |
||||
|
echo "<td style='background-color:#9D9D9D;'>$c_count</td>"; |
||||
|
?> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>合計</td> |
||||
|
<?php |
||||
|
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { |
||||
|
$start_month = 1; |
||||
|
$end_month = 12; |
||||
|
|
||||
|
// 迴圈第一年 |
||||
|
if ($start_y == $radsYi) { |
||||
|
$start_month = $radsM; |
||||
|
} else { |
||||
|
$start_month = 1; |
||||
|
} |
||||
|
// 迴圈最後一年 |
||||
|
if ($radsYi == $radeY) { |
||||
|
$end_month = $radeM; |
||||
|
} |
||||
|
|
||||
|
for ($start_month; $start_month <= $end_month; $start_month++) { |
||||
|
$all_count = 0; |
||||
|
foreach ($data as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$a_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#CECECE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($data3 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$b_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td style='background-color:#DEDEDE;'>$all_count</td>"; |
||||
|
$all_count = 0; |
||||
|
foreach ($data2 as $row) { |
||||
|
if ($radsYi == $row['year'] && $start_month == $row['month']) { |
||||
|
$all_count = $row['all_count']; |
||||
|
$c_count += $all_count; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
echo "<td>$all_count</td>"; |
||||
|
} |
||||
|
?> |
||||
|
<?php |
||||
|
} |
||||
|
echo "<td style='background-color:#FF8040;'>$a_count</td>"; |
||||
|
echo "<td style='background-color:#FFAF60;'>$b_count</td>"; |
||||
|
echo "<td style='background-color:#9D9D9D;'>$c_count</td>"; |
||||
|
?> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<script> |
||||
|
|
||||
|
</script> |
Loading…
Reference in new issue