49 changed files with 5242 additions and 4079 deletions
@ -0,0 +1,829 @@ |
|||||
|
<?php |
||||
|
require_once '../header_nomenu.php'; |
||||
|
require_once './FormHelper.php'; |
||||
|
require_once './wf_common.php'; |
||||
|
$vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no']; |
||||
|
|
||||
|
|
||||
|
/*** |
||||
|
* 检查是否重复生成价审单 |
||||
|
* con_maintance_examine_apply |
||||
|
*/ |
||||
|
/* |
||||
|
list($cnt)=DB::fields("select count(*) cnt from con_maintance_examine_apply where vol_no='$vol_no'"); |
||||
|
if($cnt>0) { |
||||
|
echo"<script>alert('卷號".$vol_no."已生成價審單,請勿重複生成!');history.go(-1);</script>"; |
||||
|
exit; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
#係統ID |
||||
|
$system_id = 'con'; |
||||
|
#流程ID |
||||
|
$flow_id = 'con01'; |
||||
|
#表單號 $form_id; |
||||
|
$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 '<pre>'; |
||||
|
// print_r($apply_key); |
||||
|
// echo '</pre>'; |
||||
|
// exit; |
||||
|
// if ($salesman != $user_id) { |
||||
|
// echo '<script>alert("您並不是該單營業員,無法訪問。");history.go(-1);</script>'; |
||||
|
// 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"); |
||||
|
if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 |
||||
|
else $apply_st = 9; // 已到下一關,無法䖺改 |
||||
|
} |
||||
|
|
||||
|
// if ($apply_st > 2) { |
||||
|
// echo "<script>alert('卷號" . $vol_no . "已生成價審單,請勿重複生成!');history.go(-1);</script>"; |
||||
|
// exit; |
||||
|
// } |
||||
|
|
||||
|
if ($apply_st == 1) { |
||||
|
$wf = new WorkFlow($system_id, $flow_id, $form_id); |
||||
|
$wf->initWorkFlow($user_id); |
||||
|
$form_key = $wf->flowContext->getFormKey(); |
||||
|
} else { |
||||
|
$wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); |
||||
|
} |
||||
|
|
||||
|
#獲取簽核意見 |
||||
|
$assign_opinions = Assign::get_records($form_key); |
||||
|
|
||||
|
#會簽部門意見 |
||||
|
$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); |
||||
|
|
||||
|
//預設冇有摺扣 |
||||
|
$wf->setFormData(['discount' => 100]); |
||||
|
$flowName = $wf->getFlowName(); |
||||
|
$assigner = $wf->getAssignerList(); |
||||
|
$assign_status = $wf->getAssignStatus($assigner); |
||||
|
$if_show_assign = true; |
||||
|
//加載流程圖 |
||||
|
//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); |
||||
|
//$path = $fc[0]->wf_file; |
||||
|
//echo dirname(__DIR__)."/../"."$path"; |
||||
|
|
||||
|
//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); |
||||
|
#是否可會簽 |
||||
|
$isSplitable = $wf->isSplitable(); |
||||
|
|
||||
|
//表單數據 |
||||
|
#客戶表 |
||||
|
#1.電梯品牌選項 |
||||
|
$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by code_name asc "; |
||||
|
$elevator_brand_opt = DB::result($sql); |
||||
|
#2.保養方式 |
||||
|
$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; |
||||
|
$maintain_kind_opt = DB::result($sql); |
||||
|
#3.電梯類型 |
||||
|
$sql = "select code_name value ,content label from code where field_name='maintain_elevator_kind'"; |
||||
|
$elevator_kind_opt = DB::result($sql); |
||||
|
#4.付款方式 |
||||
|
$sql = "select code_name value ,content label from code where field_name='payment_kind' order by code_name+ 0 asc"; |
||||
|
$payment_kind_opt = DB::result($sql); |
||||
|
#5.契約性質 |
||||
|
$sql = "select code_name value ,content label from code where field_name='contract_kind'"; |
||||
|
$contract_kind_opt = DB::result($sql); |
||||
|
#6.是否贈送M1 |
||||
|
$is_m1_bundle_opt = [ |
||||
|
['label' => '是', 'value' => 'Y'], |
||||
|
['label' => '否', 'value' => 'N'] |
||||
|
|
||||
|
]; |
||||
|
#7.機種 |
||||
|
$sql = "select code_name value ,content label from code where field_name='fp_kind'"; |
||||
|
$fp_kind_opt = DB::result($sql); |
||||
|
#抓取有望客戶資料 |
||||
|
|
||||
|
$vol_no = $_GET['vol_no']; |
||||
|
$where = " and vol_no='$vol_no'"; |
||||
|
$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; |
||||
|
$hope_contract = DB::result($sql); |
||||
|
$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; |
||||
|
#寫入 con_maintance_examine_apply |
||||
|
if ($apply_st == 1) { |
||||
|
#獲取評審單號 |
||||
|
$apply_key = get_sequnece_no('cmea_apply_key', date('ym')); |
||||
|
//var_dump($hope_contract); |
||||
|
$insert_data = [ |
||||
|
'apply_key' => $apply_key, |
||||
|
'vol_no' => $vol_no, |
||||
|
'form_key' => $form_key, |
||||
|
'address' => $hope_contract['address'], |
||||
|
'case_name' => $hope_contract['customer'], |
||||
|
'num' => $hope_contract['num'], |
||||
|
'brand' => '', |
||||
|
'customer' => $hope_contract['customer'], |
||||
|
'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], |
||||
|
'progress_remark' => $hope_contract['progress_status'] |
||||
|
//'platform_company'=>'', |
||||
|
// 'platforom_company_tel'=> '' |
||||
|
|
||||
|
]; |
||||
|
//var_dump($insert_data); |
||||
|
DB::insert_table('con_maintance_examine_apply', $insert_data); |
||||
|
} |
||||
|
#抓使用者主管 |
||||
|
$sql = "SELECT * FROM account WHERE accountid = '$user_id' "; |
||||
|
list($result) = DB::result($sql); |
||||
|
if ($result['department_id'] == '511') { |
||||
|
$managerid = 'M0137'; |
||||
|
$managername = '劉永德'; |
||||
|
} else if ($result['department_id'] == '512') { |
||||
|
$managerid = 'M0137'; |
||||
|
$managername = '劉永德'; |
||||
|
} else if ($result['department_id'] == '513') { |
||||
|
$managerid = 'M0086'; |
||||
|
$managername = '李烘銘'; |
||||
|
} else if ($result['department_id'] == '514') { |
||||
|
$managerid = 'M0033'; |
||||
|
$managername = '吳育宗'; |
||||
|
} |
||||
|
|
||||
|
if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') { |
||||
|
$managerid = 'M0008'; |
||||
|
$managername = '詹益彰'; |
||||
|
} |
||||
|
|
||||
|
if ($result['department_id'] == 'M0008') { |
||||
|
$managerid = 'M0008'; |
||||
|
$managername = '詹益彰'; |
||||
|
} |
||||
|
$table = 'con_maintance_examine_apply'; |
||||
|
#可編輯的列 |
||||
|
$editableColumn = [ |
||||
|
'apply_key' => [ |
||||
|
'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', |
||||
|
'attr' => [ |
||||
|
'readonly=true ', |
||||
|
'class' => 'form-control form-control-sm' |
||||
|
] |
||||
|
], |
||||
|
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
||||
|
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
||||
|
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
||||
|
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
||||
|
'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], |
||||
|
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
||||
|
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], |
||||
|
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
||||
|
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
||||
|
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], |
||||
|
'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
||||
|
|
||||
|
'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
||||
|
|
||||
|
]; |
||||
|
$where = " and apply_key='$apply_key'"; |
||||
|
|
||||
|
$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; |
||||
|
$data = []; |
||||
|
$data = DB::result($sql); |
||||
|
|
||||
|
#電梯詳細資料 |
||||
|
$con_maintance_examine_clear_columm = [ |
||||
|
'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
||||
|
'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], |
||||
|
'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], |
||||
|
'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], |
||||
|
'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], |
||||
|
'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], |
||||
|
|
||||
|
'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
||||
|
'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], |
||||
|
'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], |
||||
|
|
||||
|
'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], |
||||
|
|
||||
|
'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
||||
|
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], |
||||
|
'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], |
||||
|
'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], |
||||
|
'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], |
||||
|
|
||||
|
]; |
||||
|
$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . |
||||
|
" FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); |
||||
|
$j = 0; |
||||
|
$col_count = 12; |
||||
|
$cmecRow = " <tr>"; |
||||
|
foreach ($con_maintance_examine_clear_columm as $key => $val) { |
||||
|
$fieldVal = ""; |
||||
|
$_input = $val['tag'] == 'select' ? |
||||
|
FormHelper::select('', $val['options'], $fieldVal, $val['attr']) |
||||
|
: 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='請輸入'>"; |
||||
|
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>"; |
||||
|
if ((++$j % $col_count) == 0) { |
||||
|
if ($j == $col_count) $cmecRow .= "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>"; |
||||
|
$cmecRow .= "</tr><tr>"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$cmecRow .= "</tr>"; |
||||
|
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; |
||||
|
#當前年月 |
||||
|
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 "); |
||||
|
|
||||
|
|
||||
|
return $seq_no; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
?> |
||||
|
<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"> |
||||
|
window.param = { |
||||
|
elevator_type: '', |
||||
|
floors: 1, |
||||
|
speed: 1, |
||||
|
persons: 6, |
||||
|
weight: 1000, |
||||
|
maintain_times: 1, //病床梯一月2次保養 |
||||
|
maintain_months: 12, |
||||
|
maintain_kind: 2, |
||||
|
maintain_period: 1, //預設為1月1次, 2是為2月一次 |
||||
|
is_m1_bundle: 'N', |
||||
|
}; |
||||
|
|
||||
|
let regDelStr = ""; |
||||
|
|
||||
|
$(document).ready(function() { |
||||
|
var tag_data; |
||||
|
$.ajax({ |
||||
|
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner', |
||||
|
//url: 'http://localhost/fds/index.php/DesignFlow/get_assigner', |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
success: function(data) { |
||||
|
window.tag_data = data; |
||||
|
$('#selectPage').selectPage({ |
||||
|
showField: 'show_name', |
||||
|
keyField: 'val', |
||||
|
data: data, |
||||
|
multiple: true, |
||||
|
multipleControlbar: true, |
||||
|
pagination: false, |
||||
|
focusDropList: false |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
$.validator.addMethod('gt', function(value, element, param) { |
||||
|
return value > param; |
||||
|
}, $.validator.format("輸入值必須大於0")); |
||||
|
var assigner = eval('<?= json_encode($assigner) ?>'); |
||||
|
//console.log(assigner); |
||||
|
|
||||
|
var cmecRow = "<?= str_replace('"', '\'', $cmecRow) ?>"; |
||||
|
// $('#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 | " |
||||
|
}); |
||||
|
|
||||
|
$('#contract_begin_date').on('input propertychange', function(e) { |
||||
|
|
||||
|
var date = new Date(e.target.value); |
||||
|
var yyyy = date.getFullYear() + 1; |
||||
|
var mm = date.getMonth() + 1; |
||||
|
var dd = date.getDate(); |
||||
|
var time = yyyy + `-` + (mm < 10 ? '0' + mm : mm) + '-' + (dd < 10 ? '0' + dd : dd); |
||||
|
$('#contract_end_date').val(time); |
||||
|
}); |
||||
|
|
||||
|
$('#brand').change(function() { |
||||
|
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
||||
|
if (_selected_status == 'Z') { |
||||
|
$('#brandModal').modal('show') |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
$('#assign_status').change(function() { |
||||
|
$("#next_users").empty(); |
||||
|
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
||||
|
var _option_tmp = ""; //獲取下拉列表 |
||||
|
// for (a in assigner) { //遍曆assigner |
||||
|
// if (assigner[a][0] == _selected_status) { |
||||
|
// _tmp = assigner[a][1].split(','); |
||||
|
// for (var b in _tmp) { |
||||
|
// if (_tmp[b] == '') { |
||||
|
// continue; |
||||
|
// } |
||||
|
// _uname = _tmp[b].split('-')[1]; |
||||
|
// _uid = _tmp[b].split('-')[0]; |
||||
|
// /* console.log(_tmp[b]);*/ |
||||
|
// _option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>'; |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
_option_tmp += '<option value=' + '<?php echo $managerid ?>' + '>' + '<?php echo $managername ?>' + '</option>'; |
||||
|
console.log(_option_tmp); |
||||
|
$("#next_users").append(_option_tmp); |
||||
|
}); |
||||
|
$('#maintain_kind').change(function() { |
||||
|
if ($('#cmecTbody tr').length > 0) { |
||||
|
alert("保養方式已更動,請開始輸入電梯資料!"); |
||||
|
$('#cmecTbody').find(':input').val(''); |
||||
|
return false; |
||||
|
} |
||||
|
}); |
||||
|
$("#form").validate(); |
||||
|
$("form").submit(function(e) { |
||||
|
$('#reg_del').val(regDelStr); |
||||
|
}); |
||||
|
}); |
||||
|
addRow = function() { |
||||
|
if ($('#maintain_kind').val() == "") { |
||||
|
alert("請選擇保養方式!"); |
||||
|
$('#maintain_kind').eq(0).focus(); |
||||
|
return false; |
||||
|
} |
||||
|
var cmecRow = "<?= $cmecRow ?>"; |
||||
|
$('#cmecTbody').append(cmecRow); |
||||
|
$("select[name^='elevator_kind'],select[name^='is_m1_bundle']").on('change', function(obj) { |
||||
|
//console.log('#'+$(this).attr('name')+'#'); |
||||
|
var elen = 1; |
||||
|
if ('elevator_kind[]' == $(this).attr('name')) { |
||||
|
var children = $(this).parent().parent().parent(); |
||||
|
var elementObj = $(children).next('tr').find("input[name^='stand_price']"); |
||||
|
//var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
||||
|
} else if ('is_m1_bundle[]' == $(this).attr('name')) { |
||||
|
var children = $(this).parent().parent().parent().prev('tr'); |
||||
|
var elementObj = $(this).parent().parent().parent().find("input[name^='stand_price']"); |
||||
|
//var is_m1_bundle = $(this).val(); |
||||
|
} |
||||
|
|
||||
|
var element = elementObj; |
||||
|
if ('elevator_kind[]' == $(this).attr('name')) { |
||||
|
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option: selected").val(""); |
||||
|
} else if ('is_m1_bundle[]' == $(this).attr('name')) { |
||||
|
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle']").val(); |
||||
|
} |
||||
|
|
||||
|
var floors = $(children).find("input[name^='floors']").val(); |
||||
|
var speed = $(children).find("input[name^='speed']").val(); |
||||
|
var weight = $(children).find("input[name^='weight']").val(); |
||||
|
var persons = $(children).find("input[name^='persons']").val(); |
||||
|
var maintain_times = $(children).find("input[name^='maintain_times']").val(); |
||||
|
var maintain_months = $(children).find("input[name^='maintain_months']").val(); |
||||
|
var maintain_period = $(children).find("input[name^='maintain_period']").val(); |
||||
|
var maintain_kind = $('#maintain_kind').val(); |
||||
|
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val(); |
||||
|
|
||||
|
var param1 = { |
||||
|
...param, |
||||
|
persons, |
||||
|
floors, |
||||
|
speed, |
||||
|
weight, |
||||
|
maintain_times, |
||||
|
maintain_months, |
||||
|
maintain_period, |
||||
|
maintain_kind, |
||||
|
elevator_type, |
||||
|
is_m1_bundle |
||||
|
} |
||||
|
setStandPrice(param1, element); |
||||
|
//console.info(param1); |
||||
|
}); |
||||
|
|
||||
|
$("input[name^='floors']" + |
||||
|
",input[name^='speed']" + |
||||
|
",input[name^='persons']" + |
||||
|
",input[name^='weight']" + |
||||
|
",input[name^='maintain_times']" + |
||||
|
",input[name^='maintain_months']" + |
||||
|
",input[name^='maintain_period']" |
||||
|
).on('input propertychange', function(obj) { |
||||
|
// $(obj).parent().parent().parent().remove(); |
||||
|
var children = $(this).parent().parent().parent().children(); |
||||
|
var floors = $(children).find("input[name^='floors']").val(); |
||||
|
var speed = $(children).find("input[name^='speed']").val(); |
||||
|
var weight = $(children).find("input[name^='weight']").val(); |
||||
|
var persons = $(children).find("input[name^='persons']").val(); |
||||
|
var maintain_times = $(children).find("input[name^='maintain_times']").val(); |
||||
|
var maintain_months = $(children).find("input[name^='maintain_months']").val(); |
||||
|
var maintain_period = $(children).find("input[name^='maintain_period']").val(); |
||||
|
var maintain_kind = $('#maintain_kind').val(); |
||||
|
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val(); |
||||
|
var is_m1_bundle = $(this).parent().parent().parent().next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
||||
|
|
||||
|
var param1 = { |
||||
|
...param, |
||||
|
persons, |
||||
|
floors, |
||||
|
speed, |
||||
|
weight, |
||||
|
maintain_times, |
||||
|
maintain_months, |
||||
|
maintain_period, |
||||
|
maintain_kind, |
||||
|
elevator_type, |
||||
|
is_m1_bundle |
||||
|
} |
||||
|
var element = $(this).parent().parent().parent().next().children().find("input[name^='stand_price']"); |
||||
|
setStandPrice(param1, element); |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
delRow = function(btn) { |
||||
|
if ($(btn).attr('name') == 'btn1') { |
||||
|
//console.log($(btn).parent().parent().prev('tr').find('input[id=register_code]').val()); |
||||
|
regDelStr += $(btn).parent().parent().find('input[id=register_code]').val() + ","; |
||||
|
$(btn).parent().parent().next('tr').remove(); |
||||
|
} else { |
||||
|
//console.log($(btn).parent().parent().find('input[id=register_code]').val()); |
||||
|
$(btn).parent().parent().next('tr').remove(); |
||||
|
$(btn).parent().parent().remove(); |
||||
|
} |
||||
|
$(btn).parent().parent().remove(); |
||||
|
} |
||||
|
setStandPrice = function(p, obj) { |
||||
|
$.ajax({ |
||||
|
url: '../cont/t.php', |
||||
|
data: p, |
||||
|
type: 'get', |
||||
|
dataType: 'json', |
||||
|
//success: function(data) {}, |
||||
|
success: function(data) { |
||||
|
console.info(data); |
||||
|
if (data.status == 'ok') { |
||||
|
$(obj).val(data.price); |
||||
|
} else { |
||||
|
$(obj).val(data.message); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
addNewBrand = function() { |
||||
|
var new_brand = $("#new_brand").val(); |
||||
|
if (new_brand != '') { |
||||
|
p = { |
||||
|
new_brand: new_brand, |
||||
|
method: 'add_brand' |
||||
|
} |
||||
|
$.ajax({ |
||||
|
url: 'async_req.php', |
||||
|
data: p, |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
success: function(data) { |
||||
|
console.info(data); |
||||
|
$("#brand").append("<option value='" + data.seq + "'>" + new_brand + "</option>"); |
||||
|
}, |
||||
|
error: function(data) { |
||||
|
console.info(data); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<body> |
||||
|
|
||||
|
<div id="toolbarmenu"> |
||||
|
<!--<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span>--> |
||||
|
<!-- 導航欄 --> |
||||
|
|
||||
|
<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> |
||||
|
<!-- 導航欄 END--> |
||||
|
<div class="tab-content "> |
||||
|
|
||||
|
<div class="tab-pane active assign_content " id="tabassign"> |
||||
|
<form action="submit.php" id='form' method="post" style='width:98%;margin:0 auto'> |
||||
|
<!-- hidden域 --> |
||||
|
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' /> |
||||
|
<input type="hidden" name="token" value='<?= $_GET['token'] ?>' /> |
||||
|
<input type="hidden" name="reg_del" id="reg_del"> |
||||
|
<input type="hidden" name="form_src" id="form_src" value="apply_form"> |
||||
|
<!--表單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 ($editableColumn as $key => $val) { |
||||
|
$j = (($i++) % 4); |
||||
|
$fieldVal = empty($data) ? "" : $data[0][$key]; |
||||
|
|
||||
|
$_input = $val['tag'] == 'select' ? |
||||
|
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) |
||||
|
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
||||
|
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "' |
||||
|
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>"; |
||||
|
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_remark" name="progress_remark" value='12' rows='6'><?= $hope_contract['progress_status'] ?></textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div id="elevator_list_area " class="row "> |
||||
|
<div class="col-12 form_row_header "> |
||||
|
<b>電梯詳細資料</b> |
||||
|
</div> |
||||
|
<table style='margin-top:0px;text-align:center' class=' table-condensed' id='elevator_list'> |
||||
|
|
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan='18' style='text-align:left;font-size:13px'> |
||||
|
<b>註意事項:</b> |
||||
|
<p>1.速度單位是 米/分.</p> |
||||
|
<p>2.選擇贈送M1,保養月數需填寫60.</p> |
||||
|
<p>3.標準價格未帶出,請聯係業務部建立該規格報價.</p> |
||||
|
<p>4.無機房速度20~60米 以60米為標準.</p> |
||||
|
|
||||
|
|
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan='18' ;><button onClick='addRow()' type="button" style='float:right' class="btn btn-link btn-md">+新增</button></td> |
||||
|
</tr> |
||||
|
<tr style='margin-top:0px;text-align:center'> |
||||
|
<?php |
||||
|
$j = 0; |
||||
|
foreach ($con_maintance_examine_clear_columm as $val) { |
||||
|
|
||||
|
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan']) ? 1 : $val['attr']['colspan']], $val['label']); |
||||
|
//echo "<th>" . $val['label'] . "</th>"; |
||||
|
if ((++$j % $col_count) == 0) { |
||||
|
if ($j == $col_count) echo "<th>操作</th>"; |
||||
|
|
||||
|
|
||||
|
echo "</tr><tr style='margin-top:0px;text-align:center'>"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
?> |
||||
|
|
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody id='cmecTbody'> |
||||
|
<?php |
||||
|
|
||||
|
foreach ($con_maintance_examine_clear as $key => $val) { |
||||
|
$j = 0; |
||||
|
$cmecRow = " <td>"; |
||||
|
foreach ($con_maintance_examine_clear_columm as $col => $col_def) { |
||||
|
|
||||
|
$fieldVal = empty($val) ? "" : $val[$col]; |
||||
|
$_input = $col_def['tag'] == 'select' ? |
||||
|
FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr']) |
||||
|
: FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']); |
||||
|
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' : |
||||
|
$col_def['attr']['colspan']) . "' ><div class=' col-12'> |
||||
|
$_input</td>"; |
||||
|
if ((++$j % $col_count) == 0) { |
||||
|
$cmecRow .= "<td><button name='btn1' onClick='delRow(this)' type='button' class='btn btn-link btn-md '>刪除</button></td>"; |
||||
|
$cmecRow .= "</td><td>"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
echo $cmecRow . "</td>"; |
||||
|
} |
||||
|
?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div id="assign_area " class="row "> |
||||
|
<div class="col-12 form_row_header "> |
||||
|
<b>簽核操作</b> |
||||
|
</div> |
||||
|
<div class="col-12 col-3 form_field_content " style="padding:0"> |
||||
|
<textarea id="assign_opinion" name="assign_opinion" required></textarea> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class=" col-3 form_field_title"> |
||||
|
<b style='float:right'>簽核狀態</b> |
||||
|
</div> |
||||
|
<div class=" col-2 form_field_content "> |
||||
|
<select name="assign_status" id="assign_status" required class='form-control form-control form-control-sm '> |
||||
|
<?php echo $assign_status; ?> |
||||
|
</select> |
||||
|
</div> |
||||
|
|
||||
|
<div class=" col-2 form_field_title"> |
||||
|
<b>下位簽核者</b> |
||||
|
</div> |
||||
|
<div class="col-2 form_field_content"> |
||||
|
<select lect name="next_users" id="next_users" class='form-control form-control-sm '></select> |
||||
|
|
||||
|
</div> |
||||
|
<div class="col-3 form_field_title "> |
||||
|
<button type="submit" name="btn_save" class="btn btn-warning btn-sm" value="save" style='float:left;margin-right:4px;'>保存</button> |
||||
|
<button type="submit" name="btn_save" class="btn btn-primary btn-sm" value="tosign" style='float:left'>提交</button> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div id="opinion_area " class="row form_comment "> |
||||
|
<div class='col-12 '> |
||||
|
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'> |
||||
|
<li class="active nav-item "> |
||||
|
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a> |
||||
|
</li> |
||||
|
|
||||
|
</ul> |
||||
|
</div> |
||||
|
<div class="tab-content col-12"> |
||||
|
<div role="tabpanel" class="tab-pane active" id="main_flow_assign"> |
||||
|
<?php |
||||
|
$assign_departs = array(); |
||||
|
foreach ($assign_opinions as $as) { |
||||
|
$assign_departs[$as['assign_depart']] = $as['assign_depart_name']; |
||||
|
} |
||||
|
?> |
||||
|
|
||||
|
<div class="comment_items "> |
||||
|
<?php $cnt = 1; |
||||
|
$tmp_code = "0"; |
||||
|
foreach ($assign_opinions as $as) { ?> |
||||
|
<div class="comment-item"> |
||||
|
|
||||
|
<!-- <div class="comment-title"> |
||||
|
<b>大 </b> |
||||
|
</div>--> |
||||
|
<?php |
||||
|
if (($as['flow_code']) != $tmp_code) |
||||
|
echo ' <div class="comment-title"> |
||||
|
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b> |
||||
|
</div>'; |
||||
|
$tmp_code = $as['flow_code']; |
||||
|
?> |
||||
|
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>"> |
||||
|
<div class="comment-content-header"> |
||||
|
<span> |
||||
|
|
||||
|
<strong> |
||||
|
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?> |
||||
|
|
||||
|
<?php if ($as['lead_code'] < 90) echo |
||||
|
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?> |
||||
|
|
||||
|
</strong> |
||||
|
</span> |
||||
|
<span> |
||||
|
|
||||
|
<strong> |
||||
|
|
||||
|
<?php if ($as['assign_status'] == 'S') echo |
||||
|
" <label class='comment-content-tag'>申請人 </label>"; ?> |
||||
|
<?php if (substr($as['assign_status'], 0, 1) == 'B') |
||||
|
echo " <label class='comment-content-tag red-tag'>退回</label>"; ?> |
||||
|
<?php if (substr($as['assign_status'], 0, 2) == 'X3') |
||||
|
echo " <label class='comment-content-tag red-tag'>會簽</label>"; ?> |
||||
|
</strong> |
||||
|
</span> |
||||
|
<span class="comment-content-header-time"> |
||||
|
簽核於:<?= $as['assign_date'] ?> |
||||
|
</span> |
||||
|
|
||||
|
<!-- <ul class="comment-content-tags"> |
||||
|
<li class="">不同意</li> |
||||
|
<li class="comment-content-tag-alert">退回</li> |
||||
|
</ul>--> |
||||
|
</div> |
||||
|
<div class="comment-content-body"> |
||||
|
<?= $as['assign_opinion'] ?> |
||||
|
</div> |
||||
|
<!-- <div class="comment-content-footer"> |
||||
|
<span>已上載附件: </span><a href="#">附件1</a> |
||||
|
</div>--> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<?php } ?> |
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
<!-- 模態框(Modal) --> |
||||
|
<div class="modal fade" id="brandModal" tabindex="-1" role="dialog" aria-labelledby="brandModalLabel" aria-hidden="true"> |
||||
|
<div class="modal-dialog"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
新增廠牌 |
||||
|
</div> |
||||
|
<div class="modal-body"> |
||||
|
<input type="text" class='form-control form-control form-control-sm ' id='new_brand'> |
||||
|
|
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" class="btn btn-primary" onClick="addNewBrand()" data-dismiss="modal">保存</button> |
||||
|
|
||||
|
</div> |
||||
|
</div><!-- /.modal-content --> |
||||
|
</div><!-- /.modal --> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</body> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Loading…
Reference in new issue