106 changed files with 12626 additions and 1257 deletions
Binary file not shown.
@ -1,201 +0,0 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$BillNo = $_GET['BillNo']; |
|||
echo $BillNo; |
|||
//企業名稱 統一編號 聯絡地址 |
|||
// $Bill = $_POST['Bill']; |
|||
// $Bill = json_decode($Bill, true); |
|||
// $sql_received = "SELECT * from account_received where BillNo = '$Bill[0]' ORDER BY `pay_id` ASC"; |
|||
// $pay_received = mysqli_query($link, $sql_received); |
|||
// $had_received = 0; |
|||
// if (mysqli_num_rows($pay_received) == 0) { |
|||
// foreach ($pay_received as $received) { |
|||
// $had_received += $received['received_amount']; |
|||
// } |
|||
// } |
|||
// $unreceived = $Bill[12] - $had_received; |
|||
// $data = json_encode($Bill); |
|||
?> |
|||
<style> |
|||
th { |
|||
text-align: center; |
|||
} |
|||
|
|||
td { |
|||
text-align: right; |
|||
} |
|||
</style> |
|||
<div style="width: 90%;"> |
|||
|
|||
<div style="padding-left: 2rem; padding-bottom: 1rem;"> |
|||
<a href="account-receivable-index.php?<?php echo $token_link; ?>" class="btn btn-default btn-lg"> |
|||
<span class="glyphicon glyphicon-home"></span> |
|||
</a> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="container"> |
|||
<div class="text-center" style="margin-bottom: 20px;"> |
|||
<h3><strong><?= $Bill[4] ?></strong></h3> |
|||
</div> |
|||
<form class="form-horizontal"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="BillNo">合約號</label> |
|||
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $Bill[0] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="DeptId">部門</label> |
|||
<input type="text" class="form-control" id="DeptId" name="DeptId" value="<?= $Bill[1] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="Manager">經理</label> |
|||
<input type="text" class="form-control" id="Manager" name="Manager" value="<?= $Bill[2] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="PersonName">營業員</label> |
|||
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $Bill[3] ?>" disabled> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="EnterpriseName">抬頭</label> |
|||
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $Bill[14] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="TaxNo">統一編號</label> |
|||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $Bill[15] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ContactAddress">聯絡地址</label> |
|||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $Bill[16] ?>" disabled> |
|||
</div> |
|||
</div> |
|||
<div> |
|||
<label for="detail">狀態</label> |
|||
<textarea class="form-control" style="height: 150px; width: 50%;" name="detail" id="detail" disabled><?= str_replace("<br>", "\n", $Bill[13]) ?></textarea> |
|||
</div> |
|||
</form> |
|||
<div style="width: auto; margin-top: 30px;"> |
|||
<table class="table table-striped table-bordered" style="width:100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th>目前應收</th> |
|||
<th>已開發票金額</th> |
|||
<th>未開發票金額</th> |
|||
<th>已收金額</th> |
|||
<th>未收金額</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?= number_format(round($Bill[12])) ?></td> |
|||
<td><?= number_format(round($Bill[19])) ?></td> |
|||
<td><?= number_format(round($Bill[21])) ?></td> |
|||
<td><?= number_format(round($Bill[20])) ?></td> |
|||
<td><?= number_format(round($Bill[22])) ?></td> |
|||
|
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
|
|||
<div style="width: auto; margin-top: 30px;"> |
|||
<table class="table table-striped table-bordered" style="width:100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th>簽約款</th> |
|||
<th>二次款</th> |
|||
<th>貨抵工地款</th> |
|||
<th>安裝款</th> |
|||
<th>試車款</th> |
|||
<th>官檢款</th> |
|||
<th>交車款</th> |
|||
|
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td><?= number_format(round($Bill[5])) ?></td> |
|||
<td><?= number_format(round($Bill[6])) ?></td> |
|||
<td><?= number_format(round($Bill[7])) ?></td> |
|||
<td><?= number_format(round($Bill[8])) ?></td> |
|||
<td><?= number_format(round($Bill[9])) ?></td> |
|||
<td><?= number_format(round($Bill[10])) ?></td> |
|||
<td><?= number_format(round($Bill[11])) ?></td> |
|||
|
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
include "./footer.php"; |
|||
|
|||
?> |
|||
<?php |
|||
if ($user_id == "M0122") { |
|||
?> |
|||
<button type="button" onclick="create('create',0)" class="btn btn-primary btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;"> |
|||
新增收款紀錄<span class=" glyphicon glyphicon-plus"></span></button> |
|||
<?php |
|||
} |
|||
?> |
|||
<div style="margin-right: 10%;margin-left: 10%; justify-content: center;"> |
|||
<table class="table table-striped table-bordered" style="width:100%;"> |
|||
<thead> |
|||
<tr> |
|||
<th>發票日期</th> |
|||
<th>發票金額</th> |
|||
<th>收款日期</th> |
|||
<th>收款金額</th> |
|||
<th>說明</th> |
|||
<th style="width: 10%;">功能</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php if ($pay_received) { |
|||
foreach ($pay_received as $received) { ?> |
|||
<tr> |
|||
<td><?= $received['invoice_date'] ?></td> |
|||
<td><?= number_format($received['invoice_amount']) ?></td> |
|||
<td><?= $received['received_date'] ?></td> |
|||
<td><?= number_format($received['received_amount']) ?></td> |
|||
<td><?= $received['remark'] ?></td> |
|||
<td><?php if (in_array(accountidToDepartId($user_id), array('220', '210'))) { ?> |
|||
<button type="button" onclick="create('edit',<?= $received['pay_id'] ?>)" class="btn btn-warning btn-sm pull-right" style="margin-right: 10%;margin-bottom: 10px;"> |
|||
<span class="glyphicon glyphicon-pencil"></span></button> |
|||
<a href="account-receivable-received-delete.php?id=<?php echo $received['pay_id'] ?>&<?= $token_link ?>" class="btn btn-danger btn-sm"> |
|||
<span class=" glyphicon glyphicon-trash"></span> |
|||
</a> |
|||
<?php } ?> |
|||
</td> |
|||
</tr> |
|||
<?php } |
|||
} ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<script> |
|||
function create(type, pay_id) { |
|||
var BillData = <?= $data ?>; |
|||
var form = document.createElement("form"); |
|||
form.method = 'POST'; |
|||
if (type === 'create') { |
|||
form.action = "account-receivable-received-create.php?<?= $token_link ?>"; |
|||
} else { |
|||
form.action = "account-receivable-received-edit.php?pay_id=" + pay_id + "&<?= $token_link ?>"; |
|||
} |
|||
|
|||
var input = document.createElement("input"); |
|||
input.type = "hidden"; |
|||
input.name = "Bill"; |
|||
input.value = JSON.stringify(BillData); |
|||
form.appendChild(input); |
|||
document.body.appendChild(form); |
|||
form.submit(); |
|||
} |
|||
</script> |
File diff suppressed because it is too large
@ -1 +0,0 @@ |
|||
<?php |
@ -0,0 +1,721 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start']; |
|||
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end']; |
|||
$sum_facility = 0; |
|||
$sum_contract = 0; |
|||
$sum_A40001 = 0; |
|||
$sum_A40008 = 0; |
|||
$sum_total_budget = 0; |
|||
$average_budget = 0; |
|||
$average_A40001 = 0; |
|||
$average_A40008 = 0; |
|||
$sum_invoice_budget = 0; |
|||
$sum_received_budget = 0; |
|||
$sum_collect_budget = 0; |
|||
|
|||
// 主要array |
|||
$arrayData = array(); |
|||
// 收款階段另存array整理收款順序 |
|||
$PayStage_array = array(); |
|||
// 所有的新梯合約號,方便後續SQL查詢 |
|||
$contractNumbers = array(); |
|||
|
|||
/* 比較應收日期 |
|||
@param $a array |
|||
@param $b array |
|||
return int */ |
|||
function comparePlanPayDate($a, $b) |
|||
{ |
|||
// return strtotime($a['PlanPayDate']) - strtotime($b['PlanPayDate']); |
|||
$aDate = strtotime($a['PlanPayDate']); |
|||
$bDate = strtotime($b['PlanPayDate']); |
|||
|
|||
if ($aDate === false && $bDate === false) { |
|||
return 0; // 兩個日期都無效,視為相等 |
|||
} elseif ($aDate === false) { |
|||
return 1; // $aDate 無效,認為 $aDate 較大 |
|||
} elseif ($bDate === false) { |
|||
return -1; // $bDate 無效,認為 $bDate 較大 |
|||
} |
|||
return $aDate - $bDate; |
|||
} |
|||
|
|||
/* 計算比例 |
|||
@param $facilityno string |
|||
@param $contractno string |
|||
@param $arrayData array |
|||
return float */ |
|||
function get_ratio($facilityno, $contractno, $arrayData) |
|||
{ |
|||
$ratio = 0; |
|||
if (isset($arrayData[$contractno])) { |
|||
$this_total = $arrayData[$contractno]['total_budget']; |
|||
if (isset($arrayData[$contractno]['facility'][$facilityno]['total_budget'])) { |
|||
$this_facility = $arrayData[$contractno]['facility'][$facilityno]['total_budget']; |
|||
$ratio = $this_facility / $this_total; |
|||
} |
|||
} |
|||
return $ratio; |
|||
} |
|||
|
|||
// 查WMS 員工與對應主管 |
|||
// $sql_manager = "SELECT A.accountid, A.name, A.manager, B.name AS manager_name FROM account AS A |
|||
// LEFT JOIN account AS B ON A.manager = B.accountid "; |
|||
// $managers = mysqli_query($link, $sql_manager); |
|||
// // $find_manager['員工工號'] = array('員工姓名', '主管工號', '主管姓名'); |
|||
// $find_manager = array(); |
|||
// if (is_iterable($managers)) { |
|||
// foreach ($managers as $manager) { |
|||
// $find_manager[$manager['accountid']] = $manager; |
|||
// } |
|||
// } |
|||
$follower = find_follow($user_id); |
|||
|
|||
// T8所有合約號 |
|||
$sql_all_contract = "SELECT |
|||
MainAll.*, |
|||
Person.PersonName, |
|||
Dept.DeptName, |
|||
Dept.LeaderId, |
|||
Leader.PersonName AS LeaderName |
|||
FROM |
|||
( |
|||
SELECT |
|||
Main.BillNo, |
|||
Main.BillDate, |
|||
Main.BizPartnerId, |
|||
Biz.ShortName, |
|||
Biz.BizPartnerName, |
|||
Biz.ContactAddress, |
|||
Main.OAmountWithTax, |
|||
Main.PersonId, |
|||
Main.DeptId, |
|||
Main.ModeId, |
|||
Main.CurrentState |
|||
FROM |
|||
salSalesOrder AS Main |
|||
LEFT JOIN comBusinessPartner AS Biz ON Biz.BizPartnerId = Main.BizPartnerId |
|||
) AS MainAll |
|||
LEFT JOIN comGroupPerson AS Person ON MainAll.PersonId = Person.PersonId |
|||
LEFT JOIN comDepartment AS Dept ON MainAll.DeptId = Dept.DeptId |
|||
LEFT JOIN comGroupPerson AS Leader ON Dept.LeaderId = Leader.PersonId |
|||
WHERE |
|||
MainAll.ModeId = 'M' AND (MainAll.CurrentState = 2 OR MainAll.CurrentState = 4) "; |
|||
if (!is_null($start_date)) { |
|||
$start_date = (int)date('Ymd', strtotime($start_date)); |
|||
$sql_all_contract .= " AND MainAll.BillDate >= $start_date "; |
|||
} |
|||
if (!is_null($end_date)) { |
|||
$end_date = (int)date('Ymd', strtotime($end_date)); |
|||
$sql_all_contract .= " AND MainAll.BillDate <= $end_date "; |
|||
} |
|||
if ((in_array($user_id, array('M0060', 'M0175'))) || (in_array(accountidToDepartId($user_id), array('220', '210', '321')))) { |
|||
} else { |
|||
$sql_all_contract .= " AND (MainAll.PersonId = '$user_id'"; |
|||
if (count($follower) > 0) { |
|||
$column_str = "('$user_id'" . ",'"; |
|||
$column_str .= implode("','", $follower); |
|||
$column_str .= "')"; |
|||
$sql_all_contract .= " OR MainAll.PersonId IN $column_str)"; |
|||
} else { |
|||
$sql_all_contract .= ")"; |
|||
}; |
|||
} |
|||
$str_numbers = ""; |
|||
$query_all_contract = $conn->query($sql_all_contract); |
|||
if (is_iterable($query_all_contract)) { |
|||
foreach ($query_all_contract as $contract_numbers) { |
|||
if (!in_array($contract_numbers['BillNo'], $contractNumbers)) { |
|||
array_push($contractNumbers, $contract_numbers['BillNo']); |
|||
$arrayData[$contract_numbers['BillNo']]['BillNo'] = isset($contract_numbers['BillNo']) ? $contract_numbers['BillNo'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['BillDate'] = isset($contract_numbers['BillDate']) ? $contract_numbers['BillDate'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['CustomerId'] = isset($contract_numbers['BizPartnerId']) ? $contract_numbers['BizPartnerId'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['CustomerName'] = isset($contract_numbers['BizPartnerName']) ? $contract_numbers['BizPartnerName'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['CustomerAddress'] = isset($contract_numbers['ContactAddress']) ? $contract_numbers['ContactAddress'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['OAmountWithTax'] = isset($contract_numbers['OAmountWithTax']) ? $contract_numbers['OAmountWithTax'] : 0; |
|||
$arrayData[$contract_numbers['BillNo']]['PersonId'] = isset($contract_numbers['PersonId']) ? $contract_numbers['PersonId'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['DeptId'] = isset($contract_numbers['DeptId']) ? $contract_numbers['DeptId'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['PersonName'] = isset($contract_numbers['PersonName']) ? $contract_numbers['PersonName'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['DeptName'] = isset($contract_numbers['DeptName']) ? $contract_numbers['DeptName'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['ShortName'] = isset($contract_numbers['ShortName']) ? $contract_numbers['ShortName'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['ManagerId'] = isset($contract_numbers['LeaderId']) ? $contract_numbers['LeaderId'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['ManagerName'] = isset($contract_numbers['LeaderName']) ? $contract_numbers['LeaderName'] : '--'; |
|||
$arrayData[$contract_numbers['BillNo']]['invoice_budget'] = 0; |
|||
$arrayData[$contract_numbers['BillNo']]['received_budget'] = 0; |
|||
$arrayData[$contract_numbers['BillNo']]['receivable_budget'] = 0; |
|||
$arrayData[$contract_numbers['BillNo']]['collect_budget'] = 0; |
|||
$arrayData[$contract_numbers['BillNo']]['A40001'] = 0; |
|||
$arrayData[$contract_numbers['BillNo']]['A40008'] = 0; |
|||
$arrayData[$contract_numbers['BillNo']]['facility_status'] = ""; |
|||
$arrayData[$contract_numbers['BillNo']]['facility'] = array(); |
|||
$arrayData[$contract_numbers['BillNo']]['total_budget'] = $contract_numbers['OAmountWithTax']; |
|||
$sum_total_budget += $contract_numbers['OAmountWithTax']; |
|||
$sum_contract +=1; |
|||
} |
|||
} |
|||
$str_numbers .= "('" . implode("','", $contractNumbers) . "')"; |
|||
} |
|||
|
|||
// T8 銷售訂單 作番總金額、作番A40001金額、作番A40008金額、合約A40001金額、合約A40008金額 |
|||
$sql_contract_budget = "SELECT A.BillNo, A.OAmountWithTax,A.CU_MaterialId, A.MaterialId FROM salSalesOrderDetail AS A |
|||
LEFT JOIN salSalesOrder AS B ON A.BillNo=B.BillNo |
|||
WHERE B.ModeId='M' AND A.ItemType=1 "; |
|||
$query_contract_budget = $conn->query($sql_contract_budget); |
|||
foreach ($query_contract_budget as $contract_budget) { |
|||
if (isset($arrayData[$contract_budget['BillNo']])) { |
|||
$arrayData[$contract_budget['BillNo']][$contract_budget['MaterialId']] += $contract_budget['OAmountWithTax']; |
|||
if (isset($arrayData[$contract_budget['BillNo']]['facility']) && isset($arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']])) { |
|||
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['total_budget'] += $contract_budget['OAmountWithTax']; |
|||
if (isset($arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']][$contract_budget['MaterialId']])) { |
|||
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']][$contract_budget['MaterialId']] += $contract_budget['OAmountWithTax']; |
|||
} else { |
|||
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']][$contract_budget['MaterialId']] = $contract_budget['OAmountWithTax']; |
|||
} |
|||
} else { |
|||
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['total_budget'] = $contract_budget['OAmountWithTax']; |
|||
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']][$contract_budget['MaterialId']] = $contract_budget['OAmountWithTax']; |
|||
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['status'] = ""; |
|||
$sum_facility +=1; |
|||
} |
|||
switch($contract_budget['CU_MaterialId']){ |
|||
case "A40001": |
|||
$sum_A40001 += $contract_budget['OAmountWithTax']; |
|||
break; |
|||
case "A40008": |
|||
$sum_A40008 += $contract_budget['OAmountWithTax']; |
|||
break; |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
//T8 銷售訂單 階段收款計畫 |
|||
$sql_PayStage = "SELECT |
|||
a.RowNo, |
|||
a.BillNo, |
|||
s.BillDate, |
|||
a.PayStage, |
|||
a.PlanPayAmt, |
|||
a.PlanPayDate, |
|||
s.BizPartnerId, |
|||
s.PersonId |
|||
FROM salOrderStagePay AS a |
|||
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|||
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; |
|||
if (!empty($str_numbers)) { |
|||
$sql_PayStage .= " AND s.BillNo IN " . $str_numbers; |
|||
} |
|||
|
|||
$query_PayStage = $conn->query($sql_PayStage); |
|||
// 把階段收款計畫放進arrayData內 |
|||
foreach ($query_PayStage as $PayStage) { |
|||
if (isset($arrayData[$PayStage['BillNo']])) { |
|||
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PayStage'] = $PayStage['PayStage']; |
|||
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PlanPayAmt'] = $PayStage['PlanPayAmt']; |
|||
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PlanPayDate'] = $PayStage['PlanPayDate']; |
|||
if (isset($arrayData[$PayStage['BillNo']]['facility']) && is_iterable($arrayData[$PayStage['BillNo']]['facility'])) { |
|||
foreach ($arrayData[$PayStage['BillNo']]['facility'] as $key => &$value) { |
|||
$tmpkey = $key . $PayStage['RowNo']; |
|||
$arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage'][$tmpkey] = $arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]; |
|||
$arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage'][$tmpkey]['PlanPayAmt'] = $arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage'][$tmpkey]['PlanPayAmt'] * get_ratio($key, $PayStage['BillNo'], $arrayData); |
|||
$arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage'][$tmpkey]['facilityno'] = $key; |
|||
if (isset($PayStage_array[$PayStage['BillNo']])) { |
|||
$PayStage_array[$PayStage['BillNo']] = array_merge($PayStage_array[$PayStage['BillNo']], $arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage']); |
|||
} else { |
|||
$PayStage_array[$PayStage['BillNo']] = $arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage']; |
|||
} |
|||
$arrayData[$PayStage['BillNo']]['facility'][$key]['PayStage'] = array(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
//作番大日程 |
|||
$sql_wip = "SELECT |
|||
tmp2.*, |
|||
d.name AS depart_name |
|||
FROM( |
|||
SELECT |
|||
a.manager, |
|||
a2.name as manager_name, |
|||
a.name, |
|||
a.department_id, |
|||
w.salesid, |
|||
w.contractno, |
|||
w.facilityno, |
|||
w.estimated_shipping_date, |
|||
w.real_contract_arrival_date, |
|||
w.actual_tofactory_date, |
|||
w.real_arrival_date, |
|||
w.install_end_date, |
|||
w.tryrun_end_date, |
|||
w.official_check_date, |
|||
w.delivery_date |
|||
from wipwholestatus AS w |
|||
left join account AS a |
|||
ON w.salesid = a.accountid |
|||
left join account AS a2 |
|||
ON a2.accountid = a.manager |
|||
where w.status = '1' AND w.contract_type='A' |
|||
)AS tmp2 |
|||
left join ( |
|||
SELECT DISTINCT |
|||
department_id, |
|||
name |
|||
FROM department |
|||
|
|||
) AS d |
|||
ON d.department_id = tmp2.department_id "; |
|||
|
|||
// 將作番大日程新梯資料存入array中方便查詢 |
|||
// 作番號 -> estimated_shipping_date 預計出港日; real_contract_arrival_date 預計出貨日; real_arrival_date 實際出貨日; |
|||
// install_end_date 安裝完畢日; tryrun_end_date 試車完畢日; official_check_date 官檢日; delivery_date 移交完畢日 |
|||
$wip_array = array(); |
|||
$query_wip = mysqli_query($link, $sql_wip); |
|||
foreach ($query_wip as $wip) { |
|||
$wip_array[$wip['facilityno']]['estimated_shipping_date'] = $wip['estimated_shipping_date']; |
|||
$wip_array[$wip['facilityno']]['real_contract_arrival_date'] = $wip['real_contract_arrival_date']; |
|||
$wip_array[$wip['facilityno']]['real_arrival_date'] = $wip['real_arrival_date']; |
|||
$wip_array[$wip['facilityno']]['install_end_date'] = $wip['install_end_date']; |
|||
$wip_array[$wip['facilityno']]['tryrun_end_date'] = $wip['tryrun_end_date']; |
|||
$wip_array[$wip['facilityno']]['official_check_date'] = $wip['official_check_date']; |
|||
$wip_array[$wip['facilityno']]['delivery_date'] = $wip['delivery_date']; |
|||
if (isset($arrayData[$wip['contractno']]) && isset($arrayData[$wip['contractno']]['facility'][$wip['facilityno']])) { |
|||
if ($wip['delivery_date'] != NULL && $wip['delivery_date'] !== '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['delivery_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['delivery_date'] . "已移交"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) ; "; |
|||
} elseif ($wip['official_check_date'] != NULL && $wip['official_check_date'] != '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['official_check_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['official_check_date'] . "官檢完畢"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) ; "; |
|||
} elseif ($wip['tryrun_end_date'] != NULL && $wip['tryrun_end_date'] !== '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['tryrun_end_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['tryrun_end_date'] . "試車完畢"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) ; "; |
|||
} elseif ($wip['install_end_date'] != NULL && $wip['install_end_date'] !== '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['install_end_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['install_end_date'] . "安裝完畢"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) ; "; |
|||
} elseif ($wip['real_arrival_date'] != NULL && $wip['real_arrival_date'] !== '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['real_arrival_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['real_arrival_date'] . "貨抵工地"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) ; "; |
|||
} elseif ($wip['real_contract_arrival_date'] != NULL && $wip['real_contract_arrival_date'] !== '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['real_contract_arrival_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['real_contract_arrival_date'] . "預計出貨"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨) ; "; |
|||
} elseif ($wip['estimated_shipping_date'] != NULL && $wip['estimated_shipping_date'] !== '1970-01-01' && $wip['delivery_date'] !== '1970-01-11' && !empty($wip['estimated_shipping_date'])) { |
|||
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['estimated_shipping_date'] . "預計出港"; |
|||
$arrayData[$wip['contractno']]['facility_status'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港) ; "; |
|||
} |
|||
} |
|||
} |
|||
// 合約收款階段內容分類 |
|||
$sign60 = array('簽訂後60天', '簽約60日', '簽約後60天', '簽訂後60日內', '訂金支付後60天'); |
|||
$sign90 = array('簽約後90天', '簽約後90日', '簽訂後90天'); |
|||
$sign120 = array('簽約後120天', '簽約後120日', '簽訂後120天', '合約簽訂後120天'); |
|||
$sign0 = array('簽約', '簽訂', '合約簽訂', '訂金'); |
|||
$arrival = array('貨抵工地', '貨底工地', '工地動工'); |
|||
$final6 = array('核可函取得後6個月', '得合格函後6個月'); |
|||
|
|||
foreach ($PayStage_array as $key => &$value) { |
|||
foreach ($value as $paykey => &$payvalue) { |
|||
if (isset($wip_array[$payvalue['facilityno']])) { |
|||
switch ($payvalue['PayStage']) { |
|||
case '寶佳出貨前30天': |
|||
$payvalue['stage'] = '訂金'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time - (30 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_contract_arrival_date']); |
|||
$signtime = $estimate_time - (30 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case '寶佳出貨後10天': |
|||
$payvalue['stage'] = '二次款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time + (10 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case '貨抵工地後90天': |
|||
$payvalue['stage'] = '貨抵工地款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time + (90 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case '安裝試車後90天': |
|||
$payvalue['stage'] = '試車款'; |
|||
if ($wip_array[$payvalue['facilityno']]['tryrun_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['tryrun_end_date'])) { |
|||
$estimate_time = strtotime($wip['tryrun_end_date']); |
|||
$signtime = $estimate_time + (90 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case '交車後270天': |
|||
$payvalue['stage'] = '尾款'; |
|||
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { |
|||
$estimate_time = strtotime($wip['delivery_date']); |
|||
$signtime = $estimate_time + (270 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (in_array($payvalue['PayStage'], $arrival)): |
|||
$payvalue['stage'] = '貨抵工地款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time + (10 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case '二次款': |
|||
$payvalue['stage'] = '二次款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_contract_arrival_date']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '出貨前30') || stristr($payvalue['PayStage'], '簽約(出貨前30天)') ||stristr($payvalue['PayStage'], '建照核發時')): |
|||
$payvalue['stage'] = '二次款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time - (30 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_contract_arrival_date']); |
|||
$signtime = $estimate_time - (30 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '出貨前60')): |
|||
$payvalue['stage'] = '二次款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time - (60 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_contract_arrival_date']); |
|||
$signtime = $estimate_time - (60 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '出貨前90')): |
|||
$payvalue['stage'] = '二次款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time - (90 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_contract_arrival_date']); |
|||
$signtime = $estimate_time - (90 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '出貨前120')): |
|||
$payvalue['stage'] = '二次款'; |
|||
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_arrival_date']); |
|||
$signtime = $estimate_time - (120 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) { |
|||
$estimate_time = strtotime($wip['real_contract_arrival_date']); |
|||
$signtime = $estimate_time - (120 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case "簽定30天內": |
|||
$payvalue['stage'] = '二次款'; |
|||
$estimate_time = strtotime($arrayData[$key]['PayStage'][1]['PlanPayDate']); |
|||
$signtime = $estimate_time + (30 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
break; |
|||
case (in_array($payvalue['PayStage'], $sign60)): |
|||
$payvalue['stage'] = '二次款'; |
|||
$estimate_time = strtotime($arrayData[$key]['PayStage'][1]['PlanPayDate']); |
|||
$signtime = $estimate_time + (60 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
break; |
|||
case (in_array($payvalue['PayStage'], $sign90)): |
|||
$payvalue['stage'] = '二次款'; |
|||
$estimate_time = strtotime($arrayData[$key]['PayStage'][1]['PlanPayDate']); |
|||
$signtime = $estimate_time + (90 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
break; |
|||
case (in_array($payvalue['PayStage'], $sign120)): |
|||
$payvalue['stage'] = '二次款'; |
|||
$estimate_time = strtotime($arrayData[$key]['PayStage'][1]['PlanPayDate']); |
|||
$signtime = $estimate_time + (120 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '簽訂後30')): |
|||
$payvalue['stage'] = '二次款'; |
|||
$estimate_time = strtotime($arrayData[$key]['PayStage'][1]['PlanPayDate']); |
|||
$signtime = $estimate_time + (30 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime); |
|||
break; |
|||
case (in_array($payvalue['PayStage'], $sign0)): |
|||
$payvalue['stage'] = '訂金'; |
|||
$estimate_time = strtotime($arrayData[$key]['PayStage'][1]['PlanPayDate']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '試車')): |
|||
$payvalue['stage'] = '試車款'; |
|||
if ($wip_array[$payvalue['facilityno']]['tryrun_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['tryrun_end_date'])) { |
|||
$estimate_time = strtotime($wip['tryrun_end_date']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '安裝') || stristr($payvalue['PayStage'], '貨抵工地且完工')): |
|||
$payvalue['stage'] = '安裝款'; |
|||
if ($wip_array[$payvalue['facilityno']]['install_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['install_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['install_end_date'])) { |
|||
$estimate_time = strtotime($wip['install_end_date']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (in_array($payvalue['PayStage'], $final6)): |
|||
$payvalue['stage'] = '尾款'; |
|||
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { |
|||
$estimate_time = strtotime($wip['delivery_date']); |
|||
$estimate_time = $estimate_time + (180 * 86400); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '合格') || stristr($payvalue['PayStage'], '驗收') || stristr($payvalue['PayStage'], '驗收')): |
|||
$payvalue['stage'] = '官檢驗收款'; |
|||
if ($wip_array[$payvalue['facilityno']]['official_check_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['official_check_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['official_check_date'])) { |
|||
$estimate_time = strtotime($wip['official_check_date']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
case (stristr($payvalue['PayStage'], '交車') || stristr($payvalue['PayStage'], '移交') || stristr($payvalue['PayStage'], '完工') || stristr($payvalue['PayStage'], '許可') || stristr($payvalue['PayStage'], '核可')): |
|||
$payvalue['stage'] = '交車款'; |
|||
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) { |
|||
$estimate_time = strtotime($wip['delivery_date']); |
|||
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time); |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
break; |
|||
default: |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
break; |
|||
} |
|||
if (strtotime($payvalue['PlanPayDate']) < 975686400) { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
} |
|||
} else { |
|||
$payvalue['PlanPayDate'] = NULL; |
|||
$payvalue['stage'] = "大日程無作番"; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
// 在$PayStage_array中排序 |
|||
foreach ($PayStage_array as $key => $value) { |
|||
uasort($PayStage_array[$key], 'comparePlanPayDate'); |
|||
} |
|||
// 加入序號 |
|||
foreach ($PayStage_array as &$payStage) { |
|||
$sequenceNumber = 1; |
|||
foreach ($payStage as $tk => &$pstage) { |
|||
$pstage['sequenceNumber'] = $sequenceNumber; |
|||
$sequenceNumber += 1; |
|||
} |
|||
} |
|||
|
|||
// 整理好的收款階段放入 $final_paystage |
|||
$final_paystage = array(); |
|||
foreach ($PayStage_array as $key => &$payStage) { |
|||
if (is_iterable($payStage)) { |
|||
foreach ($payStage as $key2 => $pstage) { |
|||
$final_paystage[$key][$pstage['sequenceNumber']] = $pstage; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 發票資訊 |
|||
$sql_invoice = "SELECT |
|||
Detail.BillNo AS InvoiceBillNo, |
|||
Detail.MaterialId, |
|||
Detail.LAmountWithTax, |
|||
Main.InvoiceNo, |
|||
Main.InvoiceDate, |
|||
Main.InvoiceState, |
|||
CheckAll.FromSalSalesOrder AS BillNo |
|||
FROM arSellInvoiceMaterial AS Detail |
|||
LEFT JOIN arSellInvoice AS Main ON Detail.BillNo=Main.BillNo |
|||
LEFT JOIN ( |
|||
SELECT CheckDetail.BillNo, CheckDetail.FromSalSalesOrder, CheckDetail.RowNo |
|||
FROM arCheckBillDetail AS CheckDetail ) |
|||
AS CheckAll ON CheckAll.BillNo= Detail.FromBillNo AND Detail.FromRowCode = CheckAll.RowNo |
|||
WHERE Main.InvoiceState!=2 AND LEN(CheckAll.FromSalSalesOrder)>0"; |
|||
$query_invoice = $conn->query($sql_invoice); |
|||
|
|||
//發票資訊回填到arrayData |
|||
foreach ($query_invoice as $invoice) { |
|||
if (isset($arrayData[$invoice['BillNo']])) { |
|||
$arrayData[$invoice['BillNo']]['invoice_budget'] += $invoice['LAmountWithTax']; |
|||
} |
|||
} |
|||
|
|||
// 核銷資訊 |
|||
$sql_received = "SELECT |
|||
CheckDetail.OrderBillNo, |
|||
arWriteOffBillDetail.FromBillNo AS CheckBillNo, |
|||
arWriteOffBillDetail.FromRowCode AS CheckRowCode, |
|||
arWriteOffBillDetail.CurrStandOffOAmount, |
|||
CheckDetail.TypeId |
|||
FROM arWriteOffBillDetail |
|||
LEFT JOIN |
|||
(SELECT |
|||
arCheckBillDetail.BillNo, |
|||
arCheckBillDetail.RowCode, |
|||
arCheckBillDetail.FromSalSalesOrder AS OrderBillNo, |
|||
salSalesOrder.TypeId, |
|||
salSalesOrder.ModeId |
|||
FROM arCheckBillDetail |
|||
LEFT JOIN salSalesOrder |
|||
ON salSalesOrder.BillNo =arCheckBillDetail.FromSalSalesOrder ) |
|||
AS CheckDetail |
|||
ON CheckDetail.BillNo=arWriteOffBillDetail.FromBillNo AND arWriteOffBillDetail.FromRowCode = CheckDetail.RowCode |
|||
WHERE CheckDetail.ModeId = 'M'"; |
|||
$query_received = $conn->query($sql_received); |
|||
|
|||
// 核銷資訊回填到arrayData |
|||
foreach ($query_received as $received) { |
|||
if (isset($arrayData[$received['OrderBillNo']])) { |
|||
$arrayData[$received['OrderBillNo']]['received_budget'] += $received['CurrStandOffOAmount']; |
|||
} |
|||
} |
|||
|
|||
// 將發票與核銷資訊 分別計算作番收款階段金額 與 催收次數 |
|||
$today = strtotime(date('Y-m-t')); |
|||
foreach ($final_paystage as $key => &$value) { |
|||
$tmpinvoice = $arrayData[$key]['invoice_budget']; |
|||
$tmpreceived = $arrayData[$key]['received_budget']; |
|||
for ($sequenceNumber = 1; $sequenceNumber <= count($value); $sequenceNumber++) { |
|||
if (isset($value[$sequenceNumber]['PlanPayDate'])) { |
|||
$collect_month = collect_month(strtotime($value[$sequenceNumber]['PlanPayDate'])); |
|||
if ($today > strtotime($value[$sequenceNumber]['PlanPayDate'])) { |
|||
$value[$sequenceNumber]['hadtopay'] = 'V'; |
|||
$arrayData[$key]['receivable_budget'] += $value[$sequenceNumber]['PlanPayAmt']; |
|||
} else { |
|||
$value[$sequenceNumber]['hadtopay'] = '--'; |
|||
} |
|||
} else { |
|||
$collect_month = 0; |
|||
$value[$sequenceNumber]['hadtopay'] = '--'; |
|||
} |
|||
if ($tmpinvoice >= $value[$sequenceNumber]['PlanPayAmt']) { |
|||
$value[$sequenceNumber]['invoice_budget'] = $value[$sequenceNumber]['PlanPayAmt']; |
|||
$tmpinvoice -= $value[$sequenceNumber]['invoice_budget']; |
|||
} elseif ($tmpinvoice > 0) { |
|||
$value[$sequenceNumber]['invoice_budget'] = $tmpinvoice; |
|||
$tmpinvoice = 0; |
|||
} else { |
|||
$value[$sequenceNumber]['invoice_budget'] = 0; |
|||
} |
|||
if ($tmpreceived > $value[$sequenceNumber]['PlanPayAmt']) { |
|||
$value[$sequenceNumber]['received_budget'] = $value[$sequenceNumber]['PlanPayAmt']; |
|||
$tmpinvoice -= $value[$sequenceNumber]['received_budget']; |
|||
} elseif ($tmpreceived > 0) { |
|||
$value[$sequenceNumber]['received_budget'] = $tmpreceived; |
|||
$tmpreceived = 0; |
|||
} else { |
|||
$value[$sequenceNumber]['received_budget'] = 0; |
|||
} |
|||
if ($collect_month > 0 && $value[$sequenceNumber]['PlanPayAmt'] > $value[$sequenceNumber]['received_budget']) { |
|||
$value[$sequenceNumber]['collect_month'] = $collect_month; |
|||
} else { |
|||
$value[$sequenceNumber]['collect_month'] = 0; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// foreach($final_paystage as $key => $value) { |
|||
// echo $key."<br>"; |
|||
// echo "---------------------<br>"; |
|||
// foreach($value as $key2 => $value2) { |
|||
// echo $key2."<br>"; |
|||
// print_r($value2); |
|||
// echo "<br>"; |
|||
// } |
|||
// echo "<br>==================<br>"; |
|||
// } |
|||
// exit(); |
|||
foreach ($final_paystage as $key => $value) { |
|||
for ($sequence = 1; $sequence <= count($value); $sequence++) { |
|||
if (isset($arrayData[$key]) && isset($arrayData[$key]['facility']) && isset($arrayData[$key]['facility'][$value[$sequence]['facilityno']]) && isset($arrayData[$key]['facility'][$value[$sequence]['facilityno']]['PayStage'])) { |
|||
array_push($arrayData[$key]['facility'][$value[$sequence]['facilityno']]['PayStage'], $value[$sequence]); |
|||
foreach ($arrayData[$key]['PayStage'] as $arkey => &$arvalue) { |
|||
if ($arvalue['PayStage'] == $value[$sequence]['PayStage']) { |
|||
if (isset($arvalue['receivable_budget']) && isset($arvalue['received_budget']) && isset($arvalue['invoice_budget'])) { |
|||
$arvalue['receivable_budget'] += $value[$sequence]['PlanPayAmt']; |
|||
$arvalue['received_budget'] += $value[$sequence]['received_budget']; |
|||
$arvalue['invoice_budget'] += $value[$sequence]['invoice_budget']; |
|||
if ($arvalue['collect_month'] < $value[$sequence]['collect_month']) { |
|||
$arvalue['collect_month'] = $value[$sequence]['collect_month']; |
|||
} |
|||
} else { |
|||
$arvalue['stage'] = $value[$sequence]['stage']; |
|||
$arvalue['receivable_budget'] = $value[$sequence]['PlanPayAmt']; |
|||
$arvalue['received_budget'] = $value[$sequence]['received_budget']; |
|||
$arvalue['invoice_budget'] = $value[$sequence]['invoice_budget']; |
|||
$arvalue['collect_month'] = $value[$sequence]['collect_month']; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 存進excel_array |
|||
$excel_array = array(); |
|||
foreach ($arrayData as $key => $value) { |
|||
echo $key . "<br>********************<br>"; |
|||
print_r($value); |
|||
// foreach($value['facility'] as $key2 => $value2) { |
|||
// echo $key2."<br>"; |
|||
// print_r($value2['PayStage']); |
|||
// echo "<br>"; |
|||
// } |
|||
echo "<br>-------------------------------<br>"; |
|||
} |
@ -1,124 +0,0 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$Bill = $_POST['Bill']; |
|||
$BillData = json_decode($Bill, true); |
|||
?> |
|||
<div style="width: 90%;"> |
|||
|
|||
<div style="padding-left: 2rem; padding-bottom: 1rem;"> |
|||
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button> |
|||
</div> |
|||
</div> |
|||
<div class="container"> |
|||
<div class="text-center"> |
|||
<h3><strong><?= $BillData[4] ?></strong></h3> |
|||
<h4>新增收款資訊</h4> |
|||
</div> |
|||
<form class="form-horizontal" id="pay_received" method="POST" action="account-receivable-received-submit.php?type=create&<?= $token_link ?>" enctype="multipart/form-data"> |
|||
<div class="form-group" style="margin-left: 1%;margin-right: 1%;"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="BillNo">合約號</label> |
|||
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $BillData[0] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="DeptName">部門</label> |
|||
<input type="text" class="form-control" id="DeptName" name="DeptName" value="<?= $BillData[1] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="ManagerName">經理</label> |
|||
<input type="text" class="form-control" id="ManagerName" name="ManagerName" value="<?= $BillData[2] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="PersonName">營業員</label> |
|||
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $BillData[3] ?>" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="EnterpriseName">抬頭</label> |
|||
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $BillData[14] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="TaxNo">統一編號</label> |
|||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $BillData[15] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ContactAddress">聯絡地址</label> |
|||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $BillData[16] ?>" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="InvoiceDate">發票開立日期</label> |
|||
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="InvoiceAmount">發票金額</label> |
|||
<input type="number" class="form-control" id="InvoiceAmount" name="InvoiceAmount"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="InvoiceNo">發票號碼</label> |
|||
<input type="text" class="form-control" id="InvoiceNo" name="InvoiceNo"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="ReceivedDate">收款日期</label> |
|||
<input type="date" class="form-control" id="ReceivedDate" name="ReceivedDate"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="ReceivedAmount">收款金額</label> |
|||
<input type="number" class="form-control" id="ReceivedAmount" name="ReceivedAmount"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="remark">備註</label> |
|||
<input type="text" class="form-control" id="remark" name="remark"> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<input type="hidden" name="DeptId" value="<?= $BillData[17] ?>"> |
|||
<input type="hidden" name="PersonId" value="<?= $BillData[18] ?>"> |
|||
<input type="hidden" name="CustName" value="<?= $BillData[4] ?>"> |
|||
<input type="hidden" name="Bill" id="Bill" value=""> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
</div> |
|||
<div class="col-md-9"> |
|||
<button type="button" onclick="send()" class="btn btn-primary btn-lg pull-right">送出</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
function backToIndex() { |
|||
var Bill = <?= $Bill ?>; |
|||
var form = document.createElement("form"); |
|||
form.method = 'POST'; |
|||
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|||
var input = document.createElement("input"); |
|||
input.type = "hidden"; |
|||
input.name = "Bill"; |
|||
input.value = JSON.stringify(Bill); |
|||
form.appendChild(input); |
|||
document.body.appendChild(form); |
|||
form.submit(); |
|||
} |
|||
|
|||
function send() { |
|||
event.preventDefault(); |
|||
$("#BillNo").prop("disabled", false); |
|||
$("#DeptName").prop("disabled", false); |
|||
$("#ManagerName").prop("disabled", false); |
|||
$("#PersonName").prop("disabled", false); |
|||
var Bill = <?= $Bill ?>; |
|||
Bill = JSON.stringify(Bill); |
|||
$("#Bill").val(Bill); |
|||
$("#pay_received").submit(); |
|||
} |
|||
</script> |
@ -1,142 +0,0 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$Bill = $_POST['Bill']; |
|||
$BillData = json_decode($Bill, true); |
|||
$pay_id = $_GET['pay_id']; |
|||
// echo $pay_id."<br>"; |
|||
// print_r($BillData); |
|||
$sql_pay = "SELECT * from account_received where pay_id = '$pay_id'"; |
|||
$pay = mysqli_query($link, $sql_pay); |
|||
$pay = mysqli_fetch_assoc($pay); |
|||
|
|||
?> |
|||
<div style="width: 90%;"> |
|||
|
|||
<div style="padding-left: 2rem; padding-bottom: 1rem;"> |
|||
<button type="button" onclick="backToIndex()" class="btn btn-outline-primary btn-lg"><span class="glyphicon glyphicon-menu-left"></span></button> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="container"> |
|||
<div class="text-center"> |
|||
<h3><strong><?= $BillData[4] ?></strong></h3> |
|||
<h4>編輯收款資訊</h4> |
|||
</div> |
|||
<form class="form-horizontal" id="pay_received" method="POST" action="account-receivable-received-submit.php?type=edit&<?= $token_link ?>" enctype="multipart/form-data"> |
|||
<div class="form-group" style="margin-left: 1%;margin-right: 1%;"> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="BillNo">合約號</label> |
|||
<input type="text" class="form-control" id="BillNo" name="BillNo" value="<?= $BillData[0] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="DeptName">部門</label> |
|||
<input type="text" class="form-control" id="DeptName" name="DeptName" value="<?= $BillData[1] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="ManagerName">經理</label> |
|||
<input type="text" class="form-control" id="ManagerName" name="ManagerName" value="<?= $BillData[2] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="PersonName">營業員</label> |
|||
<input type="text" class="form-control" id="PersonName" name="PersonName" value="<?= $BillData[3] ?>" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="EnterpriseName">抬頭</label> |
|||
<input type="text" class="form-control" id="EnterpriseName" name="EnterpriseName" value="<?= $BillData[14] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="TaxNo">統一編號</label> |
|||
<input type="text" class="form-control" id="TaxNo" name="TaxNo" value="<?= $BillData[15] ?>" disabled> |
|||
</div> |
|||
<div class="col-md-6"> |
|||
<label for="ContactAddress">聯絡地址</label> |
|||
<input type="text" class="form-control" id="ContactAddress" name="ContactAddress" value="<?= $BillData[16] ?>" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="InvoiceDate">發票開立日期</label> |
|||
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate" value="<?= $pay['invoice_date'] ?>"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="InvoiceAmount">發票金額</label> |
|||
<input type="number" class="form-control" id="InvoiceAmount" name="InvoiceAmount" value="<?= $pay['invoice_amount'] ?>"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="InvoiceNo">發票號碼</label> |
|||
<input type="text" class="form-control" id="InvoiceNo" name="InvoiceNo" value="<?= $pay['invoice_no'] ?>"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="ReceivedDate">收款日期</label> |
|||
<input type="date" class="form-control" id="ReceivedDate" name="ReceivedDate" value="<?= $pay['received_date'] ?>"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="ReceivedAmount">收款金額</label> |
|||
<input type="number" class="form-control" id="ReceivedAmount" name="ReceivedAmount" value="<?= $pay['received_amount'] ?>"> |
|||
</div> |
|||
<div class="col-md-3"> |
|||
<label for="remark">備註</label> |
|||
<input type="text" class="form-control" id="remark" name="remark" value="<?= $pay['remark'] ?>"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
<label for="status" style="color: red;">狀態</label> |
|||
<select id="status" name="status"> |
|||
<option value=0 <?php if ($pay['status'] == 0) echo "selected" ?>>進行中</option> |
|||
<option value=1 <?php if ($pay['status'] == 1) echo "selected" ?>>催收</option> |
|||
<option value=2 <?php if ($pay['status'] == 2) echo "selected" ?>>法務件 (發函)</option> |
|||
<option value=3 <?php if ($pay['status'] == 3) echo "selected" ?>>法務件 (訴訟)</option> |
|||
<option value=4 <?php if ($pay['status'] == 4) echo "selected" ?>>折讓</option> |
|||
<option value=5 <?php if ($pay['status'] == 5) echo "selected" ?>>壞帳</option> |
|||
<option value=99 <?php if ($pay['status'] == 99) echo "selected" ?>>完成</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<input type="hidden" name="pay_id" value="<?= $pay['pay_id'] ?>"> |
|||
<input type="hidden" name="Bill" id="Bill" value=""> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="col-md-3"> |
|||
</div> |
|||
<div class="col-md-9"> |
|||
<button type="button" onclick="send()" class="btn btn-primary btn-lg pull-right">送出</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
<script> |
|||
function backToIndex() { |
|||
var Bill = <?= $Bill ?>; |
|||
var form = document.createElement("form"); |
|||
form.method = 'POST'; |
|||
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|||
var input = document.createElement("input"); |
|||
input.type = "hidden"; |
|||
input.name = "Bill"; |
|||
input.value = JSON.stringify(Bill); |
|||
form.appendChild(input); |
|||
document.body.appendChild(form); |
|||
form.submit(); |
|||
} |
|||
|
|||
function send() { |
|||
event.preventDefault(); |
|||
var Bill = <?= $Bill ?>; |
|||
Bill = JSON.stringify(Bill); |
|||
$("#Bill").val(Bill); |
|||
$("#pay_received").submit(); |
|||
} |
|||
</script> |
@ -1,96 +0,0 @@ |
|||
<?php |
|||
include "./header.php"; |
|||
$type = $_GET['type']; |
|||
$InvoiceNo = empty($_POST['InvoiceNo']) ? '' : str_replace('-', '', trim($_POST['InvoiceNo'])); |
|||
$InvoiceDate = isset($_POST['InvoiceDate']) ? $_POST['InvoiceDate'] : ''; |
|||
$Bill = $_POST['Bill']; |
|||
|
|||
$invoice_amount = empty($_POST['InvoiceAmount']) ? 0 : $_POST['InvoiceAmount']; |
|||
$received_amount = empty($_POST['ReceivedAmount']) ? 0 : $_POST['ReceivedAmount']; |
|||
$received_date = isset($_POST['ReceivedDate']) ? $_POST['ReceivedDate'] : ''; |
|||
$remark = isset($_POST['remark']) ? $_POST['remark'] : ''; |
|||
|
|||
if ($type == 'edit') { |
|||
$pay_id = $_POST['pay_id']; |
|||
$status = $_POST['status']; |
|||
$sql_query_pay = "SELECT * from account_received where pay_id = $pay_id"; |
|||
$pay = mysqli_query($link, $sql_query_pay); |
|||
$pay = mysqli_fetch_assoc($pay); |
|||
|
|||
$sql1 = "UPDATE account_received SET "; |
|||
if ($InvoiceNo !== $pay['invoice_no']) { |
|||
$sql1 .= "invoice_no = '$InvoiceNo',"; |
|||
} |
|||
if ($InvoiceDate != $pay['invoice_date']) { |
|||
|
|||
$sql1 .= "invoice_date = '$InvoiceDate',"; |
|||
} |
|||
if ($invoice_amount != $pay['invoice_amount']) { |
|||
$sql1 .= "invoice_amount = $invoice_amount,"; |
|||
} |
|||
if ($received_amount != $pay['received_amount']) { |
|||
$sql1 .= "received_amount = $received_amount,"; |
|||
} |
|||
if ($received_date != $pay['received_date']) { |
|||
$sql1 .= "received_date = '$received_date',"; |
|||
} |
|||
if ($remark != $pay['remark']) { |
|||
$sql1 .= "remark = '$remark',"; |
|||
} |
|||
if ($status != $pay['status']) { |
|||
$sql1 .= "status = $status,"; |
|||
} |
|||
// $sql1 = substr($sql1, 0, -1); |
|||
$sql = $sql1 . "LastOperatorId = '$user_id' WHERE pay_id = $pay_id"; |
|||
} else { |
|||
$BillNo = $_POST['BillNo']; |
|||
$dept_id = $_POST['DeptId']; |
|||
$dept_name = $_POST['DeptName']; |
|||
$manager_name = $_POST['ManagerName']; |
|||
$person_id = $_POST['PersonId']; |
|||
$person_name = $_POST['PersonName']; |
|||
$cust_name = $_POST['CustName']; |
|||
$sql1 = "INSERT INTO account_received ( |
|||
BillNo,dept_id,dept_name,manager_name,person_id,person_name,cust_name"; |
|||
$sql2 = ",CreatorId) VALUES ('$BillNo','$dept_id','$dept_name','$manager_name','$person_id','$person_name','$cust_name'"; |
|||
if (isset($InvoiceNo)) { |
|||
$sql1 .= ",invoice_no"; |
|||
$sql2 .= ",'$InvoiceNo'"; |
|||
} |
|||
if ((!empty($InvoiceDate))) { |
|||
$sql1 .= ",invoice_date"; |
|||
$sql2 .= ",'$InvoiceDate'"; |
|||
} |
|||
if (isset($invoice_amount)) { |
|||
$sql1 .= ",invoice_amount"; |
|||
$sql2 .= ",$invoice_amount"; |
|||
} |
|||
if (isset($received_amount)) { |
|||
$sql1 .= ",received_amount"; |
|||
$sql2 .= ",$received_amount"; |
|||
} |
|||
if (!(empty($received_date))) { |
|||
$sql1 .= ",received_date"; |
|||
$sql2 .= ",'$received_date'"; |
|||
} |
|||
if (!(empty($remark))) { |
|||
$sql1 .= ",remark"; |
|||
$sql2 .= ",'$remark'"; |
|||
} |
|||
$sql = $sql1 . $sql2 . ",'$user_id')"; |
|||
} |
|||
mysqli_query($link, $sql); |
|||
?> |
|||
<script> |
|||
var Bill = <?= $Bill ?>; |
|||
var form = document.createElement("form"); |
|||
form.method = 'POST'; |
|||
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|||
var input = document.createElement("input"); |
|||
input.type = "hidden"; |
|||
input.name = "Bill"; |
|||
input.value = JSON.stringify(Bill); |
|||
form.appendChild(input); |
|||
document.body.appendChild(form); |
|||
form.submit(); |
|||
</script> |
Binary file not shown.
@ -0,0 +1,509 @@ |
|||
<?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 |
|||
//$label = str_replace('&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>"; |
|||
} |
|||
} |
@ -0,0 +1,324 @@ |
|||
<?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 |
|||
]; |
|||
} |
|||
} |
@ -0,0 +1,322 @@ |
|||
<?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 |
|||
]; |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
<?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>'; |
@ -0,0 +1,859 @@ |
|||
<?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 = 'M0029'; |
|||
$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> |
|||
<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') ?> |
|||
|
|||
<?php if ($as['lead_code'] < 90) echo |
|||
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?> |
|||
|
|||
</strong> |
|||
</span> |
|||
<span> |
|||
|
|||
<strong> |
|||
|
|||
<?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>已上載附件: </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> |
@ -0,0 +1,877 @@ |
|||
<?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($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"; |
|||
$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; |
|||
} |
|||
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.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().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(); |
|||
} |
|||
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_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'> |
|||
<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>操作</th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<div 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> |
|||
</select></div> |
|||
</td> |
|||
<td colspan="2"> |
|||
<div class=' col-12'> |
|||
<select name="elevator_kind[]" id="" class="form-control form-control-sm"></select> |
|||
</div> |
|||
</td> |
|||
<td colspan="2"> |
|||
<div class=' col-12'><select name="spec[]" id="" class="form-control form-control-sm"> |
|||
<option> |
|||
|
|||
</option> |
|||
</select> |
|||
</div> |
|||
</td> |
|||
<!-- <td><section name='spec'></section></td> --> |
|||
<td> |
|||
<div class=' col-12'><input type="text" id="weight" name="weight[]" type="digits" value gt="0" min="0" required class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td colspan="2"> |
|||
<div class=' col-12'><input type="text" id="speed" name="speed[]" type="number" valaue gt="0" min="0" require class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td> |
|||
<div class=' col-12'><input type="text" id="stop" name="stop[]" type="number" class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td> |
|||
<div class=' col-12'><input type="text" id="floors" name="floors[]" type="digits" value min="1" required class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td> |
|||
<div class=' col-12'><input type="text" id="persons" name="persons[]" type="digits" value min='1' required class="form-control form-contorl-sm"></div> |
|||
</td> |
|||
<td colspan="2"> |
|||
<div class=' col-12'><input type="text" id="maintain_times" name="maintain_times[]" type="digits" value='1' min='1' required class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td> |
|||
<div class=' col-12'><input type="text" id="maintain_months" name="maintain_months[]" type="digits" value="12" min='12' required class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td> |
|||
<div class=' col-12'><input type="text" id="maintain_period" name="maintain_period[]" type="digits" value="1" min='1' require class="form-control form-control-sm"></div> |
|||
</td> |
|||
<td> |
|||
<div class=' col-12'><button onclick="delRow()" type="button" class="btn btn-link btn md">刪除</button></div> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
<thead> |
|||
<tr style='margin-top:0px;text-align:center'> |
|||
<th>人乘</th> |
|||
<th>贈送M1</th> |
|||
<th colspan="2">竣工檢查年度</th> |
|||
<th>上次年檢日期</th> |
|||
<th>年檢費用(元)</th> |
|||
<th colspan="2">標準價格(元/月)</th> |
|||
<th colspan="2">契約報價(元/月)</th> |
|||
<th colspan="2">契約成交價(元/月)</th> |
|||
</tr> |
|||
</thead> |
|||
<div id='cmecTbody'> |
|||
<tr> |
|||
<td><input type="text"></td> |
|||
<td></td> |
|||
<td colspan="2"></td> |
|||
<td></td> |
|||
<td></td> |
|||
<td colspan="2"></td> |
|||
<td colspan="2"></td> |
|||
<td colspan="2"></td> |
|||
</tr> |
|||
</div> |
|||
</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> |
|||
<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') ?> |
|||
|
|||
<?php if ($as['lead_code'] < 90) echo |
|||
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?> |
|||
|
|||
</strong> |
|||
</span> |
|||
<span> |
|||
|
|||
<strong> |
|||
|
|||
<?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>已上載附件: </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> |
@ -0,0 +1,20 @@ |
|||
<?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]); |
|||
} |
@ -0,0 +1,14 @@ |
|||
<?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' "); |
@ -0,0 +1,21 @@ |
|||
<?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>"; |
@ -0,0 +1,168 @@ |
|||
<?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"; |
|||
|
|||
|
|||
?> |
@ -0,0 +1,29 @@ |
|||
<?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', |
|||
]; |
|||
} |
@ -0,0 +1,33 @@ |
|||
<?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', |
|||
]; |
|||
} |
@ -0,0 +1,53 @@ |
|||
<?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 []; |
|||
} |
|||
} |
@ -0,0 +1,511 @@ |
|||
<?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') ?> |
|||
|
|||
<?php if ($as['lead_code'] < 90) echo |
|||
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?> |
|||
|
|||
</strong> |
|||
</span> |
|||
<span> |
|||
|
|||
<strong> |
|||
|
|||
<?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>已上載附件: </span><a href="#">附件1</a> |
|||
</div>--> |
|||
</div> |
|||
|
|||
</div> |
|||
<?php } ?> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
|
|||
</body> |
@ -0,0 +1,507 @@ |
|||
<?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') ?> |
|||
|
|||
<?php if ($as['lead_code'] < 90) echo |
|||
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?> |
|||
|
|||
</strong> |
|||
</span> |
|||
<span> |
|||
|
|||
<strong> |
|||
|
|||
<?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>已上传附件: </span><a href="#">附件1</a> |
|||
</div>--> |
|||
</div> |
|||
|
|||
</div> |
|||
<?php } ?> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
|
|||
</body> |
@ -0,0 +1,577 @@ |
|||
<?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') ?> |
|||
|
|||
<?php if ($as['lead_code'] < 90) echo |
|||
" <label class='comment-content-tag'>" . $as['position_name'] . " </label>"; ?> |
|||
|
|||
</strong> |
|||
</span> |
|||
<span> |
|||
|
|||
<strong> |
|||
|
|||
<?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>已上載附件: </span><a href="#">附件1</a> |
|||
</div>--> |
|||
</div> |
|||
|
|||
</div> |
|||
<?php } ?> |
|||
|
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
</div> |
|||
|
|||
</body> |
@ -0,0 +1,225 @@ |
|||
<?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"; |
|||
|
|||
?> |
@ -0,0 +1,78 @@ |
|||
<?php |
|||
//require_once "../database.php"; |
|||
require_once './wf_common.php'; |
|||
require_once './model/ConMaintanceExamineApplyModel.php'; |
|||
require_once './model/ConMaintanceExamineClearModel.php'; |
|||
//print_r($_POST);exit; |
|||
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST; |
|||
$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='../cont/sign_list.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>"; |
@ -0,0 +1 @@ |
|||
<h4 style='text-align:center'>成功提交<a href='https://crm.platform-cn.com/pqm/pqmm01'>返回待签 </a></h4> |
@ -0,0 +1,84 @@ |
|||
<?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); |
@ -0,0 +1,174 @@ |
|||
<?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); |
|||
} |
@ -0,0 +1,20 @@ |
|||
<?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; |
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,46 @@ |
|||
<?php |
|||
|
|||
require_once('../conn.php'); |
|||
$spec = $_GET['spec']; |
|||
$person = $_GET['person']; |
|||
$stop = $_GET['stop']; |
|||
$open = $_GET['open']; |
|||
$speed = $_GET['speed']; |
|||
$weight = $_GET['weight']; |
|||
|
|||
|
|||
$sql_str = "SELECT * FROM elevator_mi_option WHERE elevator_type = :elevator_type AND max_weight = :max_weight AND max_speed = :max_speed ORDER BY id DESC LIMIT 1"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':elevator_type', $spec); |
|||
$stmt->bindParam(':max_weight', $weight); |
|||
$stmt->bindParam(':max_speed', $speed); |
|||
$stmt->execute(); |
|||
$mi = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
|
|||
|
|||
if(!$mi){ |
|||
echo false; |
|||
exit; |
|||
} |
|||
|
|||
$stop = $stop > $mi['max_floors'] ? $mi['max_floors'] : $stop; |
|||
$stop = $stop < 2 ? 2 : $stop; |
|||
$equipment_fee = round($mi['purchase_cost'] + ($stop - $mi['base_floor']) * $mi['material_plus']); |
|||
$customs_shipping_fee = round($equipment_fee * 0.09); |
|||
$unloading_fee = round($mi['unloading']); |
|||
$transport_site_fee = round($mi['transport_site']); |
|||
$install_fee = round(($mi['install_price'] + ($stop - $mi['base_floor']) * $mi['install_plus']) + $mi['trial_price'] + ($stop - $mi['base_floor']) * $mi['trial_plus']); |
|||
$free1y_fee = round($mi['free1y']); |
|||
$other_fee = round($mi['crane'] + $mi['wooden_box'] + $mi['consumables']); |
|||
|
|||
|
|||
$newMI = [ |
|||
'equipment_fee'=>$equipment_fee, |
|||
'customs_shipping_fee'=>$customs_shipping_fee, |
|||
'unloading_fee'=>$unloading_fee, |
|||
'transport_site_fee'=>$transport_site_fee, |
|||
'install_fee'=>$install_fee, |
|||
'free1y_fee'=>$free1y_fee, |
|||
'other_fee'=>$other_fee |
|||
]; |
|||
echo json_encode($newMI); |
@ -0,0 +1,19 @@ |
|||
<?php |
|||
|
|||
require_once("../conn.php"); |
|||
|
|||
$model = $_GET['model']; |
|||
|
|||
$sql_str = "SELECT id, model, price FROM facility_price WHERE model = :model ORDER BY id DESC"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':model', $model); |
|||
$stmt->execute(); |
|||
$el = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
if($el){ |
|||
$price = $el['price']; |
|||
$id = $el['id']; |
|||
}else{ |
|||
$price = null; |
|||
$id = null; |
|||
} |
|||
echo json_encode(['id'=>$id, 'price'=>$price]); |
@ -0,0 +1,12 @@ |
|||
<?php |
|||
|
|||
require_once('../conn.php'); |
|||
|
|||
$accountid = $_GET['user_id']; |
|||
|
|||
$sql_str = "SELECT name FROM account WHERE accountid = :accountid"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':accountid', $accountid); |
|||
$stmt->execute(); |
|||
$user = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
echo $user['name']; |
@ -0,0 +1,234 @@ |
|||
<?php |
|||
require_once("../conn.php"); |
|||
date_default_timezone_set('Asia/Taipei'); |
|||
|
|||
$contractno = $_POST['contractno']; |
|||
$ekind = $_POST['ekind']; |
|||
$person = $_POST['person']; |
|||
$company = $_POST['company']; |
|||
$case_name = $_POST['case_name']; |
|||
$address = $_POST['address']; |
|||
$compete = ""; |
|||
$price_lowest = $_POST['price_lowest']; |
|||
$price_total = $_POST['price_total']; |
|||
$price_rate = $_POST['price_rate']; |
|||
$special_fee = $_POST['special_fee']; |
|||
$predeal_date = $_POST['predeal_date']; |
|||
$penalty = $_POST['penalty']; |
|||
$deposit_rate = $_POST['deposit_rate']; |
|||
$warranty_rate = $_POST['warranty_rate']; |
|||
$keep_rate = $_POST['keep_rate']; |
|||
$memo = $_POST['memo']; |
|||
$status = $_POST['status']; |
|||
$attatch1 = $_POST['attatch1'] =='' ? NULL : $_POST['attatch1']; |
|||
$attatch2 = $_POST['attatch2'] =='' ? NULL : $_POST['attatch2']; |
|||
$creater = "M0174"; |
|||
$create_at = date("Y-m-d H:i:s"); |
|||
|
|||
|
|||
$elevators = $_POST['elevators']; |
|||
$options = $_POST['options']; |
|||
$otherOptions = $_POST['otherOptions']; |
|||
$maintainOptions = $_POST['maintainOptions']; |
|||
|
|||
$paymentRatio = $_POST['paymentRatio']; |
|||
|
|||
$conn->beginTransaction(); |
|||
|
|||
try{ |
|||
|
|||
$sql_str = "INSERT INTO pricereview_main (contractno, ekind, person, company, case_name, address, compete, price_lowest, price_total, price_rate, special_fee, predeal_date, facilitok_date, penalty, deposit_rate, keep_rate, warranty_rate, memo, status, attatch1, attatch2, creater, create_at) |
|||
VALUES (:contractno, :ekind, :person, :company, :case_name, :address, :compete, :price_lowest, :price_total, :price_rate, :special_fee, :predeal_date, :facilitok_date, :penalty, :deposit_rate, :keep_rate, :warranty_rate, :memo, :status, :attatch1, :attatch2, :creater, :create_at)"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':contractno', $contractno); |
|||
$stmt->bindParam(':ekind', $ekind); |
|||
$stmt->bindParam(':person', $person); |
|||
$stmt->bindParam(':company', $company); |
|||
$stmt->bindParam(':case_name', $case_name); |
|||
$stmt->bindParam(':address', $address); |
|||
$stmt->bindParam(':compete', $compete); |
|||
$stmt->bindParam(':price_lowest', $price_lowest); |
|||
$stmt->bindParam(':price_total', $price_total); |
|||
$stmt->bindParam(':price_rate', $price_rate); |
|||
$stmt->bindParam(':special_fee', $special_fee); |
|||
$stmt->bindParam(':predeal_date', $predeal_date); |
|||
$stmt->bindParam(':facilitok_date', $facilitok_date); |
|||
$stmt->bindParam(':penalty', $penalty); |
|||
$stmt->bindParam(':deposit_rate', $deposit_rate); |
|||
$stmt->bindParam(':keep_rate', $keep_rate); |
|||
$stmt->bindParam(':warranty_rate', $warranty_rate); |
|||
$stmt->bindParam(':memo', $memo); |
|||
$stmt->bindParam(':status', $status); |
|||
$stmt->bindParam(':attatch1', $attatch1); |
|||
$stmt->bindParam(':attatch2', $attatch2); |
|||
$stmt->bindParam(':creater', $creater); |
|||
$stmt->bindParam(':create_at', $create_at); |
|||
$stmt->execute(); |
|||
$mid = $conn->lastInsertId(); |
|||
|
|||
//insert 整機單價 |
|||
$sql_str = "INSERT INTO pricereview_item (mid, price_id, item_no, item_group, item_spec, item_weight, item_op, item_unit_price, item_qty, item_price_bp, item_price_ct, note) |
|||
VALUES (:mid, :price_id, :item_no, :item_group, :item_spec, :item_weight, :item_op, :item_unit_price, :item_qty, :item_price_bp, :item_price_ct, :note)"; |
|||
|
|||
foreach(json_decode($elevators, true) as $elevator){ |
|||
$price_id = $elevator['facility_id']; |
|||
$item_no = $elevator['id']; |
|||
$item_group = "A"; |
|||
$item_spec = $elevator['specifications'] . "-" . $elevator['person'] . "*" . $elevator['stop'] . "-" . $elevator['open_converted'] . $elevator['speed']; |
|||
$item_weight = ""; |
|||
$item_op = $elevator['open_converted']; |
|||
|
|||
$item_unit_price = $elevator['price']; |
|||
$item_qty = (int)$elevator['spec_num']; |
|||
$item_price_bp = (int)$elevator['price'] * (int)$elevator['spec_num']; |
|||
$item_price_ct = $elevator['spec_price']; |
|||
$note = $elevator['specifications'] . ',' . $elevator['person'] . ',' . $elevator['stop'] . ',' . $elevator['speed']; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':price_id', $price_id); |
|||
$stmt->bindParam(':item_no', $item_no); |
|||
$stmt->bindParam(':item_group', $item_group); |
|||
$stmt->bindParam(':item_spec', $item_spec); |
|||
$stmt->bindParam(':item_weight', $item_weight); |
|||
$stmt->bindParam(':item_op', $item_op); |
|||
$stmt->bindParam(':item_unit_price', $item_unit_price); |
|||
$stmt->bindParam(':item_qty', $item_qty); |
|||
$stmt->bindParam(':item_price_bp', $item_price_bp); |
|||
$stmt->bindParam(':item_price_ct', $item_price_ct); |
|||
$stmt->bindParam(':note', $note); |
|||
$stmt->execute(); |
|||
} |
|||
|
|||
//insert options 加價 |
|||
$sql_str = "INSERT INTO pricereview_item (mid, price_id, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp) |
|||
VALUES (:mid, :price_id, :item_no, :item_group, :item_spec, :option_relate_spec, :item_unit_price, :item_qty, :item_price_bp)"; |
|||
|
|||
foreach(json_decode($options, true) as $option){ |
|||
$price_id = $option['id']; |
|||
$item_no = $option['key'] + 1; |
|||
$item_group = "B"; |
|||
$item_spec = $option['name'] . $option['memo']; |
|||
$option_relate_spec = $option['toElevator'][0]['id']; |
|||
$item_unit_price = $option['price']; |
|||
$item_qty = $option['qty']; |
|||
$item_price_bp = $option['price'] * $option['qty']; |
|||
|
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':price_id', $price_id); |
|||
$stmt->bindParam(':item_no', $item_no); |
|||
$stmt->bindParam(':item_group', $item_group); |
|||
$stmt->bindParam(':item_spec', $item_spec); |
|||
$stmt->bindParam(':option_relate_spec', $option_relate_spec); |
|||
$stmt->bindParam(':item_unit_price', $item_unit_price); |
|||
$stmt->bindParam(':item_qty', $item_qty); |
|||
$stmt->bindParam(':item_price_bp', $item_price_bp); |
|||
$stmt->execute(); |
|||
} |
|||
|
|||
//insert 除外項目 |
|||
$sql_str = "INSERT INTO pricereview_item (mid, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp) |
|||
VALUES (:mid, :item_no, :item_group, :item_spec, :option_relate_spec, :item_unit_price, :item_qty, :item_price_bp)"; |
|||
|
|||
foreach(json_decode($otherOptions, true) as $option){ |
|||
$item_no = $option['id'] + 1; |
|||
$item_group = "E"; |
|||
$item_spec = $option['name']; |
|||
$option_relate_spec = $option['toElevator'][0]['id']; |
|||
$item_unit_price = $option['price']; |
|||
$item_qty = $option['num']; |
|||
$item_price_bp = $option['price'] * $option['num']; |
|||
|
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':item_no', $item_no); |
|||
$stmt->bindParam(':item_group', $item_group); |
|||
$stmt->bindParam(':item_spec', $item_spec); |
|||
$stmt->bindParam(':option_relate_spec', $option_relate_spec); |
|||
$stmt->bindParam(':item_unit_price', $item_unit_price); |
|||
$stmt->bindParam(':item_qty', $item_qty); |
|||
$stmt->bindParam(':item_price_bp', $item_price_bp); |
|||
$stmt->execute(); |
|||
} |
|||
|
|||
$sql_str = "INSERT INTO pricereview_item (mid, item_no, item_group, item_spec, option_relate_spec, item_unit_price, item_qty, item_price_bp) |
|||
VALUES (:mid, :item_no, :item_group, :item_spec, :option_relate_spec, :item_unit_price, :item_qty, :item_price_bp)"; |
|||
//insert 保養延長 |
|||
foreach(json_decode($maintainOptions, true) as $option){ |
|||
$item_no = $option['id'] + 1; |
|||
$item_group = "D"; |
|||
$item_spec = $option['toElevator'][0]['model']; |
|||
$option_relate_spec = $option['toElevator'][0]['id']; |
|||
$item_unit_price = $option['price']; |
|||
$item_qty = $option['num']; |
|||
$item_price_bp = $option['price'] * $option['num']; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':item_no', $item_no); |
|||
$stmt->bindParam(':item_group', $item_group); |
|||
$stmt->bindParam(':item_spec', $item_spec); |
|||
$stmt->bindParam(':option_relate_spec', $option_relate_spec); |
|||
$stmt->bindParam(':item_unit_price', $item_unit_price); |
|||
$stmt->bindParam(':item_qty', $item_qty); |
|||
$stmt->bindParam(':item_price_bp', $item_price_bp); |
|||
$stmt->execute(); |
|||
} |
|||
|
|||
|
|||
$sql_str = "INSERT INTO pricereview_pay (mid, pay_kind, pay_scale, pay_amount, pay_period) |
|||
VALUES (:mid, :pay_kind, :pay_scale, :pay_amount, :pay_period)"; |
|||
|
|||
foreach(json_decode($paymentRatio, true) as $key=>$pay){ |
|||
$pay_kind = $key +1; |
|||
$pay_scale = $pay['scale'] == '' ? 0 : $pay['scale']; |
|||
$pay_amount = $pay['scale']/100 * $price_total; |
|||
$pay_period = ($pay['scale'] == '' || $pay['scale'] == 0) ? '' :$pay['ticket']; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':pay_kind', $pay_kind); |
|||
$stmt->bindParam(':pay_scale', $pay_scale); |
|||
$stmt->bindParam(':pay_amount', $pay_amount); |
|||
$stmt->bindParam(':pay_period', $pay_period); |
|||
$stmt->execute(); |
|||
} |
|||
|
|||
$sql_str = "SELECT * FROM account WHERE accountid = :accountid"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':accountid', $creater); |
|||
$stmt->execute(); |
|||
$account = $stmt->fetch(PDO::FETCH_ASSOC); |
|||
$manager = $account['manager']; |
|||
|
|||
$sign1 = "$manager,,"; //區處長 |
|||
$sign2 = NULL; // 業務承辦人 |
|||
$sign3 = "M0060,,"; //業務部協理 |
|||
|
|||
//是否呈核至總經理(M0006) |
|||
if($price_rate < 80 || $special_fee > 0){ |
|||
$sign4 = "M0006,,"; |
|||
$sign_total = 4; |
|||
}else{ |
|||
$sign4 = NULL; |
|||
$sign_total = 3; |
|||
} |
|||
|
|||
$sql_str = "INSERT INTO pricereview_sign (mid, sign1, sign2, sign3, sign4, sign_total) |
|||
VALUES (:mid, :sign1, :sign2, :sign3, :sign4, :sign_total)"; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':sign1', $sign1); |
|||
$stmt->bindParam(':sign2', $sign2); |
|||
$stmt->bindParam(':sign3', $sign3); |
|||
$stmt->bindParam(':sign4', $sign4); |
|||
$stmt->bindParam(':sign_total', $sign_total); |
|||
$stmt->execute(); |
|||
|
|||
|
|||
echo "success"; |
|||
|
|||
$conn->commit(); |
|||
}catch (PDOException $e) { |
|||
$conn->rollback(); |
|||
echo $e->getMessage(); |
|||
die('Error!:' . $e->getMessage()); |
|||
} |
@ -0,0 +1,40 @@ |
|||
<?php |
|||
|
|||
require_once('../conn.php'); |
|||
date_default_timezone_set("Asia/Taipei"); |
|||
|
|||
$sign = $_POST['sign']; |
|||
$mid = $_POST['mid']; |
|||
$result = $_POST['result']; |
|||
$reviewcomment = $_POST['reviewcomment']; |
|||
$signOff = ''; |
|||
if($result == 'YY' ){ |
|||
$signOff = 'YY'; |
|||
}elseif($result == 'YN'){ |
|||
$signOff = 'N'; |
|||
}elseif($result == 'YS'){ |
|||
$signOff = 'Y'; |
|||
} |
|||
try{ |
|||
|
|||
$user_id = $_POST['user_id']; |
|||
|
|||
$sign_result = $user_id . "," . $signOff . "," . date("Y-m-d H:i:s"); |
|||
|
|||
$sql_str = "UPDATE pricereview_sign SET sign" . $sign . "=:sign, sign".$sign."_note = :reviewcomment WHERE mid = :mid "; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':sign', $sign_result); |
|||
$stmt->bindParam(':mid', $mid); |
|||
$stmt->bindParam(':reviewcomment', $reviewcomment); |
|||
$stmt->execute(); |
|||
|
|||
$sql_str = "UPDATE pricereview_main SET status=:status WHERE id = :id "; |
|||
$stmt = $conn->prepare($sql_str); |
|||
$stmt->bindParam(':status', $result); |
|||
$stmt->bindParam(':id', $mid); |
|||
$stmt->execute(); |
|||
|
|||
echo 1; |
|||
}catch(PDOException $e){ |
|||
echo $e->getMessage(); |
|||
} |
@ -1,7 +1,882 @@ |
|||
const pricereviewCreate = ()=>{ |
|||
return { |
|||
init(){ |
|||
console.log(123) |
|||
this.elevators = elevators; |
|||
console.log(this.elevators); |
|||
console.log(this.total_spec); |
|||
}, |
|||
|
|||
openFn:{ |
|||
4:'2U', |
|||
5:"4PCO", |
|||
7:"6PCO", |
|||
8:"2S", |
|||
9:"CO" |
|||
}, |
|||
optionalArr: { |
|||
1:'標配', |
|||
2:'選配', |
|||
3:'選配', |
|||
}, |
|||
total_spec: total_spec, |
|||
options: options, |
|||
// orioptions: options,
|
|||
searchtext: '', |
|||
kind: 1, |
|||
subkind: 1, |
|||
buttons: [], |
|||
modalSelectedOptions: {}, |
|||
selectedOptions:[], |
|||
elevators: [], |
|||
toElevators:[], |
|||
toElevatorNo: '', |
|||
currentOptionKey: '', |
|||
currentOtherOptionKey: '', |
|||
currentMaintainOptionKey: '', |
|||
optionKey:0, |
|||
otherOptionKey:0, |
|||
maintainOptionKey:0, |
|||
modalElevatorInfo:{ |
|||
spec:'', |
|||
person:'', |
|||
stop:'', |
|||
speed:'', |
|||
open:'CO', |
|||
num: 1, |
|||
price:'', |
|||
sale_price:'', |
|||
facility_id: '', |
|||
}, |
|||
otherOptions: [], |
|||
modalOtherOptionInfo:{ |
|||
pr_no:"", |
|||
name:"", |
|||
price: 0, |
|||
num:"", |
|||
}, |
|||
maintainOptions:[], |
|||
modalMaintainInfo:{ |
|||
price:0, |
|||
num:"", |
|||
memo:"", |
|||
}, |
|||
paymentRatio:[ |
|||
{ |
|||
scale: 20, |
|||
ticket: 30, |
|||
}, |
|||
{ |
|||
scale: 0, |
|||
ticket: '', |
|||
}, |
|||
{ |
|||
scale: 50, |
|||
ticket: 30, |
|||
}, |
|||
{ |
|||
scale: 0, |
|||
ticket: '', |
|||
}, |
|||
{ |
|||
scale: 20, |
|||
ticket: 30, |
|||
}, |
|||
{ |
|||
scale: 10, |
|||
ticket: 30, |
|||
}, |
|||
{ |
|||
scale: 0, |
|||
ticket: '', |
|||
}, |
|||
], |
|||
serviceFee:0, |
|||
transactionDate: pre_order_date, |
|||
shippingDate:'', |
|||
remark:'', |
|||
async getElevatorPrice(idx){ |
|||
const spec = this.elevators[idx].specifications |
|||
const person = this.elevators[idx].person |
|||
const stop = this.elevators[idx].stop |
|||
const open_converted = this.elevators[idx].open_converted |
|||
const speed = this.elevators[idx].speed |
|||
const model = spec + '-' + person + '*' + stop + '-' + open_converted + speed; |
|||
try{ |
|||
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model}}) |
|||
console.log(res.data); |
|||
if(res.data.id == null || res.data.id == ""){ |
|||
console.log("公司並無提供此規格!!"); |
|||
} |
|||
this.elevators[idx].price = res.data.price |
|||
this.elevators[idx].facility_id = res.data.id |
|||
}catch (error) { |
|||
console.error("Error fetching elevator price:", error); |
|||
} |
|||
|
|||
}, |
|||
async getModalElevatorPrice(){ |
|||
let model = this.modalElevatorInfo.spec + '-' + this.modalElevatorInfo.person + '*' + this.modalElevatorInfo.stop + '-' + this.modalElevatorInfo.open + this.modalElevatorInfo.speed; |
|||
try{ |
|||
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model}}) |
|||
console.log(res.data); |
|||
if(res.data.id == null || res.data.id == ""){ |
|||
console.log("公司並無提供此規格!!"); |
|||
} |
|||
this.modalElevatorInfo.price = res.data.price |
|||
this.modalElevatorInfo.facility_id = res.data.id |
|||
}catch (error) { |
|||
console.error("Error fetching elevator price:", error); |
|||
} |
|||
}, |
|||
initButtons(kind) { |
|||
if (kind == 'A') { |
|||
this.buttons = [ |
|||
{ name: '車廂意匠', type: 'A1' } |
|||
] |
|||
} else if (kind == 'B') { |
|||
this.buttons = [ |
|||
{ name: '天井', type: 'B1' }, |
|||
{ name: '地板', type: 'B2' }, |
|||
{ name: '操縱盤', type: 'B3' }, |
|||
{ name: '扶手', type: 'B4' }, |
|||
{ name: '車廂門與層門(轎門/層門)', type: 'B5' }, |
|||
{ name: '轎壁(車廂側板)', type: 'B6' }, |
|||
{ name: '其他車廂內裝配件', type: 'B7' }, |
|||
] |
|||
} else if (kind == 'C') { |
|||
this.buttons = [ |
|||
{ name: '框', type: 'C1' }, |
|||
{ name: '乘場指示器', type: 'C2' }, |
|||
{ name: '燈', type: 'C3' }, |
|||
{ name: '方式與門', type: 'C4' }, |
|||
] |
|||
} else if (kind == 'D') { |
|||
this.buttons = [ |
|||
{ name: '功能與配置', type: 'D1' }, |
|||
{ name: 'OH與樓高', type: 'D2' }, |
|||
] |
|||
} else if (kind == 'E') { |
|||
this.buttons = [ |
|||
{ name: '平台梯', type: 'E1' }, |
|||
] |
|||
} else if (kind == 'F') { |
|||
this.buttons = [ |
|||
{ name: '汰改', type: 'F1' }, |
|||
] |
|||
} else if (kind == 1) { |
|||
this.buttons = [] |
|||
} |
|||
}, |
|||
optionSubCategory: 1, |
|||
initOptinos(){ |
|||
this.options.forEach(option=>{ |
|||
option.isShow = 1; |
|||
}) |
|||
}, |
|||
searchOptions(kind=this.kind, subkind=this.subkind){ |
|||
if(kind!=null) this.kind = kind; |
|||
if(subkind!=null) this.subkind = subkind; |
|||
this.initOptinos(); |
|||
this.initButtons(kind); |
|||
this.options.forEach(option=>{ |
|||
if(option.kind != this.kind && this.kind != 1){ |
|||
option.isShow = 0; |
|||
}else{ |
|||
if(option.subkind != this.subkind && this.subkind != 1){ |
|||
option.isShow = 0; |
|||
} |
|||
} |
|||
if(option.isShow == 1){ |
|||
if(option.group_name == null) option.group_name = '' |
|||
if(option.spec == null) option.spec = '' |
|||
if(option.memo == null) option.memo = '' |
|||
if(option.price == null) option.price = 0 |
|||
if(option.unit == null) option.unit = '' |
|||
if(String(option.id).includes(this.searchtext) || option.group_name.includes(this.searchtext) || option.memo.toLowerCase().includes(this.searchtext) || option.spec.toLowerCase().includes(this.searchtext) || option.unit.includes(this.searchtext) || String(option.price).includes(this.searchtext)){ |
|||
option.isShow = 1 |
|||
}else{ |
|||
option.isShow = 0 |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
selectOption(idx, id, name, price, memo){ |
|||
this.options[idx].selected = this.options[idx].selected==1 ? 0 : 1; |
|||
|
|||
if(this.modalSelectedOptions.hasOwnProperty(idx)){ |
|||
delete this.modalSelectedOptions[idx]; |
|||
}else{ |
|||
//this.optionKey => 已選option 流水號, idx:option表內的流水號, id:option 資料庫的ID
|
|||
this.modalSelectedOptions[idx] = {key:this.optionKey, 'idx':idx, 'id': id, 'name': name, 'price': price, qty:1, 'memo': memo, 'toElevator':[] } |
|||
} |
|||
this.optionKey ++; |
|||
}, |
|||
initModalSelectedOptions(){ |
|||
this.modalSelectedOptions = {} |
|||
this.options.forEach(option=>{ |
|||
option.selected = 0 |
|||
}) |
|||
this.$refs.optionsModal.style.display = "block" |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
chkOptions(){ |
|||
Object.keys(this.modalSelectedOptions).forEach(option=>{ |
|||
this.selectedOptions.push(this.modalSelectedOptions[option]) |
|||
}) |
|||
console.log(this.modalSelectedOptions); |
|||
console.log(this.selectedOptions); |
|||
this.hideOptionsModal(); |
|||
}, |
|||
hideOptionsModal(){ |
|||
this.$refs.optionsModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
}, |
|||
hideToElevatorModal(){ |
|||
this.$refs.toElevatorModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
}, |
|||
hideToOtherOptionElevatorModal(){ |
|||
this.$refs.toOtherOptionElevatorModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
}, |
|||
hideToMaintainOptionElevatorModal(){ |
|||
this.$refs.toMaintainOptionElevatorModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
}, |
|||
hideCreateElevatorModal(){ |
|||
this.$refs.createElevatorModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
this.modalElevatorInfo = { |
|||
spec:'', |
|||
person:'', |
|||
stop:'', |
|||
speed:'', |
|||
open:'CO', |
|||
num: 1, |
|||
price:'', |
|||
sale_price:'', |
|||
}; |
|||
}, |
|||
hideCreateOtherOptionModal(){ |
|||
this.$refs.createOtherOptionModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
}, |
|||
hideCreateMaintainModal(){ |
|||
this.$refs.createMaintainModal.style.display = 'none'; |
|||
body.style.overflow = 'auto' |
|||
}, |
|||
openCreateElevatorModal(){ |
|||
this.$refs.createElevatorModal.style.display = 'block'; |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
openCreateOtherOptionFn(){ |
|||
this.$refs.createOtherOptionModal.style.display = 'block'; |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
openCreateMaintainModal(){ |
|||
this.$refs.createMaintainModal.style.display = 'block'; |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
totalElevatorsPrice(){ |
|||
return this.elevators.reduce((total, elevator) => { |
|||
return total + (elevator.spec_num * elevator.price); |
|||
}, 0); |
|||
}, |
|||
totalElevatorsNum(){ |
|||
return this.elevators.reduce((total, elevator) => { |
|||
return total + Number(elevator.spec_num); |
|||
}, 0) |
|||
}, |
|||
totalElevatorsSalePrice(){ |
|||
return this.elevators.reduce((total, elevator) => { |
|||
return total + (elevator.spec_num * elevator.spec_price); |
|||
}, 0); |
|||
}, |
|||
totalOptionsPrice(){ |
|||
return this.selectedOptions.reduce((total, option) => { |
|||
return total + (option.qty * option.price); |
|||
}, 0); |
|||
}, |
|||
openAddElevatorFn(){ |
|||
|
|||
}, |
|||
createElevatorFn(){ |
|||
if(this.modalElevatorInfo.spec == '') return alert("請選擇電梯規格"); |
|||
if(this.modalElevatorInfo.stop == '') return alert("請填入停數"); |
|||
if(this.modalElevatorInfo.speed == '') return alert("請選擇速度"); |
|||
if(this.modalElevatorInfo.open == '') return alert("請選擇開梯方式"); |
|||
if(this.modalElevatorInfo.person == '') return alert("請填入人乘/載重"); |
|||
if(this.modalElevatorInfo.num == '') return alert("請填入數量"); |
|||
if(this.modalElevatorInfo.sale_price == '') return alert("請填入售價"); |
|||
this.total_spec ++; |
|||
this.elevators.push({ |
|||
id: this.total_spec, |
|||
specifications: this.modalElevatorInfo.spec, |
|||
person: this.modalElevatorInfo.person, |
|||
stop: this.modalElevatorInfo.stop, |
|||
speed: this.modalElevatorInfo.speed, |
|||
open_converted: this.modalElevatorInfo.open, |
|||
spec_price: this.modalElevatorInfo.sale_price, |
|||
price: this.modalElevatorInfo.price, |
|||
open:'', |
|||
spec_num: this.modalElevatorInfo.num, |
|||
facility_id: this.modalElevatorInfo.facility_id, |
|||
}); |
|||
console.log(this.elevators); |
|||
this.hideCreateElevatorModal(); |
|||
}, |
|||
copyElevator(idx){ |
|||
const spec = this.elevators[idx].specifications |
|||
const person = this.elevators[idx].person |
|||
const stop = this.elevators[idx].stop |
|||
const open_converted = this.elevators[idx].open_converted |
|||
const speed = this.elevators[idx].speed |
|||
const spec_price = this.elevators[idx].spec_price |
|||
const open = this.elevators[idx].open |
|||
const spec_num = this.elevators[idx].spec_num |
|||
const price = this.elevators[idx].price |
|||
const facility_id = this.elevators[idx].facility_id |
|||
|
|||
this.total_spec ++; |
|||
this.elevators.push({ |
|||
id: this.total_spec, |
|||
specifications: spec, |
|||
person: person, |
|||
stop: stop, |
|||
speed: speed, |
|||
open_converted: open_converted, |
|||
spec_price: spec_price, |
|||
price: price, |
|||
open: open, |
|||
spec_num: spec_num, |
|||
facility_id: facility_id, |
|||
}); |
|||
console.log(this.elevators); |
|||
}, |
|||
addOptionToElevator(key){ |
|||
this.currentOptionKey = key; |
|||
this.toElevators = []; |
|||
this.toElevatorNo = ""; |
|||
const matchElevators = this.selectedOptions.filter(option=> option.key == key)[0].toElevator.map(elevator=> elevator.id) |
|||
console.log(matchElevators); |
|||
this.toElevatorNo = matchElevators[0] |
|||
this.elevators.forEach(elevator=>{ |
|||
if(elevator.price > 0){ |
|||
this.toElevators.push({ |
|||
id: elevator.id, |
|||
model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed, |
|||
checked: matchElevators.includes(elevator.id) ? 1: 0, |
|||
}) |
|||
} |
|||
}) |
|||
this.$refs.toElevatorModal.style.display = 'block'; |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
addOtherOptionToElevator(id){ |
|||
this.currentOtherOptionKey = id; |
|||
this.toElevators = []; |
|||
this.toElevatorNo = ""; |
|||
const matchElevators = this.otherOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id) |
|||
this.toElevatorNo = matchElevators[0] |
|||
this.elevators.forEach(elevator=>{ |
|||
if(elevator.price > 0){ |
|||
this.toElevators.push({ |
|||
id: elevator.id, |
|||
model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed, |
|||
checked: matchElevators.includes(elevator.id) ? 1: 0, |
|||
}) |
|||
} |
|||
}) |
|||
this.$refs.toOtherOptionElevatorModal.style.display = 'block'; |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
chkOptionToElevators(){ |
|||
const checkedOptions = []; |
|||
// this.toElevators.forEach(elevator=>{
|
|||
// if(elevator.checked){
|
|||
// checkedOptions.push({
|
|||
// id: elevator.id,
|
|||
// model: elevator.model,
|
|||
// });
|
|||
// }
|
|||
// })
|
|||
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] |
|||
checkedOptions.push({ |
|||
id: this.toElevatorNo, |
|||
model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'], |
|||
}) |
|||
this.selectedOptions.forEach(option=>{ |
|||
if(option.key == this.currentOptionKey){ |
|||
option.toElevator = []; |
|||
option.toElevator.push(...checkedOptions) |
|||
} |
|||
}) |
|||
this.currentOptionKey = '' |
|||
this.hideToElevatorModal(); |
|||
}, |
|||
chkOtherOptionToElevators(){ |
|||
const checkedOptions = []; |
|||
// this.toElevators.forEach(elevator=>{
|
|||
// if(elevator.checked){
|
|||
// checkedOptions.push({
|
|||
// id: elevator.id,
|
|||
// model: elevator.model,
|
|||
// });
|
|||
// }
|
|||
// })
|
|||
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] |
|||
checkedOptions.push({ |
|||
id: this.toElevatorNo, |
|||
model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'], |
|||
}) |
|||
this.otherOptions.forEach(option=>{ |
|||
if(option.id == this.currentOtherOptionKey){ |
|||
option.toElevator = []; |
|||
option.toElevator.push(...checkedOptions) |
|||
} |
|||
}) |
|||
|
|||
this.currentOtherOptionKey = '' |
|||
|
|||
this.hideToOtherOptionElevatorModal(); |
|||
}, |
|||
removeElevator(id){ |
|||
if(!confirm("確定刪除嗎?")) return; |
|||
this.elevators = this.elevators.filter(elevator=> elevator.id != id) |
|||
const issetElevators = []; |
|||
this.elevators.forEach(elevator=>{ |
|||
issetElevators.push(elevator.id); |
|||
}) |
|||
|
|||
this.selectedOptions.forEach(option=>{ |
|||
option.toElevator = option.toElevator.filter(el=>{ |
|||
return issetElevators.includes(el.id) |
|||
}) |
|||
}) |
|||
console.log(this.selectedOptions); |
|||
}, |
|||
removeOption(key){ |
|||
console.log(this.selectedOptions); |
|||
this.selectedOptions = this.selectedOptions.filter(option=> option.key != key) |
|||
}, |
|||
removeOtherOption(id){ |
|||
this.otherOptions = this.otherOptions.filter(option=> option.id != id) |
|||
}, |
|||
createOtherOptionFn(){ |
|||
this.otherOptions.push({ |
|||
id: this.otherOptionKey, |
|||
pr_no: this.modalOtherOptionInfo.pr_no, |
|||
name: this.modalOtherOptionInfo.name, |
|||
price: this.modalOtherOptionInfo.price, |
|||
num: this.modalOtherOptionInfo.num, |
|||
toElevator:[], |
|||
}) |
|||
this.modalOtherOptionInfo = { |
|||
pr_no: '', |
|||
name: '', |
|||
price: 0, |
|||
num: '', |
|||
} |
|||
this.otherOptionKey ++; |
|||
this.hideCreateOtherOptionModal(); |
|||
}, |
|||
totalOtherOptionsPrice(){ |
|||
return this.otherOptions.reduce((total, option) => { |
|||
return total + (Number(option.num) * Number(option.price)); |
|||
}, 0); |
|||
}, |
|||
totalOtherOptionsNum(){ |
|||
return this.otherOptions.reduce((total, option) => { |
|||
return total + Number(option.num); |
|||
}, 0); |
|||
}, |
|||
createMaintainOptionFn(){ |
|||
this.maintainOptions.push({ |
|||
id: this.maintainOptionKey, |
|||
price: this.modalMaintainInfo.price, |
|||
num: this.modalMaintainInfo.num, |
|||
memo: this.modalMaintainInfo.memo, |
|||
toElevator:[], |
|||
}) |
|||
this.modalMaintainInfo = { |
|||
price:0, |
|||
num:"", |
|||
memo:"", |
|||
} |
|||
this.maintainOptionKey ++; |
|||
this.hideCreateMaintainModal(); |
|||
}, |
|||
totalMaintainOptionsPrice(){ |
|||
return this.maintainOptions.reduce((total, option) => { |
|||
return total + (Number(option.num) * Number(option.price)); |
|||
}, 0); |
|||
}, |
|||
totalMaintainOptionsNum(){ |
|||
return this.maintainOptions.reduce((total, option) => { |
|||
return total + Number(option.num); |
|||
}, 0); |
|||
}, |
|||
chkMaintainOptionToElevators(){ |
|||
const checkedOptions = []; |
|||
// this.toElevators.forEach(elevator=>{
|
|||
// if(elevator.checked){
|
|||
// checkedOptions.push({
|
|||
// id: elevator.id,
|
|||
// model: elevator.model,
|
|||
// });
|
|||
// }
|
|||
// })
|
|||
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0] |
|||
checkedOptions.push({ |
|||
id: this.toElevatorNo, |
|||
model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'], |
|||
}) |
|||
this.maintainOptions.forEach(option=>{ |
|||
if(option.id == this.currentMaintainOptionKey){ |
|||
option.toElevator = []; |
|||
option.toElevator.push(...checkedOptions) |
|||
} |
|||
}) |
|||
this.currentMaintainOptionKey = '' |
|||
this.hideToMaintainOptionElevatorModal(); |
|||
}, |
|||
addMaintainOptionToElevator(id){ |
|||
this.currentMaintainOptionKey = id; |
|||
this.toElevators = []; |
|||
this.toElevatorNo = ""; |
|||
const matchElevators = this.maintainOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id) |
|||
this.toElevatorNo = matchElevators[0] |
|||
this.elevators.forEach(elevator=>{ |
|||
if(elevator.price > 0){ |
|||
this.toElevators.push({ |
|||
id: elevator.id, |
|||
model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed, |
|||
checked: matchElevators.includes(elevator.id) ? 1: 0, |
|||
}) |
|||
} |
|||
}) |
|||
|
|||
this.$refs.toMaintainOptionElevatorModal.style.display = 'block'; |
|||
body.style.overflow = 'hidden' |
|||
}, |
|||
removeMaintainOption(id){ |
|||
this.maintainOptions = this.maintainOptions.filter(option=> option.id != id) |
|||
}, |
|||
totalPrice(){ |
|||
return this.totalElevatorsPrice() + this.totalOptionsPrice() + this.totalOtherOptionsPrice() + this.totalMaintainOptionsPrice(); |
|||
}, |
|||
totalSalePrice(){ |
|||
return this.elevators.reduce((total, elevator) => { |
|||
return total + (elevator.spec_num * elevator.spec_price); |
|||
}, 0); |
|||
}, |
|||
scalePrice(scale){ |
|||
if(scale === '') return 0; |
|||
return this.totalSalePrice() * scale / 100; |
|||
}, |
|||
totalScale(){ |
|||
let total = 0; |
|||
Object.keys(this.paymentRatio).forEach(pay=>{ |
|||
if(this.paymentRatio[pay].scale != '' && this.paymentRatio[pay].scale > 0){ |
|||
total += Number(this.paymentRatio[pay].scale) |
|||
} |
|||
}) |
|||
|
|||
return total; |
|||
}, |
|||
customerInfo:{ |
|||
contractno: contractno, |
|||
company: customer, |
|||
manager: manager, |
|||
address: address, |
|||
case_name: case_name, |
|||
uscc: uscc, |
|||
person: salesman, |
|||
}, |
|||
penalty:"", |
|||
deposit_rate:0, |
|||
keep_rate:0, |
|||
warranty_rate:0, |
|||
error: [], |
|||
submit(){ |
|||
this.error = [] |
|||
for(let i=0;i<this.elevators.length;i++){ |
|||
if(this.elevators[i].specifications =='') this.error.push("整機單價:規格不能為空"); |
|||
if(this.elevators[i].person =='') this.error.push("整機單價:人數不能為空"); |
|||
if(this.elevators[i].stop =='') this.error.push("整機單價:梯數不能為空"); |
|||
if(this.elevators[i].speed =='') this.error.push("整機單價:速度不能為空"); |
|||
if(this.elevators[i].open_converted =='') this.error.push("整機單價:開梯方式不能為空"); |
|||
if(this.elevators[i].price =='') this.error.push("整機單價:公司發布價無此規格"); |
|||
if(this.elevators[i].spec_price <= 0) this.error.push("整機單價:售價需大於0"); |
|||
if(this.elevators[i].spec_num <= 0) this.error.push("整機單價:電梯數量需大於0"); |
|||
} |
|||
|
|||
for(let i=0;i<this.selectedOptions.length;i++){ |
|||
if(this.selectedOptions[i].qty =='' ) this.error.push("Option:數量需大於0") |
|||
if(this.selectedOptions[i].toElevator.length <= 0) this.error.push("Option:需配對至電梯") |
|||
} |
|||
for(let i=0;i<this.otherOptions.length;i++){ |
|||
if(this.otherOptions[i].name == '' ) this.error.push("除外項目:名稱不得為空"); |
|||
if(this.otherOptions[i].price == '' ) this.error.push("除外項目:價錢需大於0"); |
|||
if(this.otherOptions[i].num == '' ) this.error.push("除外項目:數量需大於0"); |
|||
if(this.otherOptions[i].toElevator.length <= 0) this.error.push("除外項目:需配對至電梯") |
|||
} |
|||
for(let i=0;i<this.maintainOptions.length;i++){ |
|||
if(this.maintainOptions[i].price == '' ) this.error.push("保固延長:價錢需大於0"); |
|||
if(this.maintainOptions[i].num == '' ) this.error.push("保固延長:數量需大於0"); |
|||
if(this.maintainOptions[i].toElevator.length <= 0) this.error.push("保固延長:需配對至電梯") |
|||
} |
|||
if(this.totalScale() != 100) this.error.push('付款辦法比例需等於100%') |
|||
if(this.transactionDate == '') this.error.push('預定成交日不得為空') |
|||
if(this.shippingDate == '') this.error.push('預定出貨日不得為空') |
|||
|
|||
if(this.error.length > 0){ |
|||
let errortext = ''; |
|||
this.error.forEach(err=>{ |
|||
errortext += err+'\n'; |
|||
}) |
|||
alert(errortext) |
|||
return; |
|||
} |
|||
|
|||
const form = new FormData(); |
|||
form.append('contractno', contractno); |
|||
form.append('ekind', "新梯"); |
|||
form.append('person', this.customerInfo.person); |
|||
form.append('company', this.customerInfo.company); |
|||
form.append('case_name', this.customerInfo.case_name); |
|||
form.append('address', this.customerInfo.address); |
|||
form.append('price_lowest', this.totalPrice()); |
|||
form.append('price_total', this.totalSalePrice()); |
|||
form.append('price_rate', Math.round(this.totalSalePrice() / this.totalPrice() * 100 *10) / 10); |
|||
form.append('special_fee', this.serviceFee); |
|||
form.append('predeal_date', this.transactionDate); |
|||
form.append('facilitok_date', this.shippingDate); |
|||
form.append('penalty', this.penalty); |
|||
form.append('deposit_rate', this.deposit_rate); |
|||
form.append('keep_rate', this.keep_rate); |
|||
form.append('warranty_rate', this.warranty_rate); |
|||
form.append('memo', this.remark); |
|||
form.append('status', "YS"); |
|||
form.append('attatch1', ""); |
|||
form.append('attatch2', ""); |
|||
|
|||
|
|||
form.append('elevators', JSON.stringify(this.elevators)); |
|||
|
|||
form.append('options', JSON.stringify(this.selectedOptions)); |
|||
form.append('otherOptions', JSON.stringify(this.otherOptions)); |
|||
form.append('maintainOptions', JSON.stringify(this.maintainOptions)); |
|||
|
|||
form.append('paymentRatio', JSON.stringify(this.paymentRatio)); |
|||
|
|||
axios.post('./api/postNewElevatorPricereview.php', form).then(res=>{ |
|||
console.log(res.data); |
|||
if(res.data == "success"){ |
|||
alert("送審成功!"); |
|||
window.location.href = './pricereview-index.php?' + token_link; |
|||
} |
|||
}).catch(err=>{ |
|||
console.error(err); |
|||
}) |
|||
}, |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
const pricereviewCheck = ()=>{ |
|||
return { |
|||
init(){ |
|||
this.elevators = items.filter(item=> item.item_group =='A'); |
|||
this.elevators.forEach(el=>{ |
|||
el.options = [] |
|||
el.optionsTotalPrice = 0; |
|||
el.otherOptions = [] |
|||
el.otherOptionsTotalPrice = 0; |
|||
el.maintainOptions = [] |
|||
el.maintainOptionsTotalPrice = 0; |
|||
}) |
|||
this.options = options; |
|||
this.otherOptions = items.filter(item=> item.item_group =='E'); |
|||
this.maintainOptions = items.filter(item=> item.item_group =='D'); |
|||
console.log(this.options); |
|||
|
|||
this.elevators.forEach((elevator, idx)=>{ |
|||
|
|||
this.options.forEach(option=>{ |
|||
if(option.option_relate_spec == elevator.item_no){ |
|||
elevator.optionsTotalPrice += option.option_mi * option.item_qty |
|||
this.elevators[idx].options.push({ |
|||
'id': option.id, //&lt;br&gt;()
|
|||
'item_spec': option.item_spec.trim().replaceAll('&', '').replaceAll('lt;', '').replaceAll('br', '').replaceAll('gt;', '').replaceAll('()', ''), |
|||
'item_unit_price': option.item_unit_price, |
|||
'item_qty': option.item_qty, |
|||
'mi': Math.round(option.option_mi), |
|||
}) |
|||
} |
|||
}) |
|||
|
|||
this.otherOptions.forEach(option=>{ |
|||
if(option.option_relate_spec == elevator.item_no){ |
|||
elevator.otherOptionsTotalPrice += option.item_unit_price * option.item_qty |
|||
this.elevators[idx].otherOptions.push({ |
|||
'id': option.id, |
|||
'item_spec': option.item_spec.trim(), |
|||
'item_unit_price': option.item_unit_price, |
|||
'item_qty': option.item_qty, |
|||
'mi': Math.round(option.item_unit_price), |
|||
}) |
|||
} |
|||
}) |
|||
|
|||
this.maintainOptions.forEach(option=>{ |
|||
if(option.option_relate_spec == elevator.item_no){ |
|||
elevator.maintainOptionsTotalPrice += option.item_unit_price * option.item_qty |
|||
this.elevators[idx].maintainOptions.push({ |
|||
'id': option.id, |
|||
'item_spec': option.item_spe.trim(), |
|||
'item_unit_price': option.item_unit_price, |
|||
'item_qty': option.item_qty, |
|||
'mi': Math.round(option.item_unit_price), |
|||
}) |
|||
} |
|||
}) |
|||
this.qty += Number(elevator.item_qty); |
|||
this.elevators_total_price += Number(elevator.item_qty) * Number(elevator.item_unit_price); |
|||
//MAE100-15*24-CO105
|
|||
const model = elevator.item_spec; |
|||
let spec = model.split('-')[0]; |
|||
let person = model.split('-')[1].split('*')[0]; |
|||
let stop = model.split('-')[1].split('*')[1].split('-')[0]; |
|||
let open = model.split('-')[2]; |
|||
let speed = ''; |
|||
for(let i=0;i<this.openFn.length;i++){ |
|||
if(open.includes(this.openFn[i])){ |
|||
speed = open.replace(this.openFn[i], '') |
|||
open = this.openFn[i]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
this.getElevatorMi(idx, spec, person, stop, open, speed, elevator.item_weight) |
|||
|
|||
}); |
|||
this.sign1 = this.getUsername(sign1) |
|||
this.sign2 = this.getUsername(sign2) |
|||
this.sign3 = this.getUsername(sign3) |
|||
this.sign4 = this.getUsername(sign4) |
|||
|
|||
|
|||
}, |
|||
async getElevatorMi(idx, spec, person, stop, open, speed, item_weight){ |
|||
try{ |
|||
const res = await axios.get('./api/getElevatorMi.php', {params: { |
|||
spec: spec, |
|||
person: person, |
|||
stop: stop, |
|||
open: open, |
|||
speed: speed, |
|||
weight: item_weight |
|||
}}) |
|||
console.log('---->',res.data); |
|||
if(res.data){ |
|||
this.elevators[idx].mi = res.data |
|||
this.elevators[idx].totalMi = res.data['equipment_fee'] + res.data['customs_shipping_fee'] + res.data['free1y_fee'] + res.data['install_fee'] + res.data['other_fee'] + res.data['transport_site_fee'] + res.data['unloading_fee']; |
|||
}else{ |
|||
this.isNotfoundMi = true; |
|||
this.elevators[idx].mi = { |
|||
'equipment_fee': 0, |
|||
'customs_shipping_fee': 0, |
|||
'free1y_fee': 0, |
|||
'install_fee': 0, |
|||
'other_fee': 0, |
|||
'transport_site_fee': 0, |
|||
'unloading_fee': 0 |
|||
} |
|||
} |
|||
|
|||
|
|||
console.log(this.elevators[idx]); |
|||
|
|||
}catch (error) { |
|||
console.error("Error fetching elevator price:", error); |
|||
} |
|||
}, |
|||
isNotfoundMi:false, |
|||
openFn:[ |
|||
'CO', '2S', '2U', '4PCO', '6PCO' |
|||
], |
|||
sign1:'', |
|||
sign2:'', |
|||
sign3:'', |
|||
sign4:'', |
|||
is_renovate: false, |
|||
elevators_total_price: 0, |
|||
contractno: contractno, |
|||
person_name: person_name, |
|||
company: company, |
|||
case_name: case_name, |
|||
address: address, |
|||
price_lowest: price_lowest, |
|||
price_total: price_total, |
|||
special_fee: special_fee, |
|||
predeal_date: predeal_date, |
|||
facilitok_date: facilitok_date, |
|||
penalty: penalty, |
|||
deposit_rate: deposit_rate, |
|||
keep_rate: keep_rate, |
|||
warranty_rate: warranty_rate, |
|||
memo: memo, |
|||
qty: 0, |
|||
pays: pays, |
|||
elevators:[], |
|||
options: [], |
|||
otherOptions: [], |
|||
maintainOptions: [], |
|||
mid: mid, |
|||
user_id: user_id, |
|||
reviewcomment:'', |
|||
optionsTotalPrice(){ |
|||
return this.options.reduce((total, option) => { |
|||
return total + (option.item_qty * option.item_unit_price); |
|||
}, 0); |
|||
}, |
|||
otherOptionsTotalPrice(){ |
|||
return this.otherOptions.reduce((total, option) => { |
|||
return total + (option.item_qty * option.item_unit_price); |
|||
}, 0); |
|||
}, |
|||
maintainOptionsTotalPrice(){ |
|||
return this.maintainOptions.reduce((total, option) => { |
|||
return total + (option.item_qty * option.item_unit_price); |
|||
}, 0); |
|||
}, |
|||
totalScale(){ |
|||
return this.pays.reduce((total, option) => { |
|||
return total + Number(option.pay_scale ); |
|||
}, 0); |
|||
}, |
|||
check(sign, status){ |
|||
console.log(sign); |
|||
const form = new FormData(); |
|||
form.append('sign', sign); |
|||
form.append('mid', this.mid); |
|||
form.append('result', status); |
|||
form.append('user_id', this.user_id); |
|||
form.append('reviewcomment', this.reviewcomment); |
|||
axios.post('./api/postPricereviewSign.php', form).then(res=>{ |
|||
console.log(res.data); |
|||
if(res.data == 1){ |
|||
alert("簽核成功!"); |
|||
window.location.reload() |
|||
} |
|||
}) |
|||
}, |
|||
async getUsername(user_id){ |
|||
if(user_id == '') return '---' |
|||
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}}) |
|||
return res.data ; |
|||
}, |
|||
} |
|||
} |
@ -1 +1 @@ |
|||
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,sBAAA;EACA,aAAA;ACAR;ADGQ;EACI,yBAAA;ACDZ;ADIY;EACI,eAAA;ACFhB;ADIY;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACFhB;ADKQ;EACI,eAAA;ACHZ;ADMI;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;ACJR;ADKQ;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACHZ;ADIY;EACI,yBAAA;EACA,WAAA;ACFhB;ADIY;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACFhB;ADIY;EACI,yBAAA;EACA,WAAA;ACFhB;ADMQ;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACJZ;ADKY;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACHhB;ADIgB;EACI,gBAAA;ACFpB;ADMY;EACI,eAAA;EACA,6BAAA;ACJhB;ADKgB;EACI,eAAA;ACHpB;ADKgB;;;;EAEA,wBAAA;EACA,SAAA;ACDhB;ADKgB;EACI,UAAA;ACHpB;ADKgB;EACI,kBAAA;ACHpB;ADIoB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACFxB","file":"pricereview.css"} |
|||
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB","file":"pricereview.css"} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue