Browse Source

契約價審

main
Cheng 1 year ago
parent
commit
e3e2bc642d
  1. 520
      wms/crm/crmm05-edit.php
  2. 5
      wms/crm/crmm06-edit.php
  3. 38
      wms/crm/crmm06_submit.php
  4. 69
      wms/crm/model/HopeContractCustomerModel.php
  5. 159
      wms/crm/model/Model.php
  6. 32
      wms/fun_global.php
  7. 2
      workflow/lib/DB.php
  8. 296
      workflow/model/Subflow.php
  9. 494
      workflow/model/SubflowManager.php

520
wms/crm/crmm05-edit.php

@ -1,264 +1,258 @@
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
ini_set("display_errors", "On"); ini_set("display_errors", "On");
require_once './FormHelper.php'; require_once './FormHelper.php';
require_once './wf_common.php'; require_once './wf_common.php';
$vol_no = $_GET['vol_no']; $vol_no = $_GET['vol_no'];
//錶單數據 //錶單數據
#客戶錶 #客戶錶
#1.電梯品牌選項 #1.電梯品牌選項
$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by convert(content using gbk) asc "; $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); $elevator_brand_opt = DB::result($sql);
#2.客戶來源 #2.客戶來源
$sql = "select code_name value ,content label from code where field_name='customer_source'"; $sql = "select code_name value ,content label from code where field_name='customer_source'";
$customer_source_opt = DB::result($sql); $customer_source_opt = DB::result($sql);
#3.電梯類型 #3.電梯類型
$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; $sql = "select code_name value ,content label from code where field_name='elevator_kind'";
$elevator_kind_opt = DB::result($sql); $elevator_kind_opt = DB::result($sql);
#4.營業員 #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); $salesman_opt = DB::result($sql);
#5.有望客戶狀態 #5.有望客戶狀態
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'"; $sql = "select code_name value ,content label from code where field_name='hope_customer_status'";
$hope_customer_status_opt = DB::result($sql); $hope_customer_status_opt = DB::result($sql);
#6.是否汰改 #6.是否汰改
$is_renovation_opt = [ $is_renovation_opt = [
['label' => '是', 'value' => 'Y'], ['label' => '是', 'value' => 'Y'],
['label' => '否', 'value' => 'N'], ['label' => '否', 'value' => 'N'],
]; ];
$sql = "select code_name value ,content label from code where field_name='open_kind'"; $sql = "select code_name value ,content label from code where field_name='open_kind'";
$open_kind_opt = DB::result($sql); $open_kind_opt = DB::result($sql);
#生成新梯卷號 #生成新梯卷號
#抓取有望客戶資料 #抓取有望客戶資料
$table_hope_contract_customer = 'hope_contract_customer'; $table_hope_contract_customer = 'hope_contract_customer';
$hope_contract_customer_column = [ $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' ]], //'form_key' => ['label' => "錶單號","tag" => 'text', 'attr'=>['class' => 'form-control form-control-sm' ]],
'customer' => ['label' => "客戶名稱", "tag" => 'text', 'attr' => ['required', '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']], '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], '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']], //'linkman' => ['label' => "聯係人", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
'lm_tel' => ['label' => "手機", "tag" => 'text', 'attr' => ['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], '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']], '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']], // 'case_name' => ['label' => "现场名称", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm']],
'floors' => ['label' => '樓層', 'tag' => 'text', 'attr' => ['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']], 'persons' => ['label' => '人乘', 'tag' => 'text', 'attr' => ['class' => 'form-control form-control-sm']],
'speed' => ['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']], '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']], '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], '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']], '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], // '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']], '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],
]; ];
$where = " and vol_no='$vol_no'"; $where = " and vol_no='$vol_no'";
$sql = " SELECT vol_no,customer,manager,source, $sql = " SELECT vol_no,customer,manager,source,
linkman,lm_tel,salesman,num,address,floors,persons,speed,completed_date, linkman,lm_tel,salesman,num,address,floors,persons,speed,completed_date,
date_format(pre_order_date,'%Y-%m-%d') pre_order_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 , status, date_format(next_visit_date,'%Y-%m-%d') next_visit_date ,brand ,
date_format(quote_date,'%Y-%m-%d') quote_date ,progress_status FROM $table_hope_contract_customer where 1=1 $where "; date_format(quote_date,'%Y-%m-%d') quote_date ,progress_status FROM $table_hope_contract_customer where 1=1 $where ";
$hope_contract_customer = DB::result($sql); $hope_contract_customer = DB::result($sql);
//var_dump($hope_elevator_customer ); //var_dump($hope_elevator_customer );
#電梯規格 契约客户不用输入下面的 #電梯規格 契约客户不用输入下面的
/* /*
$table_hope_project_elevator_spec = 'hope_project_elevator_spec'; $table_hope_project_elevator_spec = 'hope_project_elevator_spec';
$hope_project_elevator_spec_columm = [ $hope_project_elevator_spec_columm = [
'spec' => ['label' => "規格", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm']], 'spec' => ['label' => "規格", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm']],
'person' => ['label' => "人", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'person[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], 'person' => ['label' => "人", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'person[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt],
'weight' => ['label' => "載重(KG)", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'class' => 'form-control form-control-sm']], 'weight' => ['label' => "載重(KG)", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'class' => 'form-control form-control-sm']],
'stop' => ['label' => "停數", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], 'stop' => ['label' => "停數", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']],
'open' => ['label' => "開門方式", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'open[]', 'class' => 'form-control form-control-sm'],'options' => $open_kind_opt], 'open' => ['label' => "開門方式", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'open[]', 'class' => 'form-control form-control-sm'],'options' => $open_kind_opt],
'speed' => ['label' => "速度(m/s)", "tag" => 'number', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm']], 'speed' => ['label' => "速度(m/s)", "tag" => 'number', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm']],
'spec_num' => ['label' => "臺數", "tag" => 'number', 'attr' => ['name' => 'spec_num[]', 'class' => 'form-control form-control-sm']], 'spec_num' => ['label' => "臺數", "tag" => 'number', 'attr' => ['name' => 'spec_num[]', 'class' => 'form-control form-control-sm']],
'spec_price' => ['label' => "單價", "tag" => 'number', 'attr' => ['name' => 'spec_price[]', 'class' => 'form-control form-control-sm']], 'spec_price' => ['label' => "單價", "tag" => 'number', 'attr' => ['name' => 'spec_price[]', 'class' => 'form-control form-control-sm']],
]; ];
$sql = " SELECT * FROM $table_hope_project_elevator_spec where 1=1 $where "; $sql = " SELECT * FROM $table_hope_project_elevator_spec where 1=1 $where ";
$hope_project_elevator_spec = DB::result($sql); $hope_project_elevator_spec = DB::result($sql);
$i = 0; $i = 0;
$cmecRow = " <tr>"; $cmecRow = " <tr>";
foreach ($hope_project_elevator_spec_columm as $key => $val) { foreach ($hope_project_elevator_spec_columm as $key => $val) {
$fieldVal = ""; $fieldVal = "";
$_input = $val['tag'] == 'select' ? $_input = $val['tag'] == 'select' ?
FormHelper::select('', $val['options'], $fieldVal, $val['attr']) FormHelper::select('', $val['options'], $fieldVal, $val['attr'])
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>"; // : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>";
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>"; $cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>";
} }
$cmecRow .= "<td><button onClick='delCmecRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>"; $cmecRow .= "<td><button onClick='delCmecRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>";
*/ */
#電梯Option #電梯Option
/* /*
$table_hope_project_elevator_option = 'hope_project_elevator_option'; $table_hope_project_elevator_option = 'hope_project_elevator_option';
$hope_project_elevator_option_column = [ $hope_project_elevator_option_column = [
'option' => ['label' => "OPTION", "tag" => 'text', 'attr' => ['colspan' => 9, 'name' => 'option[]', 'class' => 'form-control form-control-sm']], 'option' => ['label' => "OPTION", "tag" => 'text', 'attr' => ['colspan' => 9, 'name' => 'option[]', 'class' => 'form-control form-control-sm']],
'option_num' => ['label' => "臺數", "tag" => 'number', 'attr' => ['name' => 'option_num[]', 'class' => 'form-control form-control-sm']], 'option_num' => ['label' => "臺數", "tag" => 'number', 'attr' => ['name' => 'option_num[]', 'class' => 'form-control form-control-sm']],
'option_price' => ['label' => "單價", "tag" => 'number', 'attr' => ['name' => 'option_price[]', 'class' => 'form-control form-control-sm']], 'option_price' => ['label' => "單價", "tag" => 'number', 'attr' => ['name' => 'option_price[]', 'class' => 'form-control form-control-sm']],
]; ];
$sql = " SELECT * FROM $table_hope_project_elevator_option where 1=1 $where "; $sql = " SELECT * FROM $table_hope_project_elevator_option where 1=1 $where ";
$hope_project_elevator_option = DB::result($sql); $hope_project_elevator_option = DB::result($sql);
$hpeoRow = " <tr>"; $hpeoRow = " <tr>";
foreach ($hope_project_elevator_option_column as $key => $val) { foreach ($hope_project_elevator_option_column as $key => $val) {
$fieldVal = ""; $fieldVal = "";
$_input = $val['tag'] == 'select' ? $_input = $val['tag'] == 'select' ?
FormHelper::select('', $val['options'], $fieldVal, $val['attr']) FormHelper::select('', $val['options'], $fieldVal, $val['attr'])
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>"; // : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>";
$hpeoRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>"; $hpeoRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>";
} }
$hpeoRow .= "<td><button onClick='delHpeoRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>"; $hpeoRow .= "<td><button onClick='delHpeoRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>";
*/ */
function base_url($url) function base_url($url)
{ {
return "https://www.masada.com.tw/static/" . $url; return "https://www.masada.com.tw/static/" . $url;
} }
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>有望客戶新增</title> <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('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('bootstrap4/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" />
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> <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/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('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('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/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/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 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/jquery.validate.min.js?' . rand(10, 100)); ?>"></script>
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script> <script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
// $('#cmecTbody').append(cmecRow); // $('#cmecTbody').append(cmecRow);
$('.sp_element_box').attr("disabled", true); $('.sp_element_box').attr("disabled", true);
$("#assign_opinion").cleditor({ $("#assign_opinion").cleditor({
height: 100, // height not including margins, borders or padding height: 100, // height not including margins, borders or padding
controls: // controls to add to the toolbar controls: // controls to add to the toolbar
"bold italic underline strikethrough subscript superscript | font size " + "bold italic underline strikethrough subscript superscript | font size " +
"style | color highlight removeformat | bullets numbering | outdent " + "style | color highlight removeformat | bullets numbering | outdent " +
"indent | alignleft center alignright justify | undo redo | " "indent | alignleft center alignright justify | undo redo | "
}); });
$("#form").validate(); $("#form").validate();
}); });
</script>
</head>
</script> <body>
<div id="toolbarmenu">
</head> <ul class="nav nav-tabs" role="tablist" id="tablist">
<li class=" nav-item ">
<body> <a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">申請單</a>
<div id="toolbarmenu"> </li>
<ul class="nav nav-tabs" role="tablist" id="tablist"> </ul>
<li class=" nav-item "> </div>
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">申請單</a> <div class="tab-content ">
</li> <div class="tab-pane active assign_content " id="tabassign">
</ul> <form action="crmm05_submit.php" id='form' method="post" style='width:98%;margin:0 auto'>
</div> <!-- hidden域 -->
<div class="tab-content "> <input type='hidden' name='vol_no' value='<?= $vol_no ?>'>
<div class="tab-pane active assign_content " id="tabassign"> <input type='hidden' name='token' value='<?= $_GET['token'] ?>' />
<form action="crmm05_submit.php" id='form' method="post" style='width:98%;margin:0 auto'>
<!-- hidden域 --> <!--錶單start-->
<input type='hidden' name='vol_no' value='<?= $vol_no ?>'> <div class=" form container-fluid pt-5">
<input type='hidden' name='token' value='<?= $_GET['token'] ?>' /> <div class="row form_head ">
<div class=" col-12 form_head_title ">
<!--錶單start--> <h4> 有望客戶(契約)訂正</h4>
<div class=" form container-fluid pt-5"> </div>
<div class="row form_head "> </div>
<div class=" col-12 form_head_title ">
<h4> 有望客戶(契約)訂正</h4> <div class="row " style='padding-top:30px;'>
</div> <div class=" col-lg-12 form_row_header ">
</div> <b>有望客戶資料</b>
</div>
<div class="row " style='padding-top:30px;'> </div>
<div class=" col-lg-12 form_row_header ">
<b>有望客戶資料</b> <?php
</div> //一行顯示三列
</div> $i = 0;
echo " <div class='row '>";
<?php foreach ($hope_contract_customer_column as $key => $val) {
//一行顯示三列 $j = (($i++) % 4);
$i = 0; $fieldVal = empty($hope_contract_customer) ? "" : $hope_contract_customer[0][$key];
echo " <div class='row '>";
foreach ($hope_contract_customer_column as $key => $val) { $_input = $val['tag'] == 'select' ?
$j = (($i++) % 4); FormHelper::select("$key", $val['options'], $fieldVal, $val['attr'])
$fieldVal = empty($hope_contract_customer) ? "" : $hope_contract_customer[0][$key]; : FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
if ($i != 1 && $j == 0) {
$_input = $val['tag'] == 'select' ? echo "
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) </div>
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); <div class='row'>
if ($i != 1 && $j == 0) { ";
echo " }
</div> echo " <div class='col-1 form_field_title'>
<div class='row'> " . $val['label'] . "
"; </div>
} <div class=' col-2 form_field_content ' >
echo " <div class='col-1 form_field_title'> $_input
" . $val['label'] . " </div>
</div> ";
<div class=' col-2 form_field_content ' > }
$_input echo "</div>";
</div>
"; ?>
}
echo "</div>"; <div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
?> <b>洽商進度</b>
</div>
<div id="assign_area " class="row "> <div class="col-12 " style="padding:0">
<div class="col-12 form_row_header ">
<b>洽商進度</b> <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>
<div class="col-12 " style="padding:0"> </div>
<textarea class='form-control textarea' id="progress_status" <button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button>
name="progress_status" value='<?= $hope_contract_customer[0]['progress_status']?>' </div>
rows='6'><?= $hope_contract_customer[0]['progress_status']?></textarea>
</div> </form>
</div>
</div>
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button>
</div>
</form> </div>
</div>
</div>
</body> </body>

5
wms/crm/crmm06-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'"; $sql = "select code_name value ,content label from code where field_name='elevator_kind'";
$elevator_kind_opt = DB::result($sql); $elevator_kind_opt = DB::result($sql);
#4.營業員 #4.營業員
$sql = "select employee_no value ,name label from employee where depart_no in ('511','512','513','514','515','314')"; $sql = "select employee_no value ,name label from employee where depart_no in ('511','512','513','514','515','314')";
$salesman_opt = DB::result($sql); $salesman_opt = DB::result($sql);
#5.有望客戶狀態 #5.有望客戶狀態
$sql = "select code_name value ,content label from code where field_name='hope_customer_status'"; $sql = "select code_name value ,content label from code where field_name='hope_customer_status'";
@ -60,8 +60,7 @@ $hope_contract_customer_column = [
'next_visit_date' => ['label' => "下次拜訪時間", "tag" => 'date', 'attr' => ['class' => 'date form-control form-control-sm']], '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], // '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']], '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 = [ $data = [
'salesman' => $user_id 'salesman' => $user_id

38
wms/crm/crmm06_submit.php

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

69
wms/crm/model/HopeContractCustomerModel.php

@ -1,34 +1,35 @@
<?php <?php
require_once 'Model.php'; require_once 'Model.php';
class HopeContractCustomerModel extends Model class HopeContractCustomerModel extends Model
{ {
protected $table = 'hope_contract_customer'; protected $table = 'hope_contract_customer';
public $fillable = [ public $fillable = [
'vol_no', 'vol_no',
'customer_no', 'customer_no',
'customer', 'customer',
'manager', 'manager',
'source', 'source',
'linkman', 'linkman',
'lm_tel', 'lm_tel',
'salesman_name', 'salesman_name',
'salesman', 'salesman',
'num', 'num',
'pre_order_date', 'pre_order_date',
'status', 'status',
'progress_status', 'progress_status',
'recently_status', 'recently_status',
'next_visit_date', 'next_visit_date',
'address', 'address',
'tel', 'tel',
'mail', 'mail',
'quote_date', 'quote_date',
'is_renovation', 'is_renovation',
'file', 'file',
'floors', 'floors',
'persons', 'persons',
'speed', 'speed',
'completed_date', 'completed_date',
'creater_name', 'creater_name',
'creater']; 'creater'
} ];
}

159
wms/crm/model/Model.php

@ -1,79 +1,80 @@
<?php <?php
class Model class Model
{ {
protected $table = ''; protected $table = '';
protected $fillable = []; protected $fillable = [];
/** /**
* 创建记录 * 创建记录
* *
* @param array $data * @param array $data
* @return void * @return void
*/ */
public function create(array $data) public function create(array $data)
{ {
$_data = []; $_data = [];
foreach ($this->fillable as $col) { foreach ($this->fillable as $col) {
$_data[$col] = empty($data[$col]) ? '' : $data[$col]; $_data[$col] = empty($data[$col]) ? '' : $data[$col];
} }
DB::insert_table($this->table, $_data);
} DB::insert_table($this->table, $_data);
/** }
* 创建或更新 /**
* * 创建或更新
* @return void *
*/ * @return void
public function createOrUpdate(array $keyCol, array $data) */
{ public function createOrUpdate(array $keyCol, array $data)
{
$where = ' 1=1 ';
foreach ($keyCol as $key => $col) { $where = ' 1=1 ';
$where .= " and " . $col[0] . " = '" . $col[1] . "'"; foreach ($keyCol as $key => $col) {
} $where .= " and " . $col[0] . " = '" . $col[1] . "'";
// echo "select count(*) from $this->table where $where "; }
// echo "select count(*) from $this->table where $where ";
list($cnt) = DB::fields(
"select count(*) from $this->table where $where " list($cnt) = DB::fields(
); "select count(*) from $this->table where $where "
if ($cnt == 0) { );
foreach ($keyCol as $key => $col) { if ($cnt == 0) {
$data[$col[0]] = $col[1]; foreach ($keyCol as $key => $col) {
} $data[$col[0]] = $col[1];
self::create($data); }
} else { self::create($data);
self::update($keyCol, $data); } else {
} self::update($keyCol, $data);
} }
public function delete(array $keyCol, array $data) }
{ public function delete(array $keyCol, array $data)
$where = ' 1=1 '; {
foreach ($keyCol as $key => $col) { $where = ' 1=1 ';
$where .= " and " . $col[0] . " = '" . $col[1] . "'"; foreach ($keyCol as $key => $col) {
} $where .= " and " . $col[0] . " = '" . $col[1] . "'";
// echo "delete from $this->table where $where "; }
DB::query( // echo "delete from $this->table where $where ";
"delete from $this->table where $where " DB::query(
); "delete from $this->table where $where "
} );
public function update(array $keyCol, array $data) }
{ public function update(array $keyCol, array $data)
$_data = []; {
foreach ($this->fillable as $col) { $_data = [];
if (in_array($col, array_keys($data))) $_data[$col] = empty($data[$col]) ? '' : $data[$col]; foreach ($this->fillable as $col) {
} if (in_array($col, array_keys($data))) $_data[$col] = empty($data[$col]) ? '' : $data[$col];
$where = ' 1=1 '; }
foreach ($keyCol as $key => $col) { $where = ' 1=1 ';
$where .= " and " . $col[0] . " = '" . $col[1] . "'"; foreach ($keyCol as $key => $col) {
} $where .= " and " . $col[0] . " = '" . $col[1] . "'";
DB::update_table($this->table, $_data, $where); }
} DB::update_table($this->table, $_data, $where);
/** }
* 获取记录 /**
* * 获取记录
* @param array $cond *
* @return void * @param array $cond
*/ * @return void
public function get(array $cond) */
{ public function get(array $cond)
return []; {
} return [];
} }
}

32
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'"; $sql = "select manager from account where accountid = '$user_id'";
$res = mysqli_query($link, $sql); $res = mysqli_query($link, $sql);
$i = 0;
while ($row = mysqli_fetch_assoc($res)) { while ($row = mysqli_fetch_assoc($res)) {
if ($row["manager"] == "M0001") return; // 董事長略過 if ($row["manager"] == "M0001") return; // 董事長略過
if ($user_id == 'TEST01') { if ($user_id == 'TEST01') {
@ -99,13 +100,30 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee)
return $ret; return $ret;
exit; exit;
} else { } 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") { if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
$ret[1] = $row["manager"] . ",,"; if ($row["manager"] == 'M0029') {
pricereview_class($rate, $row["manager"], $ret, $special_fee); $ret[1] = "M0147,,";
} else { $i++;
if ($user_id == 'M0033' || $user_id == 'M0137' || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == 'M0086') { pricereview_class($rate, $row["manager"], $ret, $special_fee);
$ret[1] = $user_id . ",,"; } else {
$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[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理 $ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) { if ($rate < 80 || $special_fee > 0) {
@ -164,7 +182,9 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
return $ret; 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 class DB
{ {
private static $ds = array( 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; public static $instance;
/** /**

296
workflow/model/Subflow.php

@ -1,150 +1,146 @@
<?php <?php
class Subflow class Subflow
{ {
private $form_key; private $form_key;
private $seq = 0; private $seq = 0;
public $current_assigner; public $current_assigner;
private $real_id; private $real_id;
private $receive_date; private $receive_date;
private $pre_finish_date; private $pre_finish_date;
#会签 状态 S0001 #会签 状态 S0001
const SUSPEND_STATE = "S0001"; const SUSPEND_STATE = "S0001";
public function __construct(Flow $flow) public function __construct(Flow $flow)
{ {
if ($flow->getFormKey() == null) { if ($flow->getFormKey() == null) {
$this->form_key = Flow::getNewFormKey(); $this->form_key = Flow::getNewFormKey();
} else { } else {
$this->form_key = $flow->getFormKey(); $this->form_key = $flow->getFormKey();
} }
} }
function getFormKey() function getFormKey()
{ {
return $this->form_key; return $this->form_key;
} }
public static function delete($formKey = null) public static function delete($formKey = null)
{ {
DB::query("DELETE subflow WHERE Form_Key = '" . $formKey . "'"); DB::query("DELETE subflow WHERE Form_Key = '" . $formKey . "'");
} }
/** /**
* @param $userId * @param $userId
* @return $this * @return $this
*/ */
public function setCurrentUser($userId) public function setCurrentUser($userId)
{ {
$this->current_assigner = $userId; $this->current_assigner = $userId;
return $this; return $this;
} }
/** /**
*变更当前签核人员 *变更当前签核人员
* @param $formKey * @param $formKey
* @param $userId * @param $userId
*/ */
public static function updateCurrentUser($formKey, $userId) public static function updateCurrentUser($formKey, $userId)
{ {
$where = "form_key = '" . $formKey . "'";; $where = "form_key = '" . $formKey . "'";;
DB::update_table("subflow", array( DB::update_table("subflow", array(
"current_assigner" => $userId, "current_assigner" => $userId,
), $where); ), $where);
}
}
/**
/** * 获取当前签核者
* 获取当前签核者 * @param $formKey
* @param $formKey * @return userId
* @return userId */
*/ public static function getCurrentUser($formKey)
public static function getCurrentUser($formKey) {
{ list($currentAssigner) = DB::fields("SELECT current_assigner
list($currentAssigner) = DB::fields("SELECT current_assigner FROM subflow where form_key ='$formKey'");
FROM subflow where form_key ='$formKey'");
return $currentAssigner;
return $currentAssigner; }
}
/***
/*** *
* *关闭签核
*关闭签核 * @param null $formKey
* @param null $formKey */
*/ public static function close($formKey = null)
public static function close($formKey = null) {
{ $where = "form_key = '" . $formKey . "'";;
$where = "form_key = '" . $formKey . "'";; DB::update_table("subflow", array(
DB::update_table("subflow", array( "current_assigner" => '00000'
"current_assigner" => '00000' ), $where);
), $where); }
}
/**
/** *
* * @param null $formKey
* @param null $formKey */
*/ public static function suspend($formKey = null)
public static function suspend($formKey = null) {
{
self::updateRealId($formKey, self::getCurrentUser($formKey));
self::updateRealId($formKey, self::getCurrentUser($formKey)); $where = "form_key = '" . $formKey . "'";
$where = "form_key = '" . $formKey . "'"; DB::update_table("subflow", array(
DB::update_table("subflow", array( "current_assigner" => self::SUSPEND_STATE,
"current_assigner" => self::SUSPEND_STATE,
), $where);
), $where); }
}
/**
/** *
* * @param $formKey
* @param $formKey * @param $userId
* @param $userId */
*/ public static function updateRealId($formKey, $userId)
public static function updateRealId($formKey, $userId) {
{ $where = "form_key = '" . $formKey . "'";;
$where = "form_key = '" . $formKey . "'";; DB::update_table("subflow", array(
DB::update_table("subflow", array( "real_id" => $userId,
"real_id" => $userId, ), $where);
), $where); }
}
/**
/** *
* * @param $formKey
* @param $formKey * @param $userId
* @param $userId * @return
* @return */
*/ public static function getRealId($formKey)
public static function getRealId($formKey) {
{ list($real_id) = DB::fields("SELECT real_id
list($real_id) = DB::fields("SELECT real_id FROM subflow where form_key ='$formKey'");
FROM subflow where form_key ='$formKey'"); return $real_id;
return $real_id; }
} /**
* 插入记录
/** * @return int
* 插入记录 */
* @return int public function insert()
*/ {
public function insert() list($cnt) = DB::fields("select count(*) from subflow where form_key='" . $this->form_key . "' ");
{ if ($cnt == 0) {
list($cnt) = DB::fields("select count(*) from subflow where from_key='" . $this->form_key . "' "); DB::insert_table("subflow", array(
if ($cnt == 0) { "form_key" => $this->form_key,
DB::insert_table("subflow", array( "seq" => $this->seq + 1,
"form_key" => $this->form_key, "current_assigner" => $this->current_assigner,
"seq" => $this->seq + 1, "real_id" => $this->real_id
"current_assigner" => $this->current_assigner, ));
"real_id" => $this->real_id return 1;
)); }
return 1; return -1;
} }
return -1;
public function __toString()
} {
return json_encode($this);
public function __toString() }
{ }
return json_encode($this);
}
}

494
workflow/model/SubflowManager.php

@ -1,242 +1,252 @@
<?php <?php
/*** /***
* Class SubflowManager * Class SubflowManager
* @desc 对workflow_sublow 新增查询操作 * @desc 对workflow_sublow 新增查询操作
* @date 2018年8月5日11:42:58 * @date 2018年8月5日11:42:58
* @author u73376@yuntay.com.cn * @author u73376@yuntay.com.cn
*/ */
class SubflowManager class SubflowManager
{ {
private $parent_key; private $parent_key;
private $seq = 0; private $seq = 0;
public function __construct(Flow $parentFlow = null) public function __construct(Flow $parentFlow = null)
{ {
if (!empty($parentFlow)) { if (!empty($parentFlow)) {
$this->parent_key = $parentFlow->getFormKey(); $this->parent_key = $parentFlow->getFormKey();
} }
$this->seq = $this->_getSeq(); $this->seq = $this->_getSeq();
} }
public function __toString() public function __toString()
{ {
return json_encode($this); return json_encode($this);
} }
public static function getDetail($parentKey, $seq = 0) public static function getDetail($parentKey, $seq = 0)
{ {
$detail = DB::result("select * from workflow_subflow where $detail = DB::result("select * from workflow_subflow where
seq='" . $seq . "' and parent_key ='" . $parentKey . "'"); seq='" . $seq . "' and parent_key ='" . $parentKey . "'");
return $detail; return $detail;
}
}
/**
/** * @desc workflow_sublow 新增一条记录
* @desc workflow_sublow 新增一条记录 * @param Subflow $subflow
* @param Subflow $subflow * @param $sender
* @param $sender * @param int $seq
* @param int $seq */
*/ public function append(Subflow $subflow, $sender, $seq = null)
public function append(Subflow $subflow, $sender, $seq = null) {
{ DB::query("insert into workflow_subflow (FORM_KEY, SEQ, PARENT_KEY, LEADER_NO, CREATE_DATE, SENDER)
DB::query("insert into workflow_subflow (FORM_KEY, SEQ, PARENT_KEY, LEADER_NO, CREATE_DATE, SENDER) values ('" . $subflow->getFormKey() . "',
values ('" . $subflow->getFormKey() . "', '" . $this->seq . "',
'" . $this->seq . "', '" . $this->parent_key . "',
'" . $this->parent_key . "', '" . $subflow->current_assigner . "',
'" . $subflow->current_assigner . "', now(),
now(), '" . $sender . "' ) ");
'" . $sender . "' ) "); }
} static function getChildNode($childFormKey)
{
static function getChildNode($childFormKey)
{
$node = DB::result("select * from workflow_subflow where form_key
='" . $childFormKey . "'");
$node = DB::result("select * from workflow_subflow where form_key return $node[0];
='" . $childFormKey . "'"); }
return $node[0];
} /**
* 未回复统计
/** * @return integer|null
* 未回复统计 */
* @return integer|null public function getUnReplyCount($seq = null)
*/ {
public function getUnReplyCount($seq = null) if ($seq == null) {
{ return null;
if ($seq == null) { }
return null; list($cnt) = DB::fields("select count(*) from workflow_subflow where
} reply_flag is null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'");
list($cnt) = DB::fields("select count(*) from workflow_subflow where return $cnt;
reply_flag is null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'"); }
return $cnt;
} /**
* 未回复明细
/** * @return array|void
* 未回复明细 */
* @return array|void public function getUnReplyDetail($seq = null)
*/ {
public function getUnReplyDetail($seq = null) if ($seq == null) {
{ return null;
if ($seq == null) { }
return null; list($detail) = DB::fields("select * from workflow_subflow where
} reply_flag is null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'");
list($detail) = DB::fields("select * from workflow_subflow where return $detail;
reply_flag is null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'"); }
return $detail;
} /**
* 已回复统计
/** * @param null $seq
* 已回复统计 * @return integer
* @param null $seq */
* @return integer public function getReplyCount($seq = null)
*/ {
public function getReplyCount($seq = null) if ($seq == null) {
{ return null;
if ($seq == null) { }
return null; list($cnt) = DB::fields("select count(*) from workflow_subflow where
} reply_flag is not null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'");
list($cnt) = DB::fields("select count(*) from workflow_subflow where return $cnt;
reply_flag is not null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'"); }
return $cnt;
} /**
* 已回复明细
/** * @param null $seq 会签的序号
* 已回复明细 * @return integer
* @param null $seq 会签的序号 */
* @return integer public function getReplyDetail($seq = null)
*/ {
public function getReplyDetail($seq = null) if ($seq == null) {
{ return null;
if ($seq == null) { }
return null; $detail = DB::result("select * from workflow_subflow where
} reply_flag is not null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'");
$detail = DB::result("select * from workflow_subflow where return $detail;
reply_flag is not null and seq='" . $seq . "' and parent_key ='" . $this->parent_key . "'"); }
return $detail;
} /**
* 获取$parentKey 已经会签或拆分的次数
/** * @return integer
* 获取$parentKey 已经会签或拆分的次数 */
* @return integer private function _getSeq()
*/ {
private function _getSeq() list($cnt) = DB::fields("select nvl(max(seq),-1)+1 from workflow_subflow where
{ parent_key ='" . $this->parent_key . "'");
list($cnt) = DB::fields("select nvl(max(seq),-1)+1 from workflow_subflow where return $cnt;
parent_key ='" . $this->parent_key . "'"); }
return $cnt;
} /**
* 获取$parentKey已经会签或拆分的次数
/** * @return integer
* 获取$parentKey已经会签或拆分的次数 */
* @return integer public static function getSeqByFormKey($formKey)
*/ {
public static function getSeqByFormKey($formKey) list($seq) = DB::fields("select seq from workflow_subflow where
{ form_key ='" . $formKey . "'");
list($seq) = DB::fields("select seq from workflow_subflow where return $seq;
form_key ='" . $formKey . "'"); }
return $seq;
} /**
* 获取该节点
/** * @param $formKey
* 获取该节点 * @return integer
* @param $formKey */
* @return integer public static function getCurrentParentFlowCode($formKey)
*/ {
public static function getCurrentParentFlowCode($formKey) $flow = new Flow($formKey);
{ list($flow_code) = DB::fields("select flow_code from flow where
$flow = new Flow($formKey); form_key ='" . $flow->getParentKey() . "'");
list($flow_code) = DB::fields("select flow_code from flow where return $flow_code;
form_key ='" . $flow->getParentKey() . "'"); }
return $flow_code;
} /**
* @param $formKey
/** * @param $flag REPLY_FLAG
* @param $formKey */
* @param $flag REPLY_FLAG public static function updateReplyFlag($formKey, $flag)
*/ {
public static function updateReplyFlag($formKey, $flag) $where = "form_key = '" . $formKey . "'";
{ DB::update_table("workflow_subflow", array(
$where = "form_key = '" . $formKey . "'"; "REPLY_FLAG" => "'" . $flag . "'"
DB::update_table("workflow_subflow", array( ), $where);
"REPLY_FLAG" => "'" . $flag . "'" }
), $where);
/**
} *
* 获取会签中不同意的数量
/** * @param $seq
* * @return null
* 获取会签中不同意的数量 */
* @param $seq public function getRejectOpinionCount($seq)
* @return null {
*/ if ($seq == null) {
public function getRejectOpinionCount($seq) return null;
{ }
if ($seq == null) { $details = $this->getReplyDetail($seq);
return null; $cnt = 0;
} foreach ($details as $row) {
$details = $this->getReplyDetail($seq); if ($row['reply_flag'] == 'N') {
$cnt = 0; $cnt++;
foreach ($details as $row) { }
if ($row['reply_flag'] == 'N') { }
$cnt++; return $cnt;
} }
}
return $cnt; /**
*
} * 获取会签中不同意的数量
*/
/** public function getAcceptOpinionCount($seq)
* {
* 获取会签中不同意的数量 if ($seq == null) {
*/ return null;
public function getAcceptOpinionCount($seq) }
{ $details = $this->getReplyDetail($seq);
if ($seq == null) { $cnt = 0;
return null; foreach ($details as $row) {
} if ($row['reply_flag'] == 'Y') {
$details = $this->getReplyDetail($seq); $cnt++;
$cnt = 0; }
foreach ($details as $row) { }
if ($row['reply_flag'] == 'Y') { return $cnt;
$cnt++; }
}
} public static function updateReplyComment($formKey, $comment)
return $cnt; {
$where = "form_key = '" . $formKey . "'";
} DB::update_table("workflow_subflow", array(
"REPLY_COMMENT" => "'" . $comment . "'"
public static function updateReplyComment($formKey, $comment) ), $where);
{ self::updateChangeDate($formKey);
$where = "form_key = '" . $formKey . "'"; }
DB::update_table("workflow_subflow", array(
"REPLY_COMMENT" => "'" . $comment . "'" public static function getReplyComment($formKey)
), $where); {
self::updateChangeDate($formKey);
} $detail = DB::result("select reply_comment from workflow_subflow where
form_key='" . $formKey . "'");
public static function getReplyComment($formKey) return $detail;
{ }
$detail = DB::result("select reply_comment from workflow_subflow where public static function getCounterSignComments($parentKey)
form_key='" . $formKey . "'"); {
return $detail; $sql = "SELECT
} rownum AS seq,
seq AS CS_SEQ,
public static function getCounterSignComments($parentKey) LEADER_NO AS ASSIGNER,
{ reply_comment AS ASSIGN_OPINION,
$sql = "select rownum seq ,seq CS_SEQ ,LEADER_NO ASSIGNER,reply_comment ASSIGN_OPINION ,change_date ASSIGN_DATE , LEAD_CODE, change_date AS ASSIGN_DATE,
f_return_content('lead_code',LEAD_CODE) POSITION_NAME,case Reply_flag when 'Y' then 'F1' LEAD_CODE,
when 'N' then 'Y1' else 'A4' end ASSIGN_STATUS,'' FLOW_CODE from workflow_subflow a,employee b f_return_content('lead_code', LEAD_CODE) AS POSITION_NAME,
where parent_key='" . $parentKey . "' and a.leader_no=b.employee_no"; CASE Reply_flag
return DB::result($sql); WHEN 'Y' THEN 'F1'
} WHEN 'N' THEN 'Y1'
ELSE 'A4'
public static function updateChangeDate($formKey) END AS ASSIGN_STATUS,
{ '' AS FLOW_CODE
$sql = "update workflow_subflow set change_date=sysdate where form_key='" . $formKey . "'"; FROM
DB::query($sql); workflow_subflow a,
} employee b
WHERE
} parent_key = '" . $parentKey . "' AND
a.leader_no = b.employee_no;";
return DB::result($sql);
}
public static function updateChangeDate($formKey)
{
$sql = "update workflow_subflow set change_date=sysdate where form_key='" . $formKey . "'";
DB::query($sql);
}
}

Loading…
Cancel
Save