Browse Source

1.新增分布圖假保養資料補丁

2.header 新增判斷是否從藍凌過來的判斷方法
3.wms登入判斷強制改為大寫
4.大日程select優化
5.生管(業務)從M0024 改為 M0079
6.新增 BPM API 到 BPM測試檔案
7.首頁通知顯示bug修正
8.戰情室分布圖 工地 連接資料庫檔案修正及程式排版
gary
gary_chen\gary_chen 1 year ago
parent
commit
752d3a7734
  1. 2
      phb/map/tw.html
  2. 637
      phb/map/tw_fake.html
  3. 99
      wms/T8_APItest_from_bpm.php
  4. 43
      wms/T8_Authorization_from_bpm.php
  5. 4
      wms/frame/api_getdata.php
  6. 62
      wms/gary.php
  7. 44
      wms/header.php
  8. 2
      wms/loginapi.php
  9. 5
      wms/wipwhole-index-function.php
  10. 13
      wms/wipwhole-index-table-html.php
  11. 83
      wms/wipwhole-index.php
  12. 67
      wms/wipwhole-rec-invoice-edit-submit.php
  13. 15
      wms/wipwhole-rec-invoice-edit.php
  14. 5
      wms/wipwhole-renovate-index-function.php
  15. 13
      wms/wipwhole-renovate-index-table-html.php
  16. 77
      wms/wipwhole-renovate-index.php
  17. 35
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  18. 12
      wms/wipwhole-renovate-rec-invoice-edit.php

2
phb/map/tw.html

@ -301,7 +301,7 @@
var schedule_detail = "";
// 補丁 actualdate = 展示太久沒更新保養日期做假資料
actualdate = fakeActualdate(actualdate);
// actualdate = fakeActualdate(actualdate);
if (sid > 0) {
schedule_detail += '<li class="list-group-item"><b>保養明細</b> ';

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>

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);
}

4
wms/frame/api_getdata.php

@ -82,8 +82,8 @@ function get_notice($token)
$data = [];
$sql = "select id, kind, related_id, title from notice ";
$sql .= "where (permission like '%" . $user_id . "%' or permission = 'ALL' or creater = '$user_id') ";
$sql .= "and haveread != '1' ";
$sql .= "order by create_at desc limit 0, 6";
$sql .= "and (haveread != '1' or haveread is null) ";
$sql .= "order by id desc limit 0, 6";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$data[$i]["id"] = $row["id"];

62
wms/gary.php

@ -1,6 +1,67 @@
<?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');
echo $referrer = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "抓不到";
exit;
include "fun_global.php";
include "database.php";
print_r(manage_class("M0117"));
@ -60,4 +121,3 @@ echo manage_class("M0117")[0];
// mysqli_query($link, $sql2);
// }
// endforeach;

44
wms/header.php

@ -7,10 +7,11 @@
// $maintenancePage = new MaintenancePage($maintenancePeriod);
// $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");
$end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时
$end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时
$info = $user_id . '.' . base64_encode(urlencode($user_name)) . '.' . $start_time . '.' . $end_time; //设置token过期时间为一天
$encryption_code = "MASADA!^***";
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
@ -32,15 +33,15 @@ if (isset($_REQUEST["function_name"])) {
/**
* 連線T8 MSSQL
*/
// try {
// $conn = new PDO("sqlsrv:Server=10.10.145.2;Database=T8MASADA", "masada", "@m222222");
// if ($conn) {
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// }
// } catch (PDOException $e) {
// //echo "fail";
// //echo $e->getMessage();
// }
try {
$conn = new PDO("sqlsrv:Server=erp.masada.com.tw;Database=T8MASADA", "masada", "ztPmPP!HRoV6SL3E");
if ($conn) {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
} catch (PDOException $e) {
//echo "fail";
//echo $e->getMessage();
}
@ -53,22 +54,37 @@ if (isset($_REQUEST["function_name"])) {
* $login_dt 登入時間
* $user_auth 使用權限:1,2,3
*****************************/
$token = $_REQUEST["token"];
$token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : "";
if (count(explode(".", $token)) > 1) {
$token_link = "token=" . $_REQUEST["token"];
list($user_id, $enc_user_name, $login_dt) = explode(".", $token);
$user_name = urldecode(base64_decode($enc_user_name));
} else {
$referrer = isset($_GET['referer']) ? $_GET['referer'] : "";
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);
}
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 = CreateToken($user_id, $user_name);
$token_link = "token=" . $token;
} else {
echo "非法訪問!";
echo "<script>location.href='/wms/login.php'</script>";
}
}
include 'IncludeCommon.php';
$includecommon = new IncludeCommon();
$accounttype = getAccounttype($link, $user_id);

2
wms/loginapi.php

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

5
wms/wipwhole-index-function.php

@ -772,11 +772,12 @@ function getGongWuokNo($link)
// 取得生管部主管編號
function getShengGuanokLeaderNo($link)
{
return "M0079";
$sql = "
SELECT accountid
FROM `account`
WHERE `department_id` = '321'
AND `role_id` = '1';
WHERE `department_id` = '250'
AND `role_id` = '4';
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result);

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

@ -1,13 +1,4 @@
<?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;
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>
<tr>
<?php
@ -42,7 +33,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
<tbody>
<?php
foreach ($dataDetailsArr as $key => $data) :
foreach ($data as $key => $data) :
//規格
$Specification = $data['facility_kind'];

83
wms/wipwhole-index.php

@ -40,9 +40,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
}
// 宣告主資料空陣列
$data = array();
// 取得當前使用者所屬部門
$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_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end'];
$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 = getDataSql($department_id, $role_id, $user_id);
$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;">
@ -308,22 +302,11 @@ $dataZ = mysqli_query($link, $sql);
</div>
</div>
<?php
$dataArr = array(
"All" => $data,
"A" => $dataA,
"B" => $dataB,
"G" => $dataG,
"CH" => $dataCH,
"Z" => $dataZ
);
foreach ($dataArr as $key => $val) {
if ($val) :
$dataDetailsArr = $val;
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-index-table-html.php";
echo "</div>";
endif;
}
echo "<div id='data_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-index-table-html.php";
echo "</div>";
// 結束連線
@ -346,14 +329,13 @@ mysqli_close($link);
}
</style>
<script>
var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>";
var sheetNum = "<?php echo $sheetNum; ?>";
$(document).ready(function() {
$('#site_survey_contact_verify').select2();
});
$(function() {
$(".data_table_div").hide();
showTable(sheetNum);
document.getElementById('loadingOverlay').classList.add('hidden');
})
@ -452,7 +434,6 @@ mysqli_close($link);
}
function showTable(code) {
console.log(code);
var tmp_arr = {
"All": "1",
"A": "2",
@ -463,15 +444,13 @@ mysqli_close($link);
}
$("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("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() {
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,
fixedHeader: true,
scrollY: 500,
@ -506,11 +485,6 @@ mysqli_close($link);
);
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 畫面重整後保留資料
@ -528,16 +502,7 @@ mysqli_close($link);
var orderColumn = "<?php echo empty($_GET['orderColumn']) ? '' : $_GET['orderColumn']; ?>";
var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>";
var dataArr2 = {
"All": "table_index2",
"A": "table_index3",
"B": "table_index4",
"G": "table_index5",
"CH": "table_index6",
"Z": "table_index7",
}
var table = $('#' + dataArr2[sheetNum]).DataTable();
var table = $('#table_index2').DataTable();
// 设置排序信息
if (orderColumn !== '' && orderDirection !== '') {
@ -566,7 +531,7 @@ mysqli_close($link);
});
// 監聽搜尋事件
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() {
$("#table_index2_filter > label > input").change(function() {
searchDatatable(table);
});

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

@ -176,12 +176,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$warehouse_assistant_remark = $_POST['warehouse_assistant_remark'];
$creater = $_POST['creater'];
$create_at = $_POST['create_at'];
$create_at = date("Y-m-fd H:i:s");
// 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php";
// 工勘變更通知繪圖人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
@ -194,8 +195,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$permission = $row["accountid"];
$title = "客戶:$custom 作番:$facilityno 官檢日變更";
$content = "客戶:$custom
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
作番:$facilityno
官檢日 $old_official_check_date => $official_check_date";
$sql = "
INSERT INTO notice(
@ -221,7 +222,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
mysqli_query($link, $sql);
}
}
}
// 工勘變更通知繪圖人員
if ($site_survey_contact_verify !== $old_site_survey_contact_verify) {
@ -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 = "
UPDATE wipwholestatus
@ -652,22 +677,22 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST['form_name'] == 'assign_form') {
// foreach ($_POST as $k => $v) {
// $$k = htmlspecialchars(stripslashes(trim($v)));
// }
// $id = empty($_POST['id']) ? null : $_POST['id'];
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v)));
}
$id = empty($_POST['id']) ? null : $_POST['id'];
// // 檢查簽核狀態
// if (checkWwsAssianStatus($link, $user_id, $id)) {
// echo "<script type ='text/JavaScript'>";
// echo "alert('此表單已進入下個階段');";
// echo "location.href='wipwhole-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
// echo "</script>";
// } else {
// echo "<script type ='text/JavaScript'>";
// echo "alert('此表單某些確認項未確認');";
// echo "location.href='wipwhole-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
// echo "</script>";
// }
if (checkWwsAssianStatus($link, $user_id, $id)) {
echo "<script type ='text/JavaScript'>";
echo "alert('此表單已進入下個階段');";
echo "location.href='wipwhole-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
echo "</script>";
} else {
echo "<script type ='text/JavaScript'>";
echo "alert('此表單某些確認項未確認');";
echo "location.href='wipwhole-rec-invoice-edit.php?function_name=pricereview&id=$id&" . $token_link . "';";
echo "</script>";
}
}
}
@ -1029,8 +1054,8 @@ function checkWwsAssianStatus($link, $user_id, $id = null)
$data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)];
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
$data['shengguanokname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanokmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
$data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
// 確認營業階段
// 非主管進入主管階段

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

@ -1160,13 +1160,16 @@ include "wipwhole-rec-invoice-edit-submit.php";
<button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button>
<?php
} 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
}
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>
<?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>
<?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="doBackDesignAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回設計部門</button>

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

@ -244,11 +244,12 @@ function getGongWuokNo($link)
// 取得生管部主管編號
function getShengGuanokLeaderNo($link)
{
return "M0079";
$sql = "
SELECT accountid
FROM `account`
WHERE `department_id` = '321'
AND `role_id` = '1';
WHERE `department_id` = '250'
AND `role_id` = '4';
";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_array($result);

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

@ -1,13 +1,4 @@
<?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;
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>
<tr>
<?php
@ -42,7 +33,7 @@ if (in_array($user_id, ['M0175', 'M0079'])) {
</thead>
<tbody>
<?php
foreach ($dataDetailsArr as $key => $data) :
foreach ($data as $key => $data) :
//規格
$Specification = $data['facility_kind'];

77
wms/wipwhole-renovate-index.php

@ -1,6 +1,5 @@
<div id="loadingOverlay" class="hidden">
<div class="loading-icon"></div>
<div class="loading-text">Loading...</div>
</div>
<script>
document.getElementById('loadingOverlay').classList.remove('hidden');
@ -41,9 +40,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$numberOfDaysToAdd = 45;
$futureDate = date("Y/m/d", strtotime(date("Y-m-d") . " +{$numberOfDaysToAdd} days"));
// 主資料陣列
$data = array();
// 取得當前使用者所屬部門
$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_end = empty($_REQUEST['real_contract_arrival_date_end']) ? null : $_REQUEST['real_contract_arrival_date_end'];
$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 = getDataSql($department_id, $role_id, $user_id);
$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;">
@ -305,22 +295,11 @@ $dataZ = mysqli_query($link, $sql);
</div>
</div>
<?php
$dataArr = array(
"All" => $data,
"A" => $dataA,
"B" => $dataB,
"C" => $dataC,
"D" => $dataD,
"Z" => $dataZ
);
foreach ($dataArr as $key => $val) {
if ($val) :
$dataDetailsArr = $val;
echo "<div id='data_" . $key . "_table_div' class='data_table_div' style='overflow-x:auto;'>";
echo "<div id='data_detail_table_div' class='data_table_div' style='overflow-x:auto;'>";
include "wipwhole-renovate-index-table-html.php";
echo "</div>";
endif;
}
#結束連線
mysqli_close($link);
@ -342,13 +321,12 @@ mysqli_close($link);
}
</style>
<script>
var sheetNum = "<?php echo empty($_GET['sheetNum']) ? 'All' : $_GET['sheetNum']; ?>";
var sheetNum = "<?php echo $sheetNum; ?>";
$(document).ready(function() {
$('#site_survey_contact_verify').select2();
});
$(function() {
$(".data_table_div").hide();
showTable(sheetNum);
document.getElementById('loadingOverlay').classList.add('hidden');
})
@ -495,18 +473,11 @@ mysqli_close($link);
"D": "5",
"Z": "6",
}
$("body > 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");
$(".data_table_div").hide();
$("#data_" + code + "_table_div").show();
$("nav.navbar.navbar-tabs div > ul > li").attr("class", "");
$("nav.navbar.navbar-tabs div > ul > li:nth-child(" + tmp_arr[code] + ")").attr("class", "active");
}
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 畫面重整後保留資料
@ -526,7 +497,7 @@ mysqli_close($link);
var orderDirection = "<?php echo empty($_GET['orderDirection']) ? '' : $_GET['orderDirection']; ?>";
var dataArr2 = {
"All": "table_index2",
"All": "",
"A": "table_index3",
"B": "table_index4",
"C": "table_index5",
@ -535,7 +506,7 @@ mysqli_close($link);
}
var table = $('#' + dataArr2[sheetNum]).DataTable();
var table = $('#table_index2').DataTable();
// 设置排序信息
if (orderColumn !== '' && orderDirection !== '') {
@ -564,7 +535,7 @@ mysqli_close($link);
});
// 監聽搜尋事件
$("#" + dataArr2[sheetNum] + "_filter > label > input").change(function() {
$("#table_index2_filter > label > input").change(function() {
searchDatatable(table);
});

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

@ -236,12 +236,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$qc_official_type = $_POST['qc_official_type'] ?: $row['qc_official_type'];
$creater = $_POST['creater'];
$create_at = $_POST['create_at'];
$create_at = date("Y-m-fd H:i:s");
// 上傳附件
include "wipwhole-rec-invoice-edit-fileupload.php";
// 工勘變更通知繪圖人員
if (!empty($official_check_date)) {
if ($official_check_date !== $old_official_check_date) {
$sql = "
SELECT accountid
@ -281,6 +282,32 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
mysqli_query($link, $sql);
}
}
}
if (!empty($desin_documents_verify_file)) {
$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 = "update wipwholestatus set ";
@ -1064,8 +1091,8 @@ function checkWwsAssianStatus($link, $user_id)
$data['designleadermail'] = accountid2email([getSheJiokLeaderNo($link)])[getSheJiokLeaderNo($link)];
$data['gongwokname'] = accountid2name(getGongWuokNo($link))[getGongWuokNo($link)];
$data['gongwokmail'] = accountid2email([getGongWuokNo($link)])[getGongWuokNo($link)];
$data['shengguanokname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanokmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
$data['shengguanname'] = accountid2name(getShengGuanokLeaderNo($link))[getShengGuanokLeaderNo($link)];
$data['shengguanmail'] = accountid2email([getShengGuanokLeaderNo($link)])[getShengGuanokLeaderNo($link)];
// 確認工務階段 進入營業階段
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 (checkUseridIsManager($user_id)) {
write_note($link, $id, $user_id, "<em>營業經理提交至設計階段</em>");

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

@ -1157,19 +1157,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<?php
} 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
}
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="doShengguanAssign()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">結案</button>
<?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="doBackMarketingAssign()" type="button" class="btn btn-danger btn-lg pull-right" style="margin-left:3px;">退回營業</button>

Loading…
Cancel
Save