diff --git a/wms/con/FormHelper.php b/wms/con/FormHelper.php
new file mode 100644
index 00000000..8025239a
--- /dev/null
+++ b/wms/con/FormHelper.php
@@ -0,0 +1,509 @@
+ 'post', 'accept-charset' => 'utf-8'), $attributes);
+
+ return "
';
+ }
+
+ /**
+ * Creates a label for an input
+ *
+ * @param string $text The label text
+ * @param string $fieldName Name of the input element
+ * @param array $attributes HTML attributes
+ * @return string
+ */
+ public static function label($text, $fieldName = null, array $attributes = array())
+ {
+ if (!isset($attributes['for']) && $fieldName !== null) {
+ $attributes['for'] = static::autoId($fieldName);
+ }
+ if (!isset($attributes['id']) && isset($attributes['for'])) {
+ $attributes['id'] = $attributes['for'] . '-label';
+ }
+
+ return self::tag('label', $attributes, $text);
+ }
+
+ /**
+ * Creates a text field
+ *
+ * @param string $name
+ * @param string $value
+ * @param array $attributes HTML attributes
+ * @return string
+ */
+ public static function text($name, $value = null, array $attributes = array(),$type='text')
+ {
+ $attributes = array_merge(array(
+ 'id' => static::autoId($name),
+ 'name' => $name,
+ 'type' => $type,
+ 'value' => $value,
+ ), $attributes);
+
+ return self::tag('input', $attributes);
+ }
+
+ /**
+ * Creates a password input field
+ *
+ * @static
+ * @param string $name
+ * @param string $value
+ * @param array $attributes HTML attributes
+ * @return string
+ */
+ public static function password($name, $value = null, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'id' => static::autoId($name),
+ 'name' => $name,
+ 'type' => 'password',
+ 'value' => $value,
+ ), $attributes);
+
+ return self::tag('input', $attributes);
+ }
+
+ /**
+ * Creates a hidden input field
+ *
+ * @static
+ * @param string $name
+ * @param string $value
+ * @param array $attributes
+ * @return string
+ */
+ public static function hidden($name, $value, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'id' => static::autoId($name),
+ 'name' => $name,
+ 'type' => 'hidden',
+ 'value' => $value,
+ ), $attributes);
+
+ return self::tag('input', $attributes);
+ }
+
+ /**
+ * Creates a textarea
+ *
+ * @param string $name
+ * @param string $text
+ * @param array $attributes HTML attributes
+ * @return string
+ */
+ public static function textArea($name, $text = null, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'id' => static::autoId($name),
+ 'name' => $name,
+ ), $attributes);
+
+ return self::tag('textarea', $attributes, (string)$text);
+ }
+
+ /**
+ * Creates a check box.
+ * By default creates a hidden field with the value of 0, so that the field is present in $_POST even when not checked
+ *
+ * @param string $name
+ * @param bool $checked
+ * @param mixed $value Checked value
+ * @param array $attributes HTML attributes
+ * @param bool|string $withHiddenField Pass false to omit the hidden field or "array" to return both parts as an array
+ * @return string
+ */
+ public static function checkBox(
+ $name,
+ $checked = false,
+ $value = 1,
+ array $attributes = array(),
+ $withHiddenField = true
+ ) {
+ $auto_id = static::autoId($name);
+
+ $checkboxAttributes = array_merge(array(
+ 'name' => $name,
+ 'type' => 'checkbox',
+ 'value' => $value,
+ 'id' => $auto_id,
+ 'checked' => (bool)$checked,
+ ), $attributes);
+ $checkbox = self::tag('input', $checkboxAttributes);
+
+ if ($withHiddenField === false) {
+ return $checkbox;
+ }
+
+ $hiddenAttributes = array(
+ 'name' => $name,
+ 'type' => 'hidden',
+ 'value' => 0,
+ 'id' => $auto_id . '-hidden',
+ );
+ $hidden = self::tag('input', $hiddenAttributes);
+
+ return $withHiddenField === 'array'
+ ? array($hidden, $checkbox)
+ : $hidden . $checkbox;
+ }
+
+ /**
+ * Creates multiple checkboxes for a has-many association.
+ *
+ * @param string $name
+ * @param array $collection
+ * @param array|\Traversable $checked Collection of checked values
+ * @param array $labelAttributes
+ * @param bool $returnAsArray
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public static function collectionCheckBoxes($name, array $collection, $checked, array $labelAttributes = array(), $returnAsArray = false)
+ {
+ // TODO: Does this check cover all options?
+ if (!(is_array($checked) || $checked instanceof \Traversable)) {
+ throw new \InvalidArgumentException("$name must be an array or Traversable!");
+ }
+
+ $checkBoxes = array();
+ foreach ($collection as $value => $label) {
+ $checkBoxes[] = self::tag(
+ 'label',
+ $labelAttributes,
+ FormHelper::checkBox("{$name}[]", in_array($value, $checked, true), $value, array(), false) . self::escape($label),
+ false
+ );
+ }
+
+ return $returnAsArray ? $checkBoxes : implode('', $checkBoxes);
+ }
+
+ /**
+ * Creates a radio button
+ *
+ * @static
+ * @param string $name
+ * @param string $value
+ * @param bool $checked
+ * @param array $attributes
+ * @return string
+ */
+ public static function radio($name, $value, $checked = false, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'type' => 'radio',
+ 'name' => $name,
+ 'value' => $value,
+ 'checked' => (bool)$checked,
+ ), $attributes);
+
+ return self::tag('input', $attributes);
+ }
+
+ /**
+ * Creates multiple radio buttons with labels
+ *
+ * @static
+ * @param string $name
+ * @param array $collection
+ * @param mixed $checked Checked value
+ * @param array $labelAttributes
+ * @param bool $returnAsArray
+ * @return array|string
+ */
+ public static function collectionRadios($name, array $collection, $checked, array $labelAttributes = array(), $returnAsArray = false)
+ {
+ $radioButtons = array();
+ foreach ($collection as $value => $label) {
+ $radioButtons[] = self::tag(
+ 'label',
+ $labelAttributes,
+ FormHelper::radio($name, $value, $value === $checked) . self::escape($label),
+ false
+ );
+ }
+
+ return $returnAsArray ? $radioButtons : implode('', $radioButtons);
+ }
+
+ /**
+ * Creates a select tag
+ *
+ * // Simple select
+ * select('coffee_id', array('b' => 'black', 'w' => 'white'));
+ *
+ * With option groups
+ * select('beverage', array(
+ * 'Coffee' => array('bc' => 'black', 'wc' => 'white'),
+ * 'Tea' => array('gt' => 'Green', 'bt' => 'Black'),
+ * ));
+ *
+ *
+ * @param string $name Name of the attribute
+ * @param array $collection An associative array used for the option values
+ * @param mixed $selected Selected option Can be array or scalar
+ * @param array $attributes HTML attributes
+ * @return string
+ */
+ public static function select($name, array $collection, $selected = null, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'name' => $name,
+ 'id' => static::autoId($name),
+ 'multiple' => false,
+ ), $attributes);
+
+ if (is_string($selected) || is_numeric($selected)) {
+ $selected = array($selected => 1);
+ } else if (is_array($selected)) {
+ $selected = array_flip($selected);
+ } else {
+ $selected = array();
+ }
+
+ $content = self::option('', '', $selected);
+ foreach ($collection as $value => $element) {
+ // Element is an optgroup
+ $content .= self::option($element['value'], $element['label'], $selected);
+ }
+
+ return self::tag('select', $attributes, $content, false);
+ }
+
+ /**
+ * Creates an option tag
+ *
+ * @param string $value
+ * @param string $label
+ * @param array $selected
+ * @return string
+ */
+ private static function option($value, $label, $selected)
+ {
+ // Special handling of option tag contents to enable indentation with
+ //$label = str_replace(' ', ' ', self::escape($label));
+
+ return self::tag(
+ 'option',
+ array(
+ 'value' => $value,
+ 'selected' => isset($selected[$value]),
+ ),
+ $label,
+ false
+ );
+ }
+
+ /**
+ * Creates a file input field
+ *
+ * @static
+ * @param string $name
+ * @param array $attributes HTML attributes
+ * @return string
+ */
+ public static function file($name, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'type' => 'file',
+ 'name' => $name,
+ 'id' => static::autoId($name),
+ ), $attributes);
+
+ return self::tag('input', $attributes);
+ }
+
+ public static function button($name, $text, array $attributes = array())
+ {
+ $attributes = array_merge(array(
+ 'id' => static::autoId($name),
+ 'name' => $name,
+ ), $attributes);
+
+ return self::tag('button', $attributes, $text);
+ }
+
+
+ /**
+ * Generate an ID given the name of an input
+ *
+ * @static
+ * @param string $name
+ * @return string|null
+ */
+ public static function autoId($name)
+ {
+ // Don't set an id on collection inputs
+ if (strpos($name, '[]') !== false) {
+ return null;
+ }
+
+ // Hyphenate array keys, for example model[field][other_field] => model-field-other_field
+ $name = preg_replace('/\[([^]]+)\]/u', '-\\1', $name);
+
+ return $name;
+ }
+
+ /**
+ * Generates an HTML tag
+ *
+ * @param string $tagName Name of the tag
+ * @param array $attributes HTML attributes
+ * @param string $content Content of the tag. Omit to create a self-closing tag
+ * @param bool $escape_content
+ *
+ * @see attributes()
+ *
+ * @return string
+ */
+ public static function tag($tagName, array $attributes = array(), $content = null, $escape_content = true)
+ {
+ $result = '<' . $tagName . static::attributes($attributes) . '>';
+
+ if ($content !== null) {
+ $result .= ($escape_content ? static::escape($content) : $content) . '' . $tagName . '>';
+ }
+
+ return $result;
+ }
+
+ /**
+ * Converts an array of HTML attributes to a string
+ *
+ * If an attribute is false or null, it will not be set.
+ *
+ * If an attribute is true or is passed without a key, it will
+ * be set without an explicit value (useful for checked, disabled, ..)
+ *
+ * If an array is passed as a value, it will be joined using spaces
+ *
+ * Note: Starts with a space
+ *
+ * Html::attributes(array('id' => 'some-id', 'selected' => false, 'disabled' => true, 'class' => array('a', 'b')));
+ * //=> ' id="some-id" disabled class="a b"'
+ *
+ *
+ * @param array $attributes Associative array of attributes
+ *
+ * @return string
+ */
+ public static function attributes(array $attributes)
+ {
+ $result = '';
+
+ foreach ($attributes as $attribute => $value) {
+ if ($value === false || $value === null) continue;
+ if ($value === true) {
+ $result .= ' ' . $attribute;
+ } else if (is_numeric($attribute)) {
+ $result .= ' ' . $value;
+ } else {
+ if (is_array($value)) { // support cases like 'class' => array('one', 'two')
+ $value = implode(' ', $value);
+ }
+ $result .= ' ' . $attribute . '=\'' . static::escape($value) . '\'';
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Escapes a string for output in HTML
+ *
+ * @static
+ * @param string $string
+ * @return string
+ */
+ public static function escape($string)
+ {
+ return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
+ }
+ /**
+ * 输出表单标题
+ *
+ * @param string $title
+ * @return void
+ */
+ public static function formTitle(string $title)
+ {
+ return '
+ ';
+ }
+ /**
+ * 输出行标题
+ *
+ * @param string $title
+ * @return void
+ */
+ public static function formRowTitle(string $title)
+ {
+ return '
+
+
+ ';
+ }
+ /**
+ * 输出行内容
+ *
+ * @return void
+ */
+ public static function formRowContent($fieldName, string $fieldValue, string $key)
+ {
+ return '
+
+
+
+ ';
+ }
+ /**
+ * 生成Row
+ *
+ * @return void
+ */
+ public function formRow()
+ {
+ $_div = " ";
+ $_div .= "
";
+ }
+}
diff --git a/wms/con/MICalculator.php b/wms/con/MICalculator.php
new file mode 100644
index 00000000..73283ee9
--- /dev/null
+++ b/wms/con/MICalculator.php
@@ -0,0 +1,322 @@
+ 'fail',
+ 'message' => '無此項目,請聯係業務部創建MI'
+ ];
+ }
+ public function success($price)
+ {
+ return [
+ 'status' => 'ok',
+ 'price' => $price
+ ];
+ }
+}
diff --git a/wms/con/MSCalculator.php b/wms/con/MSCalculator.php
new file mode 100644
index 00000000..a5415e76
--- /dev/null
+++ b/wms/con/MSCalculator.php
@@ -0,0 +1,322 @@
+ 'fail',
+ 'message' => '無此項目,請聯係業務部創建標準成本'
+ ];
+ }
+ public function success($price)
+ {
+ return [
+ 'status' => 'ok',
+ 'price' => $price
+ ];
+ }
+}
diff --git a/wms/con/apply.php b/wms/con/apply.php
new file mode 100644
index 00000000..451eb877
--- /dev/null
+++ b/wms/con/apply.php
@@ -0,0 +1,22 @@
+initWorkFlow(ID);
+
+//加载视图
+
+echo '查看全部待签';
diff --git a/wms/con/apply_form.php b/wms/con/apply_form.php
new file mode 100644
index 00000000..0d43d345
--- /dev/null
+++ b/wms/con/apply_form.php
@@ -0,0 +1,770 @@
+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[]', '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']],
+ '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 = " ";
+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']);
+ // : "";
+ $cmecRow .= " $_input | ";
+ if ((++$j % $col_count) == 0) {
+ if ($j == $col_count) $cmecRow .= " | ";
+ $cmecRow .= "
";
+ }
+}
+
+
+$cmecRow .= "
";
+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;
+}
+
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wms/con/async_req.php b/wms/con/async_req.php
new file mode 100644
index 00000000..0d693a1e
--- /dev/null
+++ b/wms/con/async_req.php
@@ -0,0 +1,20 @@
+ $code_name]);
+}
diff --git a/wms/con/con_maintance_examine_clear.php b/wms/con/con_maintance_examine_clear.php
new file mode 100644
index 00000000..f2faf705
--- /dev/null
+++ b/wms/con/con_maintance_examine_clear.php
@@ -0,0 +1,14 @@
+ ['label' => "电梯注册代码", "value" => "", "tag" => 'text', 'class' => ''],
+ 'brand' => ['label' => "品牌", "value" => "", "tag" => 'text', 'class' => ''],
+ 'spec' => ['label' => "规格型号", "value" => "", "tag" => 'text', 'class' => ''],
+ 'weight' => ['label' => "载重", "value" => "", "tag" => 'text', 'class' => ''],
+ 'speed' => ['label' => "速度", "value" => "", "tag" => 'text', 'class' => ''],
+ 'stop' => ['label' => "停数", "value" => "", "tag" => 'text', 'class' => ''],
+ 'useful_years' => ['label' => "使用年限", "value" => "", "tag" => 'text', 'class' => ''],
+ 'last_check_date' => ['label' => "最近一次年检日期", "value" => "", "tag" => 'text', 'class' => ''],
+ 'speed_governors_check_expense' => ['label' => "限速器校验费", "value" => "", "tag" => 'text', 'class' => ''],
+];
+$con_maintance_examine_clear = DB::result("SELECT * FROM con_maintance_examine_clear where 1=1 and cmstatus='Y' ");
diff --git a/wms/con/crmm06_submit.php b/wms/con/crmm06_submit.php
new file mode 100644
index 00000000..79b54de8
--- /dev/null
+++ b/wms/con/crmm06_submit.php
@@ -0,0 +1,21 @@
+fillable;
+foreach ($cols as $col) {
+ if (!in_array($col, array_keys($request))) {
+ continue;
+ }
+ $data[$col] = empty($request[$col]) ? NULL : $request[$col];
+}
+$hecm->create( $data);
+
+
+echo"";
diff --git a/wms/con/list.php b/wms/con/list.php
new file mode 100644
index 00000000..a019243e
--- /dev/null
+++ b/wms/con/list.php
@@ -0,0 +1,168 @@
+ $item['system_id'], 'system_name' => $item['system_name']);
+}, $res_get);
+$system_name_opt = (array_unique($system_name_opt, SORT_REGULAR));
+
+
+$flow_name_opt = array_map(function ($item) {
+ return array('flow_id' => $item['flow_id'], 'flow_name' => $item['flow_name']);
+}, $res_get);
+$flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR));
+
+?>
+
+
+
\ No newline at end of file
diff --git a/wms/con/model/ConMaintanceExamineApplyModel.php b/wms/con/model/ConMaintanceExamineApplyModel.php
new file mode 100644
index 00000000..f4824a9a
--- /dev/null
+++ b/wms/con/model/ConMaintanceExamineApplyModel.php
@@ -0,0 +1,29 @@
+fillable as $col) {
+ $_data[$col] = empty($data[$col]) ? '' : $data[$col];
+ }
+ DB::insert_table($this->table, $_data);
+ }
+ /**
+ * 创建或更新
+ *
+ * @return void
+ */
+ public function createOrUpdate(array $keyCol, array $data)
+ {
+ list($cnt) = DB::fields(
+ "select count(*) from $this->table where " . $keyCol[0] . " = '" . $keyCol[1] . "'"
+ );
+ if ($cnt == 0) {
+ self::create(array_merge($data, $keyCol));
+ }
+ }
+
+ public function update(array $keyCol, array $data)
+ {
+ $_data = [];
+ foreach ($this->fillable as $col) {
+ if (in_array($col, array_keys($data))) $_data[$col] = empty($data[$col]) ? '' : $data[$col];
+ }
+ DB::update_table($this->table, $_data, $keyCol[0] . '=\'' . $keyCol[1] . '\'');
+ }
+ /**
+ * 获取记录
+ *
+ * @param array $cond
+ * @return void
+ */
+ public function get(array $cond)
+ {
+ return [];
+ }
+}
diff --git a/wms/con/query_form.php b/wms/con/query_form.php
new file mode 100644
index 00000000..2c9a47b6
--- /dev/null
+++ b/wms/con/query_form.php
@@ -0,0 +1,510 @@
+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;
+}
+
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wms/con/review_apply_form.php b/wms/con/review_apply_form.php
new file mode 100644
index 00000000..aac97e74
--- /dev/null
+++ b/wms/con/review_apply_form.php
@@ -0,0 +1,507 @@
+user_id;
+$apply_key = 'MB23060422';
+require_once './FormHelper.php';
+require_once './wf_common.php';
+#系统ID
+$system_id = 'con';
+#流程ID
+$flow_id = 'con01';
+#表单号 $form_id;
+$form_id = "";
+
+$wf = new WorkFlow($system_id, $flow_id, $form_id);
+$wf->initWorkFlow($user_id);
+
+$form_key = $wf->flowContext->getFormKey();
+
+#获取签核意见
+$assign_opinions = Assign::get_records($form_key);
+
+#会签部门意见
+$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key);
+
+$flowName = $wf->getFlowName();
+$assigner = $wf->getAssignerList();
+$assign_status = $wf->getAssignStatus($assigner);
+$if_show_assign = true;
+
+#是否可会签
+$isSplitable = $wf->isSplitable();
+
+//表单数据
+#客户表
+#1.电梯品牌选项
+$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by convert(content using gbk) asc ";
+$elevator_brand_opt = DB::result($sql);
+#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='hope_contract_customer_kind'";
+$contract_kind_opt = DB::result($sql);
+
+#抓取有
+
+$where = " and apply_key='$apply_key'";
+$sql = "SELECT * FROM con_maintance_examine_apply where 1=1 $where ";
+$res_cmea = DB::result($sql);
+$cmea = empty($res_cmea) ? [] : $res_cmea[0];
+#写入 con_maintance_review_apply
+#获取评审单号
+//$cmea['payment_kind']; //付款方式
+//月付 12; 季付 三月一次;半年付 6个月一次, 年付 12个月
+//
+$insert_data = [
+ 'apply_key' => $apply_key,
+ 'vol_no' => $cmea['vol_no'],
+ 'form_key' => $cmea,
+ 'address' => $cmea['address'],
+ 'case_name' => $cmea['case_name'],
+ 'num' => $cmea['num'],
+ 'brand' => $cmea['brand'],
+ 'customer' => $hope_contract['customer'],
+ 'salesman' => $hope_contract['salesman'],
+ 'progress_remark' => $hope_contract['progress_remark'],
+ 'platform_company' => empty(trim($hope_contract['common_platform_company'])) ? $hope_contract['sales_platform_company'] : $hope_contract['common_platform_company'],
+ 'platforom_company_tel' => empty(trim($hope_contract['common_platform_tel'])) ? $hope_contract['sales_platform_tel'] : $hope_contract['common_platform_tel']
+
+];
+//var_dump($insert_data);
+DB::insert_table('con_maintance_examine_apply', $insert_data);
+// $ins_sql="INSERT INTO `adm824727563_db`.`hope_contract_customer` (`vol_no`, `customer_kind`, `num`, `case_name`, `customer`,
+// `salesman`, `address`, `lm_name`, `lm_tel`, `pre_order_date`, `order_rate`, `visit_date`, `progress_remark`, `common_platform_lm`, `common_platform_tel`,
+// `common_platform_company`, `sales_platform_lm`, `sales_platform_tel`, `sales_platform_company`, `is_strategic_customer`,
+// `strategic_customer`, `brand`, `partya_end_date`, `created_at`, `creator`, `updated_at`) VALUES ('Q2305047', '1', '47', '辰富佳苑', '上海新桃源物业管理有限公司', 'P0053', '松江广富林路3939弄', '周总', '13482376166', '2023-06-30 00:00:00', '中', '2023-05-23 18:13:05', '该物业为国有企业,本次 拜访物业沈经理引荐周总。经过与周总交流要求我司进行投标,今天进公司注册云采购账号,等公示后进一步了解如何投标再与周总会面细谈。', NULL, NULL, NULL, NULL, NULL, NULL, 'N', NULL, '永大', '2023-06-30 00:00:00', '2023-05-25 10:15:31', 'P0053', '2023-05-29 14:22:35');
+// ";
+$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']],
+ //'form_key' => ['label' => "表单号", "value" => "", "tag" => 'text', 'attr'=>['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', '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']],
+ 'elevator_kind' => ['label' => "电梯类型", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt],
+ 'contract_kind' => ['label' => "合约性质", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt],
+ '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']],
+ 'stand_price' => ['label' => "标准价格(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
+ 'contract_price' => ['label' => "合约报价(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
+ 'sold_price' => ['label' => "合约成交价(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
+ 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt],
+ 'commission_expense' => ['label' => "加盟分成费(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
+ 'management_expense' => ['label' => "我司管理费(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']],
+ 'annual_survey_expense' => ['label' => "年检费用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'date form-control form-control-sm ']],
+ 'service_expense' => ['label' => "服务费", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm ']],
+ // 'postgress_remark' => ['label' => "洽商进度", "value" => "", "tag" => 'text', 'attr'=>['class' => 'form-control form-control-sm' ]]
+
+];
+$vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no'];
+$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[]', '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],
+ 'spec' => ['label' => "规格型号", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm']],
+ 'weight' => ['label' => "载重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'class' => 'form-control form-control-sm']],
+ 'speed' => ['label' => "速度(m/s)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm']],
+ 'stop' => ['label' => "停数", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']],
+ 'elevator_num' => ['label' => "台数", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']],
+ 'useful_years' => ['label' => "使用年限", "value" => "", "tag" => 'number', 'attr' => ['name' => 'useful_years[]', 'class' => 'form-control form-control-sm']],
+ 'last_check_date' => ['label' => "最近一次年检日期", "value" => "", "tag" => 'date', 'attr' => ['name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']],
+ 'speed_governors_check_expense' => ['label' => "限速器校验费", "value" => "", "tag" => 'number', 'attr' => ['name' => 'speed_governors_check_expense[]', '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' ");
+$i = 0;
+$cmecRow = " ";
+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']);
+ // : "";
+ $cmecRow .= " $_input | ";
+}
+$cmecRow .= " | ";
+function base_url($url)
+{
+ return "https://web.platform-cn.com/static/" . $url;
+}
+function get_sequnece_no($seq_name = '', $p_yyyymm = '')
+{
+
+ if (empty($p_yyyymm) || empty($seq_name)) return null;
+ #当前年月
+ //echo "select yyyymm from sequence where seq_name='$seq_name' ";
+ 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(nextval('$seq_name'),2)) seq_no ");
+
+
+ return $seq_no;
+}
+
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wms/con/sign_form.php b/wms/con/sign_form.php
new file mode 100644
index 00000000..6da977bb
--- /dev/null
+++ b/wms/con/sign_form.php
@@ -0,0 +1,575 @@
+vol_no;
+require_once './FormHelper.php';
+require_once '../con/MICalculator.php';
+
+require_once './wf_common.php';
+$flow = new Flow($form_key);
+// 當前節點簽核開始
+
+$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key);
+#獲取簽核意見
+$assign_opinions = Assign::get_records($form_key);
+$flowName = $wf->getFlowName();
+
+//表單數據
+#客戶表
+#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']],
+
+ 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt],
+
+];
+$where = " and form_key='$form_key'";
+
+$sql = "SELECT " . implode(',', array_keys($editableColumn)) .
+" ,progress_remark 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' => "標準價格(元/月)", "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']],
+
+
+ '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' => ['required', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']],
+ 'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']],
+ 'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['required', '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,
+
+ 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='" . $data['apply_key'] . "' and cmstatus='Y'");
+
+#總臺數
+$count = count($con_maintance_examine_clear);
+$total_sold_price = 0;
+#總成交價
+#總標準價格
+$total_stand_price = 0;
+#總標準成本
+foreach ($con_maintance_examine_clear as $val) {
+ $total_sold_price += $val['sold_price'];
+ $total_stand_price += $val['stand_price'];
+}
+$total_discount_rate = $total_sold_price == 0 ? 0
+ : (100*round($total_sold_price / $total_stand_price, 4)) . "%";
+
+$wf->setFormData(['discount' => substr($total_discount_rate, 0, -1)]);
+$assigner = $wf->getAssignerList();
+$assign_status = $wf->getAssignStatus($assigner);
+
+
+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;
+ #當前年月
+ //echo "select yyyymm from sequence where seq_name='$seq_name' ";
+ 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(nextval('$seq_name'),2)) seq_no ");
+
+
+ return $seq_no;
+}
+
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wms/con/sign_list.php b/wms/con/sign_list.php
new file mode 100644
index 00000000..90c7295b
--- /dev/null
+++ b/wms/con/sign_list.php
@@ -0,0 +1,149 @@
+ [
+ 'label' => "評審單號", "value" => "", "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']],
+ 'num' => ['label' => "電梯臺數", "value" => "", "tag" => 'number', 'attr' => ['required', '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']],
+ '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']],
+ '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],
+
+];
+// 設置一個空陣列來放資料
+$data = array();
+
+$salesman = empty($_GET['salesman']) ? $user_id : $_GET['salesman'];
+//$where = " and salesman like '%'";
+$where = " and salesman = '$salesman'";
+
+// 可瀏覽全部資料的部門
+$depart_arr = ["220"];
+$sql = "select department_id from account where accountid = '$user_id'";
+$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") $where = "";
+
+$sql = "SELECT
+ apply_key,
+ vol_no,
+ address,
+case_name,
+brand ,
+num ,
+f_return_name(salesman) salesman,
+f_return_content('maintain_kind',maintain_kind ) maintain_kind,
+date_format(contract_begin_date,'%Y/%m/%d') contract_begin_date,
+date_format(contract_end_date,'%Y/%m/%d') contract_end_date ,
+f_return_content('contract_kind',contract_kind ) contract_kind,
+platform_company,
+platforom_company_tel,
+form_key,
+
+f_return_content('payment_kind',payment_kind ) payment_kind FROM $table
+ where 1=1 $where ORDER BY vol_no";
+
+$data = mysqli_query($link, $sql);
+?>
+
+Please fill up the required field!";
+ } else {
+ header("Location:repair-index.php");
+ }
+ }
+
+?>
+
+
+
+
+
+There is no record!";
+endif;
+
+#代表結束連線
+mysqli_close($link);
+
+include "../footer.php";
+
+?>
\ No newline at end of file
diff --git a/wms/con/submit.php b/wms/con/submit.php
new file mode 100644
index 00000000..d1ae677b
--- /dev/null
+++ b/wms/con/submit.php
@@ -0,0 +1,69 @@
+update(['apply_key', $apply_key], array_diff_key($request, ['apply_key' => '']));
+//更新电梯列表
+if (!empty($request["reg_del"])) {
+ $register_code_del_arr = explode(",", rtrim($request["reg_del"], ","));
+ foreach ($register_code_del_arr as $val) {
+ $sql = "update con_maintance_examine_clear set cmstatus = 'D' where apply_key = '$apply_key' and register_code = '$val' and cmstatus <> 'D'";
+ DB::query($sql);
+ }
+}
+if (!empty($request['register_code']) && count($request['register_code']) > 0) {
+ $cmec = new ConMaintanceExamineClearModel();
+ for ($i = 0; $i < count($request['register_code']); $i++) {
+ $data = [
+ 'apply_key' => $request['apply_key']
+ ];
+ $cols = array_diff($cmec->fillable, ['apply_key']);
+ foreach ($cols as $col) {
+ $data[$col] = empty($request[$col][$i]) ? '' : $request[$col][$i];
+ if ($col=="annual_survey_expense") $data[$col] = '0.00';
+ }
+ $cmec->create($data);
+ }
+}
+
+//var_dump($_POST);
+//var_dump($_GET);
+
+if ($tosign) {
+ #流程开始,var_dump($request);
+ $flow = new Flow($request['form_key']);
+ // 当前节点签核开始
+ $wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $request['form_key']);
+ $wf->setFormData($request);
+ $wf->submit($request['next_users'], $request['assign_status'], $request['assign_opinion']);
+ //当前节点签核结束
+ $responses['flowName'] = $wf->getFlowName();
+ $responses['form_key'] = $request['form_key'];
+ //var_dump($request);
+ #結案發通知給營業員
+ if ($request['assign_status'] == 'F4') {
+
+ list($salesman, $case_name ) = DB::fields("select salesman ,case_name from con_maintance_examine_apply where apply_key='" . $apply_key. "' ");
+ $ins_notice_sql = "INSERT INTO `notice` ( `kind`,`title`, `content`, `permission`)
+ VALUES ( '1', '契約價審單結案通知(" .$case_name . ")', '契約價審單結案通知(" . $case_name . ")', ' $salesman')";
+ DB::query($ins_notice_sql);
+ // echo $ins_notice_sql;
+ }
+}
+echo "";
diff --git a/wms/con/success.php b/wms/con/success.php
new file mode 100644
index 00000000..96c2a2f2
--- /dev/null
+++ b/wms/con/success.php
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/wms/con/t.php b/wms/con/t.php
new file mode 100644
index 00000000..f6103f08
--- /dev/null
+++ b/wms/con/t.php
@@ -0,0 +1,84 @@
+ 'A',
+ 'floors' => 7,
+ 'speed' => 1,
+ 'persons' => 6,
+ 'weight' => 1000,
+ 'maintain_times' => 1,
+ 'maintain_months' => 12,
+ 'maintain_kind' => 2,
+ 'maintain_period' => 1, //默认为1月1次, 2是为2月一次
+ 'is_m1_bundle' => 'N',
+];
+*/
+/* //货梯
+$param = [
+
+ 'elevator_type' => 'B',
+ 'floors' => 7,
+ 'speed' => 1,
+ 'persons' => 6,
+ 'weight' => 1000,
+ 'maintain_times' => 1,
+ 'maintain_months' => 12,
+ 'maintain_kind' => 2,
+ 'maintain_period' => 1, //默认为1月1次, 2是为2月一次
+ 'is_m1_bundle' => 'N',
+];
+*/
+
+/*//病床梯
+$param = [
+
+ 'elevator_type' => 'C',
+ 'floors' => 28,
+ 'speed' => 1,
+ 'persons' => 6,
+ 'weight' => 1000,
+ 'maintain_times' => 2, //病床梯一月2次保养
+ 'maintain_months' => 12,
+ 'maintain_kind' => 2,
+ 'maintain_period' => 1, //默认为1月1次, 2是为2月一次
+ 'is_m1_bundle' => 'N',
+];*/
+
+/*//无机房
+$param = [
+ 'elevator_type' => 'D',
+ 'floors' => 3,
+ 'speed' => 1,
+ 'persons' => 6,
+ 'weight' => 1000,
+ 'maintain_times' => 1, //病床梯一月2次保养
+ 'maintain_months' => 12,
+ 'maintain_kind' => 3,
+ 'maintain_period' => 1, //默认为1月1次, 2是为2月一次
+ 'is_m1_bundle' => 'N',
+];
+
+*/
+//家用梯
+$param = [
+ 'elevator_type' => 'E',
+ 'floors' => 3,
+ 'speed' => 1,
+ 'persons' => 6,
+ 'weight' => 1000,
+ 'maintain_times' => 1, //病床梯一月2次保养
+ 'maintain_months' => 60,
+ 'maintain_kind' => 2,
+ 'maintain_period' => 1, //默认为1月1次, 2是为2月一次
+ 'is_m1_bundle' => 'Y',
+];
+
+$mic = new MSCalculator();
+$price = $mic->cal($_GET);
+echo json_encode($price);
diff --git a/wms/con/test.php b/wms/con/test.php
new file mode 100644
index 00000000..55f9873a
--- /dev/null
+++ b/wms/con/test.php
@@ -0,0 +1,174 @@
+ $regions['content'],
+ #当月件数
+ 'd_item_cnt' => 0,
+ #当月台数
+ 'd_mfg_cnt' => 0,
+ #直销件数
+ 'z_item_cnt' => 0,
+ #直销台数
+ 'z_mfg_cnt' => 0,
+ #平台件数
+ 'p_item_cnt' => 0,
+ #平台台数
+ 'p_mfg_cnt' => 0,
+ #台数合计
+ 'mfg_total' => 0,
+ #件数合计
+ 'item_total' => 0,
+ #营业人数
+ 'persons' => 0,
+ #人均台数
+ 'avg_mfg_total' => 0,
+ #人均件数
+ 'avg_item_total' => 0,
+ ];
+ #遍历大区下面所有分公司
+ $res_branch = DB::result("select depart_no,depart_name from depart where regions='" . $regions['code_name'] . "' ");
+ foreach ($res_branch as $branch) {
+ #遍历分公司下面所有人
+ $depart_data = [];
+ $res_salesman = DB::result("select employee_no,name from employee
+ where depart_no='" . $branch['depart_no'] . "' ");
+ $depart_data = [
+ 'depart_name' => $branch['depart_name'],
+
+ ];
+ foreach ($res_salesman as $salesman) {
+ //当月预定成交台数 件数
+ $d_item_cnt = $d_mfg_cnt = $z_item_cnt = $z_mfg_cnt = $p_item_cnt = $p_mfg_cnt = 0;
+ list($d_item_cnt, $d_mfg_cnt) = DB::fields("select count(vol_no) item_cnt ,sum(num) mfg_cnt
+ From hope_contract_customer where salesman='" . $salesman['employee_no'] . "'
+ and pre_order_date between DATE_FORMAT(concat('$yyyymm','01'),'%Y-%m-%d')
+ and LAST_DAY(STR_TO_DATE('$yyyymm', '%Y%m'))");
+ // 直销 台数 件数
+ list($z_item_cnt, $z_mfg_cnt) = DB::fields("select count(vol_no) z_item_cnt ,sum(num)
+ z_mfg_cnt From hope_contract_customer where salesman=''" . $salesman['employee_no'] . "'
+ and customer_kind='1'");
+ // 平台 台数 件数
+ list($p_item_cnt, $p_mfg_cnt) = DB::fields("select count(vol_no) p_item_cnt ,sum(num)
+ p_mfg_cnt From hope_contract_customer where salesman='" . $salesman['employee_no'] . "'
+ and customer_kind!='1'
+ ");
+ #当月件数
+ $d_item_cnt = empty($d_item_cnt) ? 0 : $d_item_cnt;
+ #当月台数
+ $d_mfg_cnt = empty($d_mfg_cnt) ? 0 : $d_mfg_cnt;
+ #直销件数
+ $z_item_cnt = empty($z_item_cnt) ? 0 : $z_item_cnt;
+ #直销台数
+ $z_mfg_cnt = empty($z_mfg_cnt) ? 0 : $z_mfg_cnt;
+ #平台件数
+ $p_item_cnt = empty($p_item_cnt) ? 0 : $p_item_cnt;
+ #平台台数
+ $p_mfg_cnt = empty($p_mfg_cnt) ? 0 : $p_mfg_cnt;
+ #台数合计
+ $mfg_total = $z_mfg_cnt + $p_mfg_cnt;
+ #件数合计
+ $item_total = $z_item_cnt + $p_item_cnt;
+ #营业人数
+ $persons = 1;
+ #人均台数
+ $avg_mfg_total = $z_mfg_cnt + $p_mfg_cnt;
+ #人均件数
+ $avg_item_total = $z_item_cnt + $p_item_cnt;
+
+ #部门数据
+ $depart_data = [
+ #当月件数
+ 'd_item_cnt' => $depart_data['d_item_cnt'] + $d_item_cnt,
+ #当月台数
+ 'd_mfg_cnt' => $depart_data['d_mfg_cnt'] + $d_mfg_cnt,
+ #直销件数
+ 'z_item_cnt' => $depart_data['z_item_cnt'] + $z_item_cnt,
+ #直销台数
+ 'z_mfg_cnt' => $depart_data['z_mfg_cnt'] + $z_mfg_cnt,
+ #平台件数
+ 'p_item_cnt' => $depart_data['p_item_cnt'] + $p_item_cnt,
+ #平台台数
+ 'p_mfg_cnt' => $depart_data['p_mfg_cnt'] + $p_mfg_cnt,
+ #台数合计
+ 'mfg_total' => $depart_data['mfg_total'] + $mfg_total,
+ #件数合计
+ 'item_total' => $depart_data['item_total'] + $item_total,
+ #营业人数
+ 'persons' => $depart_data['persons'] + $persons,
+ #人均台数 $z_mfg_cnt + $p_mfg_cnt
+ 'avg_mfg_total' => ($depart_data['z_mfg_cnt'] + $z_mfg_cnt) / ($depart_data['persons'] + $persons),
+ #人均件数
+ 'avg_item_total' => ($depart_data['z_item_cnt'] + $z_item_cnt) / ($depart_data['persons'] + $persons)
+ ];
+
+
+ $region_data[$regions['code_name']] = [
+ #当月件数
+ 'd_item_cnt' => $region_data[$regions['code_name']]['d_item_cnt'] + $depart_data['d_item_cnt'],
+ #当月台数
+ 'd_mfg_cnt' => $region_data[$regions['code_name']]['d_mfg_cnt'] + $depart_data['d_mfg_cnt'],
+ #直销件数
+ 'z_item_cnt' => $region_data[$regions['code_name']]['z_item_cnt'] + $depart_data['z_item_cnt'],
+ #直销台数
+ 'z_mfg_cnt' => $region_data[$regions['code_name']]['z_mfg_cnt'] + $depart_data['z_mfg_cnt'],
+ #平台件数
+ 'p_item_cnt' => $region_data[$regions['code_name']]['p_item_cnt'] + $depart_data['p_item_cnt'],
+ #平台台数
+ 'p_mfg_cnt' => $region_data[$regions['code_name']]['p_mfg_cnt'] + $depart_data['p_mfg_cnt'],
+ #台数合计
+ 'mfg_total' => $region_data[$regions['code_name']]['mfg_total'] + $depart_data['mfg_total'],
+ #件数合计
+ 'item_total' => $region_data[$regions['code_name']]['item_total'] + $depart_data['item_total'],
+ #营业人数
+ 'persons' => $region_data[$regions['code_name']]['persons'] + $depart_data['persons'],
+ #人均台数 $z_mfg_cnt + $p_mfg_cnt
+ 'avg_mfg_total' => ($region_data[$regions['code_name']]['z_mfg_cnt'])
+ / ($region_data[$regions['persons']]),
+ #人均件数
+ 'avg_item_total' => ($region_data[$regions['code_name']]['z_item_cnt'])
+ / ($region_data[$regions['persons']]),
+
+ ];
+ $depart_data['children'][] = [
+ 'depart_name' => $salesman['name'],
+ #当月件数
+ 'd_item_cnt' => $d_item_cnt,
+ #当月台数
+ 'd_mfg_cnt' => $d_mfg_cnt,
+ #直销件数
+ 'z_item_cnt' => $z_item_cnt,
+ #直销台数
+ 'z_mfg_cnt' => $z_mfg_cnt,
+ #平台件数
+ 'p_item_cnt' => $p_item_cnt,
+ #平台台数
+ 'p_mfg_cnt' => $p_mfg_cnt,
+ #台数合计
+ 'mfg_total' => $z_mfg_cnt + $p_mfg_cnt,
+ #件数合计
+ 'item_total' => $z_item_cnt + $p_item_cnt,
+ #营业人数
+ 'persons' => 1,
+ #人均台数
+ 'avg_mfg_total' => $z_mfg_cnt + $p_mfg_cnt,
+ #人均件数
+ 'avg_item_total' => $z_item_cnt + $p_item_cnt,
+ ];
+ }
+ #大区资料
+ if (empty($region_data[$regions['code_name']])) $region_data[$regions['code_name']] = [];
+ if ($region_data[$regions['code_name']]['children']) $region_data[$regions['code_name']]['children'] = [];
+ array_push($region_data[$regions['code_name']]['children'], $depart_data);
+ }
+ echo "";
+ var_dump($region_data);
+}
diff --git a/wms/con/wf_common.php b/wms/con/wf_common.php
new file mode 100644
index 00000000..519d341f
--- /dev/null
+++ b/wms/con/wf_common.php
@@ -0,0 +1,20 @@
+