268 changed files with 45944 additions and 44355 deletions
@ -1,91 +1,91 @@ |
|||
<?php |
|||
include "T8_Authorization.php"; |
|||
echo "ii"; |
|||
?> |
|||
<script> |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
|||
// if (event.origin === "https://masada.com.tw" && (typeof event.data === "string")) { |
|||
var validation = event.data; |
|||
console.log("event"); |
|||
console.log(validation); |
|||
|
|||
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALDISPATCHLIST/GetERPData?pkValue=SS20230825001'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [{ |
|||
"name": "MasterTable", |
|||
"rows": [{ |
|||
"BillNo": "Z001", |
|||
"BillDate": 20230930, |
|||
"OrgId": "1000", |
|||
"TypeId": "OPV", |
|||
"BizPartnerId": "03051501", |
|||
"CurrId": "RMB", |
|||
"CurrLAmount":5, |
|||
"TaxId": "ST005", |
|||
"PersonId": "M0012", |
|||
"DeptId": "220", |
|||
"CompId": "1001", |
|||
"CreditAgeDate": 20230930, |
|||
"RecBizPartnerId": "03051501", |
|||
|
|||
}] |
|||
}, |
|||
{ |
|||
"name": "DetailTable", |
|||
"rows": [{ |
|||
"BillNo": "Z001", |
|||
"RowCode": 1, |
|||
"RowNo": 1, |
|||
"ItemType": 0, |
|||
"MaterialId": "MX00000001", |
|||
"UnitId": "PCS", |
|||
"MaterialSpec": "", |
|||
"SQuantity": 10, |
|||
"SPrice": 141.18, |
|||
"OAmount": 1344.57, |
|||
"OTax": 67.23, |
|||
"OAmountWithTax": 1411.8, |
|||
"TaxId": "ST005" |
|||
}, |
|||
{ |
|||
"BillNo": "Z001", |
|||
"RowCode": 2, |
|||
"RowNo": 2, |
|||
"ItemType": 0, |
|||
"MaterialId": "MX00000001", |
|||
"UnitId": "PCS", |
|||
"MaterialSpec": "", |
|||
"SQuantity": 15, |
|||
"SPrice": 141.18, |
|||
"OAmount": 2016.86, |
|||
"OTax": 100.84, |
|||
"OAmountWithTax": 2117.7, |
|||
"TaxId": "ST005" |
|||
} |
|||
] |
|||
} |
|||
]; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type: 'GET', |
|||
// url: `${corsurl}${apiurl}`, |
|||
url: `${apiurl}`, |
|||
// dataType: 'json', |
|||
headers: headerParam, |
|||
// data: json, |
|||
// dataType: "json", |
|||
success: function(res) { |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
} |
|||
}) |
|||
<?php |
|||
include "T8_Authorization.php"; |
|||
echo "ii"; |
|||
?> |
|||
<script> |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
|||
// if (event.origin === "https://masada.com.tw" && (typeof event.data === "string")) { |
|||
var validation = event.data; |
|||
console.log("event"); |
|||
console.log(validation); |
|||
|
|||
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALDISPATCHLIST/GetERPData?pkValue=SS20230825001'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [{ |
|||
"name": "MasterTable", |
|||
"rows": [{ |
|||
"BillNo": "Z001", |
|||
"BillDate": 20230930, |
|||
"OrgId": "1000", |
|||
"TypeId": "OPV", |
|||
"BizPartnerId": "03051501", |
|||
"CurrId": "RMB", |
|||
"CurrLAmount":5, |
|||
"TaxId": "ST005", |
|||
"PersonId": "M0012", |
|||
"DeptId": "220", |
|||
"CompId": "1001", |
|||
"CreditAgeDate": 20230930, |
|||
"RecBizPartnerId": "03051501", |
|||
|
|||
}] |
|||
}, |
|||
{ |
|||
"name": "DetailTable", |
|||
"rows": [{ |
|||
"BillNo": "Z001", |
|||
"RowCode": 1, |
|||
"RowNo": 1, |
|||
"ItemType": 0, |
|||
"MaterialId": "MX00000001", |
|||
"UnitId": "PCS", |
|||
"MaterialSpec": "", |
|||
"SQuantity": 10, |
|||
"SPrice": 141.18, |
|||
"OAmount": 1344.57, |
|||
"OTax": 67.23, |
|||
"OAmountWithTax": 1411.8, |
|||
"TaxId": "ST005" |
|||
}, |
|||
{ |
|||
"BillNo": "Z001", |
|||
"RowCode": 2, |
|||
"RowNo": 2, |
|||
"ItemType": 0, |
|||
"MaterialId": "MX00000001", |
|||
"UnitId": "PCS", |
|||
"MaterialSpec": "", |
|||
"SQuantity": 15, |
|||
"SPrice": 141.18, |
|||
"OAmount": 2016.86, |
|||
"OTax": 100.84, |
|||
"OAmountWithTax": 2117.7, |
|||
"TaxId": "ST005" |
|||
} |
|||
] |
|||
} |
|||
]; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type: 'GET', |
|||
// url: `${corsurl}${apiurl}`, |
|||
url: `${apiurl}`, |
|||
// dataType: 'json', |
|||
headers: headerParam, |
|||
// data: json, |
|||
// dataType: "json", |
|||
success: function(res) { |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
} |
|||
}) |
|||
</script> |
@ -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); |
|||
} |
@ -1,37 +1,37 @@ |
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> |
|||
<?php |
|||
$now = gmdate("YmdHis"); |
|||
$data = 'M0000.' . $now; |
|||
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); |
|||
|
|||
?> |
|||
|
|||
<script> |
|||
function get_Auth() { |
|||
var api_key = 'B2D6395D2883E26C'; |
|||
var validation = ""; |
|||
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
|||
// var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth' |
|||
headerParam = { |
|||
UserId: 'M0000', |
|||
Pwd: 'M012290493119', |
|||
TimestampUTC: <?= $now ?>, |
|||
Sign: '<?= $sign ?>' |
|||
}; |
|||
obj = { |
|||
type: 'get', |
|||
// url: `${corsurl}${apiurl}`, |
|||
url: `${apiurl}`, |
|||
dataType: 'json', |
|||
headers: headerParam, |
|||
success: function(res) { |
|||
validation = res.Data['CHI_Authorization']; |
|||
console.log("validation:",validation); |
|||
window.parent.postMessage(validation,'http://localhost:3000'); |
|||
// window.parent.postMessage(validation,'https://masada.com.tw'); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
} |
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> |
|||
<?php |
|||
$now = gmdate("YmdHis"); |
|||
$data = 'M0000.' . $now; |
|||
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); |
|||
|
|||
?> |
|||
|
|||
<script> |
|||
function get_Auth() { |
|||
var api_key = 'B2D6395D2883E26C'; |
|||
var validation = ""; |
|||
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
|||
// var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth' |
|||
headerParam = { |
|||
UserId: 'M0000', |
|||
Pwd: 'M012290493119', |
|||
TimestampUTC: <?= $now ?>, |
|||
Sign: '<?= $sign ?>' |
|||
}; |
|||
obj = { |
|||
type: 'get', |
|||
// url: `${corsurl}${apiurl}`, |
|||
url: `${apiurl}`, |
|||
dataType: 'json', |
|||
headers: headerParam, |
|||
success: function(res) { |
|||
validation = res.Data['CHI_Authorization']; |
|||
console.log("validation:",validation); |
|||
window.parent.postMessage(validation,'http://localhost:3000'); |
|||
// window.parent.postMessage(validation,'https://masada.com.tw'); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
} |
|||
</script> |
@ -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); |
|||
} |
@ -1,71 +1,71 @@ |
|||
<?php |
|||
//外購組裝單 (組裝申請單) |
|||
include "T8_Authorization.php"; |
|||
?> |
|||
<script> |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
|||
var validation = event.data; |
|||
console.log(validation); |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKASSY/PostERPData'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [{ |
|||
"name":"stkAssyMast", |
|||
"rows":[ |
|||
{ |
|||
"BillNo":"TEST02", |
|||
"OrgId":"1000", |
|||
"TypeId":"CA", |
|||
"MaterialId":"3MH00302", |
|||
"PersonId":"M0122", |
|||
"CompId":"1001", |
|||
"DeptId":"220", |
|||
"SQuantity":1, |
|||
"SUnitId":"SET", |
|||
"CurrentState":2, |
|||
"CreatorId":"M0122" |
|||
} |
|||
] |
|||
},{ |
|||
"name":"stkAssySubMatInfo", |
|||
"rows":[ |
|||
{ |
|||
"BillNo":"TEST02", |
|||
"MaterialId":"3MH00302P", |
|||
"ComponentBaseQty":1, |
|||
"UnitQty":1, |
|||
"SUnitId":"SET", |
|||
"MarkerNo":"3MH00302", |
|||
"CU_MaterialId":"3MH00302" |
|||
},{ |
|||
"BillNo":"TEST02", |
|||
"MaterialId":"MX00000001", |
|||
"ComponentBaseQty":1, |
|||
"UnitQty":3, |
|||
"SUnitId":"PCS", |
|||
"MarkerNo":"3MH00302", |
|||
"CU_MaterialId":"3MH00302" |
|||
} |
|||
] |
|||
}]; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type:'POST', |
|||
url:`${apiurl}`, |
|||
headers:headerParam, |
|||
data: json, |
|||
dataType:"json", |
|||
success: function(res){ |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
|
|||
} |
|||
}) |
|||
<?php |
|||
//外購組裝單 (組裝申請單) |
|||
include "T8_Authorization.php"; |
|||
?> |
|||
<script> |
|||
get_Auth(); |
|||
window.addEventListener('message', function(event) { |
|||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
|||
var validation = event.data; |
|||
console.log(validation); |
|||
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKASSY/PostERPData'; |
|||
headerParam = { |
|||
CHI_Authorization: `${validation}`, |
|||
}; |
|||
var body = [{ |
|||
"name":"stkAssyMast", |
|||
"rows":[ |
|||
{ |
|||
"BillNo":"TEST02", |
|||
"OrgId":"1000", |
|||
"TypeId":"CA", |
|||
"MaterialId":"3MH00302", |
|||
"PersonId":"M0122", |
|||
"CompId":"1001", |
|||
"DeptId":"220", |
|||
"SQuantity":1, |
|||
"SUnitId":"SET", |
|||
"CurrentState":2, |
|||
"CreatorId":"M0122" |
|||
} |
|||
] |
|||
},{ |
|||
"name":"stkAssySubMatInfo", |
|||
"rows":[ |
|||
{ |
|||
"BillNo":"TEST02", |
|||
"MaterialId":"3MH00302P", |
|||
"ComponentBaseQty":1, |
|||
"UnitQty":1, |
|||
"SUnitId":"SET", |
|||
"MarkerNo":"3MH00302", |
|||
"CU_MaterialId":"3MH00302" |
|||
},{ |
|||
"BillNo":"TEST02", |
|||
"MaterialId":"MX00000001", |
|||
"ComponentBaseQty":1, |
|||
"UnitQty":3, |
|||
"SUnitId":"PCS", |
|||
"MarkerNo":"3MH00302", |
|||
"CU_MaterialId":"3MH00302" |
|||
} |
|||
] |
|||
}]; |
|||
var json = JSON.stringify(body); |
|||
obj = { |
|||
type:'POST', |
|||
url:`${apiurl}`, |
|||
headers:headerParam, |
|||
data: json, |
|||
dataType:"json", |
|||
success: function(res){ |
|||
console.log(res.Status); |
|||
console.log(res.ErrorMsg); |
|||
console.log(res.Data); |
|||
} |
|||
}; |
|||
jQuery.ajax(obj); |
|||
|
|||
} |
|||
}) |
|||
</script> |
@ -1,23 +1,23 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
//假設供應商代碼為P |
|||
$BizPartnerId = "P"; |
|||
$sql_purBillOrder = " |
|||
SELECT * FROM purBillOrderMaster WHERE BizPartnerId = '$BizPartnerId' AND CurrentState = 2"; |
|||
$purMaster = $conn->query($sql_purBillOrder); |
|||
//每筆採購單資料 |
|||
foreach($purMaster as $master){ |
|||
//print_r($master); |
|||
$BillNo = $master['BillNo']; |
|||
|
|||
//每筆採購單明細資料 |
|||
$sql_purDetail = " |
|||
SELECT * FROM purBillOrderDetail WHERE BillNo = '$BillNo'"; |
|||
$purDetail = $conn->query($sql_purDetail); |
|||
foreach($purDetail as $detail){ |
|||
print_r($detail); |
|||
} |
|||
echo "<br>----------------------<br>"; |
|||
|
|||
} |
|||
|
|||
<?php |
|||
include "./header.php"; |
|||
//假設供應商代碼為P |
|||
$BizPartnerId = "P"; |
|||
$sql_purBillOrder = " |
|||
SELECT * FROM purBillOrderMaster WHERE BizPartnerId = '$BizPartnerId' AND CurrentState = 2"; |
|||
$purMaster = $conn->query($sql_purBillOrder); |
|||
//每筆採購單資料 |
|||
foreach($purMaster as $master){ |
|||
//print_r($master); |
|||
$BillNo = $master['BillNo']; |
|||
|
|||
//每筆採購單明細資料 |
|||
$sql_purDetail = " |
|||
SELECT * FROM purBillOrderDetail WHERE BillNo = '$BillNo'"; |
|||
$purDetail = $conn->query($sql_purDetail); |
|||
foreach($purDetail as $detail){ |
|||
print_r($detail); |
|||
} |
|||
echo "<br>----------------------<br>"; |
|||
|
|||
} |
|||
|
|||
|
@ -1,45 +1,45 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
date_default_timezone_set('Asia/Taipei'); |
|||
|
|||
//表頭 |
|||
$BillNo ="TEST01"; |
|||
$BillDate = 20231204; |
|||
$PersonId = "M0122"; |
|||
$DeptId = "220"; |
|||
// $ProjectId = "3MH00545"; |
|||
$CreateTime = Date("YmdHis"); |
|||
$CurrentState = 2; |
|||
|
|||
//表身 |
|||
$ItemType = 0; |
|||
$MaterialId = "MX00011078"; |
|||
$SUnitId = "PCS"; |
|||
$DemandSQty = 5; //核准數量 |
|||
$RequestSQty = 5; //請購數量 |
|||
$RequireDate=20231205; |
|||
$CurrId="TWD"; |
|||
$UnTransQty = 5; //未轉採購基本數量 |
|||
$TransQty = 0; //已轉採購基本數量 |
|||
$SupplyQty = 5; //供給數量 |
|||
$ProjectId="3MH00545"; //合約號 |
|||
$SupplyId= "P"; //供應商 |
|||
$UnTransOtherSQty = 5; |
|||
$AllowTransOtherSQty = 5; |
|||
$CU_MaterialId="3MH00352"; //作番號 、預留標示號 |
|||
|
|||
$sql = "INSERT INTO purRequestOrder(BillNo, BillDate, PersonId, DeptId, CreateTime, CurrentState, |
|||
TypeId, DemandOrgId, FOrgId,CreatorId, CompId) VALUES ('$BillNo',$BillDate,'$PersonId','$DeptId',$CreateTime,$CurrentState, |
|||
'PR','1000','1000','$user_id','1001')"; |
|||
|
|||
$sql_sub = "INSERT INTO purApplyOrderDetail(BillNo,RowCode, RowNo, ItemType, MaterialId, SUnitId, |
|||
DemandSQty, DemandQty, RequestSQty,RequestQty, RequireDate, IsPriceWithTax, CurrId, |
|||
PurOrgId, BpOrgId, SupplyId, UnTransQty, TransQty, SupplyQty, ProjectId, PlanRangeId, |
|||
UnTransOtherSQty, AllowTransOtherSQty,P_A_DemandOrgId, PurCompId, CU_MaterialId, MarkerNo |
|||
) VALUES ('$BillNo',1,1,$ItemType,'$MaterialId','$SUnitId', |
|||
$DemandSQty, $DemandSQty, $RequestSQty, $RequestSQty, $RequireDate, 1, '$CurrId', |
|||
'1000', '1000', '$SupplyId', $UnTransQty, $TransQty, $SupplyQty, '$ProjectId', '1000', |
|||
$UnTransOtherSQty, $AllowTransOtherSQty,'1000','1001','$CU_MaterialId','$CU_MaterialId')"; |
|||
|
|||
$conn ->query($sql); |
|||
<?php |
|||
include "./header.php"; |
|||
date_default_timezone_set('Asia/Taipei'); |
|||
|
|||
//表頭 |
|||
$BillNo ="TEST01"; |
|||
$BillDate = 20231204; |
|||
$PersonId = "M0122"; |
|||
$DeptId = "220"; |
|||
// $ProjectId = "3MH00545"; |
|||
$CreateTime = Date("YmdHis"); |
|||
$CurrentState = 2; |
|||
|
|||
//表身 |
|||
$ItemType = 0; |
|||
$MaterialId = "MX00011078"; |
|||
$SUnitId = "PCS"; |
|||
$DemandSQty = 5; //核准數量 |
|||
$RequestSQty = 5; //請購數量 |
|||
$RequireDate=20231205; |
|||
$CurrId="TWD"; |
|||
$UnTransQty = 5; //未轉採購基本數量 |
|||
$TransQty = 0; //已轉採購基本數量 |
|||
$SupplyQty = 5; //供給數量 |
|||
$ProjectId="3MH00545"; //合約號 |
|||
$SupplyId= "P"; //供應商 |
|||
$UnTransOtherSQty = 5; |
|||
$AllowTransOtherSQty = 5; |
|||
$CU_MaterialId="3MH00352"; //作番號 、預留標示號 |
|||
|
|||
$sql = "INSERT INTO purRequestOrder(BillNo, BillDate, PersonId, DeptId, CreateTime, CurrentState, |
|||
TypeId, DemandOrgId, FOrgId,CreatorId, CompId) VALUES ('$BillNo',$BillDate,'$PersonId','$DeptId',$CreateTime,$CurrentState, |
|||
'PR','1000','1000','$user_id','1001')"; |
|||
|
|||
$sql_sub = "INSERT INTO purApplyOrderDetail(BillNo,RowCode, RowNo, ItemType, MaterialId, SUnitId, |
|||
DemandSQty, DemandQty, RequestSQty,RequestQty, RequireDate, IsPriceWithTax, CurrId, |
|||
PurOrgId, BpOrgId, SupplyId, UnTransQty, TransQty, SupplyQty, ProjectId, PlanRangeId, |
|||
UnTransOtherSQty, AllowTransOtherSQty,P_A_DemandOrgId, PurCompId, CU_MaterialId, MarkerNo |
|||
) VALUES ('$BillNo',1,1,$ItemType,'$MaterialId','$SUnitId', |
|||
$DemandSQty, $DemandSQty, $RequestSQty, $RequestSQty, $RequireDate, 1, '$CurrId', |
|||
'1000', '1000', '$SupplyId', $UnTransQty, $TransQty, $SupplyQty, '$ProjectId', '1000', |
|||
$UnTransOtherSQty, $AllowTransOtherSQty,'1000','1001','$CU_MaterialId','$CU_MaterialId')"; |
|||
|
|||
$conn ->query($sql); |
|||
$conn ->query($sql_sub); |
@ -1,180 +1,180 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 部門職別 |
|||
$db_query = "select department_id, name, role_id, role from department order by department_id"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$depart_arr[$row["department_id"]] = $row["name"]; |
|||
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
var jroleStr = '<?php echo json_encode($role_arr); ?>'; |
|||
var jroleArr = JSON.parse(jroleStr); |
|||
var optStr = ""; |
|||
$("select[name=department_id]").change(function(){ |
|||
if ($(this).val() != "") { |
|||
optStr = ""; |
|||
for (var i in jroleArr[$(this).val()]) { |
|||
if ('undefined' !== jroleArr[$(this).val()][i]) { |
|||
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>'; |
|||
} |
|||
} |
|||
$("select[name=role_id]").html(optStr); |
|||
} else $("select[name=role_id]").html('<option value="">請選擇</option>'); |
|||
}) |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "account-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> |
|||
|
|||
|
|||
<div> |
|||
<label for="accounttype">帳號類別(必選)</label> |
|||
<select name="accounttype" id="accounttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<option value="A">客戶(A)</option> |
|||
<option value="B">保養人員(B)</option> |
|||
<!-- |
|||
<option value="C">檢查人員</option> |
|||
<option value="D">契約人員</option> |
|||
--> |
|||
<option value="E">管理人員(E)</option> |
|||
<option value="M">永佳捷員工(M)</option> |
|||
<option value="X">未分類(X)</option> |
|||
</select> |
|||
<!-- <input type="text" name="accounttype" id="accounttype" placeholder="帳號類別..." required> --> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="accountid">請輸入員工、個人客戶ID或公司客戶統編(必填)</label> |
|||
<input type="text" name="accountid" id="accountid" placeholder="請輸入員工、個人客戶ID或公司客戶統編...(必填)" maxlength="10" required> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="pwd">密碼(必填)</label> |
|||
<input type="text" name="pwd" id="pwd" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">姓名(必填)</label> |
|||
<input type="text" name="name" id="name" required> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" maxlength="16"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="email">電子郵箱</label> |
|||
<input type="text" name="email" id="email"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="lineid">Line ID</label> |
|||
<input type="text" name="lineid" id="lineid"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="wechatid">微信ID</label> |
|||
<input type="text" name="wechatid" id="wechatid"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="phone_call_help">保養員聯絡手機號(客戶必填)</label> |
|||
<input type="text" name="phone_call_help" id="phone_call_help" maxlength="16"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_for_help">線上文字客服</label> |
|||
<input type="text" name="chat_for_help" id="chat_for_help"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="remote_help">遠端視頻帳號</label> |
|||
<input type="text" name="remote_help" id="remote_help"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">服務與支持人員工號(客戶必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" maxlength="10"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="manager">直屬主管工號(員工必填)</label> |
|||
<input type="text" name="manager" id="manager" maxlength="10"> |
|||
|
|||
</div> |
|||
<div> |
|||
<label for="department_id">部門(員工必填)</label> |
|||
<select name="department_id"> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($depart_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="role_id">職別(員工必填)</label> |
|||
<select name="role_id"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
<?php if ($user_auth&2) { ?> |
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<?php } ?> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 部門職別 |
|||
$db_query = "select department_id, name, role_id, role from department order by department_id"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$depart_arr[$row["department_id"]] = $row["name"]; |
|||
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
var jroleStr = '<?php echo json_encode($role_arr); ?>'; |
|||
var jroleArr = JSON.parse(jroleStr); |
|||
var optStr = ""; |
|||
$("select[name=department_id]").change(function(){ |
|||
if ($(this).val() != "") { |
|||
optStr = ""; |
|||
for (var i in jroleArr[$(this).val()]) { |
|||
if ('undefined' !== jroleArr[$(this).val()][i]) { |
|||
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>'; |
|||
} |
|||
} |
|||
$("select[name=role_id]").html(optStr); |
|||
} else $("select[name=role_id]").html('<option value="">請選擇</option>'); |
|||
}) |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "account-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> |
|||
|
|||
|
|||
<div> |
|||
<label for="accounttype">帳號類別(必選)</label> |
|||
<select name="accounttype" id="accounttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<option value="A">客戶(A)</option> |
|||
<option value="B">保養人員(B)</option> |
|||
<!-- |
|||
<option value="C">檢查人員</option> |
|||
<option value="D">契約人員</option> |
|||
--> |
|||
<option value="E">管理人員(E)</option> |
|||
<option value="M">永佳捷員工(M)</option> |
|||
<option value="X">未分類(X)</option> |
|||
</select> |
|||
<!-- <input type="text" name="accounttype" id="accounttype" placeholder="帳號類別..." required> --> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="accountid">請輸入員工、個人客戶ID或公司客戶統編(必填)</label> |
|||
<input type="text" name="accountid" id="accountid" placeholder="請輸入員工、個人客戶ID或公司客戶統編...(必填)" maxlength="10" required> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="pwd">密碼(必填)</label> |
|||
<input type="text" name="pwd" id="pwd" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">姓名(必填)</label> |
|||
<input type="text" name="name" id="name" required> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" maxlength="16"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="email">電子郵箱</label> |
|||
<input type="text" name="email" id="email"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="lineid">Line ID</label> |
|||
<input type="text" name="lineid" id="lineid"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="wechatid">微信ID</label> |
|||
<input type="text" name="wechatid" id="wechatid"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="phone_call_help">保養員聯絡手機號(客戶必填)</label> |
|||
<input type="text" name="phone_call_help" id="phone_call_help" maxlength="16"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_for_help">線上文字客服</label> |
|||
<input type="text" name="chat_for_help" id="chat_for_help"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="remote_help">遠端視頻帳號</label> |
|||
<input type="text" name="remote_help" id="remote_help"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">服務與支持人員工號(客戶必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" maxlength="10"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="manager">直屬主管工號(員工必填)</label> |
|||
<input type="text" name="manager" id="manager" maxlength="10"> |
|||
|
|||
</div> |
|||
<div> |
|||
<label for="department_id">部門(員工必填)</label> |
|||
<select name="department_id"> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($depart_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="role_id">職別(員工必填)</label> |
|||
<select name="role_id"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
<?php if ($user_auth&2) { ?> |
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<?php } ?> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,19 +1,19 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$sql = "select accountid from account where id = '$id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
if ($row = mysqli_fetch_assoc($res)) { |
|||
$db_query = "delete from account where id = '$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
$db_query = "delete from account_auth where accountid = '".$row["accountid"]."'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
mysqli_free_result($res); |
|||
header("Refresh:0; url=account-index.php?function_name=account&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$sql = "select accountid from account where id = '$id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
if ($row = mysqli_fetch_assoc($res)) { |
|||
$db_query = "delete from account where id = '$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
$db_query = "delete from account_auth where accountid = '".$row["accountid"]."'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
mysqli_free_result($res); |
|||
header("Refresh:0; url=account-index.php?function_name=account&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,173 +1,173 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
// 部門職別 |
|||
$db_query = "select department_id, name, role_id, role from department order by department_id"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$depart_arr[$row["department_id"]] = $row["name"]; |
|||
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM account WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
var jroleStr = '<?php echo json_encode($role_arr); ?>'; |
|||
var jroleArr = JSON.parse(jroleStr); |
|||
var optStr = ""; |
|||
$("select[name=department_id]").change(function(){ |
|||
if ($(this).val() != "") { |
|||
optStr = ""; |
|||
for (var i in jroleArr[$(this).val()]) { |
|||
if ('undefined' !== jroleArr[$(this).val()][i]) { |
|||
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>'; |
|||
} |
|||
} |
|||
$("select[name=role_id]").html(optStr); |
|||
} else $("select[name=role_id]").html('<option value="">請選擇</option>'); |
|||
}) |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="account-record-update.php"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="accounttype">帳號類別</label> |
|||
<input type="text" name="accounttype" id="accounttype" value="<?php echo $data['accounttype']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="accountid">帳號</label> |
|||
<input type="text" name="accountid" id="accountid" value="<?php echo $data['accountid']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="pwd">密碼(必填)</label> |
|||
<input type="text" name="pwd" id="pwd" value="<?php echo $data['pwd']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">姓名(必填)</label> |
|||
<input type="text" name="name" id="name" value="<?php echo $data['name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="email">電子郵箱</label> |
|||
<input type="text" name="email" id="email" value="<?php echo $data['email']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="lineid">Line ID</label> |
|||
<input type="text" name="lineid" id="lineid" value="<?php echo $data['lineid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="wechatid">微信ID</label> |
|||
<input type="text" name="wechatid" id="wechatid" value="<?php echo $data['wechatid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="phone_call_help">保養員聯絡手機號(客戶必填)</label> |
|||
<input type="text" name="phone_call_help" id="phone_call_help" value="<?php echo $data['phone_call_help']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_for_help">線上文字客服</label> |
|||
<input type="text" name="chat_for_help" id="chat_for_help" value="<?php echo $data['chat_for_help']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="remote_help">遠端視頻帳號</label> |
|||
<input type="text" name="remote_help" id="remote_help" value="<?php echo $data['remote_help']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">服務與支持人員工號(客戶必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data['repairerid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="manager">直屬主管工號(員工必填)</label> |
|||
<input type="text" name="manager" id="manager" value="<?php echo $data['manager']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="department_id">部門(員工必填)</label> |
|||
<select name="department_id"> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($depart_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["department_id"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="role_id">職別(員工必填)</label> |
|||
<select name="role_id"> |
|||
<?php |
|||
foreach ($role_arr[$data["department_id"]] as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["role_id"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
// 部門職別 |
|||
$db_query = "select department_id, name, role_id, role from department order by department_id"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$depart_arr[$row["department_id"]] = $row["name"]; |
|||
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM account WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
var jroleStr = '<?php echo json_encode($role_arr); ?>'; |
|||
var jroleArr = JSON.parse(jroleStr); |
|||
var optStr = ""; |
|||
$("select[name=department_id]").change(function(){ |
|||
if ($(this).val() != "") { |
|||
optStr = ""; |
|||
for (var i in jroleArr[$(this).val()]) { |
|||
if ('undefined' !== jroleArr[$(this).val()][i]) { |
|||
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>'; |
|||
} |
|||
} |
|||
$("select[name=role_id]").html(optStr); |
|||
} else $("select[name=role_id]").html('<option value="">請選擇</option>'); |
|||
}) |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="account-record-update.php"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="accounttype">帳號類別</label> |
|||
<input type="text" name="accounttype" id="accounttype" value="<?php echo $data['accounttype']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="accountid">帳號</label> |
|||
<input type="text" name="accountid" id="accountid" value="<?php echo $data['accountid']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="pwd">密碼(必填)</label> |
|||
<input type="text" name="pwd" id="pwd" value="<?php echo $data['pwd']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">姓名(必填)</label> |
|||
<input type="text" name="name" id="name" value="<?php echo $data['name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="email">電子郵箱</label> |
|||
<input type="text" name="email" id="email" value="<?php echo $data['email']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="lineid">Line ID</label> |
|||
<input type="text" name="lineid" id="lineid" value="<?php echo $data['lineid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="wechatid">微信ID</label> |
|||
<input type="text" name="wechatid" id="wechatid" value="<?php echo $data['wechatid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="phone_call_help">保養員聯絡手機號(客戶必填)</label> |
|||
<input type="text" name="phone_call_help" id="phone_call_help" value="<?php echo $data['phone_call_help']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_for_help">線上文字客服</label> |
|||
<input type="text" name="chat_for_help" id="chat_for_help" value="<?php echo $data['chat_for_help']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="remote_help">遠端視頻帳號</label> |
|||
<input type="text" name="remote_help" id="remote_help" value="<?php echo $data['remote_help']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">服務與支持人員工號(客戶必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data['repairerid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="manager">直屬主管工號(員工必填)</label> |
|||
<input type="text" name="manager" id="manager" value="<?php echo $data['manager']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="department_id">部門(員工必填)</label> |
|||
<select name="department_id"> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($depart_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["department_id"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="role_id">職別(員工必填)</label> |
|||
<select name="role_id"> |
|||
<?php |
|||
foreach ($role_arr[$data["department_id"]] as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["role_id"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
@ -1,85 +1,85 @@ |
|||
<?php |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
include "database.php"; |
|||
include 'class/Cmail.php'; |
|||
|
|||
header('Content-Type: application/json'); |
|||
$method = $_POST['method']; |
|||
$id = empty($_POST['id']) ? '' : $_POST['id']; |
|||
$sql = " |
|||
SELECT * FROM account WHERE id = '$id' |
|||
"; |
|||
$result = mysqli_query($link, $sql); |
|||
$data = mysqli_fetch_assoc($result); |
|||
|
|||
$cmail = new Cmail(); |
|||
$subject = "永佳捷新人文件"; |
|||
$em_body = ""; |
|||
$file_name = str_replace('/', '\\', __DIR__ . "/public/file/永佳捷雲端空間使用設定方式.pdf"); |
|||
$file[0] = [$file_name, "永佳捷雲端空間使用設定方式.pdf"]; |
|||
$sendlist[0] = [$data['name'], $data['email']]; |
|||
|
|||
// 保養人員 |
|||
if (in_array($data['accounttype'], ['B'])) { |
|||
$em_body = " |
|||
您好,我是桃園資訊處的子苹, |
|||
以下是給新報到同仁的基本資訊,您再參考: |
|||
|
|||
員編:" . $data['accountid'] . " |
|||
公司手機門號:請和資訊人員聯絡 |
|||
你的email:" . $data['email'] . " |
|||
web收信:http://webmail.masada.com.tw:8081 |
|||
帳號:" . explode('@', $data['email'])[0] . " |
|||
密碼:" . $data['accountid'] . " |
|||
登入後密碼可再自行更改 |
|||
除了這個web方式收信,你也可以點擊手機裡的gmail收發信 |
|||
|
|||
桌面有安裝「維保APP系統」 |
|||
登入帳號 " . $data['accountid'] . " |
|||
密碼 " . explode('@', $data['email'])[0] . " |
|||
GPS定位APP的登入帳密跟上面的一樣 |
|||
|
|||
http://oa.masada.com.tw |
|||
這是公司內部系統 |
|||
登入帳號:" . $data['accountid'] . " |
|||
登入密碼:" . explode('@', $data['email'])[0] . " |
|||
|
|||
https://cloud.masada.com.tw:1846/ |
|||
這是公司雲端系統 |
|||
預設帳密在信箱 請記得去更改密碼 |
|||
|
|||
以上,有問題請隨時與資訊聯繫,謝謝! |
|||
"; |
|||
} |
|||
// 員工 |
|||
if (in_array($data['accounttype'], ['M', 'E'])) { |
|||
$em_body = " |
|||
您好, |
|||
以下是給新報到同仁的基本資訊,您再參考: |
|||
|
|||
員編:" . $data['accountid'] . " |
|||
你的email:" . $data['email'] . " |
|||
web收信:http://webmail.masada.com.tw:8081 |
|||
帳號:" . explode('@', $data['email'])[0] . " |
|||
密碼:" . $data['accountid'] . " |
|||
登入後密碼可再自行更改 |
|||
除了這個web方式收信,你也可以用電腦裡的outlook收發信 |
|||
|
|||
http://oa.masada.com.tw |
|||
這是公司內部系統 |
|||
登入帳號:" . $data['accountid'] . " |
|||
登入密碼:" . explode('@', $data['email'])[0] . " |
|||
|
|||
https://cloud.masada.com.tw:1846/ |
|||
這是公司雲端系統 |
|||
預設帳密在信箱 請記得去更改密碼 |
|||
|
|||
|
|||
以上,有問題請隨時與資訊聯繫,謝謝! |
|||
|
|||
"; |
|||
} |
|||
|
|||
$cmail->sendx($subject, $em_body, $sendlist, "永佳捷科技", "", $file); |
|||
echo json_encode([1, "信件發送成功"]); |
|||
} |
|||
<?php |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
include "database.php"; |
|||
include 'class/Cmail.php'; |
|||
|
|||
header('Content-Type: application/json'); |
|||
$method = $_POST['method']; |
|||
$id = empty($_POST['id']) ? '' : $_POST['id']; |
|||
$sql = " |
|||
SELECT * FROM account WHERE id = '$id' |
|||
"; |
|||
$result = mysqli_query($link, $sql); |
|||
$data = mysqli_fetch_assoc($result); |
|||
|
|||
$cmail = new Cmail(); |
|||
$subject = "永佳捷新人文件"; |
|||
$em_body = ""; |
|||
$file_name = str_replace('/', '\\', __DIR__ . "/public/file/永佳捷雲端空間使用設定方式.pdf"); |
|||
$file[0] = [$file_name, "永佳捷雲端空間使用設定方式.pdf"]; |
|||
$sendlist[0] = [$data['name'], $data['email']]; |
|||
|
|||
// 保養人員 |
|||
if (in_array($data['accounttype'], ['B'])) { |
|||
$em_body = " |
|||
您好,我是桃園資訊處的子苹, |
|||
以下是給新報到同仁的基本資訊,您再參考: |
|||
|
|||
員編:" . $data['accountid'] . " |
|||
公司手機門號:請和資訊人員聯絡 |
|||
你的email:" . $data['email'] . " |
|||
web收信:http://webmail.masada.com.tw:8081 |
|||
帳號:" . explode('@', $data['email'])[0] . " |
|||
密碼:" . $data['accountid'] . " |
|||
登入後密碼可再自行更改 |
|||
除了這個web方式收信,你也可以點擊手機裡的gmail收發信 |
|||
|
|||
桌面有安裝「維保APP系統」 |
|||
登入帳號 " . $data['accountid'] . " |
|||
密碼 " . explode('@', $data['email'])[0] . " |
|||
GPS定位APP的登入帳密跟上面的一樣 |
|||
|
|||
http://oa.masada.com.tw |
|||
這是公司內部系統 |
|||
登入帳號:" . $data['accountid'] . " |
|||
登入密碼:" . explode('@', $data['email'])[0] . " |
|||
|
|||
https://cloud.masada.com.tw:1846/ |
|||
這是公司雲端系統 |
|||
預設帳密在信箱 請記得去更改密碼 |
|||
|
|||
以上,有問題請隨時與資訊聯繫,謝謝! |
|||
"; |
|||
} |
|||
// 員工 |
|||
if (in_array($data['accounttype'], ['M', 'E'])) { |
|||
$em_body = " |
|||
您好, |
|||
以下是給新報到同仁的基本資訊,您再參考: |
|||
|
|||
員編:" . $data['accountid'] . " |
|||
你的email:" . $data['email'] . " |
|||
web收信:http://webmail.masada.com.tw:8081 |
|||
帳號:" . explode('@', $data['email'])[0] . " |
|||
密碼:" . $data['accountid'] . " |
|||
登入後密碼可再自行更改 |
|||
除了這個web方式收信,你也可以用電腦裡的outlook收發信 |
|||
|
|||
http://oa.masada.com.tw |
|||
這是公司內部系統 |
|||
登入帳號:" . $data['accountid'] . " |
|||
登入密碼:" . explode('@', $data['email'])[0] . " |
|||
|
|||
https://cloud.masada.com.tw:1846/ |
|||
這是公司雲端系統 |
|||
預設帳密在信箱 請記得去更改密碼 |
|||
|
|||
|
|||
以上,有問題請隨時與資訊聯繫,謝謝! |
|||
|
|||
"; |
|||
} |
|||
|
|||
$cmail->sendx($subject, $em_body, $sendlist, "永佳捷科技", "", $file); |
|||
echo json_encode([1, "信件發送成功"]); |
|||
} |
|||
|
@ -1,173 +1,198 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$accounttype_arr = ["A" => "客戶", "B" => "保養人員", "C" => "檢查人員", "D" => "契約人員", "M" => "員工", "E" => "管理員(IT)", "X" => "未分類"]; #A=客戶 B=保養人員 C=檢查人員 D=契約人員 E=管理人員 M=永佳捷員工 X=未分類 |
|||
|
|||
// 工務總處、王凱欣可瀏覽全部資料 |
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; |
|||
$sql = "SELECT * FROM account $sql_cmd ORDER BY id"; |
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="account-create.php?function_name=account&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:account-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>遠端協助</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<!--<th>刪除</th>--> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td data-toggle="tooltip" data-placement="right" title=" |
|||
<?php |
|||
if (isset($accounttype_arr[$data['accounttype']])){ |
|||
echo $accounttype_arr[$data['accounttype']]; |
|||
}else{ |
|||
echo $data['accounttype']; |
|||
} |
|||
?> |
|||
"> |
|||
<?php |
|||
if (isset($accounttype_arr[$data['accounttype']])){ |
|||
echo $accounttype_arr[$data['accounttype']]; |
|||
}else{ |
|||
echo $data['accounttype']; |
|||
} |
|||
?></td> |
|||
<td><?php echo $data['accountid']; ?></td> |
|||
<!--<td><?php echo $data['pwd']; ?></td>--> |
|||
<td><?php echo $data['name']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['email']; ?></td> |
|||
<td><?php echo $data['lineid']; ?></td> |
|||
<td><?php echo $data['wechatid']; ?></td> |
|||
<td><a href="<?php echo $data['remote_help']; ?>">連結<a/></td> |
|||
<td><?php echo $data['repairerid']; ?></td> |
|||
<td><?php echo $data['manager']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="account-edit.php?id=<?php echo $data['id']; ?>&function_name=account&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<!--<td> |
|||
<p> |
|||
<a href="account-delete.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td>--> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$accounttype_arr = ["A" => "客戶", "B" => "保養人員", "C" => "檢查人員", "D" => "契約人員", "M" => "員工", "E" => "管理員(IT)", "X" => "未分類"]; #A=客戶 B=保養人員 C=檢查人員 D=契約人員 E=管理人員 M=永佳捷員工 X=未分類 |
|||
|
|||
// 工務總處、王凱欣可瀏覽全部資料 |
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; |
|||
$sql = "SELECT * FROM account $sql_cmd ORDER BY id"; |
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link, $sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth & 2) { ?> |
|||
<p> |
|||
<a href="account-create.php?function_name=account&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
|
|||
if ($data) : |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) { |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:account-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout: fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap: break-word; |
|||
} |
|||
|
|||
img { |
|||
width: 125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width: 125px; |
|||
} |
|||
|
|||
table { |
|||
width: 100%; |
|||
} |
|||
|
|||
#table_index_filter { |
|||
float: right; |
|||
} |
|||
|
|||
#table_index_paginate { |
|||
float: right; |
|||
} |
|||
|
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>遠端協助</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth & 2) { ?> |
|||
<th>修改</th> |
|||
<th>新人資料</th> |
|||
<!--<th>刪除</th>--> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach ($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td data-toggle="tooltip" data-placement="right" title=" |
|||
<?php |
|||
if (isset($accounttype_arr[$data['accounttype']])) { |
|||
echo $accounttype_arr[$data['accounttype']]; |
|||
} else { |
|||
echo $data['accounttype']; |
|||
} |
|||
?> |
|||
"> |
|||
<?php |
|||
if (isset($accounttype_arr[$data['accounttype']])) { |
|||
echo $accounttype_arr[$data['accounttype']]; |
|||
} else { |
|||
echo $data['accounttype']; |
|||
} |
|||
?></td> |
|||
<td><?php echo $data['accountid']; ?></td> |
|||
<!--<td><?php echo $data['pwd']; ?></td>--> |
|||
<td><?php echo $data['name']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['email']; ?></td> |
|||
<td><?php echo $data['lineid']; ?></td> |
|||
<td><?php echo $data['wechatid']; ?></td> |
|||
<td><a href="<?php echo $data['remote_help']; ?>">連結<a /></td> |
|||
<td><?php echo $data['repairerid']; ?></td> |
|||
<td><?php echo $data['manager']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth & 2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="account-edit.php?id=<?php echo $data['id']; ?>&function_name=account&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<!--<td> |
|||
<p> |
|||
<a href="account-delete.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td>--> |
|||
<?php } ?> |
|||
<td> |
|||
<button type="button" class="btn" onclick="sendJuniorStaffDoc(<?php echo $data['id']; ?>)">寄送</button> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<script> |
|||
function sendJuniorStaffDoc(id) { |
|||
$.ajax({ |
|||
url: window.location.origin + '/wms/account-index-submit.php', |
|||
type: 'POST', |
|||
data: { |
|||
'method': 'sendJuniorStaffDoc', |
|||
'id': id |
|||
}, |
|||
dataType: 'json', |
|||
success: function(response) { |
|||
alert("寄送成功!"); |
|||
}, |
|||
error: function(xhr, status, error) { |
|||
alert("寄送失敗!"); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
</script> |
|||
<?php |
|||
|
|||
else : |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
@ -1,199 +1,255 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
//企業名稱 統一編號 聯絡地址 |
|||
$Bill = $_POST['Bill']; |
|||
$Bill = json_decode($Bill, true); |
|||
$sql_received = "SELECT * from account_received where BillNo = '$Bill[0]' ORDER BY `pay_id` ASC"; |
|||
$pay_received = mysqli_query($link, $sql_received); |
|||
$had_received = 0; |
|||
if (mysqli_num_rows($pay_received) == 0) { |
|||
foreach ($pay_received as $received) { |
|||
$had_received += $received['received_amount']; |
|||
} |
|||
} |
|||
$unreceived = $Bill[12] - $had_received; |
|||
$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[0] ?>" 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[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="<?= $Bill[14] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="TaxNo">統一編號</label> |
|||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[15] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ContactAddress">聯絡地址</label> |
|||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[16] ?>" 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[13]) ?></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[12])) ?></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> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?= number_format(round($Bill[5])) ?></td> |
|||
<td><?= number_format(round($Bill[6])) ?></td> |
|||
<td><?= number_format(round($Bill[7])) ?></td> |
|||
<td><?= number_format(round($Bill[8])) ?></td> |
|||
<td><?= number_format(round($Bill[9])) ?></td> |
|||
<td><?= number_format(round($Bill[10])) ?></td> |
|||
<td><?= number_format(round($Bill[11])) ?></td> |
|||
|
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
include "./footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
if ($user_id == "M0122") { |
|||
?> |
|||
<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 style="width: 10%;">功能</th> |
|||
</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['received_date'] ?></td> |
|||
<td><?= number_format($received['received_amount']) ?></td> |
|||
<td><?= $received['remark'] ?></td> |
|||
<td><?php if (in_array(accountidToDepartId($user_id), array('220', '210'))) { ?> |
|||
<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> |
|||
<?php } ?> |
|||
</td> |
|||
</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(); |
|||
} |
|||
<?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> |
@ -1,39 +1,39 @@ |
|||
<?php |
|||
include "header.php"; |
|||
// 合約收款款別名稱 |
|||
$arrayData = []; |
|||
echo "合約號;客戶名稱;1款;金額;2款;金額;3款;金額;4款;金額;5款;金額;6款;金額;7款;金額;8款;金額;9款;金額;10款;金額;11款;金額;12款</br>"; |
|||
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName |
|||
FROM salOrderStagePay AS a |
|||
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|||
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId |
|||
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4)"; |
|||
|
|||
$contract = $conn->query($sql_contract); |
|||
foreach ($contract as $cont) { |
|||
if ($cont['BillNo'] == 'SO20230801002') { |
|||
$BillNo = 'M231067'; |
|||
}else{ |
|||
$BillNo = $cont['BillNo']; |
|||
}; |
|||
$PayStage = $cont['PayStage']; |
|||
$PayAmount = $cont['PlanPayAmt']; |
|||
$partnerName = $cont['BizPartnerName']; |
|||
if(isset($arrayData[$BillNo])){ |
|||
array_push($arrayData[$BillNo], $PayStage); |
|||
array_push($arrayData[$BillNo], $PayAmount); |
|||
|
|||
}else{ |
|||
$arrayData[$BillNo][0] = $BillNo; |
|||
$arrayData[$BillNo][1] = $partnerName; |
|||
array_push($arrayData[$BillNo], $PayStage); |
|||
array_push($arrayData[$BillNo], $PayAmount); |
|||
|
|||
} |
|||
}; |
|||
foreach($arrayData as $data){ |
|||
foreach($data as $value){ |
|||
echo $value.";"; |
|||
} |
|||
echo "</br>"; |
|||
<?php |
|||
include "header.php"; |
|||
// 合約收款款別名稱 |
|||
$arrayData = []; |
|||
echo "合約號;客戶名稱;1款;金額;2款;金額;3款;金額;4款;金額;5款;金額;6款;金額;7款;金額;8款;金額;9款;金額;10款;金額;11款;金額;12款</br>"; |
|||
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName |
|||
FROM salOrderStagePay AS a |
|||
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|||
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId |
|||
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4)"; |
|||
|
|||
$contract = $conn->query($sql_contract); |
|||
foreach ($contract as $cont) { |
|||
if ($cont['BillNo'] == 'SO20230801002') { |
|||
$BillNo = 'M231067'; |
|||
}else{ |
|||
$BillNo = $cont['BillNo']; |
|||
}; |
|||
$PayStage = $cont['PayStage']; |
|||
$PayAmount = $cont['PlanPayAmt']; |
|||
$partnerName = $cont['BizPartnerName']; |
|||
if(isset($arrayData[$BillNo])){ |
|||
array_push($arrayData[$BillNo], $PayStage); |
|||
array_push($arrayData[$BillNo], $PayAmount); |
|||
|
|||
}else{ |
|||
$arrayData[$BillNo][0] = $BillNo; |
|||
$arrayData[$BillNo][1] = $partnerName; |
|||
array_push($arrayData[$BillNo], $PayStage); |
|||
array_push($arrayData[$BillNo], $PayAmount); |
|||
|
|||
} |
|||
}; |
|||
foreach($arrayData as $data){ |
|||
foreach($data as $value){ |
|||
echo $value.";"; |
|||
} |
|||
echo "</br>"; |
|||
} |
@ -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> |
@ -1,345 +1,403 @@ |
|||
<?php |
|||
include "header.php"; |
|||
require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php'; |
|||
|
|||
use PhpOffice\PhpSpreadsheet\Spreadsheet; |
|||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls; |
|||
//use PhpOffice\PhpSpreadsheet\Reader\Xls; |
|||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx; |
|||
|
|||
$follower = find_follow($user_id); |
|||
$arrayData = []; |
|||
$receivable_array = []; |
|||
$received_array = []; |
|||
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 |
|||
//arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 |
|||
$sql_received = "SELECT * from account_received"; |
|||
|
|||
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName, s.PersonId, |
|||
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a |
|||
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|||
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId |
|||
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; |
|||
if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { |
|||
$sql_contract .= "AND (s.PersonId = '$user_id'"; |
|||
$sql_received .= " WHERE person_id = '$user_id'"; |
|||
if (count($follower) > 0) { |
|||
$column_str = "('$user_id'" . ",'"; |
|||
$column_str .= implode("','", $follower); |
|||
$column_str .= "')"; |
|||
$sql_contract .= " OR s.PersonId IN $column_str)"; |
|||
$sql_received .= " OR person_id IN $column_str)"; |
|||
} else { |
|||
$sql_contract .= ")"; |
|||
}; |
|||
} |
|||
|
|||
$contract = $conn->query($sql_contract); |
|||
$received_data = mysqli_query($link, $sql_received); |
|||
foreach ($received_data as $received) { |
|||
if ($received['BillNo'] == 'SO20230801001') { |
|||
$BillNo = 'M230947'; |
|||
} elseif ($received['BillNo'] == 'SO20230801002') { |
|||
$BillNo = 'M231067'; |
|||
} else { |
|||
$BillNo = $received['BillNo']; |
|||
}; |
|||
if (isset($received_array[$BillNo])) { |
|||
$received_array[$BillNo][0] += $received['invoice_amount']; |
|||
$received_array[$BillNo][1] += $received['received_amount']; |
|||
} else { |
|||
$received_array[$BillNo][0] = $received['invoice_amount']; |
|||
$received_array[$BillNo][1] = $received['received_amount']; |
|||
} |
|||
} |
|||
foreach ($contract as $cont) { |
|||
// print_r($cont); |
|||
// echo "<br>"; |
|||
if ($cont['BillNo'] == 'SO20230801001') { |
|||
$BillNo = 'M230947'; |
|||
} elseif ($cont['BillNo'] == 'SO20230801002') { |
|||
$BillNo = 'M231067'; |
|||
} else { |
|||
$BillNo = $cont['BillNo']; |
|||
}; |
|||
$PayStage = $cont['PayStage']; |
|||
$PayAmount = $cont['PlanPayAmt']; |
|||
$partnerName = $cont['BizPartnerName']; |
|||
$EnterpriseName = $cont['EnterpriseName']; |
|||
$TaxNo = $cont['TaxNo']; |
|||
$ContactAddress = $cont['ContactAddress']; |
|||
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 |
|||
if (isset($arrayData[$BillNo])) { |
|||
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { |
|||
$arrayData[$BillNo][5] = $PayAmount; |
|||
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { |
|||
$arrayData[$BillNo][4] = $PayAmount; |
|||
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { |
|||
$arrayData[$BillNo][6] = $PayAmount; |
|||
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { |
|||
$arrayData[$BillNo][8] = $PayAmount; |
|||
} elseif (stristr($PayStage, '安裝')) { |
|||
$arrayData[$BillNo][7] = $PayAmount; |
|||
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { |
|||
$arrayData[$BillNo][10] = $PayAmount; |
|||
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { |
|||
$arrayData[$BillNo][9] = $PayAmount; |
|||
} else { |
|||
$arrayData[$BillNo][12] = $PayAmount; |
|||
} |
|||
} else { |
|||
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|||
$arrayData[$BillNo][3] = $partnerName; |
|||
$arrayData[$BillNo][13] = $EnterpriseName; |
|||
$arrayData[$BillNo][14] = $TaxNo; |
|||
$arrayData[$BillNo][15] = $ContactAddress; |
|||
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { |
|||
$arrayData[$BillNo][5] = $PayAmount; |
|||
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { |
|||
$arrayData[$BillNo][4] = $PayAmount; |
|||
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { |
|||
$arrayData[$BillNo][6] = $PayAmount; |
|||
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { |
|||
$arrayData[$BillNo][8] = $PayAmount; |
|||
} elseif (stristr($PayStage, '安裝')) { |
|||
$arrayData[$BillNo][7] = $PayAmount; |
|||
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { |
|||
$arrayData[$BillNo][10] = $PayAmount; |
|||
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { |
|||
$arrayData[$BillNo][9] = $PayAmount; |
|||
} else { |
|||
$arrayData[$BillNo][12] = $PayAmount; |
|||
} |
|||
} |
|||
} |
|||
|
|||
foreach ($arrayData as $key => $value) { |
|||
$sql = "SELECT |
|||
tmp2.*, |
|||
d.name AS depart_name |
|||
FROM( |
|||
SELECT |
|||
a.manager, |
|||
a2.name as manager_name, |
|||
a.name, |
|||
a.department_id, |
|||
w.salesid, |
|||
w.contractno, |
|||
w.facilityno, |
|||
w.estimated_shipping_date, |
|||
w.actual_tofactory_date, |
|||
w.real_arrival_date, |
|||
w.install_end_date, |
|||
w.tryrun_end_date, |
|||
w.official_check_date, |
|||
w.delivery_date |
|||
from wipwholestatus AS w |
|||
left join account AS a |
|||
ON w.salesid = a.accountid |
|||
left join account AS a2 |
|||
ON a2.accountid = a.manager |
|||
where w.status = '1' AND w.contractno='" . $key . "'" . " |
|||
|
|||
)AS tmp2 |
|||
left join ( |
|||
SELECT DISTINCT |
|||
department_id, |
|||
name |
|||
FROM department |
|||
|
|||
) AS d |
|||
ON d.department_id = tmp2.department_id"; |
|||
$facitities = ""; |
|||
$total_facility_num = 0; |
|||
$arrive_num = 0; |
|||
$tryrun_num = 0; |
|||
$delivery_num = 0; |
|||
$official_num = 0; |
|||
$wipwhole_array = mysqli_query($link, $sql); |
|||
foreach ($wipwhole_array as $wip) { |
|||
$value[0] = $wip['depart_name']; |
|||
$value[1] = $wip['manager_name']; |
|||
$value[2] = $wip['name']; |
|||
$value[16] = isset($wip['department_id']) ? $wip['department_id'] : ''; |
|||
$value[17] = isset($wip['salesid']) ? $wip['salesid'] : ''; |
|||
if ($wip['delivery_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|||
$total_facility_num += 1; |
|||
$arrive_num += 1; |
|||
$tryrun_num += 1; |
|||
$official_num += 1; |
|||
$delivery_num += 1; |
|||
} elseif ($wip['official_check_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; |
|||
$total_facility_num += 1; |
|||
$arrive_num += 1; |
|||
$tryrun_num += 1; |
|||
$official_num += 1; |
|||
} elseif ($wip['tryrun_end_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; |
|||
$total_facility_num += 1; |
|||
$arrive_num += 1; |
|||
$tryrun_num += 1; |
|||
} elseif ($wip['install_end_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; |
|||
$total_facility_num += 1; |
|||
$arrive_num += 1; |
|||
} elseif ($wip['real_arrival_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; |
|||
$total_facility_num += 1; |
|||
$arrive_num += 1; |
|||
} elseif ($wip['actual_tofactory_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) <br>"; |
|||
$total_facility_num += 1; |
|||
} elseif ($wip['estimated_shipping_date'] != NULL) { |
|||
$facitities .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) <br>"; |
|||
$total_facility_num += 1; |
|||
} else { |
|||
$facitities .= $wip['facilityno'] . " (預計到港日待確認) <br>"; |
|||
$total_facility_num += 1; |
|||
} |
|||
} |
|||
$receivable_budget = 0; |
|||
//這是錢 4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 |
|||
//這是數量 arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 |
|||
if ($total_facility_num > 0) { |
|||
$receivable_budget = $value[4] + ($value[5] + $value[6]) * ($arrive_num / $total_facility_num) + |
|||
($value[7] + $value[8]) * ($tryrun_num / $total_facility_num) + ($value[9]) * ($official_num / $total_facility_num) |
|||
+ ($value[10]) * ($delivery_num / $total_facility_num); |
|||
$uninvoice_budget = $receivable_budget; |
|||
$unreceived_budget = $receivable_budget; |
|||
$received_invoice = 0; |
|||
$received_budget = 0; |
|||
if (isset($received_array[$key][0])) { |
|||
$uninvoice_budget = $receivable_budget - $received_array[$key][0]; |
|||
$received_invoice = $received_array[$key][0]; |
|||
}else{ |
|||
$uninvoice_budget = $receivable_budget; |
|||
} |
|||
if (isset($received_array[$key][1])) { |
|||
$unreceived_budget = $receivable_budget - $received_array[$key][1]; |
|||
$received_budget = $received_array[$key][1]; |
|||
}else{ |
|||
$unreceived_budget = $receivable_budget; |
|||
} |
|||
} |
|||
if (isset($value[0]) && ($value[0] != 0)) { |
|||
$receivable_array[$key] = [$key, $value[0], $value[1], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], $value[9], |
|||
$value[10], $receivable_budget, $facitities, $value[13], $value[14], $value[15], $value[16], $value[17], $received_invoice, $received_budget, |
|||
$uninvoice_budget, $unreceived_budget]; |
|||
} |
|||
} |
|||
$data = json_encode($receivable_array); |
|||
|
|||
// echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;官檢款;交車款;目前應收;總作番數;貨抵;安裝試車;官檢;移交數;狀態</br>"; |
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout: fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap: break-word; |
|||
} |
|||
|
|||
img { |
|||
width: 125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width: 125px; |
|||
} |
|||
|
|||
table { |
|||
width: 100%; |
|||
} |
|||
|
|||
#table_index_filter { |
|||
float: right; |
|||
} |
|||
|
|||
#table_index_paginate { |
|||
float: right; |
|||
} |
|||
|
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
</style> |
|||
<div style="width:98%;margin:1%"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th style="width: 120px;">合約號</th> |
|||
<th style="width: 120px;">部門</th> |
|||
<th style="width: 80px;">經理</th> |
|||
<th style="width: 80px;">營業員</th> |
|||
<th>客戶名稱</th> |
|||
<!-- <th style="width: 100px;">簽約款</th> |
|||
<th style="width: 100px;">二次款</th> |
|||
<th style="width: 100px;">貨抵工地款</th> |
|||
<th style="width: 100px;">安裝款</th> |
|||
<th style="width: 100px;">試車款</th> |
|||
<th style="width: 100px;">官檢款</th> |
|||
<th style="width: 100px;">交車款</th> --> |
|||
<th style="width: 100px;">目前應收</th> |
|||
<th style="width: 150px;">未開發票金額</th> |
|||
<th style="width: 100px;">未收金額</th> |
|||
<th>狀態</th> |
|||
<th style="width: 100px;">操作</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach ($receivable_array as $contract) { |
|||
?> |
|||
<tr> |
|||
<th><?= $contract[0] ?></th> |
|||
<td><?= $contract[1] ?></td> |
|||
<td><?= $contract[2] ?></td> |
|||
<td><?= $contract[3] ?></td> |
|||
<td><?= $contract[4] ?></td> |
|||
<!-- <td><?= round($contract[5]) ?></td>
|
|||
<td><?= round($contract[6]) ?></td> |
|||
<td><?= round($contract[7]) ?></td> |
|||
<td><?= round($contract[8]) ?></td> |
|||
<td><?= round($contract[9]) ?></td> |
|||
<td><?= round($contract[10]) ?></td> |
|||
<td><?= round($contract[11]) ?></td> --> |
|||
<td style="text-align: end;"><?= number_format(round($contract[12])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($contract[21])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($contract[22])) ?></td> |
|||
<td style="text-align: start;"><?= $contract[13] ?></td> |
|||
<td><button type="button" onclick="sendData('<?= $contract[0] ?>')" class="btn btn-primary btn-sm"><span class=" glyphicon glyphicon-search"></span></button> |
|||
</td> |
|||
</tr> |
|||
<?php |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<script> |
|||
function sendData(BillNo) { |
|||
console.log(BillNo); |
|||
var BillData = <?= $data ?>; |
|||
var Bill = BillData[BillNo]; |
|||
console.log(Bill); |
|||
console.log(typeof(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(); |
|||
|
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$follower = find_follow($user_id); |
|||
$arrayData = []; |
|||
$receivable_array = []; |
|||
$sql_received = "SELECT * FROM arWriteOffBillDetail WHERE (DATALENGTH(OrderBillNo) >0)"; |
|||
|
|||
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, |
|||
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a |
|||
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|||
LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId |
|||
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; |
|||
if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { |
|||
$sql_contract .= "AND (s.PersonId = '$user_id'"; |
|||
$sql_received .= " AND (PersonId = '$user_id'"; |
|||
if (count($follower) > 0) { |
|||
$column_str = "('$user_id'" . ",'"; |
|||
$column_str .= implode("','", $follower); |
|||
$column_str .= "')"; |
|||
$sql_contract .= " OR s.PersonId IN $column_str)"; |
|||
$sql_received .= " OR PersonId IN $column_str)"; |
|||
} else { |
|||
$sql_contract .= ")"; |
|||
$sql_received .= ")"; |
|||
}; |
|||
} |
|||
$sign60 = array('簽訂後60天', '簽約60日', '簽約後60天', '簽訂後60日內', '訂金支付後60天'); |
|||
$sign90 = array('簽約後90天', '簽約後90日', '簽訂後90天'); |
|||
$sign120 = array('簽約後120天', '簽約後120日', '簽訂後120天'); |
|||
$contract = $conn->query($sql_contract); |
|||
$received_array = $conn->query($sql_received); |
|||
|
|||
// 取收款資料 account_received |
|||
// $received_data = mysqli_query($link, $sql_received); |
|||
// foreach ($received_data as $received) { |
|||
// if ($received['BillNo'] == 'SO20230801001') { |
|||
// $BillNo = 'M230947'; |
|||
// } elseif ($received['BillNo'] == 'SO20230801002') { |
|||
// $BillNo = 'M231067'; |
|||
// } else { |
|||
// $BillNo = $received['BillNo']; |
|||
// }; |
|||
// if (isset($received_array[$BillNo])) { |
|||
// $received_array[$BillNo][0] += $received['invoice_amount']; |
|||
// $received_array[$BillNo][1] += $received['received_amount']; |
|||
// $received['status'] = (intval($received['status']) < 4) ? intval($received['status']) : 0; |
|||
// if ($received_array[$BillNo][2] < intval($received['status'])) { |
|||
// $received_array[$BillNo][2] = intval($received['status']); |
|||
// } |
|||
// } else { |
|||
// $received_array[$BillNo][0] = $received['invoice_amount']; |
|||
// $received_array[$BillNo][1] = $received['received_amount']; |
|||
// $received_array[$BillNo][2] = (intval($received['status']) < 4) ? intval($received['status']) : 0; |
|||
// } |
|||
// } |
|||
|
|||
// 將T8合約收款階段資料依據款別分類放進arraData裡 |
|||
foreach ($contract as $cont) { |
|||
if ($cont['BillNo'] == 'SO20230801001') { |
|||
$BillNo = 'M230947'; |
|||
} elseif ($cont['BillNo'] == 'SO20230801002') { |
|||
$BillNo = 'M231067'; |
|||
} else { |
|||
$BillNo = $cont['BillNo']; |
|||
}; |
|||
$PayStage = $cont['PayStage']; |
|||
$PlanPayDate = $cont['PlanPayDate']; |
|||
$PayAmount = $cont['PlanPayAmt']; |
|||
$partnerName = $cont['BizPartnerName']; |
|||
$EnterpriseName = $cont['EnterpriseName']; |
|||
$TaxNo = $cont['TaxNo']; |
|||
$ContactAddress = $cont['ContactAddress']; |
|||
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 |
|||
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 |
|||
if (!(isset($arrayData[$BillNo]))) { |
|||
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 |
|||
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|||
$arrayData[$BillNo][5] = $partnerName; |
|||
$arrayData[$BillNo][6] = $EnterpriseName; |
|||
$arrayData[$BillNo][7] = $TaxNo; |
|||
$arrayData[$BillNo][8] = $ContactAddress; |
|||
$arrayData[$BillNo]['received']= array(); |
|||
$arrayData[$BillNo]['sign'][1] = $arrayData[$BillNo]['second'][1] = $arrayData[$BillNo]['arrive'][1] = $arrayData[$BillNo]['install'][1] = $arrayData[$BillNo]['tryrun'][1] = $arrayData[$BillNo]['check'][1] = $arrayData[$BillNo]['delivery'][1] = $arrayData[$BillNo]['final'][1] = 0; |
|||
$arrayData[$BillNo]['facilities'] = ""; |
|||
$arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; |
|||
} |
|||
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { |
|||
$arrayData[$BillNo]['second'][0] = $PayStage; |
|||
$arrayData[$BillNo]['second'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['second'][2] = $PlanPayDate; |
|||
if (isset($arrayData[$BillNo]['sign'][2]) && !is_null($arrayData[$BillNo]['sign'][2])) { |
|||
$signtime = strtotime(strval($arrayData[$BillNo]['sign'][2])); |
|||
if (in_array($PayStage, $sign60)) { |
|||
$secondtime = $signtime + (60 * 86400); |
|||
$secondtime = date('Ymd', $secondtime); |
|||
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|||
} elseif (in_array($PayStage, $sign90)) { |
|||
$secondtime = $signtime + (90 * 86400); |
|||
$secondtime = date('Ymd', $secondtime); |
|||
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|||
} elseif (in_array($PayStage, $sign120)) { |
|||
$secondtime = $signtime + (120 * 86400); |
|||
$secondtime = date('Ymd', $secondtime); |
|||
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|||
} elseif (stristr($PayStage, '簽訂後30天')) { |
|||
$secondtime = $signtime + (30 * 86400); |
|||
$secondtime = date('Ymd', $secondtime); |
|||
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|||
} |
|||
} |
|||
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工')) { |
|||
$arrayData[$BillNo]['sign'][0] = $PayStage; |
|||
$arrayData[$BillNo]['sign'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['sign'][2] = $PlanPayDate; |
|||
} elseif (stristr($PayStage, '試車')) { |
|||
$arrayData[$BillNo]['tryrun'][0] = $PayStage; |
|||
$arrayData[$BillNo]['tryrun'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['tryrun'][2] = $PlanPayDate; |
|||
} elseif (stristr($PayStage, '安裝') || stristr($PayStage, '貨抵工地且完工')) { |
|||
$arrayData[$BillNo]['install'][0] = $PayStage; |
|||
$arrayData[$BillNo]['install'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['install'][2] = $PlanPayDate; |
|||
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { |
|||
$arrayData[$BillNo]['arrive'][0] = $PayStage; |
|||
$arrayData[$BillNo]['arrive'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['arrive'][2] = $PlanPayDate; |
|||
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { |
|||
$arrayData[$BillNo]['delivery'][0] = $PayStage; |
|||
$arrayData[$BillNo]['delivery'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['delivery'][2] = $PlanPayDate; |
|||
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { |
|||
$arrayData[$BillNo]['check'][0] = $PayStage; |
|||
$arrayData[$BillNo]['check'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['check'][2] = $PlanPayDate; |
|||
} elseif (stristr($PayStage, '驗收完成')) { |
|||
$arrayData[$BillNo]['final'][0] = $PayStage; |
|||
$arrayData[$BillNo]['final'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['final'][2] = $PlanPayDate; |
|||
} else { |
|||
$arrayData[$BillNo]['other'][1] = $PayAmount; |
|||
$arrayData[$BillNo]['other'][2] = $PlanPayDate; |
|||
} |
|||
} |
|||
$sql = "SELECT |
|||
tmp2.*, |
|||
d.name AS depart_name |
|||
FROM( |
|||
SELECT |
|||
a.manager, |
|||
a2.name as manager_name, |
|||
a.name, |
|||
a.department_id, |
|||
w.salesid, |
|||
w.contractno, |
|||
w.facilityno, |
|||
w.estimated_shipping_date, |
|||
w.actual_tofactory_date, |
|||
w.real_arrival_date, |
|||
w.install_end_date, |
|||
w.tryrun_end_date, |
|||
w.official_check_date, |
|||
w.delivery_date |
|||
from wipwholestatus AS w |
|||
left join account AS a |
|||
ON w.salesid = a.accountid |
|||
left join account AS a2 |
|||
ON a2.accountid = a.manager |
|||
where w.status = '1' AND w.contract_type='A' |
|||
)AS tmp2 |
|||
left join ( |
|||
SELECT DISTINCT |
|||
department_id, |
|||
name |
|||
FROM department |
|||
|
|||
) AS d |
|||
ON d.department_id = tmp2.department_id"; |
|||
$wipwhole_array = mysqli_query($link, $sql); |
|||
foreach ($wipwhole_array as $wip) { |
|||
if (isset($arrayData[$wip['contractno']])) { |
|||
$arrayData[$wip['contractno']][0] = $wip['department_id'];; |
|||
$arrayData[$wip['contractno']][1] = $wip['depart_name']; |
|||
$arrayData[$wip['contractno']][2] = $wip['manager_name']; |
|||
$arrayData[$wip['contractno']][3] = $wip['salesid']; |
|||
$arrayData[$wip['contractno']][4] = $wip['name']; |
|||
$arrayData[$wip['contractno']][10] = $wip['contractno']; |
|||
if (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前30天')) { |
|||
$estimate_delivery_time = strtotime($wip['estimated_shipping_date']); |
|||
$secondtime = $estimate_delivery_time - (30 * 86400); |
|||
$secondtime = date('Ymd', $secondtime); |
|||
$arrayData[$wip['contractno']]['second'][2] = intval($secondtime); |
|||
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前90天')) { |
|||
$estimate_delivery_time = strtotime($wip['estimated_shipping_date']); |
|||
$secondtime = $estimate_delivery_time - (90 * 86400); |
|||
$secondtime = date('Ymd', $secondtime); |
|||
$arrayData[$wip['contractno']]['second'][2] = intval($secondtime); |
|||
} |
|||
if ($wip['delivery_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|||
$arrayData[$wip['contractno']]['check_num'] += 1; |
|||
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|||
$arrayData[$wip['contractno']]['install_num'] += 1; |
|||
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} elseif ($wip['official_check_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['check_num'] += 1; |
|||
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|||
$arrayData[$wip['contractno']]['install_num'] += 1; |
|||
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} elseif ($wip['tryrun_end_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|||
$arrayData[$wip['contractno']]['install_num'] += 1; |
|||
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} elseif ($wip['install_end_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['install_num'] += 1; |
|||
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} elseif ($wip['real_arrival_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { |
|||
if ($wip['estimated_shipping_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出貨日) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} elseif ($wip['actual_tofactory_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} else { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
$arrayData[$wip['contractno']]['second_num'] += 1; |
|||
} |
|||
} elseif ($wip['estimated_shipping_date'] != NULL) { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
} else { |
|||
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計到港日待確認) <br>"; |
|||
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
foreach ($arrayData as &$value) { |
|||
if ($value['total_facility_num'] > 0) { |
|||
$value['receivable_budget'] = $value['sign'][1] + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + |
|||
($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) + |
|||
($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) + |
|||
(($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num'])); |
|||
} |
|||
} |
|||
// array_push($arrayData[$wip['contractno']]['received'], ['assaaa',123124,'sdrfrqa']); |
|||
|
|||
foreach($received_array as $received){ |
|||
|
|||
if(isset($arrayData[$received['OrderBillNo']])){ |
|||
array_push($arrayData[$received['OrderBillNo']]['received'], [$received['BillNo'],$received['WriteOffBizPartnerId'],$received['OrderBillNo'],]); |
|||
|
|||
} |
|||
} |
|||
|
|||
$data = json_encode($arrayData); |
|||
|
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout: fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap: break-word; |
|||
} |
|||
|
|||
img { |
|||
width: 125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width: 125px; |
|||
} |
|||
|
|||
table { |
|||
width: 100%; |
|||
} |
|||
|
|||
#table_index_filter { |
|||
float: right; |
|||
} |
|||
|
|||
#table_index_paginate { |
|||
float: right; |
|||
} |
|||
|
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
</style> |
|||
<button type="button" onclick="downloadData()" class="btn btn-warning btn-lg pull-right"><span class="glyphicon glyphicon-download-alt"></span></button> |
|||
|
|||
<div style="width:98%;margin:1%"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th style="width: 120px;">合約號</th> |
|||
<th style="width: 120px;">部門</th> |
|||
<th style="width: 80px;">經理</th> |
|||
<th style="width: 80px;">營業員</th> |
|||
<th>客戶名稱</th> |
|||
<!-- <th style="width: 100px;">簽約款</th> |
|||
<th style="width: 100px;">二次款</th> |
|||
<th style="width: 100px;">貨抵工地款</th> |
|||
<th style="width: 100px;">安裝款</th> |
|||
<th style="width: 100px;">試車款</th> |
|||
<th style="width: 100px;">官檢款</th> |
|||
<th style="width: 100px;">交車款</th> |
|||
<th style="width: 100px;">尾款</th> --> |
|||
<th style="width: 100px;">目前應收</th> |
|||
<!-- <th style="width: 150px;">未開發票金額</th> |
|||
<th style="width: 100px;">未收金額</th> --> |
|||
<th>作番狀態</th> |
|||
<!-- <th style="width: 100px;">收款狀態</th> --> |
|||
<th style="width: 100px;">操作</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach ($arrayData as $key =>$value) { |
|||
?> |
|||
<tr> |
|||
<th><?= $key ?></th> |
|||
<td><?= $value[1] ?></td> |
|||
<td><?= $value[2] ?></td> |
|||
<td><?= $value[4] ?></td> |
|||
<td><?= $value[5] ?></td> |
|||
<!-- <td style="text-align: end;"><?= number_format(round($value['sign'][1])) ?></td>
|
|||
<td style="text-align: end;"><?= number_format(round($value['second'][1])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($value['arrive'][1])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($value['install'][1])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($value['tryrun'][1])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($value['check'][1])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($value['delivery'][1])) ?></td> |
|||
<td style="text-align: end;"><?= number_format(round($value['final'][1])) ?></td> --> |
|||
<td style="text-align: end;"><?= number_format(round($value['receivable_budget'])) ?></td> |
|||
<!-- <td style="text-align: end;"><?= number_format(round($value['total_facility_num'])) ?></td> --> |
|||
<td style="text-align: start;"><?= $value['facilities'] ?></td> |
|||
<td><button type="button" onclick="sendData('<?= $key ?>')" class="btn btn-primary btn-sm"><span class=" glyphicon glyphicon-search"></span></button> |
|||
</td> |
|||
</tr> |
|||
<?php |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<script> |
|||
function downloadData() { |
|||
var BillData = <?= $data ?>; |
|||
var form = document.createElement("form"); |
|||
form.method = 'POST'; |
|||
form.action = "account-receivable-excel.php?<?= $token_link ?>"; |
|||
var input = document.createElement("input"); |
|||
input.type = "hidden"; |
|||
input.name = "Bill"; |
|||
input.value = JSON.stringify(BillData); |
|||
form.appendChild(input); |
|||
document.body.appendChild(form); |
|||
form.submit(); |
|||
|
|||
} |
|||
function sendData(BillNo) { |
|||
var BillData = <?= $data ?>; |
|||
var Bill = BillData[BillNo]; |
|||
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> |
@ -1,121 +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] ?>"> |
|||
</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); |
|||
|
|||
$("#pay_received").submit(); |
|||
} |
|||
<?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> |
@ -1,121 +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> |
|||
|
|||
|
|||
<input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>"> |
|||
</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(); |
|||
$("#pay_received").submit(); |
|||
} |
|||
<?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> |
@ -1,84 +1,96 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$type = $_GET['type']; |
|||
$InvoiceNo = empty($_POST['InvoiceNo']) ? NULL : str_replace('-', '', trim($_POST['InvoiceNo'])); |
|||
$InvoiceDate = empty($_POST['InvoiceDate']) ? NULL: $_POST['InvoiceDate']; |
|||
|
|||
$invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount']; |
|||
$received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount']; |
|||
$received_date = empty($_POST['ReceivedDate']) ? NULL : $_POST['ReceivedDate']; |
|||
$remark = empty($_POST['remark']) ? '' : $_POST['remark']; |
|||
|
|||
if ($type == 'edit') { |
|||
$pay_id = $_POST['pay_id']; |
|||
$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',"; |
|||
} |
|||
$sql1=substr($sql1,0,-1); |
|||
$sql = $sql1 . " WHERE pay_id = $pay_id"; |
|||
echo $sql; |
|||
exit(); |
|||
} 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 (!empty($InvoiceNo)) { |
|||
$sql1 .= ",invoice_no"; |
|||
$sql2 .= ",'$InvoiceNo'"; |
|||
} |
|||
if (isset($InvoiceDate)) { |
|||
$sql1 .= ",invoice_date"; |
|||
$sql2 .= ",'$InvoiceDate'"; |
|||
} |
|||
if (!empty($invoice_amount)) { |
|||
$sql1 .= ",invoice_amount"; |
|||
$sql2 .= ",$invoice_amount"; |
|||
} |
|||
if (!empty($received_amount)) { |
|||
$sql1 .= ",received_amount"; |
|||
$sql2 .= ",$received_amount"; |
|||
} |
|||
if (isset($received_date)) { |
|||
$sql1 .= ",received_date"; |
|||
$sql2 .= ",'$received_date'"; |
|||
} |
|||
if (!empty($remark)) { |
|||
$sql1 .= ",remark"; |
|||
$sql2 .= ",'$remark'"; |
|||
} |
|||
$sql = $sql1 . $sql2 . ",'$user_id')"; |
|||
} |
|||
mysqli_query($link, $sql); |
|||
if (mysqli_affected_rows($link)) { |
|||
echo '<script>alert("新增/更新 成功")</script>'; |
|||
echo $sql; |
|||
} else { |
|||
echo '<script>alert("新增/更新 失敗")</script>'; |
|||
} |
|||
<?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.
@ -1,75 +1,75 @@ |
|||
<?php |
|||
$id= ""; |
|||
$accounttype= ""; |
|||
$accountid= ""; |
|||
$pwd= ""; |
|||
$name= ""; |
|||
$tel= ""; |
|||
$address= ""; |
|||
$email= ""; |
|||
$lineid= ""; |
|||
$wechatid= ""; |
|||
$phone_call_help= ""; |
|||
$chat_for_help= ""; |
|||
$remote_help= ""; |
|||
$repairerid= ""; |
|||
$manager= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
|
|||
|
|||
$id_error = ""; |
|||
$accounttype_error= ""; |
|||
$accountid_error= ""; |
|||
$pwd_error= ""; |
|||
$name_error= ""; |
|||
$tel_error= ""; |
|||
$address_error= ""; |
|||
$email_error= ""; |
|||
$lineid_error= ""; |
|||
$wechatid_error= ""; |
|||
$phone_call_help_error= ""; |
|||
$chat_for_help_error= ""; |
|||
$remote_help_error= ""; |
|||
$repairerid_error= ""; |
|||
$manager_error= ""; |
|||
$creater_error= ""; |
|||
$create_at_error= ""; |
|||
|
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
include "account-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO account(accounttype, accountid, pwd, name, tel, address, email, lineid, wechatid, phone_call_help, chat_for_help, remote_help, repairerid, manager, department_id, role_id, creater, create_at) VALUES "; |
|||
$db_query .= "('$accounttype', '$accountid','$pwd', '$name', '$tel', '$address', '$email', '$lineid', '$wechatid', '$phone_call_help', '$chat_for_help', '$remote_help', '$repairerid', '$manager', '$department_id', '$role_id', '$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
|
|||
// 新增權限 |
|||
if (($accounttype == "B" || $accounttype == "E" || $accounttype == "M") && $department_id && $role_id) { |
|||
$db_query = "insert into account_auth (accountid, permission) "; |
|||
$db_query .= "select '$accountid', permission from department where department_id = '$department_id' and role_id = '$role_id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
} |
|||
|
|||
// mysqli_insert_id可以抓到第一筆的id |
|||
//$new_id= mysqli_insert_id ($link); |
|||
#echo "新增後的id為 {$id} "; |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
// 如果有一筆以上代表有更新 |
|||
echo "<script>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
$id= ""; |
|||
$accounttype= ""; |
|||
$accountid= ""; |
|||
$pwd= ""; |
|||
$name= ""; |
|||
$tel= ""; |
|||
$address= ""; |
|||
$email= ""; |
|||
$lineid= ""; |
|||
$wechatid= ""; |
|||
$phone_call_help= ""; |
|||
$chat_for_help= ""; |
|||
$remote_help= ""; |
|||
$repairerid= ""; |
|||
$manager= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
|
|||
|
|||
$id_error = ""; |
|||
$accounttype_error= ""; |
|||
$accountid_error= ""; |
|||
$pwd_error= ""; |
|||
$name_error= ""; |
|||
$tel_error= ""; |
|||
$address_error= ""; |
|||
$email_error= ""; |
|||
$lineid_error= ""; |
|||
$wechatid_error= ""; |
|||
$phone_call_help_error= ""; |
|||
$chat_for_help_error= ""; |
|||
$remote_help_error= ""; |
|||
$repairerid_error= ""; |
|||
$manager_error= ""; |
|||
$creater_error= ""; |
|||
$create_at_error= ""; |
|||
|
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
include "account-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO account(accounttype, accountid, pwd, name, tel, address, email, lineid, wechatid, phone_call_help, chat_for_help, remote_help, repairerid, manager, department_id, role_id, creater, create_at) VALUES "; |
|||
$db_query .= "('$accounttype', '$accountid','$pwd', '$name', '$tel', '$address', '$email', '$lineid', '$wechatid', '$phone_call_help', '$chat_for_help', '$remote_help', '$repairerid', '$manager', '$department_id', '$role_id', '$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
|
|||
// 新增權限 |
|||
if (($accounttype == "B" || $accounttype == "E" || $accounttype == "M") && $department_id && $role_id) { |
|||
$db_query = "insert into account_auth (accountid, permission) "; |
|||
$db_query .= "select '$accountid', permission from department where department_id = '$department_id' and role_id = '$role_id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
} |
|||
|
|||
// mysqli_insert_id可以抓到第一筆的id |
|||
//$new_id= mysqli_insert_id ($link); |
|||
#echo "新增後的id為 {$id} "; |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
// 如果有一筆以上代表有更新 |
|||
echo "<script>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,66 +1,66 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$accounttype = user_input($_POST["accounttype"]); |
|||
$accountid = user_input($_POST["accountid"]); |
|||
$pwd = user_input($_POST["pwd"]); |
|||
$name = user_input($_POST["name"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$email = user_input($_POST["email"]); |
|||
$lineid = user_input($_POST["lineid"]); |
|||
$wechatid = user_input($_POST["wechatid"]); |
|||
$phone_call_help = user_input($_POST["phone_call_help"]); |
|||
$chat_for_help = user_input($_POST["chat_for_help"]); |
|||
$remote_help = user_input($_POST["remote_help"]); |
|||
$repairerid = user_input($_POST["repairerid"]); |
|||
$manager = user_input($_POST["manager"]); |
|||
$department_id = user_input($_POST["department_id"]); |
|||
$role_id = user_input($_POST["role_id"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
$db_query = "UPDATE account set pwd = '$pwd', name = '$name', tel = '$tel', address = '$address', "; |
|||
$db_query .= "email = '$email', lineid = '$lineid', wechatid = '$wechatid', phone_call_help = '$phone_call_help', chat_for_help = '$chat_for_help', "; |
|||
$db_query .= "remote_help = '$remote_help', repairerid = '$repairerid', manager = '$manager', "; |
|||
$db_query .= "department_id = '$department_id', role_id = '$role_id', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
|
|||
if (($accounttype == "B" || $accounttype == "E" || $accounttype == "M") && $department_id && $role_id) { |
|||
$sql = "select permission from department where department_id = '$department_id' and role_id = '$role_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
if ($row = mysqli_fetch_row($res)) { |
|||
$db_query = "update account_auth set permission = '$row[0]' where accountid = '$accountid'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
mysqli_free_result($res); |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$accounttype = user_input($_POST["accounttype"]); |
|||
$accountid = user_input($_POST["accountid"]); |
|||
$pwd = user_input($_POST["pwd"]); |
|||
$name = user_input($_POST["name"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$email = user_input($_POST["email"]); |
|||
$lineid = user_input($_POST["lineid"]); |
|||
$wechatid = user_input($_POST["wechatid"]); |
|||
$phone_call_help = user_input($_POST["phone_call_help"]); |
|||
$chat_for_help = user_input($_POST["chat_for_help"]); |
|||
$remote_help = user_input($_POST["remote_help"]); |
|||
$repairerid = user_input($_POST["repairerid"]); |
|||
$manager = user_input($_POST["manager"]); |
|||
$department_id = user_input($_POST["department_id"]); |
|||
$role_id = user_input($_POST["role_id"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
$db_query = "UPDATE account set pwd = '$pwd', name = '$name', tel = '$tel', address = '$address', "; |
|||
$db_query .= "email = '$email', lineid = '$lineid', wechatid = '$wechatid', phone_call_help = '$phone_call_help', chat_for_help = '$chat_for_help', "; |
|||
$db_query .= "remote_help = '$remote_help', repairerid = '$repairerid', manager = '$manager', "; |
|||
$db_query .= "department_id = '$department_id', role_id = '$role_id', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
|
|||
if (($accounttype == "B" || $accounttype == "E" || $accounttype == "M") && $department_id && $role_id) { |
|||
$sql = "select permission from department where department_id = '$department_id' and role_id = '$role_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
if ($row = mysqli_fetch_row($res)) { |
|||
$db_query = "update account_auth set permission = '$row[0]' where accountid = '$accountid'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
mysqli_free_result($res); |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='account-index.php?function_name=account&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,65 +1,65 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$accounttype = user_input($_POST["accounttype"]); |
|||
$accountid = user_input($_POST["accountid"]); |
|||
#$accountid = $accounttype . $accountid; |
|||
$pwd = user_input($_POST["pwd"]); |
|||
$name = user_input($_POST["name"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$email = user_input($_POST["email"]); |
|||
$lineid = user_input($_POST["lineid"]); |
|||
$wechatid = user_input($_POST["wechatid"]); |
|||
$phone_call_help = user_input($_POST["phone_call_help"]); |
|||
$chat_for_help = user_input($_POST["chat_for_help"]); |
|||
$remote_help = user_input($_POST["remote_help"]); |
|||
$repairerid = user_input($_POST["repairerid"]); |
|||
$manager = user_input($_POST["manager"]); |
|||
$department_id = user_input($_POST["department_id"]); |
|||
$role_id = user_input($_POST["role_id"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$accounttype = user_input($_POST["accounttype"]); |
|||
$accountid = user_input($_POST["accountid"]); |
|||
#$accountid = $accounttype . $accountid; |
|||
$pwd = user_input($_POST["pwd"]); |
|||
$name = user_input($_POST["name"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$email = user_input($_POST["email"]); |
|||
$lineid = user_input($_POST["lineid"]); |
|||
$wechatid = user_input($_POST["wechatid"]); |
|||
$phone_call_help = user_input($_POST["phone_call_help"]); |
|||
$chat_for_help = user_input($_POST["chat_for_help"]); |
|||
$remote_help = user_input($_POST["remote_help"]); |
|||
$repairerid = user_input($_POST["repairerid"]); |
|||
$manager = user_input($_POST["manager"]); |
|||
$department_id = user_input($_POST["department_id"]); |
|||
$role_id = user_input($_POST["role_id"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
@ -1,177 +1,177 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 部門職別 |
|||
$db_query = "select department_id, name, role_id, role from department order by department_id"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$depart_arr[$row["department_id"]] = $row["name"]; |
|||
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
// 選單結構 |
|||
$data = array(); |
|||
$db_query = "select * from menu order by main_menu_seq, sub_menu_seq"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$data[$row["main_menu_seq"]]["main_menu"] = $row["main_menu"]; |
|||
$data[$row["main_menu_seq"]][$row["sub_menu_seq"]]["sub_menu"] = $row["sub_menu"]; |
|||
$data[$row["main_menu_seq"]][$row["sub_menu_seq"]]["link_content"] = $row["link_content"]; |
|||
$data[$row["main_menu_seq"]][$row["sub_menu_seq"]]["status"] = $row["status"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
//print_r($data);exit; |
|||
?> |
|||
<style> |
|||
table { |
|||
margin-top:10px; |
|||
} |
|||
.table-off, .table-off > td, .table-off > th { |
|||
background-color: #d6d8db; |
|||
} |
|||
.label-checkbox { cursor: pointer; } |
|||
</style> |
|||
<script> |
|||
$(function () { |
|||
var jroleStr = '<?php echo json_encode($role_arr); ?>'; |
|||
var jroleArr = JSON.parse(jroleStr); |
|||
var optStr = ""; |
|||
$("select[name=department_id]").change(function(){ |
|||
if ($(this).val() != "") { |
|||
optStr = ""; |
|||
for (var i in jroleArr[$(this).val()]) { |
|||
if ('undefined' !== jroleArr[$(this).val()][i]) { |
|||
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>'; |
|||
} |
|||
} |
|||
$("select[name=role_id]").html(optStr); |
|||
} else $("select[name=role_id]").html('<option value="">請選擇</option>'); |
|||
}) |
|||
|
|||
$('#submit').click(function(){ |
|||
var optRStr = ""; |
|||
var optRArr = []; |
|||
$("input[name=opt_r]").each(function(){ |
|||
optRStr = ""; |
|||
optRStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optRStr += ";"+$(this).val(); |
|||
else optRStr += ";X"; |
|||
optRArr.push(optRStr); |
|||
}) |
|||
$('#opt_r_all').val(optRArr); |
|||
var optWStr = ""; |
|||
var optWArr = []; |
|||
$("input[name=opt_w]").each(function(){ |
|||
optWStr = ""; |
|||
optWStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optWStr += ";"+$(this).val(); |
|||
else optWStr += ";X"; |
|||
optWArr.push(optWStr); |
|||
}) |
|||
$('#opt_w_all').val(optWArr); |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "account_auth-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> |
|||
<div> |
|||
<label for="department_id">部門</label> |
|||
<select name="department_id" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($depart_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="role_id">職別</label> |
|||
<select name="role_id" required> |
|||
<?php |
|||
foreach ($role_arr[$data2["department_id"]] as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
|
|||
<table class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th scope="col">主功能名稱</th> |
|||
<th scope="col">子功能名稱</th> |
|||
<th scope="col">控管</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach($data as $key => $val) { |
|||
foreach($val as $k2 => $v2) { |
|||
if ($k2 == "main_menu") continue; |
|||
$td_str = ($k2 == 1) ? '<td rowspan="'.(count($val)-1).'">'.$val["main_menu"].'</td>' : ''; |
|||
$sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; |
|||
?> |
|||
<tr<?php echo $sta_str; ?>> |
|||
<?php echo $td_str; ?> |
|||
<td><?php echo $v2["sub_menu"]; ?></td> |
|||
<td> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_r" value="R" data-auth="<?php echo $key.";".$k2; ?>"> |
|||
可讀</label> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_w" value="W" data-auth="<?php echo $key.";".$k2; ?>"> |
|||
可寫</label> |
|||
</td> |
|||
</tr> |
|||
|
|||
<?php |
|||
} |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" id="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="opt_r_all" id="opt_r_all"> |
|||
<input type="hidden" name="opt_w_all" id="opt_w_all"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
include "footer.php"; |
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 部門職別 |
|||
$db_query = "select department_id, name, role_id, role from department order by department_id"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$depart_arr[$row["department_id"]] = $row["name"]; |
|||
$role_arr[$row["department_id"]][$row["role_id"]] = $row["role"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
// 選單結構 |
|||
$data = array(); |
|||
$db_query = "select * from menu order by main_menu_seq, sub_menu_seq"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$data[$row["main_menu_seq"]]["main_menu"] = $row["main_menu"]; |
|||
$data[$row["main_menu_seq"]][$row["sub_menu_seq"]]["sub_menu"] = $row["sub_menu"]; |
|||
$data[$row["main_menu_seq"]][$row["sub_menu_seq"]]["link_content"] = $row["link_content"]; |
|||
$data[$row["main_menu_seq"]][$row["sub_menu_seq"]]["status"] = $row["status"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
//print_r($data);exit; |
|||
?> |
|||
<style> |
|||
table { |
|||
margin-top:10px; |
|||
} |
|||
.table-off, .table-off > td, .table-off > th { |
|||
background-color: #d6d8db; |
|||
} |
|||
.label-checkbox { cursor: pointer; } |
|||
</style> |
|||
<script> |
|||
$(function () { |
|||
var jroleStr = '<?php echo json_encode($role_arr); ?>'; |
|||
var jroleArr = JSON.parse(jroleStr); |
|||
var optStr = ""; |
|||
$("select[name=department_id]").change(function(){ |
|||
if ($(this).val() != "") { |
|||
optStr = ""; |
|||
for (var i in jroleArr[$(this).val()]) { |
|||
if ('undefined' !== jroleArr[$(this).val()][i]) { |
|||
optStr += '<option value="'+i+'">'+jroleArr[$(this).val()][i]+'</option>'; |
|||
} |
|||
} |
|||
$("select[name=role_id]").html(optStr); |
|||
} else $("select[name=role_id]").html('<option value="">請選擇</option>'); |
|||
}) |
|||
|
|||
$('#submit').click(function(){ |
|||
var optRStr = ""; |
|||
var optRArr = []; |
|||
$("input[name=opt_r]").each(function(){ |
|||
optRStr = ""; |
|||
optRStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optRStr += ";"+$(this).val(); |
|||
else optRStr += ";X"; |
|||
optRArr.push(optRStr); |
|||
}) |
|||
$('#opt_r_all').val(optRArr); |
|||
var optWStr = ""; |
|||
var optWArr = []; |
|||
$("input[name=opt_w]").each(function(){ |
|||
optWStr = ""; |
|||
optWStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optWStr += ";"+$(this).val(); |
|||
else optWStr += ";X"; |
|||
optWArr.push(optWStr); |
|||
}) |
|||
$('#opt_w_all').val(optWArr); |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "account_auth-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> |
|||
<div> |
|||
<label for="department_id">部門</label> |
|||
<select name="department_id" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($depart_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="role_id">職別</label> |
|||
<select name="role_id" required> |
|||
<?php |
|||
foreach ($role_arr[$data2["department_id"]] as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
|
|||
<table class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th scope="col">主功能名稱</th> |
|||
<th scope="col">子功能名稱</th> |
|||
<th scope="col">控管</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach($data as $key => $val) { |
|||
foreach($val as $k2 => $v2) { |
|||
if ($k2 == "main_menu") continue; |
|||
$td_str = ($k2 == 1) ? '<td rowspan="'.(count($val)-1).'">'.$val["main_menu"].'</td>' : ''; |
|||
$sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; |
|||
?> |
|||
<tr<?php echo $sta_str; ?>> |
|||
<?php echo $td_str; ?> |
|||
<td><?php echo $v2["sub_menu"]; ?></td> |
|||
<td> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_r" value="R" data-auth="<?php echo $key.";".$k2; ?>"> |
|||
可讀</label> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_w" value="W" data-auth="<?php echo $key.";".$k2; ?>"> |
|||
可寫</label> |
|||
</td> |
|||
</tr> |
|||
|
|||
<?php |
|||
} |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" id="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="opt_r_all" id="opt_r_all"> |
|||
<input type="hidden" name="opt_w_all" id="opt_w_all"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
include "footer.php"; |
|||
?> |
|||
|
@ -1,182 +1,182 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
// 選單結構 |
|||
$menu = array(); |
|||
$db_query = "select * from menu where status = 'Y' order by main_menu_seq, sub_menu_seq"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$menu[$row["main_menu_seq"]]["main_menu"] = $row["main_menu"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["sub_menu"] = $row["sub_menu"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["mlink"] = $row["mlink"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["link_content"] = $row["link_content"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["status"] = $row["status"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["id"] = $row["id"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
$data = array(); |
|||
// sql语法存在变数中 |
|||
$db_query = "select * from department where id = '$id'"; |
|||
// 用mysqli_query方法执行(sql语法)将结果存在变数中 |
|||
$data = mysqli_query($link,$db_query); |
|||
foreach($data as $data) : |
|||
$permission_arr = json_decode(urldecode($data["permission"]), true); |
|||
|
|||
$person = ""; |
|||
$sql = "select accountid, name from account where department_id = '".$data["department_id"]."' and role_id = '".$data["role_id"]."' and accounttype <> 'X'"; |
|||
$result = mysqli_query($link, $sql); |
|||
while ($row_a = mysqli_fetch_row($result)) { |
|||
$person .= $row_a[1]."(".$row_a[0].")、"; |
|||
} |
|||
mysqli_free_result($result); |
|||
?> |
|||
<style> |
|||
table { |
|||
margin-top:10px; |
|||
} |
|||
.table-off, .table-off > td, .table-off > th { |
|||
background-color: #d6d8db; |
|||
} |
|||
.label-checkbox { |
|||
cursor: pointer; |
|||
} |
|||
|
|||
body > div > form > table > thead > tr > th:nth-child(3) > label > span { |
|||
font-size:14px; |
|||
} |
|||
.nextline { |
|||
width: 100%; |
|||
height: 0; |
|||
} |
|||
</style> |
|||
<script> |
|||
$(function () { |
|||
$("input[name=rall]").click(function(){ |
|||
$("input[name=opt_r]").not(this).prop('checked', this.checked); |
|||
}); |
|||
$("input[name=wall]").click(function(){ |
|||
$("input[name=opt_w]").not(this).prop('checked', this.checked); |
|||
}); |
|||
|
|||
$('#update').click(function(){ |
|||
var optRStr = ""; |
|||
var optRArr = []; |
|||
$("input[name=opt_r]").each(function(){ |
|||
optRStr = ""; |
|||
optRStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optRStr += ";"+$(this).val(); |
|||
else optRStr += ";0"; |
|||
optRArr.push(optRStr); |
|||
}) |
|||
$('#opt_r_all').val(optRArr); |
|||
var optWStr = ""; |
|||
var optWArr = []; |
|||
$("input[name=opt_w]").each(function(){ |
|||
optWStr = ""; |
|||
optWStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optWStr += ";"+$(this).val(); |
|||
else optWStr += ";0"; |
|||
optWArr.push(optWStr); |
|||
}) |
|||
$('#opt_w_all').val(optWArr); |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="account_auth-record-update.php"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="department_name">部門</label> |
|||
<input type="text" name="department_name" id="department_name" value="<?php echo $data['name']; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="role_name">職別</label> |
|||
<input type="text" name="role_name" id="role_name" value="<?php echo $data['role']; ?>" readonly> |
|||
</div> |
|||
|
|||
<table class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th scope="col">主功能名稱</th> |
|||
<th scope="col">子功能名稱</th> |
|||
<th scope="col"> |
|||
<label class="label-checkbox"><input type="checkbox" name="rall"> |
|||
全選</label> |
|||
</th> |
|||
<th scope="col"> |
|||
<label class="label-checkbox"><input type="checkbox" name="wall"> |
|||
全選</label> |
|||
</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach($menu as $key => $val) { |
|||
foreach($val as $k2 => $v2) { |
|||
if ($k2 == "main_menu") continue; |
|||
$td_str = ($k2 == 1) ? '<td rowspan="'.(count($val)-1).'">'.$val["main_menu"].'</td>' : ''; |
|||
$sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; |
|||
$chk_r = $chk_w = ""; |
|||
if (!empty($permission_arr[$v2["mlink"]])) { |
|||
if ($permission_arr[$v2["mlink"]]&1) $chk_r = " checked"; |
|||
if ($permission_arr[$v2["mlink"]]&2) $chk_w = " checked"; |
|||
} |
|||
?> |
|||
<tr<?php echo $sta_str; ?>> |
|||
<?php echo $td_str; ?> |
|||
<td> |
|||
<?php echo $v2["sub_menu"]; ?> |
|||
</td> |
|||
<td> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_r" value="1" data-auth="<?php echo $v2["id"]; ?>"<?php echo $chk_r; ?>> |
|||
可讀</label> |
|||
</td> |
|||
<td> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_w" value="2" data-auth="<?php echo $v2["id"]; ?>"<?php echo $chk_w; ?>> |
|||
可寫</label> |
|||
</td> |
|||
</tr> |
|||
|
|||
<?php |
|||
} |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<div> |
|||
<label>所屬人員</label> |
|||
<textarea name="person-info" rows="6" cols="70" class="form-control" readonly><?php echo rtrim($person, "、"); ?></textarea> |
|||
</div> |
|||
<div class="nextline"></div> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update" id="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="opt_r_all" id="opt_r_all"> |
|||
<input type="hidden" name="opt_w_all" id="opt_w_all"> |
|||
<input type="hidden" name="department_id" id="department_id" value="<?php echo $data["department_id"]; ?>"> |
|||
<input type="hidden" name="role_id" id="role_id" value="<?php echo $data["role_id"]; ?>"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
// 選單結構 |
|||
$menu = array(); |
|||
$db_query = "select * from menu where status = 'Y' order by main_menu_seq, sub_menu_seq"; |
|||
$res = mysqli_query($link, $db_query); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$menu[$row["main_menu_seq"]]["main_menu"] = $row["main_menu"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["sub_menu"] = $row["sub_menu"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["mlink"] = $row["mlink"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["link_content"] = $row["link_content"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["status"] = $row["status"]; |
|||
$menu[$row["main_menu_seq"]][$row["sub_menu_seq"]]["id"] = $row["id"]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
$data = array(); |
|||
// sql语法存在变数中 |
|||
$db_query = "select * from department where id = '$id'"; |
|||
// 用mysqli_query方法执行(sql语法)将结果存在变数中 |
|||
$data = mysqli_query($link,$db_query); |
|||
foreach($data as $data) : |
|||
$permission_arr = json_decode(urldecode($data["permission"]), true); |
|||
|
|||
$person = ""; |
|||
$sql = "select accountid, name from account where department_id = '".$data["department_id"]."' and role_id = '".$data["role_id"]."' and accounttype <> 'X'"; |
|||
$result = mysqli_query($link, $sql); |
|||
while ($row_a = mysqli_fetch_row($result)) { |
|||
$person .= $row_a[1]."(".$row_a[0].")、"; |
|||
} |
|||
mysqli_free_result($result); |
|||
?> |
|||
<style> |
|||
table { |
|||
margin-top:10px; |
|||
} |
|||
.table-off, .table-off > td, .table-off > th { |
|||
background-color: #d6d8db; |
|||
} |
|||
.label-checkbox { |
|||
cursor: pointer; |
|||
} |
|||
|
|||
body > div > form > table > thead > tr > th:nth-child(3) > label > span { |
|||
font-size:14px; |
|||
} |
|||
.nextline { |
|||
width: 100%; |
|||
height: 0; |
|||
} |
|||
</style> |
|||
<script> |
|||
$(function () { |
|||
$("input[name=rall]").click(function(){ |
|||
$("input[name=opt_r]").not(this).prop('checked', this.checked); |
|||
}); |
|||
$("input[name=wall]").click(function(){ |
|||
$("input[name=opt_w]").not(this).prop('checked', this.checked); |
|||
}); |
|||
|
|||
$('#update').click(function(){ |
|||
var optRStr = ""; |
|||
var optRArr = []; |
|||
$("input[name=opt_r]").each(function(){ |
|||
optRStr = ""; |
|||
optRStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optRStr += ";"+$(this).val(); |
|||
else optRStr += ";0"; |
|||
optRArr.push(optRStr); |
|||
}) |
|||
$('#opt_r_all').val(optRArr); |
|||
var optWStr = ""; |
|||
var optWArr = []; |
|||
$("input[name=opt_w]").each(function(){ |
|||
optWStr = ""; |
|||
optWStr += $(this).attr('data-auth'); |
|||
if ($(this).prop('checked')) optWStr += ";"+$(this).val(); |
|||
else optWStr += ";0"; |
|||
optWArr.push(optWStr); |
|||
}) |
|||
$('#opt_w_all').val(optWArr); |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="account_auth-record-update.php"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="department_name">部門</label> |
|||
<input type="text" name="department_name" id="department_name" value="<?php echo $data['name']; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="role_name">職別</label> |
|||
<input type="text" name="role_name" id="role_name" value="<?php echo $data['role']; ?>" readonly> |
|||
</div> |
|||
|
|||
<table class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th scope="col">主功能名稱</th> |
|||
<th scope="col">子功能名稱</th> |
|||
<th scope="col"> |
|||
<label class="label-checkbox"><input type="checkbox" name="rall"> |
|||
全選</label> |
|||
</th> |
|||
<th scope="col"> |
|||
<label class="label-checkbox"><input type="checkbox" name="wall"> |
|||
全選</label> |
|||
</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach($menu as $key => $val) { |
|||
foreach($val as $k2 => $v2) { |
|||
if ($k2 == "main_menu") continue; |
|||
$td_str = ($k2 == 1) ? '<td rowspan="'.(count($val)-1).'">'.$val["main_menu"].'</td>' : ''; |
|||
$sta_str = ($v2["status"] == "Y") ? '' : ' class="table-off"'; |
|||
$chk_r = $chk_w = ""; |
|||
if (!empty($permission_arr[$v2["mlink"]])) { |
|||
if ($permission_arr[$v2["mlink"]]&1) $chk_r = " checked"; |
|||
if ($permission_arr[$v2["mlink"]]&2) $chk_w = " checked"; |
|||
} |
|||
?> |
|||
<tr<?php echo $sta_str; ?>> |
|||
<?php echo $td_str; ?> |
|||
<td> |
|||
<?php echo $v2["sub_menu"]; ?> |
|||
</td> |
|||
<td> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_r" value="1" data-auth="<?php echo $v2["id"]; ?>"<?php echo $chk_r; ?>> |
|||
可讀</label> |
|||
</td> |
|||
<td> |
|||
<label class="label-checkbox"> |
|||
<input type="checkbox" name="opt_w" value="2" data-auth="<?php echo $v2["id"]; ?>"<?php echo $chk_w; ?>> |
|||
可寫</label> |
|||
</td> |
|||
</tr> |
|||
|
|||
<?php |
|||
} |
|||
} |
|||
?> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<div> |
|||
<label>所屬人員</label> |
|||
<textarea name="person-info" rows="6" cols="70" class="form-control" readonly><?php echo rtrim($person, "、"); ?></textarea> |
|||
</div> |
|||
<div class="nextline"></div> |
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update" id="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="opt_r_all" id="opt_r_all"> |
|||
<input type="hidden" name="opt_w_all" id="opt_w_all"> |
|||
<input type="hidden" name="department_id" id="department_id" value="<?php echo $data["department_id"]; ?>"> |
|||
<input type="hidden" name="role_id" id="role_id" value="<?php echo $data["role_id"]; ?>"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
|
@ -1,106 +1,105 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql = "select * from department order by department_id, role_id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<!-- |
|||
<p> |
|||
<a href="account_auth-create.php?function_name=account_auth&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
--> |
|||
<?php |
|||
if($data): |
|||
|
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['department_id']; ?></td> |
|||
<td><?php echo $data['name']; ?></td> |
|||
<td><?php echo $data['role_id']; ?></td> |
|||
<td><?php echo $data['role']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<td> |
|||
<p> |
|||
<a href="account_auth-edit.php?id=<?php echo $data['id']; ?>&function_name=account_auth&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
include "footer.php"; |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql = "select * from department order by department_id, role_id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<!-- |
|||
<p> |
|||
<a href="account_auth-create.php?function_name=account_auth&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
--> |
|||
<?php |
|||
if($data): |
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['department_id']; ?></td> |
|||
<td><?php echo $data['name']; ?></td> |
|||
<td><?php echo $data['role_id']; ?></td> |
|||
<td><?php echo $data['role']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<td> |
|||
<p> |
|||
<a href="account_auth-edit.php?id=<?php echo $data['id']; ?>&function_name=account_auth&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
include "footer.php"; |
|||
?> |
@ -1,65 +1,65 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
//print_r($_POST);exit; |
|||
|
|||
// 選單各功能的權限 |
|||
$prog_arr = []; |
|||
$opt_r_arr = explode(",", $opt_r_all); |
|||
$opt_w_arr = explode(",", $opt_w_all); |
|||
foreach ($opt_r_arr as $key => $val) { |
|||
list($menu_id, $auth_r) = explode(";", $val); |
|||
list($menu_id, $auth_w) = explode(";", $opt_w_arr[$key]); |
|||
|
|||
// 找出相關程式 |
|||
$sql = "select link_content from menu where id = '$menu_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
if ($row = mysqli_fetch_assoc($res)) { |
|||
if ($row["link_content"]) { |
|||
$tmp_arr = explode("\r\n", $row["link_content"]); |
|||
foreach ($tmp_arr as $v) { |
|||
$prog_arr[$v] = $auth_r|$auth_w; |
|||
} |
|||
} |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
if (($key%10)==0) usleep(200000); |
|||
} |
|||
|
|||
// 開始更新權限 |
|||
$permission = json_encode($prog_arr, JSON_UNESCAPED_SLASHES); |
|||
$sql = "update department set permission = '$permission', create_at = '$create_at' where id = '$id'"; |
|||
mysqli_query($link, $sql); |
|||
$affected = mysqli_affected_rows($link); |
|||
|
|||
// 更新user權限 |
|||
$sql = "select accountid from account where department_id = '$department_id' and role_id = '$role_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$db_query = "insert into account_auth (accountid, permission) values ('$row[0]', '$permission') "; |
|||
$db_query .= "ON DUPLICATE KEY UPDATE accountid = '$row[0]', permission = '$permission'"; |
|||
$res_u = mysqli_query($link, $db_query); |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='account_auth-index.php?function_name=account_auth&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='account_auth-index.php?function_name=account_auth&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
//print_r($_POST);exit; |
|||
|
|||
// 選單各功能的權限 |
|||
$prog_arr = []; |
|||
$opt_r_arr = explode(",", $opt_r_all); |
|||
$opt_w_arr = explode(",", $opt_w_all); |
|||
foreach ($opt_r_arr as $key => $val) { |
|||
list($menu_id, $auth_r) = explode(";", $val); |
|||
list($menu_id, $auth_w) = explode(";", $opt_w_arr[$key]); |
|||
|
|||
// 找出相關程式 |
|||
$sql = "select link_content from menu where id = '$menu_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
if ($row = mysqli_fetch_assoc($res)) { |
|||
if ($row["link_content"]) { |
|||
$tmp_arr = explode("\r\n", $row["link_content"]); |
|||
foreach ($tmp_arr as $v) { |
|||
$prog_arr[$v] = $auth_r|$auth_w; |
|||
} |
|||
} |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
if (($key%10)==0) usleep(200000); |
|||
} |
|||
|
|||
// 開始更新權限 |
|||
$permission = json_encode($prog_arr, JSON_UNESCAPED_SLASHES); |
|||
$sql = "update department set permission = '$permission', create_at = '$create_at' where id = '$id'"; |
|||
mysqli_query($link, $sql); |
|||
$affected = mysqli_affected_rows($link); |
|||
|
|||
// 更新user權限 |
|||
$sql = "select accountid from account where department_id = '$department_id' and role_id = '$role_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$db_query = "insert into account_auth (accountid, permission) values ('$row[0]', '$permission') "; |
|||
$db_query .= "ON DUPLICATE KEY UPDATE accountid = '$row[0]', permission = '$permission'"; |
|||
$res_u = mysqli_query($link, $db_query); |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='account_auth-index.php?function_name=account_auth&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='account_auth-index.php?function_name=account_auth&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,313 +1,313 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; |
|||
|
|||
$sql = "select max(bargainno) as maxno from bargain"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$bargainno = $row[0] ? $row[0]+1 : date("Ym")."001"; |
|||
|
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
list($department_id) = $row; |
|||
mysqli_free_result($res); |
|||
|
|||
$department_arr = []; |
|||
$sql = "select department_id, name from department"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$department_arr[$row[0]] = $row[1]; |
|||
} |
|||
mysqli_free_result($res); |
|||
?> |
|||
<style> |
|||
|
|||
</style> |
|||
<script> |
|||
function commafy(num) { |
|||
num = num + ""; |
|||
var re = /(-?\d+)(\d{3})/ |
|||
while (re.test(num)) { |
|||
num = num.replace(re, "$1,$2") |
|||
} |
|||
return num; |
|||
} |
|||
|
|||
$(function(){ |
|||
$('#quantity').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#lead_time').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#margin_day').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$("input[name=quote_amt_be]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$("input[name=quote_amt_ar]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$('#btnadd').click(function(){ |
|||
$('#tb1 tr:last').prev().after($("tr[name='supplier_templ']").eq(0).clone().find('input').val('').end()); |
|||
$('#tb1 tr:last').prev().find('td').first().html($("tr[name='supplier_templ']").length); |
|||
}); |
|||
$('#submit').click(function(){ |
|||
var supIdArr = []; |
|||
$("input[name='sup_id']").each(function(){ supIdArr.push($(this).val()); }) |
|||
$('#sup_id_all').val(supIdArr); |
|||
var supplierArr = []; |
|||
$("input[name='supplier']").each(function(){ supplierArr.push($(this).val()); }) |
|||
$('#supplier_all').val(supplierArr); |
|||
var quoteAmtBeArr = []; |
|||
$("input[name='quote_amt_be']").each(function(){ quoteAmtBeArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_be_all').val(quoteAmtBeArr); |
|||
var noteBeArr = []; |
|||
$("input[name='note_be']").each(function(){ noteBeArr.push($(this).val()); }) |
|||
$('#note_be_all').val(noteBeArr); |
|||
var quoteAmtArArr = []; |
|||
$("input[name='quote_amt_ar']").each(function(){ quoteAmtArArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_ar_all').val(quoteAmtArArr); |
|||
var noteArArr = []; |
|||
$("input[name='note_ar']").each(function(){ noteArArr.push($(this).val()); }) |
|||
$('#note_ar_all').val(noteArArr); |
|||
//console.log(itemNameArr); |
|||
//return false; |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<?php |
|||
include "bargain-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="bargainno">申請單號</label> |
|||
<input type="text" name="bargainno" id="bargainno" value="<?php echo $bargainno; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="department">作成單位</label> |
|||
<input type="text" name="department" id="department" value="<?php echo $department_arr[$department_id]; ?>" readonly> |
|||
<input type="hidden" name="department_id" id="department_id" value="<?php echo $department_id; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="proposer">作成者</label> |
|||
<input type="text" name="proposer" id="proposer" value="<?php echo $user_name; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="receiver">收文單位</label> |
|||
<select name="receiver" id="receiver" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($department_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="response_dt">回答期限</label><br> |
|||
<input type="date" name="response_dt" id="response_dt" required> |
|||
</div> |
|||
<div> |
|||
<label for="item">項目名稱</label> |
|||
<input type="text" name="item" id="item" size="60" maxlength="50" required> |
|||
</div> |
|||
<div> |
|||
<label for="annual">年度議價件</label> |
|||
<select name="annual" id="annual"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="urgent">緊急件</label> |
|||
<select name="urgent" id="urgent"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="vendor">指定廠商</label> |
|||
<select name="vendor" id="vendor"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="prospecting">現場勘查</label> |
|||
<select name="prospecting" id="prospecting"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="category">類別</label> |
|||
<select name="category" id="category" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="dealer">原廠或原代理商</label> |
|||
<select name="dealer" id="dealer" required> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="reason">理由</label> |
|||
<input type="text" name="reason" id="reason" size="60" maxlength="50"> |
|||
</div> |
|||
<div> |
|||
<label for="brand">品牌</label> |
|||
<input type="text" name="brand" id="brand" maxlength="25"> |
|||
</div> |
|||
<div> |
|||
<label for="model">型號</label> |
|||
<input type="text" name="model" id="model" maxlength="25"> |
|||
</div> |
|||
<div> |
|||
<label for="quantity">預估數量</label> |
|||
<input type="text" name="quantity" id="quantity" required> |
|||
</div> |
|||
<div> |
|||
<label for="brandkeep">備選品牌</label> |
|||
<input type="text" name="brandkeep" id="brandkeep" size="60" maxlength="25"> |
|||
</div> |
|||
<div> |
|||
<label for="lead_time">交期/施工期(天)</label> |
|||
<input type="text" name="lead_time" id="lead_time"> |
|||
</div> |
|||
<div> |
|||
<label for="margin">質保金</label> |
|||
<select name="margin" id="margin"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="margin_day">質保期限(天)</label> |
|||
<input type="text" name="margin_day" id="margin_day" required> |
|||
</div> |
|||
<div> |
|||
<label for="acceptance">驗收標準</label> |
|||
<input type="text" name="acceptance" id="acceptance" size="104" maxlength="50"> |
|||
</div> |
|||
<div> |
|||
<label for="purchase_history">歷史購買記錄</label> |
|||
<select name="purchase_history" id="purchase_history"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="attatch1">附件1</label> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="attatch2">附件2</label> |
|||
<div> |
|||
<input type="file" name="attatch2" id="attatch2"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="item_description">項目描述</label> |
|||
<input type="text" name="item_description" id="item_description" size="80" maxlength="120"> |
|||
</div> |
|||
<div> |
|||
<label for="repairno">設備維修單號</label> |
|||
<input type="text" name="repairno" id="repairno" maxlength="20"> |
|||
</div> |
|||
<div> |
|||
<label for="category_repair">類別</label> |
|||
<select name="category_repair" id="category_repair" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="content">內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="4" cols="100"></textarea> |
|||
</div> |
|||
<div> |
|||
<label for="quotation">採購報價單</label> |
|||
<input type="text" name="quotation" id="quotation" readonly> |
|||
</div> |
|||
|
|||
<div class="table-responsive" style="width:100%;margin-top:10px;"> |
|||
<table id="tb1" class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th colspan="8"><h4>附件上傳及信息維護</h4></th> |
|||
</tr> |
|||
<tr> |
|||
<th rowspan="2" nowrap>序號</th> |
|||
<th colspan="4">作成單位提供◎維護信息</th> |
|||
<th colspan="3">配合單位提供◎維護信息</th> |
|||
</tr> |
|||
<tr> |
|||
<th nowrap>供應商名稱</th> |
|||
<th nowrap>供應商報價單上傳</th> |
|||
<th nowrap>報價</th> |
|||
<th nowrap>備註</th> |
|||
<th nowrap>議價後報價單上傳</th> |
|||
<th nowrap>議價後報價</th> |
|||
<th nowrap>備註</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr name="supplier_templ"> |
|||
<td>1</td> |
|||
<td><input type="text" name="supplier" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_be[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_be" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_ar[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_ar" class="form-control input-sm" size="10"><input type="hidden" name="sup_id"></td> |
|||
</tr> |
|||
<td colspan="8"><button type="button" id="btnadd" class="btn btn-primary btn-sm" style="float:left;">+供應商</button></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit" id="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="sup_id_all" id="sup_id_all"> |
|||
<input type="hidden" name="supplier_all" id="supplier_all"> |
|||
<input type="hidden" name="quote_amt_be_all" id="quote_amt_be_all"> |
|||
<input type="hidden" name="note_be_all" id="note_be_all"> |
|||
<input type="hidden" name="quote_amt_ar_all" id="quote_amt_ar_all"> |
|||
<input type="hidden" name="note_ar_all" id="note_ar_all"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; |
|||
|
|||
$sql = "select max(bargainno) as maxno from bargain"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$bargainno = $row[0] ? $row[0]+1 : date("Ym")."001"; |
|||
|
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
list($department_id) = $row; |
|||
mysqli_free_result($res); |
|||
|
|||
$department_arr = []; |
|||
$sql = "select department_id, name from department"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$department_arr[$row[0]] = $row[1]; |
|||
} |
|||
mysqli_free_result($res); |
|||
?> |
|||
<style> |
|||
|
|||
</style> |
|||
<script> |
|||
function commafy(num) { |
|||
num = num + ""; |
|||
var re = /(-?\d+)(\d{3})/ |
|||
while (re.test(num)) { |
|||
num = num.replace(re, "$1,$2") |
|||
} |
|||
return num; |
|||
} |
|||
|
|||
$(function(){ |
|||
$('#quantity').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#lead_time').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#margin_day').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$("input[name=quote_amt_be]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$("input[name=quote_amt_ar]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$('#btnadd').click(function(){ |
|||
$('#tb1 tr:last').prev().after($("tr[name='supplier_templ']").eq(0).clone().find('input').val('').end()); |
|||
$('#tb1 tr:last').prev().find('td').first().html($("tr[name='supplier_templ']").length); |
|||
}); |
|||
$('#submit').click(function(){ |
|||
var supIdArr = []; |
|||
$("input[name='sup_id']").each(function(){ supIdArr.push($(this).val()); }) |
|||
$('#sup_id_all').val(supIdArr); |
|||
var supplierArr = []; |
|||
$("input[name='supplier']").each(function(){ supplierArr.push($(this).val()); }) |
|||
$('#supplier_all').val(supplierArr); |
|||
var quoteAmtBeArr = []; |
|||
$("input[name='quote_amt_be']").each(function(){ quoteAmtBeArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_be_all').val(quoteAmtBeArr); |
|||
var noteBeArr = []; |
|||
$("input[name='note_be']").each(function(){ noteBeArr.push($(this).val()); }) |
|||
$('#note_be_all').val(noteBeArr); |
|||
var quoteAmtArArr = []; |
|||
$("input[name='quote_amt_ar']").each(function(){ quoteAmtArArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_ar_all').val(quoteAmtArArr); |
|||
var noteArArr = []; |
|||
$("input[name='note_ar']").each(function(){ noteArArr.push($(this).val()); }) |
|||
$('#note_ar_all').val(noteArArr); |
|||
//console.log(itemNameArr); |
|||
//return false; |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<?php |
|||
include "bargain-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="bargainno">申請單號</label> |
|||
<input type="text" name="bargainno" id="bargainno" value="<?php echo $bargainno; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="department">作成單位</label> |
|||
<input type="text" name="department" id="department" value="<?php echo $department_arr[$department_id]; ?>" readonly> |
|||
<input type="hidden" name="department_id" id="department_id" value="<?php echo $department_id; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="proposer">作成者</label> |
|||
<input type="text" name="proposer" id="proposer" value="<?php echo $user_name; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="receiver">收文單位</label> |
|||
<select name="receiver" id="receiver" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($department_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="response_dt">回答期限</label><br> |
|||
<input type="date" name="response_dt" id="response_dt" required> |
|||
</div> |
|||
<div> |
|||
<label for="item">項目名稱</label> |
|||
<input type="text" name="item" id="item" size="60" maxlength="50" required> |
|||
</div> |
|||
<div> |
|||
<label for="annual">年度議價件</label> |
|||
<select name="annual" id="annual"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="urgent">緊急件</label> |
|||
<select name="urgent" id="urgent"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="vendor">指定廠商</label> |
|||
<select name="vendor" id="vendor"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="prospecting">現場勘查</label> |
|||
<select name="prospecting" id="prospecting"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="category">類別</label> |
|||
<select name="category" id="category" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="dealer">原廠或原代理商</label> |
|||
<select name="dealer" id="dealer" required> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="reason">理由</label> |
|||
<input type="text" name="reason" id="reason" size="60" maxlength="50"> |
|||
</div> |
|||
<div> |
|||
<label for="brand">品牌</label> |
|||
<input type="text" name="brand" id="brand" maxlength="25"> |
|||
</div> |
|||
<div> |
|||
<label for="model">型號</label> |
|||
<input type="text" name="model" id="model" maxlength="25"> |
|||
</div> |
|||
<div> |
|||
<label for="quantity">預估數量</label> |
|||
<input type="text" name="quantity" id="quantity" required> |
|||
</div> |
|||
<div> |
|||
<label for="brandkeep">備選品牌</label> |
|||
<input type="text" name="brandkeep" id="brandkeep" size="60" maxlength="25"> |
|||
</div> |
|||
<div> |
|||
<label for="lead_time">交期/施工期(天)</label> |
|||
<input type="text" name="lead_time" id="lead_time"> |
|||
</div> |
|||
<div> |
|||
<label for="margin">質保金</label> |
|||
<select name="margin" id="margin"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="margin_day">質保期限(天)</label> |
|||
<input type="text" name="margin_day" id="margin_day" required> |
|||
</div> |
|||
<div> |
|||
<label for="acceptance">驗收標準</label> |
|||
<input type="text" name="acceptance" id="acceptance" size="104" maxlength="50"> |
|||
</div> |
|||
<div> |
|||
<label for="purchase_history">歷史購買記錄</label> |
|||
<select name="purchase_history" id="purchase_history"> |
|||
<option value="Y">是</option> |
|||
<option value="N">否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="attatch1">附件1</label> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="attatch2">附件2</label> |
|||
<div> |
|||
<input type="file" name="attatch2" id="attatch2"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="item_description">項目描述</label> |
|||
<input type="text" name="item_description" id="item_description" size="80" maxlength="120"> |
|||
</div> |
|||
<div> |
|||
<label for="repairno">設備維修單號</label> |
|||
<input type="text" name="repairno" id="repairno" maxlength="20"> |
|||
</div> |
|||
<div> |
|||
<label for="category_repair">類別</label> |
|||
<select name="category_repair" id="category_repair" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="content">內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="4" cols="100"></textarea> |
|||
</div> |
|||
<div> |
|||
<label for="quotation">採購報價單</label> |
|||
<input type="text" name="quotation" id="quotation" readonly> |
|||
</div> |
|||
|
|||
<div class="table-responsive" style="width:100%;margin-top:10px;"> |
|||
<table id="tb1" class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th colspan="8"><h4>附件上傳及信息維護</h4></th> |
|||
</tr> |
|||
<tr> |
|||
<th rowspan="2" nowrap>序號</th> |
|||
<th colspan="4">作成單位提供◎維護信息</th> |
|||
<th colspan="3">配合單位提供◎維護信息</th> |
|||
</tr> |
|||
<tr> |
|||
<th nowrap>供應商名稱</th> |
|||
<th nowrap>供應商報價單上傳</th> |
|||
<th nowrap>報價</th> |
|||
<th nowrap>備註</th> |
|||
<th nowrap>議價後報價單上傳</th> |
|||
<th nowrap>議價後報價</th> |
|||
<th nowrap>備註</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr name="supplier_templ"> |
|||
<td>1</td> |
|||
<td><input type="text" name="supplier" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_be[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_be" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_ar[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_ar" class="form-control input-sm" size="10"><input type="hidden" name="sup_id"></td> |
|||
</tr> |
|||
<td colspan="8"><button type="button" id="btnadd" class="btn btn-primary btn-sm" style="float:left;">+供應商</button></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit" id="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="sup_id_all" id="sup_id_all"> |
|||
<input type="hidden" name="supplier_all" id="supplier_all"> |
|||
<input type="hidden" name="quote_amt_be_all" id="quote_amt_be_all"> |
|||
<input type="hidden" name="note_be_all" id="note_be_all"> |
|||
<input type="hidden" name="quote_amt_ar_all" id="quote_amt_ar_all"> |
|||
<input type="hidden" name="note_ar_all" id="note_ar_all"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
@ -1,29 +1,29 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
/* 已進入簽核流程 |
|||
$db_query = "select checker_1_result from bargin where id = '$id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
$row = mysqli_fetch_array($res, MYSQLI_ASSOC); |
|||
if (!$row || $row["checker_1_result"]) { |
|||
mysqli_free_result($res); |
|||
mysqli_close($link); |
|||
echo "<script>"; |
|||
//echo "alert('審核中,已無法刪除');"; |
|||
echo "alert('資料無法刪除');"; |
|||
echo "location.href='pricereview-index.php'"; |
|||
echo "</script>"; |
|||
exit; |
|||
} |
|||
*/ |
|||
$db_query = "delete from bargain_supplier where bid = '$id'"; |
|||
if ($rs = mysqli_query($link, $db_query)) { |
|||
$db_query = "delete from bargain where id = '$id'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
|
|||
header("Refresh:0; url=bargain-index.php?function_name=bargain&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
/* 已進入簽核流程 |
|||
$db_query = "select checker_1_result from bargin where id = '$id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
$row = mysqli_fetch_array($res, MYSQLI_ASSOC); |
|||
if (!$row || $row["checker_1_result"]) { |
|||
mysqli_free_result($res); |
|||
mysqli_close($link); |
|||
echo "<script>"; |
|||
//echo "alert('審核中,已無法刪除');"; |
|||
echo "alert('資料無法刪除');"; |
|||
echo "location.href='pricereview-index.php'"; |
|||
echo "</script>"; |
|||
exit; |
|||
} |
|||
*/ |
|||
$db_query = "delete from bargain_supplier where bid = '$id'"; |
|||
if ($rs = mysqli_query($link, $db_query)) { |
|||
$db_query = "delete from bargain where id = '$id'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
|
|||
header("Refresh:0; url=bargain-index.php?function_name=bargain&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,375 +1,375 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
|
|||
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; |
|||
|
|||
$db_query = "select * from bargain where id = '$id'"; |
|||
$data = mysqli_query($link, $db_query); |
|||
|
|||
$department_arr = []; |
|||
$sql = "select department_id, name from department"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$department_arr[$row[0]] = $row[1]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
foreach($data as $data) : |
|||
$sql = "select name from account where accountid = '".$data['creater']."'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
list($creater_name) = $row; |
|||
mysqli_free_result($res); |
|||
|
|||
$item_arr = []; |
|||
$sql = "select * from bargain_supplier where bid = '$id' order by supplier_id"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$item_arr[$row['supplier_id']]['id'] = $row['id']; |
|||
$item_arr[$row['supplier_id']]['supplier'] = $row['supplier']; |
|||
$item_arr[$row['supplier_id']]['supplier_attatch_be'] = $row['supplier_attatch_be']; |
|||
$item_arr[$row['supplier_id']]['quote_amt_be'] = $row['quote_amt_be']; |
|||
$item_arr[$row['supplier_id']]['note_be'] = $row['note_be']; |
|||
$item_arr[$row['supplier_id']]['supplier_attatch_ar'] = $row['supplier_attatch_ar']; |
|||
$item_arr[$row['supplier_id']]['quote_amt_ar'] = $row['quote_amt_ar']; |
|||
$item_arr[$row['supplier_id']]['note_ar'] = $row['note_ar']; |
|||
} |
|||
mysqli_free_result($res); |
|||
?> |
|||
<style> |
|||
|
|||
</style> |
|||
<script> |
|||
function commafy(num) { |
|||
num = num + ""; |
|||
var re = /(-?\d+)(\d{3})/ |
|||
while (re.test(num)) { |
|||
num = num.replace(re, "$1,$2") |
|||
} |
|||
return num; |
|||
} |
|||
|
|||
$(function(){ |
|||
$('#quantity').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#lead_time').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#margin_day').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$("input[name=quote_amt_be]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$("input[name=quote_amt_ar]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$('#btnadd').click(function(){ |
|||
if ($('tr[name=supplier_templ]').is(':visible') == false) $('tr[name=supplier_templ]').show(); |
|||
else { |
|||
$('#tb1 tr:last').prev().after($("tr[name='supplier_templ']").eq(0).clone().find('input').val('').end()); |
|||
//$('#tb1 tr:last').find('td').first().html($("tr[name='supplier_templ']").length); |
|||
} |
|||
}); |
|||
$('#update').click(function(){ |
|||
var bsidArr = []; |
|||
$("input[name='bsid']").each(function(){ bsidArr.push($(this).val()); }) |
|||
$('#bsid_all').val(bsidArr); |
|||
var supIdArr = []; |
|||
$("input[name='sup_id']").each(function(){ supIdArr.push($(this).val()); }) |
|||
$('#sup_id_all').val(supIdArr); |
|||
var supplierArr = []; |
|||
$("input[name='supplier']").each(function(){ supplierArr.push($(this).val()); }) |
|||
$('#supplier_all').val(supplierArr); |
|||
var supplierAttatchBeAllArr = []; |
|||
$("input[name='supplier_attatch_be']").each(function(){ supplierAttatchBeAllArr.push($(this).val()); }) |
|||
$('#supplier_attatch_be_all').val(supplierAttatchBeAllArr); |
|||
var quoteAmtBeArr = []; |
|||
$("input[name='quote_amt_be']").each(function(){ quoteAmtBeArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_be_all').val(quoteAmtBeArr); |
|||
var noteBeArr = []; |
|||
$("input[name='note_be']").each(function(){ noteBeArr.push($(this).val()); }) |
|||
$('#note_be_all').val(noteBeArr); |
|||
var supplierAttatchArArr = []; |
|||
$("input[name='supplier_attatch_ar']").each(function(){ supplierAttatchArArr.push($(this).val()); }) |
|||
$('#supplier_attatch_ar_all').val(supplierAttatchArArr); |
|||
var quoteAmtArArr = []; |
|||
$("input[name='quote_amt_ar']").each(function(){ quoteAmtArArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_ar_all').val(quoteAmtArArr); |
|||
var noteArArr = []; |
|||
$("input[name='note_ar']").each(function(){ noteArArr.push($(this).val()); }) |
|||
$('#note_ar_all').val(noteArArr); |
|||
//console.log(noteArArr); |
|||
//return false; |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="bargain-record-update.php" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="bargainno">申請單號</label> |
|||
<input type="text" name="bargainno" id="bargainno" value="<?php echo $data['bargainno']; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="department">作成單位</label> |
|||
<input type="text" name="department" id="department" value="<?php echo $department_arr[$data['department_id']]; ?>" disabled> |
|||
<input type="hidden" name="department_id" id="department_id" value="<?php echo $data['department_id']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="proposer">作成者</label> |
|||
<input type="text" name="proposer" id="proposer" value="<?php echo $creater_name; ?>" disabled> |
|||
</div> |
|||
<div> |
|||
<label for="receiver">收文單位</label> |
|||
<select name="receiver" id="receiver" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($department_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["receiver"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="response_dt">回答期限</label><br> |
|||
<input type="date" name="response_dt" id="response_dt" value="<?php echo $data['response_dt']; ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="item">項目名稱</label> |
|||
<input type="text" name="item" id="item" size="60" maxlength="50" value="<?php echo $data['item']; ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="annual">年度議價件</label> |
|||
<select name="annual" id="annual"> |
|||
<option value="Y"<?php if ($data['annual']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['annual']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="urgent">緊急件</label> |
|||
<select name="urgent" id="urgent"> |
|||
<option value="Y"<?php if ($data['urgent']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['urgent']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="vendor">指定廠商</label> |
|||
<select name="vendor" id="vendor"> |
|||
<option value="Y"<?php if ($data['vendor']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['vendor']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="prospecting">現場勘查</label> |
|||
<select name="prospecting" id="prospecting"> |
|||
<option value="Y"<?php if ($data['prospecting']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['prospecting']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="category">類別</label> |
|||
<select name="category" id="category" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["category"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="dealer">原廠或原代理商</label> |
|||
<select name="dealer" id="dealer" required> |
|||
<option value="Y"<?php if ($data['dealer']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['dealer']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="reason">理由</label> |
|||
<input type="text" name="reason" id="reason" size="60" maxlength="50" value="<?php echo $data['reason']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="brand">品牌</label> |
|||
<input type="text" name="brand" id="brand" maxlength="25" value="<?php echo $data['brand']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="model">型號</label> |
|||
<input type="text" name="model" id="model" maxlength="25" value="<?php echo $data['model']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="quantity">預估數量</label> |
|||
<input type="text" name="quantity" id="quantity" value="<?php echo number_format($data['quantity']); ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="brandkeep">備選品牌</label> |
|||
<input type="text" name="brandkeep" id="brandkeep" size="60" maxlength="25" value="<?php echo $data['brandkeep']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="lead_time">交期/施工期(天)</label> |
|||
<input type="text" name="lead_time" id="lead_time" value="<?php echo number_format($data['lead_time']); ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="margin">質保金</label> |
|||
<select name="margin" id="margin"> |
|||
<option value="Y"<?php if ($data['margin']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['margin']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="margin_day">質保期限(天)</label> |
|||
<input type="text" name="margin_day" id="margin_day" value="<?php echo number_format($data['margin_day']); ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="acceptance">驗收標準</label> |
|||
<input type="text" name="acceptance" id="acceptance" size="104" maxlength="50" value="<?php echo $data['acceptance']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="purchase_history">歷史購買記錄</label> |
|||
<select name="purchase_history" id="purchase_history"> |
|||
<option value="Y"<?php if ($data['purchase_history']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['purchase_history']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="attatch1">附件1</label> |
|||
<?php |
|||
if ($data["attatch1"]) echo "<a href=\"".$data["attatch1"]."\" target=\"_blank\" style=\"font-size:13px;\">".substr($data["attatch1"], strrpos($data["attatch1"],"/")+1)."</a>"; |
|||
?> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="attatch2">附件2</label> |
|||
<?php |
|||
if ($data["attatch2"]) echo "<a href=\"".$data["attatch2"]."\" target=\"_blank\" style=\"font-size:13px;\">".substr($data["attatch2"], strrpos($data["attatch2"],"/")+1)."</a>"; |
|||
?> |
|||
<div> |
|||
<input type="file" name="attatch2" id="attatch2"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="item_description">項目描述</label> |
|||
<input type="text" name="item_description" id="item_description" size="80" maxlength="120" value="<?php echo $data['item_description']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="repairno">設備維修單號</label> |
|||
<input type="text" name="repairno" id="repairno" maxlength="20" value="<?php echo $data['repairno']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="category_repair">類別</label> |
|||
<select name="category_repair" id="category_repair" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["category_repair"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="content">內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="4" cols="100"><?php echo $data['content']; ?></textarea> |
|||
</div> |
|||
<div> |
|||
<label for="quotation">採購報價單</label> |
|||
<input type="text" name="quotation" id="quotation" value="<?php echo $data['quotation']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div class="table-responsive" style="width:100%;margin-top:10px;"> |
|||
<table id="tb1" class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th colspan="8"><h4>附件上傳及信息維護</h4></th> |
|||
</tr> |
|||
<tr> |
|||
<th rowspan="2" nowrap>序號</th> |
|||
<th colspan="4">作成單位提供◎維護信息</th> |
|||
<th colspan="3">配合單位提供◎維護信息</th> |
|||
</tr> |
|||
<tr> |
|||
<th nowrap>供應商名稱</th> |
|||
<th nowrap>供應商報價單上傳</th> |
|||
<th nowrap>報價</th> |
|||
<th nowrap>備註</th> |
|||
<th nowrap>議價後報價單上傳</th> |
|||
<th nowrap>議價後報價</th> |
|||
<th nowrap>備註</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach ($item_arr as $supplier_id => $val) { |
|||
?> |
|||
<tr> |
|||
<td><?php echo $supplier_id; ?><input type="hidden" name="sup_id" value="<?php echo $supplier_id; ?>"><input type="hidden" name="bsid" value="<?php echo $val['id']; ?>"></td> |
|||
<td><input type="text" name="supplier" class="form-control input-sm" size="10" value="<?php echo $val['supplier']; ?>"></td> |
|||
<td> |
|||
<?php |
|||
if ($val['supplier_attatch_be']) echo "<a href=\"".$val['supplier_attatch_be']."\" target=\"_blank\">".substr($val['supplier_attatch_be'], strrpos($val['supplier_attatch_be'],"/")+1)."</a>"; |
|||
else echo "--"; |
|||
?> |
|||
</td> |
|||
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3" value="<?php echo number_format($val['quote_amt_be']); ?>"></td> |
|||
<td><input type="text" name="note_be" class="form-control input-sm" size="10" value="<?php echo $val['note_be']; ?>"></td> |
|||
<td> |
|||
<?php |
|||
if ($val['supplier_attatch_ar']) echo "<a href=\"".$val['supplier_attatch_ar']."\" target=\"_blank\">".substr($val['supplier_attatch_ar'], strrpos($val['supplier_attatch_ar'],"/")+1)."</a>"; |
|||
else echo "--"; |
|||
?> |
|||
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3" value="<?php echo number_format($val['quote_amt_ar']); ?>"></td> |
|||
<td><input type="text" name="note_ar" class="form-control input-sm" size="10" value="<?php echo $val['note_ar']; ?>"></td> |
|||
</tr> |
|||
<?php |
|||
} |
|||
|
|||
?> |
|||
<tr name="supplier_templ" style="display:none;"> |
|||
<td></td> |
|||
<td><input type="text" name="supplier" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_be[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_be" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_ar[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_ar" class="form-control input-sm" size="10"><input type="hidden" name="sup_id"></td> |
|||
</tr> |
|||
</tr> |
|||
<td colspan="8"><button type="button" id="btnadd" class="btn btn-primary btn-sm" style="float:left;">+供應商</button></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update" id="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="bsid_all" id="bsid_all"> |
|||
<input type="hidden" name="sup_id_all" id="sup_id_all"> |
|||
<input type="hidden" name="supplier_all" id="supplier_all"> |
|||
<input type="hidden" name="supplier_attatch_be_all" id="supplier_attatch_be_all"> |
|||
<input type="hidden" name="quote_amt_be_all" id="quote_amt_be_all"> |
|||
<input type="hidden" name="note_be_all" id="note_be_all"> |
|||
<input type="hidden" name="supplier_attatch_ar_all" id="supplier_attatch_ar_all"> |
|||
<input type="hidden" name="quote_amt_ar_all" id="quote_amt_ar_all"> |
|||
<input type="hidden" name="note_ar_all" id="note_ar_all"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
<?php |
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
|
|||
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; |
|||
|
|||
$db_query = "select * from bargain where id = '$id'"; |
|||
$data = mysqli_query($link, $db_query); |
|||
|
|||
$department_arr = []; |
|||
$sql = "select department_id, name from department"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$department_arr[$row[0]] = $row[1]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
foreach($data as $data) : |
|||
$sql = "select name from account where accountid = '".$data['creater']."'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
list($creater_name) = $row; |
|||
mysqli_free_result($res); |
|||
|
|||
$item_arr = []; |
|||
$sql = "select * from bargain_supplier where bid = '$id' order by supplier_id"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_assoc($res)) { |
|||
$item_arr[$row['supplier_id']]['id'] = $row['id']; |
|||
$item_arr[$row['supplier_id']]['supplier'] = $row['supplier']; |
|||
$item_arr[$row['supplier_id']]['supplier_attatch_be'] = $row['supplier_attatch_be']; |
|||
$item_arr[$row['supplier_id']]['quote_amt_be'] = $row['quote_amt_be']; |
|||
$item_arr[$row['supplier_id']]['note_be'] = $row['note_be']; |
|||
$item_arr[$row['supplier_id']]['supplier_attatch_ar'] = $row['supplier_attatch_ar']; |
|||
$item_arr[$row['supplier_id']]['quote_amt_ar'] = $row['quote_amt_ar']; |
|||
$item_arr[$row['supplier_id']]['note_ar'] = $row['note_ar']; |
|||
} |
|||
mysqli_free_result($res); |
|||
?> |
|||
<style> |
|||
|
|||
</style> |
|||
<script> |
|||
function commafy(num) { |
|||
num = num + ""; |
|||
var re = /(-?\d+)(\d{3})/ |
|||
while (re.test(num)) { |
|||
num = num.replace(re, "$1,$2") |
|||
} |
|||
return num; |
|||
} |
|||
|
|||
$(function(){ |
|||
$('#quantity').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#lead_time').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$('#margin_day').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }) |
|||
$("input[name=quote_amt_be]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$("input[name=quote_amt_ar]").each(function(){ |
|||
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); |
|||
}); |
|||
$('#btnadd').click(function(){ |
|||
if ($('tr[name=supplier_templ]').is(':visible') == false) $('tr[name=supplier_templ]').show(); |
|||
else { |
|||
$('#tb1 tr:last').prev().after($("tr[name='supplier_templ']").eq(0).clone().find('input').val('').end()); |
|||
//$('#tb1 tr:last').find('td').first().html($("tr[name='supplier_templ']").length); |
|||
} |
|||
}); |
|||
$('#update').click(function(){ |
|||
var bsidArr = []; |
|||
$("input[name='bsid']").each(function(){ bsidArr.push($(this).val()); }) |
|||
$('#bsid_all').val(bsidArr); |
|||
var supIdArr = []; |
|||
$("input[name='sup_id']").each(function(){ supIdArr.push($(this).val()); }) |
|||
$('#sup_id_all').val(supIdArr); |
|||
var supplierArr = []; |
|||
$("input[name='supplier']").each(function(){ supplierArr.push($(this).val()); }) |
|||
$('#supplier_all').val(supplierArr); |
|||
var supplierAttatchBeAllArr = []; |
|||
$("input[name='supplier_attatch_be']").each(function(){ supplierAttatchBeAllArr.push($(this).val()); }) |
|||
$('#supplier_attatch_be_all').val(supplierAttatchBeAllArr); |
|||
var quoteAmtBeArr = []; |
|||
$("input[name='quote_amt_be']").each(function(){ quoteAmtBeArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_be_all').val(quoteAmtBeArr); |
|||
var noteBeArr = []; |
|||
$("input[name='note_be']").each(function(){ noteBeArr.push($(this).val()); }) |
|||
$('#note_be_all').val(noteBeArr); |
|||
var supplierAttatchArArr = []; |
|||
$("input[name='supplier_attatch_ar']").each(function(){ supplierAttatchArArr.push($(this).val()); }) |
|||
$('#supplier_attatch_ar_all').val(supplierAttatchArArr); |
|||
var quoteAmtArArr = []; |
|||
$("input[name='quote_amt_ar']").each(function(){ quoteAmtArArr.push($(this).val().replace(/[,]+/g,"")); }) |
|||
$('#quote_amt_ar_all').val(quoteAmtArArr); |
|||
var noteArArr = []; |
|||
$("input[name='note_ar']").each(function(){ noteArArr.push($(this).val()); }) |
|||
$('#note_ar_all').val(noteArArr); |
|||
//console.log(noteArArr); |
|||
//return false; |
|||
}); |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="bargain-record-update.php" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="bargainno">申請單號</label> |
|||
<input type="text" name="bargainno" id="bargainno" value="<?php echo $data['bargainno']; ?>" readonly> |
|||
</div> |
|||
<div> |
|||
<label for="department">作成單位</label> |
|||
<input type="text" name="department" id="department" value="<?php echo $department_arr[$data['department_id']]; ?>" disabled> |
|||
<input type="hidden" name="department_id" id="department_id" value="<?php echo $data['department_id']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="proposer">作成者</label> |
|||
<input type="text" name="proposer" id="proposer" value="<?php echo $creater_name; ?>" disabled> |
|||
</div> |
|||
<div> |
|||
<label for="receiver">收文單位</label> |
|||
<select name="receiver" id="receiver" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($department_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["receiver"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="response_dt">回答期限</label><br> |
|||
<input type="date" name="response_dt" id="response_dt" value="<?php echo $data['response_dt']; ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="item">項目名稱</label> |
|||
<input type="text" name="item" id="item" size="60" maxlength="50" value="<?php echo $data['item']; ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="annual">年度議價件</label> |
|||
<select name="annual" id="annual"> |
|||
<option value="Y"<?php if ($data['annual']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['annual']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="urgent">緊急件</label> |
|||
<select name="urgent" id="urgent"> |
|||
<option value="Y"<?php if ($data['urgent']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['urgent']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="vendor">指定廠商</label> |
|||
<select name="vendor" id="vendor"> |
|||
<option value="Y"<?php if ($data['vendor']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['vendor']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="prospecting">現場勘查</label> |
|||
<select name="prospecting" id="prospecting"> |
|||
<option value="Y"<?php if ($data['prospecting']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['prospecting']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="category">類別</label> |
|||
<select name="category" id="category" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["category"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="dealer">原廠或原代理商</label> |
|||
<select name="dealer" id="dealer" required> |
|||
<option value="Y"<?php if ($data['dealer']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['dealer']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="reason">理由</label> |
|||
<input type="text" name="reason" id="reason" size="60" maxlength="50" value="<?php echo $data['reason']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="brand">品牌</label> |
|||
<input type="text" name="brand" id="brand" maxlength="25" value="<?php echo $data['brand']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="model">型號</label> |
|||
<input type="text" name="model" id="model" maxlength="25" value="<?php echo $data['model']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="quantity">預估數量</label> |
|||
<input type="text" name="quantity" id="quantity" value="<?php echo number_format($data['quantity']); ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="brandkeep">備選品牌</label> |
|||
<input type="text" name="brandkeep" id="brandkeep" size="60" maxlength="25" value="<?php echo $data['brandkeep']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="lead_time">交期/施工期(天)</label> |
|||
<input type="text" name="lead_time" id="lead_time" value="<?php echo number_format($data['lead_time']); ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="margin">質保金</label> |
|||
<select name="margin" id="margin"> |
|||
<option value="Y"<?php if ($data['margin']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['margin']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="margin_day">質保期限(天)</label> |
|||
<input type="text" name="margin_day" id="margin_day" value="<?php echo number_format($data['margin_day']); ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="acceptance">驗收標準</label> |
|||
<input type="text" name="acceptance" id="acceptance" size="104" maxlength="50" value="<?php echo $data['acceptance']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="purchase_history">歷史購買記錄</label> |
|||
<select name="purchase_history" id="purchase_history"> |
|||
<option value="Y"<?php if ($data['purchase_history']=="Y") echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data['purchase_history']=="N") echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="attatch1">附件1</label> |
|||
<?php |
|||
if ($data["attatch1"]) echo "<a href=\"".$data["attatch1"]."\" target=\"_blank\" style=\"font-size:13px;\">".substr($data["attatch1"], strrpos($data["attatch1"],"/")+1)."</a>"; |
|||
?> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="attatch2">附件2</label> |
|||
<?php |
|||
if ($data["attatch2"]) echo "<a href=\"".$data["attatch2"]."\" target=\"_blank\" style=\"font-size:13px;\">".substr($data["attatch2"], strrpos($data["attatch2"],"/")+1)."</a>"; |
|||
?> |
|||
<div> |
|||
<input type="file" name="attatch2" id="attatch2"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="item_description">項目描述</label> |
|||
<input type="text" name="item_description" id="item_description" size="80" maxlength="120" value="<?php echo $data['item_description']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="repairno">設備維修單號</label> |
|||
<input type="text" name="repairno" id="repairno" maxlength="20" value="<?php echo $data['repairno']; ?>"> |
|||
</div> |
|||
<div> |
|||
<label for="category_repair">類別</label> |
|||
<select name="category_repair" id="category_repair" required> |
|||
<option value="">請選擇</option> |
|||
<?php |
|||
foreach ($category_arr as $k => $v) { |
|||
echo "<option value=\"".$k."\""; |
|||
if ($data["category_repair"] == $k) echo " selected"; |
|||
echo ">".$v."</option>"; |
|||
} |
|||
?> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="content">內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="4" cols="100"><?php echo $data['content']; ?></textarea> |
|||
</div> |
|||
<div> |
|||
<label for="quotation">採購報價單</label> |
|||
<input type="text" name="quotation" id="quotation" value="<?php echo $data['quotation']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div class="table-responsive" style="width:100%;margin-top:10px;"> |
|||
<table id="tb1" class="table table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th colspan="8"><h4>附件上傳及信息維護</h4></th> |
|||
</tr> |
|||
<tr> |
|||
<th rowspan="2" nowrap>序號</th> |
|||
<th colspan="4">作成單位提供◎維護信息</th> |
|||
<th colspan="3">配合單位提供◎維護信息</th> |
|||
</tr> |
|||
<tr> |
|||
<th nowrap>供應商名稱</th> |
|||
<th nowrap>供應商報價單上傳</th> |
|||
<th nowrap>報價</th> |
|||
<th nowrap>備註</th> |
|||
<th nowrap>議價後報價單上傳</th> |
|||
<th nowrap>議價後報價</th> |
|||
<th nowrap>備註</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php |
|||
foreach ($item_arr as $supplier_id => $val) { |
|||
?> |
|||
<tr> |
|||
<td><?php echo $supplier_id; ?><input type="hidden" name="sup_id" value="<?php echo $supplier_id; ?>"><input type="hidden" name="bsid" value="<?php echo $val['id']; ?>"></td> |
|||
<td><input type="text" name="supplier" class="form-control input-sm" size="10" value="<?php echo $val['supplier']; ?>"></td> |
|||
<td> |
|||
<?php |
|||
if ($val['supplier_attatch_be']) echo "<a href=\"".$val['supplier_attatch_be']."\" target=\"_blank\">".substr($val['supplier_attatch_be'], strrpos($val['supplier_attatch_be'],"/")+1)."</a>"; |
|||
else echo "--"; |
|||
?> |
|||
</td> |
|||
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3" value="<?php echo number_format($val['quote_amt_be']); ?>"></td> |
|||
<td><input type="text" name="note_be" class="form-control input-sm" size="10" value="<?php echo $val['note_be']; ?>"></td> |
|||
<td> |
|||
<?php |
|||
if ($val['supplier_attatch_ar']) echo "<a href=\"".$val['supplier_attatch_ar']."\" target=\"_blank\">".substr($val['supplier_attatch_ar'], strrpos($val['supplier_attatch_ar'],"/")+1)."</a>"; |
|||
else echo "--"; |
|||
?> |
|||
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3" value="<?php echo number_format($val['quote_amt_ar']); ?>"></td> |
|||
<td><input type="text" name="note_ar" class="form-control input-sm" size="10" value="<?php echo $val['note_ar']; ?>"></td> |
|||
</tr> |
|||
<?php |
|||
} |
|||
|
|||
?> |
|||
<tr name="supplier_templ" style="display:none;"> |
|||
<td></td> |
|||
<td><input type="text" name="supplier" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_be[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_be" class="form-control input-sm" size="10"></td> |
|||
<td><input type="file" name="supplier_attatch_ar[]" multiple></td> |
|||
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3"></td> |
|||
<td><input type="text" name="note_ar" class="form-control input-sm" size="10"><input type="hidden" name="sup_id"></td> |
|||
</tr> |
|||
</tr> |
|||
<td colspan="8"><button type="button" id="btnadd" class="btn btn-primary btn-sm" style="float:left;">+供應商</button></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update" id="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="bsid_all" id="bsid_all"> |
|||
<input type="hidden" name="sup_id_all" id="sup_id_all"> |
|||
<input type="hidden" name="supplier_all" id="supplier_all"> |
|||
<input type="hidden" name="supplier_attatch_be_all" id="supplier_attatch_be_all"> |
|||
<input type="hidden" name="quote_amt_be_all" id="quote_amt_be_all"> |
|||
<input type="hidden" name="note_be_all" id="note_be_all"> |
|||
<input type="hidden" name="supplier_attatch_ar_all" id="supplier_attatch_ar_all"> |
|||
<input type="hidden" name="quote_amt_ar_all" id="quote_amt_ar_all"> |
|||
<input type="hidden" name="note_ar_all" id="note_ar_all"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
<?php |
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
?> |
@ -1,144 +1,144 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
|
|||
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; |
|||
|
|||
$sql = "select department_id, name from department"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$department_arr[$row[0]] = $row[1]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
// sql語法存在變數中 |
|||
$sql = "select * from bargain order by id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<p> |
|||
<a href="bargain-create.php?function_name=bargain&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
if($data): |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:bargain-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>品牌</th> |
|||
<th>型號</th> |
|||
<th>預估數量</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['bargainno']; ?></td> |
|||
<td><?php echo $department_arr[$data['department_id']]; ?></td> |
|||
<td><?php echo $data['proposer']; ?></td> |
|||
<td><?php echo $department_arr[$data['receiver']]; ?></td> |
|||
<td><?php echo $data['response_dt']; ?></td> |
|||
<td><?php echo $data['item']; ?></td> |
|||
<td><?php echo $category_arr[$data['category']]; ?></td> |
|||
<td><?php echo $data['brand']; ?></td> |
|||
<td><?php echo $data['model']; ?></td> |
|||
<td><?php echo number_format($data['quantity']); ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<td> |
|||
<p> |
|||
<a href="bargain-edit.php?id=<?php echo $data['id']; ?>&function_name=bargain&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="bargain-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
|
|||
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"]; |
|||
|
|||
$sql = "select department_id, name from department"; |
|||
$res = mysqli_query($link, $sql); |
|||
while ($row = mysqli_fetch_row($res)) { |
|||
$department_arr[$row[0]] = $row[1]; |
|||
} |
|||
mysqli_free_result($res); |
|||
|
|||
// sql語法存在變數中 |
|||
$sql = "select * from bargain order by id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<p> |
|||
<a href="bargain-create.php?function_name=bargain&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
if($data): |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:bargain-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>品牌</th> |
|||
<th>型號</th> |
|||
<th>預估數量</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['bargainno']; ?></td> |
|||
<td><?php echo $department_arr[$data['department_id']]; ?></td> |
|||
<td><?php echo $data['proposer']; ?></td> |
|||
<td><?php echo $department_arr[$data['receiver']]; ?></td> |
|||
<td><?php echo $data['response_dt']; ?></td> |
|||
<td><?php echo $data['item']; ?></td> |
|||
<td><?php echo $category_arr[$data['category']]; ?></td> |
|||
<td><?php echo $data['brand']; ?></td> |
|||
<td><?php echo $data['model']; ?></td> |
|||
<td><?php echo number_format($data['quantity']); ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<td> |
|||
<p> |
|||
<a href="bargain-edit.php?id=<?php echo $data['id']; ?>&function_name=bargain&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="bargain-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
?> |
@ -1,149 +1,149 @@ |
|||
<?php |
|||
$accountid= ""; |
|||
$facilityno= ""; |
|||
$issue_time= ""; |
|||
$process= ""; |
|||
$memo= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$accountid_error= ""; |
|||
$facilityno_error= ""; |
|||
$issue_time_error= ""; |
|||
$process_error= ""; |
|||
$memo_error= ""; |
|||
$creater_error= ""; |
|||
$create_at_error= ""; |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
|
|||
$sql = "select max(bargainno) as maxno from bargain"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$bargainno_check = $row[0] ? $row[0]+1 : date("Ym")."001"; |
|||
if ($bargainno_check <> $bargainno) $bargainno = $bargainno_check; |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file1)) unlink($target_file1); |
|||
foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
} else $target_file1 = ""; |
|||
|
|||
if ($_FILES["attatch2"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch2"]["name"]; |
|||
$temp_file_name = $_FILES["attatch2"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch2"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file2)) unlink($target_file2); |
|||
foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); |
|||
} else $target_file2 = ""; |
|||
|
|||
if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,資料請重建。');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "insert into bargain (bargainno, department_id, proposer, receiver, response_dt, item, annual, urgent, vendor, prospecting, category, "; |
|||
$db_query .= "dealer, reason, brand, model, quantity, brandkeep, lead_time, margin, margin_day, acceptance, purchase_history, "; |
|||
$db_query .= "attatch1, attatch2, item_description, repairno, category_repair, content, quotation, creater, create_at) values ("; |
|||
$db_query .= "'$bargainno', '$department_id', '$proposer', '$receiver', '$response_dt', '$item', '$annual', '$urgent', '$vendor', '$prospecting', '$category', "; |
|||
$db_query .= "'$dealer', '$reason', '$brand', '$model', '$quantity', '$brandkeep', '$lead_time', '$margin', '$margin_day', '$acceptance', '$purchase_history', "; |
|||
$db_query .= "'$target_file1', '$target_file2', '$item_description', '$repairno', '$category_repair', '$content', '$quotation', '$user_id', '$create_at')"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
if ($result && $sup_id_all != "") { |
|||
$bid = mysqli_insert_id($link); |
|||
$sup_id_arr = explode(",", $sup_id_all); |
|||
$supplier_arr = explode(",", $supplier_all); |
|||
$quote_amt_be_arr = explode(",", $quote_amt_be_all); |
|||
$note_be_arr = explode(",", $note_be_all); |
|||
$quote_amt_ar_arr = explode(",", $quote_amt_ar_all); |
|||
$note_ar_arr = explode(",", $note_ar_all); |
|||
$item_no = 1; |
|||
|
|||
for ($i=0; $i<count($supplier_arr); $i++) { |
|||
if (!$sup_id_arr[$i]) $sup_id_arr[$i] = 0; |
|||
if (!$supplier_arr[$i]) continue; |
|||
|
|||
if ($_FILES["supplier_attatch_be"]["name"][$i] && ($_FILES["supplier_attatch_be"]["error"][$i] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_be"]["name"][$i]; |
|||
$temp_file_name = $_FILES["supplier_attatch_be"]["tmp_name"][$i]; |
|||
$file_size = $_FILES["supplier_attatch_be"]["size"][$i]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_be = strtolower($target_dir.$bargainno."-".$item_no."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_be, PATHINFO_EXTENSION); |
|||
$upload_res_be = move_uploaded_file($temp_file_name, $target_file_be); |
|||
} else $target_file_be = ""; |
|||
|
|||
if ($_FILES["supplier_attatch_ar"]["name"][$i] && ($_FILES["supplier_attatch_ar"]["error"][$i] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_ar"]["name"][$i]; |
|||
$temp_file_name = $_FILES["supplier_attatch_ar"]["tmp_name"][$i]; |
|||
$file_size = $_FILES["supplier_attatch_ar"]["size"][$i]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_ar = strtolower($target_dir.$bargainno."-".$item_no."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_ar, PATHINFO_EXTENSION); |
|||
$upload_res_ar = move_uploaded_file($temp_file_name, $target_file_ar); |
|||
} else $target_file_ar = ""; |
|||
|
|||
if (($target_file_be && !$upload_res_be) || ($target_file_ar && !$upload_res_ar)) { |
|||
$sql = "delete from bargain where id = '$bid'"; |
|||
mysqli_query($link, $sql); |
|||
$sql = "delete from bargain_supplier where bid = '$bid'"; |
|||
mysqli_query($link, $sql); |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,資料請重建!".$sql."');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$quote_amt_be_arr[$i] = str_replace(",", "", $quote_amt_be_arr[$i]); |
|||
$quote_amt_ar_all[$i] = str_replace(",", "", $quote_amt_ar_all[$i]); |
|||
$db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; |
|||
$db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; |
|||
$db_query .= "'$bid', '$item_no', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; |
|||
$db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$item_no++; |
|||
} |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功(申請單號:".$bargainno.")');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
$accountid= ""; |
|||
$facilityno= ""; |
|||
$issue_time= ""; |
|||
$process= ""; |
|||
$memo= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$accountid_error= ""; |
|||
$facilityno_error= ""; |
|||
$issue_time_error= ""; |
|||
$process_error= ""; |
|||
$memo_error= ""; |
|||
$creater_error= ""; |
|||
$create_at_error= ""; |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
|
|||
$sql = "select max(bargainno) as maxno from bargain"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$bargainno_check = $row[0] ? $row[0]+1 : date("Ym")."001"; |
|||
if ($bargainno_check <> $bargainno) $bargainno = $bargainno_check; |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file1)) unlink($target_file1); |
|||
foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
} else $target_file1 = ""; |
|||
|
|||
if ($_FILES["attatch2"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch2"]["name"]; |
|||
$temp_file_name = $_FILES["attatch2"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch2"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file2)) unlink($target_file2); |
|||
foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); |
|||
} else $target_file2 = ""; |
|||
|
|||
if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,資料請重建。');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "insert into bargain (bargainno, department_id, proposer, receiver, response_dt, item, annual, urgent, vendor, prospecting, category, "; |
|||
$db_query .= "dealer, reason, brand, model, quantity, brandkeep, lead_time, margin, margin_day, acceptance, purchase_history, "; |
|||
$db_query .= "attatch1, attatch2, item_description, repairno, category_repair, content, quotation, creater, create_at) values ("; |
|||
$db_query .= "'$bargainno', '$department_id', '$proposer', '$receiver', '$response_dt', '$item', '$annual', '$urgent', '$vendor', '$prospecting', '$category', "; |
|||
$db_query .= "'$dealer', '$reason', '$brand', '$model', '$quantity', '$brandkeep', '$lead_time', '$margin', '$margin_day', '$acceptance', '$purchase_history', "; |
|||
$db_query .= "'$target_file1', '$target_file2', '$item_description', '$repairno', '$category_repair', '$content', '$quotation', '$user_id', '$create_at')"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
if ($result && $sup_id_all != "") { |
|||
$bid = mysqli_insert_id($link); |
|||
$sup_id_arr = explode(",", $sup_id_all); |
|||
$supplier_arr = explode(",", $supplier_all); |
|||
$quote_amt_be_arr = explode(",", $quote_amt_be_all); |
|||
$note_be_arr = explode(",", $note_be_all); |
|||
$quote_amt_ar_arr = explode(",", $quote_amt_ar_all); |
|||
$note_ar_arr = explode(",", $note_ar_all); |
|||
$item_no = 1; |
|||
|
|||
for ($i=0; $i<count($supplier_arr); $i++) { |
|||
if (!$sup_id_arr[$i]) $sup_id_arr[$i] = 0; |
|||
if (!$supplier_arr[$i]) continue; |
|||
|
|||
if ($_FILES["supplier_attatch_be"]["name"][$i] && ($_FILES["supplier_attatch_be"]["error"][$i] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_be"]["name"][$i]; |
|||
$temp_file_name = $_FILES["supplier_attatch_be"]["tmp_name"][$i]; |
|||
$file_size = $_FILES["supplier_attatch_be"]["size"][$i]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_be = strtolower($target_dir.$bargainno."-".$item_no."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_be, PATHINFO_EXTENSION); |
|||
$upload_res_be = move_uploaded_file($temp_file_name, $target_file_be); |
|||
} else $target_file_be = ""; |
|||
|
|||
if ($_FILES["supplier_attatch_ar"]["name"][$i] && ($_FILES["supplier_attatch_ar"]["error"][$i] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_ar"]["name"][$i]; |
|||
$temp_file_name = $_FILES["supplier_attatch_ar"]["tmp_name"][$i]; |
|||
$file_size = $_FILES["supplier_attatch_ar"]["size"][$i]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_ar = strtolower($target_dir.$bargainno."-".$item_no."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_ar, PATHINFO_EXTENSION); |
|||
$upload_res_ar = move_uploaded_file($temp_file_name, $target_file_ar); |
|||
} else $target_file_ar = ""; |
|||
|
|||
if (($target_file_be && !$upload_res_be) || ($target_file_ar && !$upload_res_ar)) { |
|||
$sql = "delete from bargain where id = '$bid'"; |
|||
mysqli_query($link, $sql); |
|||
$sql = "delete from bargain_supplier where bid = '$bid'"; |
|||
mysqli_query($link, $sql); |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,資料請重建!".$sql."');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$quote_amt_be_arr[$i] = str_replace(",", "", $quote_amt_be_arr[$i]); |
|||
$quote_amt_ar_all[$i] = str_replace(",", "", $quote_amt_ar_all[$i]); |
|||
$db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; |
|||
$db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; |
|||
$db_query .= "'$bid', '$item_no', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; |
|||
$db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$item_no++; |
|||
} |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功(申請單號:".$bargainno.")');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,144 +1,144 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if (isset($_POST['update'])) { |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
|
|||
$sql_atta = ""; |
|||
|
|||
$quantity = str_replace(",", "", $quantity); |
|||
$lead_time = str_replace(",", "", $lead_time); |
|||
$margin_day = str_replace(",", "", $margin_day); |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file1)) unlink($target_file1); |
|||
foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
$sql_atta .= "attatch1 = '$target_file1', "; |
|||
} else $target_file1 = ""; |
|||
|
|||
if ($_FILES["attatch2"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch2"]["name"]; |
|||
$temp_file_name = $_FILES["attatch2"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch2"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file2)) unlink($target_file2); |
|||
foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); |
|||
$sql_atta .= "attatch2 = '$target_file2', "; |
|||
} else $target_file2 = ""; |
|||
|
|||
if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,請重新操作。');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "update bargain set receiver = '$receiver', response_dt = '$response_dt', item = '$item', annual = '$annual', urgent = '$urgent', "; |
|||
$db_query .= "vendor = '$vendor', prospecting = '$prospecting', category = '$category', dealer = '$dealer', reason = '$reason', brand = '$brand', "; |
|||
$db_query .= "model = '$model', quantity = '$quantity', brandkeep = '$brandkeep', lead_time = '$lead_time', margin = '$margin', margin_day = '$margin_day', "; |
|||
$db_query .= "acceptance = '$acceptance', purchase_history = '$purchase_history', item_description = '$item_description', repairno = '$repairno', "; |
|||
$db_query .= $sql_atta; |
|||
$db_query .= "category_repair = '$category_repair', content = '$content', quotation = '$quotation', create_dt = '$create_at' "; |
|||
$db_query .= "where id = '$id'"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
if ($result && $sup_id_all != "") { |
|||
$bsid_arr = explode(",", $bsid_all); |
|||
$sup_id_arr = explode(",", $sup_id_all); |
|||
$supplier_arr = explode(",", rtrim($supplier_all, ",")); |
|||
$quote_amt_be_arr = explode(",", $quote_amt_be_all); |
|||
$note_be_arr = explode(",", $note_be_all); |
|||
$quote_amt_ar_arr = explode(",", $quote_amt_ar_all); |
|||
$note_ar_arr = explode(",", $note_ar_all); |
|||
$item_no = 1; |
|||
|
|||
// 有新增的供應商 |
|||
$new_sup_cnt = count($supplier_arr) - count($bsid_arr); |
|||
if ($new_sup_cnt > 0) $next_sup_id = max($sup_id_arr)+1; |
|||
$idx = 0; |
|||
for ($i=0; $i<count($supplier_arr); $i++) { |
|||
if ($new_sup_cnt > 0 && $bsid_arr[$i] == "") { // 新增 |
|||
$target_file_be = $target_file_ar = ""; |
|||
if ($_FILES["supplier_attatch_be"]["name"]) { // 有上傳檔案 |
|||
if ($_FILES["supplier_attatch_be"]["name"][$idx] && ($_FILES["supplier_attatch_be"]["error"][$idx] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_be"]["name"][$idx]; |
|||
$temp_file_name = $_FILES["supplier_attatch_be"]["tmp_name"][$idx]; |
|||
$file_size = $_FILES["supplier_attatch_be"]["size"][$idx]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_be = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_be, PATHINFO_EXTENSION); |
|||
$upload_res_be = move_uploaded_file($temp_file_name, $target_file_be); |
|||
} |
|||
} |
|||
if ($_FILES["supplier_attatch_ar"]["name"]) { // 有上傳檔案 |
|||
if ($_FILES["supplier_attatch_ar"]["name"][$idx] && ($_FILES["supplier_attatch_ar"]["error"][$idx] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_ar"]["name"][$idx]; |
|||
$temp_file_name = $_FILES["supplier_attatch_ar"]["tmp_name"][$idx]; |
|||
$file_size = $_FILES["supplier_attatch_ar"]["size"][$idx]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_ar = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_ar, PATHINFO_EXTENSION); |
|||
$upload_res_ar = move_uploaded_file($temp_file_name, $target_file_ar); |
|||
} |
|||
} |
|||
if ($upload_res_be || $upload_res_ar) $idx++; |
|||
if (($target_file_be && !$upload_res_be) || ($target_file_ar && !$upload_res_ar)) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,請重新操作!".$sql."');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
$db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; |
|||
$db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; |
|||
$db_query .= "'$id', '$next_sup_id', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; |
|||
$db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$next_sup_id++; |
|||
} else { // 修改(不支援重傳檔案) |
|||
$db_query = "update bargain_supplier set supplier = '$supplier_arr[$i]', quote_amt_be = '$quote_amt_be_arr[$i]', "; |
|||
$db_query .= "note_be = '$note_be_arr[$i]', quote_amt_ar = '$quote_amt_ar_arr[$i]', "; |
|||
$db_query .= "note_ar = '$note_ar_arr[$i]', create_at = '$create_at' "; |
|||
$db_query .= "where id = '$bsid_arr[$i]'"; |
|||
$result = mysqli_query($link, $db_query); |
|||
} |
|||
} |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if (isset($_POST['update'])) { |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
|
|||
$sql_atta = ""; |
|||
|
|||
$quantity = str_replace(",", "", $quantity); |
|||
$lead_time = str_replace(",", "", $lead_time); |
|||
$margin_day = str_replace(",", "", $margin_day); |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file1 = strtolower($target_dir.$bargainno."-1-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file1)) unlink($target_file1); |
|||
foreach (glob($target_dir.$bargainno."-1-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
$sql_atta .= "attatch1 = '$target_file1', "; |
|||
} else $target_file1 = ""; |
|||
|
|||
if ($_FILES["attatch2"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch2"]["name"]; |
|||
$temp_file_name = $_FILES["attatch2"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch2"]["size"]; |
|||
$target_dir = "bargain-uploads/"; |
|||
$target_file2 = strtolower($target_dir.$bargainno."-2-".basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
//if (file_exists($target_file2)) unlink($target_file2); |
|||
foreach (glob($target_dir.$bargainno."-2-*") as $todelfile) { |
|||
unlink($todelfile); |
|||
} |
|||
$upload_res_2 = move_uploaded_file($temp_file_name, $target_file2); |
|||
$sql_atta .= "attatch2 = '$target_file2', "; |
|||
} else $target_file2 = ""; |
|||
|
|||
if (($target_file1 && !$upload_res_1) || ($target_file2 && !$upload_res_2)) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,請重新操作。');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "update bargain set receiver = '$receiver', response_dt = '$response_dt', item = '$item', annual = '$annual', urgent = '$urgent', "; |
|||
$db_query .= "vendor = '$vendor', prospecting = '$prospecting', category = '$category', dealer = '$dealer', reason = '$reason', brand = '$brand', "; |
|||
$db_query .= "model = '$model', quantity = '$quantity', brandkeep = '$brandkeep', lead_time = '$lead_time', margin = '$margin', margin_day = '$margin_day', "; |
|||
$db_query .= "acceptance = '$acceptance', purchase_history = '$purchase_history', item_description = '$item_description', repairno = '$repairno', "; |
|||
$db_query .= $sql_atta; |
|||
$db_query .= "category_repair = '$category_repair', content = '$content', quotation = '$quotation', create_dt = '$create_at' "; |
|||
$db_query .= "where id = '$id'"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
if ($result && $sup_id_all != "") { |
|||
$bsid_arr = explode(",", $bsid_all); |
|||
$sup_id_arr = explode(",", $sup_id_all); |
|||
$supplier_arr = explode(",", rtrim($supplier_all, ",")); |
|||
$quote_amt_be_arr = explode(",", $quote_amt_be_all); |
|||
$note_be_arr = explode(",", $note_be_all); |
|||
$quote_amt_ar_arr = explode(",", $quote_amt_ar_all); |
|||
$note_ar_arr = explode(",", $note_ar_all); |
|||
$item_no = 1; |
|||
|
|||
// 有新增的供應商 |
|||
$new_sup_cnt = count($supplier_arr) - count($bsid_arr); |
|||
if ($new_sup_cnt > 0) $next_sup_id = max($sup_id_arr)+1; |
|||
$idx = 0; |
|||
for ($i=0; $i<count($supplier_arr); $i++) { |
|||
if ($new_sup_cnt > 0 && $bsid_arr[$i] == "") { // 新增 |
|||
$target_file_be = $target_file_ar = ""; |
|||
if ($_FILES["supplier_attatch_be"]["name"]) { // 有上傳檔案 |
|||
if ($_FILES["supplier_attatch_be"]["name"][$idx] && ($_FILES["supplier_attatch_be"]["error"][$idx] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_be"]["name"][$idx]; |
|||
$temp_file_name = $_FILES["supplier_attatch_be"]["tmp_name"][$idx]; |
|||
$file_size = $_FILES["supplier_attatch_be"]["size"][$idx]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_be = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_be, PATHINFO_EXTENSION); |
|||
$upload_res_be = move_uploaded_file($temp_file_name, $target_file_be); |
|||
} |
|||
} |
|||
if ($_FILES["supplier_attatch_ar"]["name"]) { // 有上傳檔案 |
|||
if ($_FILES["supplier_attatch_ar"]["name"][$idx] && ($_FILES["supplier_attatch_ar"]["error"][$idx] == 0)) { |
|||
$file_name = $_FILES["supplier_attatch_ar"]["name"][$idx]; |
|||
$temp_file_name = $_FILES["supplier_attatch_ar"]["tmp_name"][$idx]; |
|||
$file_size = $_FILES["supplier_attatch_ar"]["size"][$idx]; |
|||
$target_dir = "bargain-uploads/supplier/"; |
|||
$target_file_ar = strtolower($target_dir.$bargainno."-".$next_sup_id."-".basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file_ar, PATHINFO_EXTENSION); |
|||
$upload_res_ar = move_uploaded_file($temp_file_name, $target_file_ar); |
|||
} |
|||
} |
|||
if ($upload_res_be || $upload_res_ar) $idx++; |
|||
if (($target_file_be && !$upload_res_be) || ($target_file_ar && !$upload_res_ar)) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,請重新操作!".$sql."');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} |
|||
$db_query = "insert into bargain_supplier (bid, supplier_id, supplier, supplier_attatch_be, quote_amt_be, note_be, "; |
|||
$db_query .= "supplier_attatch_ar, quote_amt_ar, note_ar, creater, create_at) values ("; |
|||
$db_query .= "'$id', '$next_sup_id', '$supplier_arr[$i]', '$target_file_be', '$quote_amt_be_arr[$i]', '$note_be_arr[$i]', "; |
|||
$db_query .= "'$target_file_ar', '$quote_amt_ar_arr[$i]', '$note_ar_arr[$i]', '$user_id', '$create_at')"; |
|||
$result = mysqli_query($link, $db_query); |
|||
$next_sup_id++; |
|||
} else { // 修改(不支援重傳檔案) |
|||
$db_query = "update bargain_supplier set supplier = '$supplier_arr[$i]', quote_amt_be = '$quote_amt_be_arr[$i]', "; |
|||
$db_query .= "note_be = '$note_be_arr[$i]', quote_amt_ar = '$quote_amt_ar_arr[$i]', "; |
|||
$db_query .= "note_ar = '$note_ar_arr[$i]', create_at = '$create_at' "; |
|||
$db_query .= "where id = '$bsid_arr[$i]'"; |
|||
$result = mysqli_query($link, $db_query); |
|||
} |
|||
} |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='bargain-index.php?function_name=bargain&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,51 +1,80 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<?php |
|||
include "board-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="title">主旨</label> |
|||
<input type="text" name="title" id="title" size="30" maxlength="25" required> |
|||
</div> |
|||
<!--<div> |
|||
<label for="pin">置頂</label> |
|||
<select name="pin" id="pin"> |
|||
<option value="Y">是</option> |
|||
<option value="N" selected>否</option> |
|||
</select> |
|||
</div>--> |
|||
<div> |
|||
<label for="attatch1">附件上傳</label> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="content">公告內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="8" cols="100" required></textarea> |
|||
</div> |
|||
<div> |
|||
<button type="submit" name="submit" id="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
<script> |
|||
$(function() {}); |
|||
</script> |
|||
<div class="container"> |
|||
<?php |
|||
include "board-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> |
|||
<div class='container'> |
|||
<div class='row'> |
|||
<div class='col-md-6 col-12'> |
|||
<label for="title">主旨</label> |
|||
<input type="text" name="title" id="title" size="30" maxlength="25" required> |
|||
</div> |
|||
<div class='col-md-6 col-12'> |
|||
<label for="attatch1">附件上傳</label> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class='row'> |
|||
<div class='col-md-3 col-3'> |
|||
<label>連結名稱</label> |
|||
<input type="text" id="linkName"> |
|||
</div> |
|||
<div class='col-md-9 col-6'> |
|||
<label>連結網址</label> |
|||
<input type="text" id="linkURL"> |
|||
</div> |
|||
<div class='col-md-2 col-2'> |
|||
<button type='button' onclick="insertLink()">插入超連結</button> |
|||
</div> |
|||
</div> |
|||
<div class='row'> |
|||
<div class='col-md-12 col-12'> |
|||
<label for="content">公告內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="8" cols="100" required></textarea> |
|||
</div> |
|||
</div> |
|||
<br /> |
|||
<div class='row'> |
|||
<div class='col-md-12 col-12'> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
<button type="submit" name="submit" id="submit">確定</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<script> |
|||
function insertLink() { |
|||
var linkName = document.getElementById('linkName').value; |
|||
var linkURL = document.getElementById('linkURL').value; |
|||
|
|||
if (linkName !== '' && linkURL !== '') { |
|||
var textarea = document.getElementById('content'); |
|||
var link = '<a style="color:blue" href="' + linkURL + '">' + linkName + '</a>'; |
|||
|
|||
// 插入超連結到 textarea 中 |
|||
textarea.value += link; |
|||
} else { |
|||
alert('請輸入連結名稱和 URL'); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<?php include "footer.php"; ?> |
@ -1,23 +1,23 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "update board set status = 'N', create_at = NOW() where id = '$id' and creater = '$user_id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
/* |
|||
$db_query = "select attach from board where id = '$id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
$row = mysqli_fetch_row($res); |
|||
$target_file = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
$db_query = "delete from board where id = '$id'"; |
|||
mysqli_query($link, $db_query); |
|||
unlink($target_file); |
|||
*/ |
|||
//header("Location:board-index.php"); |
|||
header("Refresh:0; url=board-index.php?function_name=board&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "update board set status = 'N', create_at = NOW() where id = '$id' and creater = '$user_id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
/* |
|||
$db_query = "select attach from board where id = '$id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
$row = mysqli_fetch_row($res); |
|||
$target_file = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
$db_query = "delete from board where id = '$id'"; |
|||
mysqli_query($link, $db_query); |
|||
unlink($target_file); |
|||
*/ |
|||
//header("Location:board-index.php"); |
|||
header("Refresh:0; url=board-index.php?function_name=board&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,60 +1,60 @@ |
|||
<?php |
|||
exit; |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "select * from board where id = '$id'"; |
|||
$data = mysqli_query($link, $db_query); |
|||
|
|||
foreach($data as $data) : |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="board-record-update.php" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="title">主旨</label> |
|||
<input type="text" name="title" id="title" size="30" maxlength="25" value="<?php echo $data['title']; ?>" required> |
|||
</div> |
|||
<!--<div> |
|||
<label for="sdate">開始日期</label><br> |
|||
<input type="date" name="sdate" id="sdate" value="<?php echo $data['sdate']; ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="edate">結束日期</label><br> |
|||
<input type="date" name="edate" id="edate" value="<?php echo $data['edate']; ?>" required> |
|||
</div>--> |
|||
<div> |
|||
<label for="pin">置頂</label> |
|||
<select name="pin" id="pin"> |
|||
<option value="Y"<?php if ($data["pin"]>1) echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data["pin"]==1) echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="attatch1">附件上傳</label> |
|||
<a href="<?php echo $data['attach']; ?>" target="_blank"><?php echo str_replace("/wms/board-attach/","",$data['attach']); ?></a> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="content">公告內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="8" cols="100" required><?php echo $data['content']; ?></textarea> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update" id="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
</form> |
|||
</div> |
|||
<?php |
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
<?php |
|||
exit; |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "select * from board where id = '$id'"; |
|||
$data = mysqli_query($link, $db_query); |
|||
|
|||
foreach($data as $data) : |
|||
?> |
|||
<script> |
|||
$(function(){ |
|||
}); |
|||
</script> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="board-record-update.php" enctype="multipart/form-data"> |
|||
<div> |
|||
<label for="title">主旨</label> |
|||
<input type="text" name="title" id="title" size="30" maxlength="25" value="<?php echo $data['title']; ?>" required> |
|||
</div> |
|||
<!--<div> |
|||
<label for="sdate">開始日期</label><br> |
|||
<input type="date" name="sdate" id="sdate" value="<?php echo $data['sdate']; ?>" required> |
|||
</div> |
|||
<div> |
|||
<label for="edate">結束日期</label><br> |
|||
<input type="date" name="edate" id="edate" value="<?php echo $data['edate']; ?>" required> |
|||
</div>--> |
|||
<div> |
|||
<label for="pin">置頂</label> |
|||
<select name="pin" id="pin"> |
|||
<option value="Y"<?php if ($data["pin"]>1) echo " selected"; ?>>是</option> |
|||
<option value="N"<?php if ($data["pin"]==1) echo " selected"; ?>>否</option> |
|||
</select> |
|||
</div> |
|||
<div> |
|||
<label for="attatch1">附件上傳</label> |
|||
<a href="<?php echo $data['attach']; ?>" target="_blank"><?php echo str_replace("/wms/board-attach/","",$data['attach']); ?></a> |
|||
<div> |
|||
<input type="file" name="attatch1" id="attatch1"> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="content">公告內容</label><br> |
|||
<textarea class="form-control2" name="content" id="content" rows="8" cols="100" required><?php echo $data['content']; ?></textarea> |
|||
</div> |
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update" id="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
</form> |
|||
</div> |
|||
<?php |
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
?> |
@ -1,19 +1,19 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "select attach from board where id = '$id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
if ($row = mysqli_fetch_row($res)) { |
|||
header("Location: /wms/".$row[0]); |
|||
exit; |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案下載失敗!');"; |
|||
echo "</script>"; |
|||
header("Refresh:0; url=board-index.php?function_name=board&".$token_link); |
|||
} |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "select attach from board where id = '$id'"; |
|||
$res = mysqli_query($link, $db_query); |
|||
if ($row = mysqli_fetch_row($res)) { |
|||
header("Location: /wms/".$row[0]); |
|||
exit; |
|||
} else { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案下載失敗!');"; |
|||
echo "</script>"; |
|||
header("Refresh:0; url=board-index.php?function_name=board&".$token_link); |
|||
} |
|||
ob_end_flush(); |
|||
?> |
@ -1,108 +1,201 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
|
|||
// sql語法存在變數中 |
|||
$sql = "select * from board where status = 'Y' order by id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
if($data): |
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['title']; ?></td> |
|||
<td><a href="/wms/board-file.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" target="_blank"><?php echo str_replace("board-attach/","",$data['attach']); ?></a></td> |
|||
<!--<td><?php if ($data['pin'] > 1) echo "是"; else echo "否"; ?></td>--> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<td> |
|||
<p> |
|||
<?php if (($data['creater'] == $user_id) && ($data['status']=="Y")) { ?> |
|||
<a href="board-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('確認關閉公告嗎?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
<?php } else echo "-"; ?> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
|
|||
// sql語法存在變數中 |
|||
$sql = "select * from board where status = 'Y' order by id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link, $sql); |
|||
$data2 = $data; |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth & 2) { ?> |
|||
<p> |
|||
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
if ($data) : |
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout: fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap: break-word; |
|||
} |
|||
|
|||
img { |
|||
width: 125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width: 125px; |
|||
} |
|||
|
|||
table { |
|||
width: 100%; |
|||
} |
|||
|
|||
#table_index_filter { |
|||
float: right; |
|||
} |
|||
|
|||
#table_index_paginate { |
|||
float: right; |
|||
} |
|||
|
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
|
|||
/* The Modal (background) */ |
|||
.modal { |
|||
display: none; |
|||
/* Hidden by default */ |
|||
position: fixed; |
|||
/* Stay in place */ |
|||
z-index: 1; |
|||
/* Sit on top */ |
|||
padding-top: 100px; |
|||
/* Location of the box */ |
|||
left: 0; |
|||
top: 0; |
|||
width: 100%; |
|||
/* Full width */ |
|||
height: 100%; |
|||
/* Full height */ |
|||
overflow: auto; |
|||
/* Enable scroll if needed */ |
|||
|
|||
} |
|||
|
|||
.modal .back { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: rgba(0, 0, 0, 0.4); |
|||
/* Black w/ opacity */ |
|||
} |
|||
|
|||
/* Modal Content */ |
|||
.modal-content { |
|||
z-index: 9; |
|||
background-color: #fefefe; |
|||
margin: auto; |
|||
padding: 20px; |
|||
border: 1px solid #888; |
|||
width: 80%; |
|||
} |
|||
|
|||
/* The Close Button */ |
|||
.close { |
|||
color: #aaaaaa; |
|||
float: right; |
|||
font-size: 28px; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.close:hover, |
|||
.close:focus { |
|||
color: #000; |
|||
text-decoration: none; |
|||
cursor: pointer; |
|||
} |
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach ($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<!-- <td><?php echo $data['title']; ?></td> --> |
|||
<td><a onclick="openModal('<?php echo $data['id']; ?>')" href="#"><?php echo $data['title']; ?></button></a> |
|||
<td><a href="/wms/board-file.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" target="_blank"><?php echo str_replace("board-attach/", "", $data['attach']); ?></a></td> |
|||
<!--<td><?php if ($data['pin'] > 1) echo "是"; |
|||
else echo "否"; ?></td>--> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<td> |
|||
<p> |
|||
<?php if (($data['creater'] == $user_id) && ($data['status'] == "Y")) { ?> |
|||
<a href="board-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('確認關閉公告嗎?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
<?php } else echo "-"; ?> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
foreach ($data2 as $data2) : |
|||
?> |
|||
|
|||
<div id="myModal<?php echo $data2['id']; ?>" class="modal"> |
|||
<div class="back"></div> |
|||
<div class="modal-content"> |
|||
<button type="button" class="close myCloseBtn" id="">X</button> |
|||
<div class='col-12' style='text-align:center'> |
|||
<h3><?php echo $data2['title']; ?></h3> |
|||
<br/> |
|||
<?php echo nl2br($data2['content']); ?> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<?php endforeach; ?> |
|||
|
|||
<script> |
|||
var modal = document.getElementById("myModal"); |
|||
|
|||
function openModal(id) { |
|||
$("#myModal" + id).show(); |
|||
} |
|||
$(".myCloseBtn").click(function(e) { |
|||
$(".modal").hide(); |
|||
}); |
|||
$(".back").click(function(e) { |
|||
$(".modal").hide(); |
|||
}); |
|||
</script> |
|||
<?php |
|||
|
|||
else : |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
?> |
@ -1,52 +1,53 @@ |
|||
<?php |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
|
|||
function get_basename($filename) { |
|||
return preg_replace('/^.+[\\\\\\/]/', '', $filename); |
|||
} |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "board-attach/"; |
|||
$target_file1 = strtolower($target_dir.get_basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
if (file_exists($target_file1)) unlink($target_file1); |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
} else $target_file1 = ""; |
|||
|
|||
|
|||
if ($target_file1 && !$upload_res_1) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,資料請重建。');"; |
|||
echo "location.href='board-index.php?function_name=board&token=".$token."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "insert into board (title, content, attach, pin, creater, create_at) values ("; |
|||
$db_query .= "'$title', '$content', '$target_file1', '1', '".$user_id."', NOW())"; |
|||
$result = mysqli_query($link, $db_query); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='board-index.php?function_name=board&token=".$token."';"; |
|||
echo "</script>"; |
|||
} elseif (mysqli_affected_rows($link)==0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='board-index.php?function_name=board&token=".$token."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
} |
|||
<?php |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
foreach ($_POST as $k => $v) { |
|||
// $$k = htmlspecialchars(stripslashes(trim($v))); |
|||
$$k = trim($v); |
|||
} |
|||
|
|||
function get_basename($filename) { |
|||
return preg_replace('/^.+[\\\\\\/]/', '', $filename); |
|||
} |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "board-attach/"; |
|||
$target_file1 = strtolower($target_dir.get_basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
if (file_exists($target_file1)) unlink($target_file1); |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
} else $target_file1 = ""; |
|||
|
|||
|
|||
if ($target_file1 && !$upload_res_1) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,資料請重建。');"; |
|||
echo "location.href='board-index.php?function_name=board&token=".$token."';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "insert into board (title, content, attach, pin, creater, create_at) values ("; |
|||
$db_query .= "'$title', '$content', '$target_file1', '1', '".$user_id."', NOW())"; |
|||
$result = mysqli_query($link, $db_query); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='board-index.php?function_name=board&token=".$token."';"; |
|||
echo "</script>"; |
|||
} elseif (mysqli_affected_rows($link)==0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='board-index.php?function_name=board&token=".$token."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
} |
|||
?> |
@ -1,52 +1,52 @@ |
|||
<?php |
|||
exit; |
|||
require_once "database.php"; |
|||
|
|||
if (isset($_POST['update'])) { |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
|
|||
function get_basename($filename) { |
|||
return preg_replace('/^.+[\\\\\\/]/', '', $filename); |
|||
} |
|||
|
|||
$pin = ($pin == "Y") ? "99" : "1"; |
|||
$sql_atta = ""; |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "board-attach/"; |
|||
$target_file1 = strtolower($target_dir.get_basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
if (file_exists($target_file1)) unlink($target_file1); |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
$sql_atta .= "path = '$target_file1', "; |
|||
} else $target_file1 = ""; |
|||
|
|||
if ($target_file1 && !$upload_res_1) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,請重新操作。');"; |
|||
echo "location.href='board-index.php';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "update board set title = '$title', pin = '$pin', "; |
|||
$db_query .= $sql_atta; |
|||
$db_query .= "content = '$content'"; |
|||
$db_query .= "where id = '$id'"; |
|||
$result = mysqli_query($link, $db_query); |
|||
|
|||
mysqli_close($link); |
|||
|
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('修改成功');"; |
|||
echo "location.href='board-index.php';"; |
|||
echo "</script>"; |
|||
} |
|||
<?php |
|||
exit; |
|||
require_once "database.php"; |
|||
|
|||
if (isset($_POST['update'])) { |
|||
foreach ($_POST as $k => $v) { |
|||
$$k = htmlspecialchars(stripslashes(trim($v))); |
|||
} |
|||
//print_r($_POST); |
|||
//print_r($_FILES);exit; |
|||
|
|||
function get_basename($filename) { |
|||
return preg_replace('/^.+[\\\\\\/]/', '', $filename); |
|||
} |
|||
|
|||
$pin = ($pin == "Y") ? "99" : "1"; |
|||
$sql_atta = ""; |
|||
|
|||
if ($_FILES["attatch1"]["error"] == 0) { |
|||
$file_name = $_FILES["attatch1"]["name"]; |
|||
$temp_file_name = $_FILES["attatch1"]["tmp_name"]; |
|||
$file_size = $_FILES["attatch1"]["size"]; |
|||
$target_dir = "board-attach/"; |
|||
$target_file1 = strtolower($target_dir.get_basename($file_name)); |
|||
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION); |
|||
$upload_ok = 1; |
|||
if (file_exists($target_file1)) unlink($target_file1); |
|||
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1); |
|||
$sql_atta .= "path = '$target_file1', "; |
|||
} else $target_file1 = ""; |
|||
|
|||
if ($target_file1 && !$upload_res_1) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('檔案上傳失敗,請重新操作。');"; |
|||
echo "location.href='board-index.php';"; |
|||
echo "</script>"; |
|||
} |
|||
|
|||
$db_query = "update board set title = '$title', pin = '$pin', "; |
|||
$db_query .= $sql_atta; |
|||
$db_query .= "content = '$content'"; |
|||
$db_query .= "where id = '$id'"; |
|||
$result = mysqli_query($link, $db_query); |
|||
|
|||
mysqli_close($link); |
|||
|
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('修改成功');"; |
|||
echo "location.href='board-index.php';"; |
|||
echo "</script>"; |
|||
} |
|||
?> |
@ -1,48 +1,48 @@ |
|||
<?php |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
|
|||
require_once "database.php"; |
|||
|
|||
$token = $_REQUEST["token"]; |
|||
$token_link = "token=" . $_REQUEST["token"]; |
|||
list($user_id, $enc_user_name, $login_dt) = explode(".", $token); |
|||
|
|||
$old_pwd = $_REQUEST['old_pwd']; |
|||
$new_pwd = $_REQUEST['new_pwd']; |
|||
|
|||
$data = array(); # 設置一個空陣列來放資料 |
|||
$real_user_id = ""; |
|||
$real_pwd = ""; |
|||
$sql = "SELECT * FROM account where ((accountid = '$user_id') and (pwd = '$old_pwd'))"; # sql語法存在變數中 |
|||
$data = mysqli_query($link, $sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
foreach ($data as $data) { |
|||
$real_user_id = $data['accountid']; |
|||
$real_pwd = $data['pwd']; |
|||
} |
|||
|
|||
#如果帳號密碼都正確才可update |
|||
if (strlen($real_user_id) > 0) { |
|||
$sql_query = "UPDATE account set pwd = '$new_pwd' where ((accountid = '$user_id') and (pwd = '$old_pwd'))"; |
|||
mysqli_query($link, $sql_query); |
|||
$result_message = " |
|||
<script> |
|||
alert('修改成功!'); |
|||
location.href='change-password.php?" . $token_link . "'; |
|||
</script> |
|||
"; |
|||
} else { |
|||
$result_message = " |
|||
<script> |
|||
alert('帳號密碼錯誤!'); |
|||
location.href='change-password.php?" . $token_link . "'; |
|||
</script> |
|||
"; |
|||
} |
|||
echo $result_message; |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
?> |
|||
<script> |
|||
|
|||
<?php |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
|
|||
require_once "database.php"; |
|||
|
|||
$token = $_REQUEST["token"]; |
|||
$token_link = "token=" . $_REQUEST["token"]; |
|||
list($user_id, $enc_user_name, $login_dt) = explode(".", $token); |
|||
|
|||
$old_pwd = $_REQUEST['old_pwd']; |
|||
$new_pwd = $_REQUEST['new_pwd']; |
|||
|
|||
$data = array(); # 設置一個空陣列來放資料 |
|||
$real_user_id = ""; |
|||
$real_pwd = ""; |
|||
$sql = "SELECT * FROM account where ((accountid = '$user_id') and (pwd = '$old_pwd'))"; # sql語法存在變數中 |
|||
$data = mysqli_query($link, $sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
foreach ($data as $data) { |
|||
$real_user_id = $data['accountid']; |
|||
$real_pwd = $data['pwd']; |
|||
} |
|||
|
|||
#如果帳號密碼都正確才可update |
|||
if (strlen($real_user_id) > 0) { |
|||
$sql_query = "UPDATE account set pwd = '$new_pwd' where ((accountid = '$user_id') and (pwd = '$old_pwd'))"; |
|||
mysqli_query($link, $sql_query); |
|||
$result_message = " |
|||
<script> |
|||
alert('修改成功!'); |
|||
location.href='change-password.php?" . $token_link . "'; |
|||
</script> |
|||
"; |
|||
} else { |
|||
$result_message = " |
|||
<script> |
|||
alert('帳號密碼錯誤!'); |
|||
location.href='change-password.php?" . $token_link . "'; |
|||
</script> |
|||
"; |
|||
} |
|||
echo $result_message; |
|||
} |
|||
|
|||
mysqli_close($link); |
|||
?> |
|||
<script> |
|||
|
|||
</script> |
@ -1,77 +1,77 @@ |
|||
<?php |
|||
if ($_REQUEST["token"]) { |
|||
$item = substr($_REQUEST["token"], 0, strpos($_REQUEST["token"], ".")); |
|||
if ($item) { |
|||
require_once "header.php"; |
|||
} |
|||
} |
|||
?> |
|||
|
|||
|
|||
|
|||
<!-- 主頁header --> |
|||
<?php |
|||
require_once "header.php"; |
|||
require_once "database.php"; # 載入db.php來連結資料庫 |
|||
$data = array(); # 設置一個空陣列來放資料 |
|||
$sql = "SELECT * FROM account where (accountid = '$user_id')"; # sql語法存在變數中 |
|||
$data = mysqli_query($link, $sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
|
|||
|
|||
foreach ($data as $data) { |
|||
$phone_call_help = $data['phone_call_help']; |
|||
} |
|||
|
|||
|
|||
?> |
|||
<div> |
|||
<div id="loader"> |
|||
<div class="spinner-border text-primary" role="status"></div> |
|||
</div> |
|||
<div class="appHeader bg-primary text-light"> |
|||
<div class="left"> |
|||
<a href="javascript:;" class="headerButton goBack"> |
|||
<ion-icon name="chevron-back-outline"></ion-icon> |
|||
</a> |
|||
</div> |
|||
<div class="pageTitle">變更密碼</div> |
|||
</div> |
|||
<div id="appCapsule"> |
|||
<div class="section full mt-2"> |
|||
<div class="section-title">請輸入變更前後密碼!</div> |
|||
<div class="wide-block pt-2 pb-2"> |
|||
<form action="change-password-update.php?token=<?php echo $_REQUEST["token"];?>" method="post" enctype="multipart/form-data"> |
|||
<!-- 以下是要傳遞的資料 --> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>" /> |
|||
<!-- 以上是要傳遞的資料 --> |
|||
<div class="form-group boxed"> |
|||
<div class="input-wrapper"> |
|||
<input type="text" class="form-control" name="old_pwd" placeholder="變更前密碼"> |
|||
<i class="clear-input"> |
|||
<ion-icon name="close-circle"></ion-icon> |
|||
</i> |
|||
</div> |
|||
</div> |
|||
<div class="form-group boxed"> |
|||
<div class="input-wrapper"> |
|||
<input type="text" class="form-control" name="new_pwd" placeholder="變更後密碼"> |
|||
<i class="clear-input"> |
|||
<ion-icon name="close-circle"></ion-icon> |
|||
</i> |
|||
</div> |
|||
</div> |
|||
<div class="mt-1"> |
|||
<button type="submit" class="btn btn-primary btn-lg btn-block"> |
|||
確定 |
|||
</button> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- * App Capsule --> |
|||
</div> |
|||
<?php |
|||
|
|||
mysqli_close($link); |
|||
<?php |
|||
if ($_REQUEST["token"]) { |
|||
$item = substr($_REQUEST["token"], 0, strpos($_REQUEST["token"], ".")); |
|||
if ($item) { |
|||
require_once "header.php"; |
|||
} |
|||
} |
|||
?> |
|||
|
|||
|
|||
|
|||
<!-- 主頁header --> |
|||
<?php |
|||
require_once "header.php"; |
|||
require_once "database.php"; # 載入db.php來連結資料庫 |
|||
$data = array(); # 設置一個空陣列來放資料 |
|||
$sql = "SELECT * FROM account where (accountid = '$user_id')"; # sql語法存在變數中 |
|||
$data = mysqli_query($link, $sql); # 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
|
|||
|
|||
foreach ($data as $data) { |
|||
$phone_call_help = $data['phone_call_help']; |
|||
} |
|||
|
|||
|
|||
?> |
|||
<div> |
|||
<div id="loader"> |
|||
<div class="spinner-border text-primary" role="status"></div> |
|||
</div> |
|||
<div class="appHeader bg-primary text-light"> |
|||
<div class="left"> |
|||
<a href="javascript:;" class="headerButton goBack"> |
|||
<ion-icon name="chevron-back-outline"></ion-icon> |
|||
</a> |
|||
</div> |
|||
<div class="pageTitle">變更密碼</div> |
|||
</div> |
|||
<div id="appCapsule"> |
|||
<div class="section full mt-2"> |
|||
<div class="section-title">請輸入變更前後密碼!</div> |
|||
<div class="wide-block pt-2 pb-2"> |
|||
<form action="change-password-update.php?token=<?php echo $_REQUEST["token"];?>" method="post" enctype="multipart/form-data"> |
|||
<!-- 以下是要傳遞的資料 --> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>" /> |
|||
<!-- 以上是要傳遞的資料 --> |
|||
<div class="form-group boxed"> |
|||
<div class="input-wrapper"> |
|||
<input type="text" class="form-control" name="old_pwd" placeholder="變更前密碼"> |
|||
<i class="clear-input"> |
|||
<ion-icon name="close-circle"></ion-icon> |
|||
</i> |
|||
</div> |
|||
</div> |
|||
<div class="form-group boxed"> |
|||
<div class="input-wrapper"> |
|||
<input type="text" class="form-control" name="new_pwd" placeholder="變更後密碼"> |
|||
<i class="clear-input"> |
|||
<ion-icon name="close-circle"></ion-icon> |
|||
</i> |
|||
</div> |
|||
</div> |
|||
<div class="mt-1"> |
|||
<button type="submit" class="btn btn-primary btn-lg btn-block"> |
|||
確定 |
|||
</button> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- * App Capsule --> |
|||
</div> |
|||
<?php |
|||
|
|||
mysqli_close($link); |
|||
?> |
@ -1,86 +1,86 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "combo-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="combono">保養套餐號</label> |
|||
<input type="text" name="combono" id="combono"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="part">部位</label> |
|||
<input type="text" name="part" id="part"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="partid">部位類別</label> |
|||
<input type="text" name="partid" id="partid"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="comboitem">部位類別序號</label> |
|||
<input type="text" name="comboitem" id="comboitem" value="1"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="detail">保養內容</label> |
|||
<input type="text" name="detail" id="detail"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="enable">是否啟用</label> |
|||
<Select name="enable" id="enable" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="1">啟用</Option> |
|||
<Option Value="0">停用</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="enable" id="enable" value="1"> --> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "combo-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="combono">保養套餐號</label> |
|||
<input type="text" name="combono" id="combono"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="part">部位</label> |
|||
<input type="text" name="part" id="part"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="partid">部位類別</label> |
|||
<input type="text" name="partid" id="partid"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="comboitem">部位類別序號</label> |
|||
<input type="text" name="comboitem" id="comboitem" value="1"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="detail">保養內容</label> |
|||
<input type="text" name="detail" id="detail"> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="enable">是否啟用</label> |
|||
<Select name="enable" id="enable" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="1">啟用</Option> |
|||
<Option Value="0">停用</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="enable" id="enable" value="1"> --> |
|||
|
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM combo WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=combo-index.php?function_name=combo&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM combo WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=combo-index.php?function_name=combo&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,93 +1,93 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM combo WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="combo-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="combono">保養套餐號</label> |
|||
<input type="text" name="combono" id="combono" value="<?php echo $data['combono']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="part">部位</label> |
|||
<input type="text" name="part" id="part" value="<?php echo $data['part']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="partid">部位類別</label> |
|||
<input type="text" name="partid" id="partid" value="<?php echo $data['partid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="comboitem">部位類別序號</label> |
|||
<input type="text" name="comboitem" id="comboitem" value="<?php echo $data['comboitem']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="detail">保養內容</label> |
|||
<input type="text" name="detail" id="detail" value="<?php echo $data['detail']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="enable">是否啟用</label> |
|||
<Select name="enable" id="enable" required> |
|||
<?php |
|||
if($data["enable"] == 1){ |
|||
echo "<Option Value='1' selected='selected'>啟用</Option> <Option Value='0'>停用</Option>"; |
|||
}else{ |
|||
echo "<Option Value='0' selected='selected'>停用</Option> <Option Value='1'>啟用</Option>"; |
|||
} |
|||
?> |
|||
</Select> |
|||
<!-- <input type="text" name="enable" id="enable" value=""> --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM combo WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="combo-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="combono">保養套餐號</label> |
|||
<input type="text" name="combono" id="combono" value="<?php echo $data['combono']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="part">部位</label> |
|||
<input type="text" name="part" id="part" value="<?php echo $data['part']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="partid">部位類別</label> |
|||
<input type="text" name="partid" id="partid" value="<?php echo $data['partid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="comboitem">部位類別序號</label> |
|||
<input type="text" name="comboitem" id="comboitem" value="<?php echo $data['comboitem']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="detail">保養內容</label> |
|||
<input type="text" name="detail" id="detail" value="<?php echo $data['detail']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="enable">是否啟用</label> |
|||
<Select name="enable" id="enable" required> |
|||
<?php |
|||
if($data["enable"] == 1){ |
|||
echo "<Option Value='1' selected='selected'>啟用</Option> <Option Value='0'>停用</Option>"; |
|||
}else{ |
|||
echo "<Option Value='0' selected='selected'>停用</Option> <Option Value='1'>啟用</Option>"; |
|||
} |
|||
?> |
|||
</Select> |
|||
<!-- <input type="text" name="enable" id="enable" value=""> --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
|
@ -1,140 +1,140 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM combo $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="combo-create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="combo-create.php?function_name=combo&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:combo-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['combono']; ?></td> |
|||
<td><?php echo $data['part']; ?></td> |
|||
<td><?php echo $data['partid']; ?></td> |
|||
<td><?php echo $data['comboitem']; ?></td> |
|||
<td><?php echo $data['detail']; ?></td> |
|||
<td><?php echo $data['enable']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="combo-edit.php?id=<?php echo $data['id']; ?>&function_name=combo&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="combo-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM combo $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="combo-create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="combo-create.php?function_name=combo&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:combo-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['combono']; ?></td> |
|||
<td><?php echo $data['part']; ?></td> |
|||
<td><?php echo $data['partid']; ?></td> |
|||
<td><?php echo $data['comboitem']; ?></td> |
|||
<td><?php echo $data['detail']; ?></td> |
|||
<td><?php echo $data['enable']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="combo-edit.php?id=<?php echo $data['id']; ?>&function_name=combo&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="combo-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
@ -1,42 +1,42 @@ |
|||
<?php |
|||
$combono= ""; |
|||
$part= ""; |
|||
$partid= ""; |
|||
$comboitem= ""; |
|||
$detail= ""; |
|||
$enable= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$combono_error= ""; |
|||
$part_error= ""; |
|||
$partid_error= ""; |
|||
$comboitem_error= ""; |
|||
$detail_error= ""; |
|||
$enable_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "combo-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO combo(combono, part, partid, comboitem,detail, enable,creater, create_at) VALUES ('$combono', '$part', '$partid', '$comboitem','$detail', '$enable','$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
<?php |
|||
$combono= ""; |
|||
$part= ""; |
|||
$partid= ""; |
|||
$comboitem= ""; |
|||
$detail= ""; |
|||
$enable= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$combono_error= ""; |
|||
$part_error= ""; |
|||
$partid_error= ""; |
|||
$comboitem_error= ""; |
|||
$detail_error= ""; |
|||
$enable_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "combo-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO combo(combono, part, partid, comboitem,detail, enable,creater, create_at) VALUES ('$combono', '$part', '$partid', '$comboitem','$detail', '$enable','$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
|
@ -1,41 +1,41 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$id = $_POST['id']; |
|||
$combono = user_input($_POST["combono"]); |
|||
$part = user_input($_POST["part"]); |
|||
$partid = user_input($_POST["partid"]); |
|||
$comboitem = user_input($_POST["comboitem"]); |
|||
$detail = user_input($_POST["detail"]); |
|||
$enable = user_input($_POST["enable"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$db_query = "UPDATE combo set combono = '$combono', part = '$part', partid = '$partid', comboitem = '$comboitem', detail = '$detail', enable = '$enable',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$id = $_POST['id']; |
|||
$combono = user_input($_POST["combono"]); |
|||
$part = user_input($_POST["part"]); |
|||
$partid = user_input($_POST["partid"]); |
|||
$comboitem = user_input($_POST["comboitem"]); |
|||
$detail = user_input($_POST["detail"]); |
|||
$enable = user_input($_POST["enable"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$db_query = "UPDATE combo set combono = '$combono', part = '$part', partid = '$partid', comboitem = '$comboitem', detail = '$detail', enable = '$enable',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='combo-index.php?function_name=combo&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,54 +1,54 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$combono = user_input($_POST["combono"]); |
|||
$part = user_input($_POST["part"]); |
|||
$partid = user_input($_POST["partid"]); |
|||
$comboitem = user_input($_POST["comboitem"]); |
|||
$detail = user_input($_POST["detail"]); |
|||
$enable = user_input($_POST["enable"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$combono = user_input($_POST["combono"]); |
|||
$part = user_input($_POST["part"]); |
|||
$partid = user_input($_POST["partid"]); |
|||
$comboitem = user_input($_POST["comboitem"]); |
|||
$detail = user_input($_POST["detail"]); |
|||
$enable = user_input($_POST["enable"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
@ -1,126 +1,126 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "contract-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="contracttype">合約類型(必填)</label> |
|||
<Select name="contracttype" id="contracttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="company">公司名稱</label> |
|||
<input type="text" name="company" id="company" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="taxid">統一編號</label> |
|||
<input type="text" name="taxid" id="taxid" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="promiser">立約人</label> |
|||
<input type="text" name="promiser" id="promiser"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶維護帳號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input type="text" name="contractperson" id="contractperson" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input type="text" name="contractaddress" id="contractaddress" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contracttel">業務聯繫人電話(必填)</label> |
|||
<input type="text" name="contracttel" id="contracttel" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input type="text" name="contractemail" id="contractemail" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input type="text" name="contract_employee" id="contract_employee" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="start_date">合約起始年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="<?php echo date('Y-m-d'); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="end_date">合約終止年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="<?php echo date('Y-m-d',strtotime('+364 day')); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "contract-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="contracttype">合約類型(必填)</label> |
|||
<Select name="contracttype" id="contracttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="company">公司名稱</label> |
|||
<input type="text" name="company" id="company" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="taxid">統一編號</label> |
|||
<input type="text" name="taxid" id="taxid" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="promiser">立約人</label> |
|||
<input type="text" name="promiser" id="promiser"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶維護帳號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input type="text" name="contractperson" id="contractperson" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input type="text" name="contractaddress" id="contractaddress" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contracttel">業務聯繫人電話(必填)</label> |
|||
<input type="text" name="contracttel" id="contracttel" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input type="text" name="contractemail" id="contractemail" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input type="text" name="contract_employee" id="contract_employee" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="start_date">合約起始年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="<?php echo date('Y-m-d'); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="end_date">合約終止年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="<?php echo date('Y-m-d',strtotime('+364 day')); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM contract WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=contract-index.php?function_name=contract&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM contract WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=contract-index.php?function_name=contract&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,142 +1,142 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM contract WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="contract-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="contracttype">合約類型</label> |
|||
<Select name="contracttype" id="contracttype" required> |
|||
<?php |
|||
switch ($data['contracttype']) { |
|||
case "A": |
|||
echo "<Option Value='A' selected='selected'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "B": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B' selected='selected'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "C": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C' selected='selected'>單次維修</Option>"; |
|||
break; |
|||
} |
|||
?> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號</label> |
|||
<input type="text" name="contractno" id="contractno" value="<?php echo $data['contractno']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="company">公司名稱</label> |
|||
<input type="text" name="company" id="company" value="<?php echo $data['company']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="taxid">統一編號</label> |
|||
<input type="text" name="taxid" id="taxid" value="<?php echo $data['taxid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="promiser">立約人</label> |
|||
<input type="text" name="promiser" id="promiser" value="<?php echo $data['promiser']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶維護帳號</label> |
|||
<input type="text" name="customerid" id="customerid" value="<?php echo $data['customerid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input type="text" name="contractperson" id="contractperson" value="<?php echo $data['contractperson']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input type="text" name="contractaddress" id="contractaddress" value="<?php echo $data['contractaddress']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contracttel">業務聯繫人電話</label> |
|||
<input type="text" name="contracttel" id="contracttel" value="<?php echo $data['contracttel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input type="text" name="contractemail" id="contractemail" value="<?php echo $data['contractemail']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input type="text" name="contract_employee" id="contract_employee" value="<?php echo $data['contract_employee']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="start_date">合約起始年月日</label> |
|||
<input type="text" name="start_date" id="start_date" value="<?php echo $data['start_date']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="end_date">合約終止年月日</label> |
|||
<input type="text" name="end_date" id="end_date" value="<?php echo $data['end_date']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM contract WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="contract-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="contracttype">合約類型</label> |
|||
<Select name="contracttype" id="contracttype" required> |
|||
<?php |
|||
switch ($data['contracttype']) { |
|||
case "A": |
|||
echo "<Option Value='A' selected='selected'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "B": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B' selected='selected'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "C": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C' selected='selected'>單次維修</Option>"; |
|||
break; |
|||
} |
|||
?> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號</label> |
|||
<input type="text" name="contractno" id="contractno" value="<?php echo $data['contractno']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="company">公司名稱</label> |
|||
<input type="text" name="company" id="company" value="<?php echo $data['company']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="taxid">統一編號</label> |
|||
<input type="text" name="taxid" id="taxid" value="<?php echo $data['taxid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="promiser">立約人</label> |
|||
<input type="text" name="promiser" id="promiser" value="<?php echo $data['promiser']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶維護帳號</label> |
|||
<input type="text" name="customerid" id="customerid" value="<?php echo $data['customerid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input type="text" name="contractperson" id="contractperson" value="<?php echo $data['contractperson']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input type="text" name="contractaddress" id="contractaddress" value="<?php echo $data['contractaddress']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contracttel">業務聯繫人電話</label> |
|||
<input type="text" name="contracttel" id="contracttel" value="<?php echo $data['contracttel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input type="text" name="contractemail" id="contractemail" value="<?php echo $data['contractemail']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input type="text" name="contract_employee" id="contract_employee" value="<?php echo $data['contract_employee']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="start_date">合約起始年月日</label> |
|||
<input type="text" name="start_date" id="start_date" value="<?php echo $data['start_date']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="end_date">合約終止年月日</label> |
|||
<input type="text" name="end_date" id="end_date" value="<?php echo $data['end_date']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
@ -1,162 +1,162 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 工務總處可瀏覽全部資料 |
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; |
|||
$sql = "SELECT * FROM contract $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="contract-create.php?function_name=contract&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:contract-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>客戶維護帳號</th> |
|||
<th>業務聯繫人</th> |
|||
<th>業務聯繫人地址</th> |
|||
<th>業務聯繫人電話</th> |
|||
<th>業務聯繫人郵件地址</th> |
|||
<th>契約人員工號</th> |
|||
<th>合約起始日</th> |
|||
<th>合約終止日</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<!--<th>刪除</th>--> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['contracttype']; ?></td> |
|||
<td><?php echo $data['contractno']; ?></td> |
|||
<td><?php echo $data['company']; ?></td> |
|||
<td><?php echo $data['taxid']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['promiser']; ?></td> |
|||
<td><?php echo $data['customerid']; ?></td> |
|||
<td><?php echo $data['contractperson']; ?></td> |
|||
<td><?php echo $data['contractaddress']; ?></td> |
|||
<td><?php echo $data['contracttel']; ?></td> |
|||
<td><?php echo $data['contractemail']; ?></td> |
|||
<td><?php echo $data['contract_employee']; ?></td> |
|||
<td><?php echo $data['start_date']; ?></td> |
|||
<td><?php echo $data['end_date']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="contract-edit.php?id=<?php echo $data['id']; ?>&function_name=contract&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<!--<td> |
|||
<p> |
|||
<a href="contract-delete.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td>--> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 工務總處可瀏覽全部資料 |
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; |
|||
$sql = "SELECT * FROM contract $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="contract-create.php?function_name=contract&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:contract-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>客戶維護帳號</th> |
|||
<th>業務聯繫人</th> |
|||
<th>業務聯繫人地址</th> |
|||
<th>業務聯繫人電話</th> |
|||
<th>業務聯繫人郵件地址</th> |
|||
<th>契約人員工號</th> |
|||
<th>合約起始日</th> |
|||
<th>合約終止日</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<!--<th>刪除</th>--> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['contracttype']; ?></td> |
|||
<td><?php echo $data['contractno']; ?></td> |
|||
<td><?php echo $data['company']; ?></td> |
|||
<td><?php echo $data['taxid']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['promiser']; ?></td> |
|||
<td><?php echo $data['customerid']; ?></td> |
|||
<td><?php echo $data['contractperson']; ?></td> |
|||
<td><?php echo $data['contractaddress']; ?></td> |
|||
<td><?php echo $data['contracttel']; ?></td> |
|||
<td><?php echo $data['contractemail']; ?></td> |
|||
<td><?php echo $data['contract_employee']; ?></td> |
|||
<td><?php echo $data['start_date']; ?></td> |
|||
<td><?php echo $data['end_date']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="contract-edit.php?id=<?php echo $data['id']; ?>&function_name=contract&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<!--<td> |
|||
<p> |
|||
<a href="contract-delete.php?id=<?php echo $data['id']; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td>--> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
@ -1,61 +1,61 @@ |
|||
<?php |
|||
$contracttype= ""; |
|||
$contractno= ""; |
|||
$company= ""; |
|||
$taxid= ""; |
|||
$address= ""; |
|||
$tel= ""; |
|||
$promiser= ""; |
|||
$customerid= ""; |
|||
$contractperson= ""; |
|||
$contractaddress= ""; |
|||
$contracttel= ""; |
|||
$contractemail= ""; |
|||
$contract_employee= ""; |
|||
$start_date= ""; |
|||
$end_date= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$contracttype_error= ""; |
|||
$contractno_error= ""; |
|||
$company_error= ""; |
|||
$taxid_error= ""; |
|||
$address_error= ""; |
|||
$tel_error= ""; |
|||
$promiser_error= ""; |
|||
$customerid_error= ""; |
|||
$contractperson_error= ""; |
|||
$contractaddress_error= ""; |
|||
$contracttel_error= ""; |
|||
$contractemail_error= ""; |
|||
$contract_employee_error= ""; |
|||
$start_date_error= ""; |
|||
$end_date_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "contract-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$start_date','$end_date', '$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
|
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
<?php |
|||
$contracttype= ""; |
|||
$contractno= ""; |
|||
$company= ""; |
|||
$taxid= ""; |
|||
$address= ""; |
|||
$tel= ""; |
|||
$promiser= ""; |
|||
$customerid= ""; |
|||
$contractperson= ""; |
|||
$contractaddress= ""; |
|||
$contracttel= ""; |
|||
$contractemail= ""; |
|||
$contract_employee= ""; |
|||
$start_date= ""; |
|||
$end_date= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$contracttype_error= ""; |
|||
$contractno_error= ""; |
|||
$company_error= ""; |
|||
$taxid_error= ""; |
|||
$address_error= ""; |
|||
$tel_error= ""; |
|||
$promiser_error= ""; |
|||
$customerid_error= ""; |
|||
$contractperson_error= ""; |
|||
$contractaddress_error= ""; |
|||
$contracttel_error= ""; |
|||
$contractemail_error= ""; |
|||
$contract_employee_error= ""; |
|||
$start_date_error= ""; |
|||
$end_date_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "contract-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$start_date','$end_date', '$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
|
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
|
@ -1,50 +1,50 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
|
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$contracttype = user_input($_POST["contracttype"]); |
|||
$contractno = user_input($_POST["contractno"]); |
|||
$company = user_input($_POST["company"]); |
|||
$taxid = user_input($_POST["taxid"]); |
|||
$address = user_input($_POST["address"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$promiser = user_input($_POST["promiser"]); |
|||
$customerid = user_input($_POST["customerid"]); |
|||
$contractperson = user_input($_POST["contractperson"]); |
|||
$contractaddress = user_input($_POST["contractaddress"]); |
|||
$contracttel = user_input($_POST["contracttel"]); |
|||
$contractemail = user_input($_POST["contractemail"]); |
|||
$contract_employee = user_input($_POST["contract_employee"]); |
|||
$start_date = user_input($_POST["start_date"]); |
|||
$end_date = user_input($_POST["end_date"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$db_query = "UPDATE contract set contracttype = '$contracttype', contractno = '$contractno', company = '$company', taxid = '$taxid', address = '$address', tel = '$tel', promiser = '$promiser', customerid = '$customerid', contractperson = '$contractperson', contractaddress = '$contractaddress', contracttel = '$contracttel', contractemail = '$contractemail', contract_employee = '$contract_employee',start_date = '$start_date',end_date = '$end_date',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
|
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$contracttype = user_input($_POST["contracttype"]); |
|||
$contractno = user_input($_POST["contractno"]); |
|||
$company = user_input($_POST["company"]); |
|||
$taxid = user_input($_POST["taxid"]); |
|||
$address = user_input($_POST["address"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$promiser = user_input($_POST["promiser"]); |
|||
$customerid = user_input($_POST["customerid"]); |
|||
$contractperson = user_input($_POST["contractperson"]); |
|||
$contractaddress = user_input($_POST["contractaddress"]); |
|||
$contracttel = user_input($_POST["contracttel"]); |
|||
$contractemail = user_input($_POST["contractemail"]); |
|||
$contract_employee = user_input($_POST["contract_employee"]); |
|||
$start_date = user_input($_POST["start_date"]); |
|||
$end_date = user_input($_POST["end_date"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$db_query = "UPDATE contract set contracttype = '$contracttype', contractno = '$contractno', company = '$company', taxid = '$taxid', address = '$address', tel = '$tel', promiser = '$promiser', customerid = '$customerid', contractperson = '$contractperson', contractaddress = '$contractaddress', contracttel = '$contracttel', contractemail = '$contractemail', contract_employee = '$contract_employee',start_date = '$start_date',end_date = '$end_date',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='contract-index.php?function_name=contract&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,63 +1,63 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$contracttype = user_input($_POST["contracttype"]); |
|||
$contractno = user_input($_POST["contractno"]); |
|||
$company = user_input($_POST["company"]); |
|||
$taxid = user_input($_POST["taxid"]); |
|||
$address = user_input($_POST["address"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$promiser = user_input($_POST["promiser"]); |
|||
$customerid = user_input($_POST["customerid"]); |
|||
$contractperson = user_input($_POST["contractperson"]); |
|||
$contractaddress = user_input($_POST["contractaddress"]); |
|||
$contracttel = user_input($_POST["contracttel"]); |
|||
$contractemail = user_input($_POST["contractemail"]); |
|||
$contract_employee = user_input($_POST["contract_employee"]); |
|||
$start_date = user_input($_POST["start_date"]); |
|||
$end_date = user_input($_POST["end_date"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$contracttype = user_input($_POST["contracttype"]); |
|||
$contractno = user_input($_POST["contractno"]); |
|||
$company = user_input($_POST["company"]); |
|||
$taxid = user_input($_POST["taxid"]); |
|||
$address = user_input($_POST["address"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$promiser = user_input($_POST["promiser"]); |
|||
$customerid = user_input($_POST["customerid"]); |
|||
$contractperson = user_input($_POST["contractperson"]); |
|||
$contractaddress = user_input($_POST["contractaddress"]); |
|||
$contracttel = user_input($_POST["contracttel"]); |
|||
$contractemail = user_input($_POST["contractemail"]); |
|||
$contract_employee = user_input($_POST["contract_employee"]); |
|||
$start_date = user_input($_POST["start_date"]); |
|||
$end_date = user_input($_POST["end_date"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
@ -1,226 +1,226 @@ |
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
// 查詢提交成功的賬戶信息 |
|||
$accountid=$_REQUEST['accountid']; |
|||
|
|||
if(!empty($accountid)){ |
|||
$sql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$accountdata = mysqli_query($link,$sql); |
|||
$row = mysqli_fetch_array($accountdata, MYSQLI_ASSOC); |
|||
|
|||
} |
|||
|
|||
if($_POST['type']=='contract'){ |
|||
$contracttype = $_POST["contracttype"]; |
|||
$contractno = $_POST["contractno"]; |
|||
$company = $_POST["company"]; |
|||
$taxid = $_POST["taxid"]; |
|||
$address = $_POST["address"]; |
|||
$tel = $_POST["tel"]; |
|||
$promiser = $_POST["promiser"]; |
|||
$customerid = $_POST["customerid"]; |
|||
$contractperson = $_POST["contractperson"]; |
|||
$contractaddress = $_POST["contractaddress"]; |
|||
$contracttel = $_POST["contracttel"]; |
|||
$contractemail = $_POST["contractemail"]; |
|||
$contract_employee = $_POST["contract_employee"]; |
|||
$start_date = $_POST["start_date"]; |
|||
$end_date = $_POST["end_date"]; |
|||
$creater = $_POST["creater"]; |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
//根據合約編號判斷合約是否存在 |
|||
|
|||
$contractsql = "SELECT * FROM contract where contractno='$contractno'"; |
|||
$contract_nums_rows=mysqli_num_rows(mysqli_query($link,$contractsql)); |
|||
if($contract_nums_rows==0) { |
|||
$db_query = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$start_date','$end_date', '$creater', '$create_at')"; |
|||
mysqli_query($link,$db_query); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo "合約添加成功"; |
|||
header('location:custom-create-facility.php?accountid='.$customerid.'&contractno='.$contractno); |
|||
exit(); |
|||
} |
|||
else{ |
|||
echo "<h1 class='text-center'>合約添加失敗</h1>"; |
|||
|
|||
} |
|||
} else{ |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>帳號類型</th> |
|||
<th>帳號</th> |
|||
<th>密碼</th> |
|||
<th>姓名</th> |
|||
<th>電話</th> |
|||
<th>地址</th> |
|||
<th>電子郵件</th> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $row['accounttype']; ?></td> |
|||
<td><?php echo $row['accountid']; ?></td> |
|||
<td><?php echo $row['pwd']; ?></td> |
|||
<td><?php echo $row['name']; ?></td> |
|||
<td><?php echo $row['tel']; ?></td> |
|||
<td><?php echo $row['address']; ?></td> |
|||
<td><?php echo $row['email']; ?></td> |
|||
<td><?php echo $row['lineid']; ?></td> |
|||
<td><?php echo $row['wechatid']; ?></td> |
|||
<td><?php echo $row['repairerid']; ?></td> |
|||
<td><?php echo $row['manager']; ?></td> |
|||
<td><?php echo $row['creater']; ?></td> |
|||
<td><?php echo $row['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
<div class="text-center"> <h3>合約資料添加</h3> </div> |
|||
<form class="form-horizontal" name="account" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contracttype">合約類型(必填)</label> |
|||
<Select class="form-control" name="contracttype" id="contracttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
|
|||
</div> |
|||
<div class="col-md-9 "> |
|||
<button type="submit" class="btn btn-primary btn-lg pull-right" >點擊後提交合約資料</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control" type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="company">公司名稱</label> |
|||
<input class="form-control" type="text" name="company" id="company" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="taxid">統一編號</label> |
|||
<input class="form-control" type="text" name="taxid" id="taxid" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="address">地址</label> |
|||
<input class="form-control" type="text" name="address" id="address" > |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-3" > |
|||
<label for="tel">電話</label> |
|||
<input class="form-control" type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div class="col-md-3" > |
|||
<label for="promiser">立約人</label> |
|||
<input class="form-control" type="text" name="promiser" id="promiser"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="customerid">客戶維護帳號(必填)</label> |
|||
<input class="form-control" type="text" name="customerid" id="customerid" value="<?php echo $row['accountid']; ?>" required> |
|||
</div class="col-md-3"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input class="form-control" type="text" name="contractperson" id="contractperson" > |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input class="form-control" type="text" name="contractaddress" id="contractaddress" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contracttel">業務聯繫人電話(必填)</label> |
|||
<input class="form-control" type="text" name="contracttel" id="contracttel" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input class="form-control" type="text" name="contractemail" id="contractemail" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input class="form-control" type="text" name="contract_employee" id="contract_employee" > |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="start_date">合約起始年月日(必填)</label><br> |
|||
<input class="form-control" type="text" data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="<?php echo date('Y-m-d'); ?>" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="end_date">合約終止年月日(必填)</label><br> |
|||
<input class="form-control" type="text" data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="<?php echo date('Y-m-d',strtotime('+364 day')); ?>" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control" type="text" name="creater" id="creater" value="<?php echo $user_id;?>"> |
|||
|
|||
</div> |
|||
<div class="col-md-3"> |
|||
<input class="form-control" type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control" type="hidden" name="type" id="create_at" value="contract"> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
// 查詢提交成功的賬戶信息 |
|||
$accountid=$_REQUEST['accountid']; |
|||
|
|||
if(!empty($accountid)){ |
|||
$sql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$accountdata = mysqli_query($link,$sql); |
|||
$row = mysqli_fetch_array($accountdata, MYSQLI_ASSOC); |
|||
|
|||
} |
|||
|
|||
if($_POST['type']=='contract'){ |
|||
$contracttype = $_POST["contracttype"]; |
|||
$contractno = $_POST["contractno"]; |
|||
$company = $_POST["company"]; |
|||
$taxid = $_POST["taxid"]; |
|||
$address = $_POST["address"]; |
|||
$tel = $_POST["tel"]; |
|||
$promiser = $_POST["promiser"]; |
|||
$customerid = $_POST["customerid"]; |
|||
$contractperson = $_POST["contractperson"]; |
|||
$contractaddress = $_POST["contractaddress"]; |
|||
$contracttel = $_POST["contracttel"]; |
|||
$contractemail = $_POST["contractemail"]; |
|||
$contract_employee = $_POST["contract_employee"]; |
|||
$start_date = $_POST["start_date"]; |
|||
$end_date = $_POST["end_date"]; |
|||
$creater = $_POST["creater"]; |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
//根據合約編號判斷合約是否存在 |
|||
|
|||
$contractsql = "SELECT * FROM contract where contractno='$contractno'"; |
|||
$contract_nums_rows=mysqli_num_rows(mysqli_query($link,$contractsql)); |
|||
if($contract_nums_rows==0) { |
|||
$db_query = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$start_date','$end_date', '$creater', '$create_at')"; |
|||
mysqli_query($link,$db_query); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo "合約添加成功"; |
|||
header('location:custom-create-facility.php?accountid='.$customerid.'&contractno='.$contractno); |
|||
exit(); |
|||
} |
|||
else{ |
|||
echo "<h1 class='text-center'>合約添加失敗</h1>"; |
|||
|
|||
} |
|||
} else{ |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>帳號類型</th> |
|||
<th>帳號</th> |
|||
<th>密碼</th> |
|||
<th>姓名</th> |
|||
<th>電話</th> |
|||
<th>地址</th> |
|||
<th>電子郵件</th> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $row['accounttype']; ?></td> |
|||
<td><?php echo $row['accountid']; ?></td> |
|||
<td><?php echo $row['pwd']; ?></td> |
|||
<td><?php echo $row['name']; ?></td> |
|||
<td><?php echo $row['tel']; ?></td> |
|||
<td><?php echo $row['address']; ?></td> |
|||
<td><?php echo $row['email']; ?></td> |
|||
<td><?php echo $row['lineid']; ?></td> |
|||
<td><?php echo $row['wechatid']; ?></td> |
|||
<td><?php echo $row['repairerid']; ?></td> |
|||
<td><?php echo $row['manager']; ?></td> |
|||
<td><?php echo $row['creater']; ?></td> |
|||
<td><?php echo $row['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
<div class="text-center"> <h3>合約資料添加</h3> </div> |
|||
<form class="form-horizontal" name="account" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contracttype">合約類型(必填)</label> |
|||
<Select class="form-control" name="contracttype" id="contracttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
|
|||
</div> |
|||
<div class="col-md-9 "> |
|||
<button type="submit" class="btn btn-primary btn-lg pull-right" >點擊後提交合約資料</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control" type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="company">公司名稱</label> |
|||
<input class="form-control" type="text" name="company" id="company" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="taxid">統一編號</label> |
|||
<input class="form-control" type="text" name="taxid" id="taxid" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="address">地址</label> |
|||
<input class="form-control" type="text" name="address" id="address" > |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-3" > |
|||
<label for="tel">電話</label> |
|||
<input class="form-control" type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div class="col-md-3" > |
|||
<label for="promiser">立約人</label> |
|||
<input class="form-control" type="text" name="promiser" id="promiser"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="customerid">客戶維護帳號(必填)</label> |
|||
<input class="form-control" type="text" name="customerid" id="customerid" value="<?php echo $row['accountid']; ?>" required> |
|||
</div class="col-md-3"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input class="form-control" type="text" name="contractperson" id="contractperson" > |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input class="form-control" type="text" name="contractaddress" id="contractaddress" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contracttel">業務聯繫人電話(必填)</label> |
|||
<input class="form-control" type="text" name="contracttel" id="contracttel" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input class="form-control" type="text" name="contractemail" id="contractemail" > |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input class="form-control" type="text" name="contract_employee" id="contract_employee" > |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="start_date">合約起始年月日(必填)</label><br> |
|||
<input class="form-control" type="text" data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="<?php echo date('Y-m-d'); ?>" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="end_date">合約終止年月日(必填)</label><br> |
|||
<input class="form-control" type="text" data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="<?php echo date('Y-m-d',strtotime('+364 day')); ?>" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control" type="text" name="creater" id="creater" value="<?php echo $user_id;?>"> |
|||
|
|||
</div> |
|||
<div class="col-md-3"> |
|||
<input class="form-control" type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control" type="hidden" name="type" id="create_at" value="contract"> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
@ -1,272 +1,272 @@ |
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
// 查詢提交成功的賬戶信息 |
|||
$accountid=$_REQUEST['accountid']; |
|||
$contractno=$_REQUEST['contractno']; |
|||
if(!empty($accountid)&&!empty($contractno)){ |
|||
$accountsql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$accountdata = mysqli_query($link,$accountsql); |
|||
$row = mysqli_fetch_array($accountdata, MYSQLI_ASSOC); |
|||
|
|||
$contractsql = "SELECT * FROM contract where contractno='$contractno'"; |
|||
$contractdata=mysqli_query($link,$contractsql); |
|||
$contractrows= mysqli_fetch_array($contractdata, MYSQLI_ASSOC); |
|||
} |
|||
|
|||
|
|||
if($_POST['type']=='facility'){ |
|||
|
|||
$contractno = $_POST["contractno"];//合同號 |
|||
$customerid = $_POST["customerid"];//客戶編號 |
|||
$creater = $_POST["creater"];//建檔人 |
|||
$create_at = date('Y/m/d H:i:s');//創建時間 |
|||
|
|||
$facilitynos=json_decode($_POST['facilitynos'], true); |
|||
$weights=json_decode($_POST['weights'], true); |
|||
$numberofstops=json_decode($_POST['numberofstops'], true); |
|||
$numberoffloors=json_decode($_POST['numberoffloors'], true); |
|||
$opentypes=json_decode($_POST['opentypes'], true); |
|||
$speeds=json_decode($_POST['speeds'], true); |
|||
$repairtypes=json_decode($_POST['repairtypes'], true); |
|||
$longitudes=json_decode($_POST['longitudes'], true); |
|||
$latitudes=json_decode($_POST['latitudes'], true); |
|||
$addresss=json_decode($_POST['addresss'], true); |
|||
$repairerids=json_decode($_POST['repairerids'], true); |
|||
$repairernames=json_decode($_POST['repairernames'], true); |
|||
$success=0; |
|||
print_r($facilitynos); |
|||
|
|||
for ($i = 0; $i<sizeof($facilitynos); $i++) { |
|||
echo $db_query3 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofstop, numberoffloor,opentype,speed,repairtype,longitude, latitude, address,repairerid,repairername,creater, create_at) VALUES |
|||
('$contractno', '$facilitynos[$i]', '$customerid', '$weights[$i]','$numberofstops[$i]', '$numberoffloors[$i]','$opentypes[$i]','$speeds[$i]','$repairtypes[$i]','$longitudes[$i]', '$latitudes[$i]', '$addresss[$i]','$repairerids[$i]','$repairernames[$i]','$creater', '$create_at')"; |
|||
mysqli_query($link,$db_query3); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
$success++; |
|||
} |
|||
|
|||
} |
|||
|
|||
echo $success; |
|||
exit(); |
|||
if($success>0){ |
|||
$jsonres['code']='200'; |
|||
return json_encode($jsonres); |
|||
// header('location:custom-create-schedule.php?accountid='.$customerid.'&contractno='.$contractno); |
|||
// exit(); |
|||
} ; |
|||
|
|||
} |
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>帳號類型</th> |
|||
<th>帳號</th> |
|||
<th>密碼</th> |
|||
<th>姓名</th> |
|||
<th>電話</th> |
|||
<th>地址</th> |
|||
<th>電子郵件</th> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $row['accounttype']; ?></td> |
|||
<td><?php echo $row['accountid']; ?></td> |
|||
<td><?php echo $row['pwd']; ?></td> |
|||
<td><?php echo $row['name']; ?></td> |
|||
<td><?php echo $row['tel']; ?></td> |
|||
<td><?php echo $row['address']; ?></td> |
|||
<td><?php echo $row['email']; ?></td> |
|||
<td><?php echo $row['lineid']; ?></td> |
|||
<td><?php echo $row['wechatid']; ?></td> |
|||
<td><?php echo $row['repairerid']; ?></td> |
|||
<td><?php echo $row['manager']; ?></td> |
|||
<td><?php echo $row['creater']; ?></td> |
|||
<td><?php echo $row['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>合約類型</th> |
|||
<th>合約號</th> |
|||
<th>公司名稱</th> |
|||
<th>統一編號</th> |
|||
<th>地址</th> |
|||
<th>電話</th> |
|||
<th>立約人</th> |
|||
<th>客戶維護帳號</th> |
|||
<!-- <th>業務聯繫人</th>--> |
|||
<!-- <th>業務聯繫人地址</th>--> |
|||
<th>業務聯繫人電話</th> |
|||
<th>業務聯繫人郵件地址</th> |
|||
<th>契約人員工號</th> |
|||
<th>合約起始日</th> |
|||
<th>合約終止日</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $contractrows['contracttype']; ?></td> |
|||
<td><?php echo $contractrows['contractno']; ?></td> |
|||
<td><?php echo $contractrows['company']; ?></td> |
|||
<td><?php echo $contractrows['taxid']; ?></td> |
|||
<td><?php echo $contractrows['address']; ?></td> |
|||
<td><?php echo $contractrows['tel']; ?></td> |
|||
<td><?php echo $contractrows['promiser']; ?></td> |
|||
<td><?php echo $contractrows['customerid']; ?></td> |
|||
<!-- <td>--><?php //echo $contractrows['contractperson']; ?><!--</td>-->
|
|||
<!-- <td>--><?php //echo $contractrows['contractaddress']; ?><!--</td>-->
|
|||
<td><?php echo $contractrows['contracttel']; ?></td> |
|||
<td><?php echo $contractrows['contractemail']; ?></td> |
|||
<td><?php echo $contractrows['contract_employee']; ?></td> |
|||
<td><?php echo $contractrows['start_date']; ?></td> |
|||
<td><?php echo $contractrows['end_date']; ?></td> |
|||
<td><?php echo $contractrows['creater']; ?></td> |
|||
<td><?php echo $contractrows['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<div class="text-center"> <h3>作番資料添加</h3> </div> |
|||
|
|||
<div class="form-horizontal" > |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control contractno" type="text" id="contractno" value="<?php echo $contractrows['contractno']; ?>" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="customerid">客戶編號(必填)</label> |
|||
<input class="form-control customerid" type="text" id="customerid" value="<?php echo $contractrows['customerid']; ?>" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control creater" type="text" id="creater" value="<?php echo $user_id;?>" > |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<input class="form-control create_at" type="hidden" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control type" type="hidden" id="type" value="facility"> |
|||
</div> |
|||
<div class="col-md-3 "> |
|||
<button onclick="tijiao()" class="btn btn-primary btn-lg pull-right" >點擊後提交作番資料</button> |
|||
</div> |
|||
</div> |
|||
<div id="facility"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input class="form-control facilitynos" type="text" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="weight">重量(必填)</label> |
|||
<input class="form-control weights " type="text" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="numberofstop">停數(必填)</label> |
|||
<input class="form-control numberofstops" type="text" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3" > |
|||
<label for="numberoffloor">樓層數(必填)</label> |
|||
<input class="form-control numberoffloors" type="text" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3" > |
|||
<label for="opentype">開門方式(必填)</label> |
|||
<Select class="form-control opentypes" id="opentype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="CO">CO</Option> |
|||
<Option Value="SO">SO</Option> |
|||
<Option Value="CO-SO">CO-SO</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="speed">速度(必填)</label> |
|||
<input class="form-control speeds" type="text" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
|
|||
</div class="col-md-3"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairtype">維修型態(必填)</label> |
|||
<Select class="form-control repairtypes" id="repairtype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="address">地址</label> |
|||
<input class="form-control addresss" type="text" id="address" > |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input class="form-control longitudes" type="text" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input class="form-control latitudes" type="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairerid">維修人員工號(必填)</label> |
|||
<input class="form-control repairerids" type="text" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairername">維修人員姓名(必填)</label> |
|||
<input class="form-control repairernames" type="text" id="repairername" required> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12 text-center" > |
|||
<h1 onclick="tan('f')" style="cursor: pointer;">+</h1> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
// 查詢提交成功的賬戶信息 |
|||
$accountid=$_REQUEST['accountid']; |
|||
$contractno=$_REQUEST['contractno']; |
|||
if(!empty($accountid)&&!empty($contractno)){ |
|||
$accountsql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$accountdata = mysqli_query($link,$accountsql); |
|||
$row = mysqli_fetch_array($accountdata, MYSQLI_ASSOC); |
|||
|
|||
$contractsql = "SELECT * FROM contract where contractno='$contractno'"; |
|||
$contractdata=mysqli_query($link,$contractsql); |
|||
$contractrows= mysqli_fetch_array($contractdata, MYSQLI_ASSOC); |
|||
} |
|||
|
|||
|
|||
if($_POST['type']=='facility'){ |
|||
|
|||
$contractno = $_POST["contractno"];//合同號 |
|||
$customerid = $_POST["customerid"];//客戶編號 |
|||
$creater = $_POST["creater"];//建檔人 |
|||
$create_at = date('Y/m/d H:i:s');//創建時間 |
|||
|
|||
$facilitynos=json_decode($_POST['facilitynos'], true); |
|||
$weights=json_decode($_POST['weights'], true); |
|||
$numberofstops=json_decode($_POST['numberofstops'], true); |
|||
$numberoffloors=json_decode($_POST['numberoffloors'], true); |
|||
$opentypes=json_decode($_POST['opentypes'], true); |
|||
$speeds=json_decode($_POST['speeds'], true); |
|||
$repairtypes=json_decode($_POST['repairtypes'], true); |
|||
$longitudes=json_decode($_POST['longitudes'], true); |
|||
$latitudes=json_decode($_POST['latitudes'], true); |
|||
$addresss=json_decode($_POST['addresss'], true); |
|||
$repairerids=json_decode($_POST['repairerids'], true); |
|||
$repairernames=json_decode($_POST['repairernames'], true); |
|||
$success=0; |
|||
print_r($facilitynos); |
|||
|
|||
for ($i = 0; $i<sizeof($facilitynos); $i++) { |
|||
echo $db_query3 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofstop, numberoffloor,opentype,speed,repairtype,longitude, latitude, address,repairerid,repairername,creater, create_at) VALUES |
|||
('$contractno', '$facilitynos[$i]', '$customerid', '$weights[$i]','$numberofstops[$i]', '$numberoffloors[$i]','$opentypes[$i]','$speeds[$i]','$repairtypes[$i]','$longitudes[$i]', '$latitudes[$i]', '$addresss[$i]','$repairerids[$i]','$repairernames[$i]','$creater', '$create_at')"; |
|||
mysqli_query($link,$db_query3); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
$success++; |
|||
} |
|||
|
|||
} |
|||
|
|||
echo $success; |
|||
exit(); |
|||
if($success>0){ |
|||
$jsonres['code']='200'; |
|||
return json_encode($jsonres); |
|||
// header('location:custom-create-schedule.php?accountid='.$customerid.'&contractno='.$contractno); |
|||
// exit(); |
|||
} ; |
|||
|
|||
} |
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>帳號類型</th> |
|||
<th>帳號</th> |
|||
<th>密碼</th> |
|||
<th>姓名</th> |
|||
<th>電話</th> |
|||
<th>地址</th> |
|||
<th>電子郵件</th> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $row['accounttype']; ?></td> |
|||
<td><?php echo $row['accountid']; ?></td> |
|||
<td><?php echo $row['pwd']; ?></td> |
|||
<td><?php echo $row['name']; ?></td> |
|||
<td><?php echo $row['tel']; ?></td> |
|||
<td><?php echo $row['address']; ?></td> |
|||
<td><?php echo $row['email']; ?></td> |
|||
<td><?php echo $row['lineid']; ?></td> |
|||
<td><?php echo $row['wechatid']; ?></td> |
|||
<td><?php echo $row['repairerid']; ?></td> |
|||
<td><?php echo $row['manager']; ?></td> |
|||
<td><?php echo $row['creater']; ?></td> |
|||
<td><?php echo $row['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>合約類型</th> |
|||
<th>合約號</th> |
|||
<th>公司名稱</th> |
|||
<th>統一編號</th> |
|||
<th>地址</th> |
|||
<th>電話</th> |
|||
<th>立約人</th> |
|||
<th>客戶維護帳號</th> |
|||
<!-- <th>業務聯繫人</th>--> |
|||
<!-- <th>業務聯繫人地址</th>--> |
|||
<th>業務聯繫人電話</th> |
|||
<th>業務聯繫人郵件地址</th> |
|||
<th>契約人員工號</th> |
|||
<th>合約起始日</th> |
|||
<th>合約終止日</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $contractrows['contracttype']; ?></td> |
|||
<td><?php echo $contractrows['contractno']; ?></td> |
|||
<td><?php echo $contractrows['company']; ?></td> |
|||
<td><?php echo $contractrows['taxid']; ?></td> |
|||
<td><?php echo $contractrows['address']; ?></td> |
|||
<td><?php echo $contractrows['tel']; ?></td> |
|||
<td><?php echo $contractrows['promiser']; ?></td> |
|||
<td><?php echo $contractrows['customerid']; ?></td> |
|||
<!-- <td>--><?php //echo $contractrows['contractperson']; ?><!--</td>-->
|
|||
<!-- <td>--><?php //echo $contractrows['contractaddress']; ?><!--</td>-->
|
|||
<td><?php echo $contractrows['contracttel']; ?></td> |
|||
<td><?php echo $contractrows['contractemail']; ?></td> |
|||
<td><?php echo $contractrows['contract_employee']; ?></td> |
|||
<td><?php echo $contractrows['start_date']; ?></td> |
|||
<td><?php echo $contractrows['end_date']; ?></td> |
|||
<td><?php echo $contractrows['creater']; ?></td> |
|||
<td><?php echo $contractrows['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<div class="text-center"> <h3>作番資料添加</h3> </div> |
|||
|
|||
<div class="form-horizontal" > |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control contractno" type="text" id="contractno" value="<?php echo $contractrows['contractno']; ?>" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="customerid">客戶編號(必填)</label> |
|||
<input class="form-control customerid" type="text" id="customerid" value="<?php echo $contractrows['customerid']; ?>" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control creater" type="text" id="creater" value="<?php echo $user_id;?>" > |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<input class="form-control create_at" type="hidden" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control type" type="hidden" id="type" value="facility"> |
|||
</div> |
|||
<div class="col-md-3 "> |
|||
<button onclick="tijiao()" class="btn btn-primary btn-lg pull-right" >點擊後提交作番資料</button> |
|||
</div> |
|||
</div> |
|||
<div id="facility"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input class="form-control facilitynos" type="text" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="weight">重量(必填)</label> |
|||
<input class="form-control weights " type="text" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="numberofstop">停數(必填)</label> |
|||
<input class="form-control numberofstops" type="text" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3" > |
|||
<label for="numberoffloor">樓層數(必填)</label> |
|||
<input class="form-control numberoffloors" type="text" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3" > |
|||
<label for="opentype">開門方式(必填)</label> |
|||
<Select class="form-control opentypes" id="opentype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="CO">CO</Option> |
|||
<Option Value="SO">SO</Option> |
|||
<Option Value="CO-SO">CO-SO</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="speed">速度(必填)</label> |
|||
<input class="form-control speeds" type="text" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
|
|||
</div class="col-md-3"> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairtype">維修型態(必填)</label> |
|||
<Select class="form-control repairtypes" id="repairtype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="address">地址</label> |
|||
<input class="form-control addresss" type="text" id="address" > |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input class="form-control longitudes" type="text" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input class="form-control latitudes" type="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairerid">維修人員工號(必填)</label> |
|||
<input class="form-control repairerids" type="text" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairername">維修人員姓名(必填)</label> |
|||
<input class="form-control repairernames" type="text" id="repairername" required> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-12 text-center" > |
|||
<h1 onclick="tan('f')" style="cursor: pointer;">+</h1> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
@ -1,230 +1,230 @@ |
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
$accountid=$_REQUEST['accountid']; |
|||
$contractno=$_REQUEST['contractno']; |
|||
$facilitydata=[];//初始化 |
|||
if(!empty($accountid)&&!empty($contractno)){ |
|||
//查詢賬戶信息 |
|||
$accountsql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$accountdata = mysqli_query($link,$accountsql); |
|||
$row = mysqli_fetch_array($accountdata, MYSQLI_ASSOC); |
|||
//查詢合同信息 |
|||
$contractsql = "SELECT * FROM contract where contractno='$contractno'"; |
|||
$contractdata=mysqli_query($link,$contractsql); |
|||
$contractrows= mysqli_fetch_array($contractdata, MYSQLI_ASSOC); |
|||
//查詢作番信息(可能多條) |
|||
$facilitysql = "SELECT * FROM facility where contractno='$contractno'"; |
|||
$facilitydata=mysqli_query($link,$facilitysql); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>帳號類型</th> |
|||
<th>帳號</th> |
|||
<th>密碼</th> |
|||
<th>姓名</th> |
|||
<th>電話</th> |
|||
<th>地址</th> |
|||
<th>電子郵件</th> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $row['accounttype']; ?></td> |
|||
<td><?php echo $row['accountid']; ?></td> |
|||
<td><?php echo $row['pwd']; ?></td> |
|||
<td><?php echo $row['name']; ?></td> |
|||
<td><?php echo $row['tel']; ?></td> |
|||
<td><?php echo $row['address']; ?></td> |
|||
<td><?php echo $row['email']; ?></td> |
|||
<td><?php echo $row['lineid']; ?></td> |
|||
<td><?php echo $row['wechatid']; ?></td> |
|||
<td><?php echo $row['repairerid']; ?></td> |
|||
<td><?php echo $row['manager']; ?></td> |
|||
<td><?php echo $row['creater']; ?></td> |
|||
<td><?php echo $row['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>合約類型</th> |
|||
<th>合約號</th> |
|||
<th>公司名稱</th> |
|||
<th>統一編號</th> |
|||
<th>地址</th> |
|||
<th>電話</th> |
|||
<th>立約人</th> |
|||
<th>客戶維護帳號</th> |
|||
<!-- <th>業務聯繫人</th>--> |
|||
<!-- <th>業務聯繫人地址</th>--> |
|||
<th>業務聯繫人電話</th> |
|||
<th>業務聯繫人郵件地址</th> |
|||
<th>契約人員工號</th> |
|||
<th>合約起始日</th> |
|||
<th>合約終止日</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $contractrows['contracttype']; ?></td> |
|||
<td><?php echo $contractrows['contractno']; ?></td> |
|||
<td><?php echo $contractrows['company']; ?></td> |
|||
<td><?php echo $contractrows['taxid']; ?></td> |
|||
<td><?php echo $contractrows['address']; ?></td> |
|||
<td><?php echo $contractrows['tel']; ?></td> |
|||
<td><?php echo $contractrows['promiser']; ?></td> |
|||
<td><?php echo $contractrows['customerid']; ?></td> |
|||
<!-- <td>--><?php //echo $contractrows['contractperson']; ?><!--</td>-->
|
|||
<!-- <td>--><?php //echo $contractrows['contractaddress']; ?><!--</td>-->
|
|||
<td><?php echo $contractrows['contracttel']; ?></td> |
|||
<td><?php echo $contractrows['contractemail']; ?></td> |
|||
<td><?php echo $contractrows['contract_employee']; ?></td> |
|||
<td><?php echo $contractrows['start_date']; ?></td> |
|||
<td><?php echo $contractrows['end_date']; ?></td> |
|||
<td><?php echo $contractrows['creater']; ?></td> |
|||
<td><?php echo $contractrows['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<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> |
|||
<th>維修型態</th> |
|||
<th>經度</th> |
|||
<th>緯度</th> |
|||
<th>地址</th> |
|||
<th>維修人員工號</th> |
|||
<th>維修人員姓名</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach($facilitydata as $data) : ?> |
|||
<tr> |
|||
|
|||
<td><?php echo $data['contractno']; ?></td> |
|||
<td><?php echo $data['facilityno']; ?></td> |
|||
<td><?php echo $data['customerid']; ?></td> |
|||
<td><?php echo $data['weight']; ?></td> |
|||
<td><?php echo $data['numberofstop']; ?></td> |
|||
<td><?php echo $data['numberoffloor']; ?></td> |
|||
<td><?php echo $data['opentype']; ?></td> |
|||
<td><?php echo $data['speed']; ?></td> |
|||
<td><?php echo $data['repairtype']; ?></td> |
|||
<td><?php echo $data['longitude']; ?></td> |
|||
<td><?php echo $data['latitude']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['repairerid']; ?></td> |
|||
<td><?php echo $data['repairername']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
|
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
<div class="text-center"> <h3>保養行程資料添加</h3> </div> |
|||
<div class="form-horizontal"> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control contractno" type="text" id="contractno" value="<?php echo $contractrows['contractno']; ?>" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control creater" type="text" id="creater" value="<?php echo $user_id;?>" > |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<input class="form-control create_at" type="hidden" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control type" type="hidden" id="type" value="schedule"> |
|||
</div> |
|||
<div class="col-md-6 "> |
|||
<button onclick="tijiaosch()" class="btn btn-primary btn-lg pull-right" >點擊後提交保養行程資料</button> |
|||
</div> |
|||
</div> |
|||
<div id="schedule"> |
|||
<div class="form-group" > |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input class="form-control facilitynos" type="text" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label for="combono">保養套餐編號(必填)</label> |
|||
<input class="form-control combonos" type="text" id="combono" required> |
|||
</div> |
|||
<div class="col-md-2"> |
|||
<label for="duedate">應保養日期(必填)</label> |
|||
<input class="form-control duedates" type="text " id="duedate" value="<?php echo date('Y/m/d'); ?>" required> |
|||
|
|||
</div> |
|||
<div class="col-md-2"> |
|||
<label for="repairerid">保養人員工號(必填)</label> |
|||
<input class="form-control repairerids" type="text" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairername">保養人員姓名(必填)</label> |
|||
<input class="form-control repairernames" type="text" id="repairername" required> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-12 text-center" > |
|||
<h1 onclick="tan('s')" style="cursor: pointer;">+</h1> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
$accountid=$_REQUEST['accountid']; |
|||
$contractno=$_REQUEST['contractno']; |
|||
$facilitydata=[];//初始化 |
|||
if(!empty($accountid)&&!empty($contractno)){ |
|||
//查詢賬戶信息 |
|||
$accountsql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$accountdata = mysqli_query($link,$accountsql); |
|||
$row = mysqli_fetch_array($accountdata, MYSQLI_ASSOC); |
|||
//查詢合同信息 |
|||
$contractsql = "SELECT * FROM contract where contractno='$contractno'"; |
|||
$contractdata=mysqli_query($link,$contractsql); |
|||
$contractrows= mysqli_fetch_array($contractdata, MYSQLI_ASSOC); |
|||
//查詢作番信息(可能多條) |
|||
$facilitysql = "SELECT * FROM facility where contractno='$contractno'"; |
|||
$facilitydata=mysqli_query($link,$facilitysql); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>帳號類型</th> |
|||
<th>帳號</th> |
|||
<th>密碼</th> |
|||
<th>姓名</th> |
|||
<th>電話</th> |
|||
<th>地址</th> |
|||
<th>電子郵件</th> |
|||
<th>Line ID</th> |
|||
<th>微信id</th> |
|||
<th>維修ID</th> |
|||
<th>直屬主管</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $row['accounttype']; ?></td> |
|||
<td><?php echo $row['accountid']; ?></td> |
|||
<td><?php echo $row['pwd']; ?></td> |
|||
<td><?php echo $row['name']; ?></td> |
|||
<td><?php echo $row['tel']; ?></td> |
|||
<td><?php echo $row['address']; ?></td> |
|||
<td><?php echo $row['email']; ?></td> |
|||
<td><?php echo $row['lineid']; ?></td> |
|||
<td><?php echo $row['wechatid']; ?></td> |
|||
<td><?php echo $row['repairerid']; ?></td> |
|||
<td><?php echo $row['manager']; ?></td> |
|||
<td><?php echo $row['creater']; ?></td> |
|||
<td><?php echo $row['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<table class="table table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>合約類型</th> |
|||
<th>合約號</th> |
|||
<th>公司名稱</th> |
|||
<th>統一編號</th> |
|||
<th>地址</th> |
|||
<th>電話</th> |
|||
<th>立約人</th> |
|||
<th>客戶維護帳號</th> |
|||
<!-- <th>業務聯繫人</th>--> |
|||
<!-- <th>業務聯繫人地址</th>--> |
|||
<th>業務聯繫人電話</th> |
|||
<th>業務聯繫人郵件地址</th> |
|||
<th>契約人員工號</th> |
|||
<th>合約起始日</th> |
|||
<th>合約終止日</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
|
|||
<td><?php echo $contractrows['contracttype']; ?></td> |
|||
<td><?php echo $contractrows['contractno']; ?></td> |
|||
<td><?php echo $contractrows['company']; ?></td> |
|||
<td><?php echo $contractrows['taxid']; ?></td> |
|||
<td><?php echo $contractrows['address']; ?></td> |
|||
<td><?php echo $contractrows['tel']; ?></td> |
|||
<td><?php echo $contractrows['promiser']; ?></td> |
|||
<td><?php echo $contractrows['customerid']; ?></td> |
|||
<!-- <td>--><?php //echo $contractrows['contractperson']; ?><!--</td>-->
|
|||
<!-- <td>--><?php //echo $contractrows['contractaddress']; ?><!--</td>-->
|
|||
<td><?php echo $contractrows['contracttel']; ?></td> |
|||
<td><?php echo $contractrows['contractemail']; ?></td> |
|||
<td><?php echo $contractrows['contract_employee']; ?></td> |
|||
<td><?php echo $contractrows['start_date']; ?></td> |
|||
<td><?php echo $contractrows['end_date']; ?></td> |
|||
<td><?php echo $contractrows['creater']; ?></td> |
|||
<td><?php echo $contractrows['create_at']; ?></td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
<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> |
|||
<th>維修型態</th> |
|||
<th>經度</th> |
|||
<th>緯度</th> |
|||
<th>地址</th> |
|||
<th>維修人員工號</th> |
|||
<th>維修人員姓名</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach($facilitydata as $data) : ?> |
|||
<tr> |
|||
|
|||
<td><?php echo $data['contractno']; ?></td> |
|||
<td><?php echo $data['facilityno']; ?></td> |
|||
<td><?php echo $data['customerid']; ?></td> |
|||
<td><?php echo $data['weight']; ?></td> |
|||
<td><?php echo $data['numberofstop']; ?></td> |
|||
<td><?php echo $data['numberoffloor']; ?></td> |
|||
<td><?php echo $data['opentype']; ?></td> |
|||
<td><?php echo $data['speed']; ?></td> |
|||
<td><?php echo $data['repairtype']; ?></td> |
|||
<td><?php echo $data['longitude']; ?></td> |
|||
<td><?php echo $data['latitude']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['repairerid']; ?></td> |
|||
<td><?php echo $data['repairername']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
|
|||
|
|||
|
|||
</tbody> |
|||
</table> |
|||
<div class="text-center"> <h3>保養行程資料添加</h3> </div> |
|||
<div class="form-horizontal"> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control contractno" type="text" id="contractno" value="<?php echo $contractrows['contractno']; ?>" required> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control creater" type="text" id="creater" value="<?php echo $user_id;?>" > |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<input class="form-control create_at" type="hidden" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control type" type="hidden" id="type" value="schedule"> |
|||
</div> |
|||
<div class="col-md-6 "> |
|||
<button onclick="tijiaosch()" class="btn btn-primary btn-lg pull-right" >點擊後提交保養行程資料</button> |
|||
</div> |
|||
</div> |
|||
<div id="schedule"> |
|||
<div class="form-group" > |
|||
<div class="col-md-3"> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input class="form-control facilitynos" type="text" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div class="col-md-2"> |
|||
<label for="combono">保養套餐編號(必填)</label> |
|||
<input class="form-control combonos" type="text" id="combono" required> |
|||
</div> |
|||
<div class="col-md-2"> |
|||
<label for="duedate">應保養日期(必填)</label> |
|||
<input class="form-control duedates" type="text " id="duedate" value="<?php echo date('Y/m/d'); ?>" required> |
|||
|
|||
</div> |
|||
<div class="col-md-2"> |
|||
<label for="repairerid">保養人員工號(必填)</label> |
|||
<input class="form-control repairerids" type="text" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairername">保養人員姓名(必填)</label> |
|||
<input class="form-control repairernames" type="text" id="repairername" required> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-12 text-center" > |
|||
<h1 onclick="tan('s')" style="cursor: pointer;">+</h1> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -1,383 +1,383 @@ |
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
if($_POST['type']=='account'){ |
|||
$accounttype = $_POST["accounttype"]; |
|||
$accountid = $_POST["accountid"]; |
|||
$pwd = $_POST["pwd"]; |
|||
$name = $_POST["name"]; |
|||
$tel = $_POST["tel"]; |
|||
$address = $_POST["address"]; |
|||
$email = $_POST["email"]; |
|||
$lineid = $_POST["lineid"]; |
|||
$wechatid = $_POST["wechatid"]; |
|||
$phone_call_help = $_POST["phone_call_help"]; |
|||
$chat_for_help = $_POST["chat_for_help"]; |
|||
$remote_help = $_POST["remote_help"]; |
|||
$repairerid = $_POST["repairerid"]; |
|||
$manager = $_POST["manager"]; |
|||
$creater = $_POST["creater"]; |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
//查詢是否重複錄入 |
|||
|
|||
$sql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$data = mysqli_query($link,$sql); |
|||
$nums_rows=mysqli_num_rows($data); |
|||
if($nums_rows==0){ |
|||
//添加用戶 |
|||
$db_query = "INSERT INTO account(accounttype, accountid, pwd, name, tel, address, email, lineid, wechatid, phone_call_help, chat_for_help, remote_help, repairerid, manager, creater, create_at) VALUES ('$accounttype', '$accountid','$pwd', '$name', '$tel', '$address', '$email', '$lineid', '$wechatid', '$phone_call_help', '$chat_for_help', '$remote_help', '$repairerid', '$manager', '$creater', '$create_at')"; |
|||
mysqli_query($link,$db_query); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
header('location:custom-create-contract.php?accountid='.$accountid); |
|||
exit(); |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
|
|||
} |
|||
} |
|||
else{ |
|||
echo "<h1 class='text-center'>賬戶已經存在</h1>"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
?> |
|||
<script type ='text/JavaScript'> |
|||
function accounthide(){ |
|||
$('#accountadd').addClass('hidden'); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<div class="text-center"> <h3>賬號資料添加</h3> </div> |
|||
<form class="form-horizontal" name="account" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="accounttype">帳號類別(必選)</label> |
|||
<Select class="form-control" name="accounttype" id="accounttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">客戶</Option> |
|||
<Option Value="B">保養人員</Option> |
|||
<Option Value="C">檢查人員</Option> |
|||
<Option Value="D">契約人員</Option> |
|||
<Option Value="E">管理人員</Option> |
|||
</Select> |
|||
</div> |
|||
<div class="col-md-9 "> |
|||
<button type="submit" class="btn btn-primary btn-lg pull-right" >點擊後提交賬戶資料</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="accountid">員工、個人客戶ID或公司客戶統編(必填)</label> |
|||
<input class="form-control" type="text" name="accountid" id="accountid" placeholder="請輸入員工、個人客戶ID或公司客戶統編(必填)" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="pwd">密碼(必填)</label> |
|||
<input class="form-control" type="text" name="pwd" id="pwd" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="name">姓名(必填)</label> |
|||
<input class="form-control" type="text" name="name" id="name" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="tel">電話</label> |
|||
<input class="form-control" type="text" name="tel" id="tel" maxlength="16"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="address">地址</label> |
|||
<input class="form-control" type="text" name="address" id="address"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="email">電子郵箱</label> |
|||
<input class="form-control" type="text" name="email" id="email"> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="lineid">Line ID</label> |
|||
<input class="form-control" type="text" name="lineid" id="lineid"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="wechatid">微信ID</label> |
|||
<input class="form-control" type="text" name="wechatid" id="wechatid"> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="phone_call_help">聯絡手機號(必填)</label> |
|||
<input class="form-control" type="text" name="phone_call_help" id="phone_call_help" maxlength="16" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="chat_for_help">線上文字客服</label> |
|||
<input class="form-control" type="text" name="chat_for_help" id="chat_for_help"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="remote_help">遠端視頻帳號</label> |
|||
<input class="form-control" type="text" name="remote_help" id="remote_help"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairerid">服務與支持人員工號(客戶必填)</label> |
|||
<input class="form-control" type="text" name="repairerid" id="repairerid" maxlength="10"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="manager">直屬主管工號(保養人員必填)</label> |
|||
<input class="form-control" type="text" name="manager" id="manager" maxlength="10"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control" type="text" name="creater" id="creater" value="<?php echo $user_id;?>"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<input class="form-control" type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control" type="hidden" name="type" id="create_at" value="account"> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
<div class="container hidden"> |
|||
<label for="fileToUpload">合約資料添加</label> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
<div> |
|||
<label for="contracttype">合約類型(必填)</label> |
|||
<Select name="contracttype" id="contracttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control" type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="company">公司名稱</label> |
|||
<input type="text" name="company" id="company" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="taxid">統一編號</label> |
|||
<input type="text" name="taxid" id="taxid" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="promiser">立約人</label> |
|||
<input type="text" name="promiser" id="promiser"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶維護帳號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input type="text" name="contractperson" id="contractperson" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input type="text" name="contractaddress" id="contractaddress" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contracttel">業務聯繫人電話(必填)</label> |
|||
<input type="text" name="contracttel" id="contracttel" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input type="text" name="contractemail" id="contractemail" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input type="text" name="contract_employee" id="contract_employee" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="start_date">合約起始年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="<?php echo date('Y-m-d'); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="end_date">合約終止年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="<?php echo date('Y-m-d',strtotime('+364 day')); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater"> |
|||
<!-- <p class="error">--><?php //echo $creater_error; ?><!--</p>-->
|
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<!-- <p class="error">--><?php //echo $create_at_error; ?><!--</p>-->
|
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
|
|||
</form |
|||
</div> |
|||
|
|||
<div class="container hidden"> |
|||
<label for="fileToUpload">作番資料添加</label> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input type="text" name="facilityno" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶編號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="weight">重量(必填)</label> |
|||
<input type="text" name="weight" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberofstop">停數(必填)</label> |
|||
<input type="text" name="numberofstop" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberoffloor">樓層數(必填)</label> |
|||
<input type="text" name="numberoffloor" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="opentype">開門方式(必填)</label> |
|||
<Select name="opentype" id="opentype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="CO">CO</Option> |
|||
<Option Value="SO">SO</Option> |
|||
<Option Value="CO-SO">CO-SO</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="opentype" id="opentype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="speed">速度(必填)</label> |
|||
<input type="text" name="speed" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairtype">維修型態(必填)</label> |
|||
<Select name="repairtype" id="repairtype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="repairtype" id="repairtype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input type="text" name="longitude" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input type="latitude" name="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">維修人員工號(必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairername">維修人員姓名(必填)</label> |
|||
<input type="text" name="repairername" id="repairername" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater"> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
|
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<?php |
|||
// 載入db.php來連結資料庫 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
|
|||
if($_POST['type']=='account'){ |
|||
$accounttype = $_POST["accounttype"]; |
|||
$accountid = $_POST["accountid"]; |
|||
$pwd = $_POST["pwd"]; |
|||
$name = $_POST["name"]; |
|||
$tel = $_POST["tel"]; |
|||
$address = $_POST["address"]; |
|||
$email = $_POST["email"]; |
|||
$lineid = $_POST["lineid"]; |
|||
$wechatid = $_POST["wechatid"]; |
|||
$phone_call_help = $_POST["phone_call_help"]; |
|||
$chat_for_help = $_POST["chat_for_help"]; |
|||
$remote_help = $_POST["remote_help"]; |
|||
$repairerid = $_POST["repairerid"]; |
|||
$manager = $_POST["manager"]; |
|||
$creater = $_POST["creater"]; |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
//查詢是否重複錄入 |
|||
|
|||
$sql = "SELECT * FROM account where accountid='$accountid'"; |
|||
$data = mysqli_query($link,$sql); |
|||
$nums_rows=mysqli_num_rows($data); |
|||
if($nums_rows==0){ |
|||
//添加用戶 |
|||
$db_query = "INSERT INTO account(accounttype, accountid, pwd, name, tel, address, email, lineid, wechatid, phone_call_help, chat_for_help, remote_help, repairerid, manager, creater, create_at) VALUES ('$accounttype', '$accountid','$pwd', '$name', '$tel', '$address', '$email', '$lineid', '$wechatid', '$phone_call_help', '$chat_for_help', '$remote_help', '$repairerid', '$manager', '$creater', '$create_at')"; |
|||
mysqli_query($link,$db_query); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
header('location:custom-create-contract.php?accountid='.$accountid); |
|||
exit(); |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
|
|||
} |
|||
} |
|||
else{ |
|||
echo "<h1 class='text-center'>賬戶已經存在</h1>"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
?> |
|||
<script type ='text/JavaScript'> |
|||
function accounthide(){ |
|||
$('#accountadd').addClass('hidden'); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
<div class="container" id="accountadd"> |
|||
<div class="text-center"> <h3>賬號資料添加</h3> </div> |
|||
<form class="form-horizontal" name="account" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="accounttype">帳號類別(必選)</label> |
|||
<Select class="form-control" name="accounttype" id="accounttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">客戶</Option> |
|||
<Option Value="B">保養人員</Option> |
|||
<Option Value="C">檢查人員</Option> |
|||
<Option Value="D">契約人員</Option> |
|||
<Option Value="E">管理人員</Option> |
|||
</Select> |
|||
</div> |
|||
<div class="col-md-9 "> |
|||
<button type="submit" class="btn btn-primary btn-lg pull-right" >點擊後提交賬戶資料</button> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="accountid">員工、個人客戶ID或公司客戶統編(必填)</label> |
|||
<input class="form-control" type="text" name="accountid" id="accountid" placeholder="請輸入員工、個人客戶ID或公司客戶統編(必填)" required> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="pwd">密碼(必填)</label> |
|||
<input class="form-control" type="text" name="pwd" id="pwd" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="name">姓名(必填)</label> |
|||
<input class="form-control" type="text" name="name" id="name" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="tel">電話</label> |
|||
<input class="form-control" type="text" name="tel" id="tel" maxlength="16"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="address">地址</label> |
|||
<input class="form-control" type="text" name="address" id="address"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="email">電子郵箱</label> |
|||
<input class="form-control" type="text" name="email" id="email"> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="lineid">Line ID</label> |
|||
<input class="form-control" type="text" name="lineid" id="lineid"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="wechatid">微信ID</label> |
|||
<input class="form-control" type="text" name="wechatid" id="wechatid"> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="phone_call_help">聯絡手機號(必填)</label> |
|||
<input class="form-control" type="text" name="phone_call_help" id="phone_call_help" maxlength="16" required> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="chat_for_help">線上文字客服</label> |
|||
<input class="form-control" type="text" name="chat_for_help" id="chat_for_help"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="remote_help">遠端視頻帳號</label> |
|||
<input class="form-control" type="text" name="remote_help" id="remote_help"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="repairerid">服務與支持人員工號(客戶必填)</label> |
|||
<input class="form-control" type="text" name="repairerid" id="repairerid" maxlength="10"> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="manager">直屬主管工號(保養人員必填)</label> |
|||
<input class="form-control" type="text" name="manager" id="manager" maxlength="10"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<label for="creater">建檔人</label> |
|||
<input class="form-control" type="text" name="creater" id="creater" value="<?php echo $user_id;?>"> |
|||
</div> |
|||
|
|||
<div class="col-md-3"> |
|||
<input class="form-control" type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<input class="form-control" type="hidden" name="type" id="create_at" value="account"> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
<div class="container hidden"> |
|||
<label for="fileToUpload">合約資料添加</label> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
<div> |
|||
<label for="contracttype">合約類型(必填)</label> |
|||
<Select name="contracttype" id="contracttype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input class="form-control" type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="company">公司名稱</label> |
|||
<input type="text" name="company" id="company" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="taxid">統一編號</label> |
|||
<input type="text" name="taxid" id="taxid" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="promiser">立約人</label> |
|||
<input type="text" name="promiser" id="promiser"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶維護帳號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractperson">業務聯繫人</label> |
|||
<input type="text" name="contractperson" id="contractperson" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractaddress">業務聯繫人地址</label> |
|||
<input type="text" name="contractaddress" id="contractaddress" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contracttel">業務聯繫人電話(必填)</label> |
|||
<input type="text" name="contracttel" id="contracttel" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contractemail">業務聯繫人郵件地址</label> |
|||
<input type="text" name="contractemail" id="contractemail" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contract_employee">契約人員工號</label> |
|||
<input type="text" name="contract_employee" id="contract_employee" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="start_date">合約起始年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="start_date" id="start_date" value="<?php echo date('Y-m-d'); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="end_date">合約終止年月日(必填)</label><br> |
|||
<input type="text" data-date-format="yyyy-mm-dd" name="end_date" id="end_date" value="<?php echo date('Y-m-d',strtotime('+364 day')); ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater"> |
|||
<!-- <p class="error">--><?php //echo $creater_error; ?><!--</p>-->
|
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<!-- <p class="error">--><?php //echo $create_at_error; ?><!--</p>-->
|
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
|
|||
</form |
|||
</div> |
|||
|
|||
<div class="container hidden"> |
|||
<label for="fileToUpload">作番資料添加</label> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input type="text" name="facilityno" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶編號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="weight">重量(必填)</label> |
|||
<input type="text" name="weight" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberofstop">停數(必填)</label> |
|||
<input type="text" name="numberofstop" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberoffloor">樓層數(必填)</label> |
|||
<input type="text" name="numberoffloor" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="opentype">開門方式(必填)</label> |
|||
<Select name="opentype" id="opentype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="CO">CO</Option> |
|||
<Option Value="SO">SO</Option> |
|||
<Option Value="CO-SO">CO-SO</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="opentype" id="opentype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="speed">速度(必填)</label> |
|||
<input type="text" name="speed" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairtype">維修型態(必填)</label> |
|||
<Select name="repairtype" id="repairtype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="repairtype" id="repairtype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input type="text" name="longitude" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input type="latitude" name="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">維修人員工號(必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairername">維修人員姓名(必填)</label> |
|||
<input type="text" name="repairername" id="repairername" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater"> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
|
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
|
@ -1,111 +1,111 @@ |
|||
<?php |
|||
#error_reporting(E_ALL); |
|||
#ini_set('display_errors', "On"); |
|||
ob_start(); |
|||
$user_id = '73376'; |
|||
require_once "../database.php"; |
|||
/** |
|||
|
|||
|
|||
|
|||
*/ |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
// include "header.php"; |
|||
// 载入db.php来连结资料库 |
|||
require_once "../database.php"; |
|||
require_once '../PHPExcel/PHPExcel.php'; |
|||
require_once '../PHPExcel/IOFactory.php'; |
|||
//$target_dir = "../inv-uploads/"; |
|||
$target_file = 'data_collection_merge_template.xlsx'; |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5'); //支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007'); //支持xlsx是 |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
$data = []; |
|||
$data['yyyymm'] = $_POST['yyyymm']; |
|||
$i = 2; |
|||
$sql_get = "select *From ec_purchase_order where yyyymm='" . $data['yyyymm'] . "' "; |
|||
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); |
|||
#excel 第一行 从B3-H3 |
|||
foreach ($res_get as $key => $val) { |
|||
// var_dump( $key); |
|||
// $_val = $sheet->getCellByColumnAndRow(0, $i++)->getCalculatedValue(); |
|||
//if ($_val == "") return; |
|||
// $value = $sheet->getCell($key)->getValue(); |
|||
// var_dump( $val); |
|||
# 1 銀行編碼 |
|||
$sheet->setCellValueExplicit('A' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#2 繳款帳號 |
|||
$sheet->setCellValueExplicit('B' . ($key + 2), date("Y-m-d"), \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#3 客戶屬性 |
|||
$sheet->setCellValueExplicit('C' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#4 幣別 |
|||
$sheet->setCellValueExplicit('D' . ($key + 2), 'TWD', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#5 客戶代號 |
|||
$sheet->setCellValueExplicit('E' . ($key + 2), substr($val['customerid'], 1), \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
# 6客戶名稱 |
|||
$sheet->setCellValueExplicit('F' . ($key + 2), $val['customer_name'], \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
# 7 繳費說明1 |
|||
$sheet->setCellValueExplicit('G' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
# 8 繳費說明2 |
|||
$sheet->setCellValueExplicit('H' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#9 繳費說明3 |
|||
$sheet->setCellValueExplicit('I' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#10 繳費說明3 |
|||
$sheet->setCellValueExplicit('J' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#11 繳費說明4 |
|||
$sheet->setCellValueExplicit('K' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#12繳費說明5 |
|||
$sheet->setCellValueExplicit('L' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#13 繳款截止日 |
|||
$sheet->setCellValueExplicit('M' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#14 期別說明 |
|||
$sheet->setCellValueExplicit('N' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#15 繳費通路別-銀行 |
|||
$sheet->setCellValueExplicit('O' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#16 繳費通路別-郵局 |
|||
$sheet->setCellValueExplicit('P' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#17 應繳總額 |
|||
$sheet->setCellValueExplicit('Q' . ($key + 2), $val['summary_price'], \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#18 保留欄1 |
|||
$sheet->setCellValueExplicit('R' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#19 保留欄2 |
|||
$sheet->setCellValueExplicit('S' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#20 收費項目 |
|||
$sheet->setCellValueExplicit('T' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#21 應繳金額 |
|||
$sheet->setCellValueExplicit('U' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#22 說明 |
|||
$sheet->setCellValueExplicit('V' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#23 收費項目 |
|||
$sheet->setCellValueExplicit('W' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#24 應繳金額 |
|||
$sheet->setCellValueExplicit('X' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#25 說明 |
|||
$sheet->setCellValueExplicit('Y' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#26 結尾符號 |
|||
$sheet->setCellValueExplicit('Z' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
// $data[$excel_field_mapping[$key]] = (empty($value) || $value == '') ? 'null' : "'" . $value . "'"; //读取excel数据到数组 |
|||
} |
|||
|
|||
//页面导出 |
|||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
|||
//设置下载的文件名称 |
|||
header('Content-Disposition: attachment;filename=' . urlencode('代收資料匯入檔') . '.xlsx'); |
|||
header('Cache-Control: max-age=0'); |
|||
header('Cache-Control: max-age=1'); |
|||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|||
header('Cache-Control: cache, must-revalidate'); |
|||
header('Pragma: public'); |
|||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
|||
$objWriter->save('php://output'); |
|||
} |
|||
<?php |
|||
#error_reporting(E_ALL); |
|||
#ini_set('display_errors', "On"); |
|||
ob_start(); |
|||
$user_id = '73376'; |
|||
require_once "../database.php"; |
|||
/** |
|||
|
|||
|
|||
|
|||
*/ |
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
// include "header.php"; |
|||
// 载入db.php来连结资料库 |
|||
require_once "../database.php"; |
|||
require_once '../PHPExcel/PHPExcel.php'; |
|||
require_once '../PHPExcel/IOFactory.php'; |
|||
//$target_dir = "../inv-uploads/"; |
|||
$target_file = 'data_collection_merge_template.xlsx'; |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5'); //支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007'); //支持xlsx是 |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
$data = []; |
|||
$data['yyyymm'] = $_POST['yyyymm']; |
|||
$i = 2; |
|||
$sql_get = "select *From ec_purchase_order where yyyymm='" . $data['yyyymm'] . "' "; |
|||
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); |
|||
#excel 第一行 从B3-H3 |
|||
foreach ($res_get as $key => $val) { |
|||
// var_dump( $key); |
|||
// $_val = $sheet->getCellByColumnAndRow(0, $i++)->getCalculatedValue(); |
|||
//if ($_val == "") return; |
|||
// $value = $sheet->getCell($key)->getValue(); |
|||
// var_dump( $val); |
|||
# 1 銀行編碼 |
|||
$sheet->setCellValueExplicit('A' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#2 繳款帳號 |
|||
$sheet->setCellValueExplicit('B' . ($key + 2), date("Y-m-d"), \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#3 客戶屬性 |
|||
$sheet->setCellValueExplicit('C' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#4 幣別 |
|||
$sheet->setCellValueExplicit('D' . ($key + 2), 'TWD', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#5 客戶代號 |
|||
$sheet->setCellValueExplicit('E' . ($key + 2), substr($val['customerid'], 1), \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
# 6客戶名稱 |
|||
$sheet->setCellValueExplicit('F' . ($key + 2), $val['customer_name'], \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
# 7 繳費說明1 |
|||
$sheet->setCellValueExplicit('G' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
# 8 繳費說明2 |
|||
$sheet->setCellValueExplicit('H' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#9 繳費說明3 |
|||
$sheet->setCellValueExplicit('I' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#10 繳費說明3 |
|||
$sheet->setCellValueExplicit('J' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#11 繳費說明4 |
|||
$sheet->setCellValueExplicit('K' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#12繳費說明5 |
|||
$sheet->setCellValueExplicit('L' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#13 繳款截止日 |
|||
$sheet->setCellValueExplicit('M' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#14 期別說明 |
|||
$sheet->setCellValueExplicit('N' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#15 繳費通路別-銀行 |
|||
$sheet->setCellValueExplicit('O' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#16 繳費通路別-郵局 |
|||
$sheet->setCellValueExplicit('P' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#17 應繳總額 |
|||
$sheet->setCellValueExplicit('Q' . ($key + 2), $val['summary_price'], \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#18 保留欄1 |
|||
$sheet->setCellValueExplicit('R' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#19 保留欄2 |
|||
$sheet->setCellValueExplicit('S' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#20 收費項目 |
|||
$sheet->setCellValueExplicit('T' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#21 應繳金額 |
|||
$sheet->setCellValueExplicit('U' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#22 說明 |
|||
$sheet->setCellValueExplicit('V' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#23 收費項目 |
|||
$sheet->setCellValueExplicit('W' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#24 應繳金額 |
|||
$sheet->setCellValueExplicit('X' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#25 說明 |
|||
$sheet->setCellValueExplicit('Y' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
#26 結尾符號 |
|||
$sheet->setCellValueExplicit('Z' . ($key + 2), '', \PHPExcel_Cell_DataType::TYPE_STRING); |
|||
// $data[$excel_field_mapping[$key]] = (empty($value) || $value == '') ? 'null' : "'" . $value . "'"; //读取excel数据到数组 |
|||
} |
|||
|
|||
//页面导出 |
|||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
|||
//设置下载的文件名称 |
|||
header('Content-Disposition: attachment;filename=' . urlencode('代收資料匯入檔') . '.xlsx'); |
|||
header('Cache-Control: max-age=0'); |
|||
header('Cache-Control: max-age=1'); |
|||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|||
header('Cache-Control: cache, must-revalidate'); |
|||
header('Pragma: public'); |
|||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); |
|||
$objWriter->save('php://output'); |
|||
} |
|||
|
@ -1,42 +1,42 @@ |
|||
<?php |
|||
date_default_timezone_set("Asia/Taipei"); |
|||
$envFile = __DIR__ . '/../.env'; // .env 文件的路径 |
|||
|
|||
if (file_exists($envFile)) { |
|||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|||
if ($lines !== false) { |
|||
foreach ($lines as $line) { |
|||
list($key, $value) = explode('=', $line, 2); |
|||
$key = trim($key); |
|||
$value = trim($value); |
|||
// 设置环境变量 |
|||
putenv("$key=$value"); |
|||
} |
|||
} |
|||
} |
|||
date_default_timezone_set("Asia/Taipei"); |
|||
$host = getenv('DB_HOST'); |
|||
$dbuser = getenv('DB_USERNAME'); |
|||
$dbpassword = getenv('DB_PASSWORD'); |
|||
$dbname = getenv('DB_DATABASE'); |
|||
$link = mysqli_connect($host, $dbuser, $dbpassword, $dbname); |
|||
|
|||
$sqlsrv = getenv('sqlsrv'); |
|||
$Database = getenv('Database'); |
|||
$Account = getenv('Account'); |
|||
$Password = getenv('Password'); |
|||
try { |
|||
$conn = new PDO("sqlsrv:Server=$sqlsrv;Database=$Database", "$Account", "$Password"); |
|||
if ($conn) { |
|||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|||
} |
|||
} catch (PDOException $e) { |
|||
echo "fail"; |
|||
echo $e->getMessage(); |
|||
} |
|||
if ($link) { |
|||
mysqli_query($link, 'SET NAMES utf8'); |
|||
// echo "正確連接資料庫"; |
|||
} else { |
|||
echo "不正確連接資料庫</br>" . mysqli_connect_error(); |
|||
} |
|||
<?php |
|||
date_default_timezone_set("Asia/Taipei"); |
|||
$envFile = __DIR__ . '/../.env'; // .env 文件的路径 |
|||
|
|||
if (file_exists($envFile)) { |
|||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|||
if ($lines !== false) { |
|||
foreach ($lines as $line) { |
|||
list($key, $value) = explode('=', $line, 2); |
|||
$key = trim($key); |
|||
$value = trim($value); |
|||
// 设置环境变量 |
|||
putenv("$key=$value"); |
|||
} |
|||
} |
|||
} |
|||
date_default_timezone_set("Asia/Taipei"); |
|||
$host = getenv('DB_HOST'); |
|||
$dbuser = getenv('DB_USERNAME'); |
|||
$dbpassword = getenv('DB_PASSWORD'); |
|||
$dbname = getenv('DB_DATABASE'); |
|||
$link = mysqli_connect($host, $dbuser, $dbpassword, $dbname); |
|||
|
|||
$sqlsrv = getenv('sqlsrv'); |
|||
$Database = getenv('Database'); |
|||
$Account = getenv('Account'); |
|||
$Password = getenv('Password'); |
|||
try { |
|||
$conn = new PDO("sqlsrv:Server=$sqlsrv;Database=$Database", "$Account", "$Password"); |
|||
if ($conn) { |
|||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|||
} |
|||
} catch (PDOException $e) { |
|||
echo "fail"; |
|||
echo $e->getMessage(); |
|||
} |
|||
if ($link) { |
|||
mysqli_query($link, 'SET NAMES utf8'); |
|||
// echo "正確連接資料庫"; |
|||
} else { |
|||
echo "不正確連接資料庫</br>" . mysqli_connect_error(); |
|||
} |
|||
|
@ -1,92 +1,92 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "delivery_info-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="deliver_no">貨運單號</label> |
|||
<input type="text" name="deliver_no" id="deliver_no" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_id">訂購人編號</label> |
|||
<input type="text" name="orderer_id" id="orderer_id" value="<?php echo $user_id; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_name">訂購人姓名</label> |
|||
<input type="text" name="orderer_name" id="orderer_name" value="<?php echo $user_name; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contact_person">收件聯繫人</label> |
|||
<input type="text" name="contact_person" id="contact_person" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">連絡電話</label> |
|||
<input type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">收件地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="total_price_equipments">物料總價</label> |
|||
<input type="text" name="total_price_equipments" id="total_price_equipments" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="delivery_fee">運費</label> |
|||
<input type="text" name="delivery_fee" id="delivery_fee" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tax_fee">稅金</label> |
|||
<input type="text" name="tax_fee" id="tax_fee" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="summation">合計</label> |
|||
<input type="text" name="summation" id="summation" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "delivery_info-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="deliver_no">貨運單號</label> |
|||
<input type="text" name="deliver_no" id="deliver_no" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_id">訂購人編號</label> |
|||
<input type="text" name="orderer_id" id="orderer_id" value="<?php echo $user_id; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_name">訂購人姓名</label> |
|||
<input type="text" name="orderer_name" id="orderer_name" value="<?php echo $user_name; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contact_person">收件聯繫人</label> |
|||
<input type="text" name="contact_person" id="contact_person" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">連絡電話</label> |
|||
<input type="text" name="tel" id="tel" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">收件地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="total_price_equipments">物料總價</label> |
|||
<input type="text" name="total_price_equipments" id="total_price_equipments" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="delivery_fee">運費</label> |
|||
<input type="text" name="delivery_fee" id="delivery_fee" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tax_fee">稅金</label> |
|||
<input type="text" name="tax_fee" id="tax_fee" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="summation">合計</label> |
|||
<input type="text" name="summation" id="summation" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM delivery_info WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=delivery_info-index.php?function_name=delivery_info&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM delivery_info WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=delivery_info-index.php?function_name=delivery_info&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,104 +1,104 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM delivery_info WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="delivery_info-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="deliver_no">貨運單號</label> |
|||
<input type="text" name="deliver_no" id="deliver_no" value="<?php echo $data['deliver_no']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_id">訂購人編號</label> |
|||
<input type="text" name="orderer_id" id="orderer_id" value="<?php echo $data['orderer_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_name">訂購人姓名</label> |
|||
<input type="text" name="orderer_name" id="orderer_name" value="<?php echo $data['orderer_name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contact_person">收件聯繫人</label> |
|||
<input type="text" name="contact_person" id="contact_person" value="<?php echo $data['contact_person']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">連絡電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">收件地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="total_price_equipments">物料總價</label> |
|||
<input type="text" name="total_price_equipments" id="total_price_equipments" value="<?php echo $data['total_price_equipments']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="delivery_fee">運費</label> |
|||
<input type="text" name="delivery_fee" id="delivery_fee" value="<?php echo $data['delivery_fee']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tax_fee">稅金</label> |
|||
<input type="text" name="tax_fee" id="tax_fee" value="<?php echo $data['tax_fee']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="summation">合計</label> |
|||
<input type="text" name="summation" id="summation" value="<?php echo $data['summation']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo $data['create_at']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM delivery_info WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="delivery_info-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="deliver_no">貨運單號</label> |
|||
<input type="text" name="deliver_no" id="deliver_no" value="<?php echo $data['deliver_no']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_id">訂購人編號</label> |
|||
<input type="text" name="orderer_id" id="orderer_id" value="<?php echo $data['orderer_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="orderer_name">訂購人姓名</label> |
|||
<input type="text" name="orderer_name" id="orderer_name" value="<?php echo $data['orderer_name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="contact_person">收件聯繫人</label> |
|||
<input type="text" name="contact_person" id="contact_person" value="<?php echo $data['contact_person']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">連絡電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">收件地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="total_price_equipments">物料總價</label> |
|||
<input type="text" name="total_price_equipments" id="total_price_equipments" value="<?php echo $data['total_price_equipments']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="delivery_fee">運費</label> |
|||
<input type="text" name="delivery_fee" id="delivery_fee" value="<?php echo $data['delivery_fee']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tax_fee">稅金</label> |
|||
<input type="text" name="tax_fee" id="tax_fee" value="<?php echo $data['tax_fee']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="summation">合計</label> |
|||
<input type="text" name="summation" id="summation" value="<?php echo $data['summation']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php echo $data['create_at']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
|
@ -1,147 +1,147 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id, "orderer_id"); |
|||
$sql = "SELECT * FROM delivery_info $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
|
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="delivery_info-create.php?function_name=delivery_info&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:delivery_info-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>運費</th> |
|||
<th>稅金</th> |
|||
<th>合計</th> |
|||
<th>建檔日</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['deliver_no']; ?></td> |
|||
<td><?php echo $data['orderer_id']; ?></td> |
|||
<td><?php echo $data['orderer_name']; ?></td> |
|||
<td><?php echo $data['contact_person']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['total_price_equipments']; ?></td> |
|||
<td><?php echo $data['delivery_fee']; ?></td> |
|||
<td><?php echo $data['tax_fee']; ?></td> |
|||
<td><?php echo $data['summation']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_info-edit.php?id=<?php echo $data['id']; ?>&function_name=delivery_info&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_info-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id, "orderer_id"); |
|||
$sql = "SELECT * FROM delivery_info $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
|
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="delivery_info-create.php?function_name=delivery_info&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:delivery_info-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>運費</th> |
|||
<th>稅金</th> |
|||
<th>合計</th> |
|||
<th>建檔日</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['deliver_no']; ?></td> |
|||
<td><?php echo $data['orderer_id']; ?></td> |
|||
<td><?php echo $data['orderer_name']; ?></td> |
|||
<td><?php echo $data['contact_person']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['total_price_equipments']; ?></td> |
|||
<td><?php echo $data['delivery_fee']; ?></td> |
|||
<td><?php echo $data['tax_fee']; ?></td> |
|||
<td><?php echo $data['summation']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_info-edit.php?id=<?php echo $data['id']; ?>&function_name=delivery_info&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_info-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
@ -1,49 +1,49 @@ |
|||
<?php |
|||
$deliver_no= ""; |
|||
$orderer_id= ""; |
|||
$orderer_name= ""; |
|||
$contact_person= ""; |
|||
$tel= ""; |
|||
$address= ""; |
|||
$total_price_equipments= ""; |
|||
$delivery_fee= ""; |
|||
$tax_fee= ""; |
|||
$summation= ""; |
|||
$create_at= ""; |
|||
|
|||
|
|||
$deliver_no_error= ""; |
|||
$orderer_id_error= ""; |
|||
$orderer_name_error= ""; |
|||
$contact_person_error= ""; |
|||
$tel_error= ""; |
|||
$address_error= ""; |
|||
$total_price_equipments_error= ""; |
|||
$delivery_fee_error= ""; |
|||
$tax_fee_error= ""; |
|||
$summation_error= ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "delivery_info-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO delivery_info (deliver_no, orderer_id, orderer_name, contact_person, tel, address, total_price_equipments, delivery_fee, tax_fee, summation, create_at) VALUES ('$deliver_no', '$orderer_id', '$orderer_name', '$contact_person','$tel', '$address', '$total_price_equipments', '$delivery_fee', '$tax_fee', '$summation', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
<?php |
|||
$deliver_no= ""; |
|||
$orderer_id= ""; |
|||
$orderer_name= ""; |
|||
$contact_person= ""; |
|||
$tel= ""; |
|||
$address= ""; |
|||
$total_price_equipments= ""; |
|||
$delivery_fee= ""; |
|||
$tax_fee= ""; |
|||
$summation= ""; |
|||
$create_at= ""; |
|||
|
|||
|
|||
$deliver_no_error= ""; |
|||
$orderer_id_error= ""; |
|||
$orderer_name_error= ""; |
|||
$contact_person_error= ""; |
|||
$tel_error= ""; |
|||
$address_error= ""; |
|||
$total_price_equipments_error= ""; |
|||
$delivery_fee_error= ""; |
|||
$tax_fee_error= ""; |
|||
$summation_error= ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "delivery_info-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO delivery_info (deliver_no, orderer_id, orderer_name, contact_person, tel, address, total_price_equipments, delivery_fee, tax_fee, summation, create_at) VALUES ('$deliver_no', '$orderer_id', '$orderer_name', '$contact_person','$tel', '$address', '$total_price_equipments', '$delivery_fee', '$tax_fee', '$summation', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
|
@ -1,44 +1,44 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$deliver_no = user_input($_POST["deliver_no"]); |
|||
$orderer_id = user_input($_POST["orderer_id"]); |
|||
$orderer_name = user_input($_POST["orderer_name"]); |
|||
$contact_person = user_input($_POST["contact_person"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$total_price_equipments = user_input($_POST["total_price_equipments"]); |
|||
$delivery_fee = user_input($_POST["delivery_fee"]); |
|||
$tax_fee = user_input($_POST["tax_fee"]); |
|||
$summation = user_input($_POST["summation"]); |
|||
$create_at = user_input($_POST["create_at"]); |
|||
|
|||
$db_query = "UPDATE delivery_info set deliver_no = '$deliver_no', orderer_id = '$orderer_id', orderer_name = '$orderer_name', contact_person = '$contact_person', tel = '$tel', address = '$address', total_price_equipments = '$total_price_equipments', delivery_fee = '$delivery_fee', tax_fee = '$tax_fee', summation = '$summation', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
header("location: delivery_info-index.php"); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$deliver_no = user_input($_POST["deliver_no"]); |
|||
$orderer_id = user_input($_POST["orderer_id"]); |
|||
$orderer_name = user_input($_POST["orderer_name"]); |
|||
$contact_person = user_input($_POST["contact_person"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$total_price_equipments = user_input($_POST["total_price_equipments"]); |
|||
$delivery_fee = user_input($_POST["delivery_fee"]); |
|||
$tax_fee = user_input($_POST["tax_fee"]); |
|||
$summation = user_input($_POST["summation"]); |
|||
$create_at = user_input($_POST["create_at"]); |
|||
|
|||
$db_query = "UPDATE delivery_info set deliver_no = '$deliver_no', orderer_id = '$orderer_id', orderer_name = '$orderer_name', contact_person = '$contact_person', tel = '$tel', address = '$address', total_price_equipments = '$total_price_equipments', delivery_fee = '$delivery_fee', tax_fee = '$tax_fee', summation = '$summation', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
header("location: delivery_info-index.php"); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_info-index.php?function_name=delivery_info&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,58 +1,58 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$deliver_no = user_input($_POST["deliver_no"]); |
|||
$orderer_id = user_input($_POST["orderer_id"]); |
|||
$orderer_name = user_input($_POST["orderer_name"]); |
|||
$contact_person = user_input($_POST["contact_person"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$total_price_equipments = user_input($_POST["total_price_equipments"]); |
|||
$delivery_fee = user_input($_POST["delivery_fee"]); |
|||
$tax_fee = user_input($_POST["tax_fee"]); |
|||
$summation = user_input($_POST["summation"]); |
|||
$create_at = user_input($_POST["create_at"]); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$deliver_no = user_input($_POST["deliver_no"]); |
|||
$orderer_id = user_input($_POST["orderer_id"]); |
|||
$orderer_name = user_input($_POST["orderer_name"]); |
|||
$contact_person = user_input($_POST["contact_person"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$address = user_input($_POST["address"]); |
|||
$total_price_equipments = user_input($_POST["total_price_equipments"]); |
|||
$delivery_fee = user_input($_POST["delivery_fee"]); |
|||
$tax_fee = user_input($_POST["tax_fee"]); |
|||
$summation = user_input($_POST["summation"]); |
|||
$create_at = user_input($_POST["create_at"]); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
@ -1,66 +1,66 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "delivery_log-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="delivery_no">貨運單號</label> |
|||
<input type="text" name="delivery_no" id="delivery_no" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="issue_time">實際抵達時間</label> |
|||
<input type="text" name="issue_time" id="issue_time" value="<?php echo date('Y/m/d H:i:s'); ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="location">地點</label> |
|||
<input type="text" name="location" id="location"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="memo">備註</label> |
|||
<input type="text" name="memo" id="memo" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "delivery_log-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="delivery_no">貨運單號</label> |
|||
<input type="text" name="delivery_no" id="delivery_no" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="issue_time">實際抵達時間</label> |
|||
<input type="text" name="issue_time" id="issue_time" value="<?php echo date('Y/m/d H:i:s'); ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="location">地點</label> |
|||
<input type="text" name="location" id="location"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="memo">備註</label> |
|||
<input type="text" name="memo" id="memo" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM delivery_log WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=delivery_log-index.php?function_name=delivery_log&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM delivery_log WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=delivery_log-index.php?function_name=delivery_log&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,75 +1,75 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM delivery_log WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="delivery_log-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="delivery_no">貨運單號</label> |
|||
<input type="text" name="delivery_no" id="delivery_no" value="<?php echo $data['deliver_no']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="issue_time">實際抵達時間</label> |
|||
<input type="text" name="issue_time" id="issue_time" value="<?php echo $data['issue_time']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="location">地點</label> |
|||
<input type="text" name="location" id="location" value="<?php echo $data['location']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="memo">備註</label> |
|||
<input type="text" name="memo" id="memo" value="<?php echo $data['memo']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM delivery_log WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="delivery_log-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="delivery_no">貨運單號</label> |
|||
<input type="text" name="delivery_no" id="delivery_no" value="<?php echo $data['deliver_no']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="issue_time">實際抵達時間</label> |
|||
<input type="text" name="issue_time" id="issue_time" value="<?php echo $data['issue_time']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="location">地點</label> |
|||
<input type="text" name="location" id="location" value="<?php echo $data['location']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="memo">備註</label> |
|||
<input type="text" name="memo" id="memo" value="<?php echo $data['memo']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div> |
|||
<br> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
|
@ -1,137 +1,137 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM delivery_log $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
|
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="delivery_log-create.php?function_name=delivery_log&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:delivery_log-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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 ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['deliver_no']; ?></td> |
|||
<td><?php echo $data['issue_time']; ?></td> |
|||
<td><?php echo $data['location']; ?></td> |
|||
<td><?php echo $data['memo']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_log-edit.php?id=<?php echo $data['id']; ?>&function_name=delivery_log&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_log-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM delivery_log $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
|
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="delivery_log-create.php?function_name=delivery_log&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:delivery_log-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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 ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['deliver_no']; ?></td> |
|||
<td><?php echo $data['issue_time']; ?></td> |
|||
<td><?php echo $data['location']; ?></td> |
|||
<td><?php echo $data['memo']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_log-edit.php?id=<?php echo $data['id']; ?>&function_name=delivery_log&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="delivery_log-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
@ -1,38 +1,38 @@ |
|||
<?php |
|||
$deliver_no= ""; |
|||
$issue_time= ""; |
|||
$location= ""; |
|||
$memo= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$deliver_no_error= ""; |
|||
$issue_time_error= ""; |
|||
$location_error= ""; |
|||
$memo_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "delivery_log-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO delivery_log(deliver_no, issue_time, location, memo,creater,create_at) VALUES ('$deliver_no', '$issue_time', '$location', '$memo','$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
<?php |
|||
$deliver_no= ""; |
|||
$issue_time= ""; |
|||
$location= ""; |
|||
$memo= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
|
|||
$deliver_no_error= ""; |
|||
$issue_time_error= ""; |
|||
$location_error= ""; |
|||
$memo_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "delivery_log-user-input.php"; |
|||
|
|||
$db_query = "INSERT INTO delivery_log(deliver_no, issue_time, location, memo,creater,create_at) VALUES ('$deliver_no', '$issue_time', '$location', '$memo','$creater', '$create_at')"; |
|||
$result = mysqli_query($link,$db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
|
@ -1,38 +1,38 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$deliver_no = user_input($_POST["delivery_no"]); |
|||
$issue_time = user_input($_POST["issue_time"]); |
|||
$location = user_input($_POST["location"]); |
|||
$memo = user_input($_POST["memo"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$db_query = "UPDATE delivery_log set deliver_no = '$deliver_no', issue_time = '$issue_time', location = '$location', memo = '$memo',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$deliver_no = user_input($_POST["delivery_no"]); |
|||
$issue_time = user_input($_POST["issue_time"]); |
|||
$location = user_input($_POST["location"]); |
|||
$memo = user_input($_POST["memo"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$db_query = "UPDATE delivery_log set deliver_no = '$deliver_no', issue_time = '$issue_time', location = '$location', memo = '$memo',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='delivery_log-index.php?function_name=delivery_log&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,53 +1,53 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$deliver_no = user_input($_POST["delivery_no"]); |
|||
$issue_time = user_input($_POST["issue_time"]); |
|||
$location = user_input($_POST["location"]); |
|||
$memo = user_input($_POST["memo"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
|
|||
$deliver_no = user_input($_POST["delivery_no"]); |
|||
$issue_time = user_input($_POST["issue_time"]); |
|||
$location = user_input($_POST["location"]); |
|||
$memo = user_input($_POST["memo"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
@ -1,4 +1,4 @@ |
|||
void main() { |
|||
String name="测试"; |
|||
print("1231v\${name}/${name}"); |
|||
} |
|||
void main() { |
|||
String name="测试"; |
|||
print("1231v\${name}/${name}"); |
|||
} |
|||
|
@ -1,188 +1,188 @@ |
|||
<?php |
|||
//error_reporting(E_ALL); |
|||
ob_start(); |
|||
//ini_set('display_errors', "On"); |
|||
|
|||
require_once "../database.php"; |
|||
|
|||
$customerid = ""; |
|||
$inv_customer_id = ""; |
|||
$inv_customer_name = ""; |
|||
$customer_name = ""; |
|||
$item_no = ""; |
|||
$item_name = ""; |
|||
$num = ""; |
|||
$unit_price = ""; |
|||
$pre_tax_price = ""; |
|||
$business_tax = ""; |
|||
$summary_price = ""; |
|||
#$delivery_date = ""; |
|||
$summary = ""; |
|||
$contract_begin_date = ""; |
|||
$contract_end_date = ""; |
|||
$salesman = ""; |
|||
$operator_name = ""; |
|||
$enter_date = ""; |
|||
$creater = ""; |
|||
$create_at = ""; |
|||
#excel字段與mysql表字段映射 |
|||
$excel_field_mapping = [ |
|||
0 => "date_seq", |
|||
1 => "customerid", |
|||
2 => "inv_customer_id", |
|||
3 => "inv_customer_name", |
|||
4 => "customer_name", |
|||
5 => "item_no", |
|||
6 => "item_name", |
|||
7 => "num", |
|||
8 => "unit_price", |
|||
9 => "pre_tax_price", |
|||
10 => "business_tax", |
|||
11 => "summary_price", |
|||
12 => "delivery_date", |
|||
13 => "summary", |
|||
14 => "contract_begin_date", |
|||
15 => "contract_end_date", |
|||
16 => "salesman", |
|||
17 => "operator_name", |
|||
18 => "enter_date", |
|||
]; |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
include "header.php"; |
|||
// 载入db.php来连结资料库 |
|||
require_once "../database.php"; |
|||
require_once '../PHPExcel/PHPExcel.php'; |
|||
require_once '../PHPExcel/IOFactory.php'; |
|||
|
|||
$file_name = $_FILES["file"]["name"]; |
|||
$temp_file_name = $_FILES["file"]["tmp_name"]; |
|||
//$target_dir = "../inv-uploads/ec/" . $_POST['yyyymm'] . "/"; |
|||
|
|||
//if (is_dir($target_dir) || mkdir($target_dir, '0777')); |
|||
$target_dir = "../inv-uploads/"; |
|||
|
|||
$target_file = strtolower($target_dir . strtotime("now") . "." . pathinfo($file_name, PATHINFO_EXTENSION)); |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
if (move_uploaded_file($temp_file_name, $target_file)) { |
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5'); //支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007'); //支持xlsx是 |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
$success_in = 0; |
|||
$fail_in = 0; |
|||
#循環讀取excel ec_purchase_order |
|||
/** |
|||
* 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
* 2.ec_purchase_order_tmp表group by 后无重复, 则union ec_purchase_order 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
* 3.如果没有重复资料,则重定向到ec_purchase_order页面 |
|||
*/ |
|||
# 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "'"); |
|||
|
|||
for ($row = 3; $row <= $highestRow - 3; $row++) { |
|||
$val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue(); |
|||
if ($val == "") return; |
|||
$data = []; |
|||
for ($column = 0; $column < $highestColumn; $column++) { |
|||
$val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(); |
|||
//上午 오전 am 下午 오후 pm 2023-03-06 오후 12:47:28 |
|||
#包含上午 오전 |
|||
if ($column == 18 && mb_strpos($val, '오전')) { |
|||
$_am = str_replace('오전', "", $val); |
|||
//echo "_A:" . $_am . 'AM'; |
|||
$val = date("Y-m-d G:i:s", strtotime($_am . 'AM')); |
|||
} elseif ($column == 18 && mb_strpos($val, '오후')) { |
|||
$_pm = str_replace('오후', "", $val); |
|||
$val = date("Y-m-d G:i:s", strtotime($_pm . 'PM')); |
|||
} |
|||
$data[$excel_field_mapping[$column]] = (empty($val) || $val == '') ? 'null' : "'" . $val . "'"; //读取excel数据到数组 |
|||
} |
|||
$data['yyyymm'] = $_POST['yyyymm']; |
|||
$data['form_key'] = $_POST['form_key']; |
|||
$db_query1 = 'insert into ec_purchase_order_tmp(' . implode(array_keys($data), ',') . ') values (' . implode(array_values($data), ',') . ')'; |
|||
mysqli_query($link, $db_query1); |
|||
} |
|||
|
|||
#ec_purchase_order_tmp表group by 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
#gorup by |
|||
|
|||
$sql_group_epot = " |
|||
SELECT count(*) cnt, |
|||
date_seq, |
|||
customerid, |
|||
item_no, |
|||
num, |
|||
unit_price, |
|||
pre_tax_price, |
|||
business_tax, |
|||
summary_price, |
|||
enter_date From ec_purchase_order_tmp |
|||
WHERE form_key = '" . $_POST['form_key'] . "' |
|||
GROUP BY date_Seq, customerid, item_no, num, unit_price, pre_tax_price, business_tax, summary_price, enter_date |
|||
HAVING COUNT(*) > 1"; |
|||
|
|||
$res_group_epot = mysqli_fetch_row(mysqli_query($link, $sql_group_epot)); |
|||
#存在重复的记录ec_purchase_order_import |
|||
if (!empty($res_group_epot)) { |
|||
header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']); |
|||
exit(); |
|||
} |
|||
$sql_group_epo = " |
|||
SELECT |
|||
count(*) cnt, |
|||
a.date_seq, |
|||
a.customerid, |
|||
a.item_no, |
|||
a.num, |
|||
a.unit_price, |
|||
a.pre_tax_price, |
|||
a.business_tax, |
|||
a.summary_price, |
|||
a.enter_date |
|||
FROM |
|||
ec_purchase_order a, |
|||
ec_purchase_order_tmp b |
|||
WHERE |
|||
a.date_seq = b.date_seq |
|||
AND a.customerid = b.customerid |
|||
AND a.item_no = b.item_no |
|||
AND a.num = b.num |
|||
AND a.unit_price = b.unit_price |
|||
AND a.pre_tax_price = b.pre_tax_price |
|||
AND a.business_tax = b.business_tax |
|||
AND a.summary_price = b.summary_price |
|||
AND a.enter_date = b.enter_date |
|||
GROUP BY a.date_seq, a.customerid, a.item_no, a.num, a.unit_price, |
|||
a.pre_tax_price, a.business_tax, a.summary_price, a.enter_date"; |
|||
|
|||
$res_group_epo = mysqli_fetch_row(mysqli_query($link, $sql_group_epo)); |
|||
// echo $sql_group_epo; |
|||
// exit(); |
|||
#存在重复的记录ec_purchase_order_import |
|||
if (!empty($res_group_epo)) { |
|||
header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']); |
|||
exit(); |
|||
} |
|||
#不存在重复记录则插入到ec_purchase_order |
|||
$sql_ins_epo = "insert into ec_purchase_order(id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at ) |
|||
select id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at From |
|||
ec_purchase_order_tmp |
|||
where form_key='" . $_POST['form_key'] . "'"; |
|||
mysqli_query($link, $sql_ins_epo); |
|||
mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "' "); |
|||
|
|||
mysqli_close($link); |
|||
} |
|||
} |
|||
#echo $fail_in; |
|||
header("location: ec_purchase_order.php"); |
|||
|
|||
die(); |
|||
<?php |
|||
//error_reporting(E_ALL); |
|||
ob_start(); |
|||
//ini_set('display_errors', "On"); |
|||
|
|||
require_once "../database.php"; |
|||
|
|||
$customerid = ""; |
|||
$inv_customer_id = ""; |
|||
$inv_customer_name = ""; |
|||
$customer_name = ""; |
|||
$item_no = ""; |
|||
$item_name = ""; |
|||
$num = ""; |
|||
$unit_price = ""; |
|||
$pre_tax_price = ""; |
|||
$business_tax = ""; |
|||
$summary_price = ""; |
|||
#$delivery_date = ""; |
|||
$summary = ""; |
|||
$contract_begin_date = ""; |
|||
$contract_end_date = ""; |
|||
$salesman = ""; |
|||
$operator_name = ""; |
|||
$enter_date = ""; |
|||
$creater = ""; |
|||
$create_at = ""; |
|||
#excel字段與mysql表字段映射 |
|||
$excel_field_mapping = [ |
|||
0 => "date_seq", |
|||
1 => "customerid", |
|||
2 => "inv_customer_id", |
|||
3 => "inv_customer_name", |
|||
4 => "customer_name", |
|||
5 => "item_no", |
|||
6 => "item_name", |
|||
7 => "num", |
|||
8 => "unit_price", |
|||
9 => "pre_tax_price", |
|||
10 => "business_tax", |
|||
11 => "summary_price", |
|||
12 => "delivery_date", |
|||
13 => "summary", |
|||
14 => "contract_begin_date", |
|||
15 => "contract_end_date", |
|||
16 => "salesman", |
|||
17 => "operator_name", |
|||
18 => "enter_date", |
|||
]; |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
include "header.php"; |
|||
// 载入db.php来连结资料库 |
|||
require_once "../database.php"; |
|||
require_once '../PHPExcel/PHPExcel.php'; |
|||
require_once '../PHPExcel/IOFactory.php'; |
|||
|
|||
$file_name = $_FILES["file"]["name"]; |
|||
$temp_file_name = $_FILES["file"]["tmp_name"]; |
|||
//$target_dir = "../inv-uploads/ec/" . $_POST['yyyymm'] . "/"; |
|||
|
|||
//if (is_dir($target_dir) || mkdir($target_dir, '0777')); |
|||
$target_dir = "../inv-uploads/"; |
|||
|
|||
$target_file = strtolower($target_dir . strtotime("now") . "." . pathinfo($file_name, PATHINFO_EXTENSION)); |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
if (move_uploaded_file($temp_file_name, $target_file)) { |
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5'); //支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007'); //支持xlsx是 |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0); //拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
$success_in = 0; |
|||
$fail_in = 0; |
|||
#循環讀取excel ec_purchase_order |
|||
/** |
|||
* 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
* 2.ec_purchase_order_tmp表group by 后无重复, 则union ec_purchase_order 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
* 3.如果没有重复资料,则重定向到ec_purchase_order页面 |
|||
*/ |
|||
# 1.将表格存放在 ec_purchase_order_tmp表,group by 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "'"); |
|||
|
|||
for ($row = 3; $row <= $highestRow - 3; $row++) { |
|||
$val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue(); |
|||
if ($val == "") return; |
|||
$data = []; |
|||
for ($column = 0; $column < $highestColumn; $column++) { |
|||
$val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(); |
|||
//上午 오전 am 下午 오후 pm 2023-03-06 오후 12:47:28 |
|||
#包含上午 오전 |
|||
if ($column == 18 && mb_strpos($val, '오전')) { |
|||
$_am = str_replace('오전', "", $val); |
|||
//echo "_A:" . $_am . 'AM'; |
|||
$val = date("Y-m-d G:i:s", strtotime($_am . 'AM')); |
|||
} elseif ($column == 18 && mb_strpos($val, '오후')) { |
|||
$_pm = str_replace('오후', "", $val); |
|||
$val = date("Y-m-d G:i:s", strtotime($_pm . 'PM')); |
|||
} |
|||
$data[$excel_field_mapping[$column]] = (empty($val) || $val == '') ? 'null' : "'" . $val . "'"; //读取excel数据到数组 |
|||
} |
|||
$data['yyyymm'] = $_POST['yyyymm']; |
|||
$data['form_key'] = $_POST['form_key']; |
|||
$db_query1 = 'insert into ec_purchase_order_tmp(' . implode(array_keys($data), ',') . ') values (' . implode(array_values($data), ',') . ')'; |
|||
mysqli_query($link, $db_query1); |
|||
} |
|||
|
|||
#ec_purchase_order_tmp表group by 是否有重复记录,有则定向到ec_purchase_order_import显示 |
|||
#gorup by |
|||
|
|||
$sql_group_epot = " |
|||
SELECT count(*) cnt, |
|||
date_seq, |
|||
customerid, |
|||
item_no, |
|||
num, |
|||
unit_price, |
|||
pre_tax_price, |
|||
business_tax, |
|||
summary_price, |
|||
enter_date From ec_purchase_order_tmp |
|||
WHERE form_key = '" . $_POST['form_key'] . "' |
|||
GROUP BY date_Seq, customerid, item_no, num, unit_price, pre_tax_price, business_tax, summary_price, enter_date |
|||
HAVING COUNT(*) > 1"; |
|||
|
|||
$res_group_epot = mysqli_fetch_row(mysqli_query($link, $sql_group_epot)); |
|||
#存在重复的记录ec_purchase_order_import |
|||
if (!empty($res_group_epot)) { |
|||
header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']); |
|||
exit(); |
|||
} |
|||
$sql_group_epo = " |
|||
SELECT |
|||
count(*) cnt, |
|||
a.date_seq, |
|||
a.customerid, |
|||
a.item_no, |
|||
a.num, |
|||
a.unit_price, |
|||
a.pre_tax_price, |
|||
a.business_tax, |
|||
a.summary_price, |
|||
a.enter_date |
|||
FROM |
|||
ec_purchase_order a, |
|||
ec_purchase_order_tmp b |
|||
WHERE |
|||
a.date_seq = b.date_seq |
|||
AND a.customerid = b.customerid |
|||
AND a.item_no = b.item_no |
|||
AND a.num = b.num |
|||
AND a.unit_price = b.unit_price |
|||
AND a.pre_tax_price = b.pre_tax_price |
|||
AND a.business_tax = b.business_tax |
|||
AND a.summary_price = b.summary_price |
|||
AND a.enter_date = b.enter_date |
|||
GROUP BY a.date_seq, a.customerid, a.item_no, a.num, a.unit_price, |
|||
a.pre_tax_price, a.business_tax, a.summary_price, a.enter_date"; |
|||
|
|||
$res_group_epo = mysqli_fetch_row(mysqli_query($link, $sql_group_epo)); |
|||
// echo $sql_group_epo; |
|||
// exit(); |
|||
#存在重复的记录ec_purchase_order_import |
|||
if (!empty($res_group_epo)) { |
|||
header("location: ec_purchase_order_import.php?error_form_key=" . $_POST['form_key']); |
|||
exit(); |
|||
} |
|||
#不存在重复记录则插入到ec_purchase_order |
|||
$sql_ins_epo = "insert into ec_purchase_order(id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at ) |
|||
select id,date_seq,customerid,inv_customer_id,inv_customer_name,customer_name,item_no,item_name,num,unit_price,pre_tax_price,business_tax,summary_price,delivery_date,summary,contract_begin_date,contract_end_date,salesman,operator_name,enter_date,yyyymm,form_key,creater,create_at From |
|||
ec_purchase_order_tmp |
|||
where form_key='" . $_POST['form_key'] . "'"; |
|||
mysqli_query($link, $sql_ins_epo); |
|||
mysqli_query($link, "delete from ec_purchase_order_tmp where form_key='" . $_POST['form_key'] . "' "); |
|||
|
|||
mysqli_close($link); |
|||
} |
|||
} |
|||
#echo $fail_in; |
|||
header("location: ec_purchase_order.php"); |
|||
|
|||
die(); |
|||
|
@ -1,100 +1,100 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "equipment-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
<div> |
|||
<label for="category">類別</label> |
|||
<input type="text" name="category" id="category"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_id">部品號</label> |
|||
<input type="text" name="equipment_id" id="equipment_id"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_name">部品名稱</label> |
|||
<input type="text" name="equipment_name" id="equipment_name"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="brand">廠牌</label> |
|||
<input type="text" name="brand" id="brand"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="spec">規格</label> |
|||
<input type="text" name="spec" id="spec" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="count_type">計量單位</label> |
|||
<input type="text" name="count_type" id="count_type" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="inventory">庫存數</label> |
|||
<input type="text" name="inventory" id="inventory" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="list_price">牌價</label> |
|||
<input type="text" name="list_price" id="list_price"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="discount">折扣</label> |
|||
<input type="text" name="discount" id="discount" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="final_price">最後售價</label> |
|||
<input type="text" name="final_price" id="final_price" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="fileToUpload">上傳圖片</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
</div> |
|||
<p> |
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "equipment-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
<div> |
|||
<label for="category">類別</label> |
|||
<input type="text" name="category" id="category"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_id">部品號</label> |
|||
<input type="text" name="equipment_id" id="equipment_id"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_name">部品名稱</label> |
|||
<input type="text" name="equipment_name" id="equipment_name"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="brand">廠牌</label> |
|||
<input type="text" name="brand" id="brand"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="spec">規格</label> |
|||
<input type="text" name="spec" id="spec" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="count_type">計量單位</label> |
|||
<input type="text" name="count_type" id="count_type" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="inventory">庫存數</label> |
|||
<input type="text" name="inventory" id="inventory" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="list_price">牌價</label> |
|||
<input type="text" name="list_price" id="list_price"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="discount">折扣</label> |
|||
<input type="text" name="discount" id="discount" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="final_price">最後售價</label> |
|||
<input type="text" name="final_price" id="final_price" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="fileToUpload">上傳圖片</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
</div> |
|||
<p> |
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM equipment WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=equipment-index.php?function_name=equipment&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM equipment WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=equipment-index.php?function_name=equipment&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,113 +1,113 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM equipment WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="equipment-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="category">類別</label> |
|||
<input type="text" name="category" id="category" value="<?php echo $data['category']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_id">部品號</label> |
|||
<input type="text" name="equipment_id" id="equipment_id" value="<?php echo $data['equipment_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_name">部品名稱</label> |
|||
<input type="text" name="equipment_name" id="equipment_name" value="<?php echo $data['equipment_name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="brand">廠牌</label> |
|||
<input type="text" name="brand" id="brand" value="<?php echo $data['brand']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="spec">規格</label> |
|||
<input type="text" name="spec" id="spec" value="<?php echo $data['spec']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="count_type">計量單位</label> |
|||
<input type="text" name="count_type" id="count_type" value="<?php echo $data['count_type']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="inventory">庫存數</label> |
|||
<input type="text" name="inventory" id="inventory" value="<?php echo $data['inventory']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="list_price">牌價</label> |
|||
<input type="text" name="list_price" id="list_price" value="<?php echo $data['list_price']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="discount">折扣</label> |
|||
<input type="text" name="discount" id="discount" value="<?php echo $data['discount']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="final_price">最後售價</label> |
|||
<input type="text" name="final_price" id="final_price" value="<?php echo $data['final_price']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="create_at">圖片</label> |
|||
<a><?php echo $data['picture']; ?></a> |
|||
<img width="125px" src="<?php echo $data['picture']?>" alt="" class="index-image"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM equipment WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="equipment-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="category">類別</label> |
|||
<input type="text" name="category" id="category" value="<?php echo $data['category']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_id">部品號</label> |
|||
<input type="text" name="equipment_id" id="equipment_id" value="<?php echo $data['equipment_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="equipment_name">部品名稱</label> |
|||
<input type="text" name="equipment_name" id="equipment_name" value="<?php echo $data['equipment_name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="brand">廠牌</label> |
|||
<input type="text" name="brand" id="brand" value="<?php echo $data['brand']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="spec">規格</label> |
|||
<input type="text" name="spec" id="spec" value="<?php echo $data['spec']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="count_type">計量單位</label> |
|||
<input type="text" name="count_type" id="count_type" value="<?php echo $data['count_type']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="inventory">庫存數</label> |
|||
<input type="text" name="inventory" id="inventory" value="<?php echo $data['inventory']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="list_price">牌價</label> |
|||
<input type="text" name="list_price" id="list_price" value="<?php echo $data['list_price']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="discount">折扣</label> |
|||
<input type="text" name="discount" id="discount" value="<?php echo $data['discount']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="final_price">最後售價</label> |
|||
<input type="text" name="final_price" id="final_price" value="<?php echo $data['final_price']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="create_at">圖片</label> |
|||
<a><?php echo $data['picture']; ?></a> |
|||
<img width="125px" src="<?php echo $data['picture']?>" alt="" class="index-image"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
|
@ -1,151 +1,151 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM equipment $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
|
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="equipment-create.php?function_name=equipment&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:equipment-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>項次</th> |
|||
<th>類別</th> |
|||
<th>部品號</th> |
|||
<th>部品名稱</th> |
|||
<th class="width_style_1" >照片</th> |
|||
<th>廠牌</th> |
|||
<th>規格</th> |
|||
<th>計量單位</th> |
|||
<th>庫存數</th> |
|||
<th>牌價</th> |
|||
<th>折扣</th> |
|||
<th>最後售價</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['category']; ?></td> |
|||
<td><?php echo $data['equipment_id']; ?></td> |
|||
<td><?php echo $data['equipment_name']; ?></td> |
|||
<td class="width_style_1"><img src="<?php echo $data['picture']; ?>" alt="" class="index-image"></td> |
|||
<td><?php echo $data['brand']; ?></td> |
|||
<td><?php echo $data['spec']; ?></td> |
|||
<td><?php echo $data['count_type']; ?></td> |
|||
<td><?php echo $data['inventory']; ?></td> |
|||
<td><?php echo $data['list_price']; ?></td> |
|||
<td><?php echo $data['discount']; ?></td> |
|||
<td><?php echo $data['final_price']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="equipment-edit.php?id=<?php echo $data['id']; ?>&function_name=equipment&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="equipment-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM equipment $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
|
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="equipment-create.php?function_name=equipment&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:equipment-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>項次</th> |
|||
<th>類別</th> |
|||
<th>部品號</th> |
|||
<th>部品名稱</th> |
|||
<th class="width_style_1" >照片</th> |
|||
<th>廠牌</th> |
|||
<th>規格</th> |
|||
<th>計量單位</th> |
|||
<th>庫存數</th> |
|||
<th>牌價</th> |
|||
<th>折扣</th> |
|||
<th>最後售價</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['category']; ?></td> |
|||
<td><?php echo $data['equipment_id']; ?></td> |
|||
<td><?php echo $data['equipment_name']; ?></td> |
|||
<td class="width_style_1"><img src="<?php echo $data['picture']; ?>" alt="" class="index-image"></td> |
|||
<td><?php echo $data['brand']; ?></td> |
|||
<td><?php echo $data['spec']; ?></td> |
|||
<td><?php echo $data['count_type']; ?></td> |
|||
<td><?php echo $data['inventory']; ?></td> |
|||
<td><?php echo $data['list_price']; ?></td> |
|||
<td><?php echo $data['discount']; ?></td> |
|||
<td><?php echo $data['final_price']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="equipment-edit.php?id=<?php echo $data['id']; ?>&function_name=equipment&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="equipment-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
@ -1,123 +1,123 @@ |
|||
<?php |
|||
$category= ""; |
|||
$equipment_id= ""; |
|||
$equipment_name= ""; |
|||
$brand= ""; |
|||
$spec= ""; |
|||
$count_type= ""; |
|||
$inventory= ""; |
|||
$list_price= ""; |
|||
$discount= ""; |
|||
$final_price= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
$fileToUpload = ""; |
|||
|
|||
$category_error= ""; |
|||
$equipment_id_error= ""; |
|||
$equipment_name_error= ""; |
|||
$brand_error= ""; |
|||
$spec_error= ""; |
|||
$count_type_error= ""; |
|||
$inventory_error= ""; |
|||
$list_price_error= ""; |
|||
$discount_error= ""; |
|||
$final_price_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "equipment-user-input.php"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "equipment-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
#$db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price,picture,creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price','$target_file','$creater', '$create_at')"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "equipment-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
//Check if image is an actual image or fake image |
|||
|
|||
if(strlen($target_file) <= strlen("equipment-uploads/")){ |
|||
|
|||
$db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price, creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price', '$creater', '$create_at')"; |
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
#echo $result; |
|||
|
|||
}else { |
|||
|
|||
$check_img = getimagesize($temp_file_name); |
|||
|
|||
if($check_img == false) { |
|||
echo "<font color='#FF0000'>File is not an image</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//echo "File is an image - " . $check_img["mime"]; |
|||
$upload_ok = 1; |
|||
|
|||
//Check if file already exists |
|||
if(file_exists($target_file)) { |
|||
echo "<font color='#FF0000'>File is already uploaded!</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check file size |
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
echo "<font color='#FF0000'>JPG, PNG, JPEG and GIF files are allowed</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
|
|||
|
|||
// sql語法存在變數中 |
|||
// $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)"; |
|||
$db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price,picture,creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price','$target_file','$creater', '$create_at')"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
$category= ""; |
|||
$equipment_id= ""; |
|||
$equipment_name= ""; |
|||
$brand= ""; |
|||
$spec= ""; |
|||
$count_type= ""; |
|||
$inventory= ""; |
|||
$list_price= ""; |
|||
$discount= ""; |
|||
$final_price= ""; |
|||
$creater= ""; |
|||
$create_at= ""; |
|||
$fileToUpload = ""; |
|||
|
|||
$category_error= ""; |
|||
$equipment_id_error= ""; |
|||
$equipment_name_error= ""; |
|||
$brand_error= ""; |
|||
$spec_error= ""; |
|||
$count_type_error= ""; |
|||
$inventory_error= ""; |
|||
$list_price_error= ""; |
|||
$discount_error= ""; |
|||
$final_price_error= ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "equipment-user-input.php"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "equipment-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
#$db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price,picture,creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price','$target_file','$creater', '$create_at')"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "equipment-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
//Check if image is an actual image or fake image |
|||
|
|||
if(strlen($target_file) <= strlen("equipment-uploads/")){ |
|||
|
|||
$db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price, creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price', '$creater', '$create_at')"; |
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
#echo $result; |
|||
|
|||
}else { |
|||
|
|||
$check_img = getimagesize($temp_file_name); |
|||
|
|||
if($check_img == false) { |
|||
echo "<font color='#FF0000'>File is not an image</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//echo "File is an image - " . $check_img["mime"]; |
|||
$upload_ok = 1; |
|||
|
|||
//Check if file already exists |
|||
if(file_exists($target_file)) { |
|||
echo "<font color='#FF0000'>File is already uploaded!</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check file size |
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
echo "<font color='#FF0000'>JPG, PNG, JPEG and GIF files are allowed</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
|
|||
|
|||
// sql語法存在變數中 |
|||
// $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)"; |
|||
$db_query = "INSERT INTO equipment(equipment_id, equipment_name, brand,spec, count_type,inventory,list_price,discount,final_price,picture,creater, create_at) VALUES ('$equipment_id', '$equipment_name', '$brand','$spec', '$count_type','$inventory','$list_price','$discount','$final_price','$target_file','$creater', '$create_at')"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,80 +1,80 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$category = $_POST['categoryd']; |
|||
$equipment_id = user_input($_POST["equipment_id"]); |
|||
$equipment_name = user_input($_POST["equipment_name"]); |
|||
$brand = user_input($_POST["brand"]); |
|||
$spec = user_input($_POST["spec"]); |
|||
$count_type = user_input($_POST["count_type"]); |
|||
$inventory = user_input($_POST["inventory"]); |
|||
$list_price = user_input($_POST["list_price"]); |
|||
$discount = user_input($_POST["discount"]); |
|||
$final_price = user_input($_POST["final_price"]); |
|||
$picture = user_input($_POST["picture"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "equipment-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
if(strlen($target_file) <= strlen("equipment-uploads/")){ |
|||
$db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
}else { |
|||
|
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { // |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
//echo "JPG, PNG, JPEG and GIF files are allowed"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
$db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',picture = '$target_file',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
header("location: equipment-index.php"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$category = $_POST['categoryd']; |
|||
$equipment_id = user_input($_POST["equipment_id"]); |
|||
$equipment_name = user_input($_POST["equipment_name"]); |
|||
$brand = user_input($_POST["brand"]); |
|||
$spec = user_input($_POST["spec"]); |
|||
$count_type = user_input($_POST["count_type"]); |
|||
$inventory = user_input($_POST["inventory"]); |
|||
$list_price = user_input($_POST["list_price"]); |
|||
$discount = user_input($_POST["discount"]); |
|||
$final_price = user_input($_POST["final_price"]); |
|||
$picture = user_input($_POST["picture"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "equipment-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
if(strlen($target_file) <= strlen("equipment-uploads/")){ |
|||
$db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
}else { |
|||
|
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { // |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
//echo "JPG, PNG, JPEG and GIF files are allowed"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
$db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',picture = '$target_file',create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
header("location: equipment-index.php"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='equipment-index.php?function_name=equipment&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,57 +1,57 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$category = user_input($_POST["category"]); |
|||
$equipment_id = user_input($_POST["equipment_id"]); |
|||
$equipment_name = user_input($_POST["equipment_name"]); |
|||
$brand = user_input($_POST["brand"]); |
|||
$spec = user_input($_POST["spec"]); |
|||
$count_type = user_input($_POST["count_type"]); |
|||
$inventory = user_input($_POST["inventory"]); |
|||
$list_price = user_input($_POST["list_price"]); |
|||
$discount = user_input($_POST["discount"]); |
|||
$final_price = user_input($_POST["final_price"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$category = user_input($_POST["category"]); |
|||
$equipment_id = user_input($_POST["equipment_id"]); |
|||
$equipment_name = user_input($_POST["equipment_name"]); |
|||
$brand = user_input($_POST["brand"]); |
|||
$spec = user_input($_POST["spec"]); |
|||
$count_type = user_input($_POST["count_type"]); |
|||
$inventory = user_input($_POST["inventory"]); |
|||
$list_price = user_input($_POST["list_price"]); |
|||
$discount = user_input($_POST["discount"]); |
|||
$final_price = user_input($_POST["final_price"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
File diff suppressed because it is too large
@ -1,244 +1,244 @@ |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
require_once 'PHPExcel/PHPExcel.php'; |
|||
require_once 'PHPExcel/IOFactory.php'; |
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$target_dir = "excel-uploads/"; |
|||
$target_file = strtolower($target_dir . iconv("UTF-8", "big5",basename($file_name))); |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
if (move_uploaded_file($temp_file_name, $target_file)) { |
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5');//支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');//支持xlsx |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
for ($row = 2; $row <= $highestRow; $row++) { |
|||
$val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue(); |
|||
if ($val == "") return; |
|||
for ($column = 1; $column < $highestColumn; $column++) { |
|||
$val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(); |
|||
$excelArray[$row][] = $val; //读取excel数据到数组 |
|||
} |
|||
/* |
|||
( |
|||
[2] => Array |
|||
( |
|||
[0] => M230875 |
|||
[1] => 3TX23001 |
|||
[2] => 桃園市中壢區榮民南路81巷8號 |
|||
[3] => 121.25820796563 |
|||
[4] => 24.955059621474 |
|||
[5] => 梁智芳 |
|||
[6] => |
|||
[7] => 921389826 |
|||
[8] => M0089 |
|||
[9] => 郭玠德 |
|||
[10] => 0905-378-991 |
|||
[11] => 2023/07/14 |
|||
[12] => BW002 |
|||
[13] => |
|||
[14] => 45108 |
|||
[15] => 45473 |
|||
[16] => |
|||
) |
|||
)*/ |
|||
//print_r($excelArray);exit; |
|||
echo "第".$row; |
|||
|
|||
// excel欄位名稱 |
|||
list($contractno, $facilityno, $address, $longitude, $latitude, $name, $customerid, $tel, $repairerid, $repairer_name, $repairer_tel, $duedate, $combono, $receivable_date, $c_start_date, $c_end_date) = $excelArray[$row]; |
|||
$customerid = (!$customerid) ? $contractno : $customerid; |
|||
$repairer_tel = str_pad(str_replace("-", "", $repairer_tel), 10, "0", STR_PAD_LEFT); // 保養員手机号 |
|||
$combono = substr($combono,-5);//套餐编码 |
|||
$area = mb_substr($address, 0, 3); |
|||
if (is_numeric($duedate)) $duedate = date("Y-m-d", ($duedate-25569)*24*60*60); // 預保養日 |
|||
if (is_numeric($c_start_date)) $c_start_date = date("Y-m-d", ($c_start_date-25569)*24*60*60); // 合約起始日 |
|||
if (is_numeric($c_end_date)) $c_end_date = date("Y-m-d", ($c_end_date-25569)*24*60*60); // 合約終止日 |
|||
|
|||
// 创建客户信息 |
|||
$accountid= $contractno; //账户id |
|||
//判断账户是否存在 |
|||
$sql = "select * from account where accountid = '$accountid'"; |
|||
$data = mysqli_query($link,$sql); |
|||
$nums_rows = mysqli_num_rows($data); |
|||
if($nums_rows==0){ |
|||
//添加用户 |
|||
$accounttype = "A"; //账户类型 |
|||
$pwd = "123";//账户默认密码 |
|||
|
|||
//查询保养员电话 |
|||
$sqlfre = "SELECT name, tel FROM account where accountid = '$repairerid' and accounttype = 'B'"; |
|||
$repairerdata = mysqli_query($link, $sqlfre); # 用mysqli_query方法执行(sql语法)将结果存在变数中 |
|||
if ($rowdata = mysqli_fetch_assoc($repairerdata)) { |
|||
$db_repair_name = $rowdata['name']; |
|||
$db_repair_tel = $rowdata['tel']; |
|||
} |
|||
mysqli_free_result($repairerdata); |
|||
|
|||
if ($db_repair_name == $repairer_name && (str_pad(str_replace("-", "", $db_repair_tel), 10, "0", STR_PAD_LEFT)) == $repairer_tel) { |
|||
$create_at = date('Y/m/d H:i:s');//账户创建时间 |
|||
$db_query1 = "insert into account(accounttype, accountid, pwd, name, tel, address,phone_call_help, repairerid, creater, create_at) values ("; |
|||
$db_query1 .= "'$accounttype', '$accountid', '$pwd', '$name', '$tel', '$address', '$repairer_tel', '$repairerid','$user_id', '$create_at')"; |
|||
mysqli_query($link,$db_query1); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "客户账户新增成功\r\n"; |
|||
$repair_right = 1; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
} else { |
|||
echo "保養員姓名或電話有誤"; |
|||
} |
|||
} else { |
|||
echo "账户已经存在"; |
|||
$repair_right = 1; |
|||
} |
|||
|
|||
if ($repair_right) { |
|||
//创建合约信息 |
|||
//判断合约是否存在 |
|||
$contractsql = "select * from contract where contractno = '$contractno'"; |
|||
$contract_nums_rows=mysqli_num_rows(mysqli_query($link,$contractsql)); |
|||
if($contract_nums_rows==0){ |
|||
$contracttype= "A"; |
|||
$company= $name;//公司名称默认客户姓名 |
|||
$taxid= " ";//统一编码 |
|||
$promiser= $name;//契约人,个人客户默认客户姓名 |
|||
$contractperson= $name;//联系人 |
|||
$contractaddress= $address;//联系地址 |
|||
$contracttel= $tel;//联络电话 |
|||
$contractemail= ""; |
|||
$contract_employee= "";//契约员工号 |
|||
$create_at = date('Y/m/d H:i:s');//合同创建时间 |
|||
$db_query2 = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$c_start_date','$c_end_date', '$user_id', '$create_at')"; |
|||
mysqli_query($link,$db_query2); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo "合约新增成功\r\n"; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
}else{ |
|||
echo "合约已经存在"; |
|||
} |
|||
|
|||
//创建作番信息 |
|||
switch ($facilityno) { |
|||
case (preg_match('/TX/', $facilityno) ? true : false): |
|||
case (preg_match('/JX/', $facilityno) ? true : false): |
|||
$facility_kind = "MAE100"; |
|||
break; |
|||
case (preg_match('/TW/', $facilityno) ? true : false): |
|||
$facility_kind = "MAM200"; |
|||
break; |
|||
case (preg_match('/TH/', $facilityno) ? true : false): |
|||
$facility_kind = "MAH100"; |
|||
break; |
|||
case (preg_match('/TZ/', $facilityno) ? true : false): |
|||
$facility_kind = "MAZ100"; |
|||
break; |
|||
case (preg_match('/TH/', $facilityno) ? true : false): |
|||
$facility_kind = "MAQ100"; |
|||
break; |
|||
default: |
|||
$facility_kind = ""; |
|||
} |
|||
$facilitsql = "SELECT * FROM facility where facilityno='$facilityno' and contractno='$contractno'"; |
|||
$facilit_nums_rows=mysqli_num_rows(mysqli_query($link,$facilitsql)); |
|||
if($facilit_nums_rows==0){ |
|||
$weight= "450";//重量 |
|||
$numberofpassenger = "6"; // 人乘 |
|||
$numberofstop= "2";//停数 |
|||
$numberoffloor= "2";//楼层数 |
|||
$opentype= "CO-SO";//开门方式 |
|||
$speed= "60";//速度 |
|||
$repairtype= "A";//维护类型 |
|||
$create_at = date('Y/m/d H:i:s');//作番创建时间 |
|||
|
|||
$db_query3 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofpassenger,numberofstop, numberoffloor,opentype,speed,repairtype,facility_kind,longitude, latitude, address,repairerid,repairername,area,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofpassenger','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$facility_kind','$longitude', '$latitude', '$address','$repairerid','$repairer_name','$area','$user_id', '$create_at')"; |
|||
mysqli_query($link,$db_query3); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo "作番新增成功\n"; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
}else{ |
|||
echo "作番已经存在"; |
|||
} |
|||
//创建保养计划 |
|||
echo "保养日期"; |
|||
$schedulesql = "SELECT * FROM schedule where facilityno='$facilityno' and duedate='$duedate'"; |
|||
$schedule_nums_rows=mysqli_num_rows(mysqli_query($link,$schedulesql)); |
|||
if($schedule_nums_rows==0){ |
|||
$create_at = date('Y/m/d H:i:s');//作番创建时间 |
|||
$db_query4 = "INSERT INTO schedule(contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES ('$contractno', '$facilityno', '$combono', '$repairerid', '$repairer_name', '$duedate', '$user_id', '$create_at')"; |
|||
$resiult=mysqli_query($link,$db_query4); |
|||
|
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo $combono."作番保养计划新增成功\r\n"; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
}else{ |
|||
echo "作番保养计划已经存在"; |
|||
} |
|||
} |
|||
} |
|||
mysqli_close($link); |
|||
} |
|||
|
|||
//for ($i = 0; $i <= sizeof($excelArray); $i++) { |
|||
// //处理数据 |
|||
//// 创建客户信息 |
|||
// echo "循环读取数据插入数据库---".$row."---"; |
|||
// echo$accounttype= "A"; //账户类型 |
|||
// echo$accountid= $excelArray[$row][6]; //账户id |
|||
// echo$pwd= "123";//账户默认密码 |
|||
// echo$name= $excelArray[$row][5];//账户姓名 |
|||
// echo$address= $excelArray[$row][2];//账户地址 |
|||
// echo$phone_call_help=$excelArray[$row][7];//联络手机号 |
|||
// echo$repairerid=$excelArray[$row][8];//服务与支持人员工号 |
|||
// echo$creater = 'vensen';//建档人 |
|||
// echo$create_at = date('Y/m/d H:i:s');//账户创建时间 |
|||
////判断账户是否存在 |
|||
// $sqlselect='select * from account where accountid='.$accountid; |
|||
// $res = mysqli_query($link,$sqlselect); |
|||
// echo "------结果".'<br>'; |
|||
// print_r($res); |
|||
// |
|||
// echo "------".'<br>'; |
|||
//} |
|||
// |
|||
// var_dump($excelArray); |
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" |
|||
enctype="multipart/form-data"> |
|||
|
|||
<div class="bottom-margin">資料 |
|||
<label for="fileToUpload">上傳</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $_GET['token']; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
|
|||
<?php |
|||
include "header.php"; |
|||
require_once 'PHPExcel/PHPExcel.php'; |
|||
require_once 'PHPExcel/IOFactory.php'; |
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$target_dir = "excel-uploads/"; |
|||
$target_file = strtolower($target_dir . iconv("UTF-8", "big5",basename($file_name))); |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
if (move_uploaded_file($temp_file_name, $target_file)) { |
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5');//支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');//支持xlsx |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
for ($row = 2; $row <= $highestRow; $row++) { |
|||
$val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue(); |
|||
if ($val == "") return; |
|||
for ($column = 1; $column < $highestColumn; $column++) { |
|||
$val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(); |
|||
$excelArray[$row][] = $val; //读取excel数据到数组 |
|||
} |
|||
/* |
|||
( |
|||
[2] => Array |
|||
( |
|||
[0] => M230875 |
|||
[1] => 3TX23001 |
|||
[2] => 桃園市中壢區榮民南路81巷8號 |
|||
[3] => 121.25820796563 |
|||
[4] => 24.955059621474 |
|||
[5] => 梁智芳 |
|||
[6] => |
|||
[7] => 921389826 |
|||
[8] => M0089 |
|||
[9] => 郭玠德 |
|||
[10] => 0905-378-991 |
|||
[11] => 2023/07/14 |
|||
[12] => BW002 |
|||
[13] => |
|||
[14] => 45108 |
|||
[15] => 45473 |
|||
[16] => |
|||
) |
|||
)*/ |
|||
//print_r($excelArray);exit; |
|||
echo "第".$row; |
|||
|
|||
// excel欄位名稱 |
|||
list($contractno, $facilityno, $address, $longitude, $latitude, $name, $customerid, $tel, $repairerid, $repairer_name, $repairer_tel, $duedate, $combono, $receivable_date, $c_start_date, $c_end_date) = $excelArray[$row]; |
|||
$customerid = (!$customerid) ? $contractno : $customerid; |
|||
$repairer_tel = str_pad(str_replace("-", "", $repairer_tel), 10, "0", STR_PAD_LEFT); // 保養員手机号 |
|||
$combono = substr($combono,-5);//套餐编码 |
|||
$area = mb_substr($address, 0, 3); |
|||
if (is_numeric($duedate)) $duedate = date("Y-m-d", ($duedate-25569)*24*60*60); // 預保養日 |
|||
if (is_numeric($c_start_date)) $c_start_date = date("Y-m-d", ($c_start_date-25569)*24*60*60); // 合約起始日 |
|||
if (is_numeric($c_end_date)) $c_end_date = date("Y-m-d", ($c_end_date-25569)*24*60*60); // 合約終止日 |
|||
|
|||
// 创建客户信息 |
|||
$accountid= $contractno; //账户id |
|||
//判断账户是否存在 |
|||
$sql = "select * from account where accountid = '$accountid'"; |
|||
$data = mysqli_query($link,$sql); |
|||
$nums_rows = mysqli_num_rows($data); |
|||
if($nums_rows==0){ |
|||
//添加用户 |
|||
$accounttype = "A"; //账户类型 |
|||
$pwd = "123";//账户默认密码 |
|||
|
|||
//查询保养员电话 |
|||
$sqlfre = "SELECT name, tel FROM account where accountid = '$repairerid' and accounttype = 'B'"; |
|||
$repairerdata = mysqli_query($link, $sqlfre); # 用mysqli_query方法执行(sql语法)将结果存在变数中 |
|||
if ($rowdata = mysqli_fetch_assoc($repairerdata)) { |
|||
$db_repair_name = $rowdata['name']; |
|||
$db_repair_tel = $rowdata['tel']; |
|||
} |
|||
mysqli_free_result($repairerdata); |
|||
|
|||
if ($db_repair_name == $repairer_name && (str_pad(str_replace("-", "", $db_repair_tel), 10, "0", STR_PAD_LEFT)) == $repairer_tel) { |
|||
$create_at = date('Y/m/d H:i:s');//账户创建时间 |
|||
$db_query1 = "insert into account(accounttype, accountid, pwd, name, tel, address,phone_call_help, repairerid, creater, create_at) values ("; |
|||
$db_query1 .= "'$accounttype', '$accountid', '$pwd', '$name', '$tel', '$address', '$repairer_tel', '$repairerid','$user_id', '$create_at')"; |
|||
mysqli_query($link,$db_query1); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "客户账户新增成功\r\n"; |
|||
$repair_right = 1; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
} else { |
|||
echo "保養員姓名或電話有誤"; |
|||
} |
|||
} else { |
|||
echo "账户已经存在"; |
|||
$repair_right = 1; |
|||
} |
|||
|
|||
if ($repair_right) { |
|||
//创建合约信息 |
|||
//判断合约是否存在 |
|||
$contractsql = "select * from contract where contractno = '$contractno'"; |
|||
$contract_nums_rows=mysqli_num_rows(mysqli_query($link,$contractsql)); |
|||
if($contract_nums_rows==0){ |
|||
$contracttype= "A"; |
|||
$company= $name;//公司名称默认客户姓名 |
|||
$taxid= " ";//统一编码 |
|||
$promiser= $name;//契约人,个人客户默认客户姓名 |
|||
$contractperson= $name;//联系人 |
|||
$contractaddress= $address;//联系地址 |
|||
$contracttel= $tel;//联络电话 |
|||
$contractemail= ""; |
|||
$contract_employee= "";//契约员工号 |
|||
$create_at = date('Y/m/d H:i:s');//合同创建时间 |
|||
$db_query2 = "INSERT INTO contract(contracttype, contractno, company, taxid, address, tel, promiser, customerid, contractperson, contractaddress, contracttel, contractemail,contract_employee,start_date,end_date, creater, create_at) VALUES ('$contracttype', '$contractno', '$company', '$taxid', '$address', '$tel', '$promiser', '$customerid', '$contractperson', '$contractaddress', '$contracttel', '$contractemail','$contract_employee','$c_start_date','$c_end_date', '$user_id', '$create_at')"; |
|||
mysqli_query($link,$db_query2); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo "合约新增成功\r\n"; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
}else{ |
|||
echo "合约已经存在"; |
|||
} |
|||
|
|||
//创建作番信息 |
|||
switch ($facilityno) { |
|||
case (preg_match('/TX/', $facilityno) ? true : false): |
|||
case (preg_match('/JX/', $facilityno) ? true : false): |
|||
$facility_kind = "MAE100"; |
|||
break; |
|||
case (preg_match('/TW/', $facilityno) ? true : false): |
|||
$facility_kind = "MAM200"; |
|||
break; |
|||
case (preg_match('/TH/', $facilityno) ? true : false): |
|||
$facility_kind = "MAH100"; |
|||
break; |
|||
case (preg_match('/TZ/', $facilityno) ? true : false): |
|||
$facility_kind = "MAZ100"; |
|||
break; |
|||
case (preg_match('/TH/', $facilityno) ? true : false): |
|||
$facility_kind = "MAQ100"; |
|||
break; |
|||
default: |
|||
$facility_kind = ""; |
|||
} |
|||
$facilitsql = "SELECT * FROM facility where facilityno='$facilityno' and contractno='$contractno'"; |
|||
$facilit_nums_rows=mysqli_num_rows(mysqli_query($link,$facilitsql)); |
|||
if($facilit_nums_rows==0){ |
|||
$weight= "450";//重量 |
|||
$numberofpassenger = "6"; // 人乘 |
|||
$numberofstop= "2";//停数 |
|||
$numberoffloor= "2";//楼层数 |
|||
$opentype= "CO-SO";//开门方式 |
|||
$speed= "60";//速度 |
|||
$repairtype= "A";//维护类型 |
|||
$create_at = date('Y/m/d H:i:s');//作番创建时间 |
|||
|
|||
$db_query3 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofpassenger,numberofstop, numberoffloor,opentype,speed,repairtype,facility_kind,longitude, latitude, address,repairerid,repairername,area,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofpassenger','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$facility_kind','$longitude', '$latitude', '$address','$repairerid','$repairer_name','$area','$user_id', '$create_at')"; |
|||
mysqli_query($link,$db_query3); |
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo "作番新增成功\n"; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
}else{ |
|||
echo "作番已经存在"; |
|||
} |
|||
//创建保养计划 |
|||
echo "保养日期"; |
|||
$schedulesql = "SELECT * FROM schedule where facilityno='$facilityno' and duedate='$duedate'"; |
|||
$schedule_nums_rows=mysqli_num_rows(mysqli_query($link,$schedulesql)); |
|||
if($schedule_nums_rows==0){ |
|||
$create_at = date('Y/m/d H:i:s');//作番创建时间 |
|||
$db_query4 = "INSERT INTO schedule(contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES ('$contractno', '$facilityno', '$combono', '$repairerid', '$repairer_name', '$duedate', '$user_id', '$create_at')"; |
|||
$resiult=mysqli_query($link,$db_query4); |
|||
|
|||
if (mysqli_affected_rows($link)>0) { |
|||
echo $combono."作番保养计划新增成功\r\n"; |
|||
} |
|||
elseif(mysqli_affected_rows($link)==0) { |
|||
echo "无新增资料"; |
|||
} |
|||
}else{ |
|||
echo "作番保养计划已经存在"; |
|||
} |
|||
} |
|||
} |
|||
mysqli_close($link); |
|||
} |
|||
|
|||
//for ($i = 0; $i <= sizeof($excelArray); $i++) { |
|||
// //处理数据 |
|||
//// 创建客户信息 |
|||
// echo "循环读取数据插入数据库---".$row."---"; |
|||
// echo$accounttype= "A"; //账户类型 |
|||
// echo$accountid= $excelArray[$row][6]; //账户id |
|||
// echo$pwd= "123";//账户默认密码 |
|||
// echo$name= $excelArray[$row][5];//账户姓名 |
|||
// echo$address= $excelArray[$row][2];//账户地址 |
|||
// echo$phone_call_help=$excelArray[$row][7];//联络手机号 |
|||
// echo$repairerid=$excelArray[$row][8];//服务与支持人员工号 |
|||
// echo$creater = 'vensen';//建档人 |
|||
// echo$create_at = date('Y/m/d H:i:s');//账户创建时间 |
|||
////判断账户是否存在 |
|||
// $sqlselect='select * from account where accountid='.$accountid; |
|||
// $res = mysqli_query($link,$sqlselect); |
|||
// echo "------结果".'<br>'; |
|||
// print_r($res); |
|||
// |
|||
// echo "------".'<br>'; |
|||
//} |
|||
// |
|||
// var_dump($excelArray); |
|||
|
|||
?> |
|||
|
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" |
|||
enctype="multipart/form-data"> |
|||
|
|||
<div class="bottom-margin">資料 |
|||
<label for="fileToUpload">上傳</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $_GET['token']; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
|
@ -1,131 +1,131 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "expert-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="expert_id">專家ID</label> |
|||
<input type="text" name="expert_id" id="expert_id" placeholder="請輸入專家ID..." required> |
|||
<p class="error"><?php echo $expert_id_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="personal_id">身分證字號</label> |
|||
<input type="text" name="personal_id" id="personal_id"> |
|||
<p class="error"><?php echo $personal_id_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">顯示姓名</label> |
|||
<input type="text" name="name" id="name"> |
|||
<p class="error"><?php echo $name_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="title">稱謂</label> |
|||
<input type="text" name="title" id="title"> |
|||
<p class="error"><?php echo $title_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="major">專長</label> |
|||
<input type="text" name="major" id="major"> |
|||
<p class="error"><?php echo $major_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel"> |
|||
<p class="error"><?php echo $tel_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel_count">電話支援次數</label> |
|||
<input type="text" name="tel_count" id="tel_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $tel_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_id">文字客服連結</label> |
|||
<input type="text" name="chat_id" id="chat_id"> |
|||
<p class="error"><?php echo $chat_id_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_count">文字客服次數</label> |
|||
<input type="text" name="chat_count" id="chat_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $chat_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_call">遠程視頻連結</label> |
|||
<input type="text" name="video_call" id="video_call"> |
|||
<p class="error"><?php echo $video_call_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_count">遠程視頻次數</label> |
|||
<input type="text" name="video_count" id="video_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $video_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_call">現場支援電話</label> |
|||
<input type="text" name="onsite_call" id="onsite_call"> |
|||
<p class="error"><?php echo $onsite_call_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_count">現場支援次數</label> |
|||
<input type="text" name="onsite_count" id="onsite_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $onsite_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="fileToUpload">上傳圖片</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "expert-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="expert_id">專家ID</label> |
|||
<input type="text" name="expert_id" id="expert_id" placeholder="請輸入專家ID..." required> |
|||
<p class="error"><?php echo $expert_id_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="personal_id">身分證字號</label> |
|||
<input type="text" name="personal_id" id="personal_id"> |
|||
<p class="error"><?php echo $personal_id_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">顯示姓名</label> |
|||
<input type="text" name="name" id="name"> |
|||
<p class="error"><?php echo $name_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="title">稱謂</label> |
|||
<input type="text" name="title" id="title"> |
|||
<p class="error"><?php echo $title_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="major">專長</label> |
|||
<input type="text" name="major" id="major"> |
|||
<p class="error"><?php echo $major_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel"> |
|||
<p class="error"><?php echo $tel_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel_count">電話支援次數</label> |
|||
<input type="text" name="tel_count" id="tel_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $tel_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_id">文字客服連結</label> |
|||
<input type="text" name="chat_id" id="chat_id"> |
|||
<p class="error"><?php echo $chat_id_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_count">文字客服次數</label> |
|||
<input type="text" name="chat_count" id="chat_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $chat_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_call">遠程視頻連結</label> |
|||
<input type="text" name="video_call" id="video_call"> |
|||
<p class="error"><?php echo $video_call_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_count">遠程視頻次數</label> |
|||
<input type="text" name="video_count" id="video_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $video_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_call">現場支援電話</label> |
|||
<input type="text" name="onsite_call" id="onsite_call"> |
|||
<p class="error"><?php echo $onsite_call_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_count">現場支援次數</label> |
|||
<input type="text" name="onsite_count" id="onsite_count" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
<p class="error"><?php echo $onsite_count_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
<p class="error"><?php echo $creater_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at" value="<?php date('Y/m/d H:i:s'); ?>"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="fileToUpload">上傳圖片</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM expert WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=expert-index.php?function_name=expert&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM expert WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=expert-index.php?function_name=expert&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,126 +1,126 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/expert-record-update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="expert-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="expert_id">專家ID</label> |
|||
<input type="text" name="expert_id" id="expert_id" value="<?php echo $data['expert_id']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="personal_id">身分證字號</label> |
|||
<input type="text" name="personal_id" id="personal_id" value="<?php echo $data['personal_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">顯示姓名</label> |
|||
<input type="text" name="name" id="name" value="<?php echo $data['name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="title">稱謂</label> |
|||
<input type="text" name="title" id="title" value="<?php echo $data['title']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="major">專長</label> |
|||
<input type="text" name="major" id="major" value="<?php echo $data['major']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel_count">電話支援次數</label> |
|||
<input type="text" name="tel_count" id="tel_count" value="<?php echo $data['tel_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_id">文字客服連結</label> |
|||
<input type="text" name="chat_id" id="chat_id" value="<?php echo $data['chat_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_count">文字客服次數</label> |
|||
<input type="text" name="chat_count" id="chat_count" value="<?php echo $data['chat_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_call">遠程視頻連結</label> |
|||
<input type="text" name="video_call" id="video_call" value="<?php echo $data['video_call']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_count">遠程視頻次數</label> |
|||
<input type="text" name="video_count" id="video_count" value="<?php echo $data['video_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_call">現場支援電話</label> |
|||
<input type="text" name="onsite_call" id="onsite_call" value="<?php echo $data['onsite_call']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_count">現場支援次數</label> |
|||
<input type="text" name="onsite_count" id="onsite_count" value="<?php echo $data['onsite_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="create_at">頭像</label> |
|||
<a><?php echo $data['picture']; ?></a> |
|||
<img width="125px" src="<?php echo $data['picture']?>" alt="" class="index-image"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/expert-record-update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="expert-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="expert_id">專家ID</label> |
|||
<input type="text" name="expert_id" id="expert_id" value="<?php echo $data['expert_id']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="personal_id">身分證字號</label> |
|||
<input type="text" name="personal_id" id="personal_id" value="<?php echo $data['personal_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="name">顯示姓名</label> |
|||
<input type="text" name="name" id="name" value="<?php echo $data['name']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="title">稱謂</label> |
|||
<input type="text" name="title" id="title" value="<?php echo $data['title']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="major">專長</label> |
|||
<input type="text" name="major" id="major" value="<?php echo $data['major']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel">電話</label> |
|||
<input type="text" name="tel" id="tel" value="<?php echo $data['tel']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="tel_count">電話支援次數</label> |
|||
<input type="text" name="tel_count" id="tel_count" value="<?php echo $data['tel_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_id">文字客服連結</label> |
|||
<input type="text" name="chat_id" id="chat_id" value="<?php echo $data['chat_id']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="chat_count">文字客服次數</label> |
|||
<input type="text" name="chat_count" id="chat_count" value="<?php echo $data['chat_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_call">遠程視頻連結</label> |
|||
<input type="text" name="video_call" id="video_call" value="<?php echo $data['video_call']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="video_count">遠程視頻次數</label> |
|||
<input type="text" name="video_count" id="video_count" value="<?php echo $data['video_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_call">現場支援電話</label> |
|||
<input type="text" name="onsite_call" id="onsite_call" value="<?php echo $data['onsite_call']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="onsite_count">現場支援次數</label> |
|||
<input type="text" name="onsite_count" id="onsite_count" value="<?php echo $data['onsite_count']; ?>" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div class="bottom-margin"> |
|||
<label for="create_at">頭像</label> |
|||
<a><?php echo $data['picture']; ?></a> |
|||
<img width="125px" src="<?php echo $data['picture']?>" alt="" class="index-image"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
@ -1,154 +1,154 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM expert $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="expert-account-create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="expert-create.php?function_name=expert&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:expert-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>項次</th> |
|||
<th>專家ID</th> |
|||
<th>身分證字號</th> |
|||
<th>顯示姓名</th> |
|||
<th>稱謂</th> |
|||
<th class="width_style_1">頭像</th> |
|||
<th class="width_style_1">專長</th> |
|||
<th>電話</th> |
|||
<th>電話支援次數</th> |
|||
<th>Chat帳號</th> |
|||
<th>Chat支援次數</th> |
|||
<th>Video帳號</th> |
|||
<th>遠程視頻次數</th> |
|||
<th>現場支援客服窗口</th> |
|||
<th>現場支援次數</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['expert_id']; ?></td> |
|||
<td><?php echo $data['personal_id']; ?></td> |
|||
<td><?php echo $data['name']; ?></td> |
|||
<td><?php echo $data['title']; ?></td> |
|||
<td class="width_style_1"><img src="<?php echo $data['picture']; ?>" alt="" class="index-image"></td> |
|||
<td class="width_style_1"><?php echo $data['major']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['tel_count']; ?></td> |
|||
<td><a href="<?php echo $data['chat_id']; ?>">連結</a></td> |
|||
<td><?php echo $data['chat_count']; ?></td> |
|||
<td><a href="<?php echo $data['video_call']; ?>">連結</a></td> |
|||
<td><?php echo $data['video_count']; ?></td> |
|||
<td><?php echo $data['onsite_call']; ?></td> |
|||
<td><?php echo $data['onsite_count']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="expert-edit.php?id=<?php echo $data['id']; ?>&function_name=expert&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="expert-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
$sql = "SELECT * FROM expert $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="expert-account-create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="expert-create.php?function_name=expert&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
|
|||
<?php |
|||
} |
|||
|
|||
|
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:expert-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th>項次</th> |
|||
<th>專家ID</th> |
|||
<th>身分證字號</th> |
|||
<th>顯示姓名</th> |
|||
<th>稱謂</th> |
|||
<th class="width_style_1">頭像</th> |
|||
<th class="width_style_1">專長</th> |
|||
<th>電話</th> |
|||
<th>電話支援次數</th> |
|||
<th>Chat帳號</th> |
|||
<th>Chat支援次數</th> |
|||
<th>Video帳號</th> |
|||
<th>遠程視頻次數</th> |
|||
<th>現場支援客服窗口</th> |
|||
<th>現場支援次數</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['expert_id']; ?></td> |
|||
<td><?php echo $data['personal_id']; ?></td> |
|||
<td><?php echo $data['name']; ?></td> |
|||
<td><?php echo $data['title']; ?></td> |
|||
<td class="width_style_1"><img src="<?php echo $data['picture']; ?>" alt="" class="index-image"></td> |
|||
<td class="width_style_1"><?php echo $data['major']; ?></td> |
|||
<td><?php echo $data['tel']; ?></td> |
|||
<td><?php echo $data['tel_count']; ?></td> |
|||
<td><a href="<?php echo $data['chat_id']; ?>">連結</a></td> |
|||
<td><?php echo $data['chat_count']; ?></td> |
|||
<td><a href="<?php echo $data['video_call']; ?>">連結</a></td> |
|||
<td><?php echo $data['video_count']; ?></td> |
|||
<td><?php echo $data['onsite_call']; ?></td> |
|||
<td><?php echo $data['onsite_count']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="expert-edit.php?id=<?php echo $data['id']; ?>&function_name=expert&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="expert-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
@ -1,136 +1,136 @@ |
|||
<?php |
|||
$id = ""; |
|||
$expert_id = ""; |
|||
$personal_id = ""; |
|||
$name = ""; |
|||
$title = ""; |
|||
$major = ""; |
|||
$tel = ""; |
|||
$tel_count = ""; |
|||
$chat_id = ""; |
|||
$chat_count = ""; |
|||
$video_call = ""; |
|||
$video_count = ""; |
|||
$onsite_call = ""; |
|||
$onsite_count = ""; |
|||
$creater = ""; |
|||
$create_at = ""; |
|||
$fileToUpload = ""; |
|||
|
|||
$id_error = ""; |
|||
$expert_id_error = ""; |
|||
$personal_id_error = ""; |
|||
$name_error = ""; |
|||
$title_error = ""; |
|||
$major_error = ""; |
|||
$tel_error = ""; |
|||
$tel_count_error = ""; |
|||
$chat_id_error = ""; |
|||
$chat_count_error = ""; |
|||
$video_call_error = ""; |
|||
$video_count_error = ""; |
|||
$onsite_call_error = ""; |
|||
$onsite_count_error = ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
# $name_error = $email_error = $comment_error = $website_error = ""; |
|||
|
|||
|
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "expert-user-input.php"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
$db_query = "INSERT INTO expert (expert_id,personal_id,name,title,picture,major,tel,tel_count,chat_id,chat_count,video_call,video_count,onsite_call,onsite_count,creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$target_file' ,'$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
//Check if image is an actual image or fake image |
|||
|
|||
if(strlen($target_file) <= strlen("expert-uploads/")){ |
|||
|
|||
$db_query = "INSERT INTO expert(expert_id, personal_id, name, title, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')"; |
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
#echo $result; |
|||
|
|||
}else { |
|||
|
|||
$check_img = getimagesize($temp_file_name); |
|||
|
|||
if($check_img == false) { |
|||
echo "<font color='#FF0000'>File is not an image</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//echo "File is an image - " . $check_img["mime"]; |
|||
$upload_ok = 1; |
|||
|
|||
//Check if file already exists |
|||
if(file_exists($target_file)) { |
|||
echo "<font color='#FF0000'>File is already uploaded!</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check file size |
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
echo "<font color='#FF0000'>JPG, PNG, JPEG and GIF files are allowed</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
|
|||
|
|||
// sql語法存在變數中 |
|||
// $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)"; |
|||
$db_query = "INSERT INTO expert(expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$target_file', '$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
|
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
<?php |
|||
$id = ""; |
|||
$expert_id = ""; |
|||
$personal_id = ""; |
|||
$name = ""; |
|||
$title = ""; |
|||
$major = ""; |
|||
$tel = ""; |
|||
$tel_count = ""; |
|||
$chat_id = ""; |
|||
$chat_count = ""; |
|||
$video_call = ""; |
|||
$video_count = ""; |
|||
$onsite_call = ""; |
|||
$onsite_count = ""; |
|||
$creater = ""; |
|||
$create_at = ""; |
|||
$fileToUpload = ""; |
|||
|
|||
$id_error = ""; |
|||
$expert_id_error = ""; |
|||
$personal_id_error = ""; |
|||
$name_error = ""; |
|||
$title_error = ""; |
|||
$major_error = ""; |
|||
$tel_error = ""; |
|||
$tel_count_error = ""; |
|||
$chat_id_error = ""; |
|||
$chat_count_error = ""; |
|||
$video_call_error = ""; |
|||
$video_count_error = ""; |
|||
$onsite_call_error = ""; |
|||
$onsite_count_error = ""; |
|||
$creater_error = ""; |
|||
$create_at_error = ""; |
|||
# $name_error = $email_error = $comment_error = $website_error = ""; |
|||
|
|||
|
|||
|
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
include "expert-user-input.php"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
$db_query = "INSERT INTO expert (expert_id,personal_id,name,title,picture,major,tel,tel_count,chat_id,chat_count,video_call,video_count,onsite_call,onsite_count,creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$target_file' ,'$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')"; |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
//Check if image is an actual image or fake image |
|||
|
|||
if(strlen($target_file) <= strlen("expert-uploads/")){ |
|||
|
|||
$db_query = "INSERT INTO expert(expert_id, personal_id, name, title, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')"; |
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
#echo $result; |
|||
|
|||
}else { |
|||
|
|||
$check_img = getimagesize($temp_file_name); |
|||
|
|||
if($check_img == false) { |
|||
echo "<font color='#FF0000'>File is not an image</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//echo "File is an image - " . $check_img["mime"]; |
|||
$upload_ok = 1; |
|||
|
|||
//Check if file already exists |
|||
if(file_exists($target_file)) { |
|||
echo "<font color='#FF0000'>File is already uploaded!</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check file size |
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
echo "<font color='#FF0000'>JPG, PNG, JPEG and GIF files are allowed</font>"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
|
|||
|
|||
// sql語法存在變數中 |
|||
// $db_query = "INSERT INTO expert (id, expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater, create_at) VALUE (`$id`, `$expert_id`, `$personal_id`, `$name`, `$title`, `$target_file`, `$major`, `$tel`, `$tel_count`, `$chat_id`, `$chat_count`, `$video_call`, `$video_count`, `$onsite_call`, `$onsite_count`, `$creater`, `$create_at`)"; |
|||
$db_query = "INSERT INTO expert(expert_id, personal_id, name, title, picture, major, tel, tel_count, chat_id, chat_count, video_call, video_count, onsite_call, onsite_count, creater) VALUES ('$expert_id', '$personal_id', '$name', '$title', '$target_file', '$major', '$tel', '$tel_count', '$chat_id', '$chat_count', '$video_call', '$video_count', '$onsite_call', '$onsite_count', '$creater')"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$result = mysqli_query($link,$db_query); |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
|
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('新增成功');"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料');"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
|||
|
@ -1,85 +1,85 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
|
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$expert_id = user_input($_POST["expert_id"]); |
|||
$personal_id = user_input($_POST["personal_id"]); |
|||
$name = user_input($_POST["name"]); |
|||
$title = user_input($_POST["title"]); |
|||
$major = user_input($_POST["major"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$tel_count = user_input($_POST["tel_count"]); |
|||
$chat_id = user_input($_POST["chat_id"]); |
|||
$chat_count = user_input($_POST["chat_count"]); |
|||
$video_call = user_input($_POST["video_call"]); |
|||
$video_count = user_input($_POST["video_count"]); |
|||
$onsite_call = user_input($_POST["onsite_call"]); |
|||
$onsite_count = user_input($_POST["onsite_count"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
|
|||
if(strlen($target_file) <= strlen("expert-uploads/")){ |
|||
$db_query = "UPDATE expert set expert_id = '$expert_id', personal_id = '$personal_id', name = '$name', title = '$title', major = '$major', tel = '$tel', tel_count = '$tel_count', chat_id = '$chat_id', chat_count = '$chat_count', video_call = '$video_call', video_count = '$video_count', onsite_call = '$onsite_call', onsite_count = '$onsite_count', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
}else { |
|||
|
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { // |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
//echo "JPG, PNG, JPEG and GIF files are allowed"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
$db_query = "UPDATE expert set expert_id = '$expert_id', personal_id = '$personal_id', name = '$name', title = '$title', picture = '$target_file', major = '$major', tel = '$tel', tel_count = '$tel_count', chat_id = '$chat_id', chat_count = '$chat_count', video_call = '$video_call', video_count = '$video_count', onsite_call = '$onsite_call', onsite_count = '$onsite_count', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
|
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料')"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
if(isset($_POST['update'])) { |
|||
|
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$id = $_POST['id']; |
|||
$expert_id = user_input($_POST["expert_id"]); |
|||
$personal_id = user_input($_POST["personal_id"]); |
|||
$name = user_input($_POST["name"]); |
|||
$title = user_input($_POST["title"]); |
|||
$major = user_input($_POST["major"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$tel_count = user_input($_POST["tel_count"]); |
|||
$chat_id = user_input($_POST["chat_id"]); |
|||
$chat_count = user_input($_POST["chat_count"]); |
|||
$video_call = user_input($_POST["video_call"]); |
|||
$video_count = user_input($_POST["video_count"]); |
|||
$onsite_call = user_input($_POST["onsite_call"]); |
|||
$onsite_count = user_input($_POST["onsite_count"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
|
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$file_size = $_FILES["fileToUpload"]["size"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . basename($file_name)); |
|||
$upload_ok = 1; |
|||
$img_file_type = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
|
|||
|
|||
if(strlen($target_file) <= strlen("expert-uploads/")){ |
|||
$db_query = "UPDATE expert set expert_id = '$expert_id', personal_id = '$personal_id', name = '$name', title = '$title', major = '$major', tel = '$tel', tel_count = '$tel_count', chat_id = '$chat_id', chat_count = '$chat_count', video_call = '$video_call', video_count = '$video_count', onsite_call = '$onsite_call', onsite_count = '$onsite_count', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
}else { |
|||
|
|||
if($file_size > 500000) { |
|||
echo "<font color='#FF0000'>Please enter a file size between 5mb</font>"; |
|||
$upload_ok = 0; |
|||
} else { // |
|||
//Allow certain file formats |
|||
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") { |
|||
//echo "JPG, PNG, JPEG and GIF files are allowed"; |
|||
$upload_ok = 0; |
|||
} else { |
|||
//Check if $upload_ok is set to 0 by an error |
|||
if($upload_ok === 0) { |
|||
echo "<font color='#FF0000'>File has not been uploaded</font>"; |
|||
} else { |
|||
if(move_uploaded_file($temp_file_name, $target_file)){ |
|||
$db_query = "UPDATE expert set expert_id = '$expert_id', personal_id = '$personal_id', name = '$name', title = '$title', picture = '$target_file', major = '$major', tel = '$tel', tel_count = '$tel_count', chat_id = '$chat_id', chat_count = '$chat_count', video_call = '$video_call', video_count = '$video_count', onsite_call = '$onsite_call', onsite_count = '$onsite_count', create_at = '$create_at' WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
$affected = mysqli_affected_rows($link); |
|||
mysqli_close($link); |
|||
|
|||
if ($affected > 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('update成功');"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} elseif ($affected == 0) { |
|||
echo "<script type ='text/JavaScript'>"; |
|||
echo "alert('無新增資料')"; |
|||
echo "location.href='expert-index.php?function_name=expert&".$token_link."';"; |
|||
echo "</script>"; |
|||
} else { |
|||
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link); |
|||
} |
|||
} |
|||
?> |
@ -1,59 +1,59 @@ |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$expert_id = user_input($_POST["expert_id"]); |
|||
$personal_id = user_input($_POST["personal_id"]); |
|||
$name = user_input($_POST["name"]); |
|||
$title = user_input($_POST["title"]); |
|||
$major = user_input($_POST["major"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$tel_count = user_input($_POST["tel_count"]); |
|||
$chat_id = user_input($_POST["chat_id"]); |
|||
$chat_count = user_input($_POST["chat_count"]); |
|||
$video_call = user_input($_POST["video_call"]); |
|||
$video_count = user_input($_POST["video_count"]); |
|||
$onsite_call = user_input($_POST["onsite_call"]); |
|||
$onsite_count = user_input($_POST["onsite_count"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = user_input($_POST["create_at"]); |
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
<?php |
|||
|
|||
//Function to filter the form input |
|||
function user_input( $data ) { |
|||
$data1 = trim($data); |
|||
$data2 = stripslashes($data1); |
|||
$data3 = htmlspecialchars($data2); |
|||
return $data3; |
|||
} |
|||
|
|||
$expert_id = user_input($_POST["expert_id"]); |
|||
$personal_id = user_input($_POST["personal_id"]); |
|||
$name = user_input($_POST["name"]); |
|||
$title = user_input($_POST["title"]); |
|||
$major = user_input($_POST["major"]); |
|||
$tel = user_input($_POST["tel"]); |
|||
$tel_count = user_input($_POST["tel_count"]); |
|||
$chat_id = user_input($_POST["chat_id"]); |
|||
$chat_count = user_input($_POST["chat_count"]); |
|||
$video_call = user_input($_POST["video_call"]); |
|||
$video_count = user_input($_POST["video_count"]); |
|||
$onsite_call = user_input($_POST["onsite_call"]); |
|||
$onsite_count = user_input($_POST["onsite_count"]); |
|||
$creater = user_input($_POST["creater"]); |
|||
$create_at = user_input($_POST["create_at"]); |
|||
|
|||
|
|||
|
|||
/* |
|||
|
|||
if(empty($_POST["name"])) { |
|||
$name_error = "Name is required"; |
|||
} else { |
|||
$name = user_input($_POST["name"]); |
|||
|
|||
if(!preg_match("/^[a-zA-Z ]*$/", $name)) { |
|||
$name_error = "Only letter and white space are allowed"; |
|||
} |
|||
} |
|||
|
|||
|
|||
/* |
|||
if(empty($_POST["website"])) { |
|||
$website_error = "Website address is required"; |
|||
} else { |
|||
$website = user_input($_POST["website"]); |
|||
|
|||
if(!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) { |
|||
$website_error = "Invalid website URL"; |
|||
} |
|||
} |
|||
|
|||
if(empty($_POST["comment"])) { |
|||
$comment = ""; |
|||
} else { |
|||
$comment = user_input($_POST["comment"]); |
|||
} |
|||
*/ |
|||
?> |
|||
|
@ -1,126 +1,126 @@ |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "facility-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input type="text" name="facilityno" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶編號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="weight">重量(必填)</label> |
|||
<input type="text" name="weight" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberofstop">停數(必填)</label> |
|||
<input type="text" name="numberofstop" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberoffloor">樓層數(必填)</label> |
|||
<input type="text" name="numberoffloor" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="opentype">開門方式(必填)</label> |
|||
<Select name="opentype" id="opentype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="CO">CO</Option> |
|||
<Option Value="SO">SO</Option> |
|||
<Option Value="CO-SO">CO-SO</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="opentype" id="opentype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="speed">速度(必填)</label> |
|||
<input type="text" name="speed" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairtype">維修型態(必填)</label> |
|||
<Select name="repairtype" id="repairtype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="repairtype" id="repairtype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input type="text" name="longitude" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input type="latitude" name="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">維修人員工號(必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairername">維修人員姓名(必填)</label> |
|||
<input type="text" name="repairername" id="repairername" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
<?php |
|||
include "header.php"; |
|||
?> |
|||
|
|||
<div class="container"> |
|||
|
|||
<?php |
|||
|
|||
include "facility-record-submit.php"; |
|||
/* |
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
echo "<p class='success'>Record has added successfully</p>"; |
|||
} |
|||
} |
|||
*/ |
|||
?> |
|||
|
|||
|
|||
|
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data"> |
|||
|
|||
|
|||
<div> |
|||
<label for="contractno">合約號(必填)</label> |
|||
<input type="text" name="contractno" id="contractno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="facilityno">作番號(必填)</label> |
|||
<input type="text" name="facilityno" id="facilityno" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶編號(必填)</label> |
|||
<input type="text" name="customerid" id="customerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="weight">重量(必填)</label> |
|||
<input type="text" name="weight" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberofstop">停數(必填)</label> |
|||
<input type="text" name="numberofstop" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberoffloor">樓層數(必填)</label> |
|||
<input type="text" name="numberoffloor" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="opentype">開門方式(必填)</label> |
|||
<Select name="opentype" id="opentype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="CO">CO</Option> |
|||
<Option Value="SO">SO</Option> |
|||
<Option Value="CO-SO">CO-SO</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="opentype" id="opentype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="speed">速度(必填)</label> |
|||
<input type="text" name="speed" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairtype">維修型態(必填)</label> |
|||
<Select name="repairtype" id="repairtype" required> |
|||
<option selected="selected" disabled="disabled" style="display: none" value=""></option> |
|||
<Option Value="A">定期保養</Option> |
|||
<Option Value="B">單次保養</Option> |
|||
<Option Value="C">單次維修</Option> |
|||
</Select> |
|||
<!-- <input type="text" name="repairtype" id="repairtype" > --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input type="text" name="longitude" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input type="latitude" name="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\D*(\d*(?:\.\d{0,7})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" > |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">維修人員工號(必填)</label> |
|||
<input type="text" name="repairerid" id="repairerid" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairername">維修人員姓名(必填)</label> |
|||
<input type="text" name="repairername" id="repairername" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $user_id; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<!-- <label for="create_at">create_at</label> --> |
|||
<input type="hidden" name="create_at" id="create_at"> |
|||
<p class="error"><?php echo $create_at_error; ?></p> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="submit">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php include "footer.php"; ?> |
|||
|
@ -1,12 +1,12 @@ |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM facility WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=facility-index.php?function_name=facility&".$token_link); |
|||
ob_end_flush(); |
|||
<?php |
|||
ob_start(); |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$db_query = "DELETE FROM facility WHERE id='$id'"; |
|||
mysqli_query($link, $db_query); |
|||
|
|||
header("Refresh:0; url=facility-index.php?function_name=facility&".$token_link); |
|||
ob_end_flush(); |
|||
?> |
@ -1,153 +1,153 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM facility WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="facility-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號</label> |
|||
<input type="text" name="contractno" id="contractno" value="<?php echo $data['contractno']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="facilityno">作番號</label> |
|||
<input type="text" name="facilityno" id="facilityno" value="<?php echo $data['facilityno']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶編號</label> |
|||
<input type="text" name="customerid" id="customerid" value="<?php echo $data['customerid']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="weight">重量</label> |
|||
<input type="text" name="weight" id="weight" value="<?php echo $data['weight']; ?>" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberofstop">停數</label> |
|||
<input type="text" name="numberofstop" id="numberofstop" value="<?php echo $data['numberofstop']; ?>" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberoffloor">樓層數</label> |
|||
<input type="text" name="numberoffloor" id="numberoffloor" value="<?php echo $data['numberoffloor']; ?>" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="opentype">開門方式</label> |
|||
<Select name="opentype" id="opentype" required> |
|||
<?php |
|||
switch ($data['opentype']) { |
|||
case "CO": |
|||
echo "<Option Value='CO' selected='selected'>CO</Option> <Option Value='OS'>SO</Option> <Option Value='CO-SO'>CO-SO</Option>"; |
|||
break; |
|||
case "SO": |
|||
echo "<Option Value='CO'>CO</Option> <Option Value='SO' selected='selected'>SO</Option> <Option Value='CO-SO'>CO-SO</Option>"; |
|||
break; |
|||
case "CO-SO": |
|||
echo "<Option Value='CO'>CO</Option> <Option Value='SO'>SO</Option> <Option Value='CO-SO' selected='selected'>CO-SO</Option>"; |
|||
break; |
|||
} |
|||
?> |
|||
</Select> |
|||
<!-- <input type="text" name="opentype" id="opentype" value=""> --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="speed">速度</label> |
|||
<input type="text" name="speed" id="speed" value="<?php echo $data['speed']; ?>" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairtype">維修型態</label> |
|||
<Select name="repairtype" id="repairtype" required> |
|||
<?php |
|||
switch ($data['repairtype']) { |
|||
case "A": |
|||
echo "<Option Value='A' selected='selected'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "B": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B' selected='selected'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "C": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C' selected='selected'>單次維修</Option>"; |
|||
break; |
|||
} |
|||
?> |
|||
</Select> |
|||
<!-- <input type="text" name="repairtype" id="repairtype" value=""> --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input type="text" name="longitude" id="longitude" value="<?php echo $data['longitude']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input type="latitude" name="latitude" id="latitude" value="<?php echo $data['latitude']; ?>"d> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">維修人員工號</label> |
|||
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data['repairerid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairername">維修人員姓名</label> |
|||
<input type="text" name="repairername" id="repairername" value="<?php echo $data['repairername']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); |
|||
|
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM facility WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
/* |
|||
include "inc/record_update.php"; |
|||
|
|||
try { |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$db_query = "SELECT * FROM expert WHERE id=$id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$db_query); |
|||
}catch (Exception $e) { |
|||
echo 'Caught exception: ', $e->getMessage(), "\n"; |
|||
} |
|||
*/ |
|||
foreach($data as $data) : |
|||
?> |
|||
|
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="facility-record-update.php" enctype="multipart/form-data"> |
|||
<input type="hidden" name="id" value="<?php echo $id; ?>"> |
|||
|
|||
<div> |
|||
<label for="contractno">合約號</label> |
|||
<input type="text" name="contractno" id="contractno" value="<?php echo $data['contractno']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="facilityno">作番號</label> |
|||
<input type="text" name="facilityno" id="facilityno" value="<?php echo $data['facilityno']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="customerid">客戶編號</label> |
|||
<input type="text" name="customerid" id="customerid" value="<?php echo $data['customerid']; ?>" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="weight">重量</label> |
|||
<input type="text" name="weight" id="weight" value="<?php echo $data['weight']; ?>" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberofstop">停數</label> |
|||
<input type="text" name="numberofstop" id="numberofstop" value="<?php echo $data['numberofstop']; ?>" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="numberoffloor">樓層數</label> |
|||
<input type="text" name="numberoffloor" id="numberoffloor" value="<?php echo $data['numberoffloor']; ?>" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\D*(\d*(?:\.\d)?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="opentype">開門方式</label> |
|||
<Select name="opentype" id="opentype" required> |
|||
<?php |
|||
switch ($data['opentype']) { |
|||
case "CO": |
|||
echo "<Option Value='CO' selected='selected'>CO</Option> <Option Value='OS'>SO</Option> <Option Value='CO-SO'>CO-SO</Option>"; |
|||
break; |
|||
case "SO": |
|||
echo "<Option Value='CO'>CO</Option> <Option Value='SO' selected='selected'>SO</Option> <Option Value='CO-SO'>CO-SO</Option>"; |
|||
break; |
|||
case "CO-SO": |
|||
echo "<Option Value='CO'>CO</Option> <Option Value='SO'>SO</Option> <Option Value='CO-SO' selected='selected'>CO-SO</Option>"; |
|||
break; |
|||
} |
|||
?> |
|||
</Select> |
|||
<!-- <input type="text" name="opentype" id="opentype" value=""> --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="speed">速度</label> |
|||
<input type="text" name="speed" id="speed" value="<?php echo $data['speed']; ?>" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\D*(\d*(?:\.\d{0,1})?).*$/g, '$1')" required> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairtype">維修型態</label> |
|||
<Select name="repairtype" id="repairtype" required> |
|||
<?php |
|||
switch ($data['repairtype']) { |
|||
case "A": |
|||
echo "<Option Value='A' selected='selected'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "B": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B' selected='selected'>單次保養</Option> <Option Value='C'>單次維修</Option>"; |
|||
break; |
|||
case "C": |
|||
echo "<Option Value='A'>定期保養</Option> <Option Value='B'>單次保養</Option> <Option Value='C' selected='selected'>單次維修</Option>"; |
|||
break; |
|||
} |
|||
?> |
|||
</Select> |
|||
<!-- <input type="text" name="repairtype" id="repairtype" value=""> --> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="longitude">經度(必填)</label> |
|||
<input type="text" name="longitude" id="longitude" value="<?php echo $data['longitude']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="latitude">緯度(必填)</label> |
|||
<input type="latitude" name="latitude" id="latitude" value="<?php echo $data['latitude']; ?>"d> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="address">地址</label> |
|||
<input type="text" name="address" id="address" value="<?php echo $data['address']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairerid">維修人員工號</label> |
|||
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data['repairerid']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="repairername">維修人員姓名</label> |
|||
<input type="text" name="repairername" id="repairername" value="<?php echo $data['repairername']; ?>"> |
|||
</div> |
|||
|
|||
<div> |
|||
<label for="creater">建檔人</label> |
|||
<input type="text" name="creater" id="creater" value="<?php echo $data['creater']; ?>" readonly> |
|||
</div> |
|||
|
|||
<div> |
|||
<button type="submit" name="update">確定</button> |
|||
</div> |
|||
<input type="hidden" name="token" value="<?php echo $token; ?>"> |
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
endforeach; |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
|||
|
|||
|
@ -1,115 +1,115 @@ |
|||
<?php |
|||
// 载入db.php来连结资料库 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
require_once 'PHPExcel/PHPExcel.php'; |
|||
require_once 'PHPExcel/IOFactory.php'; |
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . iconv("UTF-8", "gbk", basename($file_name))); |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
if (move_uploaded_file($temp_file_name, $target_file)) { |
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5');//支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');//支持xlsx |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
for ($row = 2; $row <= $highestRow; $row++) { |
|||
$val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue(); |
|||
|
|||
if ($val == "") return; |
|||
for ($column = 1; $column < $highestColumn; $column++) { |
|||
$val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(); |
|||
$excelArray[$row][] = $val; //读取excel数据到数组 |
|||
} |
|||
|
|||
$facilityno = $excelArray[$row][1]; //作番id |
|||
$facilitsql = "SELECT * FROM facility where facilityno='$facilityno'"; |
|||
$facilit_nums_rows = mysqli_num_rows(mysqli_query($link, $facilitsql)); |
|||
if ($facilit_nums_rows == 0) { |
|||
echo $row; |
|||
$contractno = $excelArray[$row][0]?:'null'; //合约号 |
|||
$facilityno = $excelArray[$row][1]?:'null'; //作番号 |
|||
$address = $excelArray[$row][2]?:'null'; //作番安装地址 |
|||
$longitude = $excelArray[$row][3]?:'null';//纬度 |
|||
$latitude = $excelArray[$row][4]?:'null';//经度 |
|||
$customerid = $excelArray[$row][5]?:'null'; //客户/业主名称 |
|||
$customercode = $excelArray[$row][6]?:'null'; //业主ID或统一信用代码 |
|||
$customerlinknumber = $excelArray[$row][7]?:'null'; //业主联络电话或手机 |
|||
$repairerid = $excelArray[$row][8]?:'null'; //保养员工号 |
|||
$repairername = $excelArray[$row][9]?:'null'; //保养员姓名 |
|||
$repairerphonenumber = $excelArray[$row][10]?:'null'; //保养员手机号 |
|||
$baoyangdate= $excelArray[$row][11]?:'null'; //保养日期 |
|||
$maintainance= $excelArray[$row][12]?:'null'; //保养计划类别.保養別\r\nA=全包\r\nB=半包\r\nC=清包\r\nD=半包:2個月保養一次 |
|||
$yingshoukuandate= $excelArray[$row][13]?:'null'; //应收款日期 |
|||
$contractstartdate= $excelArray[$row][14]?:'null'; //合约起始年月日 |
|||
$contractenddate= $excelArray[$row][15]?:'null'; //合约终止年月日 |
|||
$facilitychuchangno= $excelArray[$row][16]?:'null'; //原作番出厂编号 |
|||
$contractpersonid= $excelArray[$row][17]?:'null'; //契约人员工号 |
|||
$contractpersonname= $excelArray[$row][18]?:'null'; //契约人员姓名 |
|||
$weight= $excelArray[$row][19]?:'null'; //载重/输送能力 |
|||
$numberoffloor= $excelArray[$row][20]?:'null'; //层站,停数/提升高度 |
|||
$speed= $excelArray[$row][21]?:'null'; //速度 |
|||
$brand= $excelArray[$row][22]?:'null'; //品牌,型号 |
|||
$officialregistrationcode= $excelArray[$row][13]?:'null'; //官方注册代码 |
|||
$manufacturedate= $excelArray[$row][24]?:'null'; //制造日期 |
|||
$creater = "batch"; |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
//无效字段 |
|||
$numberofstop='0'; |
|||
$opentype='0'; |
|||
$repairtype='0'; |
|||
echo $db_query1 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofstop, numberoffloor,opentype,speed,repairtype,longitude, latitude, address,repairerid,repairername,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$longitude', '$latitude', '$address','$repairerid','$repairername','$creater', '$create_at')"; |
|||
|
|||
mysqli_query($link, $db_query1); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "作番新增成功\n"; |
|||
//添加作番拓展字段 |
|||
$facilityid=mysqli_insert_id($link); |
|||
$db_query2 = "INSERT INTO facility_extends(facilityid,facilitychuchangno,contractpersonid,contractpersonname,brand,officialregistrationcode,manufacturedate,creater, create_at) VALUES ("; |
|||
$db_query2.=" '$facilityid', '$facilitychuchangno','$contractpersonid','$contractpersonname','$brand','$officialregistrationcode','$manufacturedate','$creater', '$create_at')"; |
|||
|
|||
|
|||
mysqli_query($link, $db_query2); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo '扩展添加成功'; |
|||
} |
|||
|
|||
} elseif (mysqli_affected_rows($link) == 0) { |
|||
echo "无新增资料"; |
|||
} |
|||
} else { |
|||
echo "作番已经存在"; |
|||
echo $facilityno; |
|||
} |
|||
|
|||
//print_r($excelArray); |
|||
} |
|||
mysqli_close($link); |
|||
} |
|||
|
|||
?> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" |
|||
enctype="multipart/form-data"> |
|||
|
|||
<div class="bottom-margin">资料 |
|||
<label for="fileToUpload">上传</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<button type="submit" name="submit">确定</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
<?php |
|||
// 载入db.php来连结资料库 |
|||
require_once "database.php"; |
|||
include "header.php"; |
|||
require_once 'PHPExcel/PHPExcel.php'; |
|||
require_once 'PHPExcel/IOFactory.php'; |
|||
$file_name = $_FILES["fileToUpload"]["name"]; |
|||
$temp_file_name = $_FILES["fileToUpload"]["tmp_name"]; |
|||
$target_dir = "expert-uploads/"; |
|||
$target_file = strtolower($target_dir . iconv("UTF-8", "gbk", basename($file_name))); |
|||
$EXTENSION = pathinfo($target_file, PATHINFO_EXTENSION); |
|||
if (move_uploaded_file($temp_file_name, $target_file)) { |
|||
if ($EXTENSION == 'xls') { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel5');//支持xls |
|||
} else { |
|||
$objReader = PHPExcel_IOFactory::createReader('Excel2007');//支持xlsx |
|||
} |
|||
$objPHPExcel = $objReader->load($target_file); //读取上传到服务器的文件 |
|||
$sheet = $objPHPExcel->getSheet(0);//拿到第一个sheet数据 |
|||
$highestRow = $sheet->getHighestRow(); // 取得总行数 |
|||
$highestColumn = $sheet->getHighestColumn(); // 取得总列数 |
|||
$highestColumn = PHPExcel_Cell::columnIndexFromString($highestColumn); // 转换字母为对应的统计数字; |
|||
$excelArray = array(); |
|||
for ($row = 2; $row <= $highestRow; $row++) { |
|||
$val = $sheet->getCellByColumnAndRow(0, $row)->getCalculatedValue(); |
|||
|
|||
if ($val == "") return; |
|||
for ($column = 1; $column < $highestColumn; $column++) { |
|||
$val = $sheet->getCellByColumnAndRow($column, $row)->getCalculatedValue(); |
|||
$excelArray[$row][] = $val; //读取excel数据到数组 |
|||
} |
|||
|
|||
$facilityno = $excelArray[$row][1]; //作番id |
|||
$facilitsql = "SELECT * FROM facility where facilityno='$facilityno'"; |
|||
$facilit_nums_rows = mysqli_num_rows(mysqli_query($link, $facilitsql)); |
|||
if ($facilit_nums_rows == 0) { |
|||
echo $row; |
|||
$contractno = $excelArray[$row][0]?:'null'; //合约号 |
|||
$facilityno = $excelArray[$row][1]?:'null'; //作番号 |
|||
$address = $excelArray[$row][2]?:'null'; //作番安装地址 |
|||
$longitude = $excelArray[$row][3]?:'null';//纬度 |
|||
$latitude = $excelArray[$row][4]?:'null';//经度 |
|||
$customerid = $excelArray[$row][5]?:'null'; //客户/业主名称 |
|||
$customercode = $excelArray[$row][6]?:'null'; //业主ID或统一信用代码 |
|||
$customerlinknumber = $excelArray[$row][7]?:'null'; //业主联络电话或手机 |
|||
$repairerid = $excelArray[$row][8]?:'null'; //保养员工号 |
|||
$repairername = $excelArray[$row][9]?:'null'; //保养员姓名 |
|||
$repairerphonenumber = $excelArray[$row][10]?:'null'; //保养员手机号 |
|||
$baoyangdate= $excelArray[$row][11]?:'null'; //保养日期 |
|||
$maintainance= $excelArray[$row][12]?:'null'; //保养计划类别.保養別\r\nA=全包\r\nB=半包\r\nC=清包\r\nD=半包:2個月保養一次 |
|||
$yingshoukuandate= $excelArray[$row][13]?:'null'; //应收款日期 |
|||
$contractstartdate= $excelArray[$row][14]?:'null'; //合约起始年月日 |
|||
$contractenddate= $excelArray[$row][15]?:'null'; //合约终止年月日 |
|||
$facilitychuchangno= $excelArray[$row][16]?:'null'; //原作番出厂编号 |
|||
$contractpersonid= $excelArray[$row][17]?:'null'; //契约人员工号 |
|||
$contractpersonname= $excelArray[$row][18]?:'null'; //契约人员姓名 |
|||
$weight= $excelArray[$row][19]?:'null'; //载重/输送能力 |
|||
$numberoffloor= $excelArray[$row][20]?:'null'; //层站,停数/提升高度 |
|||
$speed= $excelArray[$row][21]?:'null'; //速度 |
|||
$brand= $excelArray[$row][22]?:'null'; //品牌,型号 |
|||
$officialregistrationcode= $excelArray[$row][13]?:'null'; //官方注册代码 |
|||
$manufacturedate= $excelArray[$row][24]?:'null'; //制造日期 |
|||
$creater = "batch"; |
|||
$create_at = date('Y/m/d H:i:s'); |
|||
//无效字段 |
|||
$numberofstop='0'; |
|||
$opentype='0'; |
|||
$repairtype='0'; |
|||
echo $db_query1 = "INSERT INTO facility(contractno, facilityno, customerid, weight,numberofstop, numberoffloor,opentype,speed,repairtype,longitude, latitude, address,repairerid,repairername,creater, create_at) VALUES ('$contractno', '$facilityno', '$customerid', '$weight','$numberofstop', '$numberoffloor','$opentype','$speed','$repairtype','$longitude', '$latitude', '$address','$repairerid','$repairername','$creater', '$create_at')"; |
|||
|
|||
mysqli_query($link, $db_query1); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo "作番新增成功\n"; |
|||
//添加作番拓展字段 |
|||
$facilityid=mysqli_insert_id($link); |
|||
$db_query2 = "INSERT INTO facility_extends(facilityid,facilitychuchangno,contractpersonid,contractpersonname,brand,officialregistrationcode,manufacturedate,creater, create_at) VALUES ("; |
|||
$db_query2.=" '$facilityid', '$facilitychuchangno','$contractpersonid','$contractpersonname','$brand','$officialregistrationcode','$manufacturedate','$creater', '$create_at')"; |
|||
|
|||
|
|||
mysqli_query($link, $db_query2); |
|||
if (mysqli_affected_rows($link) > 0) { |
|||
echo '扩展添加成功'; |
|||
} |
|||
|
|||
} elseif (mysqli_affected_rows($link) == 0) { |
|||
echo "无新增资料"; |
|||
} |
|||
} else { |
|||
echo "作番已经存在"; |
|||
echo $facilityno; |
|||
} |
|||
|
|||
//print_r($excelArray); |
|||
} |
|||
mysqli_close($link); |
|||
} |
|||
|
|||
?> |
|||
<div class="container"> |
|||
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" |
|||
enctype="multipart/form-data"> |
|||
|
|||
<div class="bottom-margin">资料 |
|||
<label for="fileToUpload">上传</label> |
|||
<div> |
|||
<input type="file" name="fileToUpload" id="fileToUpload"> |
|||
</div> |
|||
<div class="bottom-margin"> |
|||
<button type="submit" name="submit">确定</button> |
|||
</div> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
|
|||
|
@ -1,161 +1,161 @@ |
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 工務總處可瀏覽全部資料 |
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; |
|||
$sql = "SELECT * FROM facility $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="facility-create.php?function_name=facility&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:facility-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>速度</th> |
|||
<th>維修型態</th> |
|||
<th>經度</th> |
|||
<th>緯度</th> |
|||
<th>地址</th> |
|||
<th>維修人員工號</th> |
|||
<th>維修人員姓名</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['contractno']; ?></td> |
|||
<td><?php echo $data['facilityno']; ?></td> |
|||
<td><?php echo $data['customerid']; ?></td> |
|||
<td><?php echo $data['weight']; ?></td> |
|||
<td><?php echo $data['numberofstop']; ?></td> |
|||
<td><?php echo $data['numberoffloor']; ?></td> |
|||
<td><?php echo $data['opentype']; ?></td> |
|||
<td><?php echo $data['speed']; ?></td> |
|||
<td><?php echo $data['repairtype']; ?></td> |
|||
<td><?php echo $data['longitude']; ?></td> |
|||
<td><?php echo $data['latitude']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['repairerid']; ?></td> |
|||
<td><?php echo $data['repairername']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="facility-edit.php?id=<?php echo $data['id']; ?>&function_name=facility&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="facility-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
<?php |
|||
include "header.php"; |
|||
|
|||
// 工務總處可瀏覽全部資料 |
|||
$sql = "select department_id from account where accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$sql_cmd = sql_myself($user_id); |
|||
if ($user_department_id == "501" || $user_id == "M0105") $sql_cmd = ""; |
|||
$sql = "SELECT * FROM facility $sql_cmd ORDER BY id"; |
|||
|
|||
// 用mysqli_query方法執行(sql語法)將結果存在變數中 |
|||
$data = mysqli_query($link,$sql); |
|||
?> |
|||
|
|||
<!-- <a href="create.php"><h2>新增</h2></a> --> |
|||
<?php if ($user_auth&2) { ?> |
|||
<p> |
|||
<a href="facility-create.php?function_name=facility&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-plus"></span> |
|||
</a> |
|||
</p> |
|||
<?php |
|||
} |
|||
|
|||
if($data): |
|||
|
|||
if($_SERVER["REQUEST_METHOD"] == "POST"){ |
|||
if(empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])){ |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:facility-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
|||
<style> |
|||
table { |
|||
table-layout:fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap:break-word; |
|||
} |
|||
|
|||
img { |
|||
width:125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width:125px; |
|||
} |
|||
|
|||
table{ |
|||
width:100%; |
|||
} |
|||
#table_index_filter{ |
|||
float:right; |
|||
} |
|||
#table_index_paginate{ |
|||
float:right; |
|||
} |
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
|
|||
<div style="overflow-x:auto;"> |
|||
<table id="table_index" 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> |
|||
<th>速度</th> |
|||
<th>維修型態</th> |
|||
<th>經度</th> |
|||
<th>緯度</th> |
|||
<th>地址</th> |
|||
<th>維修人員工號</th> |
|||
<th>維修人員姓名</th> |
|||
<th>建檔人</th> |
|||
<th>建檔時間</th> |
|||
<?php if ($user_auth&2) { ?> |
|||
<th>修改</th> |
|||
<th>刪除</th> |
|||
<?php } ?> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<?php foreach($data as $data) : ?> |
|||
<tr> |
|||
<td><?php echo $data['id']; ?></td> |
|||
<td><?php echo $data['contractno']; ?></td> |
|||
<td><?php echo $data['facilityno']; ?></td> |
|||
<td><?php echo $data['customerid']; ?></td> |
|||
<td><?php echo $data['weight']; ?></td> |
|||
<td><?php echo $data['numberofstop']; ?></td> |
|||
<td><?php echo $data['numberoffloor']; ?></td> |
|||
<td><?php echo $data['opentype']; ?></td> |
|||
<td><?php echo $data['speed']; ?></td> |
|||
<td><?php echo $data['repairtype']; ?></td> |
|||
<td><?php echo $data['longitude']; ?></td> |
|||
<td><?php echo $data['latitude']; ?></td> |
|||
<td><?php echo $data['address']; ?></td> |
|||
<td><?php echo $data['repairerid']; ?></td> |
|||
<td><?php echo $data['repairername']; ?></td> |
|||
<td><?php echo $data['creater']; ?></td> |
|||
<td><?php echo $data['create_at']; ?></td> |
|||
<?php if ($user_auth&2) { ?> |
|||
<td> |
|||
<p> |
|||
<a href="facility-edit.php?id=<?php echo $data['id']; ?>&function_name=facility&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<p> |
|||
<a href="facility-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('Are you sure you want to delete?')"> |
|||
<span class="glyphicon glyphicon-remove"></span> |
|||
</a> |
|||
</p> |
|||
</td> |
|||
<?php } ?> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else: |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代表結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "footer.php"; |
|||
|
|||
?> |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue