diff --git a/wms/cont/apply_form.php b/wms/cont/apply_form.php index da57a1fa..1046d832 100644 --- a/wms/cont/apply_form.php +++ b/wms/cont/apply_form.php @@ -2,6 +2,8 @@ require_once '../header_nomenu.php'; require_once './FormHelper.php'; require_once './wf_common.php'; +// require_once('./conn.php'); + $vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no']; @@ -25,11 +27,19 @@ $flow_id = 'con01'; $form_id = ""; #價審單狀態 $apply_st = ""; -list($apply_key, $form_key) = DB::fields("SELECT apply_key, form_key from con_maintance_examine_apply where vol_no='$vol_no' order by apply_key desc limit 0, 1"); +list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1"); +// echo '
';
+// print_r($apply_key);
+// echo '
'; +// exit; +// if ($salesman != $user_id) { +// echo ''; +// exit; +// } if (empty($apply_key)) $apply_st = 1; // 準備新增 else { //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); - list($current_assigner) = DB::fields("select current_assigner from subflow where form_key = '$form_key' order by seq desc limit 0, 1"); + list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 else $apply_st = 9; // 已到下一關,無法䖺改 } diff --git a/wms/cont/apply_form1.php b/wms/cont/apply_form1.php index b965ba72..2e035859 100644 --- a/wms/cont/apply_form1.php +++ b/wms/cont/apply_form1.php @@ -27,13 +27,13 @@ $form_id = ""; $apply_st = ""; list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1"); // echo '
';
-// print_r($apply_key);
+// print_r($salesman);
 // echo '
'; // exit; -// if ($salesman != $user_id) { -// echo ''; -// exit; -// } +if ($salesman != $user_id) { + echo ''; + exit; +} if (empty($apply_key)) $apply_st = 1; // 準備新增 else { //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); diff --git a/wms/cont/conn.php b/wms/cont/conn.php new file mode 100644 index 00000000..1476902e --- /dev/null +++ b/wms/cont/conn.php @@ -0,0 +1,42 @@ +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; //關閉資料庫的連線 \ No newline at end of file diff --git a/wms/crm/crmm02-index.php b/wms/crm/crmm02-index.php index 246dce97..a808b398 100644 --- a/wms/crm/crmm02-index.php +++ b/wms/crm/crmm02-index.php @@ -1,180 +1,196 @@ - "卷號", - '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 '
';
-// print_r($sql);
-// echo '
'; -?> - - -Please fill up the required field!

"; - } else { - header("Location:repair-index.php"); - } - } - -?> - - -
-
- - - - - - - - - - - - - - - - - - '> - - - - - - - -
-

有望客戶(契約)資料維護

-
卷號營業員下單地區聯係人姓名
- - 新增 -
- - - "; - foreach ($editableColumn as $key => $val) { - echo ""; - } - echo ""; - // echo ""; - echo ""; - ?> - - - - - $val) { - echo ""; - } - ?> - - - - -
$val編輯刪除
" . (!empty($row[$key]) ? $row[$key] : '') . " -

- - - - - - 轉價審 - -

-
-
- -There is no record!"; -endif; - -#代錶結束連線 -mysqli_close($link); - -include "../footer.php"; - + "卷號", + '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 '
';
+// print_r($sql);
+// echo '
'; + +// echo '
';
+// print_r($data);
+// echo '
'; + +// $sql = "SELECT * FROM hope_contract_customer WHERE 1=1 $where"; +// $result = mysqli_query($link, $sql); +// echo '
';
+// print_r($result);
+// echo '
'; +// echo $data['salesman']; +?> + + +Please fill up the required field!

"; + } else { + header("Location:repair-index.php"); + } + } + +?> + + +
+ + + + + + + + + + + + + + + + + + + '> + + + + + + + +
+

有望客戶(契約)資料維護

+
卷號營業員下單地區聯係人姓名
+ + 新增 +
+ + + "; + foreach ($editableColumn as $key => $val) { + echo ""; + } + echo ""; + // echo ""; + echo ""; + ?> + + + + + + $val) { + // echo '
';
+                                // print_r($row['salesman']);
+                                // echo '
'; + echo ""; + } + ?> + + + + +
$val編輯刪除
" . (!empty($row[$key]) ? $row[$key] : '') . " +

+ + + + + + 轉價審 + + +

+
+
+ +There is no record!"; +endif; + +#代錶結束連線 +mysqli_close($link); + +include "../footer.php"; + ?> \ No newline at end of file diff --git a/wms/crm/crmm06-edit.php b/wms/crm/crmm06-edit.php index 75d7bcb5..bcd24d29 100644 --- a/wms/crm/crmm06-edit.php +++ b/wms/crm/crmm06-edit.php @@ -1,224 +1,228 @@ - '是', '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; -} -?> - - - - - - - 有望客戶新增 - - - - - - - - - - - - - - - - - - - -
- -
-
-
- - - - ' /> - - -
-
-
-

有望客戶(契约)

-
-
- -
-
- 有望客戶資料 -
-
- - "; - 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 " -
-
- "; - } - echo "
- " . $val['label'] . " -
-
- $_input -
- "; - } - echo "
"; - - ?> - -
-
- 洽商進度 -
-
- - -
-
- - - -
- - - -
- - - - - + '是', '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; +} +?> + + + + + + + 有望客戶新增 + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + ' /> + + +
+
+
+

有望客戶(契约)

+
+
+ +
+
+ 有望客戶資料 +
+
+ + "; + 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 " +
+
+ "; + } + echo "
+ " . $val['label'] . " +
+
+ $_input +
+ "; + } + echo "
"; + + ?> + +
+
+ 洽商進度 +
+
+ + +
+
+ + + +
+ + + +
+ + + + + \ No newline at end of file diff --git a/wms/mkt/pricereview_repair-create.php b/wms/mkt/pricereview_repair-create.php index 185ebd09..16a5bf76 100644 --- a/wms/mkt/pricereview_repair-create.php +++ b/wms/mkt/pricereview_repair-create.php @@ -271,13 +271,13 @@ $assign_status = '' $('#tb1 tr:last').prev().prev().prev().find('td a[name=item_href]').html('點選'); }); // 點擊服務費會出現 or 消失 input 框 - $('#btnadd-sc').click(function() { - $('#service_charge_tr').toggle(); - // 若消失清空 input 的值 - $('#service_charge').val(''); - // 並且重新計算總價(total) - dataFormat(); - }); + // $('#btnadd-sc').click(function() { + // $('#service_charge_tr').toggle(); + // // 若消失清空 input 的值 + // $('#service_charge').val(''); + // // 並且重新計算總價(total) + // dataFormat(); + // }); $('#tb1').on('click', 'a[name=btndel]', function() { if ($('tr[name=main_templ]').length > 1) { $(this).closest('tr').remove(); @@ -471,7 +471,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ 新增備品 * - 服務費 + 名稱 @@ -505,12 +505,12 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ X - +
服務費
- +