6 changed files with 491 additions and 419 deletions
@ -0,0 +1,42 @@ |
|||
<?php |
|||
$envFile = __DIR__ . '/.env'; // .env 文件的路径 |
|||
|
|||
if (file_exists($envFile)) { |
|||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|||
if ($lines !== false) { |
|||
foreach ($lines as $line) { |
|||
list($key, $value) = explode('=', $line, 2); |
|||
$key = trim($key); |
|||
$value = trim($value); |
|||
// 设置环境变量 |
|||
putenv("$key=$value"); |
|||
} |
|||
} |
|||
} |
|||
$db_hostname = getenv('DB_HOST'); //資料庫主機名稱 |
|||
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號 |
|||
$db_password = getenv('DB_PASSWORD'); //登入密碼 |
|||
$db_name = getenv('DB_DATABASE'); //使用的資料庫 |
|||
$db_charset = 'utf8'; //設定字元編碼 |
|||
|
|||
//建立PDO的指定工作 |
|||
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset"; |
|||
|
|||
try { |
|||
//使用PDO連接到MySQL資料庫,建立PDO物件 |
|||
$conn = new PDO($dsn, $db_username, $db_password); |
|||
|
|||
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException) |
|||
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定 |
|||
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊 |
|||
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 |
|||
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 |
|||
//設定主動以警告的形式報錯 |
|||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|||
//如果連接錯誤,將抛出一個PDOException異常對象 |
|||
} catch (PDOException $e) { |
|||
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 |
|||
die("ERROR!!!: " . $e->getMessage()); |
|||
} |
|||
|
|||
//$conn = null; //關閉資料庫的連線 |
@ -1,180 +1,196 @@ |
|||
<?php |
|||
require_once "../header.php"; |
|||
// 載入db.php來連結資料庫 |
|||
|
|||
#錶 |
|||
$table = 'hope_contract_customer'; |
|||
#可編輯的列 |
|||
$editableColumn = [ |
|||
'vol_no' => "卷號", |
|||
'customer_no' => "客戶編號", |
|||
'customer' => "客戶名稱", |
|||
'manager' => "負責人", |
|||
'source' => "客戶來源", |
|||
'linkman' => "聯係人", |
|||
'lm_tel' => "手機", |
|||
'salesman' => "營業員", |
|||
'num' => "数量", |
|||
'pre_order_date' => "預定成交日", |
|||
'status' => "有望客戶狀態", |
|||
'next_visit_date' => "下次拜訪時間", |
|||
'brand' => "廠牌", |
|||
'quote_date' => "報價日期", |
|||
'created_at' => "建立時間", |
|||
|
|||
]; |
|||
|
|||
// 可瀏覽全部資料的部門 |
|||
$depart_arr = ["501"]; |
|||
$sql = "SELECT department_id FROM account WHERE accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$vol_no = empty($_GET['vol_no']) ? "%" : $_GET['vol_no']; |
|||
$where = " and vol_no like '$vol_no'"; |
|||
$salesman = empty($_GET['salesman']) ? "%" : $_GET['salesman']; |
|||
$where .= " and salesman like '$salesman'"; |
|||
$lm_name = empty($_GET['linkman']) ? "%" : $_GET['linkman']; |
|||
$where .= " and linkman like '$lm_name'"; |
|||
$sql_cmd = sql_myself($user_id, "salesman"); |
|||
if (in_array($user_department_id, $depart_arr) || $user_id == "M0060" || $user_id == "M0149" || $user_id =="M0189") $sql_cmd = ""; // M0060:Max,鄭伊岑 |
|||
if (!empty($sql_cmd)) $where .= " and " . str_replace("where", "", $sql_cmd); |
|||
|
|||
$sql = "SELECT vol_no,customer,manager,f_return_content('customer_source',source ) source, |
|||
linkman,lm_tel,f_return_name(salesman) salesman,num ,date_format(pre_order_date,'%Y/%m/%d') pre_order_date, |
|||
f_return_content('hope_customer_status',status ) status, date_format(next_visit_date,'%Y/%m/%d') next_visit_date ,brand , |
|||
date_format(quote_date,'%Y/%m/%d') quote_date, created_at FROM $table where 1=1 $where ORDER BY vol_no"; |
|||
|
|||
$data = mysqli_query($link, $sql); |
|||
|
|||
// echo '<pre>'; |
|||
// print_r($sql); |
|||
// echo '</pre>'; |
|||
?> |
|||
<style> |
|||
#table_index2 { |
|||
table-layout: fixed; |
|||
/*width: 100%;*/ |
|||
display: inline-block; |
|||
} |
|||
|
|||
.col-sm-12 { |
|||
width: auto; |
|||
} |
|||
|
|||
.pagination { |
|||
margin: 0; |
|||
} |
|||
</style> |
|||
<script> |
|||
$(function() { |
|||
$('#table_index2').DataTable({ |
|||
order: [ |
|||
[14, 'desc'] |
|||
] |
|||
}); |
|||
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋"; |
|||
}); |
|||
</script> |
|||
<?php |
|||
|
|||
if ($data) : |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) { |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:repair-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
<link rel="stylesheet" href="common.css"> |
|||
|
|||
<div style="overflow-x:auto; white-space:nowrap;"> |
|||
<form method='get' action='#'> |
|||
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
|||
<thead> |
|||
<tr> |
|||
<td colspan="8"> |
|||
<h3 style='text-align:center'>有望客戶(契約)資料維護</h3> |
|||
</td> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<th style='width:50px'>卷號</th> |
|||
<td><input type="text" class='form-control' name='vol_no'></td> |
|||
<th>營業員</th> |
|||
<td><input type="text" class='form-control' name='salesman'></td> |
|||
<th>下單地區</th> |
|||
<td><input type="text" class='form-control' name='order_province'></td> |
|||
<th>聯係人姓名</th> |
|||
<td><input type="text" class='form-control' name='lm_name'></td> |
|||
<input type="hidden" name="token" value='<?= $_GET['token'] ?>'> |
|||
</tr> |
|||
</tbody> |
|||
<tfoot> |
|||
<tr> |
|||
<td colspan="8" style='text-align:center'> |
|||
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-info btn-sm">查詢</button> |
|||
<a href="crmm06-edit.php?<?= $token_link ?>" class="btn btn-info btn-sm">新增</a> |
|||
</td> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
<table id="table_index" class="table table-striped table-bordered"> |
|||
<thead> |
|||
<?php |
|||
echo "<tr>"; |
|||
foreach ($editableColumn as $key => $val) { |
|||
echo "<th>$val</th>"; |
|||
} |
|||
echo "<th>編輯</th>"; |
|||
// echo "<th>刪除</th>"; |
|||
echo "</tr>"; |
|||
?> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach ($data as $row) : ?> |
|||
<tr> |
|||
<?php |
|||
foreach ($editableColumn as $key => $val) { |
|||
echo "<td>" . (!empty($row[$key]) ? $row[$key] : '') . "</td>"; |
|||
} |
|||
?> |
|||
<td> |
|||
<p> |
|||
<a href="crmm05-edit.php?function_name=customer&<?= $token_link ?>&vol_no=<?php echo $row['vol_no']; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
|
|||
<a href="../cont/apply_form.php?<?= $token_link ?>&vol_no=<?php echo $row['vol_no']; ?>" class="btn btn-info btn-sm"> |
|||
轉價審 |
|||
</a> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else : |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代錶結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "../footer.php"; |
|||
|
|||
<?php |
|||
require_once "../header.php"; |
|||
// 載入db.php來連結資料庫 |
|||
|
|||
#錶 |
|||
$table = 'hope_contract_customer'; |
|||
#可編輯的列 |
|||
$editableColumn = [ |
|||
'vol_no' => "卷號", |
|||
'customer_no' => "客戶編號", |
|||
'customer' => "客戶名稱", |
|||
'manager' => "負責人", |
|||
'source' => "客戶來源", |
|||
'linkman' => "聯係人", |
|||
'lm_tel' => "手機", |
|||
'salesman' => "營業員", |
|||
'num' => "数量", |
|||
'pre_order_date' => "預定成交日", |
|||
'status' => "有望客戶狀態", |
|||
'next_visit_date' => "下次拜訪時間", |
|||
'brand' => "廠牌", |
|||
'quote_date' => "報價日期", |
|||
'created_at' => "建立時間", |
|||
|
|||
]; |
|||
|
|||
// 可瀏覽全部資料的部門 |
|||
$depart_arr = ["501"]; |
|||
$sql = "SELECT department_id FROM account WHERE accountid = '$user_id'"; |
|||
$res = mysqli_query($link, $sql); |
|||
$row = mysqli_fetch_row($res); |
|||
$user_department_id = $row[0]; |
|||
mysqli_free_result($res); |
|||
|
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
// sql語法存在變數中 |
|||
$vol_no = empty($_GET['vol_no']) ? "%" : $_GET['vol_no']; |
|||
$where = " and vol_no like '$vol_no'"; |
|||
$salesman = empty($_GET['salesman']) ? "%" : $_GET['salesman']; |
|||
$where .= " and salesman like '$salesman'"; |
|||
$lm_name = empty($_GET['linkman']) ? "%" : $_GET['linkman']; |
|||
$where .= " and linkman like '$lm_name'"; |
|||
$sql_cmd = sql_myself($user_id, "salesman"); |
|||
if (in_array($user_department_id, $depart_arr) || $user_id == "M0060" || $user_id == "M0149" || $user_id == "M0189") $sql_cmd = ""; // M0060:Max,鄭伊岑 |
|||
if (!empty($sql_cmd)) $where .= " and " . str_replace("where", "", $sql_cmd); |
|||
|
|||
$sql = "SELECT vol_no,customer,manager,salesman,f_return_content('customer_source',source ) source, |
|||
linkman,lm_tel,f_return_name(salesman) salesman,num ,date_format(pre_order_date,'%Y/%m/%d') pre_order_date, |
|||
f_return_content('hope_customer_status',status ) status, date_format(next_visit_date,'%Y/%m/%d') next_visit_date ,brand , |
|||
date_format(quote_date,'%Y/%m/%d') quote_date, created_at FROM $table where 1=1 $where ORDER BY vol_no"; |
|||
|
|||
$data = mysqli_query($link, $sql); |
|||
|
|||
// echo '<pre>'; |
|||
// print_r($sql); |
|||
// echo '</pre>'; |
|||
|
|||
// echo '<pre>'; |
|||
// print_r($data); |
|||
// echo '</pre>'; |
|||
|
|||
// $sql = "SELECT * FROM hope_contract_customer WHERE 1=1 $where"; |
|||
// $result = mysqli_query($link, $sql); |
|||
// echo '<pre>'; |
|||
// print_r($result); |
|||
// echo '</pre>'; |
|||
// echo $data['salesman']; |
|||
?> |
|||
<style> |
|||
#table_index2 { |
|||
table-layout: fixed; |
|||
/*width: 100%;*/ |
|||
display: inline-block; |
|||
} |
|||
|
|||
.col-sm-12 { |
|||
width: auto; |
|||
} |
|||
|
|||
.pagination { |
|||
margin: 0; |
|||
} |
|||
</style> |
|||
<script> |
|||
$(function() { |
|||
$('#table_index2').DataTable({ |
|||
order: [ |
|||
[14, 'desc'] |
|||
] |
|||
}); |
|||
document.querySelector("#table_index2_filter > label > input").placeholder = "快速搜尋"; |
|||
}); |
|||
</script> |
|||
<?php |
|||
|
|||
if ($data) : |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|||
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) { |
|||
echo "<p class='error'>Please fill up the required field!</p>"; |
|||
} else { |
|||
header("Location:repair-index.php"); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
<link rel="stylesheet" href="common.css"> |
|||
|
|||
<div style="overflow-x:auto; white-space:nowrap;"> |
|||
<form method='get' action='#'> |
|||
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
|||
<thead> |
|||
<tr> |
|||
<td colspan="8"> |
|||
<h3 style='text-align:center'>有望客戶(契約)資料維護</h3> |
|||
</td> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<th style='width:50px'>卷號</th> |
|||
<td><input type="text" class='form-control' name='vol_no'></td> |
|||
<th>營業員</th> |
|||
<td><input type="text" class='form-control' name='salesman'></td> |
|||
<th>下單地區</th> |
|||
<td><input type="text" class='form-control' name='order_province'></td> |
|||
<th>聯係人姓名</th> |
|||
<td><input type="text" class='form-control' name='lm_name'></td> |
|||
<input type="hidden" name="token" value='<?= $_GET['token'] ?>'> |
|||
</tr> |
|||
</tbody> |
|||
<tfoot> |
|||
<tr> |
|||
<td colspan="8" style='text-align:center'> |
|||
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-info btn-sm">查詢</button> |
|||
<a href="crmm06-edit.php?<?= $token_link ?>" class="btn btn-info btn-sm">新增</a> |
|||
</td> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
<table id="table_index" class="table table-striped table-bordered"> |
|||
<thead> |
|||
<?php |
|||
echo "<tr>"; |
|||
foreach ($editableColumn as $key => $val) { |
|||
echo "<th>$val</th>"; |
|||
} |
|||
echo "<th>編輯</th>"; |
|||
// echo "<th>刪除</th>"; |
|||
echo "</tr>"; |
|||
?> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach ($data as $row) : ?> |
|||
|
|||
<tr> |
|||
<?php |
|||
foreach ($editableColumn as $key => $val) { |
|||
// echo '<pre>'; |
|||
// print_r($row['salesman']); |
|||
// echo '</pre>'; |
|||
echo "<td>" . (!empty($row[$key]) ? $row[$key] : '') . "</td>"; |
|||
} |
|||
?> |
|||
<td> |
|||
<p> |
|||
<a href="crmm05-edit.php?function_name=customer&<?= $token_link ?>&vol_no=<?php echo $row['vol_no']; ?>" class="btn btn-info btn-sm"> |
|||
<span class="glyphicon glyphicon-pencil"></span> |
|||
</a> |
|||
<?php if ($user_name === $row['salesman']) : ?> |
|||
<a href="../cont/apply_form.php?<?= $token_link ?>&vol_no=<?php echo $row['vol_no']; ?>" class="btn btn-info btn-sm"> |
|||
轉價審 |
|||
</a> |
|||
<?php endif ?> |
|||
</p> |
|||
</td> |
|||
</tr> |
|||
<?php endforeach; ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<?php |
|||
|
|||
else : |
|||
echo "<h2>There is no record!</h2>"; |
|||
endif; |
|||
|
|||
#代錶結束連線 |
|||
mysqli_close($link); |
|||
|
|||
include "../footer.php"; |
|||
|
|||
?> |
@ -1,224 +1,228 @@ |
|||
<?php |
|||
error_reporting(E_ALL); |
|||
ini_set("display_errors", "On"); |
|||
|
|||
require_once './FormHelper.php'; |
|||
require_once './wf_common.php'; |
|||
|
|||
|
|||
//錶單數據 |
|||
#客戶錶 |
|||
#1.電梯品牌選項 |
|||
$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by convert(content using gbk) asc "; |
|||
$elevator_brand_opt = DB::result($sql); |
|||
#2.客戶來源 |
|||
$sql = "select code_name value ,content label from code where field_name='customer_source'"; |
|||
$customer_source_opt = DB::result($sql); |
|||
#3.電梯類型 |
|||
$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; |
|||
$elevator_kind_opt = DB::result($sql); |
|||
#4.營業員 |
|||
$sql = "select employee_no value ,name label from employee where depart_no in ('511','512','513','514')"; |
|||
$salesman_opt = DB::result($sql); |
|||
#5.有望客戶狀態 |
|||
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'"; |
|||
$hope_customer_status_opt = DB::result($sql); |
|||
#6.是否改造 |
|||
$is_renovation_opt = [ |
|||
['label' => '是', 'value' => 'Y'], |
|||
['label' => '否', 'value' => 'N'], |
|||
|
|||
]; |
|||
#7.开门方式 |
|||
$sql = "select code_name value ,content label from code where field_name='open_kind'"; |
|||
$open_kind_opt = DB::result($sql); |
|||
#生成新梯卷号 |
|||
$vol_no = get_sequnece_no('qy_vol_no', date('ym')); |
|||
|
|||
#抓取有望客戶資料 |
|||
$table_hope_contract_customer = 'hope_contract_customer'; |
|||
|
|||
$hope_contract_customer_column = [ |
|||
'vol_no' => ['label' => "卷號(B)", "tag" => 'text', 'attr' => ['required','readonly', "value" => "$vol_no", 'class' => 'form-control form-control-sm']], |
|||
//'form_key' => ['label' => "錶單號","tag" => 'text', 'attr'=>['class' => 'form-control form-control-sm' ]], |
|||
'customer' => ['label' => "客戶名稱", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|||
'manager' => ['label' => "負責人", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'source' => ['label' => "客戶來源", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $customer_source_opt], |
|||
//'linkman' => ['label' => "聯係人", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|||
'lm_tel' => ['label' => "手機", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'salesman' => ['label' => "營業員", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $salesman_opt], |
|||
'num' => ['label' => "数量", "tag" => 'number', 'attr' => ['min=1','class' => 'form-control form-control-sm']], |
|||
'address' => ['label' => "地址", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm']], |
|||
// 'case_name' => ['label' => "现场名称", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm']], |
|||
'floors' => ['label' => '樓層', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'persons' => ['label' => '人乘', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'speed' => ['label' => '速度', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'completed_date' => ['label' => '竣工(民國年)', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'pre_order_date' => ['label' => "預定成交日", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], |
|||
'status' => ['label' => "有望客戶狀態", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $hope_customer_status_opt], |
|||
'next_visit_date' => ['label' => "下次拜訪時間", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], |
|||
// 'brand' => ['label' => "廠牌", "tag" => 'select', 'attr' => ['required', 'class' => ' form-control form-control-sm '], 'options' => $elevator_brand_opt], |
|||
'quote_date' => ['label' => "報價日期", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], |
|||
// 'is_renovation' => ['label' => "是否汰改", "tag" => 'select', 'attr' => ['required','class' => ' form-control form-control-sm'], 'options' => $is_renovation_opt], |
|||
|
|||
]; |
|||
|
|||
|
|||
$where = " and vol_no='$vol_no'"; |
|||
|
|||
$sql = " SELECT vol_no,customer,manager,source, |
|||
linkman,lm_tel,salesman,num,address,floors,persons,speed,completed_date, |
|||
date_format(pre_order_date,'%Y-%m-%d') pre_order_date, |
|||
status, date_format(next_visit_date,'%Y-%m-%d') next_visit_date ,brand , |
|||
date_format(quote_date,'%Y-%m-%d') quote_date ,is_renovation FROM $table_hope_contract_customer where 1=1 $where "; |
|||
$hope_contract_customer = DB::result($sql); |
|||
|
|||
|
|||
|
|||
function base_url($url) |
|||
{ |
|||
return "https://www.masada.com.tw/static/" . $url; |
|||
} |
|||
|
|||
#生成卷号 |
|||
function get_sequnece_no($seq_name = '', $p_yyyymm = '') |
|||
{ |
|||
|
|||
if (empty($p_yyyymm) || empty($seq_name)) return null; |
|||
#當前年月 |
|||
|
|||
//echo "select yyyymm from sequence where seq_name='$seq_name' "; |
|||
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); |
|||
if ($p_yyyymm != $yyyymm) { |
|||
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); |
|||
} |
|||
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; |
|||
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); |
|||
// echo "SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "; |
|||
|
|||
return $seq_no; |
|||
} |
|||
?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html> |
|||
|
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF8" /> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<title>有望客戶新增</title> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|||
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script> |
|||
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" /> |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function() { |
|||
|
|||
|
|||
// $('#cmecTbody').append(cmecRow); |
|||
$('.sp_element_box').attr("disabled", true); |
|||
$("#assign_opinion").cleditor({ |
|||
height: 100, // height not including margins, borders or padding |
|||
controls: // controls to add to the toolbar |
|||
"bold italic underline strikethrough subscript superscript | font size " + |
|||
"style | color highlight removeformat | bullets numbering | outdent " + |
|||
"indent | alignleft center alignright justify | undo redo | " |
|||
}); |
|||
|
|||
$("#form").validate(); |
|||
|
|||
}); |
|||
</script> |
|||
|
|||
</head> |
|||
|
|||
<body> |
|||
<div id="toolbarmenu"> |
|||
<ul class="nav nav-tabs" role="tablist" id="tablist"> |
|||
<li class=" nav-item "> |
|||
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">申请單</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
<div class="tab-content "> |
|||
<div class="tab-pane active assign_content " id="tabassign"> |
|||
<form action="crmm06_submit.php" id='form' method="post" style='width:98%;margin:0 auto'> |
|||
<!-- hidden域 --> |
|||
<input type='hidden' name='vol_no' value='<?= $vol_no ?>'> |
|||
<input type='hidden' name='token' value='<?= $_GET['token'] ?>' /> |
|||
|
|||
<!--錶單start--> |
|||
<div class=" form container-fluid pt-5"> |
|||
<div class="row form_head "> |
|||
<div class=" col-12 form_head_title "> |
|||
<h4> 有望客戶(契约)</h4> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row " style='padding-top:30px;'> |
|||
<div class=" col-lg-12 form_row_header "> |
|||
<b>有望客戶資料</b> |
|||
</div> |
|||
</div> |
|||
|
|||
<?php |
|||
//一行顯示三列 |
|||
$i = 0; |
|||
echo " <div class='row '>"; |
|||
foreach ($hope_contract_customer_column as $key => $val) { |
|||
$j = (($i++) % 4); |
|||
$fieldVal = empty($hope_contract_customer) ? "" : $hope_contract_customer[0][$key]; |
|||
|
|||
$_input = $val['tag'] == 'select' ? |
|||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) |
|||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|||
if ($i != 1 && $j == 0) { |
|||
echo " |
|||
</div> |
|||
<div class='row'> |
|||
"; |
|||
} |
|||
echo " <div class='col-1 form_field_title'> |
|||
" . $val['label'] . " |
|||
</div> |
|||
<div class=' col-2 form_field_content ' > |
|||
$_input |
|||
</div> |
|||
"; |
|||
} |
|||
echo "</div>"; |
|||
|
|||
?> |
|||
|
|||
<div id="assign_area " class="row "> |
|||
<div class="col-12 form_row_header "> |
|||
<b>洽商進度</b> |
|||
</div> |
|||
<div class="col-12 " style="padding:0"> |
|||
|
|||
<textarea class='form-control textarea' id="progress_status" name="progress_status" value='' rows='6'></textarea> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button> |
|||
</div> |
|||
|
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
|
|||
<?php |
|||
error_reporting(E_ALL); |
|||
ini_set("display_errors", "On"); |
|||
require_once '../header_nomenu.php'; |
|||
|
|||
require_once './FormHelper.php'; |
|||
require_once './wf_common.php'; |
|||
|
|||
|
|||
//錶單數據 |
|||
#客戶錶 |
|||
#1.電梯品牌選項 |
|||
$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by convert(content using gbk) asc "; |
|||
$elevator_brand_opt = DB::result($sql); |
|||
#2.客戶來源 |
|||
$sql = "select code_name value ,content label from code where field_name='customer_source'"; |
|||
$customer_source_opt = DB::result($sql); |
|||
#3.電梯類型 |
|||
$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; |
|||
$elevator_kind_opt = DB::result($sql); |
|||
#4.營業員 |
|||
$sql = "select employee_no value ,name label from employee where depart_no in ('511','512','513','514')"; |
|||
$salesman_opt = DB::result($sql); |
|||
#5.有望客戶狀態 |
|||
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'"; |
|||
$hope_customer_status_opt = DB::result($sql); |
|||
#6.是否改造 |
|||
$is_renovation_opt = [ |
|||
['label' => '是', 'value' => 'Y'], |
|||
['label' => '否', 'value' => 'N'], |
|||
|
|||
]; |
|||
#7.开门方式 |
|||
$sql = "select code_name value ,content label from code where field_name='open_kind'"; |
|||
$open_kind_opt = DB::result($sql); |
|||
#生成新梯卷号 |
|||
$vol_no = get_sequnece_no('qy_vol_no', date('ym')); |
|||
|
|||
#抓取有望客戶資料 |
|||
$table_hope_contract_customer = 'hope_contract_customer'; |
|||
|
|||
$hope_contract_customer_column = [ |
|||
'vol_no' => ['label' => "卷號(B)", "tag" => 'text', 'attr' => ['required', 'readonly', "value" => "$vol_no", 'class' => 'form-control form-control-sm']], |
|||
//'form_key' => ['label' => "錶單號","tag" => 'text', 'attr'=>['class' => 'form-control form-control-sm' ]], |
|||
'customer' => ['label' => "客戶名稱", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|||
'manager' => ['label' => "負責人", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'source' => ['label' => "客戶來源", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $customer_source_opt], |
|||
//'linkman' => ['label' => "聯係人", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|||
'lm_tel' => ['label' => "手機", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'salesman' => ['label' => "營業員", "tag" => 'select', 'attr' => ["value" => "$user_id", 'class' => 'form-control form-control-sm'], 'options' => $salesman_opt], |
|||
'num' => ['label' => "数量", "tag" => 'number', 'attr' => ['min=1', 'class' => 'form-control form-control-sm']], |
|||
'address' => ['label' => "地址", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm']], |
|||
// 'case_name' => ['label' => "现场名称", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm']], |
|||
'floors' => ['label' => '樓層', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'persons' => ['label' => '人乘', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'speed' => ['label' => '速度', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'completed_date' => ['label' => '竣工(民國年)', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|||
'pre_order_date' => ['label' => "預定成交日", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], |
|||
'status' => ['label' => "有望客戶狀態", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $hope_customer_status_opt], |
|||
'next_visit_date' => ['label' => "下次拜訪時間", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], |
|||
// 'brand' => ['label' => "廠牌", "tag" => 'select', 'attr' => ['required', 'class' => ' form-control form-control-sm '], 'options' => $elevator_brand_opt], |
|||
'quote_date' => ['label' => "報價日期", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], |
|||
// 'is_renovation' => ['label' => "是否汰改", "tag" => 'select', 'attr' => ['required','class' => ' form-control form-control-sm'], 'options' => $is_renovation_opt], |
|||
|
|||
]; |
|||
$data = [ |
|||
'salesman' => $user_id |
|||
]; |
|||
|
|||
$where = " and vol_no='$vol_no'"; |
|||
|
|||
$sql = " SELECT vol_no,customer,manager,source, |
|||
linkman,lm_tel,salesman,num,address,floors,persons,speed,completed_date, |
|||
date_format(pre_order_date,'%Y-%m-%d') pre_order_date, |
|||
status, date_format(next_visit_date,'%Y-%m-%d') next_visit_date ,brand , |
|||
date_format(quote_date,'%Y-%m-%d') quote_date ,is_renovation FROM $table_hope_contract_customer where 1=1 $where "; |
|||
$hope_contract_customer = DB::result($sql); |
|||
|
|||
|
|||
|
|||
function base_url($url) |
|||
{ |
|||
return "https://www.masada.com.tw/static/" . $url; |
|||
} |
|||
|
|||
#生成卷号 |
|||
function get_sequnece_no($seq_name = '', $p_yyyymm = '') |
|||
{ |
|||
|
|||
if (empty($p_yyyymm) || empty($seq_name)) return null; |
|||
#當前年月 |
|||
|
|||
//echo "select yyyymm from sequence where seq_name='$seq_name' "; |
|||
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); |
|||
if ($p_yyyymm != $yyyymm) { |
|||
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); |
|||
} |
|||
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; |
|||
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); |
|||
// echo "SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "; |
|||
|
|||
return $seq_no; |
|||
} |
|||
?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html> |
|||
|
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF8" /> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<title>有望客戶新增</title> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|||
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script> |
|||
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script> |
|||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" /> |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function() { |
|||
|
|||
|
|||
// $('#cmecTbody').append(cmecRow); |
|||
$('.sp_element_box').attr("disabled", true); |
|||
$("#assign_opinion").cleditor({ |
|||
height: 100, // height not including margins, borders or padding |
|||
controls: // controls to add to the toolbar |
|||
"bold italic underline strikethrough subscript superscript | font size " + |
|||
"style | color highlight removeformat | bullets numbering | outdent " + |
|||
"indent | alignleft center alignright justify | undo redo | " |
|||
}); |
|||
|
|||
$("#form").validate(); |
|||
|
|||
}); |
|||
</script> |
|||
|
|||
</head> |
|||
|
|||
<body> |
|||
<div id="toolbarmenu"> |
|||
<ul class="nav nav-tabs" role="tablist" id="tablist"> |
|||
<li class=" nav-item "> |
|||
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">申请單</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
<div class="tab-content "> |
|||
<div class="tab-pane active assign_content " id="tabassign"> |
|||
<form action="crmm06_submit.php" id='form' method="post" style='width:98%;margin:0 auto'> |
|||
<!-- hidden域 --> |
|||
<input type='hidden' name='vol_no' value='<?= $vol_no ?>'> |
|||
<input type='hidden' name='token' value='<?= $_GET['token'] ?>' /> |
|||
|
|||
<!--錶單start--> |
|||
<div class=" form container-fluid pt-5"> |
|||
<div class="row form_head "> |
|||
<div class=" col-12 form_head_title "> |
|||
<h4> 有望客戶(契约)</h4> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="row " style='padding-top:30px;'> |
|||
<div class=" col-lg-12 form_row_header "> |
|||
<b>有望客戶資料</b> |
|||
</div> |
|||
</div> |
|||
|
|||
<?php |
|||
//一行顯示三列 |
|||
$i = 0; |
|||
echo " <div class='row '>"; |
|||
foreach ($hope_contract_customer_column as $key => $val) { |
|||
$j = (($i++) % 4); |
|||
$fieldVal = (empty($data) or !array_key_exists($key, $data)) ? "" : $data[$key]; |
|||
// $fieldVal = empty($hope_contract_customer) ? "" : $hope_contract_customer[0][$key]; |
|||
|
|||
$_input = $val['tag'] == 'select' ? |
|||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) |
|||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|||
if ($i != 1 && $j == 0) { |
|||
echo " |
|||
</div> |
|||
<div class='row'> |
|||
"; |
|||
} |
|||
echo " <div class='col-1 form_field_title'> |
|||
" . $val['label'] . " |
|||
</div> |
|||
<div class=' col-2 form_field_content ' > |
|||
$_input |
|||
</div> |
|||
"; |
|||
} |
|||
echo "</div>"; |
|||
|
|||
?> |
|||
|
|||
<div id="assign_area " class="row "> |
|||
<div class="col-12 form_row_header "> |
|||
<b>洽商進度</b> |
|||
</div> |
|||
<div class="col-12 " style="padding:0"> |
|||
|
|||
<textarea class='form-control textarea' id="progress_status" name="progress_status" value='' rows='6'></textarea> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button> |
|||
</div> |
|||
|
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
|
|||
</body> |
Loading…
Reference in new issue