43 changed files with 3837 additions and 1408 deletions
@ -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" |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
File diff suppressed because it is too large
@ -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 + ' <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> |
@ -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); |
||||
|
} |
@ -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); |
||||
|
} |
@ -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> |
@ -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> |
@ -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> |
@ -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> |
@ -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> |
Binary file not shown.
Loading…
Reference in new issue