Browse Source

commit_temp

gary
gary_chen\gary_chen 1 year ago
parent
commit
6d2d171207
  1. 31
      wms/contract_b-index-model.php
  2. 291
      wms/contract_b-index.php
  3. 311
      wms/contract_m-index.php
  4. 5
      wms/css/view/wipwhole-index.php
  5. 2
      wms/database.php
  6. 430
      wms/delivery_kpi.php
  7. 3
      wms/fix_contract_payment_status.php
  8. 184
      wms/fnh/faultreview-index.php
  9. 3
      wms/fun_global.php
  10. 1
      wms/schedule_star-index.php
  11. 157
      wms/ship_run_chart-model.php
  12. 177
      wms/ship_run_chart.php
  13. 5
      wms/wipwhole-rec-invoice-edit-submit.php
  14. 9
      wms/wipwhole-renovate-rec-invoice.php

31
wms/contract_b-index-model.php

@ -0,0 +1,31 @@
<?php
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
// AJAX 顯示合約明細
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'showDetail') {
$billno = $_POST['billno'];
$sql = "
SELECT
siad.IncomeId,
cft.FeeTypeName,
FLOOR(siad.SQuantity) AS SQuantity,
FLOOR(siad.SPrice) AS SPrice,
FLOOR(siad.OAmount) AS OAmount,
FLOOR(siad.OTax) AS OTax,
FLOOR(siad.OAmountWithTax) AS OAmountWithTax,
siad.ProjectId,
siad.CU_MaterialId,
siad.CU_EstPayDate
FROM salIncomeApplyDetail AS siad
LEFT JOIN comFeeType AS cft
ON siad.IncomeId = cft.FeeTypeId
WHERE BillNo = '$billno'
ORDER BY siad.CU_EstPayDate ASC
";
$result = $conn->query($sql);
$data = $result->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($data, JSON_UNESCAPED_UNICODE);
}
}

291
wms/contract_b-index.php

@ -0,0 +1,291 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$department_id = accountidToDepartId($user_id);
if (in_array(accountidToDepartId($user_id), ['220'])) {
$sql_cmd = " WHERE 1=1 ";
} else {
$sql_cmd = sql_myself($user_id, "cgp.PersonId");
}
// 合約主檔
$sql = "
SELECT
siam.BillNo, -- 單據號
siad_tmp.ProjectId,-- 合約號
siam.BillDate, -- 合約日期
BizPartnerName, -- 客戶名稱
cp.PersonId, -- 業務人員
cgp.PersonName, -- 業務人員名稱
cd.DeptName, -- 業務人員部門
siam.UnTransAmount -- 合約金額
-- siad_tmp2.Max_CU_EstPayDate -- 最後收款日期
FROM salIncomeApplyMaster AS siam
LEFT JOIN (
SELECT
cc.BizPartnerId,
cbp.BizPartnerName
FROM comCustomer AS cc
LEFT JOIN comBusinessPartner AS cbp
ON cc.BizPartnerId = cbp.BizPartnerId
)cb_tmp
ON cb_tmp.BizPartnerId = siam.BizPartnerId
LEFT JOIN comPerson AS cp -- 員工主檔
ON siam.PersonId = cp.PersonId
LEFT JOIN comGroupPerson AS cgp -- 員工明細檔
ON cp.PersonId = cgp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
LEFT JOIN
(
SELECT DISTINCT
siad.BillNo,
siad.ProjectId
FROM salIncomeApplyDetail AS siad
WHERE siad.ProjectId != ''
AND siad.ProjectId IS NOT NULL
)AS siad_tmp -- 合約明細
ON siam.BillNo = siad_tmp.BillNo
LEFT JOIN
(
SELECT
siad.BillNo,
MAX(siad.CU_EstPayDate) as Max_CU_EstPayDate
FROM salIncomeApplyDetail AS siad
GROUP BY siad.BillNo
)AS siad_tmp2 -- 合約明細2
ON siam.BillNo = siad_tmp.BillNo
$sql_cmd
AND siam.CurrentState = '2'
";
if (!empty($contractno)) {
$sql .= " AND siad_tmp.ProjectId = '$contractno' ";
}
// echo "<pre>";
// echo $sql;
// echo "</pre>";
// exit;
$data = $conn->query($sql);
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<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'>
<div class='row'>
<div class='col-12'>
<table id="table_detail" class="table table-bordered" style="width:100%; margin:0 auto;">
<thead>
<tr>
<th>收入代碼</th>
<th>收入名稱</th>
<th>數量</th>
<th>單價</th>
<th>金額(未稅)</th>
<th>稅金</th>
<th>含稅金額</th>
<th>專案代碼</th>
<th>作番號</th>
<th>預計請款日</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='contract_b-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 colspan="5">
<h3 style='text-align:center'>保養合約管理</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<a href="contract/contract-input.php?function_name=contract-input&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;width:120px;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>部門</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>單據號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>單據日期</th>
<!-- <th style='text-align:center;vertical-align: middle;width:80px;'>最後收款日</th> -->
<th style='text-align:center;vertical-align: middle;width:120px;'>金額</th>
<th style='text-align:center;vertical-align: middle;width:60px;'>明細</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo $row['PersonId'];
echo "<br/>";
echo $row['PersonName'];
?>
</td>
<td>
<?php echo $row['DeptName']; ?>
</td>
<td>
<?php echo $row['ProjectId']; ?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['BizPartnerName']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['BillDate'])); ?>
</td>
<!-- <td>
<?php echo date('Y/m/d', strtotime($row['Max_CU_EstPayDate'])); ?>
</td> -->
<td>
<?php echo number_format(intval($row['UnTransAmount']), 0, '', ','); ?>
</td>
<td>
<button class="btn btn-primary myBtn" type="button" onclick="showDetail('<?php echo $row['BillNo']; ?>')">明細</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
var modal = document.getElementById("myModal");
$(".myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
$("#myModal").hide();
});
$(".back").click(function(e) {
$("#myModal").hide();
});
function showDetail(billno) {
$.ajax({
type: "POST",
dataType: "json",
url: "contract_b-index-model.php",
data: {
form_name: 'showDetail',
billno: billno
},
complete: function(data) {
var data = data.responseJSON
var str = "";
for (var i = 0; i < data.length; i++) {
str += "<tr>";
str += "<td>" + data[i]['IncomeId'] + "</td>";
str += "<td>" + data[i]['FeeTypeName'] + "</td>";
str += "<td>" + data[i]['SQuantity'] + "</td>";
str += "<td>" + data[i]['SPrice'] + "</td>";
str += "<td>" + data[i]['OAmount'] + "</td>";
str += "<td>" + data[i]['OTax'] + "</td>";
str += "<td>" + data[i]['OAmountWithTax'] + "</td>";
str += "<td>" + data[i]['ProjectId'] + "</td>";
str += "<td>" + data[i]['CU_MaterialId'] + "</td>";
str += "<td>" + data[i]['CU_EstPayDate'] + "</td>";
str += "</tr>";
}
if ($('#table_detail').hasClass('dataTable')) {
dttable = $('#table_detail').dataTable();
dttable.fnClearTable();
dttable.fnDestroy();
}
$("#table_detail").find("tbody").html(str);
$('#table_detail').dataTable();
}
})
}
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

311
wms/contract_m-index.php

@ -0,0 +1,311 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$department_id = accountidToDepartId($user_id);
// $contractno = getContractnoDetails($link, $user_id, $department_id, $contractno);
$sql = "
SELECT TOP 1000
sso_tmp.BillNo,
sso_tmp.BillDate,
sso_tmp.PersonId, --負責業務人
sso_tmp.SumOAmountWithTax,
cgp.PersonName,
cd.DeptName,
sso_tmp.BizPartnerId,
sso_tmp.fsso_status, -- 發票狀態
CASE
WHEN awob_tmp.status IS NOT NULL THEN 'true'
ELSE 'false'
END AS awob_status, -- 收款狀態
sso_tmp.BizPartnerName
FROM (
SELECT
sso.BillNo,
sso.BillDate,
sso.PersonId, --負責業務人
ssod.SumOAmountWithTax,
sso.BizPartnerId,
'true' AS fsso_status,
cbp.BizPartnerName
FROM salSalesOrder AS sso
LEFT JOIN (
SELECT
BillNo,
SUM(OAmountWithTax) SumOAmountWithTax
FROM salSalesOrderDetail
GROUP BY BillNo
)AS ssod ON sso.BillNo = ssod.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON sso.BizPartnerId = cbp.BizPartnerId
WHERE sso.BillNo IN
(
SELECT FromSalSalesOrder
FROM arCheckBillDetail
)
AND sso.TypeId = 'SP'
UNION
SELECT
sso.BillNo,
sso.BillDate,
sso.PersonId, --負責業務人,
ssod.SumOAmountWithTax,
sso.BizPartnerId,
'false' AS fsso_status,
cbp.BizPartnerName
FROM salSalesOrder AS sso
LEFT JOIN (
SELECT
BillNo,
SUM(OAmountWithTax) SumOAmountWithTax
FROM salSalesOrderDetail
GROUP BY BillNo
)AS ssod ON sso.BillNo = ssod.BillNo
LEFT JOIN comBusinessPartner AS cbp
ON sso.BizPartnerId = cbp.BizPartnerId
WHERE sso.BillNo NOT IN
(
SELECT FromSalSalesOrder
FROM arCheckBillDetail
)
AND sso.TypeId = 'SP'
)AS sso_tmp
LEFT JOIN (
SELECT DISTINCT
c.OrderBillNo,
'1' AS status
FROM arWriteOffBill AS a
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo
LEFT JOIN
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c
ON a.BillNo=c.BillNo
WHERE DATALENGTH(c.OrderBillNo) >0
)AS awob_tmp
ON sso_tmp.BillNo = awob_tmp.OrderBillNo
LEFT JOIN comPerson AS cp -- 員工主檔
ON sso_tmp.PersonId = cp.PersonId
LEFT JOIN comGroupPerson AS cgp
ON cp. PersonId = cgp.PersonId
LEFT JOIN comDepartment AS cd -- 部門主檔
ON cp.DeptId = cd.DeptId
WHERE 1=1
";
$sql .= !empty($contractno) ? " AND sso_tmp.BillNo = '$contractno' " : "";
// echo "<pre>";
// echo $sql;
// echo "</pre>";
// exit;
// $sql .= !empty($contractno) ? " AND sso_tmp.BillNo IN ($contractno)" : "";
$data = $conn->query($sql);
function checkCollectMonth($row)
{
$BillDate = $row['BillDate'];
if (collect_month(strtotime($BillDate)) >= 3) {
return "<span class='text-danger'>" . collect_month(strtotime($BillDate)) . "</span>";
} else {
return "<span class=''>" . collect_month(strtotime($BillDate)) . "</span>";
}
}
function getFixDetails($conn, $row)
{
$BillNo = $row['BillNo'];
$sql = "
SELECT
ssod.MaterialId,
cmg.MaterialName,
ssod.OAmountWithTax
FROM salSalesOrder AS sso
LEFT JOIN salSalesOrderDetail AS ssod
ON sso.BillNo = ssod.BillNo
LEFT JOIN comMaterialGroup AS cmg
ON ssod.MaterialId = cmg.MaterialId
WHERE sso.BillNo = '$BillNo'
";
$data = $conn->query($sql);
$str = "";
foreach ($data as $row) {
$str .= $row['MaterialId'] . "_";
$str .= $row['MaterialName'] . ":";
$str .= number_format(intval($row['OAmountWithTax'])) . "<br/>";
}
return $str;
}
?>
<?php if ($user_auth & 2) { ?>
<!-- <p>
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p> -->
<?php
}
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='fix_contract_payment_status.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 colspan="5">
<h3 style='text-align:center'>新梯合約管理</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<a href="contract-repair/contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;width:120px;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>部門</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>單據號</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>單據日期</th>
<!-- <th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th> -->
<th style='text-align:center;vertical-align: middle;width:120px;'>金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票狀態</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>收款狀態</th>
<th style='text-align:center;vertical-align: middle;width:250px;'>修理明細</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo $row['PersonId'];
echo "<br/>";
echo $row['PersonName'];
?>
</td>
<td>
<?php echo $row['DeptName']; ?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['BizPartnerName']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['BillDate'])); ?>
</td>
<!-- <td>
<?php echo $row['awob_status'] == 'true' ? '0' : checkCollectMonth($row); ?>
</td> -->
<td>
<?php echo number_format(intval($row['SumOAmountWithTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['fsso_status'] == 'true'
? '<span class="text-primary">已開發票</span>'
: '<span class="text-danger">未開發票</span>'; ?>
</td>
<td>
<?php echo $row['awob_status'] == 'true'
? '<span class="text-primary">已收款</span>'
: '<span class="text-danger">未收款</span>'; ?>
</td>
<td style='text-align:left;'>
<?php
echo getFixDetails($conn, $row);
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
$(function() {
document.getElementById('loadingOverlay').classList.add('hidden');
})
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

5
wms/css/view/wipwhole-index.php

@ -148,7 +148,8 @@
}
.modal .back {
position: absolute;
position: fixed;
z-index: 99998;
top: 0;
left: 0;
width: 100%;
@ -159,7 +160,7 @@
/* Modal Content */
.modal-content {
z-index: 9;
z-index: 99999;
background-color: #fefefe;
margin: auto;
padding: 20px;

2
wms/database.php

@ -19,7 +19,7 @@ $host = getenv('DB_HOST');
$dbuser = getenv('DB_USERNAME');
$dbpassword = getenv('DB_PASSWORD');
$dbname = getenv('DB_DATABASE');
// $link = mysqli_connect($host, $dbuser, $dbpassword, $dbname);
$link = mysqli_connect($host, $dbuser, $dbpassword, $dbname);
$sqlsrv = getenv('sqlsrv');
$Database = getenv('Database');

430
wms/delivery_kpi.php

@ -3,6 +3,175 @@ include("header.php");
$this_year = 2024;
$expected_a['2024'] = [
1 => 10,
2 => 20,
3 => 10,
4 => 26,
5 => 13,
6 => 26,
7 => 13,
8 => 26,
9 => 13,
10 => 26,
11 => 13,
12 => 14
];
$real_a['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_b['2024'] = [
1 => 15,
2 => 30,
3 => 15,
4 => 40,
5 => 20,
6 => 40,
7 => 20,
8 => 40,
9 => 20,
10 => 40,
11 => 20,
12 => 30
];
$real_b['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_c['2024'] = [
1 => 18,
2 => 18,
3 => 19,
4 => 20,
5 => 20,
6 => 20,
7 => 20,
8 => 20,
9 => 20,
10 => 20,
11 => 20,
12 => 20
];
$real_c['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_d['2024'] = [
1 => 12650,
2 => 12650,
3 => 12650,
4 => 18150,
5 => 18150,
6 => 19800,
7 => 23650,
8 => 23650,
9 => 23650,
10 => 26400,
11 => 26400,
12 => 26400
];
$real_d['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_e['2024'] = [
1 => 192,
2 => 192,
3 => 192,
4 => 272,
5 => 272,
6 => 272,
7 => 272,
8 => 272,
9 => 272,
10 => 272,
11 => 272,
12 => 272
];
$real_e['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$expected_f['2024'] = [
1 => 822,
2 => 957,
3 => 1092,
4 => 1227,
5 => 1362,
6 => 1497,
7 => 2162,
8 => 2297,
9 => 2432,
10 => 2567,
11 => 2702,
12 => 2838,
];
$real_f['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
function getMAdetails($conn, $this_year, $i)
{
$date = $this_year . str_pad($i, 2, '0', STR_PAD_LEFT);
@ -166,7 +335,7 @@ function getFixdetails($conn, $this_year, $i)
</tr>
<tr>
<th style='text-align:center;width:150px;vertical-align:middle;' colspan='2'>項目</th>
<th style='text-align:center;width:150px;vertical-align:middle;'><?php echo (date("Y") - 1); ?></th>
<th style='text-align:center;width:100px;vertical-align:middle;'><?php echo (date("Y") - 1); ?></th>
<th style='text-align:center;vertical-align:middle;'>月份</th>
<?php
for ($i = 1; $i <= 12; $i++) {
@ -181,26 +350,12 @@ function getFixdetails($conn, $this_year, $i)
<tbody>
<tr>
<td rowspan="3">1</td>
<td rowspan="3">舊梯全汰改(台數)</td>
<td rowspan="3">舊梯全汰改(合約台數)</td>
<td rowspan="3">
X/X
X
</td>
<td>預定</td>
<?php
$expected_a['2024'] = [
1 => 10,
2 => 20,
3 => 10,
4 => 26,
5 => 13,
6 => 26,
7 => 13,
8 => 26,
9 => 13,
10 => 26,
11 => 13,
12 => 14
];
$expected_a_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_a_count += $expected_a[$this_year][$i];
@ -212,20 +367,6 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td>實際</td>
<?php
$real_a['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$real_a_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_a[$this_year][$i] = getMAdetails($conn, $this_year, $i);
@ -249,26 +390,12 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td rowspan="6">2</td>
<td rowspan="3">舊梯M1改(台數)</td>
<td rowspan="3">舊梯M1改(合約台數)</td>
<td rowspan="3">
X/X
X
</td>
<td>預定</td>
<?php
$expected_b['2024'] = [
1 => 15,
2 => 30,
3 => 15,
4 => 40,
5 => 20,
6 => 40,
7 => 20,
8 => 40,
9 => 20,
10 => 40,
11 => 20,
12 => 30
];
$expected_b_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_b_count += $expected_b[$this_year][$i];
@ -280,20 +407,6 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td>實際</td>
<?php
$real_b['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$real_b_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_b[$this_year][$i] = getM1details($conn, $this_year, $i);
@ -314,26 +427,12 @@ function getFixdetails($conn, $this_year, $i)
</tr>
<tr>
<td rowspan="3">保養簽長約,免費M1</td>
<td rowspan="3">保養簽長約,免費M1(合約台數)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_c['2024'] = [
1 => 18,
2 => 18,
3 => 19,
4 => 20,
5 => 20,
6 => 20,
7 => 20,
8 => 20,
9 => 20,
10 => 20,
11 => 20,
12 => 20
];
$expected_c_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_c_count += $expected_c[$this_year][$i];
@ -345,20 +444,6 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td>實際</td>
<?php
$real_c['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$real_c_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_c[$this_year][$i] = getM1Freedetails($conn, $this_year, $i);
@ -387,20 +472,6 @@ function getFixdetails($conn, $this_year, $i)
</td>
<td>預定</td>
<?php
$expected_d['2024'] = [
1 => 12650,
2 => 12650,
3 => 12650,
4 => 18150,
5 => 18150,
6 => 19800,
7 => 23650,
8 => 23650,
9 => 23650,
10 => 26400,
11 => 26400,
12 => 26400
];
$expected_d_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_d_count += $expected_d[$this_year][$i];
@ -412,23 +483,9 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td>實際</td>
<?php
$real_d['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$real_d_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_d[$this_year][$i] = round(getMContractAllAmount($conn, $this_year, $i)/1000,0);
$real_d[$this_year][$i] = round(getMContractAllAmount($conn, $this_year, $i) / 1000, 0);
$real_d_count += $real_d[$this_year][$i];
echo "<td>" . $real_d[$this_year][$i] . "</td>";
}
@ -446,26 +503,12 @@ function getFixdetails($conn, $this_year, $i)
</tr>
<tr>
<td rowspan="3">4</td>
<td rowspan="3">保養契約台數(台)</td>
<td rowspan="3">保養契約台數(合約)</td>
<td rowspan="3">
X
</td>
<td>預定</td>
<?php
$expected_e['2024'] = [
1 => 192,
2 => 192,
3 => 192,
4 => 272,
5 => 272,
6 => 272,
7 => 272,
8 => 272,
9 => 272,
10 => 272,
11 => 272,
12 => 272
];
$expected_e_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_e_count += $expected_e[$this_year][$i];
@ -477,20 +520,6 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td>實際</td>
<?php
$real_e['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$real_e_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_e[$this_year][$i] = getMataincedetails($conn, $this_year, $i, $real_e[$this_year]);
@ -517,20 +546,6 @@ function getFixdetails($conn, $this_year, $i)
</td>
<td>預定</td>
<?php
$expected_f['2024'] = [
1 => 822,
2 => 957,
3 => 1092,
4 => 1227,
5 => 1362,
6 => 1497,
7 => 2162,
8 => 2297,
9 => 2432,
10 => 2567,
11 => 2702,
12 => 2838,
];
$expected_f_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_f_count += $expected_f[$this_year][$i];
@ -542,23 +557,9 @@ function getFixdetails($conn, $this_year, $i)
<tr>
<td>實際</td>
<?php
$real_f['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0
];
$real_f_count = 0;
for ($i = 1; $i <= 12; $i++) {
$real_f[$this_year][$i] = round(getFixdetails($conn, $this_year, $i)/1000,0);
$real_f[$this_year][$i] = round(getFixdetails($conn, $this_year, $i) / 1000, 0);
$real_f_count += $real_f[$this_year][$i];
echo "<td>" . $real_f[$this_year][$i] . "</td>";
}
@ -575,81 +576,6 @@ function getFixdetails($conn, $this_year, $i)
<td><?php echo round(($real_f_count / $expected_f_count) * 100, 2) . "%"; ?></td>
</tr>
<!-- <tr>
<td rowspan="2">6</td>
<td>併購</td>
<td>
X
</td>
<td></td>
<?php
$expected_f['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 1000,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0,
];
$expected_f_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_f_count += $expected_f[$this_year][$i];
echo "<td>" . $expected_f[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_f_count; ?></td>
</tr> -->
<!-- <tr>
<td>未續保流失台數</td>
<td>
X
</td>
<td>3</td>
<?php
$expected_g['2024'] = [
1 => 0,
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0,
];
$expected_g_count = 0;
for ($i = 1; $i <= 12; $i++) {
$expected_g_count += $expected_g[$this_year][$i];
echo "<td>" . $expected_g[$this_year][$i] . "</td>";
}
?>
<td><?php echo $expected_g_count; ?></td>
</tr> -->
<!-- <tr>
<td>7</td>
<td>目前累計台數(台)</td>
<td>
X
</td>
<td></td>
<?php
for ($i = 1; $i <= 12; $i++) {
echo "<td></td>";
}
?>
<td>sum</td>
</tr> -->
</tbody>
</table>

3
wms/fix_contract_payment_status.php

@ -227,6 +227,9 @@ if ($data) :
</div>
<div style="overflow-x:auto;">
<a href="contract-repair/contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>

184
wms/fnh/faultreview-index.php

@ -2,63 +2,90 @@
include "../header.php";
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "handlestaff");
// 張珈瑄、莊雅涵、賴定國、何維光可瀏覽近兩個月資料
if ($user_id == "M0061" || $user_id == "M0112" || $user_id == "C0004" || $user_id == "M0154") {
$last2mon = date("Y/m/d 00:00:00", strtotime("-2 month"));
$sql_cmd = "where calltime >= '$last2mon'";
function getAllFacilitynos($link, $user_id)
{
$sql_cmd = sql_myself($user_id, "repairerid");
$sql = "
SELECT facilityno
FROM facility
$sql_cmd
";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return "'" . implode("','", array_column($data, 'facilityno')) . "'";
}
if (getAccounttype($link, $user_id) == "B") {
$facilitynos = getAllFacilitynos($link, $user_id);
} else if (in_array(accountidToDepartId($user_id), ['912', '220'])) {
$facilitynos = '';
} else if (in_array($user_id, ['M0061', 'M0112', 'C0004', 'M0154'])) {
$facilitynos = '';
} else {
$facilitynos = "'NA'";
}
$sql = "select * from fault_notification_job_handling $sql_cmd order by id desc";
$data = mysqli_query($link,$sql);
/*
$permissionsql = "select * from account_permission where permissiontype='B' and accountid='$user_id'";
$permissiondata = mysqli_query($link,$permissionsql);
$row = mysqli_fetch_array($permissiondata, MYSQLI_ASSOC);
$permission = $row['permission'];
*/
if ($user_auth&2) {
$last2mon = date("Y/m/d 00:00:00", strtotime("-2 month"));
$sql = "
SELECT
*
FROM fault_notification_job_handling
WHERE 1 = 1
AND calltime >= '$last2mon'
";
$sql .= !empty($facilitynos) ? " AND facilityno IN ($facilitynos)" : "";
$sql .= "
ORDER BY id DESC
";
$data = mysqli_query($link, $sql);
if ($user_auth & 2) {
?>
<p><a href="fault-create.php?function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p>
<p><a href="fault-create.php?function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm" style="margin-left: 12px"> <span class="glyphicon glyphicon-plus"></span></a></p>
<?php
}
if ($data):
if ($data) :
?>
<style>
table {
table-layout:fixed;
<style>
table {
table-layout: fixed;
width: 100%;
}
}
td {
word-wrap:break-word;
}
td {
word-wrap: break-word;
}
img {
width:125px;
}
img {
width: 125px;
}
.width_style_1 {
width:125px;
}
.width_style_1 {
width: 125px;
}
table{
width:100%;
}
#table_index_filter{
float:right;
}
#table_index_paginate{
float:right;
}
label {
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
}
@media screen and (max-width: 600px) {
@media screen and (max-width: 600px) {
table {
border: 0;
@ -91,9 +118,9 @@ label {
text-transform: uppercase;
font-weight: bold;
}
}
</style>
<div style="overflow-x:auto;">
}
</style>
<div style="overflow-x:auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
@ -103,61 +130,74 @@ label {
<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($permission==0) {?>
<?php if ($user_auth&2) { ?>
<?php //if($permission==0) {
?>
<?php if ($user_auth & 2) { ?>
<th>修改</th>
<!-- <th>刪除</th>-->
<?php }?>
<!-- <th>刪除</th>-->
<?php } ?>
</tr>
</thead>
<tbody>
<?php
foreach($data as $key=>$data) :
foreach ($data as $key => $data) :
?>
<tr>
<td><?php echo $key+1; ?></td>
<td><?php echo $key + 1; ?></td>
<td><?php echo $data['facilityno']; ?></td>
<td><a href="fault-detail.php?account=<?php echo $user_id;?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>"><?php echo $data['sitename']; ?></a></td>
<td><a href="fault-detail.php?account=<?php echo $user_id; ?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>"><?php echo $data['sitename']; ?></a></td>
<td><?php echo $data['faultstate']; ?></td>
<td><?php echo $data['caller']; ?></td>
<td><?php echo $data['address']; ?></td>
<!-- <td>--><?php //echo $data['buildingnumber']; ?><!--</td>-->
<!-- <td>--><?php //echo $data['positionnumber']; ?><!--</td>-->
<!-- <td>--><?php //echo $data['brandmodel']; ?><!--</td>-->
<!-- <td>--><?php //echo $data['buildingnumber'];
?><!--</td>-->
<!-- <td>--><?php //echo $data['positionnumber'];
?><!--</td>-->
<!-- <td>--><?php //echo $data['brandmodel'];
?><!--</td>-->
<td><?php echo $data['calltime']; ?></td>
<td><?php echo $data['handlestaff']; ?></td>
<td><?php echo $data['remarks']; ?></td>
<?php //if($permission==0) {?>
<?php if ($user_auth&2) { ?>
<?php //if($permission==0) {
?>
<?php if ($user_auth & 2) { ?>
<td>
<?php
if (!in_array($data['caller'], ['system', 'system/Monarch', 'system/aijiati'])) {
?>
<p>
<a href="faultreview-edit.php?account=<?php echo $user_id;?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<a href="faultreview-edit.php?account=<?php echo $user_id; ?>&id=<?php echo $data['id']; ?>&function_name=faultreview&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</p>
<?php
}
?>
</td>
<!-- <td>-->
<!-- <p>-->
<!-- <a href="faultreview-delete.php?account=--><?php //echo $user_id;?><!--&id=--><?php //echo $data['id']; ?><!--" class="btn btn-info btn-sm" onClick="return confirm('確定刪除?')">-->
<!-- <span class="glyphicon glyphicon-remove"></span>-->
<!-- </a>-->
<!-- </p>-->
<!---->
<!-- </td>-->
<?php }?>
<!-- <td>-->
<!-- <p>-->
<!-- <a href="faultreview-delete.php?account=--><?php //echo $user_id;
?><!--&id=--><?php //echo $data['id'];
?><!--" class="btn btn-info btn-sm" onClick="return confirm('確定刪除?')">-->
<!-- <span class="glyphicon glyphicon-remove"></span>-->
<!-- </a>-->
<!-- </p>-->
<!---->
<!-- </td>-->
<?php } ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php
else:
else :
echo "<h2>There is no record!</h2>";
endif;

3
wms/fun_global.php

@ -196,6 +196,9 @@ function check_user_permission($user_id, $token)
'/wms/wipwhole-change-contractdate.php',
'/wms/wipwhole-change-planning-customer-name.php',
'/wms/test.php',
'/wms/delivery_kpi.php',
'/wms/contract_m-index.php',
'/wms/contract_b-index.php'
];
if (in_array($_SERVER["SCRIPT_NAME"], $ignore_url_arr)) return;

1
wms/schedule_star-index.php

@ -1,4 +1,5 @@
<?php
error_reporting(0);
include "header.php";
// 設置一個空陣列來放資料

157
wms/ship_run_chart-model.php

@ -0,0 +1,157 @@
<?php
require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php";
// AJAX 顯示合約明細
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$form_name = $_POST['form_name'];
$type = $_POST['type'];
$mtype = $_POST['mtype'];
$year = $_POST['year'];
$month = $_POST['month'];
if ($form_name == 'getShipping') {
echo getShipping($type, $mtype, $year, $month);
}
if ($form_name == 'getInstalling') {
echo getInstalling($type, $mtype, $year, $month);
}
if ($form_name == 'getInstalling2') {
echo getInstalling2($type, $mtype, $year, $month);
}
if ($form_name == 'getQCing') {
echo getQCing($type, $mtype, $year, $month);
}
if ($form_name == 'getDeliverying') {
echo getDeliverying($type, $mtype, $year, $month);
}
}
// 出貨台數
function getShipping($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 在裝台數
function getInstalling($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
install_start_date IS NOT NULL
OR install_start_date != ''
)
AND (
install_end_date IS NULL
OR install_end_date = ''
)
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 完工台數
function getInstalling2($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND install_start_date IS NOT NULL
AND install_start_date != ''
AND install_end_date IS NOT NULL
AND install_end_date != ''
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// QC台數
function getQCing($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND end_qc_date IS NOT NULL
AND end_qc_date != ''
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
// 移交台數
function getDeliverying($type, $mtype, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND delivery_date IS NOT NULL
AND delivery_date != ''
";
if(!empty($month)){
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
}else{
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
}
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE);
}

177
wms/ship_run_chart.php

@ -1,6 +1,8 @@
<?php
// ini_set('display_errors', 'on');
include "header.php";
include "css/view/wipwhole-index.php";
// 出貨台數
function getShipping($type, $mtype, $year, $month)
@ -64,7 +66,6 @@ function getInstalling2($type, $mtype, $year, $month)
AND install_start_date != ''
AND install_end_date IS NOT NULL
AND install_end_date != ''
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
@ -110,8 +111,6 @@ function getDeliverying($type, $mtype, $year, $month)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
echo $sql;
echo "<br>";
$result = mysqli_query($link, $sql);
$data = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $data['all_count'];
@ -125,6 +124,36 @@ foreach ($contract_type as $c_val => $c_key) {
?>
<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'>
<div class='row'>
<div class='col-12'>
<table id="table_detail" class="table table-bordered" style="width:100%; margin:0 auto;">
<thead>
<tr>
<th>合約號</th>
<th>作番號</th>
<th>客戶名稱</th>
<th>預計出貨日</th>
<th>試車完工日</th>
<th>QC合格日</th>
<th>官檢日</th>
<th>移交日</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<table class="table table-striped table-bordered" style="width:98.5%;overflow-x:auto">
<thead>
<tr>
@ -186,39 +215,54 @@ foreach ($contract_type as $c_val => $c_key) {
if ($val == 'A') {
$a = getShipping($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
echo '<td style="text-align:center;">' . $a . '</td>';
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a . '</a></td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
echo '<td style="text-align:center;">' . $b . '</td>';
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b . '</a></td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
echo '<td style="text-align:center;">' . $c . '</td>';
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c . '</a></td>';
}
if ($val == 'D') {
$d = getQCing($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
echo '<td style="text-align:center;">' . $d . '</td>';
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d . '</a></td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, null, (date("Y") - 1), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
echo '<td style="text-align:center;">' . $e . '</td>';
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y") - 1) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e . '</a></td>';
}
}
if ($val == 'A')
echo '<td style="text-align:center;">' . $a_count . '</td>';
if ($val == 'B')
echo '<td style="text-align:center;">' . $b_count . '</td>';
if ($val == 'C')
echo '<td style="text-align:center;">' . $c_count . '</td>';
if ($val == 'D')
echo '<td style="text-align:center;">' . $d_count . '</td>';
if ($val == 'E')
echo '<td style="text-align:center;">' . $e_count . '</td>';
if ($val == 'A') {
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a_count . '</a></td>';
}
if ($val == 'B') {
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b_count . '</a></td>';
}
if ($val == 'C') {
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c_count . '</a></td>';
}
if ($val == 'D') {
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d_count . '</a></td>';
}
if ($val == 'E') {
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y")-1) . "', '')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e_count . '</a></td>';
}
?>
</tr>
<tr>
@ -233,39 +277,54 @@ foreach ($contract_type as $c_val => $c_key) {
if ($val == 'A') {
$a = getShipping($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$a_count += $a;
echo '<td style="text-align:center;">' . $a . '</td>';
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $a . '</a></td>';
}
if ($val == 'B') {
$b = getInstalling($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$b_count += $b;
echo '<td style="text-align:center;">' . $b . '</td>';
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $b . '</a></td>';
}
if ($val == 'C') {
$c = getInstalling2($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$c_count += $c;
echo '<td style="text-align:center;">' . $c . '</td>';
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $c . '</a></td>';
}
if ($val == 'D') {
$d = getQCing($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$d_count += $d;
echo '<td style="text-align:center;">' . $d . '</td>';
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $d . '</a></td>';
}
if ($val == 'E') {
$e = getDeliverying($c_val, null, (date("Y")), str_pad($i, 2, '0', STR_PAD_LEFT));
$e_count += $e;
echo '<td style="text-align:center;">' . $e . '</td>';
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y")) . "', '" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')";
echo '<td style="text-align:center;"><a class="myBtn" href="#" onclick="' . $onclick . '">' . $e . '</a></td>';
}
}
if ($val == 'A')
echo '<td style="text-align:center;">' . $a_count . '</td>';
if ($val == 'B')
echo '<td style="text-align:center;">' . $b_count . '</td>';
if ($val == 'C')
echo '<td style="text-align:center;">' . $c_count . '</td>';
if ($val == 'D')
echo '<td style="text-align:center;">' . $d_count . '</td>';
if ($val == 'E')
echo '<td style="text-align:center;">' . $e_count . '</td>';
if ($val == 'A') {
$onclick = "showDetail('getShipping', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $a_count . ' </a></td>';
}
if ($val == 'B') {
$onclick = "showDetail('getInstalling', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $b_count . ' </a></td>';
}
if ($val == 'C') {
$onclick = "showDetail('getInstalling2', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $c_count . ' </a></td>';
}
if ($val == 'D') {
$onclick = "showDetail('getQCing', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $d_count . ' </a></td>';
}
if ($val == 'E') {
$onclick = "showDetail('getDeliverying', '$c_val', '', '" . (date("Y")) . "', '')";
echo '<td style="text-align:center;"> <a class="myBtn" href="#" onclick="' . $onclick . '">' . $e_count . ' </a></td>';
}
?>
</tr>
<?php
@ -273,6 +332,58 @@ foreach ($contract_type as $c_val => $c_key) {
?>
</tbody>
</table>
<script>
var modal = document.getElementById("myModal");
$(".myBtn").click(function() {
$("#myModal").show();
});
$("#myCloseBtn").click(function(e) {
$("#myModal").hide();
});
$(".back").click(function(e) {
$("#myModal").hide();
});
function showDetail(form_name, type, mtype, year, month) {
$.ajax({
type: "POST",
dataType: "json",
url: "ship_run_chart-model.php",
data: {
form_name: form_name,
type: type,
mtype: mtype,
year: year,
month: month
},
complete: function(data) {
console.log(data);
var data = data.responseJSON
var str = "";
for (var i = 0; i < data.length; i++) {
str += "<tr>";
str += "<td>" + data[i]['contractno'] + "</td>";
str += "<td>" + data[i]['facilityno'] + "</td>";
str += "<td>" + data[i]['custom'] + "</td>";
str += "<td>" + data[i]['real_arrival_date'] + "</td>";
str += "<td>" + data[i]['tryrun_end_date'] + "</td>";
str += "<td>" + data[i]['end_qc_date'] + "</td>";
str += "<td>" + data[i]['official_check_date'] + "</td>";
str += "<td>" + data[i]['delivery_date'] + "</td>";
str += "</tr>";
}
if ($('#table_detail').hasClass('dataTable')) {
dttable = $('#table_detail').dataTable();
dttable.fnClearTable();
dttable.fnDestroy();
}
$("#table_detail").find("tbody").html(str);
$('#table_detail').dataTable();
}
})
}
</script>
<?php
}

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

@ -850,7 +850,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'update_date_form') {
include "class/Cnotice.php";
include "./class/Cmail.php";
$cmail = new Cmail();
$cn = new Cnotice();
$creater = $user_id;
foreach ($_POST as $k => $v)

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

@ -442,7 +442,14 @@ if ($department_id == "321" || $department_id == "220") {
name AS label
FROM account
WHERE department_id IN ('311','312','313','314','315','511','512','513','514')
ORDER BY label ASC
UNION
SELECT
accountid AS val ,
name AS label
FROM account
WHERE 1=1
AND accountid IN ('M0050')
ORDER BY val ASC
";
$sales_options = mysqli_query($link, $sql);

Loading…
Cancel
Save