Browse Source

契約價審

main
Cheng 1 year ago
parent
commit
e3e2bc642d
  1. 14
      wms/crm/crmm05-edit.php
  2. 3
      wms/crm/crmm06-edit.php
  3. 8
      wms/crm/crmm06_submit.php
  4. 3
      wms/crm/model/HopeContractCustomerModel.php
  5. 1
      wms/crm/model/Model.php
  6. 28
      wms/fun_global.php
  7. 2
      workflow/lib/DB.php
  8. 6
      workflow/model/Subflow.php
  9. 30
      workflow/model/SubflowManager.php

14
wms/crm/crmm05-edit.php

@ -19,7 +19,7 @@ $customer_source_opt = DB::result($sql);
$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 w";
$sql = "select employee_no value ,name label from employee where depart_no in ('511','512','513','514','515','314')";
$salesman_opt = DB::result($sql);
#5.有望客戶狀態
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'";
@ -38,7 +38,7 @@ $open_kind_opt = DB::result($sql);
$table_hope_contract_customer = 'hope_contract_customer';
$hope_contract_customer_column = [
'vol_no' => ['label' => "卷號", "tag" => 'text', 'attr' => ['required','readonly', "value" => "$vol_no", 'class' => 'form-control form-control-sm']],
'vol_no' => ['label' => "卷號", "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']],
@ -46,7 +46,7 @@ $hope_contract_customer_column = [
//'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']],
'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']],
@ -172,10 +172,6 @@ function base_url($url)
$("#form").validate();
});
</script>
</head>
@ -244,9 +240,7 @@ function base_url($url)
</div>
<div class="col-12 " style="padding:0">
<textarea class='form-control textarea' id="progress_status"
name="progress_status" value='<?= $hope_contract_customer[0]['progress_status']?>'
rows='6'><?= $hope_contract_customer[0]['progress_status']?></textarea>
<textarea class='form-control textarea' id="progress_status" name="progress_status" value='<?= $hope_contract_customer[0]['progress_status'] ?>' rows='6'><?= $hope_contract_customer[0]['progress_status'] ?></textarea>
</div>
</div>

3
wms/crm/crmm06-edit.php

@ -60,8 +60,7 @@ $hope_contract_customer_column = [
'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],
// 'is_renovation' => ['label' => "是否汰改", "tag" => 'select', 'attr' => ['required', 'class' => ' form-control form-control-sm'], 'options' => $is_renovation_opt],
];
$data = [
'salesman' => $user_id

8
wms/crm/crmm06_submit.php

@ -6,13 +6,15 @@ $request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST;
$hecm = new HopeContractCustomerModel();
$cols = $hecm->fillable;
foreach ($cols as $col) {
if (!in_array($col, array_keys($request))) {
continue;
}
$data[$col] = empty($request[$col]) ? NULL : $request[$col];
}
$hecm->create( $data);
echo"<script>alert('已保存');</script>";
header("Location:"."https://www.masada.com.tw/wms/crm/crmm02-index.php?token=".$request['token']);
$hecm->create($data);
echo "<script>alert('已保存');</script>";
header("Location:" . "https://www.masada.com.tw/wms/crm/crmm02-index.php?token=" . $request['token']);

3
wms/crm/model/HopeContractCustomerModel.php

@ -30,5 +30,6 @@ class HopeContractCustomerModel extends Model
'speed',
'completed_date',
'creater_name',
'creater'];
'creater'
];
}

1
wms/crm/model/Model.php

@ -15,6 +15,7 @@ class Model
foreach ($this->fillable as $col) {
$_data[$col] = empty($data[$col]) ? '' : $data[$col];
}
DB::insert_table($this->table, $_data);
}
/**

28
wms/fun_global.php

@ -89,6 +89,7 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee)
$sql = "select manager from account where accountid = '$user_id'";
$res = mysqli_query($link, $sql);
$i = 0;
while ($row = mysqli_fetch_assoc($res)) {
if ($row["manager"] == "M0001") return; // 董事長略過
if ($user_id == 'TEST01') {
@ -99,13 +100,30 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee)
return $ret;
exit;
} else {
if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) {
$ret[1] = $user_id . ",,";
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
}
return $ret;
exit();
}
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
$ret[1] = $row["manager"] . ",,";
if ($row["manager"] == 'M0029') {
$ret[1] = "M0147,,";
$i++;
pricereview_class($rate, $row["manager"], $ret, $special_fee);
} else {
if ($user_id == 'M0033' || $user_id == 'M0137' || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == 'M0086') {
$ret[1] = $user_id . ",,";
$ret[1] = $row["manager"] . ",,";
$i++;
pricereview_class($rate, $row["manager"], $ret, $special_fee);
}
} else {
// if ($user_id == 'M0033' || $user_id == 'M0137' || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == 'M0086') {
// $ret[1] = $user_id . ",,";
// }
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
@ -164,7 +182,9 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
return $ret;
}
function pricereview_maintainance_class($rate, $user_id, $renovate_flag)
{
}
/**
* 檢查使用者選單權限
*

2
workflow/lib/DB.php

@ -19,7 +19,7 @@ if (file_exists($envFile)) {
class DB
{
private static $ds = array(
'default' => array('host' => '127.0.0.1', 'db_name' => 'appwms', 'user' => 'masadaroot', 'pwd' => '')
'default' => array('host' => '127.0.0.1', 'db_name' => 'appwms', 'user' => 'masadaroot', 'pwd' => 'x6h5E5p#u8y')
);
public static $instance;
/**

6
workflow/model/Subflow.php

@ -51,7 +51,6 @@ class Subflow
DB::update_table("subflow", array(
"current_assigner" => $userId,
), $where);
}
/**
@ -119,7 +118,6 @@ class Subflow
list($real_id) = DB::fields("SELECT real_id
FROM subflow where form_key ='$formKey'");
return $real_id;
}
/**
@ -128,7 +126,7 @@ class Subflow
*/
public function insert()
{
list($cnt) = DB::fields("select count(*) from subflow where from_key='" . $this->form_key . "' ");
list($cnt) = DB::fields("select count(*) from subflow where form_key='" . $this->form_key . "' ");
if ($cnt == 0) {
DB::insert_table("subflow", array(
"form_key" => $this->form_key,
@ -139,7 +137,6 @@ class Subflow
return 1;
}
return -1;
}
public function __toString()
@ -147,4 +144,3 @@ class Subflow
return json_encode($this);
}
}

30
workflow/model/SubflowManager.php

@ -29,7 +29,6 @@ class SubflowManager
$detail = DB::result("select * from workflow_subflow where
seq='" . $seq . "' and parent_key ='" . $parentKey . "'");
return $detail;
}
/**
@ -47,7 +46,6 @@ class SubflowManager
'" . $subflow->current_assigner . "',
now(),
'" . $sender . "' ) ");
}
static function getChildNode($childFormKey)
@ -162,7 +160,6 @@ class SubflowManager
DB::update_table("workflow_subflow", array(
"REPLY_FLAG" => "'" . $flag . "'"
), $where);
}
/**
@ -184,7 +181,6 @@ class SubflowManager
}
}
return $cnt;
}
/**
@ -204,7 +200,6 @@ class SubflowManager
}
}
return $cnt;
}
public static function updateReplyComment($formKey, $comment)
@ -226,10 +221,26 @@ class SubflowManager
public static function getCounterSignComments($parentKey)
{
$sql = "select rownum seq ,seq CS_SEQ ,LEADER_NO ASSIGNER,reply_comment ASSIGN_OPINION ,change_date ASSIGN_DATE , LEAD_CODE,
f_return_content('lead_code',LEAD_CODE) POSITION_NAME,case Reply_flag when 'Y' then 'F1'
when 'N' then 'Y1' else 'A4' end ASSIGN_STATUS,'' FLOW_CODE from workflow_subflow a,employee b
where parent_key='" . $parentKey . "' and a.leader_no=b.employee_no";
$sql = "SELECT
rownum AS seq,
seq AS CS_SEQ,
LEADER_NO AS ASSIGNER,
reply_comment AS ASSIGN_OPINION,
change_date AS ASSIGN_DATE,
LEAD_CODE,
f_return_content('lead_code', LEAD_CODE) AS POSITION_NAME,
CASE Reply_flag
WHEN 'Y' THEN 'F1'
WHEN 'N' THEN 'Y1'
ELSE 'A4'
END AS ASSIGN_STATUS,
'' AS FLOW_CODE
FROM
workflow_subflow a,
employee b
WHERE
parent_key = '" . $parentKey . "' AND
a.leader_no = b.employee_no;";
return DB::result($sql);
}
@ -238,5 +249,4 @@ class SubflowManager
$sql = "update workflow_subflow set change_date=sysdate where form_key='" . $formKey . "'";
DB::query($sql);
}
}
Loading…
Cancel
Save