Browse Source

保養價審獎金計算\

gary
Cheng 1 year ago
parent
commit
db3108d7d8
  1. 399
      wms/bons/maintainance_contract_payment_status.php
  2. 39
      wms/bonus/api/get.php
  3. 11
      wms/bonus/api/getAccount.php
  4. 27
      wms/bonus/api/insertBonus.php
  5. 53
      wms/bonus/api/postCalBouns.php
  6. 86
      wms/bonus/bonus_index1.php
  7. 0
      wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0.php
  8. 0
      wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php
  9. 0
      wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0.php
  10. 0
      wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0_examination.php
  11. 0
      wms/bonus/maintance/maintenance_contract_bonus_v2_0.php
  12. 0
      wms/bonus/maintance/maintenance_contract_bonus_v2_0_examination.php
  13. 62
      wms/class/Cmail.php
  14. 109
      wms/class/Cnotice.php
  15. 509
      wms/cont/FormHelper.php
  16. 324
      wms/cont/MICalculator.php
  17. 322
      wms/cont/MSCalculator.php
  18. 22
      wms/cont/apply.php
  19. 859
      wms/cont/apply_form.php
  20. 912
      wms/cont/apply_form1.php
  21. 20
      wms/cont/async_req.php
  22. 14
      wms/cont/con_maintance_examine_clear.php
  23. 42
      wms/cont/conn.php
  24. 21
      wms/cont/crmm06_submit.php
  25. 168
      wms/cont/list.php
  26. 29
      wms/cont/model/ConMaintanceExamineApplyModel.php
  27. 33
      wms/cont/model/ConMaintanceExamineClearModel.php
  28. 53
      wms/cont/model/Model.php
  29. 511
      wms/cont/query_form.php
  30. 507
      wms/cont/review_apply_form.php
  31. 577
      wms/cont/sign_form.php
  32. 225
      wms/cont/sign_list.php
  33. 79
      wms/cont/submit.php
  34. 1
      wms/cont/success.php
  35. 84
      wms/cont/t.php
  36. 174
      wms/cont/test.php
  37. 20
      wms/cont/wf_common.php
  38. 84
      wms/contract-repair/js/alpine.js
  39. BIN
      wms/contract/option/option2.xlsx
  40. 1
      wms/frame/api_getdata.php
  41. 59
      wms/fun_global.php
  42. 12
      wms/mkt/pricereview-edit.php

399
wms/bons/maintainance_contract_payment_status.php

@ -1,399 +0,0 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$contractno = getContractnoDetails($link, $user_id, $contractno);
$sql = "
SELECT
siamd.RowNo,
siamd.RowCode,
siam.BillNo,
siamd.CU_EstPayDate,
siamd.UnTransCheckBLAmtWTax ,
siamd.HadTransCheckBLAmtWTax,
siamd.CU_MaterialId,
acb_tmp.BillNo2,
acb_tmp.RowCode2,
asim.BillNo AS BillNo3,
asim.InvoiceName,
asim.OAmountWithTax,
asi.InvoiceNo
FROM salIncomeApplyMaster AS siam -- 收入申請單
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細
ON siam.BillNo = siamd.BillNo
LEFT JOIN (
SELECT
acbd.FromRowCode,
acb.FromBillNo,
acbd.BillNo AS BillNo2,
acbd.RowCode AS RowCode2
FROM arCheckBill AS acb -- 應收確認單
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細
ON acb.BillNo = acbd.BillNo
WHERE 1 = 1
AND acb.TypeId = 'RVS'
";
$sql .= !empty($contractno) ? " AND acb.FromBillNo IN ($contractno) " : "";
$sql .= "
) AS acb_tmp
ON siamd.RowNo = acb_tmp.FromRowCode
AND siamd.BillNo = acb_tmp.FromBillNo
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細
ON asim.FromBillNo = acb_tmp.BillNo2
AND asim.RowCode = acb_tmp.RowCode2
LEFT JOIN arSellInvoice AS asi
ON asim.BillNo = asi.BillNo
WHERE 1 = 1
";
$sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : "";
$data = $conn->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 "<span class='text-danger'>未轉應收確認單</span>";
} else {
return "<span class='text-primary'>已轉應收確認單</span>";
}
} 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 "<span class='text-danger'>未開發票</span>";
} else {
return "<span class='text-primary'>已開發票</span>";
}
} 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 "<span class='text-danger'>未收款</span>";
} else {
return "<span class='text-primary'>已收款</span>";
}
}
?>
<?php if ($user_auth & 2) { ?>
<!-- <p>
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p> -->
<?php
}
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='maintainance_contract_payment_status.php?<?= $token_link ?>'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="5">
<h3 style='text-align:center'>保養合約-應收款項明細</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th>
<th style='text-align:center;vertical-align: middle;'>電梯編號</th>
<th style='text-align:center;vertical-align: middle;'>預計請款日</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th>
<th style='text-align:center;vertical-align: middle;'>請款金額(未轉應收)</th>
<th style='text-align:center;vertical-align: middle;'>請款金額(已轉應收)</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單號</th>
<th style='text-align:center;vertical-align: middle;'>發票狀態</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>發票單標示號</th>
<th style='text-align:center;vertical-align: middle;'>發票單號</th>
<th style='text-align:center;vertical-align: middle;'>發票明細</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th>
<th style='text-align:center;vertical-align: middle;'>核銷</th>
<!-- <th style='text-align:center;vertical-align: middle;'>核銷日期</th>
<th style='text-align:center;vertical-align: middle;'>未核銷金額</th>
<th style='text-align:center;vertical-align: middle;'>已核銷金額</th> -->
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo getSalesmanNo($link, $row['BillNo']);
echo "<br/>";
echo getSalesmanName($link, $row['BillNo']);
?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['RowNo']; ?>
</td>
<td>
<?php echo $row['CU_MaterialId']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['CU_EstPayDate'])); ?>
</td>
<td>
<?php echo collect_month(strtotime($row['CU_EstPayDate'])); ?>
</td>
<td>
<?php echo checkArCheckBillStatus($row); ?>
</td>
<td>
<?php echo number_format(intval($row['UnTransCheckBLAmtWTax']), 0, '', ','); ?>
</td>
<td>
<?php echo number_format(intval($row['HadTransCheckBLAmtWTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['BillNo2']; ?>
</td>
<td>
<?php echo arSellInvoiceMaterial($row); ?>
</td>
<td>
<?php echo $row['RowCode2']; ?>
</td>
<td>
<?php echo $row['BillNo3']; ?>
</td>
<td>
<?php echo $row['InvoiceName']; ?>
</td>
<td>
<?php echo number_format(intval($row['OAmountWithTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['InvoiceNo']; ?>
</td>
<td>
<?php
echo checkArWriteOffBill($conn, $row)
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
$(function() {
document.getElementById('loadingOverlay').classList.add('hidden');
})
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

39
wms/bons/api/get.php → wms/bonus/api/get.php

@ -1,26 +1,28 @@
<?php
require_once('../../contract/connt8.php');
require_once("../../contract/conn.php");
// if (!empty($_GET['contract_no'])) {
// $contract_no = $_GET['contract_no'];
$contract_no = 'Q23080067';
$sql = "SELECT
a.BillNo,
b.OTaxAmt as amount,
a.CU_EstPayDate as createDate,
b.PersonId as personId,
c.BillNo as CBno,
c.CU_MaterialId as facility
FROM salIncomeApplyDetail as a
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo
LEFT JOIN (
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS'
) AS c ON a.BillNo = c.BizPartnerId
WHERE a.BillNo = 'Q23080067'
AND a.RowNo = '1'
a.BillNo,
b.OTaxAmt as amount,
a.CU_EstPayDate as createDate,
b.PersonId as personId,
c.BillNo as CBno,
c.CU_MaterialId as facility,
c.CU_FromEstPayDate as payDay
FROM salIncomeApplyDetail as a
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo
LEFT JOIN (
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId,aDetail.CU_FromEstPayDate FROM arCheckBill as aMaster
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS'
) AS c ON a.BillNo = c.BizPartnerId
WHERE a.BillNo = 'Q23080067'
AND a.RowNo = '1'
";
$stmt = $connT8->prepare($sql);
$stmt->execute();
@ -37,7 +39,9 @@ $sql = "SELECT
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
arCheckBill.BillNo AS checkBillNo,
arCheckBill.BillDate,
arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
@ -63,8 +67,6 @@ $count = COUNT($result);
$data['maintain_month'] = intval($count * $result[0]['SQuantity']);
if (!empty($check['CheckBillDate'])) {
header('Content-Type: application/json');
echo json_encode($data);
@ -72,4 +74,3 @@ if (!empty($check['CheckBillDate'])) {
echo false;
exit;
}
// }

11
wms/bonus/api/getAccount.php

@ -0,0 +1,11 @@
<?php
require('../../contract-repair/conn.php');
$accountid = empty($_GET['accountid']) ? '' : $_GET['accountid'];
$sql = "SELECT name,manager FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':accountid', $accountid);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
header('Content-Type: application/json');
echo json_encode($result);

27
wms/bonus/api/insertBonus.php

@ -0,0 +1,27 @@
;<?php
require('../../contract-repair/conn.php');
if (!empty($_POST)) {
$contract_no = empty($_POST['contract_no']) ? '' : $_POST['contract_no'];
$facility_no = empty($_POST['facility_no']) ? '' : $_POST['facility_no'];
$bonuns_verson = empty($_POST['bonuns_verson']) ? '' : $_POST['bonuns_verson'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$bonusArr = empty($_POST['bonusArr']) ? '' : json_decode($_POST['bonusArr'], true);
$contract_type = 3;
$date = date('Y-m-d');
$sql = "INSERT INTO bonus
(bonus_type,bonus_verson,conreact_no,contract_type,facility_no,amount,receiver,pay_day,review_hr,review_at,create_id,create_at) VALUES
(:bonus_type,:bonus_verson,:conreact_no,:facility_no,:contract_type,:amount,:receiver,:pay_day,:review_hr,:review_at,:create_id,:create_at)
";
foreach ($bonusArr as $data) {
$bonus_type = $data['bonus_type'];
$bonus_receiver = $data['bonus_receiver'];
$bonus_amount = $data['bonus_amount'];
$pay_day_due = $data['pay_day_due'];
$bonus_regulation = $data['bonus_regulation'];
$stmt = $conn->prepare($sql);
$stmt->bindParam(':bonus_type', $bonus_type);
$stmt->bindParam(':bonus_verson', $bonus_verson);
$stmt->bindParam('conreact_no', $contract_no);
$stmt->bindParam(':contract_type', $contract_type);
}
}

53
wms/bonus/api/postCalBouns.php

@ -0,0 +1,53 @@
<?php
require_once("../../contract/conn.php");
require_once("../maintance/maintenance_contract_bonus_v2_0.php");
if (!empty($_POST)) {
$contract_no = empty($_POST['contract_no']) ? '' : $_POST['contract_no'];
$bonuns_verson = empty($_POST['bonuns_verson']) ? '' : $_POST['bonuns_verson'];
$client_type = empty($_POST['client_type']) ? '' : $_POST['client_type'];
$maintain_month = empty($_POST['maintain_month']) ? '' : $_POST['maintain_month'];
$maintain_price_total = empty($_POST['maintain_price_total']) ? '' : $_POST['maintain_price_total'];
$payDay = empty($_POST['payDay']) ? '' : $_POST['payDay'];
$receiver = empty($_POST['receiver']) ? '' : $_POST['receiver'];
$manager = empty($_POST['manager']) ? '' : $_POST['manager'];
$a = "M001";
$fail_arr = [];
if ($client_type == '') $fail_arr[] = '合約類行為必填';
if (count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
// 合約類型
$clientType = [
'1' => 'new',
'2' => 'free_to_charge',
'3' => 'renew_priceissue'
];
// 應付日期
$day = DateTime::createFromFormat('Ymd', $payDay);
$pay_day = $day->format('Y-m-d');
$years = $maintain_month / 12;
$contract_years = ($years >= 2) ? 'above_two' : 'one';
$result = maintenance_contract_bonus_v2_0(
$bonuns_verson,
$clientType[$client_type],
$contract_years,
0.8,
$maintain_price_total,
0,
$payDay,
$receiver,
$manager,
$a
);
header('Content-Type: application/json');
echo json_encode($result);
}

86
wms/bons/bons_index.php → wms/bonus/bonus_index1.php

@ -12,7 +12,7 @@ require_once('../contract-repair/conn.php');
<script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script>
<script src="../contract-repair/semantic/dist/semantic.min.js"></script>
<div class="bons_index" x-data="bonsIndex">
<div class="bonuns_index" x-data="bonunsIndexTest">
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name="form_name" value="main_form">
<div>
@ -60,6 +60,7 @@ require_once('../contract-repair/conn.php');
<option value="2">免保轉有費</option>
<option value="3">續簽約</option>
</select>
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align:middle">作番號</td>
<td>
@ -68,11 +69,11 @@ require_once('../contract-repair/conn.php');
<td style="vertical-align:middle">獎金適用版本</td>
<td>
<input type="text" x-model="data.bons_verson" disabled="disabled">
<input type="text" x-model="data.bonuns_verson" disabled="disabled">
</td>
</tr>
<tr>
<td style="vertical-align:middle">獎金發放人員</td>
<td style="vertical-align:middle">契約人員</td>
<td>
<input type="text" x-model="data.receiver" disabled="disabled">
</td>
@ -82,28 +83,73 @@ require_once('../contract-repair/conn.php');
</td>
<td style="vertical-align:middle">保養總額</td>
<td>
<input type="text" x-model="data.maintain_price_toal" disabled="disabled">
<input type="text" x-model="data.maintain_price_total" disabled="disabled">
</td>
<td></td>
<td></td>
</tr>
</tbody>
</template>
<!-- 獎金計算頁面 -->
<template x-if="step == 3">
<tbody style="font-weight: bolder;margin-bottom:20px">
<tr>
<td colspan="7" style="vertical-align:middle;border-right:0px">
<h4>獎金確認項</h4>
<td style="vertical-align:middle">地區經理經理員</td>
<td>
<input type="text" x-model="data.manager">
</td>
<td class="text-right" style="border: left 0px;">
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button>
<td style="vertical-align:middle">專任契約經理員</td>
<td>
<input type="text" x-model="data.contract_manger">
</td>
</tr>
<tr>
<td style="vertical-align:middle"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</template>
<!-- 獎金計算頁面 -->
<template x-if="step == 3">
<template x-for="(bonusArr,index) in data.bonusArr" :key="">
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==3">
<!-- <tr x-if="index % 3 == 0 || index == 0">
<td colspan=8>
<p x-text="'獎金' + Number(index+1)"></p>
</td>
</tr> -->
<tr>
<td style="vertical-align:middle">獎金類型</td>
<td>
<input type="text" x-model="data.bonusArr[index].bonus_type">
</td>
<td style="vertical-align:middle">發放人員</td>
<td>
<input type="text" x-model="data.bonusArr[index].bonus_receiver">
</td>
<td style="vertical-align:middle;">發放金額</td>
<td>
<input type="text" x-model="data.bonusArr[index].bonus_amount">
</td>
<td style="vertical-align:middle">預計發放時間</td>
<td>
<input type="text" x-model="data.bonusArr[index].pay_day_due">
</td>
</tr>
<tr>
<td style="vertical-align:middle">發放規定</td>
<td colspan="5">
<input type="text" x-model="data.bonusArr[index].bonus_regulation">
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</template>
</template>
</table>
<button x-show="step==3" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
@ -132,4 +178,8 @@ require_once('../contract-repair/conn.php');
</button>
</div>
</div>
</div>
</div>
<script>
const user_id = '<?= $user_id ?>';
</script>

0
wms/bons/elevator_new/elevator_new_deal_bonus_v1_0.php → wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0.php

0
wms/bons/elevator_new/elevator_new_deal_bonus_v1_0_examination.php → wms/bonus/elevator_new/elevator_new_deal_bonus_v1_0_examination.php

0
wms/bons/elevator_new/elevator_new_deal_bonus_v2_0.php → wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0.php

0
wms/bons/elevator_new/elevator_new_deal_bonus_v2_0_examination.php → wms/bonus/elevator_new/elevator_new_deal_bonus_v2_0_examination.php

0
wms/bons/maintance/maintenance_contract_bonus_v2_0.php → wms/bonus/maintance/maintenance_contract_bonus_v2_0.php

0
wms/bons/maintance/maintenance_contract_bonus_v2_0_examination.php → wms/bonus/maintance/maintenance_contract_bonus_v2_0_examination.php

62
wms/class/Cmail.php

@ -1,62 +0,0 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
class Cmail
{
public $charset = "";
public $host = "";
public $port = "";
public $smtp_user = "";
public $smtp_pwd = "";
function __construct($charset='', $fromemail='')
{
include dirname(__DIR__)."/PHPMailer/Exception.php";
include dirname(__DIR__)."/PHPMailer/PHPMailer.php";
include dirname(__DIR__)."/PHPMailer/SMTP.php";
$this->charset = "UTF-8";
$this->host = "mail.masada.com.tw";
$this->port = 25;
$this->smtp_user = "notice"; // 這裡填寫SMTP登入帳號, 例如 your.gmail.name@gmail.com 則填寫your.gmail.name
$this->smtp_pwd = "90493119"; // 這裡填寫SMTP登入密碼
}
function sendx($subject="", $em_body="", $sendlist=array(), $from="永佳捷科技", $bcc="", $files=array())
{
if (!$sendlist) return;
$em_body = nl2br($em_body);
$em_body .= "<p>※此信件為系統發出信件,請勿直接回覆。</p>";
$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";
}
}
}

109
wms/class/Cnotice.php

@ -1,109 +0,0 @@
<?php
//ini_set('display_errors', 'on');
class Cnotice
{
function __construct()
{
}
function connectionDB()
{
$envFile = __DIR__ . '/../../.env';
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines !== false) {
foreach ($lines as $line) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
putenv("$key=$value");
}
}
}
date_default_timezone_set("Asia/Taipei");
$host = getenv('DB_HOST');
$dbport = getenv('DB_PORT');
$dbuser = getenv('DB_USERNAME');
$dbpassword = getenv('DB_PASSWORD');
$dbname = getenv('DB_DATABASE');
try {
$options = [
PDO::ATTR_PERSISTENT => 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);

509
wms/cont/FormHelper.php

@ -1,509 +0,0 @@
<?php
class FormHelper
{
/**
* Form opening tag
*
* @static
* @param string $action
* @param array $attributes HTML attributes
* @return string
*/
public static function open($action = '', array $attributes = array())
{
if (isset($attributes['multipart']) && $attributes['multipart']) {
$attributes['enctype'] = 'multipart/form-data';
unset($attributes['multipart']);
}
$attributes = array_merge(array('method' => 'post', 'accept-charset' => 'utf-8'), $attributes);
return "<form action=\"{$action}\"" . self::attributes($attributes) . '>';
}
/**
* Form closing tag
*
* @static
* @return string
*/
public static function close()
{
return '</form>';
}
/**
* 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
* <code>
* // 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'),
* ));
* </code>
*
* @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 &nbsp;
//$label = str_replace('&amp;nbsp;', '&nbsp;', 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
* <code>
* Html::attributes(array('id' => 'some-id', 'selected' => false, 'disabled' => true, 'class' => array('a', 'b')));
* //=> ' id="some-id" disabled class="a b"'
* </code>
*
* @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 '<div class="row form_head ">
<div class=" col-12 form_head_title ">
<b>' . $title . '</b>
</div>
</div>
';
}
/**
* 输出行标题
*
* @param string $title
* @return void
*/
public static function formRowTitle(string $title)
{
return '<div class="row " style="padding-top:10px;">
<div class=" col-lg-12 form_row_header ">
<b>' . $title . '</b>
</div>
</div>
';
}
/**
* 输出行内容
*
* @return void
*/
public static function formRowContent($fieldName, string $fieldValue, string $key)
{
return ' <div class="col-1 form_field_title">
<p>' . $fieldName . '</p>
</div>
<div class="col-3 form_field_content">
<input class=" form-control form-control-sm" value=' . $fieldValue . ' name=' . $key . ' id=' . $key . ' />
</div>
';
}
/**
* 生成Row
*
* @return void
*/
public function formRow()
{
$_div = " <div class='row' >";
$_div .= "</div>";
}
}

324
wms/cont/MICalculator.php

@ -1,324 +0,0 @@
<?php
require_once '../../workflow/lib/DB.php';
class MICalculator
{
/**
* 計算MI
*
* @param array $param
* @return void
*/
public function cal(array $param)
{
$elevator_type = $param['elevator_type'];
$func = $elevator_type . "_price";
if (method_exists($this, $elevator_type . "_price")) {
return call_user_func([$this, $func], $param);
}
return self::error();
}
/**
* 客梯報價 maintain_kind='A'
* 1.每月2次保養價格*1.25倍
* 2.全包價格按半包價+1500元/臺
* 3.簽5年長約免費送M1係統的+2600元/臺"
* @return void
*/
public function A_price(array $item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_mi_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['speed'] . " between min_speed and max_speed
and " . $item['persons'] . " between min_persons and max_persons
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
* 貨梯報價
*
* @return void
*/
public function B_price($item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_mi_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['weight'] . " between min_weight and max_weight
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
* 病床梯報價
*
* @return void
*/
public function C_price($item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_mi_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['weight'] . " between min_weight and max_weight
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
* 無機房報價
*
* @return void
*/
public function D_price($item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_mi_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['persons'] . " between min_persons and max_persons
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
*家用梯報價
*
* @return void
*/
public function E_price(array $item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_mi_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['persons'] . " between min_persons and max_persons
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_period= " . $item['maintain_period'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
// echo $sql_get_price;
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
public function error()
{
return [
'status' => 'fail',
'message' => '無此項目,請聯係業務部創建MI'
];
}
public function success($price)
{
return [
'status' => 'ok',
'price' => $price
];
}
}

322
wms/cont/MSCalculator.php

@ -1,322 +0,0 @@
<?php
require_once '../../workflow/lib/DB.php';
class MSCalculator
{
/**
* 計算报价
*
* @param array $param
* @return void
*/
public function cal(array $param)
{
$elevator_type = $param['elevator_type'];
$func = $elevator_type . "_price";
if (method_exists($this, $elevator_type . "_price")) {
return call_user_func([$this, $func], $param);
}
return self::error();
}
/**
* 客梯成本maintain_kind='A'
* 1.每月2次保養價格*1.25倍
* 2.全包價格按半包價+1500元/臺
* 3.簽5年長約免費送M1係統的+2600元/臺"
* @return void
*/
public function A_price(array $item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
SELECT
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_standard_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['speed'] . " between min_speed and max_speed
and " . $item['persons'] . " between min_persons and max_persons
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
* 貨梯成本
*
* @return void
*/
public function B_price($item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_standard_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['weight'] . " between min_weight and max_weight
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
* 病床梯成本
*
* @return void
*/
public function C_price($item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_standard_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['weight'] . " between min_weight and max_weight
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
* 無機房成本
*
* @return void
*/
public function D_price($item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_standard_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['persons'] . " between min_persons and max_persons
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_months= " . $item['maintain_months'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
/**
*家用梯成本
*
* @return void
*/
public function E_price(array $item)
{
$floors = $item['floors'];
$maintain_times = $item['maintain_times'];
$sql_get_price = "
select
elevator_type,
base_price,
floors_price,
min_floors,
min_maintain_times,
maintain_months,
maintain_kind,
maintain_period,
is_m1_bundle,
all_inclusive_fee,
maintenance_fee_coefficient,
m1_bundle_fee
from maintain_standard_option where
elevator_type='" . $item['elevator_type'] . "'
and " . $item['floors'] . " between min_floors and max_floors
and " . $item['persons'] . " between min_persons and max_persons
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times
and maintain_period= " . $item['maintain_period'] . "
and maintain_kind='" . $item['maintain_kind'] . "'
and is_m1_bundle='" . $item['is_m1_bundle'] . "'
";
list($row) = DB::result($sql_get_price);
if (empty($row)) return self::error();
#1基礎價格
$floors = $item['floors'] - $row['min_floors'];
$price1 = $row['base_price'] + ($floors) * $row['floors_price'];
// echo $price1;
#判斷是否全包
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1;
// echo $price2;
#判斷是否五年M1套餐
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2;
// echo $price3;
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3);
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times
$price4 = $price3;
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) {
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient'];
}
return self::success($price4);
}
public function error()
{
return [
'status' => 'fail',
'message' => '無此項目,請聯係業務部創建標準成本'
];
}
public function success($price)
{
return [
'status' => 'ok',
'price' => $price
];
}
}

22
wms/cont/apply.php

@ -1,22 +0,0 @@
<?php
/**
* 发起流程
*/
error_reporting(E_ALL);
ini_set("display_errors", "on");
require_once "./wf_common.php";
require_once "../database.php";
#系统ID
$system_id = 'psm';
#流程ID
$flow_id = 'psm01';
#表单号 $form_id;
$form_id = "";
$wf = new WorkFlow($system_id, $flow_id, $form_id);
$wf->initWorkFlow(ID);
//加载视图
echo '<a href="https://www.masada.com.tw/wms/sign/list.php">查看全部待签</a>';

859
wms/cont/apply_form.php

@ -1,859 +0,0 @@
<?php
require_once '../header_nomenu.php';
require_once './FormHelper.php';
require_once './wf_common.php';
// require_once('./conn.php');
$vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no'];
/***
* 检查是否重复生成价审单
* con_maintance_examine_apply
*/
/*
list($cnt)=DB::fields("select count(*) cnt from con_maintance_examine_apply where vol_no='$vol_no'");
if($cnt>0) {
echo"<script>alert('卷號".$vol_no."已生成價審單,請勿重複生成!');history.go(-1);</script>";
exit;
}
*/
#係統ID
$system_id = 'con';
#流程ID
$flow_id = 'con01';
#表單號 $form_id;
$form_id = "";
#價審單狀態
$apply_st = "";
list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1");
// echo '<pre>';
// print_r($apply_key);
// echo '</pre>';
// exit;
// if ($salesman != $user_id) {
// echo '<script>alert("您並不是該單營業員,無法訪問。");history.go(-1);</script>';
// exit;
// }
if (empty($apply_key)) $apply_st = 1; // 準備新增
else {
//list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'");
list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1");
if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交
else $apply_st = 9; // 已到下一關,無法䖺改
}
// if ($apply_st > 2) {
// echo "<script>alert('卷號" . $vol_no . "已生成價審單,請勿重複生成!');history.go(-1);</script>";
// exit;
// }
if ($apply_st == 1) {
$wf = new WorkFlow($system_id, $flow_id, $form_id);
$wf->initWorkFlow($user_id);
$form_key = $wf->flowContext->getFormKey();
} else {
$wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key);
}
#獲取簽核意見
$assign_opinions = Assign::get_records($form_key);
#會簽部門意見
$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key);
//預設冇有摺扣
$wf->setFormData(['discount' => 100]);
$flowName = $wf->getFlowName();
$assigner = $wf->getAssignerList();
$assign_status = $wf->getAssignStatus($assigner);
$if_show_assign = true;
//加載流程圖
//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID());
//$path = $fc[0]->wf_file;
//echo dirname(__DIR__)."/../"."$path";
//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path);
#是否可會簽
$isSplitable = $wf->isSplitable();
//表單數據
#客戶表
#1.電梯品牌選項
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='elevator_brand' order by code_name asc ";
$elevator_brand_opt = DB::result($sql);
#2.保養方式
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='maintain_kind'";
$maintain_kind_opt = DB::result($sql);
#3.電梯類型
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='maintain_elevator_kind'";
$elevator_kind_opt = DB::result($sql);
#4.付款方式
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='payment_kind' order by code_name+ 0 asc";
$payment_kind_opt = DB::result($sql);
#5.契約性質
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='contract_kind'";
$contract_kind_opt = DB::result($sql);
#6.是否贈送M1
$is_m1_bundle_opt = [
['label' => '是', 'value' => 'Y'],
['label' => '否', 'value' => 'N']
];
#7.機種
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='fp_kind'";
$fp_kind_opt = DB::result($sql);
#抓取有望客戶資料
$vol_no = $_GET['vol_no'];
$where = " and vol_no='$vol_no'";
$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no";
// 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 = " <tr>";
foreach ($con_maintance_examine_clear_columm as $key => $val) {
$fieldVal = "";
$_input = $val['tag'] == 'select' ?
FormHelper::select('', $val['options'], $fieldVal, $val['attr'])
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>";
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>";
if ((++$j % $col_count) == 0) {
if ($j == $col_count) $cmecRow .= "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>";
$cmecRow .= "</tr><tr>";
}
}
$cmecRow .= "</tr>";
function base_url($url)
{
return "https://www.masada.com.tw/static/" . $url;
}
function get_sequnece_no($seq_name = '', $p_yyyymm = '')
{
if (empty($p_yyyymm) || empty($seq_name)) return null;
#當前年月
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' ");
if ($p_yyyymm != $yyyymm) {
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' ");
}
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no ";
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no ");
return $seq_no;
}
$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 = 'M0054';
$managername = '陳志文';
} else if ($result['department_id'] == '513') {
$managerid = 'M0086';
$managername = '李烘銘';
} else if ($result['department_id'] == '514') {
$managerid = 'M0033';
$managername = '吳育宗';
} else if ($user_id == 'TEST01') {
$managerid = 'TEST04';
$managername = '區經理';
}
if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') {
$managerid = 'M0008';
$managername = '詹益彰';
}
?>
<style>
button.disabled {
cursor: not-allowed;
background: #555;
}
</style>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" />
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script>
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script>
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100); ?>" />
<script type="text/javascript">
window.param = {
elevator_type: '',
floors: 1,
speed: 1,
persons: 6,
weight: 1000,
maintain_times: 1, //病床梯一月2次保養
maintain_months: 12,
maintain_kind: 2,
maintain_period: 1, //預設為1月1次, 2是為2月一次
is_m1_bundle: 'N',
};
let regDelStr = "";
$(document).ready(function() {
var tag_data;
$.ajax({
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner',
//url: 'http://localhost/fds/index.php/DesignFlow/get_assigner',
type: 'post',
dataType: 'json',
success: function(data) {
window.tag_data = data;
$('#selectPage').selectPage({
showField: 'show_name',
keyField: 'val',
data: data,
multiple: true,
multipleControlbar: true,
pagination: false,
focusDropList: false
});
}
});
$.validator.addMethod('gt', function(value, element, param) {
return value > param;
}, $.validator.format("輸入值必須大於0"));
var assigner = eval('<?= json_encode($assigner) ?>');
//console.log(assigner);
var cmecRow = "<?= str_replace('"', '\'', $cmecRow) ?>";
// $('#cmecTbody').append(cmecRow);
$('.sp_element_box').attr("disabled", true);
$("#assign_opinion").cleditor({
height: 100, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic underline strikethrough subscript superscript | font size " +
"style | color highlight removeformat | bullets numbering | outdent " +
"indent | alignleft center alignright justify | undo redo | "
});
$('#contract_begin_date').on('input propertychange', function(e) {
var date = new Date(e.target.value);
var yyyy = date.getFullYear() + 1;
var mm = date.getMonth() + 1;
var dd = date.getDate();
var time = yyyy + `-` + (mm < 10 ? '0' + mm : mm) + '-' + (dd < 10 ? '0' + dd : dd);
$('#contract_end_date').val(time);
});
$('#brand').change(function() {
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態
if (_selected_status == 'Z') {
$('#brandModal').modal('show')
}
});
$('#assign_status').change(function() {
$("#next_users").empty();
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態
var _option_tmp = ""; //獲取下拉列表
// for (a in assigner) { //遍曆assigner
// if (assigner[a][0] == _selected_status) {
// _tmp = assigner[a][1].split(',');
// for (var b in _tmp) {
// if (_tmp[b] == '') {
// continue;
// }
// _uname = _tmp[b].split('-')[1];
// _uid = _tmp[b].split('-')[0];
// /* console.log(_tmp[b]);*/
// _option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>';
// }
// }
// }
_option_tmp = '<option value=' + '<?php echo $managerid ?>' + '>' + '<?php echo $managername ?>' + '</option>';
$("#next_users").append(_option_tmp);
});
$('#maintain_kind').change(function() {
if ($('#cmecTbody tr').length > 0) {
alert("保養方式已更動,請開始輸入電梯資料!");
$('#cmecTbody').find(':input').val('');
return false;
}
});
$("#form").validate();
$("form").submit(function(e) {
$('#reg_del').val(regDelStr);
});
});
const addRow = function() {
if ($('#maintain_kind').val() == "") {
alert("請選擇保養方式!");
$('#maintain_kind').eq(0).focus();
return false;
}
var cmecRow = "<?= $cmecRow ?>";
$('#cmecTbody').append(cmecRow);
$("select[name^='elevator_kind'],select[name^='is_m1_bundle']").on('change', function(obj) {
//console.log('#'+$(this).attr('name')+'#');
var elen = 1;
if ('elevator_kind[]' == $(this).attr('name')) {
var children = $(this).parent().parent().parent();
var elementObj = $(children).next('tr').find("input[name^='stand_price']");
//var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option:selected").val();
} else if ('is_m1_bundle[]' == $(this).attr('name')) {
var children = $(this).parent().parent().parent().prev('tr');
var elementObj = $(this).parent().parent().parent().find("input[name^='stand_price']");
//var is_m1_bundle = $(this).val();
}
var element = elementObj;
if ('elevator_kind[]' == $(this).attr('name')) {
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option:selected").val();
} else if ('is_m1_bundle[]' == $(this).attr('name')) {
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle']").val();
}
var floors = $(children).find("input[name^='floors']").val();
var speed = $(children).find("input[name^='speed']").val();
var weight = $(children).find("input[name^='weight']").val();
var persons = $(children).find("input[name^='persons']").val();
var maintain_times = $(children).find("input[name^='maintain_times']").val();
var maintain_months = $(children).find("input[name^='maintain_months']").val();
var maintain_period = $(children).find("input[name^='maintain_period']").val();
var maintain_kind = $('#maintain_kind').val();
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val();
var param1 = {
...param,
persons,
floors,
speed,
weight,
maintain_times,
maintain_months,
maintain_period,
maintain_kind,
elevator_type,
is_m1_bundle
}
setStandPrice(param1, element);
// console.log(param1);
});
$("input[name^='floors']" +
",input[name^='speed']" +
",input[name^='persons']" +
",input[name^='weight']" +
",input[name^='maintain_times']" +
",input[name^='maintain_months']" +
",input[name^='maintain_period']"
).on('input propertychange', function(obj) {
// $(obj).parent().parent().parent().remove();
var children = $(this).parent().parent().parent().children();
var floors = $(children).find("input[name^='floors']").val();
var speed = $(children).find("input[name^='speed']").val();
var weight = $(children).find("input[name^='weight']").val();
var persons = $(children).find("input[name^='persons']").val();
var maintain_times = $(children).find("input[name^='maintain_times']").val();
var maintain_months = $(children).find("input[name^='maintain_months']").val();
var maintain_period = $(children).find("input[name^='maintain_period']").val();
var maintain_kind = $('#maintain_kind').val();
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val();
var is_m1_bundle = $(this).parent().parent().parent().next('tr').find("select[name^='is_m1_bundle'] option:selected").val();
var param1 = {
...param,
persons,
floors,
speed,
weight,
maintain_times,
maintain_months,
maintain_period,
maintain_kind,
elevator_type,
is_m1_bundle
}
var element = $(this).parent().parent().parent().next().children().find("input[name^='stand_price']");
setStandPrice(param1, element);
});
}
const delRow = function(btn) {
if ($(btn).attr('name') == 'btn1') {
//console.log($(btn).parent().parent().prev('tr').find('input[id=register_code]').val());
regDelStr += $(btn).parent().parent().find('input[id=register_code]').val() + ",";
$(btn).parent().parent().next('tr').remove();
} else {
//console.log($(btn).parent().parent().find('input[id=register_code]').val());
$(btn).parent().parent().next('tr').remove();
$(btn).parent().parent().remove();
}
$(btn).parent().parent().remove();
}
const setStandPrice = function(p, obj) {
$.ajax({
url: '../cont/t.php',
data: p,
type: 'get',
dataType: 'json',
//success: function(data) {},
success: function(data) {
console.log(data.price);
if (data.status == 'ok') {
$(obj).val(data.price);
} else {
$(obj).val(data.message);
}
if (data.message == '無此項目,請聯係業務部創建標準成本') {
console.log('1');
// $("button[name^=btn_save]").attr('disabled', true);
// $("button[name^=btn_save]").css('cursor', 'not-allowed')
$("#submit").css('background-color', '#666')
document.querySelector('#submit').classList.add('disabled')
document.querySelector('#submit').disabled = true
}
if (data.price) {
document.querySelector('#submit').classList.remove('disabled')
document.querySelector('#submit').disabled = false
$("#submit").css('background-color', '#007bff')
// $("button[name^=btn_save]").attr('disabled', false);
// $("button[name^=btn_save]").css('cursor', 'default')
// $("button[name^=btn_save]").css('background-color', '#666')
}
}
});
}
const addNewBrand = function() {
var new_brand = $("#new_brand").val();
if (new_brand != '') {
p = {
new_brand: new_brand,
method: 'add_brand'
}
$.ajax({
url: 'async_req.php',
data: p,
type: 'post',
dataType: 'json',
success: function(data) {
// console.info(data);
$("#brand").append("<option value='" + data.seq + "'>" + new_brand + "</option>");
},
error: function(data) {
// console.info(data);
}
});
}
}
$("input[name^='stand_price']").bind('input propertychang', function() {
if ($("input[name^='stand_price']").val() == '') {
console.log('無值');
$("button[name^=btn_save]").attr('disabled', true);
}
});
</script>
<body>
<div id="toolbarmenu">
<!--<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span>-->
<!-- 導航欄 -->
<ul class="nav nav-tabs" role="tablist" id="tablist">
<li class=" nav-item ">
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">簽核表單</a>
</li>
</ul>
</div>
<!-- 導航欄 END-->
<div class="tab-content ">
<div class="tab-pane active assign_content " id="tabassign">
<form action="submit.php" id='form' method="post" style='width:98%;margin:0 auto'>
<!-- hidden域 -->
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' />
<input type="hidden" name="token" value='<?= $_GET['token'] ?>' />
<input type="hidden" name="reg_del" id="reg_del">
<input type="hidden" name="form_src" id="form_src" value="apply_form">
<!--表單start-->
<div class=" form container-fluid pt-5">
<div class="row form_head ">
<div class=" col-12 form_head_title ">
<h4> 保養契約價格審核單</h4>
</div>
</div>
<div class="row " style='padding-top:30px;'>
<div class=" col-lg-12 form_row_header ">
<b>契約信息</b>
</div>
</div>
<?php
//一行顯示三列
$i = 0;
echo " <div class='row '>";
foreach ($editableColumn as $key => $val) {
$j = (($i++) % 4);
$fieldVal = empty($data) ? "" : $data[0][$key];
$_input = $val['tag'] == 'select' ?
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr'])
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "'
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>";
if ($i != 1 && $j == 0) {
echo "
</div>
<div class='row'>
";
}
echo " <div class='col-1 form_field_title'>
" . $val['label'] . "
</div>
<div class=' col-2 form_field_content ' >
$_input
</div>
";
}
echo "</div>";
?>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>洽商進度</b>
</div>
<div class="col-12 " style="padding:0">
<textarea class='form-control textarea' id="progress_remark" name="progress_remark" value='12' rows='6'><?= $hope_contract['progress_status'] ?></textarea>
</div>
</div>
<div id="elevator_list_area " class="row ">
<div class="col-12 form_row_header ">
<b>電梯詳細資料</b>
</div>
<table style='margin-top:0px;text-align:center' class=' table-condensed' id='elevator_list'>
<thead>
<tr>
<td colspan='18' style='text-align:left;font-size:13px'>
<b>註意事項:</b>
<p>1.速度單位是 米/分.</p>
<p>2.選擇贈送M1,保養月數需填寫60.</p>
<p>3.標準價格未帶出,請聯係業務部建立該規格報價.</p>
<p>4.無機房速度20~60米 以60米為標準.</p>
</td>
</tr>
<tr>
<td colspan='18'><button onClick='addRow()' type="button" style='float:right' class="btn btn-link btn-md">+新增</button></td>
</tr>
<!-- <tr style='margin-top:0px;text-align:center'> -->
<?php
$j = 0;
echo "<tr style='margin-top:0px;text-align:center'>";
$i = 0;
$cmecRow = '<tr>';
foreach ($con_maintance_examine_clear_columm as $col => $col_def) {
echo FormHelper::tag("th", ['colspan' => empty($col_def['attr']['colspan']) ? 1 : $col_def['attr']['colspan']], $col_def['label']);
if ((++$j % $col_count) == 0) {
if ($j == $col_count) echo "<th>操作</th>";
echo "</tr><tr style='margin-top:0px;text-align:center'>";
}
}
echo '</tr>';
?>
</thead>
<tbody id='cmecTbody'>
<tr>
<?php
foreach ($con_maintance_examine_clear as $key => $val) {
$j = 0;
$cmecRow = "<tr>";
foreach ($con_maintance_examine_clear_columm as $col => $col_def) {
$fieldVal = empty($val) ? "" : $val[$col];
$_input = $col_def['tag'] == 'select' ?
FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr'])
: FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']);
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' :
$col_def['attr']['colspan']) . "' ><div class=' col-12'>
$_input</td>";
if ((++$j % $col_count) == 0) {
$cmecRow .= "<td><button name='btn1' onClick='delRow(this)' type='button' class='btn btn-link btn-md '>刪除</button></td>";
$cmecRow .= "</tr><tr>";
}
}
echo $cmecRow . "</tr>";
}
?>
</tr>
</tbody>
</table>
</div>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>簽核操作</b>
</div>
<div class="col-12 col-3 form_field_content " style="padding:0">
<textarea id="assign_opinion" name="assign_opinion" required></textarea>
</div>
</div>
<div class="row">
<div class=" col-3 form_field_title">
<b style='float:right'>簽核狀態</b>
</div>
<div class=" col-2 form_field_content ">
<select name="assign_status" id="assign_status" required class='form-control form-control form-control-sm '>
<?php echo $assign_status; ?>
</select>
</div>
<div class=" col-2 form_field_title">
<b>下位簽核者</b>
</div>
<div class="col-2 form_field_content">
<select name="next_users" id="next_users" class='form-control form-control-sm '></select>
</div>
<div class="col-3 form_field_title ">
<button type="submit" name="btn_save" class="btn btn-warning btn-sm" value="save" style='float:left;margin-right:4px;'>保存</button>&nbsp;
<button type="submit" name="btn_save" class="btn btn-primary btn-sm" value="tosign" style='float:left' id="submit">提交</button>
</div>
</div>
<div id="opinion_area " class="row form_comment ">
<div class='col-12 '>
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'>
<li class="active nav-item ">
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a>
</li>
</ul>
</div>
<div class="tab-content col-12">
<div role="tabpanel" class="tab-pane active" id="main_flow_assign">
<?php
$assign_departs = array();
foreach ($assign_opinions as $as) {
$assign_departs[$as['assign_depart']] = $as['assign_depart_name'];
}
?>
<div class="comment_items ">
<?php $cnt = 1;
$tmp_code = "0";
foreach ($assign_opinions as $as) { ?>
<div class="comment-item">
<!-- <div class="comment-title">
<b></b>
</div>-->
<?php
if (($as['flow_code']) != $tmp_code)
echo ' <div class="comment-title">
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b>
</div>';
$tmp_code = $as['flow_code'];
?>
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>">
<div class="comment-content-header">
<span>
<strong>
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?>
&nbsp;
<?php if ($as['lead_code'] < 90) echo
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?>
</strong>
</span>
<span>
<strong>
&nbsp;
<?php if ($as['assign_status'] == 'S') echo
" <label class='comment-content-tag'>申請人 </label>"; ?>
<?php if (substr($as['assign_status'], 0, 1) == 'B')
echo " <label class='comment-content-tag red-tag'>退回</label>"; ?>
<?php if (substr($as['assign_status'], 0, 2) == 'X3')
echo " <label class='comment-content-tag red-tag'>會簽</label>"; ?>
</strong>
</span>
<span class="comment-content-header-time">
簽核於:<?= $as['assign_date'] ?>
</span>
<!-- <ul class="comment-content-tags">
<li class="">不同意</li>
<li class="comment-content-tag-alert">退回</li>
</ul>-->
</div>
<div class="comment-content-body">
<?= $as['assign_opinion'] ?>
</div>
<!-- <div class="comment-content-footer">
<span>已上載附件:&nbsp;</span><a href="#">附件1</a>
</div>-->
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</form>
<!-- 模態框(Modal) -->
<div class="modal fade" id="brandModal" tabindex="-1" role="dialog" aria-labelledby="brandModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
新增廠牌
</div>
<div class="modal-body">
<input type="text" class='form-control form-control form-control-sm ' id='new_brand'>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onClick="addNewBrand()" data-dismiss="modal">保存</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
</div>
</div>
</body>

912
wms/cont/apply_form1.php

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

20
wms/cont/async_req.php

@ -1,20 +0,0 @@
<?php
require_once './wf_common.php';
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST;
//echo json_encode($request);
$func = $request['method'];
if (function_exists($func)) {
call_user_func($func, $request);
}
function add_brand($req)
{
$new_brand = $req['new_brand'];
list($code_name) = DB::fields("select cast(count(code_name) as SIGNED) +1 from code where field_name='elevator_brand' and code_name!='Z' ");
DB::query("INSERT INTO `code` (`field_name`, `code_name`, `content`, `remark`, `creator`, `create_at`) VALUES
('elevator_brand', '$code_name', '$new_brand', '电梯品牌', '', now());
");
echo json_encode(['seq' => $code_name]);
}

14
wms/cont/con_maintance_examine_clear.php

@ -1,14 +0,0 @@
<?php
#电梯详细资料
$con_maintance_examine_clear_columm = [
'register_code' => ['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' ");

42
wms/cont/conn.php

@ -1,42 +0,0 @@
<?php
$envFile = __DIR__ . '/.env'; // .env 文件的路径
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines !== false) {
foreach ($lines as $line) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
// 设置环境变量
putenv("$key=$value");
}
}
}
$db_hostname = getenv('DB_HOST'); //資料庫主機名稱
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號
$db_password = getenv('DB_PASSWORD'); //登入密碼
$db_name = getenv('DB_DATABASE'); //使用的資料庫
$db_charset = 'utf8'; //設定字元編碼
//建立PDO的指定工作
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset";
try {
//使用PDO連接到MySQL資料庫,建立PDO物件
$conn = new PDO($dsn, $db_username, $db_password);
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException)
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。
//設定主動以警告的形式報錯
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//如果連接錯誤,將抛出一個PDOException異常對象
} catch (PDOException $e) {
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作
die("ERROR!!!: " . $e->getMessage());
}
//$conn = null; //關閉資料庫的連線

21
wms/cont/crmm06_submit.php

@ -1,21 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set("display_errors", "On");
require_once './wf_common.php';
require_once './model/HopeContractCustomerModel.php';
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST;
$hecm = new HopeContractCustomerModel();
$cols = $hecm->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"<script>alert('已保存');history.go(-1);</script>";

168
wms/cont/list.php

@ -1,168 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set("display_errors", "on");
/**
* 显示所有的待签 员工所有待签
*/
// 載入db.php來連結資料庫
require_once "../database.php";
require_once "../header.php";
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$where_system_id = " and a.system_id like '" . $system_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
$sql_get = "select c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner,
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name ,
flow_name,c.update_date ,c.create_date from system_main a,flow_main b ,subflow c,flow d
where a.system_id=b.system_id
and b.flow_id=d.flow_id
and d.flow_id=b.flow_id
and c.form_key=d.form_key
$where_system_id
$where_flow_id
";
//echo $sql_get;
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
$system_name_opt = array_map(function ($item) {
return array('system_id' => $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));
?>
<style>
table {
table-layout: fixed;
width: 90%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
.table>tbody>tr>td,
.table>tbody>tr>th,
.table>tfoot>tr>td,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>thead>tr>th {
vertical-align: middle !important;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
table.query-table th {
text-align: right;
}
</style>
<form method='post' action='#'>
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>待签查询</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='width:50px'>系统名称</th>
<td colspan='1'>
<select class='form-control' name='system_id'>
<?php
echo " <option class='form-control' value='%' >全部</option>";
foreach ($system_name_opt as $opt) {
echo " <option class='form-control' value=" . $opt['system_id'] . " >" . $opt['system_name'] . "</option>";
}
?>
</select>
</td>
<th>流程名称</th>
<td colspan='1'> <select class='form-control' name='flow_id'>
<?php
echo " <option class='form-control' value='%' >全部</option>";
foreach ($flow_name_opt as $opt) {
echo " <option class='form-control' value=" . $opt['flow_id'] . " >" . $opt['flow_name'] . "</option>";
}
?>
</select> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="8" style='text-align:center'>
<button type="submit" style='text-align:center; margin:0 auto;width:50px' class="btn btn-primary">查询</button>
</td>
</tr>
</tfoot>
</table>
<div style="overflow-x:auto;width:92%;margin:0 auto">
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact">
<thead>
<tr>
<th>序号</th>
<th>系统名称</th>
<th>流程名称</th>
<th>接收日期</th>
<th>当前签核者</th>
</tr>
</thead>
<tbody>
<?php
$rowspan = 1;
foreach ($res_get as $key => $data) :
?>
<tr>
<td><a href="sign_form.php?form_key=<?= $data['form_key']; ?>"><?= $data['form_key']; ?></a></td>
<td><?php echo $data['system_name']; ?></td>
<td><?php echo $data['flow_name']; ?></td>
<td><?php echo $data['update_date']; ?></td>
<td><?php echo $data['current_assigner_name']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</form>
<?php
#代錶結束連線
mysqli_close($link);
require_once "../footer.php";
?>

29
wms/cont/model/ConMaintanceExamineApplyModel.php

@ -1,29 +0,0 @@
<?php
require_once 'Model.php';
class ConMaintanceExamineApplyModel extends Model
{
protected $table = 'con_maintance_examine_apply';
protected $fillable = [
'apply_key',
'vol_no',
'form_key',
'customer',
'address',
'case_name',
'brand',
'num',
'salesman',
'maintain_kind',
'contract_begin_date',
'contract_end_date',
'contract_kind',
'platform_company',
'platforom_company_tel',
'payment_kind',
'progress_remark',
'introducer',
'creater',
'updated_at',
];
}

33
wms/cont/model/ConMaintanceExamineClearModel.php

@ -1,33 +0,0 @@
<?php
require_once 'Model.php';
class ConMaintanceExamineClearModel extends Model
{
protected $table = 'con_maintance_examine_clear';
public $fillable = [
'apply_key',
'register_code',
'elevator_brand',
'elevator_kind',
'spec',
'weight',
'speed',
'stop',
'floors',
'persons',
'elevator_num',
'useful_years',
'last_check_date',
'speed_governors_check_expense',
'maintain_times',
'is_m1_bundle',
'maintain_months',
'maintain_period',
'stand_price',
'contract_price',
'sold_price',
// 'commission_expense',
//// 'management_expense',
'annual_survey_expense',
// 'service_expense',
];
}

53
wms/cont/model/Model.php

@ -1,53 +0,0 @@
<?php
class Model
{
protected $table = '';
protected $fillable = [];
/**
* 创建记录
*
* @param array $data
* @return void
*/
public function create(array $data)
{
$_data = [];
foreach ($this->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 [];
}
}

511
wms/cont/query_form.php

@ -1,511 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set("display_errors", "On");
require_once "../header_nomenu.php";
$apply_key = $_GET['apply_key'];
#$vol_no = $qword->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;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> <?php echo $flowName; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" />
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" />
<script type="text/javascript">
$(document).ready(function() {
var tag_data;
$.ajax({
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner',
type: 'post',
dataType: 'json',
success: function(data) {
window.tag_data = data;
$('#selectPage').selectPage({
showField: 'show_name',
keyField: 'val',
data: data,
multiple: true,
multipleControlbar: true,
pagination: false,
focusDropList: false
});
}
});
var assigner = eval('<?= json_encode($assigner) ?>');
// $('#cmecTbody').append(cmecRow);
$('.sp_element_box').attr("disabled", true);
$("#assign_opinion").cleditor({
height: 100, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic underline strikethrough subscript superscript | font size " +
"style | color highlight removeformat | bullets numbering | outdent " +
"indent | alignleft center alignright justify | undo redo | "
});
$('#assign_status').change(function() {
$("#next_users").empty();
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態
var _option_tmp = ""; //獲取下拉列表
for (a in assigner) { //遍曆assigner
if (assigner[a][0] == _selected_status) {
_tmp = assigner[a][1].split(',');
for (var b in _tmp) {
if (_tmp[b] == '') {
continue;
}
_uname = _tmp[b].split('-')[1];
_uid = _tmp[b].split('-')[0];
/* console.log(_tmp[b]);*/
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>';
}
}
}
$("#next_users").append(_option_tmp);
});
});
</script>
</head>
<body>
<!-- 導航欄 END-->
<div class="tab-content ">
<div class="tab-pane active assign_content " id="tabassign">
<form action="submit.php" method="post" style='width:98%;margin:0 auto'>
<!-- hidden域 -->
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' />
<input type="hidden" name="apply_key" value='<?php echo $apply_key; ?>' />
<!--表單start-->
<div class=" form container-fluid pt-5">
<div class="row form_head ">
<div class=" col-12 form_head_title ">
<h4> 保養契約價格審核單</h4>
</div>
</div>
<div class="row " style='padding-top:30px;'>
<div class=" col-lg-12 form_row_header ">
<b>契約信息</b>
</div>
</div>
<?php
//一行顯示三列
$i = 0;
echo " <div class='row '>";
foreach ($editableColumn as $key => $val) {
// print_r($val['label']);
$j = (($i++) % 4);
$fieldVal = empty($data) ? "" : $data[$key];
$fieldVal = empty($data) ? "" : $data[$key];
$_input = $val['tag'] == 'select' ?
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) :
FormHelper::tag("label", $val['attr'], $fieldVal);
// "<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "'
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>";
if ($i != 1 && $j == 0) {
echo "
</div>
<div class='row'>
";
}
echo " <div class='col-1 form_field_title'>
" . $val['label'] . "
</div>
<div class=' col-2 form_field_content ' >
$_input
</div>
";
}
echo "</div>";
?>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>洽商進度</b>
</div>
<div class="col-12 " style="padding:0">
<textarea class='form-control textarea' disabled id="progress_remark" name="progress_remark" value='12' rows='6'><?= $data['progress_remark'] ?></textarea>
</div>
</div>
<div id="elevator_list_area " class="row ">
<div class="col-12 form_row_header ">
<b>電梯詳細資料</b>
</div>
<table style='margin-top:0px;text-align:center' id='elevator_list'>
<thead>
<tr style='margin-top:0px;text-align:center'>
<?php
$j = 0;
foreach ($con_maintance_examine_clear_columm as $val) {
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan'])
? 1 : $val['attr']['colspan']], $val['label']);
if ((++$j % 14) == 0) {
// if ($j == 12) echo "<th>操作</th>";
echo "</tr><tr style='margin-top:0px;text-align:center'>";
}
}
?>
</tr>
</thead>
<tbody id='cmecTbody'>
<?php
$i = 0;
$tr_class = "odd";
foreach ($con_maintance_examine_clear as $key => $val) {
$j = 0;
$cmecRow = " <tr $i class='$tr_class'>";
foreach ($con_maintance_examine_clear_columm as $col => $col_def) {
$fieldVal = empty($val) ? "" : $val[$col];
if ($col == 'mi_cost') {
$param = [
'elevator_type' => $val['con_elevator_kind'],
'floors' => $val['floors'],
'speed' => $val['speed'],
'persons' => $val['persons'],
'weight' => $val['weight'],
'maintain_times' => $val['maintain_times'],
'maintain_months' => $val['maintain_months'],
'maintain_kind' => $data['maintain_kind'],
'maintain_period' => $val['maintain_period'],
'is_m1_bundle' => $val['is_m1_bundle'],
];
$mic = new MICalculator();
$res = $mic->cal($param);
#MI報價
$con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = $res['status'] == 'ok' ? $res['price'] : $res['message'];
$con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%"
#扣率
$val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%";
}
$_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1
: $col_def['attr']['colspan']], $fieldVal);
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? ''
: $col_def['attr']['colspan']) . "' ><div class=' col-12'> $_input</td>";
$cmecRow = (++$j % 14 == 0) ? $cmecRow . "</tr ><tr $i class='$tr_class'>" : $cmecRow;
}
$tr_class = $tr_class == 'odd' ? "even" : "odd";
echo $cmecRow . "</tr>";
}
?>
</tbody>
<tfoot>
<?php
#總臺數
$count = count($con_maintance_examine_clear);
#總成交價
$total_sold_price = 0;
#總標準價格
$total_stand_price = 0;
#總標準成本
$total_mi_cost = 0;
foreach ($con_maintance_examine_clear as $val) {
$total_sold_price += $val['sold_price'];
$total_stand_price += $val['stand_price'];
$total_mi_cost += $val['mi_cost'];
}
$total_discount_rate = $total_sold_price == 0 ? 0 : (100 * round($total_sold_price / $total_stand_price, 4)) . "%"
?>
<tr>
<td colspan='20'>
<div style='float:right'>
<label>合計成交價:<?= $count == 0 ? $count : $total_sold_price ?>; </label>
<label>合計成本:<?= $count == 0 ? $count : $total_mi_cost ?>; </label>
<label>折扣率(C/A):<?= $total_discount_rate ?>; </label>
<label>毛利率:/</label>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="opinion_area " class="row form_comment ">
<div class='col-12 '>
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'>
<li class="active nav-item ">
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a>
</li>
</ul>
</div>
<div class="tab-content col-12">
<div role="tabpanel" class="tab-pane active" id="main_flow_assign">
<?php
$assign_departs = array();
foreach ($assign_opinions as $as) {
$assign_departs[$as['assign_depart']] = $as['assign_depart_name'];
}
?>
<div class="comment_items ">
<?php $cnt = 1;
$tmp_code = "0";
foreach ($assign_opinions as $as) { ?>
<div class="comment-item">
<!-- <div class="comment-title">
<b></b>
</div>-->
<?php
if (($as['flow_code']) != $tmp_code)
echo ' <div class="comment-title">
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b>
</div>';
$tmp_code = $as['flow_code'];
?>
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>">
<div class="comment-content-header">
<span>
<strong>
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?>
&nbsp;
<?php if ($as['lead_code'] < 90) echo
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?>
</strong>
</span>
<span>
<strong>
&nbsp;
<?php if ($as['assign_status'] == 'S') echo
" <label class='comment-content-tag'>申請人 </label>"; ?>
<?php if (substr($as['assign_status'], 0, 1) == 'B')
echo " <label class='comment-content-tag red-tag'>退回</label>"; ?>
<?php if (substr($as['assign_status'], 0, 2) == 'X3')
echo " <label class='comment-content-tag red-tag'>會簽</label>"; ?>
</strong>
</span>
<span class="comment-content-header-time">
簽核於:<?= $as['assign_date'] ?>
</span>
<!-- <ul class="comment-content-tags">
<li class="">不同意</li>
<li class="comment-content-tag-alert">退回</li>
</ul>-->
</div>
<div class="comment-content-body">
<?= $as['assign_opinion'] ?>
</div>
<!-- <div class="comment-content-footer">
<span>已上載附件:&nbsp;</span><a href="#">附件1</a>
</div>-->
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</body>

507
wms/cont/review_apply_form.php

@ -1,507 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set("display_errors", "On");
$q = empty($_GET['q']) ? "" : $_GET['q'];
$qword = json_decode(base64_decode(pack("H*", $q)));
$user_id = $qword->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 = " <tr>";
foreach ($con_maintance_examine_clear_columm as $key => $val) {
$fieldVal = "";
$_input = $val['tag'] == 'select' ?
FormHelper::select('', $val['options'], $fieldVal, $val['attr'])
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='请输入'>";
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>";
}
$cmecRow .= "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md'>删除</button></td>";
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;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> <?php echo $flowName; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" />
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script>
<script src="https://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script src="https://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" />
<script type="text/javascript">
$(document).ready(function() {
var tag_data;
$.ajax({
url: 'https://web.platform-cn.com/fds/index.php/DesignFlow/get_assigner',
type: 'post',
dataType: 'json',
success: function(data) {
window.tag_data = data;
$('#selectPage').selectPage({
showField: 'show_name',
keyField: 'val',
data: data,
multiple: true,
multipleControlbar: true,
pagination: false,
focusDropList: false
});
}
});
var assigner = eval('<?= json_encode($assigner) ?>');
var cmecRow = "<?= str_replace('"', '\'', $cmecRow) ?>";
// $('#cmecTbody').append(cmecRow);
$('.sp_element_box').attr("disabled", true);
$("#assign_opinion").cleditor({
height: 100, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic underline strikethrough subscript superscript | font size " +
"style | color highlight removeformat | bullets numbering | outdent " +
"indent | alignleft center alignright justify | undo redo | "
});
$('#assign_status').change(function() {
$("#next_users").empty();
var _selected_status = $(this).children('option:selected').val(); //获取被选择的状态
var _option_tmp = ""; //获取下拉列表
for (a in assigner) { //遍历assigner
if (assigner[a][0] == _selected_status) {
_tmp = assigner[a][1].split(',');
for (var b in _tmp) {
if (_tmp[b] == '') {
continue;
}
_uname = _tmp[b].split('-')[1];
_uid = _tmp[b].split('-')[0];
/* console.log(_tmp[b]);*/
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>';
}
}
}
$("#next_users").append(_option_tmp);
});
$("#form").validate();
});
addRow = function() {
var cmecRow = "<?= $cmecRow ?>";
$('#cmecTbody').append(cmecRow);
}
delRow = function(btn) {
$(btn).parent().parent().remove();
}
</script>
</head>
<body>
<div id="toolbarmenu">
<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span>
<!-- 导航栏 -->
<ul class="nav nav-tabs" role="tablist" id="tablist">
<li class=" nav-item ">
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">签核表单</a>
</li>
</ul>
</div>
<!-- 导航栏 END-->
<div class="tab-content ">
<div class="tab-pane active assign_content " id="tabassign">
<form action="submit.php" id='form' method="post" style='width:98%;margin:0 auto'>
<!-- hidden域 -->
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' />
<input type="hidden" value="" name="sheet_no" />
<!--表单start-->
<div class=" form container-fluid pt-5">
<div class="row form_head ">
<div class=" col-12 form_head_title ">
<h4> 保養合約價格審核單</h4>
</div>
</div>
<div class="row " style='padding-top:30px;'>
<div class=" col-lg-12 form_row_header ">
<b>合约信息</b>
</div>
</div>
<?php
//一行显示三列
$i = 0;
echo " <div class='row '>";
foreach ($editableColumn as $key => $val) {
$j = (($i++) % 4);
$fieldVal = empty($data) ? "" : $data[0][$key];
$_input = $val['tag'] == 'select' ?
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr'])
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']);
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "'
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='请输入'>";
if ($i != 1 && $j == 0) {
echo "
</div>
<div class='row'>
";
}
echo " <div class='col-1 form_field_title'>
" . $val['label'] . "
</div>
<div class=' col-2 form_field_content ' >
$_input
</div>
";
}
echo "</div>";
?>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>洽商进度</b>
</div>
<div class="col-12 " style="padding:0">
<textarea class='form-control textarea' id="progress_remark" name="progress_remark" value='12' rows='6'><?= $data[0]['progress_remark'] ?></textarea>
</div>
</div>
<div id="elevator_list_area " class="row ">
<div class="col-12 form_row_header ">
<b>电梯详细资料</b>
</div>
<table style='margin-top:0px;text-align:center' id='elevator_list'>
<thead>
<tr>
<td colspan='15' ;><button onClick='addRow()' type="button" style='float:right' class="btn btn-link btn-md">+新增</button></td>
</tr>
<tr style='margin-top:0px;text-align:center'>
<?php
foreach ($con_maintance_examine_clear_columm as $val) {
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan']) ? 1 : $val['attr']['colspan']], $val['label']);
//echo "<th>" . $val['label'] . "</th>";
}
echo "<th>操作</th>";
?>
</tr>
</thead>
<tbody id='cmecTbody'>
<?php
foreach ($con_maintance_examine_clear as $key => $val) {
$cmecRow = " <tr>";
foreach ($con_maintance_examine_clear_columm as $col => $col_def) {
$fieldVal = empty($val) ? "" : $val[$col];
$_input = $col_def['tag'] == 'select' ?
FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr'])
: FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']);
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' : $col_def['attr']['colspan']) . "' ><div class=' col-12'> $_input</td>";
}
echo $cmecRow . "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md '>删除</button></td></tr>";
}
?>
</tbody>
</table>
</div>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>签核操作</b>
</div>
<div class="col-12 col-3 form_field_content " style="padding:0">
<textarea id="assign_opinion" name="assign_opinion" required></textarea>
</div>
</div>
<div class="row">
<div class=" col-3 form_field_title">
<b style='float:right'>签核状态</b>
</div>
<div class=" col-2 form_field_content ">
<select name="assign_status" id="assign_status" required class='form-control form-control form-control-sm '>
<?php echo $assign_status; ?>
</select>
</div>
<div class=" col-2 form_field_title">
<b>下位签核者</b>
</div>
<div class="col-2 form_field_content">
<select name="next_users" id="next_users" required class='form-control form-control-sm '></select>
</div>
<div class="col-3 form_field_title ">
<button type="submit" class="btn btn-primary btn-sm" style='float:left'>提交</button>
</div>
</div>
<div id="opinion_area " class="row form_comment ">
<div class='col-12 '>
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'>
<li class="active nav-item ">
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">签核意见</a>
</li>
</ul>
</div>
<div class="tab-content col-12">
<div role="tabpanel" class="tab-pane active" id="main_flow_assign">
<?php
$assign_departs = array();
foreach ($assign_opinions as $as) {
$assign_departs[$as['assign_depart']] = $as['assign_depart_name'];
}
?>
<div class="comment_items ">
<?php $cnt = 1;
$tmp_code = "0";
foreach ($assign_opinions as $as) { ?>
<div class="comment-item">
<!-- <div class="comment-title">
<b></b>
</div>-->
<?php
if (($as['flow_code']) != $tmp_code)
echo ' <div class="comment-title">
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b>
</div>';
$tmp_code = $as['flow_code'];
?>
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>">
<div class="comment-content-header">
<span>
<strong>
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?>
&nbsp;
<?php if ($as['lead_code'] < 90) echo
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?>
</strong>
</span>
<span>
<strong>
&nbsp;
<?php if ($as['assign_status'] == 'S') echo
" <label class='comment-content-tag'>申请人 </label>"; ?>
<?php if (substr($as['assign_status'], 0, 1) == 'B')
echo " <label class='comment-content-tag red-tag'>退回</label>"; ?>
<?php if (substr($as['assign_status'], 0, 2) == 'X3')
echo " <label class='comment-content-tag red-tag'>会签</label>"; ?>
</strong>
</span>
<span class="comment-content-header-time">
签核于:<?= $as['assign_date'] ?>
</span>
<!-- <ul class="comment-content-tags">
<li class="">不同意</li>
<li class="comment-content-tag-alert">退回</li>
</ul>-->
</div>
<div class="comment-content-body">
<?= $as['assign_opinion'] ?>
</div>
<!-- <div class="comment-content-footer">
<span>已上传附件:&nbsp;</span><a href="#">附件1</a>
</div>-->
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</body>

577
wms/cont/sign_form.php

@ -1,577 +0,0 @@
<?php
// phpinfo();
// exit;
#error_reporting(E_ALL);
#ini_set("display_errors", "On");
require_once '../header_nomenu.php';
//echo $user_id;
$apply_key = "";
$form_key = $_GET['form_key'];
$token = $_GET['token'];
#$vol_no = $qword->vol_no;
require_once './FormHelper.php';
require_once '../cont/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;
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" />
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script>
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script>
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" />
<script type="text/javascript">
$(document).ready(function() {
var tag_data;
$.ajax({
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner',
type: 'post',
dataType: 'json',
success: function(data) {
window.tag_data = data;
$('#selectPage').selectPage({
showField: 'show_name',
keyField: 'val',
data: data,
multiple: true,
multipleControlbar: true,
pagination: false,
focusDropList: false
});
}
});
var assigner = eval('<?= json_encode($assigner) ?>');
$("#form").validate();
// $('#cmecTbody').append(cmecRow);
$('.sp_element_box').attr("disabled", true);
$("#assign_opinion").cleditor({
height: 100, // height not including margins, borders or padding
controls: // controls to add to the toolbar
"bold italic underline strikethrough subscript superscript | font size " +
"style | color highlight removeformat | bullets numbering | outdent " +
"indent | alignleft center alignright justify | undo redo | "
});
$('#assign_status').change(function() {
$("#next_users").empty();
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態
var _option_tmp = ""; //獲取下拉列表
for (a in assigner) { //遍曆assigner
if (assigner[a][0] == _selected_status) {
_tmp = assigner[a][1].split(',');
for (var b in _tmp) {
if (_tmp[b] == '') {
continue;
}
_uname = _tmp[b].split('-')[1];
_uid = _tmp[b].split('-')[0];
/* console.log(_tmp[b]);*/
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>';
}
}
}
$("#next_users").append(_option_tmp);
});
});
</script>
</head>
<body>
<div id="toolbarmenu">
<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span>
<!-- 導航欄 -->
<ul class="nav nav-tabs" role="tablist" id="tablist">
<li class=" nav-item ">
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">簽核表單</a>
</li>
</ul>
</div>
<!-- 導航欄 END-->
<div class="tab-content ">
<div class="tab-pane active assign_content " id="tabassign">
<form action="submit.php" method="post" id='form' style='width:98%;margin:0 auto'>
<!-- hidden域 -->
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' />
<input type="hidden" name="apply_key" value='<?php echo $data['apply_key']; ?>' />
<input type="hidden" name="token" value='<?php echo $token; ?>' />
<input type="hidden" name="form_src" id="form_src">
<!--表單start-->
<div class=" form container-fluid pt-5">
<div class="row form_head ">
<div class=" col-12 form_head_title ">
<h4> 保養契約價格審核單</h4>
</div>
</div>
<div class="row " style='padding-top:30px;'>
<div class=" col-lg-12 form_row_header ">
<b>契約信息</b>
</div>
</div>
<?php
//一行顯示三列
$i = 0;
echo " <div class='row '>";
foreach ($editableColumn as $key => $val) {
$j = (($i++) % 4);
$fieldVal = empty($data) ? "" : $data[$key];
$_input = $val['tag'] == 'select' ?
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) :
FormHelper::tag("label", $val['attr'], $fieldVal);
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "'
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>";
if ($i != 1 && $j == 0) {
echo "
</div>
<div class='row'>
";
}
echo " <div class='col-1 form_field_title'>
" . $val['label'] . "
</div>
<div class=' col-2 form_field_content ' >
$_input
</div>
";
}
echo "</div>";
?>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>洽商進度</b>
</div>
<div class="col-12 " style="padding:0">
<textarea class='form-control textarea' disabled id="progress_remark" name="progress_remark" value='12' rows='6'> <?php echo empty($data['progress_remark']) ? '' : $data['progress_remark'] ?> </textarea>
</div>
</div>
<div id="elevator_list_area " class="row ">
<div class="col-12 form_row_header ">
<b>電梯詳細資料</b>
</div>
<table style='margin-top:0px;text-align:center' id='elevator_list'>
<thead>
<tr style='margin-top:0px;text-align:center'>
<?php
$j = 0;
foreach ($con_maintance_examine_clear_columm as $val) {
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan'])
? 1 : $val['attr']['colspan']], $val['label']);
if ((++$j % 14) == 0) {
// if ($j == 12) echo "<th>操作</th>";
echo "</tr><tr style='margin-top:0px;text-align:center'>";
}
}
?>
</tr>
</thead>
<tbody id='cmecTbody'>
<?php
$i = 0;
$tr_class = "odd";
foreach ($con_maintance_examine_clear as $key => $val) {
$j = 0;
$cmecRow = " <tr $i class='$tr_class'>";
foreach ($con_maintance_examine_clear_columm as $col => $col_def) {
$fieldVal = empty($val) ? "" : $val[$col];
if ($col == 'mi_cost') {
$param = [
'elevator_type' => $val['con_elevator_kind'],
'floors' => $val['floors'],
'speed' => $val['speed'],
'persons' => $val['persons'],
'weight' => $val['weight'],
'maintain_times' => $val['maintain_times'],
'maintain_months' => $val['maintain_months'],
'maintain_kind' => $data['maintain_kind'],
'maintain_period' => $val['maintain_period'],
'is_m1_bundle' => $val['is_m1_bundle'],
];
$mic = new MICalculator();
$res = $mic->cal($param);
#MI報價
$con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = ($res['status']
== 'ok' ? $res['price'] : $res['message']);
$con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%"
#扣率
$val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%";
}
$_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1
: $col_def['attr']['colspan']], $fieldVal);
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? ''
: $col_def['attr']['colspan']) . "' ><div class=' col-12'> $_input</td>";
$cmecRow = (++$j % 14 == 0) ? $cmecRow . "</tr ><tr $i class='$tr_class'>" : $cmecRow;
}
$tr_class = $tr_class == 'odd' ? "even" : "odd";
echo $cmecRow . "</tr>";
}
?>
</tbody>
<tfoot>
<?php
$total_mi_cost = 0;
foreach ($con_maintance_examine_clear as $val) {
$total_mi_cost += $val['mi_cost'];
}
?>
<tr>
<td colspan='20'>
<div style='float:right'>
<label>合計成交價:<?= $count == 0 ? $count : $total_sold_price ?>; </label>
<label>合計成本:<?= $count == 0 ? $count : $total_mi_cost ?>; </label>
<label>折扣率(C/A):<?= $total_discount_rate ?>; </label>
<label>毛利率:/</label>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="assign_area " class="row ">
<div class="col-12 form_row_header ">
<b>簽核意見</b>
</div>
<div class="col-12 form_field_content " style="padding:0">
<textarea id="assign_opinion" name="assign_opinion"></textarea>
</div>
</div>
<div class="row">
<div class=" col-3 form_field_title">
<b style='float:right'>簽核狀態</b>
</div>
<div class=" col-2 form_field_content ">
<select name="assign_status" id="assign_status" class='form-control form-control form-control-sm '>
<?php echo $assign_status; ?>
</select>
</div>
<div class=" col-2 form_field_title">
<b>下位簽核者</b>
</div>
<div class="col-2 form_field_content">
<select name="next_users" id="next_users" class='form-control form-control-sm '></select>
</div>
<div class="col-3 form_field_title ">
<button type="submit" name="btn_save" class="btn btn-primary btn-sm" value="tosign" style='float:left'>提交</button>
</div>
</div>
<div id="opinion_area " class="row form_comment ">
<div class='col-12 '>
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'>
<li class="active nav-item ">
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a>
</li>
</ul>
</div>
<div class="tab-content col-12">
<div role="tabpanel" class="tab-pane active" id="main_flow_assign">
<?php
$assign_departs = array();
foreach ($assign_opinions as $as) {
$assign_departs[$as['assign_depart']] = $as['assign_depart_name'];
}
?>
<div class="comment_items ">
<?php $cnt = 1;
$tmp_code = "0";
foreach ($assign_opinions as $as) { ?>
<div class="comment-item">
<!-- <div class="comment-title">
<b></b>
</div>-->
<?php
if (($as['flow_code']) != $tmp_code)
echo ' <div class="comment-title">
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b>
</div>';
$tmp_code = $as['flow_code'];
?>
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>">
<div class="comment-content-header">
<span>
<strong>
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?>
&nbsp;
<?php if ($as['lead_code'] < 90) echo
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?>
</strong>
</span>
<span>
<strong>
&nbsp;
<?php if ($as['assign_status'] == 'S') echo
" <label class='comment-content-tag'>申請人 </label>"; ?>
<?php if (substr($as['assign_status'], 0, 1) == 'B')
echo " <label class='comment-content-tag red-tag'>退回</label>"; ?>
<?php if (substr($as['assign_status'], 0, 2) == 'X3')
echo " <label class='comment-content-tag red-tag'>會簽</label>"; ?>
</strong>
</span>
<span class="comment-content-header-time">
簽核於:<?= $as['assign_date'] ?>
</span>
<!-- <ul class="comment-content-tags">
<li class="">不同意</li>
<li class="comment-content-tag-alert">退回</li>
</ul>-->
</div>
<div class="comment-content-body">
<?= $as['assign_opinion'] ?>
</div>
<!-- <div class="comment-content-footer">
<span>已上載附件:&nbsp;</span><a href="#">附件1</a>
</div>-->
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</body>

225
wms/cont/sign_list.php

@ -1,225 +0,0 @@
<?php
require_once "../header.php";
// 載入db.php來連結資料庫
$table = 'con_maintance_examine_apply';
// 待我簽核進入
if (!empty($_GET['system_id']) && !empty($_GET['flow_id'])) {
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id'];
$where_system_id = " and a.system_id like '" . $system_id . "%'";
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id'];
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'";
$sql_get = "SELECT d.form_id,c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner,
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name ,
flow_name,c.update_date ,c.create_date,b.path,d.flow_code FROM system_main a,flow_main b ,subflow
c,flow d
WHERE a.system_id=b.system_id
AND b.flow_id=d.flow_id
AND c.current_assigner='$user_id'
AND d.flow_id=b.flow_id
AND c.form_key=d.form_key
$where_system_id
$where_flow_id
";
// echo '<pre>';
// print_r($sql_get);
// echo '</pre>';
$result = mysqli_query($link, $sql_get);
if ($result == false) {
die(mysqli_error($link));
}
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
foreach ($res_get as $key => $data) {
// 結案隱藏
if ($data['flow_code'] !== 'Z') {
$test = $data['form_key'];
// $sql = "SELECT mid FROM pricereview_sign WHERE id = $test";
// $result = mysqli_fetch_all(mysqli_query($link, $sql), MYSQLI_ASSOC);
// echo '<pre>';
// print_r($result);
// echo '</pre>';
$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 '<pre>';
// print_r($data);
// echo '</pre>';
?>
<?php
if ($data) :
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) {
echo "<p class='error'>Please fill up the required field!</p>";
} else {
header("Location:repair-index.php");
}
}
?>
<link rel="stylesheet" href="common.css">
<div style="overflow-x:auto;">
<form method='get' action='#'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>(契約)價審單查詢</h3>
</td>
</tr>
</thead>
</table>
<table id="table_index" class="table table-striped table-bordered" style="width:98%">
<thead>
<?php
echo "<tr>";
foreach ($editableColumn as $key => $val) {
echo "<th>" . $val['label'] . "</th>";
}
echo "<th>是否結案</th>";
// echo "<th>刪除</th>";
echo "</tr>";
?>
</thead>
<tbody>
<?php foreach ($data as $row) : ?>
<tr>
<?php
foreach ($editableColumn as $key => $val) {
if ($key == 'apply_key') {
echo "<td> <a href='query_form.php?apply_key=$row[$key]&token=" . $_GET['token'] . "'>" . $row[$key] . "</td>";
} elseif ($key == 'brand') {
echo "<td>" . (!empty($row[$key]) ? $elevator_brand_arr[$row[$key]] : "") . "</td>";
} else {
echo "<td>" . $row[$key] . "</td>";
}
}
//list($signer)=DB::fields(");
//echo " select f_return_name(current_assigner) signer from subflow where form_key='". $row['form_key'] ."'"; ". (is_array($row['form_key'])?'': $row['form_key']) ."
list($signer) = mysqli_fetch_array(mysqli_query($link, "select max(f_return_name(current_assigner) ) signer from subflow where form_key='" . $row['form_key'] . "'"));
echo "<td>" . (empty($signer) ? "結案" : "N") . "</td>";
?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "../footer.php";
?>

79
wms/cont/submit.php

@ -1,79 +0,0 @@
<?php
//require_once "../database.php";
require_once './wf_common.php';
require_once './model/ConMaintanceExamineApplyModel.php';
require_once './model/ConMaintanceExamineClearModel.php';
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST;
// print_r($request);
// exit;
$tosign = ($request["btn_save"] == "tosign") ? 1 : 0; // 1:提交
if ($request["form_src"] == "apply_form" && $tosign && (!isset($request["register_code"]) || empty($request["register_code"][0]) || !isset($request["next_users"]) || empty($request["next_users"]))) {
echo "<script type = 'text/JavaScript'>";
echo "alert('請確認電梯資料或未選擇下位簽核者!');";
echo "history.go(-1);";
echo "</script>";
exit;
}
//更新表单ConMaintanceExamineApplyModel
$cmea = new ConMaintanceExamineApplyModel();
$apply_key = $request['apply_key'];
$cmea->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 "<script type = 'text/JavaScript'>";
//echo "<h4 style='text-align:center'>成功提交<a href='https://www.masada.com.tw/wms/sign/list.php?function_name=show&token=" . $request['token'] . "'>返回待签 </a></h4>";
if ($tosign) {
echo "alert('成功提交');";
echo "location.href='../wms/index.php.php?function_name=sign_list&token=" . $request['token'] . "';";
} else {
echo "alert('資料已保存');";
echo "location.href='../crm/crmm02-index.php?function_name=contract_customer&token=" . $request['token'] . "';";
}
echo "</script>";

1
wms/cont/success.php

@ -1 +0,0 @@
<h4 style='text-align:center'>成功提交<a href='https://crm.platform-cn.com/pqm/pqmm01'>返回待签 </a></h4>

84
wms/cont/t.php

@ -1,84 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('dispaly_errors', "On");
require_once './MSCalculator.php';
//客梯
$param = [
'elevator_type' => '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);

174
wms/cont/test.php

@ -1,174 +0,0 @@
<?php
require_once './wf_common.php';
#遍历所有大区
$yyyymm = '202306';
$res_regions = DB::result("select code_name,content from code where field_name='regions' ");
$region_data = [];
#遍历所有大区
foreach ($res_regions as $regions) {
echo $regions['code_name'];
$region_data[$regions['code_name']] = [
'depart_name' => $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 "<pre>";
var_dump($region_data);
}

20
wms/cont/wf_common.php

@ -1,20 +0,0 @@
<?php
//require_once "../header_nomenu.php";
#当前登陆者
define("ID", 'P0044');
$arr = array(
'../../workflow/impl/*.php',
'../../workflow/model/*.php',
'../../workflow/lib/*.php',
'../../workflow/Handler/*.php',
'../../workflow/*.php'
);
foreach ($arr as $dir) {
$files = glob($dir);
foreach ($files as $file) {
require_once $file;
}
}

84
wms/contract-repair/js/alpine.js

@ -320,7 +320,7 @@ const contractRepair = () => {
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,
}
}

BIN
wms/contract/option/option2.xlsx

Binary file not shown.

1
wms/frame/api_getdata.php

@ -22,7 +22,6 @@
*/
$json = array("st" => "ok", "err" => "", "errCode" => "");
echo '123';
/**
* 表單列表
*/

59
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;
}

12
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());
})

Loading…
Cancel
Save