10994015 1 year ago
parent
commit
70c7703e6e
  1. 48
      .vscode/launch.json
  2. 146
      app/app-wipinstallation-log.php
  3. 103
      app/app-wipproduction-log.php
  4. 2
      phb/DB.php
  5. 1109
      phb/map/tw.html
  6. 637
      phb/map/tw_fake.html
  7. 31
      phb/map/worksite.php
  8. 99
      wms/T8_APItest_from_bpm.php
  9. 43
      wms/T8_Authorization_from_bpm.php
  10. 255
      wms/account-receivable-check.php
  11. 51
      wms/account-receivable-excel.php
  12. 475
      wms/account-receivable-index.php
  13. 124
      wms/account-receivable-received-create.php
  14. 142
      wms/account-receivable-received-edit.php
  15. 96
      wms/account-receivable-received-submit.php
  16. BIN
      wms/account-receivable.xlsx
  17. 91
      wms/board-create.php
  18. 3
      wms/board-record-submit.php
  19. 100
      wms/css/view/wipwhole-index.php
  20. 56
      wms/css/view/wipwhole-renovate-index.php
  21. 97
      wms/frame/api_getdata.php
  22. 91
      wms/fun_global.php
  23. 62
      wms/gary.php
  24. 552
      wms/header.php
  25. 2
      wms/loginapi.php
  26. 2
      wms/rib01-check.php
  27. 22
      wms/rib01-create.php
  28. 74
      wms/sign/list.php
  29. 22
      wms/wipwhole-change-contractdate-function.php
  30. 2
      wms/wipwhole-change-contractdate.php
  31. 22
      wms/wipwhole-index-function.php
  32. 15
      wms/wipwhole-index-table-html.php
  33. 147
      wms/wipwhole-index.php
  34. 107
      wms/wipwhole-rec-invoice-edit-submit.php
  35. 19
      wms/wipwhole-rec-invoice-edit.php
  36. 21
      wms/wipwhole-renovate-index-function.php
  37. 15
      wms/wipwhole-renovate-index-table-html.php
  38. 209
      wms/wipwhole-renovate-index.php
  39. 63
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  40. 14
      wms/wipwhole-renovate-rec-invoice-edit.php
  41. 9
      wms/wipwhole-wipinstallstatus-index.php
  42. 32
      wms/wipwholeinstall-index-table-html.php
  43. 17
      wms/wipwholeinstall-renovate-index-table-html.php

48
.vscode/launch.json

@ -0,0 +1,48 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}

146
app/app-wipinstallation-log.php

@ -24,6 +24,150 @@ if ($user_id == 'A000000001') {
$sql = "SELECT * FROM wipinstallation where (facilityno = '$facilityno') order by id desc"; # sql語法存在變數中 $sql = "SELECT * FROM wipinstallation where (facilityno = '$facilityno') order by id desc"; # sql語法存在變數中
} else { } else {
$sql = " $sql = "
SELECT
'0' AS id,
facilityno,
SUBSTR(real_contract_arrival_date,1,10) AS issue_time,
'分配安裝人員' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND real_contract_arrival_date != ''
AND real_contract_arrival_date IS NOT NULL
UNION
SELECT
'1' AS id,
facilityno,
SUBSTR(real_arrival_date,1,10) AS issue_time,
'已出貨' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND real_arrival_date != ''
AND real_arrival_date IS NOT NULL
UNION
SELECT
'2' AS id,
facilityno,
SUBSTR(estimate_install_start_date,1,10) AS issue_time,
'預計安裝日期' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND estimate_install_start_date != ''
AND estimate_install_start_date IS NOT NULL
UNION
SELECT
'3' AS id,
facilityno,
SUBSTR(install_start_date,1,10) AS issue_time,
'已開工' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND install_start_date != ''
AND install_start_date IS NOT NULL
UNION
SELECT
'4' AS id,
facilityno,
SUBSTR(estimate_tryrun_start_date,1,10) AS issue_time,
'預計試車日期' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND estimate_tryrun_start_date != ''
AND estimate_tryrun_start_date IS NOT NULL
UNION
SELECT
'5' AS id,
facilityno,
SUBSTR(tryrun_start_date,1,10) AS issue_time,
'開始試車' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND tryrun_start_date != ''
AND tryrun_start_date IS NOT NULL
UNION
SELECT
'6' AS id,
facilityno,
SUBSTR(end_qc_date,1,10) AS issue_time,
'完成QC' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND end_qc_date != ''
AND end_qc_date IS NOT NULL
UNION
SELECT
'7' AS id,
facilityno,
SUBSTR(official_check_date,1,10) AS issue_time,
'完成官檢' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND official_check_date != ''
AND official_check_date IS NOT NULL
UNION
SELECT
'8' AS id,
facilityno,
SUBSTR(delivery_date,1,10) AS issue_time,
'完成移交' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE (facilityno = '$facilityno')
AND delivery_date != ''
AND delivery_date IS NOT NULL
/*
SELECT SELECT
'0' AS id, '0' AS id,
facilityno, facilityno,
@ -107,6 +251,8 @@ if ($user_id == 'A000000001') {
create_at create_at
FROM wipwholestatus FROM wipwholestatus
WHERE (facilityno = '$facilityno') WHERE (facilityno = '$facilityno')
*/
ORDER BY id DESC ORDER BY id DESC
"; ";
} }

103
app/app-wipproduction-log.php

@ -27,6 +27,101 @@ if ($user_id == 'A000000001') {
SELECT SELECT
'0' AS id, '0' AS id,
facilityno, facilityno,
'' AS issue_time,
'生產中' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
UNION
SELECT
'1' AS id,
facilityno,
SUBSTR(estimated_shipping_date,1,10) AS issue_time,
'生產完成' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND estimated_shipping_date != ''
AND estimated_shipping_date IS NOT NULL
UNION
SELECT
'2' AS id,
facilityno,
SUBSTR(estimated_shipping_schedule_date,1,10) AS issue_time,
'預計攬收' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND estimated_shipping_schedule_date != ''
AND estimated_shipping_schedule_date IS NOT NULL
UNION
SELECT
'3' AS id,
facilityno,
SUBSTR(actual_tofactory_date,1,10) AS issue_time,
'攬收成功(桃園)' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND actual_tofactory_date != ''
AND actual_tofactory_date IS NOT NULL
UNION
SELECT
'4' AS id,
facilityno,
SUBSTR(real_contract_arrival_date,1,10) AS issue_time,
'預計出貨日' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND real_contract_arrival_date != ''
AND real_contract_arrival_date IS NOT NULL
UNION
SELECT
'5' AS id,
facilityno,
SUBSTR(real_arrival_date,1,10) AS issue_time,
'出貨' AS 'process',
'bg-success' AS 'light_color',
'' AS memo,
creater,
create_at
FROM wipwholestatus
WHERE facilityno = '$facilityno'
AND real_arrival_date != ''
AND real_arrival_date IS NOT NULL
/*
UNION
SELECT
'1' AS id,
facilityno,
SUBSTR(prattford_order_date,1,10) AS issue_time, SUBSTR(prattford_order_date,1,10) AS issue_time,
CASE prattford_order_date_verify CASE prattford_order_date_verify
WHEN 0 THEN '生產完成' WHEN 0 THEN '生產完成'
@ -47,7 +142,7 @@ if ($user_id == 'A000000001') {
WHERE (facilityno = '$facilityno') WHERE (facilityno = '$facilityno')
UNION UNION
SELECT SELECT
'1' AS id, '2' AS id,
facilityno, facilityno,
SUBSTR(goods_type_date,1,10) AS issue_time, SUBSTR(goods_type_date,1,10) AS issue_time,
CASE goods_type CASE goods_type
@ -71,7 +166,7 @@ if ($user_id == 'A000000001') {
WHERE (facilityno = '$facilityno') WHERE (facilityno = '$facilityno')
UNION UNION
SELECT SELECT
'2' AS id, '3' AS id,
facilityno, facilityno,
SUBSTR(actual_tofactory_date,1,10) AS issue_time, SUBSTR(actual_tofactory_date,1,10) AS issue_time,
CASE arrival_date_verify CASE arrival_date_verify
@ -97,7 +192,7 @@ if ($user_id == 'A000000001') {
WHERE (facilityno = '$facilityno') WHERE (facilityno = '$facilityno')
UNION UNION
SELECT SELECT
'3' AS id, '4' AS id,
facilityno, facilityno,
SUBSTR(real_arrival_date,1,10) AS issue_time, SUBSTR(real_arrival_date,1,10) AS issue_time,
IF(real_arrival_date IS NOT NULL || real_arrival_date != '','已出貨','未出貨') AS 'process', IF(real_arrival_date IS NOT NULL || real_arrival_date != '','已出貨','未出貨') AS 'process',
@ -107,6 +202,8 @@ if ($user_id == 'A000000001') {
create_at create_at
FROM wipwholestatus FROM wipwholestatus
WHERE (facilityno = '$facilityno') WHERE (facilityno = '$facilityno')
*/
ORDER BY id DESC ORDER BY id DESC
"; ";
} }

2
phb/DB.php

@ -15,7 +15,7 @@ class DB
//私有的构造方法 //私有的构造方法
function __construct($config = array()) function __construct($config = array())
{ {
$this->host = isset($config['host']) ? $config['host'] : 'db-104.coowo.com'; $this->host = isset($config['host']) ? $config['host'] : 'localhost';
$this->port = isset($config['port']) ? $config['port'] : '3306'; $this->port = isset($config['port']) ? $config['port'] : '3306';
$this->user = isset($config['user']) ? $config['user'] : 'masadaroot'; $this->user = isset($config['user']) ? $config['user'] : 'masadaroot';
$this->pass = isset($config['pass']) ? $config['pass'] : 'x6h5E5p#u8y'; $this->pass = isset($config['pass']) ? $config['pass'] : 'x6h5E5p#u8y';

1109
phb/map/tw.html

File diff suppressed because it is too large

637
phb/map/tw_fake.html

@ -0,0 +1,637 @@
<html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>電梯地圖</title>
<link rel="stylesheet" href="map.css" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="jsgrid.css">
<link rel="stylesheet" href="jsgrid-theme.css">
</head>
<body>
<div id="map" style="height: 100%"></div>
<!-- Jquery -->
<script src="js/lib/jquery-3.4.1.min.js"></script>
<!-- Bootstrap-->
<script src="js/lib/popper.min.js"></script>
<script src="js/lib/bootstrap.min.js"></script>
<script src="../da/chart.js/Chart.js"></script>
<script src="js/jsgrid.js"></script>
<script>
// This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.
const urll = location.href;
const wurl = urll.split('phb')[0];
function initMap() {
var pointURL = wurl + 'phb/map/point.php';
// var pointURL = wurl + 'phbbackup/map/point.php';
var points = [];
var currentInfoWindow = null;
$.ajax({
type: "GET",
url: pointURL,
success: function (msg) {
var result = eval("(" + msg + ")");
if (result.length > 0) {
for (i = 0; i < result.length; i++) {
var obj = {};
var longitude = Number(result[i]['longitude']);
var latitude = Number(result[i]['latitude']);
var custormname = result[i]['name'];
obj['lat'] = latitude;
obj['lng'] = longitude;
var icon = {
url: 'icon/lift.png',
//scaledSize: new google.maps.Size(52, 50), // scaled size
scaledSize: new google.maps.Size(32.4, 31.2), // scaled size
origin: new google.maps.Point(0, 0), // origin
anchor: new google.maps.Point(0, 0) // anchor
};
const marker = new google.maps.Marker({
position: obj,
map,
title: custormname,
icon: icon
});
const contentString =
'<div class="container">' +
'<div class="row">' +
'<div class="col-md-12">' +
'<div id="choosecontent" style="height: 430px;width: 500px">' +
'</div>' +
'</div>' +
"</div>" +
"</div>";
const infowindow = new google.maps.InfoWindow({
content: contentString
});
clickMarker(marker, latitude, infowindow);
}
}
}
})
function clickMarker(marker, latitude, infowindow) {
marker.addListener("click", (e) => {
if (currentInfoWindow != null) {
currentInfoWindow.close();
}
infowindow.open({
anchor: marker,
map,
shouldFocus: false,
});
currentInfoWindow = infowindow;
var chooselat = e.latLng.lat();
var accountURL = wurl + 'phb/map/account.php?latitude=' + chooselat;
$.ajax({
type: "GET",
url: accountURL,
success: function (msg) {
var result = eval("(" + msg + ")");
console.log(result);
var htmltai = '';
if (result.length > 0) {
for (i = 0; i < result.length; i++) {
var name = result[i]['name'];
var tel = result[i]['tel'];
var address = result[i]['address'];
var repairername = result[i]['repairername'];
var repairertel = result[i]['repairertel'];
var customerid = result[i]['customerid'];
htmltai +=
'<div class="card card-primary card-outline mt-05">' +
'<div class="card-body box-profile">' +
'<h2 class="profile-username text-center">' + name + '</h2>' +
'<p class="lead text-center"><a href="tel:' + tel + '">' + tel + '</a></p>' +
'<p class="lead text-center">' + address + '</p>' +
'<ul class="list-group list-group-unbordered mb-3 lead">' +
'<li class="list-group-item">' +
'<b>保養員</b> <a class="float-right">' + repairername + '</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>保養員聯繫電話</b> <a class="float-right" href="tel:' + repairertel + '" >' + repairertel + '</a> ' +
'</li>' +
'</ul>' +
'<p class="lead text-center"><a href="#" onclick=jibnen("' + customerid + '","' + chooselat + '")>查看電梯</a></p>'
'</div>' +
'</div>';
}
$('#choosecontent').empty().append(htmltai);
}
}
})
});
}
//const uluru = { lat:24.9966186 , lng: 121.1594333 };
//const uluru = { lat:23.974003045820343 , lng: 120.97981583669126 };
const uluru = { lat: 23.633310942708295, lng: 120.77153763992857 };
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 8,
center: uluru,
// disableDefaultUI: true,
});
const eledata2 = document.createElement("div");
eledata2.className = 'gm-style-mtc';
eledata2.style.cssText = "float: left; position: relative;";
eledata2.innerHTML = "新竹以南、台南以北建置中。";
eledata2.style.cssText = "background: none padding-box rgb(255, 255, 255);border: 0px; margin-left: 10px;text-transform: none; -webkit-appearance: none; position: relative; cursor: pointer; user-select: none; direction: ltr; overflow: hidden; text-align: center; height: 24px;width:200px; vertical-align: middle; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 15px; border-bottom-left-radius: 2px; border-top-left-radius: 2px; -webkit-background-clip: padding-box; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; min-width: 36px; font-weight: 500;";
const eledata = document.createElement("div");
eledata.className = 'gm-style-mtc';
eledata.style.cssText = "float: left; position: relative;";
const fenbutu = document.createElement("button");
fenbutu.textContent = "分佈圖";
fenbutu.style.cssText = "background: none padding-box rgb(255, 255, 255);border: 0px; margin-left: 10px;text-transform: none; -webkit-appearance: none; position: relative; user-select: none; direction: ltr; overflow: hidden; text-align: center; height: 40px;width:70px; vertical-align: middle; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 18px; border-bottom-left-radius: 2px; border-top-left-radius: 2px; -webkit-background-clip: padding-box; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; min-width: 36px; font-weight: 500;";
eledata.appendChild(fenbutu);
const eledata1 = document.createElement("div");
eledata1.className = 'gm-style-mtc xia';
eledata1.style.cssText = "width:100px;margin-left: 10px;margin-top: 5px; display:none";
eledata.appendChild(eledata1);
const dainti = document.createElement("button");
dainti.textContent = "電梯";
dainti.style.cssText = "background: none padding-box rgb(255, 255, 255); border: 0px; margin-top: 2px;text-transform: none; -webkit-appearance: none; position: relative; cursor: pointer; user-select: none; direction: ltr; overflow: hidden; text-align: center; height: 40px;width:70px; vertical-align: middle; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 18px; border-bottom-left-radius: 2px; border-top-left-radius: 2px; -webkit-background-clip: padding-box; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; min-width: 36px; font-weight: 500;";
const baoyangyuan = document.createElement("button");
baoyangyuan.textContent = "保養員";
baoyangyuan.style.cssText = "background: none padding-box rgb(255, 255, 255);border: 0px;margin-top: 2px; text-transform: none; -webkit-appearance: none; position: relative; cursor: pointer; user-select: none; direction: ltr; overflow: hidden; text-align: center; height: 40px;width:70px; vertical-align: middle; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 18px; border-bottom-left-radius: 2px; border-top-left-radius: 2px; -webkit-background-clip: padding-box; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; min-width: 36px; font-weight: 500;";
const gongchang = document.createElement("button");
gongchang.textContent = "工廠";
gongchang.style.cssText = "background: none padding-box rgb(255, 255, 255); border: 0px; margin-top: 2px;text-transform: none; -webkit-appearance: none; position: relative; cursor: pointer; user-select: none; direction: ltr; overflow: hidden; text-align: center; height: 40px;width:70px; vertical-align: middle; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 18px; border-bottom-left-radius: 2px; border-top-left-radius: 2px; -webkit-background-clip: padding-box; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; min-width: 36px; font-weight: 500;";
const gongdi = document.createElement("button");
gongdi.textContent = "工地";
gongdi.style.cssText = "background: none padding-box rgb(255, 255, 255); border: 0px; margin-top: 2px;text-transform: none; -webkit-appearance: none; position: relative; cursor: pointer; user-select: none; direction: ltr; overflow: hidden; text-align: center; height: 40px;width:70px; vertical-align: middle; color: rgb(0, 0, 0); font-family: Roboto, Arial, sans-serif; font-size: 18px; border-bottom-left-radius: 2px; border-top-left-radius: 2px; -webkit-background-clip: padding-box; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; min-width: 36px; font-weight: 500;";
eledata1.appendChild(dainti);
eledata1.appendChild(baoyangyuan);
eledata1.appendChild(gongchang);
eledata1.appendChild(gongdi);
map.controls[google.maps.ControlPosition.LEFT_TOP].push(eledata);
map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(eledata2);
fenbutu.onmouseover = (() => {
eledata1.style.display = "block";
})
eledata1.onmouseleave = (() => {
eledata1.style.display = "none";
})
dainti.addEventListener('click', () => {
window.location.href = "tw.html";
});
baoyangyuan.addEventListener('click', () => {
window.location.href = "person.html";
});
gongchang.addEventListener('click', () => {
window.location.href = "factory.html";
});
gongdi.addEventListener('click', () => {
window.location.href = "worksite.html";
});
}
window.initMap = initMap;
function kehu(chooselng) {
var accountURL = wurl + 'phb/map/account.php?latitude=' + chooselng;
$.ajax({
type: "GET",
url: accountURL,
success: function (msg) {
var result = eval("(" + msg + ")");
console.log(result);
var htmltai = '';
if (result.length > 0) {
for (i = 0; i < result.length; i++) {
var name = result[i]['name'];
var tel = result[i]['tel'];
var address = result[i]['address'];
var repairername = result[i]['repairername'];
var repairertel = result[i]['repairertel'];
var customerid = result[i]['customerid'];
htmltai +=
'<div class="card card-primary card-outline mt-05">' +
'<div class="card-body box-profile">' +
'<h3 class="profile-username text-center">' + name + '</h3>' +
'<p class="text-muted text-center"><a href="tel:' + tel + '">' + tel + '</a</p>' +
'<p class="text-muted text-center">' + address + '&nbsp;&nbsp;<a href="#" onclick=jibnen("' + customerid + '","' + chooselng + '")>查看作番</a></p>' +
'<ul class="list-group list-group-unbordered mb-3">' +
'<li class="list-group-item">' +
'<b>保養員</b> <a class="float-right">' + repairername + '</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>保養員聯繫電話</b> <a class="float-right" href="tel:' + repairertel + '" >' + repairertel + '</a> ' +
'</li>' +
'</ul>' +
'</div>' +
'</div>';
}
$('#choosecontent').empty().append(htmltai);
}
}
})
}
function jibnen(customerid, chooselng) {
var facilityURL = wurl + 'phb/map/facility.php?customerid=' + customerid;
$.ajax({
type: "GET",
url: facilityURL,
success: function (msg) {
var result = eval("(" + msg + ")");
console.log(result);
var htmlfacility = '';
htmlfacility = '<div class="card card-primary card-outline">' +
' <div class="appHeader bg-primary text-light">' +
' <div class="left">' +
' <a href="#" onclick=kehu("' + chooselng + '") class="headerButton">' +
' <ion-icon name="chevron-back-outline"></ion-icon>' +
' </a>' +
' </div>' +
' <div class="pageTitle">電梯</div>' +
' </div>' +
'<div class="card-body box-profile" id="facility">' +
'</div>' +
'</div>';
if (result[0].length > 0) {
var htmlds = '';
// next month
const date = new Date();
const ndate = new Date(date.setMonth(date.getMonth() + 1));
let nextDay = String(ndate.getDate()).padStart(2, '0');
let nextMonth = String(ndate.getMonth() + 1).padStart(2, "0");
let nextYear = ndate.getFullYear();
//let nextDate = `${nextYear}-${nextMonth}-${nextDay}`;
let nextDate = `${nextYear}-${nextMonth}-15`;
for (i = 0; i < result[0].length; i++) {
var facilityno = result[0][i]['facilityno'];
var address = result[0][i]['address'];
var speed = result[0][i]['speed'];
var numberoffloor = result[0][i]['numberoffloor'];
var numberofstop = (result[0][i]['numberofstop'] == 1) ? "2" : result[0][i]['numberofstop']; // 預設2停
var actualdate = (result[1][facilityno]) ? result[1][facilityno]['actualdate'] : "預計 " + nextDate;
var sid = (result[1][facilityno]) ? result[1][facilityno]['id'] : "0";
var schedule_detail = "";
// 補丁 actualdate = 展示太久沒更新保養日期做假資料
actualdate = fakeActualdate(actualdate);
if (sid > 0) {
schedule_detail += '<li class="list-group-item"><b>保養明細</b> ';
schedule_detail += '<a href="/app/app-maintenance-uploadsuccess-survey.php?id_schedule=' + sid + '&view=Y&actualdate=' + actualdate + '" class="float-right" target="_self">連結</a>';
schedule_detail += '</li>';
}
var ckmore = "";
if (sid > 0) {
ckmore = '<a href="/app/app-maintenance-uploadsuccess-photo-review_v2.php?id_schedule=' + sid + '" target="_self" title="瀏覽保養照片"><img src="icon/camera.png" width="25" style="vertical-align:middle;"></a>';
}
var baditems = (result[1][facilityno]) ? result[1][facilityno]['baditems'] : "";
var sresult = "";
if (baditems) {
if (result[1][facilityno]['item_detail']) {
sresult += '<br><a class="float-left" style="margin-top:6px;">' + baditems + '<br>' + result[1][facilityno]['item_detail'] + '</a>';
} else {
sresult += '<a class="float-right">' + baditems + '</a>';
}
} else {
sresult += '<a class="float-right">新梯待保養</a>';
}
var fault_message = '';
if (result[2][facilityno]) {
for (j = 0; j < result[2][facilityno].length; j++) {
fault_message += result[2][facilityno][j] + '<br>';
}
} else fault_message = '狀態正常';
htmlds +=
'<ul class="list-group list-group-unbordered mb-3 lead">' +
'<li class="list-group-item list-group-item-secondary">' +
'<b>電梯ID</b> <a class="float-right">' + facilityno + '</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>速度</b> <a class="float-right">' + speed + 'm/min</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>樓層</b> <a class="float-right">' + numberoffloor + '樓</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>樓停</b> <a class="float-right">' + numberofstop + '停</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>地址</b> <a class="float-right">' + address + '</a>' +
'</li>' +
'<li class="list-group-item">' +
'<b>最近一次保養日期</b> <a class="float-right">' + actualdate + '</a>' +
'</li>' +
schedule_detail +
'<li class="list-group-item">' +
'<b>保養結果</b> ' + ckmore + sresult +
'</li>' +
'<li class="list-group-item">' +
'<b>故障訊息</b> <a class="float-right">' + fault_message + '</a>' +
//'<br><a class="float-right">' + item_detail + '</a>' +
'</li>' +
'</ul>';
/*
'<li class="list-group-item">' +
'<a href="#" onclick=jishi("'+facilityno+'","'+customerid+'") class="btn btn-primary width40"><b>及時狀態</b></a>'+
'<a href="#" onclick=guzhang("'+facilityno+'","'+customerid+'") class="btn btn-primary width40"><b>故障内容</b></a>'+
'</li>' +
*/
}
$('#choosecontent').empty().append(htmlfacility);
$('#facility').append(htmlds);
}
}
})
}
// 及時狀態
function jishi(facilityno, customerid) {
var htmlds = "";
var facilitystatusURL = wurl + 'phb/map/facility_status.php?facilityno=' + facilityno;
$.ajax({
type: "GET",
url: facilitystatusURL,
success: function (msg) {
var result = eval("(" + msg + ")");
console.log(result);
console.log(result['labels']);
htmlds = '<div>' +
' <div class="appHeader bg-primary text-light">' +
' <div class="left">' +
' <a href="#" onclick=jibnen("' + customerid + '") class="headerButton">' +
' <ion-icon name="chevron-back-outline"></ion-icon>' +
' </a>' +
' </div>' +
' <div class="pageTitle">及時狀態</div>' +
' </div>' +
'<div class="chart">' +
'<canvas id="lineChart" height="200"></canvas>' +
'</div></div>';
$('#choosecontent').empty().append(htmlds);
//折线图
var lineChartCanvas = $('#lineChart')
let linedata = {
"labels": result['labels'],
"datasets": [{
"label": "走行時間",
"data": result['walking_hours'],
"fill": false,
"borderColor": "rgb(75, 192, 192)",
"lineTension": 0.1
}, {
"label": "走行次數",
"data": result['walking_times'],
"fill": false,
"borderColor": "rgb(192,75,126)",
"lineTension": 0.1
}]
};
const optsLineChart = {
scales: {
x: {
time: false,
},
y: {
range: [0, 100],
},
},
series: [
{},
{
fill: 'transparent',
width: 5,
stroke: 'rgba(60,141,188,1)',
},
{
stroke: '#c1c7d1',
width: 5,
fill: 'transparent',
},
],
hover: {
animationDuration: 0 // 防止鼠标移上去,数字闪烁
},
animation: { // 这部分是数值显示的功能实现
onComplete: function () {
var chartInstance = this.chart,
ctx = chartInstance.ctx;
// 以下属于canvas的属性(font、fillStyle、textAlign...)
ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontSize, Chart.defaults.global.defaultFontStyle, Chart.defaults.global.defaultFontFamily);
ctx.fillStyle = "black";
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
this.data.datasets.forEach(function (dataset, i) {
var meta = chartInstance.controller.getDatasetMeta(i);
meta.data.forEach(function (bar, index) {
var data = dataset.data[index];
ctx.fillText(data, bar._model.x, bar._model.y - 5);
});
});
}
}
};
new Chart(lineChartCanvas, {
type: 'line',
data: linedata,
options: optsLineChart
});
}
})
}
// 故障內容
function guzhang(facilityno, customerid) {
var htmlds = '';
var facilitybreakdownURL = wurl + 'phb/map/facility_breakdown.php?facilityno=' + facilityno;
$.ajax({
type: "GET",
url: facilitybreakdownURL,
success: function (msg) {
var result = eval("(" + msg + ")");
console.log(result);
htmlds = '<div>' +
' <div class="appHeader bg-primary text-light">' +
' <div class="left">' +
' <a href="#" onclick=jibnen("' + customerid + '") class="headerButton">' +
' <ion-icon name="chevron-back-outline"></ion-icon>' +
' </a>' +
' </div>' +
' <div class="pageTitle">故障內容</div>' +
' </div>' +
'<div class="chart">' +
'<canvas id="guzhangchart" height="100" ></canvas>' +
'</div></div>';
htmlds += '<div style="width: 100%;height:200px;overflow: scroll">' +
'<div id="jsGrid1" style="height: 300px;font-size: 12px"></div>' +
'</div>'
$('#choosecontent').empty().append(htmlds);
//折线图
var guzhangchartCanvas = $('#guzhangchart')
let guzhanglinedata = {
"labels": result['labels'],
"datasets": [{
"label": "故障內容",
"data": result['data'],
"fill": true,
"borderColor": "rgb(75, 192, 192)",
"lineTension": 1
}]
};
const optsguzhangLineChart = {
scales: {
x: {
time: false,
},
y: {
range: [0, 100],
},
},
series: [
{},
{
fill: 'transparent',
width: 5,
stroke: 'rgba(60,141,188,1)',
},
{
stroke: '#c1c7d1',
width: 5,
fill: 'transparent',
},
],
hover: {
animationDuration: 0 // 防止鼠标移上去,数字闪烁
},
animation: { // 这部分是数值显示的功能实现
onComplete: function () {
var chartInstance = this.chart,
ctx = chartInstance.ctx;
// 以下属于canvas的属性(font、fillStyle、textAlign...)
ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontSize, Chart.defaults.global.defaultFontStyle, Chart.defaults.global.defaultFontFamily);
ctx.fillStyle = "black";
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
this.data.datasets.forEach(function (dataset, i) {
var meta = chartInstance.controller.getDatasetMeta(i);
meta.data.forEach(function (bar, index) {
var data = dataset.data[index];
ctx.fillText(data, bar._model.x, bar._model.y - 5);
});
});
}
}
};
new Chart(guzhangchartCanvas, {
type: 'line',
data: guzhanglinedata,
options: optsguzhangLineChart
});
//数据表
$("#jsGrid1").jsGrid({
height: "300px",
width: "100%",
sorting: true,
paging: false,
data: result['tables'],
fields: [
{ name: "id", title: "項次", type: "text", },
{ name: "facilityno", title: "電梯編號", type: "text", },
{ name: "identifying_code", title: "識別碼", type: "text", },
{ name: "breakdown_code", title: "故障代碼", type: "text", },
{ name: "breakdown_content", title: "故障内容", type: "text", },
{ name: "breakdown_date", title: "故障时间", type: "text", },
]
});
}
})
}
// 補丁 actualdate = 展示太久沒更新保養日期做假資料
function fakeActualdate(actualdate) {
if (actualdate.substring(0, 2) == '預計') {
return actualdate;
}
const today = new Date();
const currentYear = today.getFullYear();
const currentMonth = today.getMonth() - 1;
let datetimeArr = actualdate.split(' ');
let dateArr = datetimeArr[0].split('-');
let timeArr = datetimeArr[1].split(':');
let year = parseInt(dateArr[0]);
let month = parseInt(dateArr[1]);
let day = parseInt(dateArr[2]);
let hour = parseInt(timeArr[0]);
let minute = parseInt(timeArr[1]);
let second = parseInt(timeArr[2]);
if (day > 30) {
day = day - 1;
}
// return "2020-01-01 00:00:00";
if (year <= currentYear && month <= currentMonth) {
return year + '-' + (currentMonth + 1) + '-' + day + ' ' + hour + ':' + minute + ':' + second;
} else {
return actualdate;
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDCJp-JIcYIyeR_QNpREvsepApvVytZWOs&callback=initMap"
async defer></script>
</body>
</html>

31
phb/map/worksite.php

@ -5,13 +5,32 @@ try {
$conn = new DB(); $conn = new DB();
if ($conn) { if ($conn) {
$sql = "SELECT distinct(latitude),longitude,facilitynum,facilityno,address,buildcompany,marchintotime,estimatedcompletiontime,process,status,create_at from worksite ORDER BY create_at desc"; $sql = "SELECT
DISTINCT
latitude,
longitude,
facilitynum,
facilityno,
address,
buildcompany,
marchintotime,
estimatedcompletiontime,
process,
status,
create_at
FROM worksite
WHERE (maintainance_facility_no IS NULL
OR maintainance_facility_no = '')
ORDER BY create_at DESC ";
$result = $conn->getAll($sql); $result = $conn->getAll($sql);
//print_r($result); for ($i = 0; $i < sizeof($result); $i++) {
for($i=0;$i<sizeof($result);$i++){ $facilityno = $result[$i]["facilityno"];
$installsql = "SELECT * FROM wipinstallation where facilityno = '".$result[$i]["facilityno"]."' order by id desc"; # sql語法存在變數中 $installsql = " SELECT *
$installinffo=$conn->getAll($installsql); FROM wipinstallation
$result[$i]['installschedule']= $installinffo; WHERE facilityno = '$facilityno'
ORDER BY id DESC ";
$installinffo = $conn->getAll($installsql);
$result[$i]['installschedule'] = $installinffo;
} }
echo json_encode($result); echo json_encode($result);
} }

99
wms/T8_APItest_from_bpm.php

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

43
wms/T8_Authorization_from_bpm.php

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

255
wms/account-receivable-check.php

@ -0,0 +1,255 @@
<?php
include "./header.php";
$Bill = $_POST['Bill'];
$Bill = json_decode($Bill, true);
print_r($Bill);
// $sql_received = "SELECT * from account_received where BillNo = '$Bill[0]' ORDER BY `pay_id` ASC";
// $pay_received = mysqli_query($link, $sql_received);
// $had_received_amount = intval(0);
// $had_invoice_amount=intval(0);
// $status_summary = intval(0);
// if (mysqli_num_rows($pay_received) > 0) {
// foreach ($pay_received as $received) {
// $had_received_amount += intval($received['received_amount']);
// $had_invoice_amount += intval($received['invoice_amount']);
// if(in_array(intval($received['status']),array(0,4,5,99))){
// $tem_status = intval(0);
// }else{
// $tem_status = intval($received['status']);
// }
// if($status_summary < $tem_status){
// $status_summary = $tem_status;
// }
// }
// }
// $unreceived_amount = intval($Bill[12]) - intval($had_received_amount);
// $uninvoice_amount = intval($Bill[12]) - intval($had_invoice_amount);
// $Bill[19] =$had_invoice_amount;
// $Bill[20] =$had_received_amount;
// $Bill[21] =$uninvoice_amount;
// $Bill[22] =$unreceived_amount;
// $Bill[23] =$status_summary;
$data = json_encode($Bill);
?>
<style>
th {
text-align: center;
}
td {
text-align: right;
}
</style>
<div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;">
<a href="account-receivable-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-home"></span>
</a>
</div>
</div>
<div class="container">
<div class="text-center" style="margin-bottom: 20px;">
<h3><strong><?= $Bill[4] ?></strong></h3>
</div>
<form class="form-horizontal">
<div class="form-group">
<div class="col-md-3">
<label for="BillNo">合約號</label>
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $Bill[10] ?>" disabled>
</div>
<div class="col-md-3">
<label for="DeptId">部門</label>
<input type="text" class="form-control" id="DeptId" name="DeptId" value="<?= $Bill[1] ?>" disabled>
</div>
<div class="col-md-3">
<label for="Manager">經理</label>
<input type="text" class="form-control" id="Manager" name="Manager" value="<?= $Bill[2] ?>" disabled>
</div>
<div class="col-md-3">
<label for="PersonName">營業員</label>
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $Bill[4] ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="EnterpriseName">抬頭</label>
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $Bill[6] ?>" disabled>
</div>
<div class="col-md-3">
<label for="TaxNo">統一編號</label>
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[7] ?>" disabled>
</div>
<div class="col-md-6">
<label for="ContactAddress">聯絡地址</label>
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[8] ?>" disabled>
</div>
</div>
<div>
<label for="detail">狀態</label>
<textarea class="form-control" style="height: 150px; width: 50%;" name="detail" id="detail" disabled><?= str_replace("<br>", "\n", $Bill['facilities']) ?></textarea>
</div>
</form>
<div style="width: auto; margin-top: 30px;">
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>目前應收</th>
<!-- <th>已開發票金額</th>
<th>未開發票金額</th>
<th>已收金額</th>
<th>未收金額</th> -->
</tr>
</thead>
<tbody>
<tr>
<td><?= number_format(round($Bill['receivable_budget'])) ?></td>
<!-- <td><?= number_format(round($Bill[19])) ?></td>
<td><?= number_format(round($Bill[21])) ?></td>
<td><?= number_format(round($Bill[20])) ?></td>
<td><?= number_format(round($Bill[22])) ?></td> -->
</tr>
</tbody>
</table>
</div>
<div style="width: auto; margin-top: 30px;">
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>簽約款</th>
<th>二次款</th>
<th>貨抵工地款</th>
<th>安裝款</th>
<th>試車款</th>
<th>官檢款</th>
<th>交車款</th>
<th>尾款</th>
</tr>
</thead>
<tbody>
<tr>
<td><?= number_format(round($Bill['sign'][1])) ?></td>
<td><?= number_format(round($Bill['second'][1])) ?></td>
<td><?= number_format(round($Bill['arrive'][1])) ?></td>
<td><?= number_format(round($Bill['install'][1])) ?></td>
<td><?= number_format(round($Bill['tryrun'][1])) ?></td>
<td><?= number_format(round($Bill['check'][1])) ?></td>
<td><?= number_format(round($Bill['delivery'][1])) ?></td>
<td><?= number_format(round($Bill['final'][1])) ?></td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
include "./footer.php";
?>
<?php
if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) {
?>
<button type="button" onclick="create('create',0)" class="btn btn-primary btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;">
新增收款紀錄<span class=" glyphicon glyphicon-plus"></span></button>
<?php
}
?>
<div style="margin-right: 10%;margin-left: 10%; justify-content: center;">
<table class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th>發票日期</th>
<th>發票金額</th>
<th>發票號碼</th>
<th>收款日期</th>
<th>收款金額</th>
<th>備註</th>
<th>狀態</th>
<?php if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) { ?>
<th style="width: 10%;">功能</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php if ($pay_received) {
foreach ($pay_received as $received) { ?>
<tr>
<td><?= $received['invoice_date'] ?></td>
<td><?= number_format($received['invoice_amount']) ?></td>
<td><?= $received['invoice_no'] ?></td>
<td><?= $received['received_date'] ?></td>
<td><?= number_format($received['received_amount']) ?></td>
<td><?= $received['remark'] ?></td>
<td style="text-align: center;">
<?php
switch ($received['status']) {
case 0:
echo "<span style='color:blue;'>進行中</span>";
break;
case 1:
echo "<span style='color:brown;'>催收</span>";
break;
case 2:
echo "<span style='color:red;'>法務件 (發函)</span>";
break;
case 3:
echo "<span style='color:red;'>法務件 (訴訟)</span>";
break;
case 4:
echo "折讓";
break;
case 5:
echo "壞帳";
break;
case 99:
echo "完成";
break;
}
?></td>
<?php if ((accountidToDepartId($user_id) == '220') || ($user_id == "M0209")) { ?>
<td>
<button type="button" onclick="create('edit',<?= $received['pay_id'] ?>)" class="btn btn-warning btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;">
<span class="glyphicon glyphicon-pencil"></span></button>
<!-- <a href="account-receivable-received-delete.php?id=<?php echo $received['pay_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm">
<span class=" glyphicon glyphicon-trash"></span>
</a> -->
</td>
<?php } ?>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
<script>
function create(type, pay_id) {
var BillData = <?= $data ?>;
var form = document.createElement("form");
form.method = 'POST';
if (type === 'create') {
form.action = "account-receivable-received-create.php?<?= $token_link ?>";
} else {
form.action = "account-receivable-received-edit.php?pay_id=" + pay_id + "&<?= $token_link ?>";
}
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(BillData);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
</script>

51
wms/account-receivable-excel.php

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

475
wms/account-receivable-index.php

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

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

@ -0,0 +1,124 @@
<?php
include "./header.php";
$Bill = $_POST['Bill'];
$BillData = json_decode($Bill, true);
?>
<div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;">
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button>
</div>
</div>
<div class="container">
<div class="text-center">
<h3><strong><?= $BillData[4] ?></strong></h3>
<h4>新增收款資訊</h4>
</div>
<form class="form-horizontal" id="pay_received" method="POST" action="account-receivable-received-submit.php?type=create&<?= $token_link ?>" enctype="multipart/form-data">
<div class="form-group" style="margin-left: 1%;margin-right: 1%;">
<div class="form-group">
<div class="col-md-3">
<label for="BillNo">合約號</label>
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $BillData[0] ?>" disabled>
</div>
<div class="col-md-3">
<label for="DeptName">部門</label>
<input type="text" class="form-control" id="DeptName" name="DeptName" value="<?= $BillData[1] ?>" disabled>
</div>
<div class="col-md-3">
<label for="ManagerName">經理</label>
<input type="text" class="form-control" id="ManagerName" name="ManagerName" value="<?= $BillData[2] ?>" disabled>
</div>
<div class="col-md-3">
<label for="PersonName">營業員</label>
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $BillData[3] ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="EnterpriseName">抬頭</label>
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $BillData[14] ?>" disabled>
</div>
<div class="col-md-3">
<label for="TaxNo">統一編號</label>
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $BillData[15] ?>" disabled>
</div>
<div class="col-md-6">
<label for="ContactAddress">聯絡地址</label>
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $BillData[16] ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="InvoiceDate">發票開立日期</label>
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate" >
</div>
<div class="col-md-3">
<label for="InvoiceAmount">發票金額</label>
<input type="number" class="form-control" id="InvoiceAmount" name="InvoiceAmount" >
</div>
<div class="col-md-3">
<label for="InvoiceNo">發票號碼</label>
<input type="text" class="form-control" id="InvoiceNo" name="InvoiceNo" >
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="ReceivedDate">收款日期</label>
<input type="date" class="form-control" id="ReceivedDate" name="ReceivedDate" >
</div>
<div class="col-md-3">
<label for="ReceivedAmount">收款金額</label>
<input type="number" class="form-control" id="ReceivedAmount" name="ReceivedAmount" >
</div>
<div class="col-md-3">
<label for="remark">備註</label>
<input type="text" class="form-control" id="remark" name="remark" >
</div>
</div>
<input type="hidden" name="DeptId" value="<?= $BillData[17] ?>">
<input type="hidden" name="PersonId" value="<?= $BillData[18] ?>">
<input type="hidden" name="CustName" value="<?= $BillData[4] ?>">
<input type="hidden" name="Bill" id="Bill" value="">
</div>
<div class="form-group">
<div class="col-md-3">
</div>
<div class="col-md-9">
<button type="button" onclick="send()" class="btn btn-primary btn-lg pull-right">送出</button>
</div>
</div>
</form>
</div>
<script>
function backToIndex() {
var Bill = <?= $Bill ?>;
var form = document.createElement("form");
form.method = 'POST';
form.action = "account-receivable-check.php?<?= $token_link ?>";
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(Bill);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
function send() {
event.preventDefault();
$("#BillNo").prop("disabled", false);
$("#DeptName").prop("disabled", false);
$("#ManagerName").prop("disabled", false);
$("#PersonName").prop("disabled", false);
var Bill = <?= $Bill ?>;
Bill = JSON.stringify(Bill);
$("#Bill").val(Bill);
$("#pay_received").submit();
}
</script>

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

@ -0,0 +1,142 @@
<?php
include "./header.php";
$Bill = $_POST['Bill'];
$BillData = json_decode($Bill, true);
$pay_id = $_GET['pay_id'];
// echo $pay_id."<br>";
// print_r($BillData);
$sql_pay = "SELECT * from account_received where pay_id = '$pay_id'";
$pay = mysqli_query($link, $sql_pay);
$pay = mysqli_fetch_assoc($pay);
?>
<div style="width: 90%;">
<div style="padding-left: 2rem; padding-bottom: 1rem;">
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button>
</div>
</div>
<div class="container">
<div class="text-center">
<h3><strong><?= $BillData[4] ?></strong></h3>
<h4>編輯收款資訊</h4>
</div>
<form class="form-horizontal" id="pay_received" method="POST" action="account-receivable-received-submit.php?type=edit&<?= $token_link ?>" enctype="multipart/form-data">
<div class="form-group" style="margin-left: 1%;margin-right: 1%;">
<div class="form-group">
<div class="col-md-3">
<label for="BillNo">合約號</label>
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $BillData[0] ?>" disabled>
</div>
<div class="col-md-3">
<label for="DeptName">部門</label>
<input type="text" class="form-control" id="DeptName" name="DeptName" value="<?= $BillData[1] ?>" disabled>
</div>
<div class="col-md-3">
<label for="ManagerName">經理</label>
<input type="text" class="form-control" id="ManagerName" name="ManagerName" value="<?= $BillData[2] ?>" disabled>
</div>
<div class="col-md-3">
<label for="PersonName">營業員</label>
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $BillData[3] ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="EnterpriseName">抬頭</label>
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $BillData[14] ?>" disabled>
</div>
<div class="col-md-3">
<label for="TaxNo">統一編號</label>
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $BillData[15] ?>" disabled>
</div>
<div class="col-md-6">
<label for="ContactAddress">聯絡地址</label>
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $BillData[16] ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="InvoiceDate">發票開立日期</label>
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate" value="<?= $pay['invoice_date'] ?>">
</div>
<div class="col-md-3">
<label for="InvoiceAmount">發票金額</label>
<input type="number" class="form-control" id="InvoiceAmount" name="InvoiceAmount" value="<?= $pay['invoice_amount'] ?>">
</div>
<div class="col-md-3">
<label for="InvoiceNo">發票號碼</label>
<input type="text" class="form-control" id="InvoiceNo" name="InvoiceNo" value="<?= $pay['invoice_no'] ?>">
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="ReceivedDate">收款日期</label>
<input type="date" class="form-control" id="ReceivedDate" name="ReceivedDate" value="<?= $pay['received_date'] ?>">
</div>
<div class="col-md-3">
<label for="ReceivedAmount">收款金額</label>
<input type="number" class="form-control" id="ReceivedAmount" name="ReceivedAmount" value="<?= $pay['received_amount'] ?>">
</div>
<div class="col-md-3">
<label for="remark">備註</label>
<input type="text" class="form-control" id="remark" name="remark" value="<?= $pay['remark'] ?>">
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="status" style="color: red;">狀態</label>
<select id="status" name="status">
<option value=0 <?php if($pay['status'] == 0) echo "selected" ?>>進行中</option>
<option value=1 <?php if($pay['status'] == 1) echo "selected" ?>>催收</option>
<option value=2 <?php if($pay['status'] == 2) echo "selected" ?>>法務件 (發函)</option>
<option value=3 <?php if($pay['status'] == 3) echo "selected" ?>>法務件 (訴訟)</option>
<option value=4 <?php if($pay['status'] == 4) echo "selected" ?>>折讓</option>
<option value=5 <?php if($pay['status'] == 5) echo "selected" ?>>壞帳</option>
<option value=99 <?php if($pay['status'] == 99) echo "selected" ?>>完成</option>
</select>
</div>
</div>
<input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>">
<input type="hidden" name="Bill" id="Bill" value="">
</div>
<div class="form-group">
<div class="col-md-3">
</div>
<div class="col-md-9">
<button type="button" onclick="send()" class="btn btn-primary btn-lg pull-right">送出</button>
</div>
</div>
</form>
</div>
<script>
function backToIndex() {
var Bill = <?= $Bill ?>;
var form = document.createElement("form");
form.method = 'POST';
form.action = "account-receivable-check.php?<?= $token_link ?>";
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(Bill);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
}
function send() {
event.preventDefault();
var Bill = <?= $Bill ?>;
Bill = JSON.stringify(Bill);
$("#Bill").val(Bill);
$("#pay_received").submit();
}
</script>

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

@ -0,0 +1,96 @@
<?php
include "./header.php";
$type = $_GET['type'];
$InvoiceNo = empty($_POST['InvoiceNo']) ? '' : str_replace('-', '', trim($_POST['InvoiceNo']));
$InvoiceDate = isset($_POST['InvoiceDate']) ? $_POST['InvoiceDate'] : '';
$Bill = $_POST['Bill'];
$invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount'];
$received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount'];
$received_date = isset($_POST['ReceivedDate']) ? $_POST['ReceivedDate'] : '';
$remark = isset($_POST['remark']) ? $_POST['remark'] : '';
if ($type == 'edit') {
$pay_id = $_POST['pay_id'];
$status = $_POST['status'];
$sql_query_pay = "SELECT * from account_received where pay_id = $pay_id";
$pay = mysqli_query($link, $sql_query_pay);
$pay = mysqli_fetch_assoc($pay);
$sql1 = "UPDATE account_received SET ";
if ($InvoiceNo !== $pay['invoice_no']) {
$sql1 .= "invoice_no = '$InvoiceNo',";
}
if ($InvoiceDate != $pay['invoice_date']) {
$sql1 .= "invoice_date = '$InvoiceDate',";
}
if ($invoice_amount != $pay['invoice_amount']) {
$sql1 .= "invoice_amount = $invoice_amount,";
}
if ($received_amount != $pay['received_amount']) {
$sql1 .= "received_amount = $received_amount,";
}
if ($received_date != $pay['received_date']) {
$sql1 .= "received_date = '$received_date',";
}
if ($remark != $pay['remark']) {
$sql1 .= "remark = '$remark',";
}
if ($status != $pay['status']) {
$sql1 .= "status = $status,";
}
// $sql1 = substr($sql1, 0, -1);
$sql = $sql1 . "LastOperatorId = '$user_id' WHERE pay_id = $pay_id";
} else {
$BillNo = $_POST['BillNo'];
$dept_id = $_POST['DeptId'];
$dept_name = $_POST['DeptName'];
$manager_name = $_POST['ManagerName'];
$person_id = $_POST['PersonId'];
$person_name = $_POST['PersonName'];
$cust_name = $_POST['CustName'];
$sql1 = "INSERT INTO account_received (
BillNo,dept_id,dept_name,manager_name,person_id,person_name,cust_name";
$sql2 = ",CreatorId) VALUES ('$BillNo','$dept_id','$dept_name','$manager_name','$person_id','$person_name','$cust_name'";
if (isset($InvoiceNo)) {
$sql1 .= ",invoice_no";
$sql2 .= ",'$InvoiceNo'";
}
if ((!empty($InvoiceDate))) {
$sql1 .= ",invoice_date";
$sql2 .= ",'$InvoiceDate'";
}
if (isset($invoice_amount)) {
$sql1 .= ",invoice_amount";
$sql2 .= ",$invoice_amount";
}
if (isset($received_amount)) {
$sql1 .= ",received_amount";
$sql2 .= ",$received_amount";
}
if (!(empty($received_date))) {
$sql1 .= ",received_date";
$sql2 .= ",'$received_date'";
}
if (!(empty($remark))) {
$sql1 .= ",remark";
$sql2 .= ",'$remark'";
}
$sql = $sql1 . $sql2 . ",'$user_id')";
}
mysqli_query($link, $sql);
?>
<script>
var Bill = <?= $Bill ?>;
var form = document.createElement("form");
form.method = 'POST';
form.action = "account-receivable-check.php?<?= $token_link ?>";
var input = document.createElement("input");
input.type = "hidden";
input.name = "Bill";
input.value = JSON.stringify(Bill);
form.appendChild(input);
document.body.appendChild(form);
form.submit();
</script>

BIN
wms/account-receivable.xlsx

Binary file not shown.

91
wms/board-create.php

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

3
wms/board-record-submit.php

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

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

@ -126,51 +126,61 @@
/* 旋转动画 */ /* 旋转动画 */
} }
/* The Modal (background) */ /* The Modal (background) */
.modal { .modal {
display: none; /* Hidden by default */ display: none;
position: fixed; /* Stay in place */ /* Hidden by default */
z-index: 1; /* Sit on top */ position: fixed;
padding-top: 100px; /* Location of the box */ /* Stay in place */
left: 0; z-index: 1;
top: 0; /* Sit on top */
width: 100%; /* Full width */ padding-top: 100px;
height: 100%; /* Full height */ /* Location of the box */
overflow: auto; /* Enable scroll if needed */ left: 0;
top: 0;
} width: 100%;
.modal .back{ /* Full width */
position: absolute; height: 100%;
top: 0; /* Full height */
left:0; overflow: auto;
width: 100%; /* Enable scroll if needed */
height: 100%;
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ }
}
/* Modal Content */ .modal .back {
.modal-content { position: absolute;
z-index: 9; top: 0;
background-color: #fefefe; left: 0;
margin: auto; width: 100%;
padding: 20px; height: 100%;
border: 1px solid #888; background-color: rgba(0, 0, 0, 0.4);
width: 80%; /* Black w/ opacity */
} }
/* The Close Button */ /* Modal Content */
.close { .modal-content {
color: #aaaaaa; z-index: 9;
float: right; background-color: #fefefe;
font-size: 28px; margin: auto;
font-weight: bold; padding: 20px;
} border: 1px solid #888;
width: 80%;
.close:hover, }
.close:focus {
color: #000; /* The Close Button */
text-decoration: none; .close {
cursor: pointer; color: #aaaaaa;
} float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
@keyframes spin { @keyframes spin {

56
wms/css/view/wipwhole-renovate-index.php

@ -126,6 +126,62 @@
/* 旋转动画 */ /* 旋转动画 */
} }
/* The Modal (background) */
.modal {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
padding-top: 100px;
/* Location of the box */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
}
.modal .back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
/* Black w/ opacity */
}
/* Modal Content */
.modal-content {
z-index: 9;
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
table { table {

97
wms/frame/api_getdata.php

@ -1,4 +1,5 @@
<?php <?php
/** /**
* 提供首頁資料 * 提供首頁資料
* @url /frame/api_getdata.php * @url /frame/api_getdata.php
@ -20,12 +21,13 @@
* *
*/ */
$json = array("st"=>"ok","err"=>"","errCode"=>""); $json = array("st" => "ok", "err" => "", "errCode" => "");
/** /**
* 表單列表 * 表單列表
*/ */
function get_forms() { function get_forms()
{
global $link; global $link;
$i = 1; $i = 1;
@ -45,7 +47,8 @@ function get_forms() {
/** /**
* 公告欄列表 * 公告欄列表
*/ */
function get_board() { function get_board()
{
global $link; global $link;
$i = 1; $i = 1;
@ -70,16 +73,17 @@ function get_board() {
/** /**
* 系統通知列表 * 系統通知列表
*/ */
function get_notice($token) { function get_notice($token)
{
global $link; global $link;
if (!$token) throw new \Exception("token empty", 802); if (!$token) throw new \Exception("token empty", 802);
list($user_id) = explode(".", $token); list($user_id) = explode(".", $token);
$i = 1; $i = 1;
$data = []; $data = [];
$sql = "select id, kind, related_id, title from notice "; $sql = "select id, kind, related_id, title from notice ";
$sql .= "where (permission like '%".$user_id."%' or permission = 'ALL' or creater = '$user_id') "; $sql .= "where (permission like '%" . $user_id . "%' or permission = 'ALL' or creater = '$user_id') ";
$sql .= "and haveread != '1' "; $sql .= "and (haveread != '1' or haveread is null) ";
$sql .= "order by create_at desc limit 0, 6"; $sql .= "order by id desc limit 0, 6";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) { while ($row = mysqli_fetch_assoc($res)) {
$data[$i]["id"] = $row["id"]; $data[$i]["id"] = $row["id"];
@ -95,24 +99,64 @@ function get_notice($token) {
/** /**
* 待我簽核 * 待我簽核
*/ */
function get_pending($token) { function get_pending($token)
{
global $link; global $link;
if (!$token) throw new \Exception("token empty", 802); if (!$token) throw new \Exception("token empty", 802);
list($user_id) = explode(".", $token); list($user_id) = explode(".", $token);
$i = 1; $i = 1;
$data = []; $data = [];
$sql = "
SELECT
t.system_id,
t.system_name,
t.flow_id,
t.flow_name,
COUNT(*)
FROM (
SELECT s.form_key,
m.system_id,
y.system_name,
m.flow_id,
m.flow_name,
m.path
FROM subflow s,
flow f,
flow_main m,
system_main y
WHERE EXISTS (
SELECT form_key,
MAX(seq)
FROM subflow
GROUP BY form_key
HAVING SUBSTRING(s.form_key, 1, 10) = form_key
AND s.seq = max(seq)
)
AND SUBSTRING(s.form_key, 1, 10) = f.form_key
AND f.flow_id = m.flow_id
AND f.system_id = y.system_id
AND s.current_assigner = '$user_id'
AND f.flow_code != 'Z'
) t
GROUP BY t.system_id,
t.flow_id,
t.system_name,
t.flow_name
LIMIT 0, 6
";
// $sql = "select t.system_id, t.system_name, t.flow_id, t.flow_name, count(*) from (";
// $sql .= "select s.form_key, m.system_id, y.system_name, m.flow_id, m.flow_name, m.path from subflow s, flow f, flow_main m, system_main y ";
// $sql .= "where ";
// $sql .= "EXISTS (
// select form_key, max(seq) from subflow
// group by form_key
// having SUBSTRING(s.form_key,1,10) = form_key and s.seq = max(seq)
// ) ";
// $sql .= "and SUBSTRING(s.form_key,1,10) = f.form_key and f.flow_id = m.flow_id and f.system_id = y.system_id and s.current_assigner = '$user_id'";
// $sql .= ") t group by t.system_id, t.flow_id, t.system_name, t.flow_name ";
// $sql .= "limit 0, 6";
$sql = "select t.system_id, t.system_name, t.flow_id, t.flow_name, count(*) from (";
$sql .= "select s.form_key, m.system_id, y.system_name, m.flow_id, m.flow_name, m.path from subflow s, flow f, flow_main m, system_main y ";
$sql .= "where ";
$sql .= "EXISTS (
select form_key, max(seq) from subflow
group by form_key
having SUBSTRING(s.form_key,1,10) = form_key and s.seq = max(seq)
) ";
$sql .= "and SUBSTRING(s.form_key,1,10) = f.form_key and f.flow_id = m.flow_id and f.system_id = y.system_id and s.current_assigner = '$user_id'";
$sql .= ") t group by t.system_id, t.flow_id, t.system_name, t.flow_name ";
$sql .= "limit 0, 6";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) { while ($row = mysqli_fetch_row($res)) {
$data[$i]["sid"] = $row[0]; $data[$i]["sid"] = $row[0];
@ -139,7 +183,7 @@ function get_pending($token) {
return $data; return $data;
} }
try{ try {
if (empty($_REQUEST)) throw new \Exception("post empty", 801); if (empty($_REQUEST)) throw new \Exception("post empty", 801);
if (empty($_REQUEST["p"])) throw new \Exception("post p empty", 801); if (empty($_REQUEST["p"])) throw new \Exception("post p empty", 801);
@ -161,13 +205,10 @@ try{
default: default:
echo "error"; echo "error";
} }
} catch (\Exception $ex) {
$json["st"] = "err";
}catch(\Exception $ex){ $json["err"] = $ex->getMessage();
$json["st"] = "err"; $json["errCode"] = (!empty($ex->getCode())) ? $ex->getCode() : 701;
$json["err"] = $ex->getMessage();
$json["errCode"] = (!empty($ex->getCode()))?$ex->getCode():701;
} }
echo json_encode($json,JSON_UNESCAPED_UNICODE); echo json_encode($json, JSON_UNESCAPED_UNICODE);
?>

91
wms/fun_global.php

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

62
wms/gary.php

@ -1,6 +1,67 @@
<?php <?php
// 接收 referer 參數
if (isset($_GET['referer'])) {
$referer = urldecode($_GET['referer']);
echo "HTTP_REFERER 是: $referer";
echo "<br/>";
date_default_timezone_set('Asia/Taipei');
$currentTimestamp = time();
$hashReferer = "";
for ($i = -3; $i <= 3; $i++) {
$modifiedTimestamp = strtotime("$i seconds", $currentTimestamp);
$formattedTime = date("Y-m-d H:i:s", $modifiedTimestamp);
$hashReferer .= md5("https://bpm.masada.com.twMasada@2023".$formattedTime);
}
echo $hashReferer;
if (strpos($hashReferer, $referer)) {
echo "login";
}
} else {
echo "沒有 HTTP_REFERER 資訊可用";
}
echo "<br/>";
if(isset($_SERVER['HTTP_REFERER'])) {
$referrer = $_SERVER['HTTP_REFERER'];
echo "來自於: $referrer";
} else {
echo "沒有 referrer 資訊可用";
}
echo "<br/>";
if (isset($_SERVER['REMOTE_ADDR'])) {
$visitor_ip = $_SERVER['REMOTE_ADDR'];
echo "訪問者的 IP 地址是: $visitor_ip";
} else {
echo "REMOTE_ADDR : 無法獲取訪問者的 IP 地址";
}
echo "<br/>";
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$visitor_ip = $_SERVER['HTTP_CLIENT_IP'];
echo "訪問者的 IP 地址是: $visitor_ip";
} else {
echo "HTTP_CLIENT_IP : 無法獲取訪問者的 IP 地址";
}
echo "<br/>";
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$visitor_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
echo "訪問者的 IP 地址是: $visitor_ip";
} else {
echo "HTTP_X_FORWARDED_FOR : 法獲取訪問者的 IP 地址";
}
echo "<br/>";
?>
<script>
var referrer = document.referrer;
console.log("前一個網頁是:" + referrer);
</script>
<?php
exit;
ini_set('display_errors', 'on'); ini_set('display_errors', 'on');
echo $referrer = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "抓不到";
exit;
include "fun_global.php"; include "fun_global.php";
include "database.php"; include "database.php";
print_r(manage_class("M0117")); print_r(manage_class("M0117"));
@ -60,4 +121,3 @@ echo manage_class("M0117")[0];
// mysqli_query($link, $sql2); // mysqli_query($link, $sql2);
// } // }
// endforeach; // endforeach;

552
wms/header.php

@ -7,40 +7,41 @@ ini_set('display_errors', 'off');
// $maintenancePage = new MaintenancePage($maintenancePeriod); // $maintenancePage = new MaintenancePage($maintenancePeriod);
// $maintenancePage->displayPage(); // $maintenancePage->displayPage();
function CreateToken($user_id, $user_name) { function CreateToken($user_id, $user_name)
date_default_timezone_set("Asia/Taipei"); {
$start_time = date("Y-m-d H:i:s"); date_default_timezone_set("Asia/Taipei");
$end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时 $start_time = date("Y-m-d H:i:s");
$info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天 $end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时
$encryption_code = "MASADA!^***"; $info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量) $encryption_code = "MASADA!^***";
$signature = hash_hmac('md5', $info, $encryption_code); //根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
//最后将这两部分拼接起来,得到最终的Token字符串 $signature = hash_hmac('md5', $info, $encryption_code);
return $token = $info . '.' . $signature; //最后将这两部分拼接起来,得到最终的Token字符串
return $token = $info . '.' . $signature;
} }
require_once dirname(__FILE__) . "/../mkt/database.php"; require_once dirname(__FILE__) . "/../mkt/database.php";
include "fun_global.php"; include "fun_global.php";
if (isset($_REQUEST["function_name"])) { if (isset($_REQUEST["function_name"])) {
$function_name = $_REQUEST["function_name"]; $function_name = $_REQUEST["function_name"];
$function_flag = True; $function_flag = True;
} else { } else {
$function_name = ""; $function_name = "";
$function_flag = False; $function_flag = False;
} }
/** /**
* 連線T8 MSSQL * 連線T8 MSSQL
*/ */
// try { try {
// $conn = new PDO("sqlsrv:Server=10.10.145.2;Database=T8MASADA", "masada", "@m222222"); $conn = new PDO("sqlsrv:Server=erp.masada.com.tw;Database=T8MASADA", "masada", "ztPmPP!HRoV6SL3E");
// if ($conn) { if ($conn) {
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// } }
// } catch (PDOException $e) { } catch (PDOException $e) {
// //echo "fail"; //echo "fail";
// //echo $e->getMessage(); //echo $e->getMessage();
// } }
@ -53,34 +54,49 @@ if (isset($_REQUEST["function_name"])) {
* $login_dt 登入時間 * $login_dt 登入時間
* $user_auth 使用權限:1,2,3 * $user_auth 使用權限:1,2,3
*****************************/ *****************************/
$token = $_REQUEST["token"]; $token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : "";
if (count(explode(".", $token)) > 1) { if (count(explode(".", $token)) > 1) {
$token_link = "token=" . $_REQUEST["token"]; $token_link = "token=" . $_REQUEST["token"];
list($user_id, $enc_user_name, $login_dt) = explode(".", $token); list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
$user_name = urldecode(base64_decode($enc_user_name)); $user_name = urldecode(base64_decode($enc_user_name));
} else { } else {
$user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id; $referrer = isset($_GET['referer']) ? $_GET['referer'] : "";
$login_dt = !empty($_GET["timestamp"]) ? substr($_GET["timestamp"], 0, 10) : $login_dt; date_default_timezone_set('Asia/Taipei');
$login_dt = date('Y-m-d H:i:s', $login_dt); $currentTimestamp = time();
$user_name = accountid2name()[$user_id]; $hashReferer = "";
$token = CreateToken($user_id,$user_name); for ($i = -3; $i <= 3; $i++) {
$token_link = "token=" . $token; $modifiedTimestamp = strtotime("$i seconds", $currentTimestamp);
$formattedTime = date("Y-m-d H:i:s", $modifiedTimestamp);
$hashReferer .= md5("https://bpm.masada.com.twMasada@2023" . $formattedTime);
}
if (strpos($hashReferer, $referrer)) {
$user_id = !empty($_GET["employee_no"]) ? $_GET["employee_no"] : $user_id;
$login_dt = !empty($_GET["timestamp"]) ? substr($_GET["timestamp"], 0, 10) : $login_dt;
$login_dt = date('Y-m-d H:i:s', $login_dt);
// 藍凌超連結過來 token 設置永久
$login_dt = (date("Y") + 100) . "-12-31 23:59:59";
$user_name = accountid2name()[$user_id];
$token = CreateToken($user_id, $user_name);
$token_link = "token=" . $token;
} else {
echo "非法訪問!";
echo "<script>location.href='/wms/login.php'</script>";
}
} }
include 'IncludeCommon.php'; include 'IncludeCommon.php';
$includecommon = new IncludeCommon(); $includecommon = new IncludeCommon();
$accounttype = getAccounttype($link, $user_id); $accounttype = getAccounttype($link, $user_id);
$login_json = null; $login_json = null;
if (strlen($accounttype) != 0) { if (strlen($accounttype) != 0) {
$jsonres['menu'] = $includecommon->menu_v3($user_id, $accounttype); $jsonres['menu'] = $includecommon->menu_v3($user_id, $accounttype);
$login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE); $login_json = json_encode($jsonres, JSON_UNESCAPED_UNICODE);
} }
?> ?>
<script> <script>
res = eval("(" + JSON.stringify(<?php echo $login_json; ?>) + ")"); res = eval("(" + JSON.stringify(<?php echo $login_json; ?>) + ")");
window.localStorage.setItem("menu_<?php echo $user_id; ?>", res.menu); window.localStorage.setItem("menu_<?php echo $user_id; ?>", res.menu);
</script> </script>
<?php <?php
@ -94,196 +110,196 @@ $user_auth = check_user_permission($user_id, $token);
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Masada後臺系統</title> <title>Masada後臺系統</title>
<link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/styles.css" /> <link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/styles.css" />
<link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.css"> <link rel="stylesheet" href="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.css">
<style> <style>
a svg { a svg {
display: inline-block; display: inline-block;
vertical-align: text-top; vertical-align: text-top;
} }
.nav .icon {
display: none;
}
input:read-only { .nav .icon {
background-color: #eee5e5; display: none;
} }
@media screen and (max-width: 992px) { input:read-only {
.header-right { background-color: #eee5e5;
float: left !important; }
margin-top: -40px;
margin-left: -15px;
}
/*.nav.navbar-nav a:not(:last-child), .dropdown {*/
.nav.navbar-nav a,
.dropdown {
display: none;
}
.nav.navbar-nav .icon {
color: #fff;
display: block;
position: fixed;
right: 0;
top: 0;
}
}
@media screen and (max-width: 992px) { @media screen and (max-width: 992px) {
.nav.navbar-nav.responsive { .header-right {
position: relative; float: left !important;
} margin-top: -40px;
margin-left: -15px;
.nav.navbar-nav.responsive a.icon { }
position: fixed;
right: 0; /*.nav.navbar-nav a:not(:last-child), .dropdown {*/
top: 0; .nav.navbar-nav a,
} .dropdown {
display: none;
.nav.navbar-nav.responsive li { }
float: none;
display: block; .nav.navbar-nav .icon {
text-align: left; color: #fff;
} display: block;
position: fixed;
.nav.navbar-nav.responsive .dropdown { right: 0;
float: none; top: 0;
} }
}
.nav.navbar-nav.responsive .dropdown li {
position: relative;
}
.nav.navbar-nav.responsive .dropdown a {
display: block;
width: 100%;
text-align: left;
top: -10px;
line-height: 10px;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #000;
}
.nav.navbar-nav.responsive .dropdown ul {
width: 200px;
background-color: #fff;
}
.navbar-nav .open .dropdown-menu {
position: absolute;
}
}
@media screen and (max-width: 992px) { @media screen and (max-width: 992px) {
#member_content_phone { .nav.navbar-nav.responsive {
display: inline-grid !important; position: relative;
} }
}
</style> .nav.navbar-nav.responsive a.icon {
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.min.js"></script> position: fixed;
<script src="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.js"></script> right: 0;
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.dataTables.min.js"></script> top: 0;
<script src="<?php dirname(__DIR__); ?>/wms/css/dataTables.bootstrap4.min.js"></script> }
<script src="<?php dirname(__DIR__); ?>/wms/css/function.js"></script>
<script> .nav.navbar-nav.responsive li {
$(document).ready(function() { float: none;
if ($('#table_index').length !== 0) $('#table_index').DataTable(); display: block;
text-align: left;
if (window.localStorage) { }
//var tokendata=window.localStorage.getItem("token");
//var namedata=window.localStorage.getItem("name"); .nav.navbar-nav.responsive .dropdown {
//var logindata=window.localStorage.getItem("login"); float: none;
var menudata = window.localStorage.getItem("menu_<?php echo $user_id; ?>"); }
//if(tokendata==null || namedata==null || menudata==null){
if (menudata == null) { .nav.navbar-nav.responsive .dropdown li {
window.location.href = "<?php dirname(__DIR__); ?>/wms/login.php"; position: relative;
}
.nav.navbar-nav.responsive .dropdown a {
display: block;
width: 100%;
text-align: left;
top: -10px;
line-height: 10px;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #000;
}
.nav.navbar-nav.responsive .dropdown ul {
width: 200px;
background-color: #fff;
}
.navbar-nav .open .dropdown-menu {
position: absolute;
}
} }
} else {
// var tokendata=$.cookie("token"); @media screen and (max-width: 992px) {
} #member_content_phone {
display: inline-grid !important;
}
var url = "<?php dirname(__DIR__); ?>/wms/headerapi.php";
$.ajax({
method: 'post',
url: url,
data: {
token: '<?php echo $token; ?>'
},
success: function(data) {
var res = eval('(' + data + ')');
//console.log(res);
if (res.code != '200') {
window.location.href = '<?php dirname(__DIR__); ?>/wms/login.php?errno=3';
}
} }
}); </style>
<script src="<?php dirname(__DIR__); ?>/wms/css/jquery.min.js"></script>
var mdata = JSON.parse(menudata); <script src="<?php dirname(__DIR__); ?>/wms/css/bootstrap.min.js"></script>
var menuStr = ''; <script src="<?php dirname(__DIR__); ?>/wms/css/jquery.dataTables.min.js"></script>
var checkAuth = 0; <script src="<?php dirname(__DIR__); ?>/wms/css/dataTables.bootstrap4.min.js"></script>
var m = 1; <script src="<?php dirname(__DIR__); ?>/wms/css/function.js"></script>
for (var i in mdata) { <script>
menuStr += '<li class="dropdown">'; $(document).ready(function() {
menuStr += '<a class="dropdown-toggle" data-toggle="dropdown" href="#">' + i; if ($('#table_index').length !== 0) $('#table_index').DataTable();
menuStr += '<span class="caret"></span></a>';
menuStr += '<ul class="dropdown-menu">'; if (window.localStorage) {
for (var j in mdata[i]) { //var tokendata=window.localStorage.getItem("token");
for (var k in mdata[i][j]) { //var namedata=window.localStorage.getItem("name");
menuStr += '<li'; //var logindata=window.localStorage.getItem("login");
if (k == '<?php echo $function_name; ?>') menuStr += " class='active'"; var menudata = window.localStorage.getItem("menu_<?php echo $user_id; ?>");
menuStr += '><a href="<?php dirname(__DIR__); ?>/wms/' + mdata[i][j][k] + '?function_name=' + k + '&<?php echo $token_link; ?>"'; //if(tokendata==null || namedata==null || menudata==null){
if (k.indexOf('open-') !== -1) menuStr += ' target="_blank"'; if (menudata == null) {
menuStr += '>' + j + '</a></li>'; window.location.href = "<?php dirname(__DIR__); ?>/wms/login.php";
if (mdata[i][j][k] == window.location.pathname) checkAuth = 1; }
m++; } else {
} // var tokendata=$.cookie("token");
}
var url = "<?php dirname(__DIR__); ?>/wms/headerapi.php";
$.ajax({
method: 'post',
url: url,
data: {
token: '<?php echo $token; ?>'
},
success: function(data) {
var res = eval('(' + data + ')');
//console.log(res);
if (res.code != '200') {
window.location.href = '<?php dirname(__DIR__); ?>/wms/login.php?errno=3';
}
}
});
var mdata = JSON.parse(menudata);
var menuStr = '';
var checkAuth = 0;
var m = 1;
for (var i in mdata) {
menuStr += '<li class="dropdown">';
menuStr += '<a class="dropdown-toggle" data-toggle="dropdown" href="#">' + i;
menuStr += '<span class="caret"></span></a>';
menuStr += '<ul class="dropdown-menu">';
for (var j in mdata[i]) {
for (var k in mdata[i][j]) {
menuStr += '<li';
if (k == '<?php echo $function_name; ?>') menuStr += " class='active'";
menuStr += '><a href="<?php dirname(__DIR__); ?>/wms/' + mdata[i][j][k] + '?function_name=' + k + '&<?php echo $token_link; ?>"';
if (k.indexOf('open-') !== -1) menuStr += ' target="_blank"';
menuStr += '>' + j + '</a></li>';
if (mdata[i][j][k] == window.location.pathname) checkAuth = 1;
m++;
}
}
menuStr += '</ul>';
menuStr += '</li>';
}
menuStr += '<li><a href="javascript:void(0);" class="icon" onclick="myFunction()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grid-3x3-gap-fill" viewBox="0 0 16 16"><path d="M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V2zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V7zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2z"/></svg></a></li>';
/*
if (checkAuth == 0 && ('/wms/custom-create.php' != window.location.pathname)) {
window.location.href='login.php?errno=4';
}
*/
$('#menu_content').html(menuStr);
$('.dropdown a').on('click', function() {
$('.dropdown').removeClass('open');
});
});
function myFunction() {
var x = document.getElementById("menu_content");
if (x.className === "nav navbar-nav") {
x.className += " responsive";
} else {
x.className = "nav navbar-nav";
}
} }
menuStr += '</ul>'; </script>
menuStr += '</li>';
}
menuStr += '<li><a href="javascript:void(0);" class="icon" onclick="myFunction()"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-grid-3x3-gap-fill" viewBox="0 0 16 16"><path d="M1 2a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V2zM1 7a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V7zM1 12a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-2zm5 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2z"/></svg></a></li>';
/*
if (checkAuth == 0 && ('/wms/custom-create.php' != window.location.pathname)) {
window.location.href='login.php?errno=4';
}
*/
$('#menu_content').html(menuStr);
$('.dropdown a').on('click', function() {
$('.dropdown').removeClass('open');
});
});
function myFunction() {
var x = document.getElementById("menu_content");
if (x.className === "nav navbar-nav") {
x.className += " responsive";
} else {
x.className = "nav navbar-nav";
}
}
</script>
</head> </head>
<body> <body>
<nav class="navbar navbar-inverse"> <nav class="navbar navbar-inverse">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
<a class="navbar-brand" href="<?php dirname(__DIR__); ?>/wms/index.php?<?php echo $token_link; ?>">Masada</a> <a class="navbar-brand" href="<?php dirname(__DIR__); ?>/wms/index.php?<?php echo $token_link; ?>">Masada</a>
</div> </div>
<ul class="nav navbar-nav" id="menu_content"> <ul class="nav navbar-nav" id="menu_content">
</ul> </ul>
<!-- <!--
<div class="topnav" id="myTopnav"> <div class="topnav" id="myTopnav">
<a href="#home" class="active">Home</a> <a href="#home" class="active">Home</a>
<a href="#news">News</a> <a href="#news">News</a>
@ -303,53 +319,53 @@ $user_auth = check_user_permission($user_id, $token);
</div> </div>
--> -->
<div class="header-right"> <div class="header-right">
<ul class="nav navbar-nav" id="member_content"> <ul class="nav navbar-nav" id="member_content">
<li class="dropdown d-lg-none"> <li class="dropdown d-lg-none">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" style='padding:0px;padding-top:5px;'> <a class="dropdown-toggle" data-toggle="dropdown" href="#" style='padding:0px;padding-top:5px;'>
<?php echo $user_name . "(" . $user_id . ")" . "<br/>" . $login_dt; ?> <?php echo $user_name . "(" . $user_id . ")" . "<br/>" . $login_dt; ?>
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"> <a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg viewBox="0 0 24 24" width="16" height="16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g> <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g> <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier"> <g id="SVGRepo_iconCarrier">
<rect width="24" height="24" fill="white"></rect> <rect width="24" height="24" fill="white"></rect>
<path d="M2.5 12C2.5 12.2761 2.72386 12.5 3 12.5C3.27614 12.5 3.5 12.2761 3.5 12H2.5ZM3.5 12C3.5 7.30558 7.30558 3.5 12 3.5V2.5C6.75329 2.5 2.5 6.75329 2.5 12H3.5ZM12 3.5C15.3367 3.5 18.2252 5.4225 19.6167 8.22252L20.5122 7.77748C18.9583 4.65062 15.7308 2.5 12 2.5V3.5Z" fill="#000000"></path> <path d="M2.5 12C2.5 12.2761 2.72386 12.5 3 12.5C3.27614 12.5 3.5 12.2761 3.5 12H2.5ZM3.5 12C3.5 7.30558 7.30558 3.5 12 3.5V2.5C6.75329 2.5 2.5 6.75329 2.5 12H3.5ZM12 3.5C15.3367 3.5 18.2252 5.4225 19.6167 8.22252L20.5122 7.77748C18.9583 4.65062 15.7308 2.5 12 2.5V3.5Z" fill="#000000"></path>
<path d="M20.4716 2.42157V8.07843H14.8147" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M20.4716 2.42157V8.07843H14.8147" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M21.5 12C21.5 11.7239 21.2761 11.5 21 11.5C20.7239 11.5 20.5 11.7239 20.5 12L21.5 12ZM20.5 12C20.5 16.6944 16.6944 20.5 12 20.5L12 21.5C17.2467 21.5 21.5 17.2467 21.5 12L20.5 12ZM12 20.5C8.66333 20.5 5.77477 18.5775 4.38328 15.7775L3.48776 16.2225C5.04168 19.3494 8.26923 21.5 12 21.5L12 20.5Z" fill="#000000"></path> <path d="M21.5 12C21.5 11.7239 21.2761 11.5 21 11.5C20.7239 11.5 20.5 11.7239 20.5 12L21.5 12ZM20.5 12C20.5 16.6944 16.6944 20.5 12 20.5L12 21.5C17.2467 21.5 21.5 17.2467 21.5 12L20.5 12ZM12 20.5C8.66333 20.5 5.77477 18.5775 4.38328 15.7775L3.48776 16.2225C5.04168 19.3494 8.26923 21.5 12 21.5L12 20.5Z" fill="#000000"></path>
<path d="M3.52844 21.5784L3.52844 15.9216L9.18529 15.9216" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path> <path d="M3.52844 21.5784L3.52844 15.9216L9.18529 15.9216" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
</g> </g>
</svg> </svg>
更改密碼 更改密碼
</a> </a>
</li> </li>
<li> <li>
<a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"> <a style="color:#000;" href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" /> <path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" /> <path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg> </svg>
登出 登出
</a> </a>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
<div id="member_content_phone" style="display:none"> <div id="member_content_phone" style="display:none">
<span class="navbar-brand"> <span class="navbar-brand">
<h5><?php echo $user_name . "(" . $user_id . ")" . $login_dt; ?></h5> <h5><?php echo $user_name . "(" . $user_id . ")" . $login_dt; ?></h5>
</span> </span>
<a href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"> <a href="<?php dirname(__DIR__); ?>/wms/change-password.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;">
更改密碼</a> 更改密碼</a>
<a href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16"> <a href="<?php dirname(__DIR__); ?>/wms/logout.php?<?php echo $token_link; ?>" class="navbar-brand" style="font-size:14px;line-height:34px;"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" /> <path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" /> <path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
</svg> </svg>
登出</a> 登出</a>
</div> </div>
</div> </div>
</nav> </nav>

2
wms/loginapi.php

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

2
wms/rib01-check.php

@ -107,7 +107,7 @@ elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) :
</p> </p>
</div> </div>
<?php <?php
elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) : elseif ($state == 1) :
?> ?>
<div style="padding-left: 2rem;"> <div style="padding-left: 2rem;">

22
wms/rib01-create.php

@ -127,8 +127,8 @@ if ($MaxBillNo < 10) {
echo "selected"; echo "selected";
} ?>> <?php echo $value['Username']; ?> </option> --> } ?>> <?php echo $value['Username']; ?> </option> -->
<option value="<?php echo $key; ?>" id="<?= 'WriteOff' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) { <option value="<?php echo $key; ?>" id="<?= 'WriteOff' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) {
echo "selected"; echo "selected";
} ?>> <?php echo $value[0]; ?> </option> } ?>> <?php echo $value[0]; ?> </option>
<?php } <?php }
?> ?>
</select> </select>
@ -142,18 +142,15 @@ if ($MaxBillNo < 10) {
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="GatheringPersonId" style="color: red;">收款人</label> <label for="GatheringPersonId" style="color: red;">收款人</label>
<select name="GatheringPersonId" id="GatheringPersonId" class="form-control"> <select name="GatheringPersonId" id="GatheringPersonId" >
<option value="" style="display:flex" id="GatheringOption">請選擇收款人</option> <option value="" style="display:flex" id="GatheringOption">請選擇收款人</option>
<?php <?php
// foreach ($deptmem as $key => $value) {
foreach ($member as $key => $value) { foreach ($member as $key => $value) {
?> ?>
<!-- <option value="<?php echo $value['accountid']; ?>" id="<?= 'Gathering' . $value['department_id'] ?>" <?php if ($value['accountid'] == $user_id) {
echo "selected"; <option value="<?php echo $key; ?>" id="<?= 'Gathering' . $value[1] . "-" . $value[0] ?>" style="display:flex" <?php if ($key == $user_id) {
} ?>> <?php echo $value['name']; ?> </option> --> echo "selected";
<option value="<?php echo $key; ?>" id="<?= 'Gathering' . $value[1] . "-" . $value[0] ?>" <?php if ($key == $user_id) { } ?>> <?php echo $key.$value[0]; ?> </option>
echo "selected";
} ?>> <?php echo $value[0]; ?> </option>
<?php }; ?> <?php }; ?>
</select> </select>
</div> </div>
@ -180,7 +177,12 @@ if ($MaxBillNo < 10) {
</div> </div>
</form> </form>
</div> </div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/css/selectize.default.min.css" integrity="sha512-pTaEn+6gF1IeWv3W1+7X7eM60TFu/agjgoHmYhAfLEU8Phuf6JKiiE8YmsNC0aCgQv4192s4Vai8YZ6VNM6vyQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.15.2/js/selectize.min.js" integrity="sha512-IOebNkvA/HZjMM7MxL0NYeLYEalloZ8ckak+NDtOViP7oiYzG5vn6WVXyrJDiJPhl4yRdmNAG49iuLmhkUdVsQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script> <script>
$(document).ready(function() {
$('#GatheringPersonId').selectize();
})
$(function() { $(function() {
$("#DeptId").change(function() { $("#DeptId").change(function() {
changeWriteOffId($('#DeptId').val()); changeWriteOffId($('#DeptId').val());

74
wms/sign/list.php

@ -27,12 +27,44 @@ function getWipwholestatusDataByFormkey($link, $form_key, $flow_id)
* *
FROM wipwholestatus FROM wipwholestatus
WHERE id = '" . $row['form_id'] . "' WHERE id = '" . $row['form_id'] . "'
ANd status = '1'
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result); $row = mysqli_fetch_assoc($result);
return $row; return $row;
} }
function getwipwholeChangeContractdateDetailsDataByFormkey($link, $form_key, $flow_id)
{
$sql = "
SELECT
form_id
FROM flow
WHERE form_key = '$form_key'
AND system_id = 'wws'
AND flow_id = '$flow_id'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
$sql = "
SELECT
wipwholestatus_id
FROM wipwhole_change_contractdate_details
WHERE id = '" . $row['form_id'] . "'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
$sql = "
SELECT
*
FROM wipwholestatus
WHERE id = '" . $row['wipwholestatus_id'] . "'
ANd status = '1'
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($result);
return $row;
}
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id']; $system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$where_system_id = " and a.system_id like '" . $system_id . "%'"; $where_system_id = " and a.system_id like '" . $system_id . "%'";
@ -40,15 +72,28 @@ $where_system_id = " and a.system_id like '" . $system_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id']; $flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'"; $where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
$sql_get = "select c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner, $sql_get = "
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name , select
flow_name,c.update_date ,c.create_date,b.path,d.flow_code from system_main a,flow_main b ,subflow c.form_key,
c,flow d a.system_id,
where a.system_id=b.system_id b.flow_id ,
and b.flow_id=d.flow_id a.system_name,
and c.current_assigner='$user_id' c.current_assigner,
and d.flow_id=b.flow_id concat(
and c.form_key=d.form_key c.current_assigner ,
'-',f_return_name(c.current_assigner)
) current_assigner_name ,
flow_name,
c.update_date ,
c.create_date,
b.path,
d.flow_code
from system_main a,flow_main b ,subflow c,flow d
where a.system_id=b.system_id
and b.flow_id=d.flow_id
and c.current_assigner='$user_id'
and d.flow_id=b.flow_id
and c.form_key=d.form_key
$where_system_id $where_system_id
$where_flow_id $where_flow_id
"; ";
@ -173,7 +218,7 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
<tr> <tr>
<td> <td>
<?php <?php
if ($data['system_name'] == '作番大日程系統') { if (in_array($data['flow_name'], ['作番大日程(新梯)流程', '作番大日程(汰改)流程'])) {
$w_data = getWipwholestatusDataByFormkey($link, $data['form_key'], $data['flow_id']); $w_data = getWipwholestatusDataByFormkey($link, $data['form_key'], $data['flow_id']);
$facilityno = $w_data['facilityno']; $facilityno = $w_data['facilityno'];
$contractno = $w_data['contractno']; $contractno = $w_data['contractno'];
@ -182,6 +227,15 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
作番大日程-合約號:<?= $contractno ?> 作番號:<?= $facilityno ?> 作番大日程-合約號:<?= $contractno ?> 作番號:<?= $facilityno ?>
</a> </a>
<?php <?php
} else if (in_array($data['flow_name'], ['預計出貨日調整申請流程'])) {
$w_data = getwipwholeChangeContractdateDetailsDataByFormkey($link, $data['form_key'], $data['flow_id']);
$facilityno = $w_data['facilityno'];
$contractno = $w_data['contractno'];
?>
<a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>">
作番大日程-合約號:<?= $contractno ?> 作番號:<?= $facilityno ?>
</a>
<?php
} else { } else {
?> ?>
<a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>"> <a target="_blank" href="<?= $data['path'] . "?form_key=" . $data['form_key'] . "&token=$token" ?>">

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

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

2
wms/wipwhole-change-contractdate.php

@ -340,7 +340,7 @@ if (!empty(checkNowFormStatus($link)))
</select> </select>
"; ";
} else if (checkNowFormStatus($link) == 'B') { } else if (checkNowFormStatus($link) == 'B') {
if (getDepartmentId($link, $user_id) == '521' || getDepartmentId($link, $user_id) == '531') { if (in_array(getDepartmentId($link, $user_id), ['521', '531', '541', '542', '543', '544', '545'])){
echo "<select name='next_users' id='next_users'>"; echo "<select name='next_users' id='next_users'>";
foreach ($shengguanok_options as $shengguanok_option) : foreach ($shengguanok_options as $shengguanok_option) :
echo " echo "

22
wms/wipwhole-index-function.php

@ -11,6 +11,7 @@ function getWipwholestatusDetail($link, $id)
$db_query = " $db_query = "
SELECT * FROM SELECT * FROM
wipwholestatus WHERE id = '$id' wipwholestatus WHERE id = '$id'
AND status = '1'
"; ";
$receivabledata = mysqli_query($link, $db_query); $receivabledata = mysqli_query($link, $db_query);
return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC); return mysqli_fetch_array($receivabledata, MYSQLI_ASSOC);
@ -146,6 +147,10 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$sql_cmd = sql_myself($user_id, "salesid"); $sql_cmd = sql_myself($user_id, "salesid");
$sql = " $sql = "
@ -196,7 +201,7 @@ function getDataSql($department_id, $role_id, $user_id)
"; ";
return $sql; return $sql;
} }
if ($department_id == '314' && (in_array($role_id, ['2']))) { if ($department_id == '314' && (in_array($role_id, ['1', '2']))) {
$sql = " $sql = "
SELECT * FROM wipwholestatus SELECT * FROM wipwholestatus
WHERE 1=1 WHERE 1=1
@ -314,7 +319,10 @@ function getDataSqlByFlowCode($department_id, $role_id, $user_id, $flow_code)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$flow_code_tmp = explode(',', $flow_code); $flow_code_tmp = explode(',', $flow_code);
$flow_code = implode("','", $flow_code_tmp); $flow_code = implode("','", $flow_code_tmp);
@ -764,11 +772,12 @@ function getGongWuokNo($link)
// 取得生管部主管編號 // 取得生管部主管編號
function getShengGuanokLeaderNo($link) function getShengGuanokLeaderNo($link)
{ {
return "M0079";
$sql = " $sql = "
SELECT accountid SELECT accountid
FROM `account` FROM `account`
WHERE `department_id` = '321' WHERE `department_id` = '250'
AND `role_id` = '1'; AND `role_id` = '4';
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result); $row = mysqli_fetch_array($result);
@ -836,7 +845,8 @@ function getYewuStatus($link, $user_department_id, $role_id)
// 取得工務的欄位權限 // 取得工務的欄位權限
function getWarehouseStatus($link, $user_department_id, $role_id, $status) function getWarehouseStatus($link, $user_department_id, $role_id, $status)
{ {
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) { // if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
if(getSaveEstimateInstallData($user_department_id, $role_id)){
if ($status == 1) { if ($status == 1) {
return checkNowFormGStatus($link) == 'G' ? "" : "disabled"; return checkNowFormGStatus($link) == 'G' ? "" : "disabled";
} else { } else {
@ -1161,7 +1171,7 @@ function saveInstallData($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6']))
return true; return true;
if ($user_department_id == '545' && in_array($role_id, ['3', '6'])) if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true; return true;

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

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

147
wms/wipwhole-index.php

@ -40,9 +40,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
} }
// 宣告主資料空陣列
$data = array();
// 取得當前使用者所屬部門 // 取得當前使用者所屬部門
$department_id = getDepartmentId($link, $user_id); $department_id = getDepartmentId($link, $user_id);
// 取得當前使用者所屬職位 // 取得當前使用者所屬職位
@ -62,30 +59,27 @@ $site_survey_contact_verify = !isset($_REQUEST['site_survey_contact_verify']) ?
$real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start']; $real_contract_arrival_date_start = empty($_REQUEST['real_contract_arrival_date_start']) ? null : $_REQUEST['real_contract_arrival_date_start'];
$real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end']; $real_contract_arrival_date_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end'];
$area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no']; $area_no = !isset($_REQUEST['area_no']) ? '' : $_REQUEST['area_no'];
$sheetNum = empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum'];
$tableArr = array(
"All" => "",
"A" => "A",
"B" => "B",
"G" => "G",
"CH" => "C,H",
"Z" => "Z"
);
if (empty($sheetNum) || $sheetNum == "All") {
$sql = getDataSql($department_id, $role_id, $user_id);
} else {
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, $tableArr[$sheetNum]);
}
// 取得資料 sql // 取得資料 sql
$sql = getDataSql($department_id, $role_id, $user_id);
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// 取得資料(營業部門階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "A");
$dataA = mysqli_query($link, $sql);
// 取得資料(設計部門階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "B");
$dataB = mysqli_query($link, $sql);
// 取得資料(工勘部門階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "G");
$dataG = mysqli_query($link, $sql);
// 取得資料(生管階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "C,H");
$dataCH = mysqli_query($link, $sql);
// 取得資料(結案階段) sql
$sql = getDataSqlByFlowCode($department_id, $role_id, $user_id, "Z");
$dataZ = mysqli_query($link, $sql);
?> ?>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
@ -234,11 +228,8 @@ $dataZ = mysqli_query($link, $sql);
</div> </div>
<div class="col-md-3 col-12 text-right" id="myBtn"> <div class="col-md-3 col-12 text-right" id="myBtn">
<button class="btn btn-primary " type="button">欄位維護權限</button> <button class="btn btn-primary " type="button">欄位維護權限</button>
</div> </div>
</div> </div>
</div> </div>
</nav> </nav>
@ -247,27 +238,75 @@ $dataZ = mysqli_query($link, $sql);
<div class="modal-content"> <div class="modal-content">
<button type="button" class="close" id="myCloseBtn">X</button> <button type="button" class="close" id="myCloseBtn">X</button>
<div class='col-12' style='text-align:center'> <div class='col-12' style='text-align:center'>
qwe <h3>欄位維護權限</h3>
<hr>
<div class='row'>
<div class='col-12'>
<table class="table table-bordered" style="width:50%; margin:0 auto;">
<tr>
<th style="text-align:right;">欄位</th>
<th style="text-align:left;">維護單位</th>
</tr>
<tr>
<td style="text-align:right;">合約號</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">電梯編號</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">客戶姓名</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">規格</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">地址</td>
<td style="text-align:left;">業務部(營業人員 or 工勘人員透過申請單)</td>
</tr>
<tr>
<td style="text-align:right;">工勘狀態</td>
<td style="text-align:left;">工勘人員</td>
</tr>
<tr>
<td style="text-align:right;">合約交期(到工地)</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">下單日(普來特富)</td>
<td style="text-align:left;">業務部</td>
</tr>
<tr>
<td style="text-align:right;">預計到廠日(觀音廠)</td>
<td style="text-align:left;">生管部門</td>
</tr>
<tr>
<td style="text-align:right;">實際到廠日(觀音廠)</td>
<td style="text-align:left;">生管部門</td>
</tr>
<tr>
<td style="text-align:right;">預計出貨日(到工地)</td>
<td style="text-align:left;">業務部(營業人員 or 工勘人員透過申請單)</td>
</tr>
<tr>
<td style="text-align:right;">實際出貨日(到工地)</td>
<td style="text-align:left;">生管部門</td>
</tr>
</table>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
$dataArr = array(
"All" => $data, echo "<div id='data_table_div' class='data_table_div' style='overflow-x:auto;'>";
"A" => $dataA, include "wipwhole-index-table-html.php";
"B" => $dataB, echo "</div>";
"G" => $dataG,
"CH" => $dataCH,
"Z" => $dataZ
);
foreach ($dataArr as $key => $val) {
if ($val) :
$dataDetailsArr = $val;
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-index-table-html.php";
echo "</div>";
endif;
}
// 結束連線 // 結束連線
@ -290,14 +329,13 @@ mysqli_close($link);
} }
</style> </style>
<script> <script>
var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>"; var sheetNum = "<?php echo $sheetNum; ?>";
$(document).ready(function() { $(document).ready(function() {
$('#site_survey_contact_verify').select2(); $('#site_survey_contact_verify').select2();
}); });
$(function() { $(function() {
$(".data_table_div").hide();
showTable(sheetNum); showTable(sheetNum);
document.getElementById('loadingOverlay').classList.add('hidden'); document.getElementById('loadingOverlay').classList.add('hidden');
}) })
@ -396,7 +434,6 @@ mysqli_close($link);
} }
function showTable(code) { function showTable(code) {
console.log(code);
var tmp_arr = { var tmp_arr = {
"All": "1", "All": "1",
"A": "2", "A": "2",
@ -407,15 +444,13 @@ mysqli_close($link);
} }
$("nav.navbar.navbar-tabs div > ul > li").attr("class", ""); $("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active"); $("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
$(".data_table_div").hide();
$("#data_" + code + "_table_div").show();
} }
function estimatedShippingDateReportButton() { function estimatedShippingDateReportButton() {
window.location.href = '<?php echo "/wms/estimated_shipping_date_report.php?$token_link" ?>'; window.location.href = '<?php echo "/wms/estimated_shipping_date_report.php?$token_link" ?>';
} }
$('#table_index2,#table_index3,#table_index4,#table_index5,#table_index6,#table_index7').DataTable({ $('#table_index2').DataTable({
scrollX: true, scrollX: true,
fixedHeader: true, fixedHeader: true,
scrollY: 500, scrollY: 500,
@ -450,11 +485,6 @@ mysqli_close($link);
); );
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋"; document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index3_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index4_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index5_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index6_filter > label > input").placeholder = "快速搜尋";
document.querySelector("#table_index7_filter > label > input").placeholder = "快速搜尋";
// datatable 畫面重整後保留資料 // datatable 畫面重整後保留資料
@ -472,16 +502,7 @@ mysqli_close($link);
var orderColumn = "<?php echo empty($_GET['orderColumn']) ? '' : $_GET['orderColumn']; ?>"; var orderColumn = "<?php echo empty($_GET['orderColumn']) ? '' : $_GET['orderColumn']; ?>";
var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>"; var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>";
var dataArr2 = { var table = $('#table_index2').DataTable();
"All": "table_index2",
"A": "table_index3",
"B": "table_index4",
"G": "table_index5",
"CH": "table_index6",
"Z": "table_index7",
}
var table = $('#' + dataArr2[sheetNum]).DataTable();
// 设置排序信息 // 设置排序信息
if (orderColumn !== '' && orderDirection !== '') { if (orderColumn !== '' && orderDirection !== '') {
@ -510,7 +531,7 @@ mysqli_close($link);
}); });
// 監聽搜尋事件 // 監聽搜尋事件
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() { $("#table_index2_filter > label > input").change(function() {
searchDatatable(table); searchDatatable(table);
}); });

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

@ -176,53 +176,54 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark']; $warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
$creater = $_POST['creater']; $creater = $_POST['creater'];
$create_at = $_POST['create_at']; $create_at = date("Y-m-fd H:i:s");
// 上傳附件 // 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php"; include "wipwhole-rec-invoice-edit-fileupload.php";
// 工勘變更通知繪圖人員 // 工勘變更通知繪圖人員
if ($official_check_date !== $old_official_check_date) { if (!empty($official_check_date)) {
$sql = " if ($official_check_date !== $old_official_check_date) {
SELECT accountid
FROM account
WHERE department_id = '250'
AND role_id IN ('1','2','3','4');
";
$result = mysqli_query($link, $sql);
foreach ($result as $row) {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$sql = " $sql = "
INSERT INTO notice( SELECT accountid
kind, FROM account
related_id, WHERE department_id = '250'
title, AND role_id IN ('1','2','3','4');
content, ";
haveread, $result = mysqli_query($link, $sql);
permission, foreach ($result as $row) {
creater, $permission = $row["accountid"];
create_at $title = "客戶:$custom 作番:$facilityno 官檢日變更";
)VALUES( $content = "客戶:$custom
'1', 作番:$facilityno
'$id', 官檢日 $old_official_check_date => $official_check_date";
'$title',
'$content', $sql = "
null, INSERT INTO notice(
'$permission', kind,
'$creater', related_id,
'" . date("Y-m-d H:i:s") . "' title,
); content,
"; haveread,
mysqli_query($link, $sql); permission,
creater,
create_at
)VALUES(
'1',
'$id',
'$title',
'$content',
null,
'$permission',
'$creater',
'" . date("Y-m-d H:i:s") . "'
);
";
mysqli_query($link, $sql);
}
} }
} }
// 工勘變更通知繪圖人員 // 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) { if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
$site_survey_status = array( $site_survey_status = array(
@ -289,6 +290,30 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
} }
if (!empty($desin_documents_verify_file)) {
echo $sql = "
INSERT INTO notice(
kind,
related_id,
title,
content,
haveread,
permission,
creater,
create_at
)VALUES(
'1',
'$id',
'合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
'合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
null,
'M0168',
'$creater',
'$create_at'
);
";
mysqli_query($link, $sql);
}
$updatesql = " $updatesql = "
UPDATE wipwholestatus UPDATE wipwholestatus
@ -656,7 +681,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));
} }
$id = empty($_POST['id']) ? null : $_POST['id']; $id = empty($_POST['id']) ? null : $_POST['id'];
// 檢查簽核狀態 // // 檢查簽核狀態
if (checkWwsAssianStatus($link, $user_id, $id)) { if (checkWwsAssianStatus($link, $user_id, $id)) {
echo "<script type ='text/JavaScript'>"; echo "<script type ='text/JavaScript'>";
echo "alert('此表單已進入下個階段');"; echo "alert('此表單已進入下個階段');";
@ -1029,8 +1054,8 @@ function checkWwsAssianStatus($link, $user_id, $id = null)
$data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)]; $data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)];
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)]; $data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)]; $data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
$data['shengguanokname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)]; $data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanokmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)]; $data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
// 確認營業階段 // 確認營業階段
// 非主管進入主管階段 // 非主管進入主管階段

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

@ -1158,15 +1158,18 @@ include "wipwhole-rec-invoice-edit-submit.php";
if (checkNowFormGStatus($link) == 'Z' && checkNowFormYDStatus($link) == 'Z' && ($user_department_id == 220 || $user_department_id == 321)) { if (checkNowFormGStatus($link) == 'Z' && checkNowFormYDStatus($link) == 'Z' && ($user_department_id == 220 || $user_department_id == 321)) {
?> ?>
<button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button> <button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button>
<?php <?php
} else { } else {
// 生管 小雯 預計到貨日(到觀音廠日)權限 // 生管 小雯 預計到貨日(到觀音廠日)權限
if ($user_id == 'M0168') { // if ($user_id == 'M0168') {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <!-- <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> -->
<?php <?php
} // }
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0060')) {
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0060' || $user_id == 'M0168')) {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button>
<?php <?php
@ -1177,12 +1180,12 @@ include "wipwhole-rec-invoice-edit-submit.php";
} }
} }
} }
if (checkNowFormGStatus($link) == 'H' && ($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5'))) { if (checkNowFormGStatus($link) == 'H' && ($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0168')) {
?> ?>
<button onclick="doBackWarhouseAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回工務部門</button> <button onclick="doBackWarhouseAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回工務部門</button>
<?php <?php
} }
if (checkNowFormYDStatus($link) == 'D' && ($user_department_id == 220 || ($user_department_id == 321 && $ro !== '5'))) { if (checkNowFormYDStatus($link) == 'D' && ($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0168')) {
?> ?>
<button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button> <button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button>
<button onclick="doBackDesignAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回設計部門</button> <button onclick="doBackDesignAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回設計部門</button>

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

@ -244,11 +244,12 @@ function getGongWuokNo($link)
// 取得生管部主管編號 // 取得生管部主管編號
function getShengGuanokLeaderNo($link) function getShengGuanokLeaderNo($link)
{ {
return "M0079";
$sql = " $sql = "
SELECT accountid SELECT accountid
FROM `account` FROM `account`
WHERE `department_id` = '321' WHERE `department_id` = '250'
AND `role_id` = '1'; AND `role_id` = '4';
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result); $row = mysqli_fetch_array($result);
@ -386,6 +387,10 @@ function getDataSql($department_id, $role_id, $user_id)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$contract_type = 'B'; $contract_type = 'B';
// 營業員主管或營業員 // 營業員主管或營業員
@ -443,7 +448,7 @@ function getDataSql($department_id, $role_id, $user_id)
"; ";
return $sql; return $sql;
} }
if ($department_id == '314' && (in_array($role_id, ['2']))) { if ($department_id == '314' && (in_array($role_id, ['1', '2']))) {
$sql = " $sql = "
SELECT * FROM wipwholestatus SELECT * FROM wipwholestatus
WHERE 1=1 WHERE 1=1
@ -561,6 +566,10 @@ function getDataSqlByflowCode($department_id, $role_id, $user_id, $flow_code)
if (in_array($user_id, ['M0166', 'M0091'])) { if (in_array($user_id, ['M0166', 'M0091'])) {
$user_id = 'M0086'; $user_id = 'M0086';
} }
// 補丁 孫仲凱 = 林瑋隆
if (in_array($user_id, ['M0159'])) {
$user_id = 'M0113';
}
$contract_type = 'B'; $contract_type = 'B';
// 營業員主管或營業員 // 營業員主管或營業員
@ -825,7 +834,8 @@ function getWarehouseStatus($link, $user_department_id, $role_id, $status)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
return ""; return "";
if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) { // if (in_array($user_department_id, [521, 531, 541, 542, 543, 544, 545, 50, 501, 311, 313, 314, 521, 315, 912])) {
if(getSaveEstimateInstallData($user_department_id, $role_id)){
if ($status == 1) { if ($status == 1) {
return checkNowFormStatus($link) == 'A' ? "" : "disabled"; return checkNowFormStatus($link) == 'A' ? "" : "disabled";
} else { } else {
@ -834,6 +844,7 @@ function getWarehouseStatus($link, $user_department_id, $role_id, $status)
} }
return "disabled"; return "disabled";
} }
function getMarketingStatus($link, $user_department_id, $role_id, $status) function getMarketingStatus($link, $user_department_id, $role_id, $status)
{ {
if ($user_department_id == 220) if ($user_department_id == 220)
@ -1092,7 +1103,7 @@ function getSaveInstallDataButtonStatus($user_department_id, $role_id)
return true; return true;
if ($user_department_id == '543' && $role_id == '2') if ($user_department_id == '543' && $role_id == '2')
return true; return true;
if ($user_department_id == '544' && in_array($role_id, ['3', '6'])) if ($user_department_id == '544' && in_array($role_id, ['3', '4', '6']))
return true; return true;
if ($user_department_id == '545' && in_array($role_id, ['3', '6'])) if ($user_department_id == '545' && in_array($role_id, ['3', '6']))
return true; return true;

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

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

209
wms/wipwhole-renovate-index.php

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

63
wms/wipwhole-renovate-rec-invoice-edit-submit.php

@ -236,28 +236,56 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$qc_official_type = $_POST['qc_official_type'] ?: $row['qc_official_type']; $qc_official_type = $_POST['qc_official_type'] ?: $row['qc_official_type'];
$creater = $_POST['creater']; $creater = $_POST['creater'];
$create_at = $_POST['create_at']; $create_at = date("Y-m-fd H:i:s");
// 上傳附件 // 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php"; include "wipwhole-rec-invoice-edit-fileupload.php";
// 工勘變更通知繪圖人員 // 工勘變更通知繪圖人員
if ($official_check_date !== $old_official_check_date) { if (!empty($official_check_date)) {
$sql = " if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid SELECT accountid
FROM account FROM account
WHERE department_id = '250' WHERE department_id = '250'
AND role_id IN ('1','2','3','4'); AND role_id IN ('1','2','3','4');
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
foreach ($result as $row) { foreach ($result as $row) {
$permission = $row["accountid"]; $permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更"; $title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom $content = "客戶:$custom
作番:$facilityno 作番:$facilityno
官檢日 $old_official_check_date => $official_check_date"; 官檢日 $old_official_check_date => $official_check_date";
$sql = " $sql = "
INSERT INTO notice(
kind,
related_id,
title,
content,
haveread,
permission,
creater,
create_at
)VALUES(
'1',
'$id',
'$title',
'$content',
null,
'$permission',
'$creater',
'" . date("Y-m-d H:i:s") . "'
);
";
mysqli_query($link, $sql);
}
}
}
if (!empty($desin_documents_verify_file)) {
$sql = "
INSERT INTO notice( INSERT INTO notice(
kind, kind,
related_id, related_id,
@ -270,16 +298,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
)VALUES( )VALUES(
'1', '1',
'$id', '$id',
'$title', '合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
'$content', '合約號:$contract_no 作番號:$facilityno 設計上傳追加技術文件',
null, null,
'$permission', 'M0168',
'$creater', '$creater',
'" . date("Y-m-d H:i:s") . "' '$create_at'
); );
"; ";
mysqli_query($link, $sql); mysqli_query($link, $sql);
}
} }
$updatesql = "update wipwholestatus set "; $updatesql = "update wipwholestatus set ";
@ -1064,8 +1091,8 @@ function checkWwsAssianStatus($link, $user_id)
$data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)]; $data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)];
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)]; $data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)]; $data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
$data['shengguanokname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)]; $data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanokmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)]; $data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
// 確認工務階段 進入營業階段 // 確認工務階段 進入營業階段
if (checkNowFormStatus($link) == 'A' && checkGongWuok($link, $id) == '0') { if (checkNowFormStatus($link) == 'A' && checkGongWuok($link, $id) == '0') {
@ -1119,7 +1146,7 @@ function checkWwsAssianStatus($link, $user_id)
} }
} }
// 確認營業主管階段 進入設計人員(新梯:郭承瑋 M0023)階段 // 確認營業主管階段 進入設計人員(汰改:林昭翰 M0173)階段
if (checkNowFormStatus($link) == 'F' && checkYingYeok($link, $id) == '0') { if (checkNowFormStatus($link) == 'F' && checkYingYeok($link, $id) == '0') {
if (checkUseridIsManager($user_id)) { if (checkUseridIsManager($user_id)) {
write_note($link, $id, $user_id, "<em>營業經理提交至設計階段</em>"); write_note($link, $id, $user_id, "<em>營業經理提交至設計階段</em>");

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

@ -690,7 +690,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">移交日</td> <td style="vertical-align: middle">移交日</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>> <input class="form-control disabled_select" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button>
</span> </span>
@ -1157,19 +1157,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<?php <?php
} else { } else {
// 生管 小雯 預計到貨日(到觀音廠日)權限 // 生管 小雯 預計到貨日(到觀音廠日)權限
if ($user_id == 'M0168') { // if ($user_id == 'M0168') {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <!-- <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> -->
<?php <?php
} // }
if (($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5') || $user_id == 'M0060')) {
if (($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5') || $user_id == 'M0060' || $user_id == 'M0168')) {
?> ?>
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> <button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button>
<button onclick="doShengguanAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">結案</button> <button onclick="doShengguanAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">結案</button>
<?php <?php
} }
} }
if (($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5'))) { if (($user_department_id == '220' || ($user_department_id == '321' && $role_id !== '5') || $user_id == 'M0168')) {
?> ?>
<button onclick="doBackWarhouseAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回工務部門</button> <button onclick="doBackWarhouseAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回工務部門</button>
<button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button> <button onclick="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button>

9
wms/wipwhole-wipinstallstatus-index.php

@ -504,6 +504,9 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
<tr> <tr>
<td>M1</td> <td>M1</td>
<?php <?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) {
$start_month = 1; $start_month = 1;
$end_month = 12; $end_month = 12;
@ -559,6 +562,9 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
<tr> <tr>
<td>MA</td> <td>MA</td>
<?php <?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) {
$start_month = 1; $start_month = 1;
$end_month = 12; $end_month = 12;
@ -614,6 +620,9 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
<tr> <tr>
<td>合計</td> <td>合計</td>
<?php <?php
$a_count = 0;
$b_count = 0;
$c_count = 0;
for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) { for ($radsYi = $radsY; $radsYi <= $radeY; $radsYi++) {
$start_month = 1; $start_month = 1;
$end_month = 12; $end_month = 12;

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

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

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

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

Loading…
Cancel
Save