Browse Source

價審欄位添加服務費

main
Cheng 1 year ago
parent
commit
26318a6004
  1. 45
      mkt/IncludeCommon.php
  2. 29
      wms/contract-repair/api/deleteNewContractData.php
  3. 24
      wms/contract-repair/api/getContractData.php
  4. 500
      wms/contract-repair/api/postContractData.php
  5. 316
      wms/contract-repair/api/putContractData.php
  6. 44
      wms/contract-repair/contract-repair-edit.php
  7. 286
      wms/contract-repair/contract-repair-input.php
  8. 166
      wms/contract-repair/contract-repair-management.php
  9. 12
      wms/contract-repair/js/alpine.js
  10. 343
      wms/contract-repair/styles/style.css
  11. 2
      wms/contract-repair/styles/style.css.map
  12. 583
      wms/contract-repair/styles/style.scss
  13. 4
      wms/mkt/pricereview_contractno-api.php
  14. 401
      wms/mkt/pricereview_repair-check.php
  15. 517
      wms/mkt/pricereview_repair-create.php
  16. 23
      wms/mkt/pricereview_repair-record-submit.php
  17. 19
      wms/sign/list.php
  18. 24
      wms/sign/sign_form.php

45
mkt/IncludeCommon.php

@ -1,14 +1,17 @@
<?php
// phpinfo();
// exit;
class IncludeCommon
{
function CheckToken($token) {
function CheckToken($token)
{
date_default_timezone_set("Asia/Taipei");
$encryption_code = "MASADA!^***";
$time = date("Y-m-d H:i:s");
if (!isset($token) || empty($token)) {
$data['code'] = '400';
$data['message'] = '非法求';
$data['message'] = '非法求';
return $data;
}
//对比token
@ -20,7 +23,7 @@ class IncludeCommon
$data['user_id'] = '';
$data['user_name'] = '';
$data['code'] = '401';
$data['message'] = 'Token已过期,请重新登录';
$data['message'] = 'Token已過期,請重新登入';
return $data;
}
if ($true_signature == $explode[4]) {
@ -44,22 +47,23 @@ class IncludeCommon
return $data;
}
}
//生成登录记录
function save_log_response($source_flag='web', $account, $response_result){
//生成登录记录
function save_log_response($source_flag = 'web', $account, $response_result)
{
# 储存纪录并输出
#echo date("Y-m-d");
$file_path = "account_log/" . $account . "-" . date("Y-m-d") . ".ini";
$data = serialize($response_result). date("H:i:s") . "\n";
$fp = fopen($file_path,"a"); # 如果档案不存在择尝试建立再写入
$data = serialize($response_result) . date("H:i:s") . "\n";
$fp = fopen($file_path, "a"); # 如果档案不存在择尝试建立再写入
fwrite($fp, $data);
fclose($fp);
if ($source_flag == "web"){
// header("Location: custom-create.php?function_list=" . serialize($response_result) .
// "&token=" . $response_result["token"]); #请输入使用者名称密码
// exit();
if ($source_flag == "web") {
// header("Location: custom-create.php?function_list=" . serialize($response_result) .
// "&token=" . $response_result["token"]); #请输入使用者名称密码
// exit();
return true;
}else{
// echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
} else {
// echo json_encode($response_result, JSON_UNESCAPED_UNICODE);
return false;
}
@ -74,11 +78,12 @@ class IncludeCommon
*/
}
//生成token
function CreateToken($user_id, $user_name) {
//生成token
function CreateToken($user_id, $user_name)
{
date_default_timezone_set("Asia/Taipei");
$start_time = date("Y-m-d H:i:s");
$end_time = date('Y-m-d H:i:s',strtotime('+24 hour')); #设定24小时
$end_time = date('Y-m-d H:i:s', strtotime('+24 hour')); #设定24小时
$info = $user_id . '.' . $start_time . '.' . $end_time . '.' . $user_name; //设置token过期时间为一天
$encryption_code = "MASADA!^***";
//根据以上信息信息生成签名(密钥为 SIGNATURE 自定义全局常量)
@ -86,9 +91,10 @@ class IncludeCommon
//最后将这两部分拼接起来,得到最终的Token字符串
return $token = $info . '.' . $signature;
}
//生成菜单
//生成菜单
function menu ($from='tw',$type){
function menu($from = 'tw', $type)
{
$function_type = array(
"tw" => array(
# F角色菜单
@ -104,7 +110,6 @@ class IncludeCommon
)
);
return $function_type[$from][$type];
return $function_type[$from][$type];
}
}

29
wms/contract-repair/api/deleteNewContractData.php

@ -1,35 +1,34 @@
<?php
require_once("../conn.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
if(isset($_GET['contractid']) && $_GET['contractid']!="" && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r'){
try{
ini_set('date.timezone', 'Asia/Taipei');
if (isset($_GET['contractid']) && $_GET['contractid'] != "" && isset($_GET['contracttype']) && $_GET['contracttype'] == 'r') {
try {
$id = $_GET['contractid'];
$user_id = $_GET['user_id'];
$date = date('Y-m-d H:i:s');
$del = 2;
$del = '2';
$sql = "UPDATE contract_r_signed_back SET delete_status = :del,delete_userid= :user_id, delete_date = :date WHERE id = :id";
$stmt = $conn->prepare($sql);
$stmt->bindParam(":id",$id);
$stmt->bindParam(":del",$del);
$stmt->bindParam(":user_id",$user_id);
$stmt->bindParam(":date",$date);
$stmt->bindParam(":id", $id);
$stmt->bindParam(":del", $del);
$stmt->bindParam(":user_id", $user_id);
$stmt->bindParam(":date", $date);
$stmt->execute();
header("HTTP/1.1 204 NO Content");
}catch(PDOException $e){
die("ERROR!!!". $e->getMessage());
} catch (PDOException $e) {
die("ERROR!!!" . $e->getMessage());
}
}
if(isset($_GET['contractid']) && $_GET['contractid']!=""){
try{
if (isset($_GET['contractid']) && $_GET['contractid'] != "") {
try {
$id = $_GET["contractid"];
$sql_str = "DELETE FROM contract_m_signed_back WHERE id = :contractid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contractid", $id);
$stmt->execute();
header("HTTP/1.1 204 No Content");
}catch(PDOException $e){
die("ERROR!!!: ". $e->getMessage());
} catch (PDOException $e) {
die("ERROR!!!: " . $e->getMessage());
}
}
?>

24
wms/contract-repair/api/getContractData.php

@ -68,20 +68,36 @@ if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['cont
try {
$contractno = $_GET['contractno'];
$fail_arr = [];
$sql = "SELECT COUNT(*) AS num FROM pricereview_repair_main WHERE contractno = :contractno";
$d_status = '1';
// 判斷單號是否在合約簽核已建立
$sql = "SELECT COUNT(*) AS num FROM contract_r_signed_back WHERE contractno = :contractno AND delete_status = :d_status ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(":contractno", $contractno);
$stmt->bindParam(":d_status", $d_status);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$count = $result['num'];
if ($count > 1) {
if ($count >= 1) {
$fail_arr[] = '合約單號重複,請至契約管理(修理)查看。';
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
// 判斷單號是否在價格審查中以建立。
$sql = "SELECT COUNT(*) AS num FROM pricereview_repair_main WHERE contractno = :contractno";
$stmt = $conn->prepare($sql);
$stmt->bindParam(":contractno", $contractno);
$stmt->execute();
$result2 = $stmt->fetch(PDO::FETCH_ASSOC);
$count2 = $result2['num'];
if ($count2 == 0) {
$fail_arr[] = '找不到單號,請再確認。';
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
// $contractno = $_GET['contractno'];
$sql = "SELECT a.*,b.name,b.accountid
FROM pricereview_repair_main AS a

500
wms/contract-repair/api/postContractData.php

@ -3,21 +3,21 @@ require_once("../conn.php");
include_once("./getFacilityNo.php");
include_once("./getComboNo.php");
include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
ini_set('date.timezone', 'Asia/Taipei');
//保養簽回
if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') {
try{
if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') {
try {
$created_at = date('Y-m-d H:i:s');
$contractno = !empty($_POST['contractno'])? $_POST['contractno'] : null;
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
$mtype = !empty($_POST['mtype']) ? $_POST['mtype'] :null;
$opendoor = !empty($_POST['opendoor']) ? $_POST['opendoor']: null;
$mtype = !empty($_POST['mtype']) ? $_POST['mtype'] : null;
$opendoor = !empty($_POST['opendoor']) ? $_POST['opendoor'] : null;
$phone = !empty($_POST['phone']) ? $_POST['phone'] : null;
$email = !empty($_POST['email']) ? $_POST['email'] : null;
$mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : null;
$mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
$salesman = !empty($_POST['salesman']) ?$_POST['salesman'] : null;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null;
$contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null;
@ -34,31 +34,31 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
// validate
$fail_arr = [];
if($contractno === '') return $fail_arr[] = '合約號為必填';
if ($contractno === '') return $fail_arr[] = '合約號為必填';
if($total_price == '') $fail_arr[] = '合約總價為必填';
if($vat == '') $fail_arr[] = '統一編號為必填';
if($mtype == '') $fail_arr[] = '維修型態為必填';
if($phone == '') $fail_arr[] = '客戶電話為必填';
if($email == '') $fail_arr[] = 'Email為必填';
if($mworker == '') $fail_arr[] = '保養員為必填';
if($mcycle == '') $fail_arr[] = '保養頻率為必填';
if($salesman == '') $fail_arr[] = '營業員為必填';
if($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
if($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
if($address == '') $fail_arr[] = '地址為必填';
if($area == '') $fail_arr[] = '區域為必填';
if($customer == '') $fail_arr[] = '客戶為必填';
if($partyA == '') $fail_arr[] = '業務聯繫人為必填';
if($partyAaddress == '') $fail_arr[] = '業務聯繫人地址為必填';
if($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填';
if($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填';
if($num == '') $fail_arr[] = '電梯數量為必填';
if(count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
if ($total_price == '') $fail_arr[] = '合約總價為必填';
if ($vat == '') $fail_arr[] = '統一編號為必填';
if ($mtype == '') $fail_arr[] = '維修型態為必填';
if ($phone == '') $fail_arr[] = '客戶電話為必填';
if ($email == '') $fail_arr[] = 'Email為必填';
if ($mworker == '') $fail_arr[] = '保養員為必填';
if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
if ($salesman == '') $fail_arr[] = '營業員為必填';
if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
if ($address == '') $fail_arr[] = '地址為必填';
if ($area == '') $fail_arr[] = '區域為必填';
if ($customer == '') $fail_arr[] = '客戶為必填';
if ($partyA == '') $fail_arr[] = '業務聯繫人為必填';
if ($partyAaddress == '') $fail_arr[] = '業務聯繫人地址為必填';
if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填';
if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填';
if ($num == '') $fail_arr[] = '電梯數量為必填';
if (count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
//create account table
$accounttype = "A";
@ -73,18 +73,18 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$conn->beginTransaction();
$sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':accounttype' ,$accounttype);
$stmt -> bindParam(':accountid' ,$accountid);
$stmt -> bindParam(':pwd' ,$pwd);
$stmt -> bindParam(':name' ,$name);
$stmt -> bindParam(':tel' ,$tel);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':email' ,$email);
$stmt -> bindParam(':repairerid' ,$repairerid);
$stmt -> bindParam(':creater' ,$creater);
$stmt -> bindParam(':create_at' ,$create_at);
$stmt -> execute();
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accounttype', $accounttype);
$stmt->bindParam(':accountid', $accountid);
$stmt->bindParam(':pwd', $pwd);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':tel', $tel);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':repairerid', $repairerid);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
$stmt->execute();
//create contract table
@ -103,100 +103,100 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$end_date = $contract_end_date;
$sql_str = "INSERT INTO contract (contracttype, contractno, company, taxid, address, tel, promiser, contractperson, contractaddress, contracttel, contractemail, contract_employee, start_date, end_date, creater, create_at) VALUES (:contracttype, :contractno, :company, :taxid, :address, :tel, :promiser, :contractperson, :contractaddress, :contracttel, :contractemail, :contract_employee, :start_date, :end_date, :creater, :create_at)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contracttype' ,$contracttype);
$stmt -> bindParam(':contractno' ,$contractno);
$stmt -> bindParam(':company' ,$company);
$stmt -> bindParam(':taxid' ,$taxid);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':tel' ,$tel);
$stmt -> bindParam(':promiser' ,$promiser);
$stmt -> bindParam(':contractperson' ,$contractperson);
$stmt -> bindParam(':contractaddress' ,$contractaddress);
$stmt -> bindParam(':contracttel' ,$contracttel);
$stmt -> bindParam(':contractemail' ,$contractemail);
$stmt -> bindParam(':contract_employee' ,$contract_employee);
$stmt -> bindParam(':start_date' ,$start_date);
$stmt -> bindParam(':end_date' ,$end_date);
$stmt -> bindParam(':creater' ,$creater);
$stmt -> bindParam(':create_at' ,$create_at);
$stmt -> execute();
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contracttype', $contracttype);
$stmt->bindParam(':contractno', $contractno);
$stmt->bindParam(':company', $company);
$stmt->bindParam(':taxid', $taxid);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':tel', $tel);
$stmt->bindParam(':promiser', $promiser);
$stmt->bindParam(':contractperson', $contractperson);
$stmt->bindParam(':contractaddress', $contractaddress);
$stmt->bindParam(':contracttel', $contracttel);
$stmt->bindParam(':contractemail', $contractemail);
$stmt->bindParam(':contract_employee', $contract_employee);
$stmt->bindParam(':start_date', $start_date);
$stmt->bindParam(':end_date', $end_date);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
$stmt->execute();
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100'=>'X',
'MAM200'=>'W',
'MAH100'=>'H',
'MAQ100'=>'Z',
'MAF100'=>'F',
'MAZ100'=>'B',
];
$facility_arr = [];
foreach($elevators as $elevator){
$facility_arr[] = $dailyNecessities[$elevator['spec']];
}
echo json_encode($facility_arr);
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
echo json_encode($facilityno);
echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accountid',$mworker);
$stmt->execute();
$worker = $stmt->fetch(PDO::FETCH_ASSOC);
$customerid = $vat;
$define = "B";
$repairtype = $mtype;
$repairerid = $mworker;
$repairername = $worker['name'];
foreach($elevators as $idx=>$elevator){
$sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$facility_arr = [];
foreach ($elevators as $elevator) {
$facility_arr[] = $dailyNecessities[$elevator['spec']];
}
echo json_encode($facility_arr);
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
echo json_encode($facilityno);
echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accountid', $mworker);
$stmt->execute();
$worker = $stmt->fetch(PDO::FETCH_ASSOC);
$customerid = $vat;
$define = "B";
$repairtype = $mtype;
$repairerid = $mworker;
$repairername = $worker['name'];
foreach ($elevators as $idx => $elevator) {
$sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contractno' ,$contractno);
$stmt -> bindParam(':define' ,$define);
$stmt -> bindParam(':facilityno' ,$facilityno[$idx]);
$stmt -> bindParam(':latitude' ,$elevator['latitude']);
$stmt -> bindParam(':longitude' ,$elevator['longitude']);
$stmt -> bindParam(':customerid' ,$customerid);
$stmt -> bindParam(':weight' ,$elevator['weight']);
$stmt -> bindParam(':numberofpassenger' ,$elevator['persons']);
$stmt -> bindParam(':numberofstop' ,$elevator['stop']);
$stmt -> bindParam(':numberoffloor' ,$elevator['floors']);
$stmt -> bindParam(':opentype' ,$elevator['opendoor']);
$stmt -> bindParam(':speed' ,$elevator['speed']);
$stmt -> bindParam(':repairtype' ,$repairtype);
$stmt -> bindParam(':maintainance' ,$elevator['maintainance']);
$stmt -> bindParam(':facility_kind' ,$elevator['spec']);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':repairerid' ,$repairerid);
$stmt -> bindParam(':repairername' ,$repairername);
$stmt -> bindParam(':creater' ,$creater);
$stmt -> bindParam(':create_at' ,$create_at);
$stmt -> bindParam(':area' ,$area);
$stmt -> bindParam(':takecertificatedate' ,$elevator['takecertificatedate']);
$stmt -> bindParam(':licensedate' ,$elevator['useful_date']);
$result = $stmt -> execute();
}
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contractno', $contractno);
$stmt->bindParam(':define', $define);
$stmt->bindParam(':facilityno', $facilityno[$idx]);
$stmt->bindParam(':latitude', $elevator['latitude']);
$stmt->bindParam(':longitude', $elevator['longitude']);
$stmt->bindParam(':customerid', $customerid);
$stmt->bindParam(':weight', $elevator['weight']);
$stmt->bindParam(':numberofpassenger', $elevator['persons']);
$stmt->bindParam(':numberofstop', $elevator['stop']);
$stmt->bindParam(':numberoffloor', $elevator['floors']);
$stmt->bindParam(':opentype', $elevator['opendoor']);
$stmt->bindParam(':speed', $elevator['speed']);
$stmt->bindParam(':repairtype', $repairtype);
$stmt->bindParam(':maintainance', $elevator['maintainance']);
$stmt->bindParam(':facility_kind', $elevator['spec']);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':repairerid', $repairerid);
$stmt->bindParam(':repairername', $repairername);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
$stmt->bindParam(':area', $area);
$stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']);
$stmt->bindParam(':licensedate', $elevator['useful_date']);
$result = $stmt->execute();
}
//create schedule table
$comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
$comboArr = json_decode($comboNo->getComboNo(), true);
foreach($facilityno as $no){
foreach($comboArr as $combo){
foreach ($facilityno as $no) {
foreach ($comboArr as $combo) {
$sql_str = 'INSERT INTO schedule (contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES (:contractno, :facilityno, :combono, :repairerid, :repairername, :duedate, :creater, :create_at)';
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contractno' ,$contractno);
$stmt -> bindParam(':facilityno' ,$no);
$stmt -> bindParam(':combono' ,$combo[0]);
$stmt -> bindParam(':repairerid' ,$repairerid);
$stmt -> bindParam(':repairername' ,$repairername);
$stmt -> bindParam(':duedate' ,$combo[1]);
$stmt -> bindParam(':creater' ,$creater);
$stmt -> bindParam(':create_at' ,$create_at);
$result = $stmt -> execute();
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contractno', $contractno);
$stmt->bindParam(':facilityno', $no);
$stmt->bindParam(':combono', $combo[0]);
$stmt->bindParam(':repairerid', $repairerid);
$stmt->bindParam(':repairername', $repairername);
$stmt->bindParam(':duedate', $combo[1]);
$stmt->bindParam(':creater', $creater);
$stmt->bindParam(':create_at', $create_at);
$result = $stmt->execute();
}
}
// create contract_b_signed_back table
@ -216,101 +216,102 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$bonus = 1000;
$max_bonus = 2000;
if(!empty($files)){
$englisharr = range('a', 'z');
$file = $_FILES['files'];
$file_name = $file['name'];
$file_type = $file['type'];
$tmp_name = $file['tmp_name'];
$file_size = $file['size'];
$error = $file['error'];
$newfiles = [];
foreach( $files as $file ){
$i = 0; //新陣列的索引編號
foreach( $file as $key => $val ){
$newfiles[$i]['name'] = $files['name'][$key];
$newfiles[$i]['type'] = $files['type'][$key];
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
$newfiles[$i]['error'] = $files['error'][$key];
$newfiles[$i]['size'] = $files['size'][$key];
$i++;
} //foreach 第2層 end
}
$max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/';
if (!file_exists($path)) { mkdir($path); }
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$datetime = (string)date('YmdHis');
$files_id = 'b' . $datetime; // 保養=>b + 日期時間
foreach( $newfiles as $key => $file ){
$randNum = rand(1000,9999);
$randEnglish = $englisharr[rand(0,25)];
$file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name'];
$msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name );
if($msg==1){
$msg = '檔案傳送成功!';
$sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':files_id' ,$files_id);
$stmt -> bindParam(':file_name' ,$file_name);
$stmt -> bindParam(':file_mime' ,$file['type']);
$stmt -> bindParam(':file_size' ,$file['size']);
$stmt -> bindParam(':created_at' ,$created_at);
$stmt -> bindParam(':created_by' ,$user_id);
$stmt ->execute();
}
$msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '<br/>';
$src_name = $path.$file['name'];
if( file_exists($src_name) ){
//副檔名
$extname = pathinfo($src_name, PATHINFO_EXTENSION);
//主檔名
$basename = basename($src_name, '.'.$extname);
}
}
}else{
$files = null;
if (!empty($files)) {
$englisharr = range('a', 'z');
$file = $_FILES['files'];
$file_name = $file['name'];
$file_type = $file['type'];
$tmp_name = $file['tmp_name'];
$file_size = $file['size'];
$error = $file['error'];
$newfiles = [];
foreach ($files as $file) {
$i = 0; //新陣列的索引編號
foreach ($file as $key => $val) {
$newfiles[$i]['name'] = $files['name'][$key];
$newfiles[$i]['type'] = $files['type'][$key];
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
$newfiles[$i]['error'] = $files['error'][$key];
$newfiles[$i]['size'] = $files['size'][$key];
$i++;
} //foreach 第2層 end
}
$max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/';
if (!file_exists($path)) {
mkdir($path);
}
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$datetime = (string)date('YmdHis');
$files_id = 'b' . $datetime; // 保養=>b + 日期時間
foreach ($newfiles as $key => $file) {
$randNum = rand(1000, 9999);
$randEnglish = $englisharr[rand(0, 25)];
$file_name = 'b' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
$msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
if ($msg == 1) {
$msg = '檔案傳送成功!';
$sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':files_id', $files_id);
$stmt->bindParam(':file_name', $file_name);
$stmt->bindParam(':file_mime', $file['type']);
$stmt->bindParam(':file_size', $file['size']);
$stmt->bindParam(':created_at', $created_at);
$stmt->bindParam(':created_by', $user_id);
$stmt->execute();
}
$msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '<br/>';
$src_name = $path . $file['name'];
if (file_exists($src_name)) {
//副檔名
$extname = pathinfo($src_name, PATHINFO_EXTENSION);
//主檔名
$basename = basename($src_name, '.' . $extname);
}
}
} else {
$files = null;
}
$sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price, customer_phone, customer_email, repairman, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by)
VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(":contract_no",$contractno);
$stmt -> bindParam(":contract_type",$contract_type);
$stmt -> bindParam(":company",$company);
$stmt -> bindParam(":customer_no",$customer_no);
$stmt -> bindParam(":salesperson",$salesperson);
$stmt -> bindParam(":contract_start_date",$contract_begin_date);
$stmt -> bindParam(":contract_end_date",$contract_end_date);
$stmt -> bindParam(":total_price",$total_price);
$stmt -> bindParam(":customer_phone",$customer_phone);
$stmt -> bindParam(":customer_email",$customer_email);
$stmt -> bindParam(":repairman",$repairman);
$stmt -> bindParam(":cycle",$cycle);
$stmt -> bindParam(":contact_person",$contact_person);
$stmt -> bindParam(":contact_address",$contact_address);
$stmt -> bindParam(":contact_phone",$contact_phone);
$stmt -> bindParam(":contact_email",$contact_email);
$stmt -> bindParam(":elevators_number",$elevators_number);
$stmt -> bindParam(":area",$area);
$stmt -> bindParam(":address",$address);
$stmt -> bindParam(":files_id",$files_id);
$stmt -> bindParam(":bonus",$bonus);
$stmt -> bindParam(":max_bonus",$max_bonus);
$stmt -> bindParam(":created_at", $created_at);
$stmt -> bindParam(":created_by",$user_id);
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contract_no", $contractno);
$stmt->bindParam(":contract_type", $contract_type);
$stmt->bindParam(":company", $company);
$stmt->bindParam(":customer_no", $customer_no);
$stmt->bindParam(":salesperson", $salesperson);
$stmt->bindParam(":contract_start_date", $contract_begin_date);
$stmt->bindParam(":contract_end_date", $contract_end_date);
$stmt->bindParam(":total_price", $total_price);
$stmt->bindParam(":customer_phone", $customer_phone);
$stmt->bindParam(":customer_email", $customer_email);
$stmt->bindParam(":repairman", $repairman);
$stmt->bindParam(":cycle", $cycle);
$stmt->bindParam(":contact_person", $contact_person);
$stmt->bindParam(":contact_address", $contact_address);
$stmt->bindParam(":contact_phone", $contact_phone);
$stmt->bindParam(":contact_email", $contact_email);
$stmt->bindParam(":elevators_number", $elevators_number);
$stmt->bindParam(":area", $area);
$stmt->bindParam(":address", $address);
$stmt->bindParam(":files_id", $files_id);
$stmt->bindParam(":bonus", $bonus);
$stmt->bindParam(":max_bonus", $max_bonus);
$stmt->bindParam(":created_at", $created_at);
$stmt->bindParam(":created_by", $user_id);
$stmt -> execute();
$stmt->execute();
header('Content-Type: application/json');
// $jsonData = json_encode($files);
$conn->commit();
}catch(PDOException $e){
} catch (PDOException $e) {
$conn->rollback();
echo $e->getMessage();
die('Error!:'.$e->getMessage());
die('Error!:' . $e->getMessage());
}
}
@ -321,8 +322,8 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
//// 製作人:梓誠
/// 時間 :
//////////////////////////////
if(isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'r'){
try{
if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'r') {
try {
$created_at = date('Y-m-d H:i:s');
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$company = !empty($_POST['company']) ? $_POST['company'] : null;
@ -332,28 +333,34 @@ if(isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['co
$invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null;
$repair_no = !empty($_POST['repair_no']) ? $_POST['repair_no'] : null;
$total_price= !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
$type = !empty($_POST['type']) ? $_POST['type'] : null;
$sign_date = !empty($_POST['sign_date']) ? $_POST['sign_date']: null;
$sign_date = !empty($_POST['sign_date']) ? $_POST['sign_date'] : null;
$contract_status = !empty($_POST['contract_status']) ? $_POST['contract_status'] : null;
$fail_arr = [];
if($contractno === '') return $fail_arr[] = '合約號為必填';
if($repair_no === '') return $fail_arr[] = '報價單編號為必填';
if($company === '') return $fail_arr[] = '客戶名稱為必填';
// if($taxid === '') return $fail_arr[] = '統一編號為必填';
if($facilityno === '') return $fail_arr[] = '電梯編號為必填';
if($address === '') return $fail_arr[] = '工程地址為必填';
if($type === '') return $fail_arr[] = '工程類別為必填';
if($invoice === '') return $fail_arr[] = '發票抬頭為必填';
if(count($fail_arr)>0){
if (empty($contractno)) $fail_arr[] = '合約號為必填';
if (empty($repair_no)) $fail_arr[] = '報價單編號為必填';
if (empty($company)) $fail_arr[] = '客戶名稱為必填';
if (empty($repairid)) $fail_arr[] = '為保人員為必填';
// iempty(f($taxid === '') return $fail_arr[] = '統一編號為必填';
if (empty($facilityno)) $fail_arr[] = '電梯編號為必填';
if (empty($address)) $fail_arr[] = '工程地址為必填';
if (empty($type)) $fail_arr[] = '工程類別為必填';
if (empty($invoice)) $fail_arr[] = '發票抬頭為必填';
if (empty($taxid)) $fail_arr[] = '統一編號為必填';
// echo json_encode($fail_arr);
// exit;
if (count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
// exit();
//create contrac_r_signed_back table
$conn -> beginTransaction();
$conn->beginTransaction();
$sql = "INSERT INTO contract_r_signed_back(
repair_no,
contractno,
@ -366,7 +373,8 @@ if(isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['co
repaireid,
total_price,
sign_date,
create_userid,
contract_status,
create_user,
create_date) VALUES(
:repair_no,
:contractno,
@ -379,34 +387,34 @@ if(isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST['co
:repaireid,
:total_price,
:sign_date,
:contract_status,
:create_userid,
:create_date
)";
$stmt = $conn -> prepare($sql);
$stmt -> bindParam(":repair_no",$repair_no);
$stmt -> bindParam(":contractno",$contractno);
$stmt -> bindParam(":company",$company);
$stmt -> bindParam(":taxid",$taxid);
$stmt -> bindParam(":facilityno",$facilityno);
$stmt -> bindParam(":address",$address);
$stmt -> bindParam(":type", $type);
$stmt -> bindParam(":invoice", $invoice);
$stmt -> bindParam(":repaireid",$repaireid);
$stmt -> bindParam(":total_price",$total_price);
$stmt -> bindParam(":sign_date",$sign_date);
$stmt -> bindParam(":create_userid",$user_id);
$stmt -> bindParam("create_date",$created_at);
$stmt = $conn->prepare($sql);
$stmt->bindParam(":repair_no", $repair_no);
$stmt->bindParam(":contractno", $contractno);
$stmt->bindParam(":company", $company);
$stmt->bindParam(":taxid", $taxid);
$stmt->bindParam(":facilityno", $facilityno);
$stmt->bindParam(":address", $address);
$stmt->bindParam(":type", $type);
$stmt->bindParam(":invoice", $invoice);
$stmt->bindParam(":repaireid", $repaireid);
$stmt->bindParam(":total_price", $total_price);
$stmt->bindParam(":sign_date", $sign_date);
$stmt->bindParam(":contract_status", $contract_status);
$stmt->bindParam(":create_userid", $user_id);
$stmt->bindParam("create_date", $created_at);
$stmt -> execute();
$stmt->execute();
header('Content-Type: application/json');
// $jsonData = json_encode($files);
$conn -> commit();
}catch(PDOException $e){
$conn -> rollback();
$conn->commit();
} catch (PDOException $e) {
$conn->rollback();
echo $e->getMessage();
die('Error!' .$e->getMessage());
die('Error!' . $e->getMessage());
}
}

316
wms/contract-repair/api/putContractData.php

@ -1,174 +1,190 @@
<?php
require_once("../conn.php");
include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
ini_set('date.timezone', 'Asia/Taipei');
// echo json_encode(explode(',', $_POST['deletefiles']));
if(isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_POST["id"]) && $_POST['id']!=""){
try{
if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_POST["id"]) && $_POST['id'] != "") {
try {
$create_date = date('Y-m-d H:i:s');
$repair_no = !empty($POST['repair_no']) ? $_POST['repair_no'] : null;
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$company = !empty($_POST['company']) ? $_POST['conpany'] : null;
$company = !empty($_POST['company']) ? $_POST['company'] : null;
$taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null;
$facilityno = !empty($_POST['facilityno']) ? $_POST['facilityno'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null;
$type = !empty($_POST['type']) ? $_POST['type'] : null;
$invoice = !empty($_POST['invoice']) ? $_POST['invoice'] : null;
$repaireid = !empty($_POST['repaireid']) ? $_POST['repaireid'] : null;
$contract_status = !empty($_POST['contract_status']) ? $_POST['contract_status'] : null;
// $total_price = !empty($_POST['total_price']) ? $_POST['total_price'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
$fail_arr = [];
if(empty($repair_no)) $fail_arr[] = '號為必填';
if(empty($contractno)) $fail_arr[] = '合約號為必填';
if(empty($company)) $fail_arr[] = '客戶名稱為必填';
if(empty($taxid)) $fail_arr[] = '統一編號為必填';
if(empty($facilityno)) $fail_arr[] = '電梯號為必填';
if(empty($address)) $fail_arr[] = '工程地址為必填';
if(empty($type)) $fail_arr[] = '工程類行為必填';
if(empty($invoice)) $fail_arr[] = '發票抬頭為必填';
if(empty($repaireid)) $fail_arr[] = '維修人員為必填';
if(count($fail_arr) > 0){
// if (empty($repair_no)) $fail_arr[] = '號為必填';
if (empty($contractno)) $fail_arr[] = '合約號為必填';
if (empty($company)) $fail_arr[] = '客戶名稱為必填';
if (empty($taxid)) $fail_arr[] = '統一編號為必填';
if (empty($facilityno)) $fail_arr[] = '電梯號為必填';
if (empty($address)) $fail_arr[] = '工程地址為必填';
if (empty($type)) $fail_arr[] = '工程類行為必填';
if (empty($invoice)) $fail_arr[] = '發票抬頭為必填';
if (empty($repaireid)) $fail_arr[] = '維修人員為必填';
if (empty($contract_status)) $fail_arr[] = '工程類別為必填';
if (count($fail_arr) > 0) {
header("HTTP/1.1 442 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
$conn -> beginTransaction();
}catch(PDOException $e){
$conn->rollback();
// $conn->beginTransaction();
$sql = "UPDATE contract_r_signed_back SET
repaireid = :repaireid,facilityno= :facilityno, invoice=:invoice, taxid=:taxid, address=:address,type=:type,contract_status=:contract_status,update_user=:update_user,update_date=:update_date
WHERE id = :id";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':repaireid', $repaireid);
$stmt->bindParam(':facilityno', $facilityno);
$stmt->bindParam(':invoice', $invoice);
$stmt->bindParam(':taxid', $taxid);
$stmt->bindParam(':address', $address);
$stmt->bindParam(':type', $type);
$stmt->bindParam(':contract_status', $contract_status);
$stmt->bindParam(':update_user', $user_id);
$stmt->bindParam(':update_date', $create_date);
$stmt->bindParam(':id', $_POST['id']);
// echo json_encode($sql);
// exit;
$stmt->execute();
// header("HTTP/1.1 204 NO Content");
// $conn->commit();
} catch (PDOException $e) {
// $conn->rollback();
header("HTTPP/1.1 500 Internal Server Error");
die('Error!:' .$e->getMessage());
die('Error!:' . $e->getMessage());
}
}
if(isset($_POST['contractno']) && $_POST['contractno']!="" && isset($_POST["id"]) && $_POST['id']!=""){
try{
$created_at = date('Y-m-d H:i:s');
$created_by = $_POST['user_id'];
$id = $_POST["id"];
$contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
$manager = !empty($_POST['manager']) ? $_POST['manager'] : null;
$vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
$case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null;
$linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null;
$lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null;
$address = !empty($_POST['address']) ? $_POST['address'] : null;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$qc = !empty($_POST['qc']) ? $_POST['qc'] : null;
$deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
$files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$deletefilesArr = explode(',', $_POST['deletefiles']);
$fail_arr = [];
if(empty($contract_no)) $fail_arr[] = '合約號為必填';
if(empty($customer)) $fail_arr[] = '客戶名稱為必填';
if(empty($manager)) $fail_arr[] = '負責人為必填';
if(empty($vat)) $fail_arr[] = '統編/身分證為必填';
if(empty($case_name)) $fail_arr[] = '案名為必填';
if(empty($linkman)) $fail_arr[] = '聯絡人為必填';
if(empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
if(empty($address)) $fail_arr[] = '地址為必填';
if(empty($salesman)) $fail_arr[] = '營業員為必填';
if(empty($qc)) $fail_arr[] = '請選擇QC或管檢';
if(count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
$conn->beginTransaction();
$sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman, qc_official_type=:qc WHERE id = :id";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':contract_no' ,$contract_no);
$stmt -> bindParam(':customer' ,$customer);
$stmt -> bindParam(':manager' ,$manager);
$stmt -> bindParam(':vat' ,$vat);
$stmt -> bindParam(':case_name' ,$case_name);
$stmt -> bindParam(':linkman' ,$linkman);
$stmt -> bindParam(':lm_tel' ,$lm_tel);
$stmt -> bindParam(':address' ,$address);
$stmt -> bindParam(':salesman' ,$salesman);
$stmt -> bindParam(':qc' ,$qc);
$stmt -> bindParam(':id' ,$id);
$stmt -> execute();
if(!empty($deletefiles)){
$sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)";
$stmt = $conn -> prepare($sql_str);
$stmt -> execute();
}
if(!empty($files)){
$englisharr = range('a', 'z');
$files = $_FILES['files'];
$newfiles = [];
foreach( $files as $file ){
$i = 0; //新陣列的索引編號
foreach( $file as $key => $val ){
$newfiles[$i]['name'] = $files['name'][$key];
$newfiles[$i]['type'] = $files['type'][$key];
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
$newfiles[$i]['error'] = $files['error'][$key];
$newfiles[$i]['size'] = $files['size'][$key];
$i++;
} //foreach 第2層 end
}
$max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/';
if (!file_exists($path)) { mkdir($path); }
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$datetime = (string)date('YmdHis');
$files_id = ($files_id !== null ) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間
foreach( $newfiles as $key => $file ){
$randNum = rand(1000,9999);
$randEnglish = $englisharr[rand(0,25)];
$file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name'];
$msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name );
if($msg==1){
$msg = '檔案傳送成功!';
$sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':files_id' ,$files_id);
$stmt -> bindParam(':file_name' ,$file_name);
$stmt -> bindParam(':file_mime' ,$file['type']);
$stmt -> bindParam(':file_size' ,$file['size']);
$stmt -> bindParam(':created_at' ,$created_at);
$stmt -> bindParam(':created_by' ,$created_by);
$stmt ->execute();
}else{
throw new PDOException('檔案上傳失敗:' . $msg);
}
$msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '<br/>';
$src_name = $path.$file['name'];
if( file_exists($src_name) ){
//副檔名
$extname = pathinfo($src_name, PATHINFO_EXTENSION);
//主檔名
$basename = basename($src_name, '.'.$extname);
}
}
}else{
$files = null;
}
$conn->commit();
}catch(PDOException $e) {
$conn->rollback();
header("HTTP/1.1 500 Internal Server Error");
die('Error!:'.$e->getMessage());
}
}
// if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST["id"]) && $_POST['id'] != "") {
// try {
// $created_at = date('Y-m-d H:i:s');
// $created_by = $_POST['user_id'];
// $id = $_POST["id"];
// $contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
// $customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
// $manager = !empty($_POST['manager']) ? $_POST['manager'] : null;
// $vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
// $case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null;
// $linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null;
// $lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null;
// $address = !empty($_POST['address']) ? $_POST['address'] : null;
// $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
// $qc = !empty($_POST['qc']) ? $_POST['qc'] : null;
// $deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
// $files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null;
// $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
// $deletefilesArr = explode(',', $_POST['deletefiles']);
// $fail_arr = [];
// if (empty($contract_no)) $fail_arr[] = '合約號為必填';
// if (empty($customer)) $fail_arr[] = '客戶名稱為必填';
// if (empty($manager)) $fail_arr[] = '負責人為必填';
// if (empty($vat)) $fail_arr[] = '統編/身分證為必填';
// if (empty($case_name)) $fail_arr[] = '案名為必填';
// if (empty($linkman)) $fail_arr[] = '聯絡人為必填';
// if (empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
// if (empty($address)) $fail_arr[] = '地址為必填';
// if (empty($salesman)) $fail_arr[] = '營業員為必填';
// if (empty($qc)) $fail_arr[] = '請選擇QC或管檢';
// if (count($fail_arr) > 0) {
// header("HTTP/1.1 422 Unprocessable Entity");
// echo json_encode($fail_arr);
// exit();
// }
// $conn->beginTransaction();
// $sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman, qc_official_type=:qc WHERE id = :id";
// $stmt = $conn->prepare($sql_str);
// $stmt->bindParam(':contract_no', $contract_no);
// $stmt->bindParam(':customer', $customer);
// $stmt->bindParam(':manager', $manager);
// $stmt->bindParam(':vat', $vat);
// $stmt->bindParam(':case_name', $case_name);
// $stmt->bindParam(':linkman', $linkman);
// $stmt->bindParam(':lm_tel', $lm_tel);
// $stmt->bindParam(':address', $address);
// $stmt->bindParam(':salesman', $salesman);
// $stmt->bindParam(':qc', $qc);
// $stmt->bindParam(':id', $id);
// $stmt->execute();
// if (!empty($deletefiles)) {
// $sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)";
// $stmt = $conn->prepare($sql_str);
// $stmt->execute();
// }
// if (!empty($files)) {
// $englisharr = range('a', 'z');
// $files = $_FILES['files'];
// $newfiles = [];
// foreach ($files as $file) {
// $i = 0; //新陣列的索引編號
// foreach ($file as $key => $val) {
// $newfiles[$i]['name'] = $files['name'][$key];
// $newfiles[$i]['type'] = $files['type'][$key];
// $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
// $newfiles[$i]['error'] = $files['error'][$key];
// $newfiles[$i]['size'] = $files['size'][$key];
// $i++;
// } //foreach 第2層 end
// }
// $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
// $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
// $path = '../images/contracts/';
// if (!file_exists($path)) {
// mkdir($path);
// }
// $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
// $datetime = (string)date('YmdHis');
// $files_id = ($files_id !== null) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間
// foreach ($newfiles as $key => $file) {
// $randNum = rand(1000, 9999);
// $randEnglish = $englisharr[rand(0, 25)];
// $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
// $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
// if ($msg == 1) {
// $msg = '檔案傳送成功!';
// $sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
// $stmt = $conn->prepare($sql_str);
// $stmt->bindParam(':files_id', $files_id);
// $stmt->bindParam(':file_name', $file_name);
// $stmt->bindParam(':file_mime', $file['type']);
// $stmt->bindParam(':file_size', $file['size']);
// $stmt->bindParam(':created_at', $created_at);
// $stmt->bindParam(':created_by', $created_by);
// $stmt->execute();
// } else {
// throw new PDOException('檔案上傳失敗:' . $msg);
// }
// $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '<br/>';
// $src_name = $path . $file['name'];
// if (file_exists($src_name)) {
// //副檔名
// $extname = pathinfo($src_name, PATHINFO_EXTENSION);
// //主檔名
// $basename = basename($src_name, '.' . $extname);
// }
// }
// } else {
// $files = null;
// }
// $conn->commit();
// } catch (PDOException $e) {
// $conn->rollback();
// header("HTTP/1.1 500 Internal Server Error");
// die('Error!:' . $e->getMessage());
// }
// }

44
wms/contract-repair/contract-repair-edit.php

@ -30,16 +30,21 @@ $persons = array_map(function ($person) {
'name' => $person['name']
];
}, $persons);
$contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"];
?>
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<!-- <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css" />
<div class="contract-management" x-data='contract_edit'>
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="main_form" />
@ -111,14 +116,14 @@ $persons = array_map(function ($person) {
</td>
<td style="vertical-align: middle">統一編號</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.taxid">
<input class="form-control disabled_select" type="text" x-model="data.taxid">
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">工程地址</td>
<td colspan=3>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.address">
<input class="form-control disabled_select" type="text" x-model="data.address">
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<!-- <td style="vertical-align: middle">附件上傳</td>
@ -126,8 +131,16 @@ $persons = array_map(function ($person) {
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> -->
<td></td>
<td></td>
<td style="vertical-align: middle">工程進度</td>
<td style="vertical-align: middle">
<select class="contract_status" id="contract_status" x-model="data.contract_status">
<?php foreach ($contract_stauts as $key => $status) : ?>
<option value="<?php echo $key + 1; ?>"><?php echo $status; ?></option>
<?php endforeach ?>
</select>
<p class="alerttext" x-show="data.contract_status==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td></td>
<td></td>
</tr>
@ -172,17 +185,18 @@ $persons = array_map(function ($person) {
const user_id = '<?php echo $user_id; ?>';
const user_name = '<?php echo $user_name; ?>';
const id = <?php echo $contract['id'] ?>;
const repair_no = '<?php echo $contract['repair_no']; ?>'
const contractno = '<?php echo $contract['contractno']; ?>'
const company = '<?php echo $contract['company']; ?>'
const taxid = '<?php echo $contract['taxid']; ?>'
const facilityno = '<?php echo $contract['facilityno']; ?>'
const address = '<?php echo $contract['address']; ?>'
const type = '<?php echo $contract['type']; ?>'
const repair_no = '<?php echo $contract['repair_no']; ?>';
const contractno = '<?php echo $contract['contractno']; ?>';
const company = '<?php echo $contract['company']; ?>';
const taxid = '<?php echo $contract['taxid']; ?>';
const facilityno = '<?php echo $contract['facilityno']; ?>';
const address = '<?php echo $contract['address']; ?>';
const type = '<?php echo $contract['type']; ?>';
const repaireid = '<?php echo $contract['repaireid']; ?>';
const total_price = '<?php echo $contract['total_price']; ?>';
const sign_date = '<?php echo $contract['sign_date']; ?>';
const invoice = '<?php echo $contract['invoice']; ?>'
const repaireid = '<?php echo $contract['repaireid']; ?>'
const total_price = '<?php echo $contract['total_price']; ?>'
const sign_date = '<?php echo $contract['sign_date']; ?>'
const contract_status = '<?php echo $contract['contract_status']; ?>'
// $('#table_index').DataTable(
// {
// "order": [

286
wms/contract-repair/contract-repair-input.php

@ -5,181 +5,167 @@ include_once("./api/getFacilityNo.php");
$accounttype = "B";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accounttype',$accounttype);
$stmt->bindParam(':accounttype', $accounttype);
$stmt->execute();
$workers = $stmt->fetchAll(PDO::FETCH_ASSOC);
$accounttype = "M";
$sql_str = "SELECT id,accountid, name FROM account WHERE accounttype = :accounttype";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accounttype',$accounttype);
$stmt->bindParam(':accounttype', $accounttype);
$stmt->execute();
$contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
$contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修理完成"];
?>
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js" ></script>
<script src="./js/axios/axios.min.js"></script>
<div class="contract-input-component" x-data="contractRepair">
<div class="form" method="post" id="form" enctype="multipart/form-data" >
<input type="hidden" name='form_name' value="main_form" />
<div>
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>合約入力(修理)</h3>
</td>
</tr>
</thead>
<template x-if="step==1">
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1">
<tr>
<td style="vertical-align: middle">合約號</td>
<td colspan="5">
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno" >
</td>
<td colspan="2" style="vertical-align: middle">
<label for="customize">
<input type="checkbox" x-model="customize" id="customize" />自定義欄位
</label>
</td>
</tr>
</tbody>
</template>
<template x-if="step==2">
<!-- <template x-if="step==1"> -->
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==2">
<!-- <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1"> -->
<tr>
<td colspan="7" style='vertical-align: middle;border-right:0px;'>
<h4>業務確認項</h4>
</td>
<td class="text-right" style='border-left:0px;'>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button>
</td>
</tr>
<tr>
<td style="vertical-align: middle">立約人</td>
<td>
<input type="text" x-model="data.company"/>
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">維保人員</td>
<td>
<input type="text" x-model="data.repairer" />
<p class="alerttext" x-show="data.repairer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">電梯編號</td>
<td>
<input class="form-control disabled_select" type="text" name="facilityno" x-model="data.facilityno" >
<p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">工程地址</td>
<td>
<input class="form-control disabled_select" type="text" name="address" x-model="data.address" >
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">工程類別</td>
<td>
<input class="form-control disabled_select" type="text" name="type" x-model="data.type" >
<p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="main_form" />
<div>
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>合約入力(修理)</h3>
</td>
</tr>
</thead>
<template x-if="step==1">
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1">
<tr>
<td style="vertical-align: middle">合約號</td>
<td colspan="5">
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno">
<td style="vertical-align: middle">簽訂時間</td>
<td>
<input class="form-control disabled_select" type="date" name="sign_date" x-model="data.sign_date" >
<p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">發票抬頭</td>
<td>
<input class="form-control disabled_select" type="text" name="invoice" x-model="data.invoice" >
<p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">統一編號</td>
<td>
<input class="form-control disabled_select" type="text" name="taxid" x-model="data.taxid" >
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</td>
<td colspan="2" style="vertical-align: middle">
<label for="customize">
<input type="checkbox" x-model="customize" id="customize" />自定義欄位
</label>
</td>
</tr>
</tbody>
</template>
<template x-if="step==2">
<!-- <template x-if="step==1"> -->
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==2">
<!-- <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==1"> -->
<tr>
<td colspan="7" style='vertical-align: middle;border-right:0px;'>
<h4>業務確認項</h4>
</td>
<td class="text-right" style='border-left:0px;'>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button>
</td>
</tr>
<tr>
<td style="vertical-align: middle">立約人</td>
<td>
<input type="text" x-model="data.company" />
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">維保人員</td>
<td>
<input type="text" x-model="data.repairer" />
<p class="alerttext" x-show="data.repairer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">電梯編號</td>
<td>
<input class="form-control disabled_select" type="text" name="facilityno" x-model="data.facilityno">
<p class="alerttext" x-show="data.facilityno==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">報價單編號</td>
<td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" name="repair_no" x-model="data.repair_no" disabled="disabled">
<p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">工程進度</td>
<td>
<input class="form-control disabled_select" type="text" name="type" x-model="data.type">
<p class="alerttext" x-show="data.type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">簽訂時間</td>
<td>
<input class="form-control disabled_select" type="date" name="sign_date" x-model="data.sign_date">
<p class="alerttext" x-show="data.sign_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">發票抬頭</td>
<td>
<input class="form-control disabled_select" type="text" name="invoice" x-model="data.invoice">
<p class="alerttext" x-show="data.invoice==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">統一編號</td>
<td>
<input class="form-control disabled_select" type="text" name="taxid" x-model="data.taxid">
<p class="alerttext" x-show="data.taxid==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">工程地址</td>
<td colspan=3>
<input class="form-control disabled_select" type="text" x-model="data.address">
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<!-- <td style="vertical-align: middle">維修型態</td>
<td style="vertical-align: middle">
<select class="ui search dropdown" name="" x-model="data.mtype">
<option value="" >選擇維修型態</option>
<option value="A">定期保養</option>
</select>
<p class="alerttext" x-show="data.mtype==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> -->
<td style="vertical-align: middle">工程確認</td>
<td style="vertical-align: middle">
<select class="contract_status" id="contract_status" x-model="data.contract_status">
<?php foreach ($contract_stauts as $key => $status) : ?>
<option value="<?php echo $key + 1; ?>"><?php echo $status; ?></option>
<?php endforeach ?>
</select>
<!-- <p class="alerttext" x-show="data.contract_status==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> -->
</td>
<td></td>
<td></td>
</tr>
<!-- <td></td> -->
<!-- <td></td> -->
</tr>
<tr>
<!-- <td style="vertical-align: middle">維修人員</td>
<td>
<input class="form-control disabled_select" type="text" name="repairer" x-model="data.repairer" >
<p class="alerttext" x-show="data.repairer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> -->
<td style="vertical-align: middle">報價單編號</td>
<td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" name="repair_no" x-model="data.repair_no" disabled="disabled">
<p class="alerttext" x-show="data.repair_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">附件</td>
<td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
<td></td>
</tr>
</tbody>
</template>
</table>
<tr>
</tr>
</tbody>
</template>
</table>
<button x-show="step==2" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step<=1" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>上一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
</div>
<button x-show="step==2" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step<=1" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>上一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
</div>
</div>
</div>
<script src="./js/jquery/jquery-3.1.1.min.js"></script>
<script src="semantic/dist/semantic.min.js" ></script>
<script src="semantic/dist/semantic.min.js"></script>
<script src="./js/alpine.js"></script>
<script>
const user_id = '<?php echo $user_id; ?>'

166
wms/contract-repair/contract-repair-management.php

@ -4,7 +4,7 @@ require_once("./conn.php");
$sql_str = "SELECT * FROM contract_r_signed_back WHERE 1=1 AND delete_status = 1 ORDER BY id DESC";
$stmt = $conn->prepare($sql_str);
$stmt->execute();
$contracts= $stmt->fetchAll(PDO::FETCH_ASSOC);
$contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
@ -12,7 +12,7 @@ $contracts= $stmt->fetchAll(PDO::FETCH_ASSOC);
<script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js"></script>
<div class="contract-management" x-data="{
<div class="contract-management" x-data="{
deleteFn(id,user){
if(confirm('確定要刪除嗎?')){
axios.get('./api/deleteNewContractData.php?contracttype=r&contractid='+id+'&user_id='+user).then(res=> {
@ -26,94 +26,106 @@ $contracts= $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}">
<div style="overflow-x:auto;margin-top:12px">
<a href="contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<div style="overflow-x:auto;margin-top:12px">
<a href="contract-repair-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>項次</th>
<th>合約號</th>
<th>客戶名稱</th>
<th>統編</th>
<th>總金額</th>
<th>建檔者</th>
<th>建立時間</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($contracts as $key => $contract): ?>
<tr>
<td><?php echo $contract['id']; ?></td>
<td><?php echo $contract['contractno'] ?></td>
<td><?php echo $contract['company'] ?></td>
<td><?php echo $contract['taxid'] ?></td>
<td><?php echo $contract['total_price']?></td>
<td><?php echo $contract['create_userid'] ?></td>
<td><?php echo $contract['create_date'] ?></td>
<td style="width:30px">
<p>
<a href="contract-repair-edit.php?&contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>,'<?php echo $user_id;?>')">
<span class="glyphicon glyphicon-remove"></span>
</a>
</p>
</td>
</tr>
<?php endforeach ?>
</tbody>
<thead>
<tr>
<th>項次</th>
<th>合約號</th>
<th>客戶名稱</th>
<th>統編</th>
<th>總金額</th>
<th>工程進度</th>
<th>建檔者</th>
<th>建立時間</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($contracts as $key => $contract) : ?>
<tr>
<td><?php echo $contract['id']; ?></td>
<td><?php echo $contract['contractno'] ?></td>
<td><?php echo $contract['company'] ?></td>
<td><?php echo $contract['taxid'] ?></td>
<td><?php echo $contract['total_price'] ?></td>
<th><?php if ($contract['contract_status'] == 1) {
echo '合約簽回';
} else if ($contract['contract_status'] == 2) {
echo '採購';
} else if ($contract['contract_status'] == 3) {
echo '工程發包';
} else if ($contract['contract_status'] == 4) {
echo '工程中';
} else if ($contract['contract_status'] == 5) {
echo '修理完成';
}
?></th>
<td><?php echo $contract['create_user'] ?></td>
<td><?php echo $contract['create_date'] ?></td>
<td style="width:30px">
<p>
<a href="contract-repair-edit.php?&contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>,'<?php echo $user_id; ?>')">
<span class="glyphicon glyphicon-remove"></span>
</a>
</p>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
<style>
table {
table-layout:fixed;
width: 100%;
}
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
td {
word-wrap:break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
img {
width:125px;
}
table {
width: 100%;
}
.width_style_1 {
width:125px;
}
#table_index_filter {
float: right;
}
table{
width:100%;
}
#table_index_filter{
float:right;
}
#table_index_paginate{
float:right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
#table_index_paginate {
float: right;
}
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<script src="semantic/dist/semantic.min.js" ></script>
<script src="semantic/dist/semantic.min.js"></script>
<script>
$('#table_index').DataTable(
{
"order": [
[0, "desc"],
]
}
);
$('#table_index').DataTable({
"order": [
[0, "desc"],
]
});
</script>

12
wms/contract-repair/js/alpine.js

@ -951,7 +951,8 @@ const contractRepair = () => {
address: '',
repair_no: '',
total_price: '',
sign_date: ''
sign_date: '',
contract_status: ''
},
step: 1,
isLoading: false,
@ -1038,6 +1039,7 @@ const contractRepair = () => {
form.append('repair_no', this.data.repair_no);
form.append('total_price', this.data.total_price);
form.append('sign_date', this.data.sign_date);
form.append('contract_status', this.data.contract_status);
form.append('contracttype', 'r');
form.append('user_id', user_id);
form.append('type', this.data.type);
@ -1059,6 +1061,7 @@ const contractRepair = () => {
this.data.user_id = '';
this.data.type = '';
this.data.sign_date = '';
this.data.contract_status = '';
}
this.isLoading = false;
}).catch(error => {
@ -1418,6 +1421,7 @@ const contractNewApply = () => {
}
const contract_edit = () => {
console.log(contract_status);
return {
isLoading: false,
data: {
@ -1434,6 +1438,7 @@ const contract_edit = () => {
total_price: total_price,
sign_date: sign_date,
user_id: user_id,
contract_status: contract_status
},
fail_arr: [],
@ -1459,16 +1464,19 @@ const contract_edit = () => {
form.append("total_price", this.data.total_price);
form.append("sign_date", this.data.sign_date);
form.append("user_id", user_id);
form.append("contract_status", this.data.contract_status);
form.append('contracttype', 'r');
axios.post("./api/putContractData.php", form).then(res => {
console.log(res.data)
console.log(res);
if (res.status === 200) {
alert("更新成功");
window.location.reload();
}
this.isLoading = false
}).catch(error => {
console.log(this.data);
console.log(error);
let code = error.response.status;
if (code == 422) {
this.fail_arr = error.response.data

343
wms/contract-repair/styles/style.css

@ -49,7 +49,8 @@ main .inputDiv {
main .inputDiv label {
margin-bottom: 10px;
}
main .inputDiv label input, main .inputDiv label select {
main .inputDiv label input,
main .inputDiv label select {
border: 1px #aaa solid;
outline: none;
border-radius: 5px;
@ -68,100 +69,140 @@ main .inputDiv label button {
font-weight: 6500;
margin-top: 15px;
}
main .contract-install-component, main .contract-material-component {
main .contract-install-component,
main .contract-material-component {
width: 100%;
max-width: 816px;
margin: 30px auto;
background-color: #f7f7f7 !important;
}
main .contract-install-component p, main .contract-material-component p {
main .contract-install-component p,
main .contract-material-component p {
margin: 0;
}
main .contract-install-component > .btn-list, main .contract-material-component > .btn-list {
main .contract-install-component > .btn-list,
main .contract-material-component > .btn-list {
display: flex;
align-items: center;
}
main .contract-install-component > .btn-list > button, main .contract-material-component > .btn-list > button {
main .contract-install-component > .btn-list > button,
main .contract-material-component > .btn-list > button {
padding: 8px;
margin: 0 4px;
}
main .contract-install-component > .contract, main .contract-material-component > .contract {
main .contract-install-component > .contract,
main .contract-material-component > .contract {
background: #fff;
width: 100%;
margin-top: 15px;
padding: 20px;
font-family: "標楷體";
}
main .contract-install-component > .contract > h2, main .contract-material-component > .contract > h2 {
main .contract-install-component > .contract > h2,
main .contract-material-component > .contract > h2 {
font-size: 18pt;
text-align: center;
}
main .contract-install-component > .contract br, main .contract-material-component > .contract br {
main .contract-install-component > .contract br,
main .contract-material-component > .contract br {
line-height: 2.5;
}
main .contract-install-component > .contract .d-flex, main .contract-material-component > .contract .d-flex {
main .contract-install-component > .contract .d-flex,
main .contract-material-component > .contract .d-flex {
display: flex;
align-items: center;
}
main .contract-install-component > .contract .mouseover, main .contract-material-component > .contract .mouseover {
main .contract-install-component > .contract .mouseover,
main .contract-material-component > .contract .mouseover {
background-color: #f1f1f1;
cursor: pointer;
}
main .contract-install-component > .contract div, main .contract-install-component > .contract section, main .contract-material-component > .contract div, main .contract-material-component > .contract section {
main .contract-install-component > .contract div,
main .contract-install-component > .contract section,
main .contract-material-component > .contract div,
main .contract-material-component > .contract section {
font-size: 12pt;
line-height: 2.5;
}
main .contract-install-component > .contract div.party, main .contract-install-component > .contract section.party, main .contract-material-component > .contract div.party, main .contract-material-component > .contract section.party {
main .contract-install-component > .contract div.party,
main .contract-install-component > .contract section.party,
main .contract-material-component > .contract div.party,
main .contract-material-component > .contract section.party {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
main .contract-install-component > .contract div.party .company-name, main .contract-install-component > .contract section.party .company-name, main .contract-material-component > .contract div.party .company-name, main .contract-material-component > .contract section.party .company-name {
main .contract-install-component > .contract div.party .company-name,
main .contract-install-component > .contract section.party .company-name,
main .contract-material-component > .contract div.party .company-name,
main .contract-material-component > .contract section.party .company-name {
text-indent: 80pt;
}
main .contract-install-component > .contract div.party .notes, main .contract-install-component > .contract section.party .notes, main .contract-material-component > .contract div.party .notes, main .contract-material-component > .contract section.party .notes {
main .contract-install-component > .contract div.party .notes,
main .contract-install-component > .contract section.party .notes,
main .contract-material-component > .contract div.party .notes,
main .contract-material-component > .contract section.party .notes {
margin-right: 25%;
white-space: nowrap;
}
main .contract-install-component > .contract div.list-content, main .contract-install-component > .contract section.list-content, main .contract-material-component > .contract div.list-content, main .contract-material-component > .contract section.list-content {
main .contract-install-component > .contract div.list-content,
main .contract-install-component > .contract section.list-content,
main .contract-material-component > .contract div.list-content,
main .contract-material-component > .contract section.list-content {
margin-left: 70px;
}
main .contract-install-component > .contract div.list-title, main .contract-install-component > .contract section.list-title, main .contract-material-component > .contract div.list-title, main .contract-material-component > .contract section.list-title {
main .contract-install-component > .contract div.list-title,
main .contract-install-component > .contract section.list-title,
main .contract-material-component > .contract div.list-title,
main .contract-material-component > .contract section.list-title {
display: flex;
align-items: flex-start;
}
main .contract-install-component > .contract div.list-title > strong, main .contract-install-component > .contract section.list-title > strong, main .contract-material-component > .contract div.list-title > strong, main .contract-material-component > .contract section.list-title > strong {
main .contract-install-component > .contract div.list-title > strong,
main .contract-install-component > .contract section.list-title > strong,
main .contract-material-component > .contract div.list-title > strong,
main .contract-material-component > .contract section.list-title > strong {
min-width: 70px;
}
main .contract-install-component > .contract p, main .contract-install-component > .contract article, main .contract-install-component > .contract div, main .contract-material-component > .contract p, main .contract-material-component > .contract article, main .contract-material-component > .contract div {
main .contract-install-component > .contract p,
main .contract-install-component > .contract article,
main .contract-install-component > .contract div,
main .contract-material-component > .contract p,
main .contract-material-component > .contract article,
main .contract-material-component > .contract div {
position: relative;
display: block;
}
main .contract-install-component > .contract .date, main .contract-material-component > .contract .date {
main .contract-install-component > .contract .date,
main .contract-material-component > .contract .date {
display: flex;
align-items: center;
width: 100%;
margin-top: 300px;
}
main .contract-install-component > .contract .date p, main .contract-material-component > .contract .date p {
main .contract-install-component > .contract .date p,
main .contract-material-component > .contract .date p {
width: 50%;
letter-spacing: 20px;
}
main .contract-install-component > .contract .date > .ml, main .contract-material-component > .contract .date > .ml {
main .contract-install-component > .contract .date > .ml,
main .contract-material-component > .contract .date > .ml {
width: 50%;
display: flex;
justify-content: space-between;
flex-direction: row-reverse;
}
main .contract-install-component > .contract .buttons, main .contract-material-component > .contract .buttons {
main .contract-install-component > .contract .buttons,
main .contract-material-component > .contract .buttons {
position: absolute;
top: 0;
right: 0;
display: flex;
z-index: 9;
}
main .contract-install-component > .contract .buttons > button, main .contract-material-component > .contract .buttons > button {
main .contract-install-component > .contract .buttons > button,
main .contract-material-component > .contract .buttons > button {
width: 30px;
height: 30px;
border-radius: 5px;
@ -174,89 +215,127 @@ main .contract-install-component > .contract .buttons > button, main .contract-m
color: #fff;
margin: 0 1px;
}
main .contract-install-component > .contract .buttons > button > i, main .contract-material-component > .contract .buttons > button > i {
main .contract-install-component > .contract .buttons > button > i,
main .contract-material-component > .contract .buttons > button > i {
font-size: 12px;
}
main .contract-install-component > .contract .buttons > button.edit, main .contract-material-component > .contract .buttons > button.edit {
main .contract-install-component > .contract .buttons > button.edit,
main .contract-material-component > .contract .buttons > button.edit {
background-color: #5BC0DE;
}
main .contract-install-component > .contract .buttons > button.add, main .contract-material-component > .contract .buttons > button.add {
main .contract-install-component > .contract .buttons > button.add,
main .contract-material-component > .contract .buttons > button.add {
background-color: #F0AD4E;
}
main .contract-install-component > .contract .buttons > button.delete, main .contract-material-component > .contract .buttons > button.delete {
main .contract-install-component > .contract .buttons > button.delete,
main .contract-material-component > .contract .buttons > button.delete {
background-color: rgb(211, 0, 0);
}
main .contract-install-component > .contract table, main .contract-material-component > .contract table {
main .contract-install-component > .contract table,
main .contract-material-component > .contract table {
border: none;
margin-top: 30px;
font-family: "標楷體";
width: 800px;
}
main .contract-install-component > .contract table tr:nth-child(even), main .contract-install-component > .contract table tr:nth-child(odd), main .contract-material-component > .contract table tr:nth-child(even), main .contract-material-component > .contract table tr:nth-child(odd) {
main .contract-install-component > .contract table tr:nth-child(even),
main .contract-install-component > .contract table tr:nth-child(odd),
main .contract-material-component > .contract table tr:nth-child(even),
main .contract-material-component > .contract table tr:nth-child(odd) {
background-color: #fff;
}
main .contract-install-component > .contract table tr, main .contract-material-component > .contract table tr {
main .contract-install-component > .contract table tr,
main .contract-material-component > .contract table tr {
font-size: 12pt;
width: 100%;
position: relative;
}
main .contract-install-component > .contract table tr.mouseover, main .contract-material-component > .contract table tr.mouseover {
main .contract-install-component > .contract table tr.mouseover,
main .contract-material-component > .contract table tr.mouseover {
background-color: #f3f3f3;
}
main .contract-install-component > .contract table tr h2, main .contract-material-component > .contract table tr h2 {
main .contract-install-component > .contract table tr h2,
main .contract-material-component > .contract table tr h2 {
font-size: 18pt;
}
main .contract-install-component > .contract table tr td, main .contract-material-component > .contract table tr td {
main .contract-install-component > .contract table tr td,
main .contract-material-component > .contract table tr td {
width: 100%;
height: 100%;
line-height: 2;
display: flex;
}
main .contract-install-component > .contract table tr td.center, main .contract-material-component > .contract table tr td.center {
main .contract-install-component > .contract table tr td.center,
main .contract-material-component > .contract table tr td.center {
display: flex;
justify-content: center;
align-items: center;
}
main .contract-install-component > .contract table tr td.list, main .contract-material-component > .contract table tr td.list {
main .contract-install-component > .contract table tr td.list,
main .contract-material-component > .contract table tr td.list {
width: 100%;
height: 100%;
white-space: nowrap;
display: flex;
}
main .contract-install-component > .contract table tr td.list span, main .contract-material-component > .contract table tr td.list span {
main .contract-install-component > .contract table tr td.list span,
main .contract-material-component > .contract table tr td.list span {
width: 100px;
min-height: 100%;
display: block;
}
main .contract-install-component > .contract table tr td.list > p, main .contract-material-component > .contract table tr td.list > p {
main .contract-install-component > .contract table tr td.list > p,
main .contract-material-component > .contract table tr td.list > p {
display: block;
text-align: justify;
}
main .contract-install-component > .contract table tr td.list div, main .contract-install-component > .contract table tr td.list article, main .contract-material-component > .contract table tr td.list div, main .contract-material-component > .contract table tr td.list article {
main .contract-install-component > .contract table tr td.list div,
main .contract-install-component > .contract table tr td.list article,
main .contract-material-component > .contract table tr td.list div,
main .contract-material-component > .contract table tr td.list article {
max-width: calc(100% - 100px);
white-space: normal;
}
main .contract-install-component > .contract table tr td.list div input[type=text], main .contract-install-component > .contract table tr td.list div input[type=number], main .contract-install-component > .contract table tr td.list div input, main .contract-install-component > .contract table tr td.list article input[type=text], main .contract-install-component > .contract table tr td.list article input[type=number], main .contract-install-component > .contract table tr td.list article input, main .contract-material-component > .contract table tr td.list div input[type=text], main .contract-material-component > .contract table tr td.list div input[type=number], main .contract-material-component > .contract table tr td.list div input, main .contract-material-component > .contract table tr td.list article input[type=text], main .contract-material-component > .contract table tr td.list article input[type=number], main .contract-material-component > .contract table tr td.list article input {
main .contract-install-component > .contract table tr td.list div input[type=text],
main .contract-install-component > .contract table tr td.list div input[type=number],
main .contract-install-component > .contract table tr td.list div input,
main .contract-install-component > .contract table tr td.list article input[type=text],
main .contract-install-component > .contract table tr td.list article input[type=number],
main .contract-install-component > .contract table tr td.list article input,
main .contract-material-component > .contract table tr td.list div input[type=text],
main .contract-material-component > .contract table tr td.list div input[type=number],
main .contract-material-component > .contract table tr td.list div input,
main .contract-material-component > .contract table tr td.list article input[type=text],
main .contract-material-component > .contract table tr td.list article input[type=number],
main .contract-material-component > .contract table tr td.list article input {
border: none !important;
border-bottom: 1px #222 solid !important;
width: 50px;
outline: none;
text-align: center;
}
main .contract-install-component > .contract table tr td.list div.text-justify, main .contract-install-component > .contract table tr td.list article.text-justify, main .contract-material-component > .contract table tr td.list div.text-justify, main .contract-material-component > .contract table tr td.list article.text-justify {
main .contract-install-component > .contract table tr td.list div.text-justify,
main .contract-install-component > .contract table tr td.list article.text-justify,
main .contract-material-component > .contract table tr td.list div.text-justify,
main .contract-material-component > .contract table tr td.list article.text-justify {
display: flex;
width: 100%;
justify-content: space-between;
}
main .contract-install-component > .contract table tr.date td > div, main .contract-material-component > .contract table tr.date td > div {
main .contract-install-component > .contract table tr.date td > div,
main .contract-material-component > .contract table tr.date td > div {
width: 100%;
text-align: right;
}
main .contract-install-component > .contract table tr.date td > div.text-justify, main .contract-material-component > .contract table tr.date td > div.text-justify {
main .contract-install-component > .contract table tr.date td > div.text-justify,
main .contract-material-component > .contract table tr.date td > div.text-justify {
display: flex;
justify-content: space-between;
}
main .contract-install-component > .contract table td, main .contract-install-component > .contract table th, main .contract-material-component > .contract table td, main .contract-material-component > .contract table th {
main .contract-install-component > .contract table td,
main .contract-install-component > .contract table th,
main .contract-material-component > .contract table td,
main .contract-material-component > .contract table th {
padding: 8px;
}
@keyframes modelanim {
@ -323,7 +402,8 @@ main .contract-model > .contract-content > .content textarea {
outline: none;
border-radius: 6px;
}
main .rebtn, main .prviewbtn {
main .rebtn,
main .prviewbtn {
background-color: #5BC0DE;
color: #fff;
outline: none;
@ -339,7 +419,8 @@ main .prviewbtn {
background-color: #2E6DA4;
}
input[type=checkbox].scorll, input[type=radio].scorll {
input[type=checkbox].scorll,
input[type=radio].scorll {
position: relative;
width: 50px;
height: 25px;
@ -349,7 +430,8 @@ input[type=checkbox].scorll, input[type=radio].scorll {
cursor: pointer;
border-radius: 20px;
}
input[type=checkbox].scorll::before, input[type=radio].scorll::before {
input[type=checkbox].scorll::before,
input[type=radio].scorll::before {
content: "";
position: absolute;
top: 0;
@ -361,13 +443,16 @@ input[type=checkbox].scorll::before, input[type=radio].scorll::before {
transform: scale(0.98, 0.96);
transition: 0.5s;
}
input[type=checkbox].scorll:checked, input[type=radio].scorll:checked {
input[type=checkbox].scorll:checked,
input[type=radio].scorll:checked {
background: linear-gradient(to right, #5BC0DE, #2E6DA4);
}
input[type=checkbox].scorll:checked::before, input[type=radio].scorll:checked::before {
input[type=checkbox].scorll:checked::before,
input[type=radio].scorll:checked::before {
left: 25px;
}
input[type=checkbox].scorll::after, input[type=radio].scorll::after {
input[type=checkbox].scorll::after,
input[type=radio].scorll::after {
content: "";
}
@ -378,7 +463,8 @@ input[type=checkbox].scorll::after, input[type=radio].scorll::after {
width: 800px;
border: 1px #ccc solid;
}
.prview table tr:nth-child(even), .prview table tr:nth-child(odd) {
.prview table tr:nth-child(even),
.prview table tr:nth-child(odd) {
background-color: #fff;
}
.prview table tr {
@ -418,11 +504,13 @@ input[type=checkbox].scorll::after, input[type=radio].scorll::after {
display: block;
text-align: justify;
}
.prview table tr td.list div, .prview table tr td.list article {
.prview table tr td.list div,
.prview table tr td.list article {
max-width: calc(100% - 100px);
white-space: normal;
}
.prview table tr td.list div.text-justify, .prview table tr td.list article.text-justify {
.prview table tr td.list div.text-justify,
.prview table tr td.list article.text-justify {
display: flex;
width: 100%;
justify-content: space-between;
@ -435,7 +523,8 @@ input[type=checkbox].scorll::after, input[type=radio].scorll::after {
display: flex;
justify-content: space-between;
}
.prview table td, .prview table th {
.prview table td,
.prview table th {
padding: 8px;
}
@ -445,7 +534,8 @@ main table {
font-family: "標楷體";
width: 800px;
}
main table tr:nth-child(even), main table tr:nth-child(odd) {
main table tr:nth-child(even),
main table tr:nth-child(odd) {
background-color: #fff;
}
main table tr {
@ -502,7 +592,8 @@ main table tr.date td > div.text-justify {
display: flex;
justify-content: space-between;
}
main table td, main table th {
main table td,
main table th {
padding: 8px;
}
@ -525,8 +616,10 @@ main table td, main table th {
}
.loader {
border: 4px solid #f3f3f3; /* Light grey */
border-top: 4px solid #999; /* Blue */
border: 4px solid #f3f3f3;
/* Light grey */
border-top: 4px solid #999;
/* Blue */
border-radius: 50%;
width: 20px;
height: 20px;
@ -541,14 +634,20 @@ main table td, main table th {
transform: rotate(360deg);
}
}
.contract-input-component .contract-input-component .form, .contract-input-component .contract-management .form, .contract-input-component .contract-new-apply-component .form, .contract-management .contract-input-component .form, .contract-management .contract-management .form, .contract-management .contract-new-apply-component .form, .contract-new-apply-component .contract-input-component .form, .contract-new-apply-component .contract-management .form, .contract-new-apply-component .contract-new-apply-component .form {
.contract-input-component .form,
.contract-management .form,
.contract-new-apply-component .form {
margin: 0 auto;
}
.contract-input-component .contract-input-component .form .dropdown, .contract-input-component .contract-management .form .dropdown, .contract-input-component .contract-new-apply-component .form .dropdown, .contract-management .contract-input-component .form .dropdown, .contract-management .contract-management .form .dropdown, .contract-management .contract-new-apply-component .form .dropdown, .contract-new-apply-component .contract-input-component .form .dropdown, .contract-new-apply-component .contract-management .form .dropdown, .contract-new-apply-component .contract-new-apply-component .form .dropdown {
.contract-input-component .form .dropdown,
.contract-management .form .dropdown,
.contract-new-apply-component .form .dropdown {
width: 100%;
margin-top: 7px;
}
.contract-input-component .contract-input-component .form .savebtn, .contract-input-component .contract-management .form .savebtn, .contract-input-component .contract-new-apply-component .form .savebtn, .contract-management .contract-input-component .form .savebtn, .contract-management .contract-management .form .savebtn, .contract-management .contract-new-apply-component .form .savebtn, .contract-new-apply-component .contract-input-component .form .savebtn, .contract-new-apply-component .contract-management .form .savebtn, .contract-new-apply-component .contract-new-apply-component .form .savebtn {
.contract-input-component .form .savebtn,
.contract-management .form .savebtn,
.contract-new-apply-component .form .savebtn {
margin-right: 13px;
display: flex;
justify-content: center;
@ -557,11 +656,15 @@ main table td, main table th {
height: 45px;
font-size: 15px;
}
.contract-input-component .contract-input-component .form table .fixed, .contract-input-component .contract-management .form table .fixed, .contract-input-component .contract-new-apply-component .form table .fixed, .contract-management .contract-input-component .form table .fixed, .contract-management .contract-management .form table .fixed, .contract-management .contract-new-apply-component .form table .fixed, .contract-new-apply-component .contract-input-component .form table .fixed, .contract-new-apply-component .contract-management .form table .fixed, .contract-new-apply-component .contract-new-apply-component .form table .fixed {
.contract-input-component .form table .fixed,
.contract-management .form table .fixed,
.contract-new-apply-component .form table .fixed {
padding: 8px 0;
cursor: not-allowed;
}
.contract-input-component .contract-input-component .form table .alerttext, .contract-input-component .contract-management .form table .alerttext, .contract-input-component .contract-new-apply-component .form table .alerttext, .contract-management .contract-input-component .form table .alerttext, .contract-management .contract-management .form table .alerttext, .contract-management .contract-new-apply-component .form table .alerttext, .contract-new-apply-component .contract-input-component .form table .alerttext, .contract-new-apply-component .contract-management .form table .alerttext, .contract-new-apply-component .contract-new-apply-component .form table .alerttext {
.contract-input-component .form table .alerttext,
.contract-management .form table .alerttext,
.contract-new-apply-component .form table .alerttext {
font-size: 13px;
color: #a00;
font-weight: 500;
@ -569,92 +672,126 @@ main table td, main table th {
font-weight: 900;
padding: 0;
}
.contract-input-component .contract-input-component .form input[type=file], .contract-input-component .contract-management .form input[type=file], .contract-input-component .contract-new-apply-component .form input[type=file], .contract-management .contract-input-component .form input[type=file], .contract-management .contract-management .form input[type=file], .contract-management .contract-new-apply-component .form input[type=file], .contract-new-apply-component .contract-input-component .form input[type=file], .contract-new-apply-component .contract-management .form input[type=file], .contract-new-apply-component .contract-new-apply-component .form input[type=file] {
.contract-input-component .form input[type=file],
.contract-management .form input[type=file],
.contract-new-apply-component .form input[type=file] {
padding: 12px 20px;
margin: 8px 0;
}
.contract-input-component .contract-input-component .form span, .contract-input-component .contract-management .form span, .contract-input-component .contract-new-apply-component .form span, .contract-management .contract-input-component .form span, .contract-management .contract-management .form span, .contract-management .contract-new-apply-component .form span, .contract-new-apply-component .contract-input-component .form span, .contract-new-apply-component .contract-management .form span, .contract-new-apply-component .contract-new-apply-component .form span {
.contract-input-component .form span,
.contract-management .form span,
.contract-new-apply-component .form span {
font-weight: 900;
}
.contract-input-component .contract-input-component .form span.successtext, .contract-input-component .contract-management .form span.successtext, .contract-input-component .contract-new-apply-component .form span.successtext, .contract-management .contract-input-component .form span.successtext, .contract-management .contract-management .form span.successtext, .contract-management .contract-new-apply-component .form span.successtext, .contract-new-apply-component .contract-input-component .form span.successtext, .contract-new-apply-component .contract-management .form span.successtext, .contract-new-apply-component .contract-new-apply-component .form span.successtext {
.contract-input-component .form span.successtext,
.contract-management .form span.successtext,
.contract-new-apply-component .form span.successtext {
color: #0a0;
}
.contract-input-component .contract-input-component .form span.failtext, .contract-input-component .contract-management .form span.failtext, .contract-input-component .contract-new-apply-component .form span.failtext, .contract-management .contract-input-component .form span.failtext, .contract-management .contract-management .form span.failtext, .contract-management .contract-new-apply-component .form span.failtext, .contract-new-apply-component .contract-input-component .form span.failtext, .contract-new-apply-component .contract-management .form span.failtext, .contract-new-apply-component .contract-new-apply-component .form span.failtext {
.contract-input-component .form span.failtext,
.contract-management .form span.failtext,
.contract-new-apply-component .form span.failtext {
color: #a00;
}
.contract-input-component .contract-input-component .form span.readtext, .contract-input-component .contract-management .form span.readtext, .contract-input-component .contract-new-apply-component .form span.readtext, .contract-management .contract-input-component .form span.readtext, .contract-management .contract-management .form span.readtext, .contract-management .contract-new-apply-component .form span.readtext, .contract-new-apply-component .contract-input-component .form span.readtext, .contract-new-apply-component .contract-management .form span.readtext, .contract-new-apply-component .contract-new-apply-component .form span.readtext {
.contract-input-component .form span.readtext,
.contract-management .form span.readtext,
.contract-new-apply-component .form span.readtext {
color: #aa0;
}
.contract-input-component .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-input-component .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-input-component .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-management .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-management .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-input-component .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-management .form input[type=number]::-webkit-inner-spin-button, .contract-new-apply-component .contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button {
.contract-input-component .form input[type=number]::-webkit-outer-spin-button,
.contract-input-component .form input[type=number]::-webkit-inner-spin-button,
.contract-management .form input[type=number]::-webkit-outer-spin-button,
.contract-management .form input[type=number]::-webkit-inner-spin-button,
.contract-new-apply-component .form input[type=number]::-webkit-outer-spin-button,
.contract-new-apply-component .form input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.contract-input-component .contract-input-component .form input[type=number], .contract-input-component .contract-management .form input[type=number], .contract-input-component .contract-new-apply-component .form input[type=number], .contract-management .contract-input-component .form input[type=number], .contract-management .contract-management .form input[type=number], .contract-management .contract-new-apply-component .form input[type=number], .contract-new-apply-component .contract-input-component .form input[type=number], .contract-new-apply-component .contract-management .form input[type=number], .contract-new-apply-component .contract-new-apply-component .form input[type=number] {
.contract-input-component .form input[type=number],
.contract-management .form input[type=number],
.contract-new-apply-component .form input[type=number] {
-moz-appearance: textfield;
}
.contract-input-component .contract-input-component .error, .contract-input-component .contract-management .error, .contract-input-component .contract-new-apply-component .error, .contract-management .contract-input-component .error, .contract-management .contract-management .error, .contract-management .contract-new-apply-component .error, .contract-new-apply-component .contract-input-component .error, .contract-new-apply-component .contract-management .error, .contract-new-apply-component .contract-new-apply-component .error {
.contract-input-component .error,
.contract-management .error,
.contract-new-apply-component .error {
display: flex;
flex-direction: column;
margin: 15px;
}
.contract-input-component .contract-input-component .error .errortext, .contract-input-component .contract-management .error .errortext, .contract-input-component .contract-new-apply-component .error .errortext, .contract-management .contract-input-component .error .errortext, .contract-management .contract-management .error .errortext, .contract-management .contract-new-apply-component .error .errortext, .contract-new-apply-component .contract-input-component .error .errortext, .contract-new-apply-component .contract-management .error .errortext, .contract-new-apply-component .contract-new-apply-component .error .errortext {
.contract-input-component .error .errortext,
.contract-management .error .errortext,
.contract-new-apply-component .error .errortext {
font-size: 16px;
font-weight: 500;
color: #a00;
}
.contract-input-component .contract-input-component .input-group-btn, .contract-input-component .contract-management .input-group-btn, .contract-input-component .contract-new-apply-component .input-group-btn, .contract-management .contract-input-component .input-group-btn, .contract-management .contract-management .input-group-btn, .contract-management .contract-new-apply-component .input-group-btn, .contract-new-apply-component .contract-input-component .input-group-btn, .contract-new-apply-component .contract-management .input-group-btn, .contract-new-apply-component .contract-new-apply-component .input-group-btn {
.contract-input-component .input-group-btn,
.contract-management .input-group-btn,
.contract-new-apply-component .input-group-btn {
font-size: 16px;
}
@media screen and (max-width: 600px) {
.contract-input-component .contract-input-component table, .contract-input-component .contract-management table, .contract-input-component .contract-new-apply-component table, .contract-management .contract-input-component table, .contract-management .contract-management table, .contract-management .contract-new-apply-component table, .contract-new-apply-component .contract-input-component table, .contract-new-apply-component .contract-management table, .contract-new-apply-component .contract-new-apply-component table {
.contract-input-component table,
.contract-management table,
.contract-new-apply-component table {
border: 0;
}
.contract-input-component .contract-input-component table thead, .contract-input-component .contract-management table thead, .contract-input-component .contract-new-apply-component table thead, .contract-management .contract-input-component table thead, .contract-management .contract-management table thead, .contract-management .contract-new-apply-component table thead, .contract-new-apply-component .contract-input-component table thead, .contract-new-apply-component .contract-management table thead, .contract-new-apply-component .contract-new-apply-component table thead {
.contract-input-component table thead,
.contract-management table thead,
.contract-new-apply-component table thead {
display: none;
}
.contract-input-component .contract-input-component table tr, .contract-input-component .contract-management table tr, .contract-input-component .contract-new-apply-component table tr, .contract-management .contract-input-component table tr, .contract-management .contract-management table tr, .contract-management .contract-new-apply-component table tr, .contract-new-apply-component .contract-input-component table tr, .contract-new-apply-component .contract-management table tr, .contract-new-apply-component .contract-new-apply-component table tr {
.contract-input-component table tr,
.contract-management table tr,
.contract-new-apply-component table tr {
margin-bottom: 10px;
display: block;
border-bottom: 2px solid #ddd;
}
.contract-input-component .contract-input-component table td, .contract-input-component .contract-management table td, .contract-input-component .contract-new-apply-component table td, .contract-management .contract-input-component table td, .contract-management .contract-management table td, .contract-management .contract-new-apply-component table td, .contract-new-apply-component .contract-input-component table td, .contract-new-apply-component .contract-management table td, .contract-new-apply-component .contract-new-apply-component table td {
.contract-input-component table td,
.contract-management table td,
.contract-new-apply-component table td {
display: block;
text-align: left;
font-size: 14px;
border-bottom: 1px dotted #ccc;
}
.contract-input-component .contract-input-component table td:last-child, .contract-input-component .contract-management table td:last-child, .contract-input-component .contract-new-apply-component table td:last-child, .contract-management .contract-input-component table td:last-child, .contract-management .contract-management table td:last-child, .contract-management .contract-new-apply-component table td:last-child, .contract-new-apply-component .contract-input-component table td:last-child, .contract-new-apply-component .contract-management table td:last-child, .contract-new-apply-component .contract-new-apply-component table td:last-child {
.contract-input-component table td:last-child,
.contract-management table td:last-child,
.contract-new-apply-component table td:last-child {
border-bottom: 0;
}
.contract-input-component .contract-input-component table td:before, .contract-input-component .contract-management table td:before, .contract-input-component .contract-new-apply-component table td:before, .contract-management .contract-input-component table td:before, .contract-management .contract-management table td:before, .contract-management .contract-new-apply-component table td:before, .contract-new-apply-component .contract-input-component table td:before, .contract-new-apply-component .contract-management table td:before, .contract-new-apply-component .contract-new-apply-component table td:before {
.contract-input-component table td:before,
.contract-management table td:before,
.contract-new-apply-component table td:before {
content: attr(data-label);
float: left;
text-transform: uppercase;
font-weight: bold;
}
}
.contract-input-component .contract-input-component .images, .contract-input-component .contract-management .images, .contract-input-component .contract-new-apply-component .images, .contract-management .contract-input-component .images, .contract-management .contract-management .images, .contract-management .contract-new-apply-component .images, .contract-new-apply-component .contract-input-component .images, .contract-new-apply-component .contract-management .images, .contract-new-apply-component .contract-new-apply-component .images {
.contract-input-component .images,
.contract-management .images,
.contract-new-apply-component .images {
display: flex;
flex-wrap: wrap;
padding: 20px;
}
.contract-input-component .contract-input-component .images > .image, .contract-input-component .contract-management .images > .image, .contract-input-component .contract-new-apply-component .images > .image, .contract-management .contract-input-component .images > .image, .contract-management .contract-management .images > .image, .contract-management .contract-new-apply-component .images > .image, .contract-new-apply-component .contract-input-component .images > .image, .contract-new-apply-component .contract-management .images > .image, .contract-new-apply-component .contract-new-apply-component .images > .image {
.contract-input-component .images > .image,
.contract-management .images > .image,
.contract-new-apply-component .images > .image {
position: relative;
margin: 10px;
}
.contract-input-component .contract-input-component .images > .image:hover > i, .contract-input-component .contract-management .images > .image:hover > i, .contract-input-component .contract-new-apply-component .images > .image:hover > i, .contract-management .contract-input-component .images > .image:hover > i, .contract-management .contract-management .images > .image:hover > i, .contract-management .contract-new-apply-component .images > .image:hover > i, .contract-new-apply-component .contract-input-component .images > .image:hover > i, .contract-new-apply-component .contract-management .images > .image:hover > i, .contract-new-apply-component .contract-new-apply-component .images > .image:hover > i {
.contract-input-component .images > .image:hover > i,
.contract-management .images > .image:hover > i,
.contract-new-apply-component .images > .image:hover > i {
opacity: 1;
}
.contract-input-component .contract-input-component .images > .image > i, .contract-input-component .contract-management .images > .image > i, .contract-input-component .contract-new-apply-component .images > .image > i, .contract-management .contract-input-component .images > .image > i, .contract-management .contract-management .images > .image > i, .contract-management .contract-new-apply-component .images > .image > i, .contract-new-apply-component .contract-input-component .images > .image > i, .contract-new-apply-component .contract-management .images > .image > i, .contract-new-apply-component .contract-new-apply-component .images > .image > i {
.contract-input-component .images > .image > i,
.contract-management .images > .image > i,
.contract-new-apply-component .images > .image > i {
position: absolute;
top: -12px;
right: -12px;
@ -663,29 +800,37 @@ main table td, main table th {
opacity: 0;
transition: 0.3s;
}
.contract-input-component table, .contract-management table, .contract-new-apply-component table {
table {
table-layout: fixed;
width: 100%;
}
.contract-input-component td, .contract-management td, .contract-new-apply-component td {
td {
word-wrap: break-word;
}
.contract-input-component img, .contract-management img, .contract-new-apply-component img {
img {
width: 125px;
}
.contract-input-component .width_style_1, .contract-management .width_style_1, .contract-new-apply-component .width_style_1 {
.width_style_1 {
width: 125px;
}
.contract-input-component table, .contract-management table, .contract-new-apply-component table {
table {
width: 100%;
}
.contract-input-component #table_index_filter, .contract-management #table_index_filter, .contract-new-apply-component #table_index_filter {
#table_index_filter {
float: right;
}
.contract-input-component #table_index_paginate, .contract-management #table_index_paginate, .contract-new-apply-component #table_index_paginate {
#table_index_paginate {
float: right;
}
.contract-input-component label, .contract-management label, .contract-new-apply-component label {
label {
display: inline-flex;
margin-bottom: 0.5rem;
margin-top: 0.5rem;

2
wms/contract-repair/styles/style.css.map

File diff suppressed because one or more lines are too long

583
wms/contract-repair/styles/style.scss

File diff suppressed because it is too large

4
wms/mkt/pricereview_contractno-api.php

@ -1,4 +1,5 @@
<?php
/**
* 客戶資料
* @url /pricereview_contractno-api.php
@ -53,11 +54,10 @@ try {
$rarr["st"] = "err";
$rarr["err"] = "無資料!";
}
}catch(\Exception $e) {
} catch (\Exception $e) {
$rarr["st"] = "err";
$rarr["err"] = $e->getMessage();
}
//print_r($rarr);exit;
echo json_encode($rarr, JSON_UNESCAPED_UNICODE);
exit;
?>

401
wms/mkt/pricereview_repair-check.php

@ -5,7 +5,7 @@ $form_key = isset($_GET['form_key']) ? $_GET['form_key'] : "";
if ($form_key == "") $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
if (!empty($form_key)) {
$sql = "select form_id from flow where form_key = '$form_key'";
$sql = "SELECT form_id FROM flow where form_key = '$form_key'";
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) {
$id = $row[0];
@ -15,7 +15,7 @@ if (!empty($form_key)) {
// 目前簽核進度
$pstatus = "";
$db_query = "select pstatus from pricereview_repair_main where id = '$id'";
$res_r = mysqli_query($link ,$db_query);
$res_r = mysqli_query($link, $db_query);
if ($row_r = mysqli_fetch_row($res_r)) {
$pstatus = $row_r[0];
}
@ -35,9 +35,9 @@ $data = [];
$db_query = "select * from pricereview_repair_main where id = '$id'";
$data = mysqli_query($link, $db_query);
foreach($data as $data) :
foreach ($data as $data) :
// 公司站點
$sql = "select content from code where field_name = 'masada_addr' and code_name = '".$data["masada_addr"]."'";
$sql = "select content from code where field_name = 'masada_addr' and code_name = '" . $data["masada_addr"] . "'";
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) {
$data["maddr"] = $row[0];
@ -46,7 +46,7 @@ foreach($data as $data) :
// 保養人員
$repairer_arr = [];
$sql = "select name from account where accounttype = 'B' and accountid = '".$data["repairerid"]."'";
$sql = "select name from account where accounttype = 'B' and accountid = '" . $data["repairerid"] . "'";
$res = mysqli_query($link, $sql);
if ($row = mysqli_fetch_row($res)) {
$data["repair"] = $row[0];
@ -67,202 +67,219 @@ foreach($data as $data) :
mysqli_free_result($res);
// get form_key
$sql = "select max(form_key) from assign where assign_opinion = '".$data["repair_no"]."'";
$sql = "select max(form_key) from assign where assign_opinion = '" . $data["repair_no"] . "'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
$form_key = $row[0];
mysqli_free_result($res);
?>
<style>
.nextline {
width: 100%;
height: 0;
}
input[type=submit], input[type=button] {
width: 100%;
background-color: #1E74FD;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
.dollar-right {
text-align: right;
}
.star {
color: red;
}
</style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(function(){
$(":input").prop("disabled", true);
$("#assign_status").prop("disabled", false);
$("#next_users").prop("disabled", false);
$("#submit").prop("disabled", false);
$("#assign_status").change(function(){
if ($(this).val() == "F6") $("#next_users").html('<option value="00000">00000</option>');
else if ($(this).val() == "Y1") $("#next_users").html('<option value="X">退回</option>');
else $("#next_users").html('');
});
$('input[name=submit]').click(function(){
$("#id").prop("disabled", false);
$("#form_key").prop("disabled", false);
$("#token").prop("disabled", false);
});
});
</script>
<div class="container">
<form class="form-inline" method="post" action="pricereview_repair-record-check.php" enctype="multipart/form-data">
<div>
<label for="contractno">客戶合約號</label>
<input type="text" name="contractno" id="contractno" value="<?php echo $data["contractno"]; ?>">
</div>
<div>
<label for="repair_no">報價單編號</label>
<input type="text" name="repair_no" id="repair_no" value="<?php echo $data["repair_no"]; ?>">
</div>
<div class="nextline"></div>
<div>
<label for="sign_date">簽訂日期</label><br>
<input type="text" name="sign_date" id="sign_date" value="<?php echo $data["sign_date"]; ?>">
</div>
<div>
<label for="company">公司地址</label>
<input type="text" name="masada_addr" id="masada_addr" size="46" value="<?php echo $data["maddr"]; ?>">
</div>
<div>
<label for="company">客戶名稱</label>
<input type="text" name="company" id="company" size="30" value="<?php echo $data["company"]; ?>">
</div>
<div>
<label for="facilityno">電梯編號</label>
<input type="text" name="facilityno" value="<?php echo $data["facilityno"]; ?>">
</div>
<div class="nextline"></div>
<div>
<label for="address">工程地址</label>
<input type="text" name="address" id="address" size="46" value="<?php echo $data["address"]; ?>">
</div>
<div>
<label for="taxid">客戶統一編號</label>
<input type="text" name="taxid" id="taxid" value="<?php echo $data["taxid"]; ?>">
</div>
<div>
<label for="invoice">客戶發票抬頭</label>
<input type="text" name="invoice" id="invoice" size="30" value="<?php echo $data["invoice"]; ?>">
</div>
<div>
<label for="repairerid">申請人</label>
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data["repair"]; ?>">
</div>
<div class="nextline"></div>
<div>
<label for="memo">備註</label><br>
<textarea name="memo" id="memo" cols="60" rows="4"><?php echo $data["memo"]; ?></textarea>
</div>
<style>
.nextline {
width: 100%;
height: 0;
}
<div class="nextline"></div>
<br>
input[type=submit],
input[type=button] {
width: 100%;
background-color: #1E74FD;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
<div class="table-responsive">
<table id="tb1" class="table table-bordered">
<thead>
<tr>
<th>項次</th>
<th>名稱</th>
<th>數量</th>
<th>單價</th>
<th>合計</th>
<th>備註</th>
</tr>
</thead>
<tbody>
<?php
foreach ($item_arr as $k => $v) {
?>
<tr name="main_templ">
<td>
<input type="text" name="item_no" class="form-control" size="3" value="<?php echo $k; ?>">
</td>
<td>
<input type="text" name="item_title" class="form-control" size="40" value="<?php echo $v["title"]; ?>">
</td>
<td>
<input type="text" name="item_qty" class="form-control dollar-right" size="3" value="<?php echo number_format($v["item_qty"]); ?>">
</td>
<td>
<input type="text" name="item_unit_price" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_unit_price"]); ?>">
</td>
<td>
<input type="text" name="item_price_bp" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_price_bp"]); ?>">
</td>
<td>
<input type="text" name="item_memo" class="form-control" value="<?php echo $v["memo"]; ?>">
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="3"><h5>營業稅</h5></td>
<td>
<input type="text" name="sales_tax" class="dollar-right" size="10" value="<?php echo number_format($data["sales_tax"]); ?>">
</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3"><h5>總價</h5></td>
<td>
<input type="text" name="total_price" class="dollar-right" size="10" value="<?php echo number_format($data["total_price"]); ?>">
</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
</div>
.dollar-right {
text-align: right;
}
<div class="nextline"></div>
<?php
if (($data["checker"] == $user_id) && ($data["pstatus"] == "A")) {
?>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th colspan="10">簽核操作<span class="star">*</span></th>
</tr>
</thead>
<tbody>
<tr>
<td><b style='float:right'>簽核狀態</b></td>
<td>
<select name="assign_status" id="assign_status" required class="form-control form-control form-control-sm">
<?php echo $assign_status; ?>
</select>
</td>
<td><b>下位簽核者</b></td>
<td>
<select name="next_users" id="next_users" class="form-control form-control-sm" required></select>
</td>
<td>
<input type="submit" name="submit" id="submit" value="提交">
</td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>">
<input type="hidden" name="form_key" id="form_key" value="<?php echo $form_key; ?>">
<input type="hidden" name="token" id="token" value="<?php echo $token; ?>">
<?php
.star {
color: red;
}
?>
</form>
</div>
</style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(function() {
$(":input").prop("disabled", true);
$("#assign_status").prop("disabled", false);
$("#next_users").prop("disabled", false);
$("#submit").prop("disabled", false);
$("#assign_status").change(function() {
if ($(this).val() == "F6") $("#next_users").html('<option value="00000">00000</option>');
else if ($(this).val() == "Y1") $("#next_users").html('<option value="X">退回</option>');
else $("#next_users").html('');
});
$('input[name=submit]').click(function() {
$("#id").prop("disabled", false);
$("#form_key").prop("disabled", false);
$("#token").prop("disabled", false);
});
});
</script>
<div class="container">
<form class="form-inline" method="post" action="pricereview_repair-record-check.php" enctype="multipart/form-data">
<div>
<label for="contractno">客戶合約號</label>
<input type="text" name="contractno" id="contractno" value="<?php echo $data["contractno"]; ?>">
</div>
<div>
<label for="repair_no">報價單編號</label>
<input type="text" name="repair_no" id="repair_no" value="<?php echo $data["repair_no"]; ?>">
</div>
<div class="nextline"></div>
<div>
<label for="sign_date">簽訂日期</label><br>
<input type="text" name="sign_date" id="sign_date" value="<?php echo $data["sign_date"]; ?>">
</div>
<div>
<label for="company">公司地址</label>
<input type="text" name="masada_addr" id="masada_addr" size="46" value="<?php echo $data["maddr"]; ?>">
</div>
<div>
<label for="company">客戶名稱</label>
<input type="text" name="company" id="company" size="30" value="<?php echo $data["company"]; ?>">
</div>
<div>
<label for="facilityno">電梯編號</label>
<input type="text" name="facilityno" value="<?php echo $data["facilityno"]; ?>">
</div>
<div class="nextline"></div>
<div>
<label for="address">工程地址</label>
<input type="text" name="address" id="address" size="46" value="<?php echo $data["address"]; ?>">
</div>
<div>
<label for="taxid">客戶統一編號</label>
<input type="text" name="taxid" id="taxid" value="<?php echo $data["taxid"]; ?>">
</div>
<div>
<label for="invoice">客戶發票抬頭</label>
<input type="text" name="invoice" id="invoice" size="30" value="<?php echo $data["invoice"]; ?>">
</div>
<div>
<label for="repairerid">申請人</label>
<input type="text" name="repairerid" id="repairerid" value="<?php echo $data["repair"]; ?>">
</div>
<div class="nextline"></div>
<div>
<label for="memo">備註</label><br>
<textarea name="memo" id="memo" cols="60" rows="4"><?php echo $data["memo"]; ?></textarea>
</div>
<div class="nextline"></div>
<br>
<div class="table-responsive">
<table id="tb1" class="table table-bordered">
<thead>
<tr>
<th>項次</th>
<th>名稱</th>
<th>數量</th>
<th>單價</th>
<th>合計</th>
<th>備註</th>
</tr>
</thead>
<tbody>
<?php
foreach ($item_arr as $k => $v) {
?>
<tr name="main_templ">
<td>
<input type="text" name="item_no" class="form-control" size="3" value="<?php echo $k; ?>">
</td>
<td>
<input type="text" name="item_title" class="form-control" size="40" value="<?php echo $v["title"]; ?>">
</td>
<td>
<input type="text" name="item_qty" class="form-control dollar-right" size="3" value="<?php echo number_format($v["item_qty"]); ?>">
</td>
<td>
<input type="text" name="item_unit_price" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_unit_price"]); ?>">
</td>
<td>
<input type="text" name="item_price_bp" class="form-control dollar-right" size="10" value="<?php echo number_format($v["item_price_bp"]); ?>">
</td>
<td>
<input type="text" name="item_memo" class="form-control" value="<?php echo $v["memo"]; ?>">
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="3">
<h5>服務費</h5>
</td>
<td>
<input type="text" name="service_charge" class="dollar-right" size="10" value="<?php echo number_format($data["service_charge"]); ?>">
</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3">
<h5>營業稅</h5>
</td>
<td>
<input type="text" name="sales_tax" class="dollar-right" size="10" value="<?php echo number_format($data["sales_tax"]); ?>">
</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3">
<h5>總價</h5>
</td>
<td>
<input type="text" name="total_price" class="dollar-right" size="10" value="<?php echo number_format($data["total_price"]); ?>">
</td>
<td colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="nextline"></div>
<?php
if (($data["checker"] == $user_id) && ($data["pstatus"] == "A")) {
?>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th colspan="10">簽核操作<span class="star">*</span></th>
</tr>
</thead>
<tbody>
<tr>
<td><b style='float:right'>簽核狀態</b></td>
<td>
<select name="assign_status" id="assign_status" required class="form-control form-control form-control-sm">
<?php echo $assign_status; ?>
</select>
</td>
<td><b>下位簽核者</b></td>
<td>
<select name="next_users" id="next_users" class="form-control form-control-sm" required></select>
</td>
<td>
<input type="submit" name="submit" id="submit" value="提交">
</td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>">
<input type="hidden" name="form_key" id="form_key" value="<?php echo $form_key; ?>">
<input type="hidden" name="token" id="token" value="<?php echo $token; ?>">
<?php
}
?>
</form>
</div>
<?php
endforeach;
?>

517
wms/mkt/pricereview_repair-create.php

@ -8,15 +8,15 @@ $sql = "select max(repair_no) from pricereview_repair_main where SUBSTRING(repai
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
if (empty($row[0])) $serial = "001";
else $serial = str_pad(substr($row[0]+1, -3), 3, 0, STR_PAD_LEFT);
$repair_no = $repair_no_a.$serial;
else $serial = str_pad(substr($row[0] + 1, -3), 3, 0, STR_PAD_LEFT);
$repair_no = $repair_no_a . $serial;
// 公司站點
$maddr_arr = [];
$sql = "select code_name, content, remark from code where field_name = 'masada_addr' order by code_name";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_row($res)) {
$maddr_arr[$row[0]] = $row[2]."(".$row[1].")";
$maddr_arr[$row[0]] = $row[2] . "(" . $row[1] . ")";
}
mysqli_free_result($res);
@ -32,7 +32,7 @@ mysqli_free_result($res);
// 備品項目
$item_arr = [];
$sql = "select * from supplies where ver = '20231103'";
$sql = "SELECT * FROM supplies WHERE ver = '20231103'";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$item_arr[$row["id"]]["title"] = $row["title"];
@ -54,12 +54,12 @@ $item_str .= '<thead>
</tr></thead><tbody>';
foreach ($item_arr as $k => $v) {
$item_str .= "<tr>";
$item_str .= "<td>".$k."</td>";
$item_str .= "<td>".$v["title"]."</td>";
$item_str .= "<td>".$v["stype"]."</td>";
$item_str .= "<td>".$v["unit"]."</td>";
$item_str .= "<td>".number_format($v["price"])."</td>";
$item_str .= "<td>".$v["memo"]."</td>";
$item_str .= "<td>" . $k . "</td>";
$item_str .= "<td>" . $v["title"] . "</td>";
$item_str .= "<td>" . $v["stype"] . "</td>";
$item_str .= "<td>" . $v["unit"] . "</td>";
$item_str .= "<td>" . number_format($v["price"]) . "</td>";
$item_str .= "<td>" . $v["memo"] . "</td>";
$item_str .= "</tr>";
}
$item_str .= "</tbody></table>";
@ -73,134 +73,151 @@ $assign_status = $wf->getAssignStatus($assigner);
$assign_status = '<option value="FH">指派</option>'
?>
<style>
#btnadd, a[name=btndel] {
margin-left: 4px;
}
.nextline {
width: 100%;
height: 0;
}
input[type=submit], input[type=button] {
width: 100%;
background-color: #1E74FD;
color: white;
padding: 14px 20px;
margin: 8px 2px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.kind-col {
color:brown;
}
.modal-dialog {
width: 1200px;
}
.modal-content {
height:660px;
}
#itemModal .modal-body {
height: 540px;
overflow-y: auto;
}
#table_index2_filter label {
width: 30%;
}
#table_index2 {
cursor: pointer;
}
.row .form_row_header {
background-color: #6d9eeb;
line-height: 30px;
font-size: 16px;
}
.dollar-right {
text-align: right;
}
.star {
color: red;
}
#btnadd,
a[name=btndel] {
margin-left: 4px;
}
.nextline {
width: 100%;
height: 0;
}
input[type=submit],
input[type=button] {
width: 100%;
background-color: #1E74FD;
color: white;
padding: 14px 20px;
margin: 8px 2px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.kind-col {
color: brown;
}
.modal-dialog {
width: 1200px;
}
.modal-content {
height: 660px;
}
#itemModal .modal-body {
height: 540px;
overflow-y: auto;
}
#table_index2_filter label {
width: 30%;
}
#table_index2 {
cursor: pointer;
}
.row .form_row_header {
background-color: #6d9eeb;
line-height: 30px;
font-size: 16px;
}
.dollar-right {
text-align: right;
}
.star {
color: red;
}
</style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
// 加千分位
function commafy(num) {
num = num + "";
var re = /(-?\d+)(\d{3})/
while (re.test(num)) {
num = num.replace(re, "$1,$2")
// 加千分位
function commafy(num) {
num = num + "";
var re = /(-?\d+)(\d{3})/
while (re.test(num)) {
num = num.replace(re, "$1,$2")
}
return num;
}
return num;
}
function getCont(o) {
var fp = o.parent().parent();
//console.log(fp.html());
var pa = fp.find('input[name=contractno]').val().trim();
if (pa !== '') {
var formdata = new FormData();
formdata.append('pa', pa);
var xhr = new XMLHttpRequest();
var str = '';
xhr.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){
data = JSON.parse(this.responseText);
if (data.st == 'err') {
//alert(data.err);
alert('查無資料,請自行輸入資料!');
fp.find('input[name=company]').val('');
fp.find('input[name=invoice]').val('');
fp.find('input[name=address]').val('');
fp.find('select[name=repairerid]').val('');
fp.find('select[name=taxid]').val('');
fp.find('select[name=invoice]').val('');
fp.find('textarea[name=memo]').val('');
fp.find('input[name=facilityno]').val('');
fp.find('select[name=facilityno]').html('<option value=""></option>');
fp.find('select[name=facilityno]').removeAttr("required");
fp.find('select[name=facilityno]').hide();
fp.find('input[name=facilityno]').prop('required',true);
fp.find('input[name=facilityno]').show();
return false;
function getCont(o) {
var fp = o.parent().parent();
//console.log(fp.html());
var pa = fp.find('input[name=contractno]').val().trim();
if (pa !== '') {
var formdata = new FormData();
formdata.append('pa', pa);
var xhr = new XMLHttpRequest();
var str = '';
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
data = JSON.parse(this.responseText);
if (data.st == 'err') {
//alert(data.err);
alert('查無資料,請自行輸入資料!');
fp.find('input[name=company]').val('');
fp.find('input[name=invoice]').val('');
fp.find('input[name=address]').val('');
fp.find('select[name=repairerid]').val('');
fp.find('select[name=taxid]').val('');
fp.find('select[name=invoice]').val('');
fp.find('textarea[name=memo]').val('');
fp.find('input[name=facilityno]').val('');
fp.find('select[name=facilityno]').html('<option value=""></option>');
fp.find('select[name=facilityno]').removeAttr("required");
fp.find('select[name=facilityno]').hide();
fp.find('input[name=facilityno]').prop('required', true);
fp.find('input[name=facilityno]').show();
return false;
}
fp.find('input[name=company]').val(data.company);
fp.find('input[name=invoice]').val(data.company);
fp.find('input[name=contractno]').val(data.contractno);
fp.find('input[name=address]').val(data.address);
fp.find('select[name=repairerid]').val(data.repairerid);
Object.keys(data.faci).forEach(function(k) {
str += '<option value="' + data.faci[k] + '">' + data.faci[k] + '</option>';
});
fp.find('input[name=facilityno]').removeAttr("required");
fp.find('input[name=facilityno]').hide();
fp.find('select[name=facilityno]').append(str);
fp.find('select[name=facilityno]').prop('required', true);
fp.find('select[name=facilityno]').show();
}
fp.find('input[name=company]').val(data.company);
fp.find('input[name=invoice]').val(data.company);
fp.find('input[name=contractno]').val(data.contractno);
fp.find('input[name=address]').val(data.address);
fp.find('select[name=repairerid]').val(data.repairerid);
Object.keys(data.faci).forEach(function(k){
str += '<option value="'+data.faci[k]+'">'+data.faci[k]+'</option>';
});
fp.find('input[name=facilityno]').removeAttr("required");
fp.find('input[name=facilityno]').hide();
fp.find('select[name=facilityno]').append(str);
fp.find('select[name=facilityno]').prop('required',true);
fp.find('select[name=facilityno]').show();
}
xhr.open('POST', 'pricereview_contractno-api.php', true);
xhr.send(formdata);
}
xhr.open('POST','pricereview_contractno-api.php',true);
xhr.send(formdata);
}
}
function dataFormat() {
var amtAll = 0;
$("input[name='item_price_bp']").each(function(){
amtAll += Number($(this).val().replace(/[,]+/g,""));
});
var tax = Math.round(amtAll*0.05);
$('#sales_tax').val(commafy(tax));
$('#total_price').val(commafy(amtAll+tax));
}
function dataFormat() {
var amtAll = 0;
$("input[name='item_price_bp']").each(function() {
amtAll += Number($(this).val().replace(/[,]+/g, ""));
});
function cacl(o) {
var fp = o.parent().parent();
fp.find('input[name=item_price_bp]').val(commafy(fp.find('input[name=item_unit_price]').val().replace(/[,]+/g,"")*o.val().replace(/[,]+/g,"")));
dataFormat();
}
var service = Number($("input[name='service_charge']").val().replace(/[,]+/g, ""));
var tax = Math.round(amtAll * 0.05);
$('#sales_tax').val(commafy(tax));
$('#total_price').val(commafy(amtAll + tax + service));
}
function cacl(o) {
console.log(o.parent().parent());
var fp = o.parent().parent();
fp.find('input[name=item_price_bp]').val(commafy(fp.find('input[name=item_unit_price]').val().replace(/[,]+/g, "") * o.val().replace(/[,]+/g, "")));
dataFormat();
}
$(function(){
//$('#assign_status').change(function() {
$(function() {
//$('#assign_status').change(function() {
$("#next_users").empty();
//var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態
var _option_tmp = ""; //獲取下拉列表
@ -224,117 +241,140 @@ $(function(){
_option_tmp += '<option value="M0086">M0086-李烘銘</option>';
_option_tmp += '<option value="M0137">M0137-劉永德</option>';
$("#next_users").append(_option_tmp);
//});
$('#table_index2').DataTable({
"language": {
"zeroRecords": "沒有符合的結果",
"search": "查詢",
},
"searching": true,
"pageLength": 300,
});
$('#table_index2_length').hide();
$("#table_index2_paginate").hide();
/*$("#repair_no").prop("disabled", true);
$("#sales_tax").prop("disabled", true);
$("#total_price").prop("disabled", true);
*/
$("select[name=facilityno]").hide();
$("select[name=facilityno]").removeAttr("required");
$("input[name=item_unit_price], input[name=item_price_bp]").each(function(){
//$(this).prop("disabled", true);
});
$('#query').click(function(){
getCont($(this));
});
$('#btnadd').click(function(){
$('#tb1 tr:last').prev().prev().after($("tr[name='main_templ']").last().clone().find('input').val('').end());
$('#tb1 tr:last').prev().prev().find('td a[name=item_href]').html('點選');
});
$('#tb1').on('click', 'a[name=btndel]', function(){
if ($('tr[name=main_templ]').length > 1) {
$(this).closest('tr').remove();
dataFormat();
}
});
// 關閉modal時
$("#itemModal").on("hidden.bs.modal", function() {
$('#table_index2_filter input').val(''); // 清空search
$('#table_index2_filter input').keyup(); // 恢復search前狀態
});
$('#tb1').on('focus', 'tr[name=main_templ] a[name=item_href]', function(){
$("#itemModal").modal('show');
var jobj = $(this); // 父視窗
$("#itemModal .modal-body td").unbind().click(function(){
var pobj = $(this).closest('td').parent();
var jTitle = pobj.find('td').eq(1).html();
var re = /主龬索 調速機/;
var found = jTitle.match(re);
//console.log(found);return;
jobj.html(jTitle);
jobj.closest('td').parent().find('input[name=item_qty]').val('');
jobj.closest('td').parent().find('input[name=item_unit_price]').val('');
jobj.closest('td').parent().find('input[name=item_memo]').val('');
jobj.closest('td').parent().find('input[name=item_price_bp]').val('');
jobj.closest('td').parent().find('input[name=item_unit_price]').val(pobj.find('td').eq(4).html());
jobj.closest('td').parent().find('input[name=supplies_id]').val(pobj.find('td').eq(0).html());
jobj.closest('td').parent().find('input[name=item_title_txt]').val(jTitle);
$("#itemModal").modal('hide');
//});
$('#table_index2').DataTable({
"language": {
"zeroRecords": "沒有符合的結果",
"search": "查詢",
},
"searching": true,
"pageLength": 300,
});
});
$('#tb1').on('click', 'input[name=item_qty]', function(){
$(this).unbind().keyup(function(){
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
cacl($(this));
$('#table_index2_length').hide();
$("#table_index2_paginate").hide();
/*$("#repair_no").prop("disabled", true);
$("#sales_tax").prop("disabled", true);
$("#total_price").prop("disabled", true);
*/
$("select[name=facilityno]").hide();
$("select[name=facilityno]").removeAttr("required");
$("input[name=item_unit_price], input[name=item_price_bp]").each(function() {
//$(this).prop("disabled", true);
});
$('#query').click(function() {
getCont($(this));
});
$('#btnadd').click(function() {
// console.log('123');
$('#tb1 tr:last').prev().prev().prev().after($("tr[name='main_templ']").last().clone().find('input').val('').end());
$('#tb1 tr:last').prev().prev().prev().find('td a[name=item_href]').html('點選');
});
$('#tb1').on('click', 'a[name=btndel]', function() {
if ($('tr[name=main_templ]').length > 1) {
$(this).closest('tr').remove();
dataFormat();
}
});
// 關閉modal時
$("#itemModal").on("hidden.bs.modal", function() {
$('#table_index2_filter input').val(''); // 清空search
$('#table_index2_filter input').keyup(); // 恢復search前狀態
});
$('#tb1').on('focus', 'tr[name=main_templ] a[name=item_href]', function() {
$("#itemModal").modal('show');
var jobj = $(this); // 父視窗
$("#itemModal .modal-body td").unbind().click(function() {
var pobj = $(this).closest('td').parent();
var jTitle = pobj.find('td').eq(1).html();
var re = /主龬索 調速機/;
var found = jTitle.match(re);
//console.log(found);return;
jobj.html(jTitle);
jobj.closest('td').parent().find('input[name=item_qty]').val('');
jobj.closest('td').parent().find('input[name=item_unit_price]').val('');
jobj.closest('td').parent().find('input[name=item_memo]').val('');
jobj.closest('td').parent().find('input[name=item_price_bp]').val('');
jobj.closest('td').parent().find('input[name=item_unit_price]').val(pobj.find('td').eq(4).html());
jobj.closest('td').parent().find('input[name=supplies_id]').val(pobj.find('td').eq(0).html());
jobj.closest('td').parent().find('input[name=item_title_txt]').val(jTitle);
$("#itemModal").modal('hide');
});
});
$('#tb1').on('click', 'input[name=item_qty]', function() {
// console.log(this);
$(this).unbind().keyup(function() {
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
cacl($(this));
});
});
// 服務費 ++
$('#tb1').on('click', 'input[name=service_charge]', function() {
// console.log(this);
$(this).unbind().keyup(function() {
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
dataFormat();
// cacl($(this));
});
});
$('input[name=submit]').click(function() {
var itemTitleArr = [];
$("input[name=item_title_txt]").each(function() {
if ($(this).val() != '') itemTitleArr.push($(this).val());
})
$('#item_title_all').val(itemTitleArr);
var itemQtyArr = [];
$("input[name=item_qty]").each(function() {
if ($(this).val() != '') itemQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_qty_all').val(itemQtyArr);
var itemUnitPriceArr = [];
$("input[name=item_unit_price]").each(function() {
if ($(this).val() != '') itemUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_unit_price_all').val(itemUnitPriceArr);
var itemPriceBpArr = [];
$("input[name=item_price_bp]").each(function() {
if ($(this).val() != '') itemPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_bp_all').val(itemPriceBpArr);
var itemMemoArr = [];
$("input[name=item_memo]").each(function() {
if ($(this).val() != '') itemMemoArr.push($(this).val() + "@@");
})
$('#item_memo_all').val(itemMemoArr);
if ($("#sales_tax").val() == "" || $("#total_price").val() == "") {
alert("請新增報價項目!");
return false;
}
});
});
$('input[name=submit]').click(function(){
var itemTitleArr = [];
$("input[name=item_title_txt]").each(function(){ if ($(this).val() != '') itemTitleArr.push($(this).val()); })
$('#item_title_all').val(itemTitleArr);
var itemQtyArr = [];
$("input[name=item_qty]").each(function(){ if ($(this).val() != '') itemQtyArr.push($(this).val().replace(/[,]+/g,"")); })
$('#item_qty_all').val(itemQtyArr);
var itemUnitPriceArr = [];
$("input[name=item_unit_price]").each(function(){ if ($(this).val() != '') itemUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); })
$('#item_unit_price_all').val(itemUnitPriceArr);
var itemPriceBpArr = [];
$("input[name=item_price_bp]").each(function(){ if ($(this).val() != '') itemPriceBpArr.push($(this).val().replace(/[,]+/g,"")); })
$('#item_price_bp_all').val(itemPriceBpArr);
var itemMemoArr = [];
$("input[name=item_memo]").each(function(){ if ($(this).val() != '') itemMemoArr.push($(this).val()+"@@"); })
$('#item_memo_all').val(itemMemoArr);
if ($("#sales_tax").val() == "" || $("#total_price").val() == "") {
alert("請新增報價項目!");
return false;
}
});
});
</script>
<!--子窗:備品項目-->
<div class="modal fade" id="itemModal" tabindex="-1" role="dialog" aria-labelledby="itemModalTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="itemModalTitle">供應商備品備料</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<?php echo $item_str; ?>
</div>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="itemModalTitle">供應商備品備料</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<?php echo $item_str; ?>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<?php
include "pricereview_repair-record-submit.php";
/*
<?php
include "pricereview_repair-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>";
@ -343,8 +383,8 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
}
}
*/
?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data">
?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data">
<div>
<label for="contractno">客戶合約號<span class="star">*</span></label>
<input type="text" name="contractno" id="contractno" required>
@ -369,7 +409,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<option value=""></option>
<?php
foreach ($maddr_arr as $k => $v) {
echo "<option value=\"".$k."\">".$v."</option>";
echo "<option value=\"" . $k . "\">" . $v . "</option>";
}
?>
</select>
@ -404,7 +444,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<option value=""></option>
<?php
foreach ($repairer_arr as $k => $v) {
echo "<option value=\"".$k."\">".$v."</option>";
echo "<option value=\"" . $k . "\">" . $v . "</option>";
}
?>
</select>
@ -457,14 +497,27 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</td>
</tr>
<tr>
<td colspan="3"><h5>營業稅</h5></td>
<td colspan="3">
<h5>服務費</h5>
</td>
<td>
<input type="text" name="service_charge" id="service_charge" class="dollar-right" size="8">
</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3">
<h5>營業稅</h5>
</td>
<td>
<input type="text" name="sales_tax" id="sales_tax" class="dollar-right" size="8" readonly>
</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3"><h5>總價</h5></td>
<td colspan="3">
<h5>總價</h5>
</td>
<td>
<input type="text" name="total_price" id="total_price" class="dollar-right" size="8" readonly>
</td>
@ -496,7 +549,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<select name="next_users" id="next_users" class="form-control form-control-sm" required></select>
</td>
<td>
<input type="submit" name="submit" id="submit" value="提交">
<input type="submit" name="submit" id="submit" value="提交">
</td>
</tr>
</tbody>

23
wms/mkt/pricereview_repair-record-submit.php

@ -1,11 +1,15 @@
<?php
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
// exit();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//print_r($_POST);exit;
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v)));
}
$sales_tax = str_replace(",", "", $sales_tax);
$service_charge = str_replace(",", "", $service_charge);
$total_price = str_replace(",", "", $total_price);
$item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@"));
$create_at = date("Y-m-d H:i:s");
@ -16,15 +20,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_row($res);
if (empty($row[0])) $serial = "001";
else $serial = str_pad(substr($row[0]+1, -3), 3, 0, STR_PAD_LEFT);
$new_repair_no = $repair_no_a.$serial;
else $serial = str_pad(substr($row[0] + 1, -3), 3, 0, STR_PAD_LEFT);
$new_repair_no = $repair_no_a . $serial;
if ($new_repair_no != $repair_no) $repair_no = $new_repair_no;
// 價審單-主文 pricereview_repair_main
$db_query = "insert into pricereview_repair_main(repair_no, contractno, masada_addr, company, taxid, invoice, facilityno, ";
$db_query .= "address, sales_tax, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at) values (";
$db_query = "INSERT INTO pricereview_repair_main(repair_no, contractno, masada_addr, company, taxid, invoice, facilityno, ";
$db_query .= "address, sales_tax, service_charge, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at) values (";
$db_query .= "'$repair_no', '$contractno', '$masada_addr', '$company', '$taxid', '$invoice', '$facilityno', ";
$db_query .= "'$address', $sales_tax, $total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at')";
$db_query .= "'$address', $sales_tax ,$service_charge ,$total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at')";
$result = mysqli_query($link, $db_query);
$affected = mysqli_affected_rows($link);
if ($rid = mysqli_insert_id($link)) {
@ -36,7 +40,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$item_price_bp_arr = explode(",", $item_price_bp_all);
$item_memo_arr = explode("@@,", rtrim($item_memo_all, "@@"));
$item_no = 1;
for ($i=0; $i<count($item_title_arr); $i++) {
for ($i = 0; $i < count($item_title_arr); $i++) {
$item_qty_arr[$i] = str_replace(",", "", $item_qty_arr[$i]);
$item_unit_price_arr[$i] = str_replace(",", "", $item_unit_price_arr[$i]);
$item_price_bp_arr[$i] = str_replace(",", "", $item_price_bp_arr[$i]);
@ -66,13 +70,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($affected > 0) {
echo "<script type = 'text/JavaScript'>";
echo "alert('提交成功');";
echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&".$token_link."';";
echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&" . $token_link . "';";
echo "</script>";
} else {
echo "<script type = 'text/JavaScript'>";
echo "alert('提交失敗,請重新操作');";
echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&".$token_link."';";
echo "location.href='pricereview_repair-index.php?function_name=pricereview_repair&" . $token_link . "';";
echo "</script>";
}
}
?>

19
wms/sign/list.php

@ -1,4 +1,6 @@
<?php
// phpinfo();
// exit();
error_reporting(E_ALL);
ini_set("display_errors", "on");
/**
@ -18,19 +20,19 @@ $where_system_id = " and a.system_id like '" . $system_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
$sql_get = "select c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner,
$sql_get = "SELECT c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner,
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name ,
flow_name,c.update_date ,c.create_date,b.path,d.flow_code from system_main a,flow_main b ,subflow
flow_name,c.update_date ,c.create_date,b.path,d.flow_code FROM system_main a,flow_main b ,subflow
c,flow d
where a.system_id=b.system_id
and b.flow_id=d.flow_id
and c.current_assigner='$user_id'
and d.flow_id=b.flow_id
and c.form_key=d.form_key
WHERE a.system_id=b.system_id
AND b.flow_id=d.flow_id
AND c.current_assigner='$user_id'
AND d.flow_id=b.flow_id
AND c.form_key=d.form_key
$where_system_id
$where_flow_id
";
//echo $sql_get;
echo $sql_get;
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
$system_name_opt = array_map(function ($item) {
@ -84,7 +86,6 @@ $flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
table.query-table th {
text-align: right;
}
</style>
<form method='post' action='#'>
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'>

24
wms/sign/sign_form.php

@ -220,12 +220,12 @@ function base_url($url)
<thead>
<tr class="no-border">
<th colspan="12">
<h4> 测试表单</h4>
<h4> 測試表單</h4>
</th>
</tr>
<tr class="no-border">
<th colspan="12">
<span style="float: left"><b>单流水号:</b><?php echo $form_key ?></span>
<span style="float: left"><b>單流水號:</b><?php echo $form_key ?></span>
<span style="float: right">
<b>申请日期:</b> <?php echo date('Y-m-d', time()); ?>
</span>
@ -237,19 +237,19 @@ function base_url($url)
</thead>
<tbody>
<tr>
<th>请单号</th>
<th>請單號</th>
<td colspan="3"><?php echo $form_key ?></td>
<th></th>
<th></th>
<td colspan="3"></td>
<th></th>
<th></th>
<td colspan="3"></td>
</tr>
<tr>
<th>请假开始日期</th>
<th>請假開始日期</th>
<td colspan="3"></td>
<th> 请假结束日期</th>
<th> 請假結束日期</th>
<td colspan="3"></td>
<th>请假时数</th>
<th>請假時數</th>
<td colspan="3"></td>
</tr>
</tbody>
@ -287,7 +287,7 @@ function base_url($url)
<table id="assign_area" class="form-content-table ">
<thead>
<tr>
<th colspan="12"><b>核操作 </b></th>
<th colspan="12"><b>核操作 </b></th>
</tr>
</thead>
<tbody>
@ -316,13 +316,13 @@ function base_url($url)
}
?>
<tr>
<th> 签核状态</th>
<th> 簽核狀態</th>
<td colspan="2">
<select name="assign_status" id="assign_status">
<?php echo $assign_status; ?>
</select>
</td>
<th class="td_title" colspan="2"> 下位核者</th>
<th class="td_title" colspan="2"> 下位核者</th>
<td colspan="7">
<select name="next_users" id="next_users">
</select>
@ -337,7 +337,7 @@ function base_url($url)
<div id="opinion_area" class="form-content-table" style='margin-top:10px'>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" data-toggle="tab">签核意见</a>
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" data-toggle="tab">簽核意見</a>
</li>
<li role="presentation">
<a href="#subflow_assign" aria-controls="subflow_assign" role="tab" data-toggle="tab">会签单位意见</a>

Loading…
Cancel
Save