From df7e24efb47ccdc3e13a981f23d6a43717d2873f Mon Sep 17 00:00:00 2001 From: Cheng Date: Wed, 20 Dec 2023 11:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=83=B9=E5=AF=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/cont/MICalculator.php | 646 +++++------ wms/cont/query_form.php | 1019 +++++++++-------- wms/cont/sign_list.php | 4 +- wms/contract/api/postContractNewApplyData.php | 293 ++--- 4 files changed, 984 insertions(+), 978 deletions(-) diff --git a/wms/cont/MICalculator.php b/wms/cont/MICalculator.php index 73283ee9..04bce2bb 100644 --- a/wms/cont/MICalculator.php +++ b/wms/cont/MICalculator.php @@ -1,322 +1,324 @@ - 'fail', - 'message' => '無此項目,請聯係業務部創建MI' - ]; - } - public function success($price) - { - return [ - 'status' => 'ok', - 'price' => $price - ]; - } -} + 'fail', + 'message' => '無此項目,請聯係業務部創建MI' + ]; + } + public function success($price) + { + return [ + 'status' => 'ok', + 'price' => $price + ]; + } +} diff --git a/wms/cont/query_form.php b/wms/cont/query_form.php index 2c9a47b6..cba779c1 100644 --- a/wms/cont/query_form.php +++ b/wms/cont/query_form.php @@ -1,510 +1,511 @@ -vol_no; -require_once './MICalculator.php'; -require_once './FormHelper.php'; -require_once './wf_common.php'; -list($form_key) = DB::fields("select form_key from con_maintance_examine_apply where apply_key='$apply_key'"); -//echo $form_key; -$flow = new Flow($form_key); -// 當前節點簽核開始 -//var_dump($flow); -$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); -#獲取簽核意見 -$assign_opinions = Assign::get_records($form_key); -$flowName = $wf->getFlowName(); -$assigner = $wf->getAssignerList(); -$assign_status = $wf->getAssignStatus($assigner); -//表單數據 -#客戶表 -#客戶表 -#1.電梯品牌選項 -$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; -$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='elevator_kind'"; -$elevator_kind_opt = DB::result($sql); -#4.付款方式 -$sql = "select code_name value ,content label from code where field_name='payment_kind'"; -$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); -$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" => 'number', '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' => ['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']], - - // 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - // 'platforom_company_tel' => ['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 apply_key"; -$data = []; -list($data) = DB::result($sql); - -#電梯詳細資料 -$con_maintance_examine_clear_columm = [ - 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', '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" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', '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" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - - 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', '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], - - - // 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], - 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], - 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], - //'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], - // 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], - // 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], - // 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], - 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], - //'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], - 'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "tag" => 'number', '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' => "標準價格A(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], - 'contract_price' => ['label' => "契約報價B(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], - 'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], - - - 'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true','disabled', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], - 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true','disabled', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], - 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true','disabled', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], - -]; -$con_maintance_examine_clear = DB::result("SELECT register_code, - f_return_content('elevator_brand',elevator_brand) elevator_brand, - f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, - elevator_kind con_elevator_kind, - spec, - weight, - speed, - floors, - persons, - maintain_times, - maintain_months, - maintain_period, - is_m1_bundle, - - useful_years, - last_check_date, - speed_governors_check_expense, - service_expense, - commission_expense, - management_expense, - annual_survey_expense, - stand_price, - contract_price, - sold_price, - 0 mi_cost , - 0 discount, - 0 gross_profit - FROM - con_maintance_examine_clear - WHERE - 1 = 1 - AND apply_key='" . $apply_key . "' and cmstatus = 'Y'"); - -function base_url($url) -{ - return "https://www.masada.com.tw/static/" . $url; -} - - -?> - - - - - - - <?php echo $flowName; ?> - - - - - - - - - - - - - - - - - - - -
- -
-
- - - - -
-
-
-

保養契約價格審核單

-
-
- -
-
- 契約信息 -
-
- - "; - foreach ($editableColumn as $key => $val) { - $j = (($i++) % 4); - $fieldVal = empty($data) ? "" : $data[$key]; - $fieldVal = empty($data) ? "" : $data[$key]; - - $_input = $val['tag'] == 'select' ? - FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : - FormHelper::tag("label", $val['attr'], $fieldVal); - - //""; - if ($i != 1 && $j == 0) { - echo " -
-
- "; - } - echo "
- " . $val['label'] . " -
-
- $_input -
- "; - } - echo "
"; - - ?> - -
-
- 洽商進度 -
-
- - -
-
- -
-
- 電梯詳細資料 -
- - - - - - empty($val['attr']['colspan']) - ? 1 : $val['attr']['colspan']], $val['label']); - - if ((++$j % 14) == 0) { - // if ($j == 12) echo ""; - - - echo ""; - } - } - - ?> - - - - - $val) { - $j = 0; - - $cmecRow = " "; - - foreach ($con_maintance_examine_clear_columm as $col => $col_def) { - $fieldVal = empty($val) ? "" : $val[$col]; - if ($col == 'mi_cost') { - $param = [ - 'elevator_type' => $val['con_elevator_kind'], - 'floors' => $val['floors'], - 'speed' => $val['speed'], - 'persons' => $val['persons'], - 'weight' => $val['weight'], - 'maintain_times' => $val['maintain_times'], - 'maintain_months' => $val['maintain_months'], - 'maintain_kind' => $data['maintain_kind'], - 'maintain_period' => $val['maintain_period'], - 'is_m1_bundle' => $val['is_m1_bundle'], - ]; - $mic = new MICalculator(); - $res = $mic->cal($param); - #MI報價 - $con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = $res['status'] == 'ok' ? $res['price'] : $res['message']; - $con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" - #扣率 - $val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; - } - - $_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 - : $col_def['attr']['colspan']], $fieldVal); - $cmecRow .= ""; - - $cmecRow = (++$j % 14 == 0) ? $cmecRow . "" : $cmecRow; - } - $tr_class = $tr_class == 'odd' ? "even" : "odd"; - echo $cmecRow . ""; - } - ?> - - - - - - - -
操作
$_input
-
- - - - - -
-
- -
- - - -
-
- -
-
-
- - -
- -
- - - - ' . $wf->getNodeDescriptions($as['flow_code']) . ' -
'; - $tmp_code = $as['flow_code']; - ?> -
"> -
- - - - -   - " . $as['position_name'] . " "; ?> - - - - - - -   - 申請人 "; ?> - 退回"; ?> - 會簽"; ?> - - - - 簽核於: - - - -
-
- -
- -
- -
- - - -
-
- -
-
-
- - - - - - - - +vol_no; +require_once './MICalculator.php'; +require_once './FormHelper.php'; +require_once './wf_common.php'; +list($form_key) = DB::fields("select form_key from con_maintance_examine_apply where apply_key='$apply_key'"); +//echo $form_key; +$flow = new Flow($form_key); +// 當前節點簽核開始 +//var_dump($flow); +$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); +#獲取簽核意見 +$assign_opinions = Assign::get_records($form_key); +$flowName = $wf->getFlowName(); +$assigner = $wf->getAssignerList(); +$assign_status = $wf->getAssignStatus($assigner); +//表單數據 +#客戶表 +#客戶表 +#1.電梯品牌選項 +$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; +$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='elevator_kind'"; +$elevator_kind_opt = DB::result($sql); +#4.付款方式 +$sql = "select code_name value ,content label from code where field_name='payment_kind'"; +$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); +$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" => 'number', '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' => ['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']], + + // 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], + // 'platforom_company_tel' => ['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 apply_key"; +$data = []; +list($data) = DB::result($sql); + +#電梯詳細資料 +$con_maintance_examine_clear_columm = [ + 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', '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" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', '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" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + + 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', '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], + + + // 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], + 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], + 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], + //'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], + // 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], + // 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], + // 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], + 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], + //'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], + 'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], + 'maintain_period' => ['label' => "保養周期", "tag" => 'number', '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' => "標準價格A(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], + 'contract_price' => ['label' => "契約報價B(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], + 'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], + + + 'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], + 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], + 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], + +]; +$con_maintance_examine_clear = DB::result("SELECT register_code, + f_return_content('elevator_brand',elevator_brand) elevator_brand, + f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, + elevator_kind con_elevator_kind, + spec, + weight, + speed, + floors, + persons, + maintain_times, + maintain_months, + maintain_period, + is_m1_bundle, + + useful_years, + last_check_date, + speed_governors_check_expense, + service_expense, + commission_expense, + management_expense, + annual_survey_expense, + stand_price, + contract_price, + sold_price, + 0 mi_cost , + 0 discount, + 0 gross_profit + FROM + con_maintance_examine_clear + WHERE + 1 = 1 + AND apply_key='" . $apply_key . "' and cmstatus = 'Y'"); + +function base_url($url) +{ + return "https://www.masada.com.tw/static/" . $url; +} + + +?> + + + + + + + <?php echo $flowName; ?> + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + +
+
+
+

保養契約價格審核單

+
+
+ +
+
+ 契約信息 +
+
+ + "; + foreach ($editableColumn as $key => $val) { + // print_r($val['label']); + $j = (($i++) % 4); + $fieldVal = empty($data) ? "" : $data[$key]; + $fieldVal = empty($data) ? "" : $data[$key]; + + $_input = $val['tag'] == 'select' ? + FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : + FormHelper::tag("label", $val['attr'], $fieldVal); + + //""; + if ($i != 1 && $j == 0) { + echo " +
+
+ "; + } + echo "
+ " . $val['label'] . " +
+
+ $_input +
+ "; + } + echo "
"; + + ?> + +
+
+ 洽商進度 +
+
+ + +
+
+ +
+
+ 電梯詳細資料 +
+ + + + + + empty($val['attr']['colspan']) + ? 1 : $val['attr']['colspan']], $val['label']); + + if ((++$j % 14) == 0) { + // if ($j == 12) echo ""; + + + echo ""; + } + } + + ?> + + + + + $val) { + $j = 0; + + $cmecRow = " "; + + foreach ($con_maintance_examine_clear_columm as $col => $col_def) { + $fieldVal = empty($val) ? "" : $val[$col]; + if ($col == 'mi_cost') { + $param = [ + 'elevator_type' => $val['con_elevator_kind'], + 'floors' => $val['floors'], + 'speed' => $val['speed'], + 'persons' => $val['persons'], + 'weight' => $val['weight'], + 'maintain_times' => $val['maintain_times'], + 'maintain_months' => $val['maintain_months'], + 'maintain_kind' => $data['maintain_kind'], + 'maintain_period' => $val['maintain_period'], + 'is_m1_bundle' => $val['is_m1_bundle'], + ]; + $mic = new MICalculator(); + $res = $mic->cal($param); + #MI報價 + $con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = $res['status'] == 'ok' ? $res['price'] : $res['message']; + $con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" + #扣率 + $val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; + } + + $_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 + : $col_def['attr']['colspan']], $fieldVal); + $cmecRow .= ""; + + $cmecRow = (++$j % 14 == 0) ? $cmecRow . "" : $cmecRow; + } + $tr_class = $tr_class == 'odd' ? "even" : "odd"; + echo $cmecRow . ""; + } + ?> + + + + + + + +
操作
$_input
+
+ + + + + +
+
+ +
+ + + +
+
+ +
+
+
+ + +
+ +
+ + + + ' . $wf->getNodeDescriptions($as['flow_code']) . ' +
'; + $tmp_code = $as['flow_code']; + ?> +
"> +
+ + + + +   + " . $as['position_name'] . " "; ?> + + + + + + +   + 申請人 "; ?> + 退回"; ?> + 會簽"; ?> + + + + 簽核於: + + + +
+
+ +
+ +
+ +
+ + + +
+
+ +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/wms/cont/sign_list.php b/wms/cont/sign_list.php index 5ada92d2..744f40cc 100644 --- a/wms/cont/sign_list.php +++ b/wms/cont/sign_list.php @@ -41,7 +41,7 @@ $res = mysqli_query($link, $sql); $row = mysqli_fetch_row($res); $user_department_id = $row[0]; mysqli_free_result($res); -if (in_array($user_department_id, $depart_arr) || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0006" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04") $where = ""; +if (in_array($user_department_id, $depart_arr) || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0006" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "M0225") $where = ""; // 電梯廠牌 $elevator_brand_arr = []; @@ -75,6 +75,8 @@ $data = mysqli_query($link, $sql); // echo '
';
 // print_r($data);
 // echo '
'; +// echo '1'; + ?> beginTransaction(); - try{ - if($isFirst == 1){ + try { + if ($isFirst == 1) { $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, total_items, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :total_items, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by)"; - $stmt = $conn -> prepare($sql_str); - $stmt ->bindParam(':mid', $mid); - $stmt ->bindParam(':contractno', $vol_no); - $stmt ->bindParam(':sales_man', $salesman); - $stmt ->bindParam(':apply_date', $apply_date); - $stmt ->bindParam(':apply_type', $apply_type); - $stmt ->bindParam(':case_name', $case_name); - $stmt ->bindParam(':customer', $customer); - $stmt ->bindParam(':manager', $manager); - $stmt ->bindParam(':vat', $vat); - $stmt ->bindParam(':total_price', $total_price); - $stmt ->bindParam(':total_items', $total_items); - $stmt ->bindParam(':buy_fee', $buy_fee); - $stmt ->bindParam(':install_fee', $install_fee); - $stmt ->bindParam(':contact_address', $contact_address); - $stmt ->bindParam(':workdeadline_a', $workdeadline_a); - $stmt ->bindParam(':workdeadline_b', $workdeadline_b); - $stmt ->bindParam(':test_time', $test_time); - $stmt ->bindParam(':freedeadline', $freedeadline); - $stmt ->bindParam(':trade_address', $trade_address); - $stmt ->bindParam(':tradedeadline', $tradedeadline); - $stmt ->bindParam(':secondPayDeadline', $secondPayDeadline); - $stmt ->bindParam(':progress', $progress); - $stmt ->bindParam(':status', $status); - $stmt ->bindParam(':person', $salesman); - $stmt ->bindParam(':personname', $salesmanname); - $stmt ->bindParam(':submit_date', $submit_date); - $stmt ->bindParam(':created_at', $created_at); - $stmt ->bindParam(':created_by', $created_by); - $stmt ->execute(); + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->bindParam(':contractno', $vol_no); + $stmt->bindParam(':sales_man', $salesman); + $stmt->bindParam(':apply_date', $apply_date); + $stmt->bindParam(':apply_type', $apply_type); + $stmt->bindParam(':case_name', $case_name); + $stmt->bindParam(':customer', $customer); + $stmt->bindParam(':manager', $manager); + $stmt->bindParam(':vat', $vat); + $stmt->bindParam(':total_price', $total_price); + $stmt->bindParam(':total_items', $total_items); + $stmt->bindParam(':buy_fee', $buy_fee); + $stmt->bindParam(':install_fee', $install_fee); + $stmt->bindParam(':contact_address', $contact_address); + $stmt->bindParam(':workdeadline_a', $workdeadline_a); + $stmt->bindParam(':workdeadline_b', $workdeadline_b); + $stmt->bindParam(':test_time', $test_time); + $stmt->bindParam(':freedeadline', $freedeadline); + $stmt->bindParam(':trade_address', $trade_address); + $stmt->bindParam(':tradedeadline', $tradedeadline); + $stmt->bindParam(':secondPayDeadline', $secondPayDeadline); + $stmt->bindParam(':progress', $progress); + $stmt->bindParam(':status', $status); + $stmt->bindParam(':person', $salesman); + $stmt->bindParam(':personname', $salesmanname); + $stmt->bindParam(':submit_date', $submit_date); + $stmt->bindParam(':created_at', $created_at); + $stmt->bindParam(':created_by', $created_by); + $stmt->execute(); $contract_apply_id = $conn->lastInsertId(); - foreach($pays as $idx=>$pay){ + foreach ($pays as $idx => $pay) { $kind = $idx; $sql_str = "INSERT INTO contract_new_apply_pays (contract_apply_id, mid, pay_kind, pay_scale, pay_amount, pay_period, condition_date, created_at, created_by) VALUES (:contract_apply_id, :mid, :pay_kind, :pay_scale, :pay_amount, :pay_period, :condition_date, :created_at, :created_by)"; - $stmt = $conn -> prepare($sql_str); - $stmt ->bindParam(':contract_apply_id', $contract_apply_id); - $stmt ->bindParam(':mid', $mid); - $stmt ->bindParam(':pay_kind', $kind); - $stmt ->bindParam(':pay_scale', $pay['scale']); - $stmt ->bindParam(':pay_amount', $pay['amount']); - $stmt ->bindParam(':pay_period', $pay['pay_period']); - $stmt ->bindParam(':condition_date', $pay['condition_date']); - $stmt ->bindParam(':created_at', $created_at); - $stmt ->bindParam(':created_by', $created_by); - $stmt ->execute(); + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contract_apply_id', $contract_apply_id); + $stmt->bindParam(':mid', $mid); + $stmt->bindParam(':pay_kind', $kind); + $stmt->bindParam(':pay_scale', $pay['scale']); + $stmt->bindParam(':pay_amount', $pay['amount']); + $stmt->bindParam(':pay_period', $pay['pay_period']); + $stmt->bindParam(':condition_date', $pay['condition_date']); + $stmt->bindParam(':created_at', $created_at); + $stmt->bindParam(':created_by', $created_by); + $stmt->execute(); } - // -----處理檔案上傳 START----- - if(!empty($files)){ + // -----處理檔案上傳 START----- + if (!empty($files)) { $englisharr = range('a', 'z'); - $files = $_FILES['files']; + $files = $_FILES['files']; $newfiles = []; - foreach( $files as $file ){ + foreach ($files as $file) { $i = 0; //新陣列的索引編號 - foreach( $file as $key => $val ){ + foreach ($file as $key => $val) { $newfiles[$i]['name'] = $files['name'][$key]; $newfiles[$i]['type'] = $files['type'][$key]; $newfiles[$i]['tmp_name'] = $files['tmp_name'][$key]; @@ -115,107 +117,106 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0 $newfiles[$i]['size'] = $files['size'][$key]; $i++; } //foreach 第2層 end - } - $max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M) - $allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF', 'docx', 'doc', 'pdf'); //設定允許上傳檔案的類型 + } + $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M) + $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF', 'docx', 'doc', 'pdf'); //設定允許上傳檔案的類型 $path = '../images/contracts_new_files/'; - if (!file_exists($path)): mkdir($path); endif; + if (!file_exists($path)) : mkdir($path); + endif; $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息 $datetime = (string)date('YmdHis'); $files_id = 'm' . $datetime; // 保養=>b + 日期時間 - foreach( $newfiles as $key => $file ){ - $randNum = rand(1000,9999); - $randEnglish = $englisharr[rand(0,25)]; - $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name']; - $msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name ); - if($msg==1){ + foreach ($newfiles as $key => $file) { + $randNum = rand(1000, 9999); + $randEnglish = $englisharr[rand(0, 25)]; + $file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name']; + $msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name); + if ($msg == 1) { $msg = '檔案傳送成功!'; $sql_str = "INSERT INTO contract_apply_files (contract_id, contract_type, file_name, file_mime, file_size, created_at, created_by) VALUES (:contract_id, :contract_type, :file_name, :file_mime, :file_size, :created_at, :created_by)"; - $stmt = $conn -> prepare($sql_str); - $stmt -> bindParam(':contract_id' ,$contract_apply_id); - $stmt -> bindParam(':contract_type' ,$contract_type); - $stmt -> bindParam(':file_name' ,$file_name); - $stmt -> bindParam(':file_mime' ,$file['type']); - $stmt -> bindParam(':file_size' ,$file['size']); - $stmt -> bindParam(':created_at' ,$created_at); - $stmt -> bindParam(':created_by' ,$created_by); - $stmt ->execute(); - }else{ + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':contract_id', $contract_apply_id); + $stmt->bindParam(':contract_type', $contract_type); + $stmt->bindParam(':file_name', $file_name); + $stmt->bindParam(':file_mime', $file['type']); + $stmt->bindParam(':file_size', $file['size']); + $stmt->bindParam(':created_at', $created_at); + $stmt->bindParam(':created_by', $created_by); + $stmt->execute(); + } else { throw new PDOException('檔案上傳失敗:' . $msg); } - $msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '
'; - $src_name = $path.$file['name']; - if( file_exists($src_name) ){ + $msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '
'; + $src_name = $path . $file['name']; + if (file_exists($src_name)) { //副檔名 - $extname = pathinfo($src_name, PATHINFO_EXTENSION); + $extname = pathinfo($src_name, PATHINFO_EXTENSION); //主檔名 - $basename = basename($src_name, '.'.$extname); + $basename = basename($src_name, '.' . $extname); } } } // -----處理檔案上傳 END----- header("HTTP/1.1 201 success!"); $conn->commit(); - }else{ + } else { $sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, total_items=:total_items, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by WHERE mid = :mid"; - $stmt = $conn -> prepare($sql_str); - $stmt ->bindParam(':mid', $mid); - $stmt ->bindParam(':status', $status); - $stmt ->bindParam(':apply_date', $apply_date); - $stmt ->bindParam(':apply_type', $apply_type); - $stmt ->bindParam(':case_name', $case_name); - $stmt ->bindParam(':customer', $customer); - $stmt ->bindParam(':manager', $manager); - $stmt ->bindParam(':vat', $vat); - $stmt ->bindParam(':total_price', $total_price); - $stmt ->bindParam(':total_items', $total_items); - $stmt ->bindParam(':buy_fee', $buy_fee); - $stmt ->bindParam(':install_fee', $install_fee); - $stmt ->bindParam(':contact_address', $contact_address); - $stmt ->bindParam(':workdeadline_a', $workdeadline_a); - $stmt ->bindParam(':workdeadline_b', $workdeadline_b); - $stmt ->bindParam(':test_time', $test_time); - $stmt ->bindParam(':freedeadline', $freedeadline); - $stmt ->bindParam(':trade_address', $trade_address); - $stmt ->bindParam(':tradedeadline', $tradedeadline); - $stmt ->bindParam(':secondPayDeadline', $secondPayDeadline); - $stmt ->bindParam(':progress', $progress); - $stmt ->bindParam(':person', $salesman); - $stmt ->bindParam(':personname', $salesmanname); - $stmt ->bindParam(':submit_date', $submit_date); - $stmt ->bindParam(':updated_at', $updated_at); - $stmt ->bindParam(':updated_by', $updated_by); - $stmt ->execute(); + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->bindParam(':status', $status); + $stmt->bindParam(':apply_date', $apply_date); + $stmt->bindParam(':apply_type', $apply_type); + $stmt->bindParam(':case_name', $case_name); + $stmt->bindParam(':customer', $customer); + $stmt->bindParam(':manager', $manager); + $stmt->bindParam(':vat', $vat); + $stmt->bindParam(':total_price', $total_price); + $stmt->bindParam(':total_items', $total_items); + $stmt->bindParam(':buy_fee', $buy_fee); + $stmt->bindParam(':install_fee', $install_fee); + $stmt->bindParam(':contact_address', $contact_address); + $stmt->bindParam(':workdeadline_a', $workdeadline_a); + $stmt->bindParam(':workdeadline_b', $workdeadline_b); + $stmt->bindParam(':test_time', $test_time); + $stmt->bindParam(':freedeadline', $freedeadline); + $stmt->bindParam(':trade_address', $trade_address); + $stmt->bindParam(':tradedeadline', $tradedeadline); + $stmt->bindParam(':secondPayDeadline', $secondPayDeadline); + $stmt->bindParam(':progress', $progress); + $stmt->bindParam(':person', $salesman); + $stmt->bindParam(':personname', $salesmanname); + $stmt->bindParam(':submit_date', $submit_date); + $stmt->bindParam(':updated_at', $updated_at); + $stmt->bindParam(':updated_by', $updated_by); + $stmt->execute(); - foreach($pays as $idx=>$pay){ + foreach ($pays as $idx => $pay) { $kind = $idx; $sql_str = "UPDATE contract_new_apply_pays SET pay_scale = :pay_scale, pay_amount = :pay_amount, pay_period = :pay_period, condition_date = :condition_date, updated_at = :updated_at, updated_by = :updated_by WHERE mid = :mid AND pay_kind = :pay_kind"; - $stmt = $conn -> prepare($sql_str); - $stmt ->bindParam(':mid', $mid); - $stmt ->bindParam(':pay_kind', $kind); - $stmt ->bindParam(':pay_scale', $pay['scale']); - $stmt ->bindParam(':pay_amount', $pay['amount']); - $stmt ->bindParam(':pay_period', $pay['pay_period']); - $stmt ->bindParam(':condition_date', $pay['condition_date']); - $stmt ->bindParam(':updated_at', $updated_at); - $stmt ->bindParam(':updated_by', $updated_by); - $stmt ->execute(); + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':mid', $mid); + $stmt->bindParam(':pay_kind', $kind); + $stmt->bindParam(':pay_scale', $pay['scale']); + $stmt->bindParam(':pay_amount', $pay['amount']); + $stmt->bindParam(':pay_period', $pay['pay_period']); + $stmt->bindParam(':condition_date', $pay['condition_date']); + $stmt->bindParam(':updated_at', $updated_at); + $stmt->bindParam(':updated_by', $updated_by); + $stmt->execute(); } header("HTTP/1.1 201 success!"); $conn->commit(); } - }catch(PDOException $e){ + } catch (PDOException $e) { $conn->rollback(); header("HTTP/1.1 500 failed!"); echo $e->getMessage(); - die('Error!:'.$e->getMessage()); + die('Error!:' . $e->getMessage()); } - - } //結案同意 -if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 3) ){ +if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 3)) { $status = $_POST['status']; $vol_no = $_POST['vol_no']; $contract_new_apply_id = $_POST['contract_new_apply_id']; @@ -224,27 +225,27 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 3 $user_id = $_POST['review_person_id']; $review_date = date('Y-m-d H:i:s'); $conn->beginTransaction(); - try{ + try { $sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_comment=:review_comment, review_person_id=:review_person_id, review_date=:review_date WHERE id = :contract_new_apply_id"; - $stmt = $conn -> prepare($sql_str); - $stmt ->bindParam(':status', $status); - $stmt ->bindParam(':progress', $progress); - $stmt ->bindParam(':contract_new_apply_id', $contract_new_apply_id); - $stmt ->bindParam(':review_comment', $review_comment); - $stmt ->bindParam(':review_person_id', $user_id); - $stmt ->bindParam(':review_date', $review_date); + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':status', $status); + $stmt->bindParam(':progress', $progress); + $stmt->bindParam(':contract_new_apply_id', $contract_new_apply_id); + $stmt->bindParam(':review_comment', $review_comment); + $stmt->bindParam(':review_person_id', $user_id); + $stmt->bindParam(':review_date', $review_date); $stmt->execute(); header("HTTP/1.1 200 success!"); $conn->commit(); - }catch(PDOException $e){ + } catch (PDOException $e) { $conn->rollback(); header("HTTP/1.1 500 failed!"); echo $e->getMessage(); - die('Error!:'.$e->getMessage()); + die('Error!:' . $e->getMessage()); } } //結案不同意(退回) -if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 2) ){ +if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 2)) { $status = $_POST['status']; $vol_no = $_POST['vol_no']; $contract_new_apply_id = $_POST['contract_new_apply_id']; @@ -253,22 +254,22 @@ if(isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 2 $user_id = $_POST['review_person_id']; $review_date = date('Y-m-d H:i:s'); $conn->beginTransaction(); - try{ + try { $sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_comment=:review_comment, review_person_id=:review_person_id, review_date=:review_date WHERE id = :contract_new_apply_id"; - $stmt = $conn -> prepare($sql_str); - $stmt ->bindParam(':status', $status); - $stmt ->bindParam(':progress', $progress); - $stmt ->bindParam(':contract_new_apply_id', $contract_new_apply_id); - $stmt ->bindParam(':review_comment', $review_comment); - $stmt ->bindParam(':review_person_id', $user_id); - $stmt ->bindParam(':review_date', $review_date); + $stmt = $conn->prepare($sql_str); + $stmt->bindParam(':status', $status); + $stmt->bindParam(':progress', $progress); + $stmt->bindParam(':contract_new_apply_id', $contract_new_apply_id); + $stmt->bindParam(':review_comment', $review_comment); + $stmt->bindParam(':review_person_id', $user_id); + $stmt->bindParam(':review_date', $review_date); $stmt->execute(); header("HTTP/1.1 200 success!"); $conn->commit(); - }catch(PDOException $e){ + } catch (PDOException $e) { $conn->rollback(); header("HTTP/1.1 500 failed!"); echo $e->getMessage(); - die('Error!:'.$e->getMessage()); + die('Error!:' . $e->getMessage()); } -} \ No newline at end of file +}