0) { echo""; exit; } */ #係統ID $system_id = 'con'; #流程ID $flow_id = 'con01'; #表單號 $form_id; $form_id = ""; #價審單狀態 $apply_st = ""; list($apply_key, $form_key)=DB::fields("select apply_key, form_key from con_maintance_examine_apply where vol_no='$vol_no' order by apply_key desc limit 0, 1"); 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""; 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); } $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[]', 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], 'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], 'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], 'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', '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', '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[]', 'colspan' => 2, 'class' => 'form-control form-control-sm']], 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', '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'], '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, '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 = "