diff --git a/wms/bons/maintainance_contract_payment_status.php b/wms/bons/maintainance_contract_payment_status.php deleted file mode 100644 index ed76f046..00000000 --- a/wms/bons/maintainance_contract_payment_status.php +++ /dev/null @@ -1,399 +0,0 @@ -query($sql); - -function getContractnoDetails($link, $user_id, $contractno = null) -{ - $sql = " - SELECT - c.contractno - FROM contract AS c - LEFT JOIN con_maintance_examine_apply AS cmea - ON c.contractno = cmea.vol_no - WHERE 1 = 1 - AND cmea.salesman IN (" . getAccountids($link, $user_id) . ") - "; - if (!empty($contractno)) { - $sql .= " - AND c.contractno = '$contractno' - "; - } - $result = mysqli_query($link, $sql); - $data = []; - foreach ($result as $row) { - array_push($data, $row['contractno']); - } - return "'" . implode("','", $data) . "'"; -} - -function getSalesmanNo($link, $contractno) -{ - $sql = " - SELECT - cmea.salesman - FROM contract AS c - LEFT JOIN con_maintance_examine_apply AS cmea - ON c.contractno = cmea.vol_no - WHERE 1 = 1 - AND c.contractno IN ('$contractno') - "; - $result = mysqli_query($link, $sql); - $data = []; - foreach ($result as $row) - return $row['salesman']; - return ""; -} -function getSalesmanName($link, $contractno) -{ - $sql = " - SELECT - a.name - FROM contract AS c - LEFT JOIN con_maintance_examine_apply AS cmea - ON c.contractno = cmea.vol_no - LEFT JOIN account AS a - ON cmea.salesman = a.accountid - WHERE 1 = 1 - AND c.contractno IN ('$contractno') - "; - $result = mysqli_query($link, $sql); - $data = []; - foreach ($result as $row) - return $row['name']; - return ""; -} - -function getAccountids($link, $user_id) -{ - $sql = " - SELECT - accountid - FROM account - WHERE 1 = 1 - AND (accountid = '$user_id' - OR accountid IN ( - SELECT - accountid - FROM account - WHERE 1 = 1 - AND manager = '$user_id' - AND accounttype IN ('B','E','M','W') - ) - ) - "; - $result = mysqli_query($link, $sql); - $data = []; - foreach ($result as $row) { - array_push($data, $row['accountid']); - } - return "'" . implode("','", $data) . "'"; -} - -function checkArCheckBillStatus($row) -{ - $CU_EstPayDate = $row['CU_EstPayDate']; - $BillNo2 = $row['BillNo2']; - if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) { - if (empty($BillNo2)) { - return "未轉應收確認單"; - } else { - return "已轉應收確認單"; - } - } else { - return "時間未到"; - } -} - -function arSellInvoiceMaterial($row) -{ - - $CU_EstPayDate = $row['CU_EstPayDate']; - $InvoiceName = $row['InvoiceName']; - - if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) { - if (empty($InvoiceName)) { - return "未開發票"; - } else { - return "已開發票"; - } - } else { - return "時間未到"; - } -} - -function checkArWriteOffBill($conn, $row) -{ - $BillNo = $row['BillNo2']; - - $sql = " - SELECT - * - -- a.BillNo, - -- a.WriteOffBizPartnerId, - -- a.PayWriteOffOAmount, - -- b.FromBillDate AS ReceivedDate, - -- b.CurrWOFeeOAmt AS Fee, - -- c.OrderBillNo, - -- c.checkBillNo, - -- c.InvoiceNo, - -- c.BillDate AS CheckBillDate - FROM arWriteOffBill AS a - LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo - LEFT JOIN - (SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail - LEFT JOIN - (SELECT - arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo - FROM arCheckBill - LEFT JOIN arCheckBillInvInfo - ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 - ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c - ON a.BillNo=c.BillNo - WHERE c.checkBillNo = '$BillNo' - "; - - $del = $conn->query($sql); - $i = 0; - foreach ($del as $row) - $i++; - if (empty($i)) { - return "未收款"; - } else { - return "已收款"; - } -} - -?> - - - - - - - - -
營業人員/契約人員 | -合約號 | -標示號 | -電梯編號 | -預計請款日 | -催收次數 | -應收申請單狀態 | -請款金額(未轉應收) | -請款金額(已轉應收) | -應收申請單號 | -發票狀態 | -發票單標示號 | -發票單號 | -發票明細 | -發票金額 | -發票號碼 | -核銷 | - -
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- "; - echo getSalesmanName($link, $row['BillNo']); - ?> - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -- - | -
未填寫
※此信件為系統發出信件,請勿直接回覆。
"; - - $mail = new PHPMailer(true); - $mail->IsHTML(true); //設定是否使用HTML格式 - $mail->CharSet = $this->charset; - $mail->isSMTP(); - $mail->SMTPAuth = true; - $mail->Host = $this->host; - $mail->Port = $this->port; - $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //使用SSL, 如果是TLS 請改為 PHPMailer::ENCRYPTION_STARTTLS - $mail->Username = $this->smtp_user; - $mail->Password = $this->smtp_pwd; - $mail->SMTPSecure = ""; - $mail->From = "notice@masada.com.tw"; - $mail->FromName = $from; - $mail->Subject = $subject; - $mail->Body = $em_body; - foreach ($sendlist as $v) { // $sendlist[0]=['M0044', 'jrbin@masada.com.tw'] - list($name, $email) = $v; - if ($email) $mail->addAddress($email, $name); - } - //$mail->addCC("personC@gmail.com", "person C"); - //$mail->addBCC("personD@gmail.com", "person D"); - //$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg - //print_r($mail);exit; - if (!$mail->Send()){ - // echo "Mailer error: " . $mail->ErrorInfo; - } else { - //echo "Email sent"; - } - } -} \ No newline at end of file diff --git a/wms/class/Cnotice.php b/wms/class/Cnotice.php deleted file mode 100644 index 970bf81c..00000000 --- a/wms/class/Cnotice.php +++ /dev/null @@ -1,109 +0,0 @@ - false, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - PDO::ATTR_EMULATE_PREPARES => false, - PDO::ATTR_STRINGIFY_FETCHES => false, - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', - ]; - $pdo = new PDO('mysql:host=' . $host . ';port=' . $dbport . ';dbname=' . $dbname . '', $dbuser, $dbpassword, $options); - $pdo->exec('SET CHARACTER SET utf8mb4'); - return $pdo; - } catch (PDOException $e) { - die("Something wrong: {$e->getMessage()}"); - } - } - - /** - * 結束資料庫連線 - */ - function endConnectionDB($pdo) - { - unset($pdo); - } - - /** - * 提交消息 notice - * @param string $kind : 類別 1=系統 2=會議 - * @param int $related_id : 關聯序號 - * @param string $title : 標題 - * @param string $title : 內容 - * @param string $permission : 瀏覽權限 員編/ALL=全體 - * @param string $creater : 建立者 - * @param string $create_at : 建立時間 - */ - function sendx($data) - { - - $kind = $data['kind']; - $related_id = $data['related_id']; - $title = $data['title']; - $content = $data['content']; - $permission = $data['permission']; - $creater = $data['creater']; - $create_at = $data['create_at']; - - $pdo = $this->connectionDB(); - $pdo->exec('SET CHARACTER SET utf8mb4'); - $str = " - INSERT INTO `notice` (`kind`, `related_id`, `title`, `content`, `permission`, `creater`, `create_at`) - VALUES (?,?,?,?,?,?,?) - "; - - $sth = $pdo->prepare($str); - $sth->bindValue(1, $kind); - $sth->bindValue(2, $related_id); - $sth->bindValue(3, $title); - $sth->bindValue(4, $content); - $sth->bindValue(5, $permission); - $sth->bindValue(6, $creater); - $sth->bindValue(7, $create_at); - - $sth->execute(); - - $this->endConnectionDB($pdo); - } -} - -// $cn = new Cnotice(); -// $data = array( -// 'kind' => 1, -// 'related_id' => 1, -// 'title' => "標題", -// 'content' => "內容", -// 'permission' => "M0117", -// 'creater' => "M0117", -// 'create_at' => date("Y-m-d H:i:s") -// ); -// $cn->sendx($data); diff --git a/wms/cont/FormHelper.php b/wms/cont/FormHelper.php deleted file mode 100644 index 8025239a..00000000 --- a/wms/cont/FormHelper.php +++ /dev/null @@ -1,509 +0,0 @@ - '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 '' . $fieldName . '
-'; -// print_r($apply_key); -// echo ''; -// exit; -// if ($salesman != $user_id) { -// echo ''; -// exit; -// } -if (empty($apply_key)) $apply_st = 1; // 準備新增 -else { - //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); - list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); - if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 - else $apply_st = 9; // 已到下一關,無法䖺改 -} - -// if ($apply_st > 2) { -// echo ""; -// 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"; -// print_r($sql); -$hope_contract = DB::result($sql); -$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; -#寫入 con_maintance_examine_apply -if ($apply_st == 1) { - #獲取評審單號 - $apply_key = get_sequnece_no('cmea_apply_key', date('ym')); - //var_dump($hope_contract); - $insert_data = [ - 'apply_key' => $apply_key, - 'vol_no' => $vol_no, - 'form_key' => $form_key, - 'address' => $hope_contract['address'], - 'case_name' => $hope_contract['customer'], - 'num' => $hope_contract['num'], - 'brand' => '', - 'customer' => $hope_contract['customer'], - 'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], - 'progress_remark' => $hope_contract['progress_status'] - //'platform_company'=>'', - // 'platforom_company_tel'=> '' - - ]; - //var_dump($insert_data); - DB::insert_table('con_maintance_examine_apply', $insert_data); -} - -$table = 'con_maintance_examine_apply'; -#可編輯的列 -$editableColumn = [ - 'apply_key' => [ - 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', - 'attr' => [ - 'readonly=true ', - 'class' => 'form-control form-control-sm' - ] - ], - 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], - 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], - 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], - 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], - 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - - 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], - -]; -$where = " and apply_key='$apply_key'"; - -$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; -$data = []; -$data = DB::result($sql); - -#電梯詳細資料 -$con_maintance_examine_clear_columm = [ - 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], - 'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], - 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], - 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - 'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], - 'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], - 'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], - - 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], - 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], - - 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], - - 'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], - 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], - 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], - 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'placeholder' => '契約成交價', '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 = "
'; -// print_r($salesman); -// echo ''; -// exit; -if ($salesman != $user_id) { - echo ''; - exit; -} -if (empty($apply_key)) $apply_st = 1; // 準備新增 -else { - //list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); - list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); - if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 - else $apply_st = 9; // 已到下一關,無法䖺改 -} - -// if ($apply_st > 2) { -// echo ""; -// exit; -// } - -if ($apply_st == 1) { - $wf = new WorkFlow($system_id, $flow_id, $form_id); - $wf->initWorkFlow($user_id); - $form_key = $wf->flowContext->getFormKey(); -} else { - $wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); -} - -#獲取簽核意見 -$assign_opinions = Assign::get_records($form_key); - -#會簽部門意見 -$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); - -//預設冇有摺扣 -$wf->setFormData(['discount' => 100]); -$flowName = $wf->getFlowName(); -$assigner = $wf->getAssignerList(); -$assign_status = $wf->getAssignStatus($assigner); -$if_show_assign = true; -//加載流程圖 -//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); -//$path = $fc[0]->wf_file; -//echo dirname(__DIR__)."/../"."$path"; - -//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); -#是否可會簽 -$isSplitable = $wf->isSplitable(); - -//表單數據 -#客戶表 -#1.電梯品牌選項 -$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by code_name asc "; -$elevator_brand_opt = DB::result($sql); -#2.保養方式 -$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; -$maintain_kind_opt = DB::result($sql); -#3.電梯類型 -$sql = "select code_name value ,content label from code where field_name='maintain_elevator_kind'"; -$elevator_kind_opt = DB::result($sql); -#4.付款方式 -$sql = "select code_name value ,content label from code where field_name='payment_kind' order by code_name+ 0 asc"; -$payment_kind_opt = DB::result($sql); -#5.契約性質 -$sql = "select code_name value ,content label from code where field_name='contract_kind'"; -$contract_kind_opt = DB::result($sql); -#6.是否贈送M1 -$is_m1_bundle_opt = [ - ['label' => '是', 'value' => 'Y'], - ['label' => '否', 'value' => 'N'] - -]; -#7.機種 -$sql = "select code_name value ,content label from code where field_name='fp_kind'"; -$fp_kind_opt = DB::result($sql); -#抓取有望客戶資料 - -$vol_no = $_GET['vol_no']; -$where = " and vol_no='$vol_no'"; -$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; -$hope_contract = DB::result($sql); -$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; -#寫入 con_maintance_examine_apply -if ($apply_st == 1) { - #獲取評審單號 - $apply_key = get_sequnece_no('cmea_apply_key', date('ym')); - //var_dump($hope_contract); - $insert_data = [ - 'apply_key' => $apply_key, - 'vol_no' => $vol_no, - 'form_key' => $form_key, - 'address' => $hope_contract['address'], - 'case_name' => $hope_contract['customer'], - 'num' => $hope_contract['num'], - 'brand' => '', - 'customer' => $hope_contract['customer'], - 'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], - 'progress_remark' => $hope_contract['progress_status'] - //'platform_company'=>'', - // 'platforom_company_tel'=> '' - - ]; - //var_dump($insert_data); - DB::insert_table('con_maintance_examine_apply', $insert_data); -} -#抓使用者主管 -$sql = "SELECT * FROM account WHERE accountid = '$user_id' "; -list($result) = DB::result($sql); -if ($result['department_id'] == '511') { - $managerid = 'M0137'; - $managername = '劉永德'; -} else if ($result['department_id'] == '512') { - $managerid = 'M0137'; - $managername = '劉永德'; -} else if ($result['department_id'] == '513') { - $managerid = 'M0086'; - $managername = '李烘銘'; -} else if ($result['department_id'] == '514') { - $managerid = 'M0033'; - $managername = '吳育宗'; -} - -if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') { - $managerid = 'M0008'; - $managername = '詹益彰'; -} - -if ($result['department_id'] == 'M0008') { - $managerid = 'M0008'; - $managername = '詹益彰'; -} -$table = 'con_maintance_examine_apply'; -#可編輯的列 -$editableColumn = [ - 'apply_key' => [ - 'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', - 'attr' => [ - 'readonly=true ', - 'class' => 'form-control form-control-sm' - ] - ], - 'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], - 'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], - 'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], - 'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], - 'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], - 'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], - 'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], - - 'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], - -]; -$where = " and apply_key='$apply_key'"; - -$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; -$data = []; -$data = DB::result($sql); - -#電梯詳細資料 -$con_maintance_examine_clear_columm = [ - 'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], - 'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], - 'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], - 'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], - 'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - 'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], - 'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], - 'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], - 'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], - - 'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], - 'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], - 'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], - - 'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], - - 'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], - 'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], - 'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], - 'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], - 'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], - 'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], - 'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], - -]; -$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . - " FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); -$j = 0; -$col_count = 12; -$cmecRow = "
'; - // print_r($result); - // echo ''; - $id[] = $test; - } - } - $inClause = implode(',', $id); -} - - -#可編輯的列 -$editableColumn = [ - 'apply_key' => [ - '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" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04") $where = ""; - -// 電梯廠牌 -$elevator_brand_arr = []; -$sql = "select code_name ,content from code where field_name='elevator_brand'"; -$res = mysqli_query($link, $sql); -while ($row = mysqli_fetch_row($res)) { - $elevator_brand_arr[$row[0]] = $row[1]; -} -mysqli_free_result($res); -if (!empty($res_get)) { - $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 form_key IN ($inClause) "; -} else { - $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"; -} -// echo $sql; -$data = mysqli_query($link, $sql); -// echo '
'; -// print_r($data); -// echo ''; -?> - -Please fill up the required field!"; - } else { - header("Location:repair-index.php"); - } - } - -?> - - -
"; - var_dump($region_data); -} diff --git a/wms/cont/wf_common.php b/wms/cont/wf_common.php deleted file mode 100644 index 519d341f..00000000 --- a/wms/cont/wf_common.php +++ /dev/null @@ -1,20 +0,0 @@ - { repair_no: '', total_price: '', sign_date: '', - contract_status: '' + contract_status: '', }, step: 1, isLoading: false, @@ -874,16 +874,27 @@ const contract_edit = () => { } -const bonsIndex = () => { +const bonunsIndexTest = () => { return { data: { contract_no: 'Q23080067', client_type: '', facility_no: '', - bons_verson: '', + bonuns_verson: '', receiver: '', maintain_month: '', - maintain_price_toal: '' + maintain_price_total: '', + payDay: '', + bonusArr: [], + client_type: '', + manager: '', + bonus_type: '', + bouns_receiver: '', + bouns_amount: '', + dayDus: '', + bouns_regulation: '', + contract_manger: 'M0001', + user_id: user_id }, step: 1, isLoading: false, @@ -921,17 +932,29 @@ const bonsIndex = () => { if (!this.customize) { this.data.contract_no = res.data.BillNo; this.data.facility_no = res.data.facility; - this.data.bons_verson = res.data.bons_verson; + this.data.bonuns_verson = res.data.bonuns_verson; this.data.receiver = res.data.personId; - this.data.maintain_price_toal = res.data.amount; - this.data.bons_verson = 2; + this.data.maintain_price_total = res.data.amount; + this.data.bonuns_verson = 2; this.data.maintain_month = res.data.maintain_month; - } + this.data.payDay = res.data.payDay; + axios.get('./api/getAccount.php?accountid=' + res.data.personId).then(res => { + this.data.manager = res.data.manager; + }).catch(err => { + console.log(err); + }) + }; this.step = 2; this.isLoading = false; }).catch(err => { - + errorFn(); }) + // axios.get('./api/getAccount.php?accountid=' + this.data.receiver).then(res => { + // console.log(res); + // this.data.manager = res.result.manager; + // }).catch(err => { + // console.log(err); + // }) }, preStepFn() { this.step = 1 @@ -940,10 +963,42 @@ const bonsIndex = () => { } }, save() { + if (this.step == 3) { + const form = new FormData(); + form.append('contract_no', this.data.contract_no); + form.append('facility_no', this.data.facility_no); + form.append('bonuns_verson', this.data.bonuns_verson); + form.append('user_id', this.data.user_id); + form.append('bonusArr', JSON.stringify(this.data.bonusArr)); + axios.post('./api/insertBonus.php', form).then(res => { + console.log(res.data); + }).catch(err => { + }) + } }, calBons() { - console.log('123'); + console.log(this.step); + const form = new FormData(); + form.append('contract_no', this.data.contract_no); + form.append('bonuns_verson', this.data.bonuns_verson); + form.append('client_type', this.data.client_type); + form.append('maintain_month', this.data.maintain_month); + form.append('maintain_price_total', this.data.maintain_price_total); + form.append('payDay', this.data.payDay); + form.append('receiver', this.data.receiver); + form.append('manager', this.data.manager); + axios.post('./api/postCalBouns.php', form).then(res => { + // console.log(res); + this.data.bonusArr = res.data.bonus_array; + console.log(this.data.bonusArr); + this.step = 3; + this.isLoading = false; + }).catch(err => { + console.log(err.response.data); + alert(err.response.data); + this.step = 2; + }) }, errorFn() { let msg = ''; @@ -954,4 +1009,13 @@ const bonsIndex = () => { }, } +} + +const bonunsIndex = () => { + return { + data: { + + }, + step: 1, + } } \ No newline at end of file diff --git a/wms/contract/option/option2.xlsx b/wms/contract/option/option2.xlsx index 4cf1f87c..8f9a57a5 100644 Binary files a/wms/contract/option/option2.xlsx and b/wms/contract/option/option2.xlsx differ diff --git a/wms/frame/api_getdata.php b/wms/frame/api_getdata.php index cfcee966..d306794d 100644 --- a/wms/frame/api_getdata.php +++ b/wms/frame/api_getdata.php @@ -22,7 +22,6 @@ */ $json = array("st" => "ok", "err" => "", "errCode" => ""); -echo '123'; /** * 表單列表 */ diff --git a/wms/fun_global.php b/wms/fun_global.php index cd4271b2..627fd90b 100644 --- a/wms/fun_global.php +++ b/wms/fun_global.php @@ -99,36 +99,37 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee, $i = 0) return $ret; exit; } else { - // 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。 - if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) { - $ret[1] = $user_id . ",,"; - $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人) - $ret[3] = "M0060,,"; // 業務協理 - if ($rate < 80 || $special_fee > 0) { - $ret[4] = "M0006,,"; // 總經理 - } - return $ret; - exit; - } - if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") { - // 新梯的部分 桃竹本該給陳家文,改為劉永德 - if ($row["manager"] == 'M0029') { - $ret[1] = "M0137,,"; - $i++; - pricereview_class($rate, $row["manager"], $ret, $special_fee, $i); - } else { - $ret[1] = $row["manager"] . ",,"; - $i++; - pricereview_class($rate, $row["manager"], $ret, $special_fee, $i); - } - } else { - - $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人) - $ret[3] = "M0060,,"; // 業務協理 - if ($rate < 80 || $special_fee > 0) { - $ret[4] = "M0006,,"; // 總經理 - } + // // 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。 + // if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) { + // $ret[1] = $user_id . ",,"; + // $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人) + // $ret[3] = "M0060,,"; // 業務協理 + // if ($rate < 80 || $special_fee > 0) { + // $ret[4] = "M0006,,"; // 總經理 + // } + // return $ret; + // exit; + // } + // if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") { + // // 新梯的部分 桃竹本該給陳家文,改為劉永德 + // if ($row["manager"] == 'M0029') { + // $ret[1] = "M0137,,"; + // $i++; + // pricereview_class($rate, $row["manager"], $ret, $special_fee, $i); + // } else { + // $ret[1] = $row["manager"] . ",,"; + // $i++; + // pricereview_class($rate, $row["manager"], $ret, $special_fee, $i); + // } + // } else { + // $ret[1] = ''; + // $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人) + // $ret[2] = ''; + $ret[3] = "M0060,,"; // 業務協理 + if ($rate < 80 || $special_fee > 0) { + $ret[4] = "M0006,,"; // 總經理 } + // } return $ret; } diff --git a/wms/mkt/pricereview-edit.php b/wms/mkt/pricereview-edit.php index 3868a44f..fda6c9b4 100644 --- a/wms/mkt/pricereview-edit.php +++ b/wms/mkt/pricereview-edit.php @@ -653,6 +653,8 @@ foreach ($res as $data) { $('#btnadd3').click(function() { $('#tb3 tr:last').prev().after($("tr[name='except_templ']").last().clone().find('input').val('').end()); $("tr[name='except_templ']").last().find('input[name=except_act]').val('I'); + $('#tb3 tr:last').prev().find('td[name=Exclusions]').html(''); + //$('#tb3 tr:last').prev().find('td').first().html($("tr[name='except_templ']").length); //$('#tb3 tr:last').prev().find('td').eq(1).find('a').attr('id', $("tr[name='except_templ']").length); }); @@ -1020,12 +1022,14 @@ foreach ($res as $data) { mnKindArr.push($(this).val()); }) $('#mn_kind_all').val(mnKindArr); - var mnSeatArr = []; + var nmExclusions = []; + $("td[name='Exclusions']").each(function() { - exRelateFacilArr.push($(this).html()); + nmExclusions.push($(this).val()); }) - $('#Exclusions_all').val(exRelateFacilArr); - var exSpecArr = []; + $('#Exclusions_all').val(nmExclusions); + + var mnSeatArr = []; $("select[name='mn_seat']").each(function() { mnSeatArr.push($(this).val()); })