77 changed files with 3998 additions and 6357 deletions
Binary file not shown.
@ -0,0 +1,483 @@ |
|||||
|
<?php |
||||
|
|
||||
|
include "header.php"; |
||||
|
|
||||
|
|
||||
|
$sum_total_budget = 0; |
||||
|
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start']; |
||||
|
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end']; |
||||
|
|
||||
|
|
||||
|
/* 比較應收日期 |
||||
|
@param $a array |
||||
|
@param $b array |
||||
|
return int */ |
||||
|
function comparePlanPayDate($a, $b) |
||||
|
{ |
||||
|
return strtotime($a['PlanPayDate']) - strtotime($b['PlanPayDate']); |
||||
|
} |
||||
|
|
||||
|
// 查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(); |
||||
|
foreach ($managers as $manager) { |
||||
|
$find_manager[$manager['accountid']] = $manager; |
||||
|
} |
||||
|
$follower = find_follow($user_id); |
||||
|
$arrayData = array(); |
||||
|
$receivable_array = []; |
||||
|
// T8所有合約號 |
||||
|
$sql_contractNumber = "SELECT MainAll.* , |
||||
|
Person.PersonName, |
||||
|
Dept.DeptName FROM |
||||
|
(SELECT |
||||
|
Main.BillNo, |
||||
|
Main.BillDate, |
||||
|
Main.BizPartnerId, |
||||
|
Biz.ShortName, |
||||
|
Biz.BizPartnerName, |
||||
|
Biz.ContactAddress, |
||||
|
Main.OAmountWithTax, |
||||
|
Main.PersonId, |
||||
|
Main.DeptId, |
||||
|
Main.TypeId, |
||||
|
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 |
||||
|
WHERE MainAll.TypeId = 'SP' AND (MainAll.CurrentState=2 OR MainAll.CurrentState=4) "; |
||||
|
if (!is_null($start_date)) { |
||||
|
$start_date = (int)date('Ymd', strtotime($start_date)); |
||||
|
$sql_contractNumber .= " AND MainAll.BillDate >= $start_date "; |
||||
|
} |
||||
|
if (!is_null($end_date)) { |
||||
|
$end_date = (int)date('Ymd', strtotime($end_date)); |
||||
|
$sql_contractNumber .= " AND MainAll.BillDate <= $end_date "; |
||||
|
} |
||||
|
if ((in_array($user_id, array('M0008', 'M0012'))) || (in_array(accountidToDepartId($user_id), array('220', '210', '501')))) { |
||||
|
} else { |
||||
|
$sql_contractNumber .= " AND (MainAll.PersonId = '$user_id'"; |
||||
|
if (count($follower) > 0) { |
||||
|
$column_str = "('$user_id'" . ",'"; |
||||
|
$column_str .= implode("','", $follower); |
||||
|
$column_str .= "')"; |
||||
|
$sql_contractNumber .= " OR MainAll.PersonId IN $column_str)"; |
||||
|
} else { |
||||
|
$sql_contractNumber .= ")"; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
$contractNumbers = array(); |
||||
|
$query_contract_number = $conn->query($sql_contractNumber); |
||||
|
if (is_iterable($query_contract_number)) { |
||||
|
foreach ($query_contract_number as $contract_numbers) { |
||||
|
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'] = !empty($find_manager[$contract_numbers['PersonId']]['manager']) ? $find_manager[$contract_numbers['PersonId']]['manager'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['ManagerName'] = !empty($find_manager[$contract_numbers['PersonId']]['manager_name']) ? $find_manager[$contract_numbers['PersonId']]['manager_name'] : '--'; |
||||
|
$arrayData[$contract_numbers['BillNo']]['invoice_budget'] = 0; |
||||
|
$arrayData[$contract_numbers['BillNo']]['received_budget'] = 0; |
||||
|
$arrayData[$contract_numbers['BillNo']]['receivable_budget'] = 0; |
||||
|
$sum_total_budget += $contract_numbers['OAmountWithTax']; |
||||
|
} |
||||
|
$str_numbers = "('" . implode("','", $contractNumbers) . "')"; |
||||
|
} |
||||
|
|
||||
|
// T8發票 |
||||
|
$sql_invoice = "SELECT |
||||
|
Detail.BillNo AS InvoiceBillNo, |
||||
|
Detail.MaterialId, |
||||
|
Detail.LAmountWithTax, |
||||
|
Main.InvoiceNo, |
||||
|
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 Detail.ItemType=0 AND Main.InvoiceState!=2"; |
||||
|
|
||||
|
// T8核銷 |
||||
|
$sql_received = "SELECT |
||||
|
CheckDetail.OrderBillNo, |
||||
|
arWriteOffBillDetail.FromBillNo AS CheckBillNo, |
||||
|
arWriteOffBillDetail.FromRowCode AS CheckRowCode, |
||||
|
arWriteOffBillDetail.CurrStandOffOAmount |
||||
|
FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBillDetail.BillNo, |
||||
|
arCheckBillDetail.RowCode, |
||||
|
arCheckBillDetail.FromSalSalesOrder AS OrderBillNo, |
||||
|
salSalesOrder.TypeId |
||||
|
FROM arCheckBillDetail |
||||
|
LEFT JOIN salSalesOrder |
||||
|
ON salSalesOrder.BillNo =arCheckBillDetail.FromSalSalesOrder ) |
||||
|
AS CheckDetail |
||||
|
ON CheckDetail.BillNo=arWriteOffBillDetail.FromBillNo AND arWriteOffBillDetail.FromRowCode = CheckDetail.RowCode |
||||
|
WHERE CheckDetail.TypeId = 'SP'"; |
||||
|
|
||||
|
|
||||
|
//T8 銷售訂單 階段收款計畫 |
||||
|
$sql_paystage = "SELECT * from salOrderStagePay"; |
||||
|
if (isset($str_numbers)) { |
||||
|
$sql_paystage .= " WHERE BillNo IN $str_numbers "; |
||||
|
$sql_invoice .= " AND CheckAll.FromSalSalesOrder IN $str_numbers "; |
||||
|
} |
||||
|
|
||||
|
$PayStage = $conn->query($sql_paystage); |
||||
|
$received_array = $conn->query($sql_received); |
||||
|
$invoice_data = $conn->query($sql_invoice); |
||||
|
|
||||
|
$allPayStages = array(); |
||||
|
foreach ($PayStage as $stage) { |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['PlanPayAmt'] = $stage['PlanPayAmt']; |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['PlanPayDate'] = $stage['PlanPayDate']; |
||||
|
$month = collect_month(strtotime($stage['PlanPayDate'])); |
||||
|
if (strtotime($stage['PlanPayDate']) > strtotime(date('Y-m-t', strtotime('now')))) { |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['receivable_ornot'] = '--'; |
||||
|
} else { |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['receivable_ornot'] = 'Y'; |
||||
|
} |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['month'] = $month; |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['received'] = 0; |
||||
|
$allPayStages[$stage['BillNo']][$stage['PayStage']]['invoice'] = 0; |
||||
|
} |
||||
|
foreach ($allPayStages as $paykey => $pay) { |
||||
|
uasort($allPayStages[$paykey], 'comparePlanPayDate'); |
||||
|
} |
||||
|
|
||||
|
foreach ($allPayStages as &$payStage) { |
||||
|
$sequenceNumber = 1; |
||||
|
foreach ($payStage as $tk => &$pstage) { |
||||
|
$pstage['sequenceNumber'] = $sequenceNumber; |
||||
|
$sequenceNumber += 1; |
||||
|
} |
||||
|
} |
||||
|
// 整理好的收款階段 |
||||
|
$final_paystage = array(); |
||||
|
foreach ($allPayStages as $key => &$payStage) { |
||||
|
if (is_iterable($payStage)) { |
||||
|
foreach ($payStage as $key2 => $pstage) { |
||||
|
if (isset($arrayData[$key])) { |
||||
|
$arrayData[$key]['PayStage'][$pstage['sequenceNumber']] = $pstage; |
||||
|
if (isset($pstage['receivable_ornot']) && $pstage['receivable_ornot'] == 'Y') { |
||||
|
$arrayData[$key]['receivable_budget'] += $pstage['PlanPayAmt']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
foreach ($invoice_data as $inv) { |
||||
|
if (isset($arrayData[$inv['BillNo']])) { |
||||
|
|
||||
|
$arrayData[$inv['BillNo']]['invoice_budget'] += $inv['LAmountWithTax']; |
||||
|
|
||||
|
if (isset($arrayData[$inv['BillNo']]['invoice'][$inv['InvoiceNo']])) { |
||||
|
$arrayData[$inv['BillNo']]['invoice'][$inv['InvoiceNo']] += $inv['LAmountWithTax']; |
||||
|
} else { |
||||
|
$arrayData[$inv['BillNo']]['invoice'][$inv['InvoiceNo']] = $inv['LAmountWithTax']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
foreach ($received_array as $received) { |
||||
|
if (isset($arrayData[$received['OrderBillNo']]) && isset($received['CurrStandOffOAmount']) && $received['CurrStandOffOAmount'] > 0) { |
||||
|
$arrayData[$received['OrderBillNo']]['received_budget'] += $received['CurrStandOffOAmount']; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
foreach ($arrayData as $key => &$value) { |
||||
|
if (!isset($value['PayStage'])) { |
||||
|
$value['receivable_budget'] = $value['OAmountWithTax']; |
||||
|
} else { |
||||
|
$tmpReceived = $value['received_budget']; |
||||
|
$tmpInvoice = $value['invoice_budget']; |
||||
|
if (is_iterable($value['PayStage'])) { |
||||
|
for ($sequence = 1; $sequence <= count($value['PayStage']); $sequence++) { |
||||
|
if ($value['PayStage'][$sequence]['PlanPayAmt'] > $tmpInvoice) { |
||||
|
$value['PayStage'][$sequence]['invoice'] = $tmpInvoice; |
||||
|
$tmpInvoice = 0; |
||||
|
} else { |
||||
|
$value['PayStage'][$sequence]['invoice'] = $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
$tmpInvoice -= $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
} |
||||
|
if ($value['PayStage'][$sequence]['PlanPayAmt'] > $tmpReceived) { |
||||
|
$value['PayStage'][$sequence]['received'] = $tmpReceived; |
||||
|
$tmpReceived = 0; |
||||
|
} else { |
||||
|
$value['PayStage'][$sequence]['received'] = $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
$tmpReceived -= $value['PayStage'][$sequence]['PlanPayAmt']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
$value['received_budget'] = $tmpReceived; |
||||
|
} |
||||
|
if ($value['receivable_budget'] > 0 && $value['received_budget'] < $value['receivable_budget']) { |
||||
|
$value['month'] = collect_month(strtotime($value['BillDate'])); |
||||
|
} else { |
||||
|
$value['month'] = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$excel_aray = array(); |
||||
|
|
||||
|
foreach ($arrayData as $key => $value) { |
||||
|
$uninvoice_budget = $value['OAmountWithTax'] - $value['invoice_budget']; |
||||
|
$unreceive_budget = $value['receivable_budget'] - $value['received_budget']; |
||||
|
|
||||
|
$excel_aray[$key] = [ |
||||
|
$value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'], |
||||
|
$value['DeptName'], $value['PersonId'], $value['PersonName'], |
||||
|
$value['ManagerId'], $value['ManagerName'], |
||||
|
number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])), |
||||
|
number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)), |
||||
|
number_format(round($value['received_budget'])), $unreceive_budget, $value['month'] |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
$total_data = json_encode($excel_aray); |
||||
|
|
||||
|
?> |
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
img { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
.width_style_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.hiddenTable { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
.hidden { |
||||
|
display: none; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<div style="width: 98%;margin: 1%;"> |
||||
|
<div class="btn-group btn-group-md " style="padding:10 px; width: 100%;"> |
||||
|
<button type="button" style="width: 12%;" onclick="downloadData()" class="btn btn-success">下載 <span class="glyphicon glyphicon-download-alt"></span></button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="container"> |
||||
|
<div class="text-center" style="margin-bottom: 20px;"> |
||||
|
<h3><strong> 零件 & 維修 應收帳款</strong></h3> |
||||
|
</div> |
||||
|
<form class="form-horizontal" id='myForm' method='post' action='account-receivable-repair-index.php?<?= $token_link ?>'> |
||||
|
<table class="table table-striped table-bordered" style='width:98%;text-align:center;margin:0 auto'> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<th class="text-center" style="vertical-align: middle;">合約日期</th> |
||||
|
<td colspan="2"> |
||||
|
<input type="date" class='form-control' id='date_start' name='date_start' style='width:40%;display:inline;'> |
||||
|
~ |
||||
|
<input type="date" class='form-control' id='date_end' name='date_end' style='width:40%;display:inline;'> |
||||
|
<button type="submit" class="btn btn-primary btn-sm">搜尋</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th class="text-center" style="vertical-align: middle;">合約總金額</th> |
||||
|
<td colspan="2"> |
||||
|
<input type="text" class="form-control" id="sum_total_budget" name="sum_total_budget" value="<?= number_format($sum_total_budget) ?> 元" disabled> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</form> |
||||
|
<hr> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_contract">查詢合約號</label> |
||||
|
<input type="text" id="search_contract" name="search_contract" class="form-control" placeholder="請輸入合約號" oninput="searchFront('contract')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_customerid">查詢客戶編號</label> |
||||
|
<input type="text" id="search_customerid" name="search_customerid" class="form-control" placeholder="請輸入客戶編號" oninput="searchFront('customerid')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_customername">查詢客戶名稱</label> |
||||
|
<input type="text" id="search_customername" name="search_customername" class="form-control" placeholder="請輸入客戶名稱" oninput="searchFront('customername')"> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_department">查詢部門</label> |
||||
|
<input type="text" id="search_department" name="search_department" class="form-control" placeholder="請輸入部門" oninput="searchFront('department')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_personId">查詢契約員</label> |
||||
|
<input type="text" id="search_personId" name="search_personId" class="form-control" placeholder="請輸入契約員工號/姓名" oninput="searchFront('personId')"> |
||||
|
</div> |
||||
|
<div class="col-md-4"> |
||||
|
<label for="search_manager">查詢主管</label> |
||||
|
<input type="text" id="search_manager" name="search_manager" class="form-control" placeholder="請輸入主管工號/姓名" oninput="searchFront('manager')"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-2"> |
||||
|
<input type="text" id="search_manager" name="search_manager" class="form-control" placeholder="請輸入主管工號/姓名" oninput="searchFront('manager')"> |
||||
|
</div> |
||||
|
<div class="col-md-2"> |
||||
|
<input class="form-control" value="催收次數" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<?php |
||||
|
include "./footer.php"; |
||||
|
?> |
||||
|
<div style="width: 20%;float:right;margin-right:5%; "> |
||||
|
<label>查詢條件</label> |
||||
|
<input type="text" id="search" name="search" class="form-control" placeholder="請輸入合約號/客戶名稱" oninput="searchData()"> |
||||
|
</div> |
||||
|
<div style="width: 98%; margin:1%;" style="overflow-x:auto;"> |
||||
|
<table class="table table-striped table-bordered" style="width:100%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th style='text-align:center;vertical-align: middle;width:140px'>合約號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:100px'>合約日期</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>客戶編號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:140px'>客戶名稱</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>主管</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>契約員</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>合約總金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>應收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>已開金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>未開金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>已收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>催收金額</th> |
||||
|
<th style='text-align:center;vertical-align: middle;'>催收次數</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php foreach ($excel_aray as $key => $row) { ?> |
||||
|
|
||||
|
<tr class="data-row" style="display: '';" id="<?= $key; ?>"> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="contract"><?= $row[0]; ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="contractdate"><?= $row[1]; ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="customerid"><?= $row[2] ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="customername"><?= $row[3] ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="department"><?= $row[4] ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="manager"><?= $row[7] . "<br>" . $row[8]; ?></td> |
||||
|
<td style='text-align:center;vertical-align: middle;' class="personId"><?= $row[5] . "<br>" . $row[6]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="total_budget"><?= $row[9]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="receivable_budget"><?= $row[10]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="invoice_budget"><?= $row[11]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="un_invoice_budget"><?= $row[12]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="received_budget"><?= $row[13]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="un_received_budget"><?= $row[14]; ?></td> |
||||
|
<td style='text-align:end;vertical-align: middle;' class="collect_month"><?= $row[15]; ?></td> |
||||
|
</tr> |
||||
|
<?php } |
||||
|
?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
function searchData() { |
||||
|
var searchTerm = document.getElementById('search').value.toLowerCase(); |
||||
|
var rows = document.getElementsByClassName('data-row'); |
||||
|
for (var i = 0; i < rows.length; i++) { |
||||
|
var rowText = rows[i].textContent.toLowerCase(); |
||||
|
if (rowText.includes(searchTerm)) { |
||||
|
console.log(rowText); |
||||
|
rows[i].style.display = ''; |
||||
|
} else { |
||||
|
rows[i].style.display = 'none'; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function searchFront(area) { |
||||
|
var term = 'search_' + area; |
||||
|
var searchTerm = document.getElementById(term).value.toLowerCase(); |
||||
|
var searchArea = document.getElementsByClassName(area); |
||||
|
var rows = document.getElementsByClassName('data-row'); |
||||
|
for (var i = 0; i < rows.length; i++) { |
||||
|
var rowText = searchArea[i].textContent.toLowerCase(); |
||||
|
if (rowText.includes(searchTerm)) { |
||||
|
rows[i].style.display = ''; |
||||
|
} else { |
||||
|
rows[i].style.display = 'none'; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function downloadData() { |
||||
|
var xhr = new XMLHttpRequest(); |
||||
|
var url = window.location.origin + "/wms/account-receivable-renovate-excel.php?type=repair&<?= $token_link ?>"; |
||||
|
xhr.open('POST', url, true); |
||||
|
xhr.setRequestHeader('Content-Type', 'application/json'); |
||||
|
xhr.onreadystatechange = function() { |
||||
|
if (xhr.readyState === 4 && xhr.status === 200) { |
||||
|
var file_path = xhr.responseText; |
||||
|
var link = document.createElement('a'); |
||||
|
var name = "零件&修理應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
||||
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable-repair.xlsx"); |
||||
|
link.setAttribute('download', name); |
||||
|
link.style.display = 'none'; |
||||
|
document.body.appendChild(link); |
||||
|
link.click(); |
||||
|
document.body.removeChild(link); |
||||
|
} |
||||
|
} |
||||
|
xhr.send(JSON.stringify({ |
||||
|
Bill: <?= $total_data ?> |
||||
|
})); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
function check(searchname) { |
||||
|
console.log(searchname); |
||||
|
|
||||
|
} |
||||
|
</script> |
Binary file not shown.
@ -1,75 +0,0 @@ |
|||||
<?php |
|
||||
require_once('../../contract/connt8.php'); |
|
||||
|
|
||||
// if (!empty($_GET['contract_no'])) { |
|
||||
// $contract_no = $_GET['contract_no']; |
|
||||
$contract_no = 'Q23080067'; |
|
||||
|
|
||||
$sql = "SELECT |
|
||||
a.BillNo, |
|
||||
b.OTaxAmt as amount, |
|
||||
a.CU_EstPayDate as createDate, |
|
||||
b.PersonId as personId, |
|
||||
c.BillNo as CBno, |
|
||||
c.CU_MaterialId as facility |
|
||||
FROM salIncomeApplyDetail as a |
|
||||
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
|
||||
LEFT JOIN ( |
|
||||
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
|
||||
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
|
||||
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS' |
|
||||
) AS c ON a.BillNo = c.BizPartnerId |
|
||||
WHERE a.BillNo = 'Q23080067' |
|
||||
AND a.RowNo = '1' |
|
||||
"; |
|
||||
$stmt = $connT8->prepare($sql); |
|
||||
$stmt->execute(); |
|
||||
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
|
||||
$data['amount'] = intval($data['amount']); |
|
||||
$checkBillNo = $data['CBno']; |
|
||||
|
|
||||
|
|
||||
$sql = "SELECT |
|
||||
c.BillDate AS CheckBillDate |
|
||||
FROM arWriteOffBill AS a |
|
||||
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
|
||||
LEFT JOIN |
|
||||
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
|
||||
LEFT JOIN |
|
||||
(SELECT |
|
||||
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
|
||||
FROM arCheckBill |
|
||||
LEFT JOIN arCheckBillInvInfo |
|
||||
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
|
||||
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
|
||||
ON a.BillNo=c.BillNo |
|
||||
WHERE c.checkBillNo = '$checkBillNo' |
|
||||
"; |
|
||||
|
|
||||
$stmt = $connT8->prepare($sql); |
|
||||
$stmt->execute(); |
|
||||
$check = $stmt->fetch(PDO::FETCH_ASSOC); |
|
||||
|
|
||||
|
|
||||
|
|
||||
$CU_MaterialId = $data['facility']; |
|
||||
$sql = "SELECT SQuantity FROM salIncomeApplyDetail WHERE BillNo = :contract_no AND CU_MaterialId = :CU_MaterialId"; |
|
||||
$stmt = $connT8->prepare($sql); |
|
||||
$stmt->bindParam(':contract_no', $contract_no); |
|
||||
$stmt->bindParam(':CU_MaterialId', $CU_MaterialId); |
|
||||
$stmt->execute(); |
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC); |
|
||||
$count = COUNT($result); |
|
||||
$data['maintain_month'] = intval($count * $result[0]['SQuantity']); |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
if (!empty($check['CheckBillDate'])) { |
|
||||
header('Content-Type: application/json'); |
|
||||
echo json_encode($data); |
|
||||
} else { |
|
||||
echo false; |
|
||||
exit; |
|
||||
} |
|
||||
// } |
|
@ -1,399 +0,0 @@ |
|||||
<?php |
|
||||
include "header.php"; |
|
||||
include "css/view/wipwhole-index.php"; |
|
||||
|
|
||||
// 設置一個空陣列來放資料 |
|
||||
$data = array(); |
|
||||
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno']; |
|
||||
$contractno = getContractnoDetails($link, $user_id, $contractno); |
|
||||
|
|
||||
$sql = " |
|
||||
SELECT |
|
||||
siamd.RowNo, |
|
||||
siamd.RowCode, |
|
||||
siam.BillNo, |
|
||||
siamd.CU_EstPayDate, |
|
||||
siamd.UnTransCheckBLAmtWTax , |
|
||||
siamd.HadTransCheckBLAmtWTax, |
|
||||
siamd.CU_MaterialId, |
|
||||
acb_tmp.BillNo2, |
|
||||
acb_tmp.RowCode2, |
|
||||
asim.BillNo AS BillNo3, |
|
||||
asim.InvoiceName, |
|
||||
asim.OAmountWithTax, |
|
||||
asi.InvoiceNo |
|
||||
FROM salIncomeApplyMaster AS siam -- 收入申請單 |
|
||||
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細 |
|
||||
ON siam.BillNo = siamd.BillNo |
|
||||
LEFT JOIN ( |
|
||||
SELECT |
|
||||
acbd.FromRowCode, |
|
||||
acb.FromBillNo, |
|
||||
acbd.BillNo AS BillNo2, |
|
||||
acbd.RowCode AS RowCode2 |
|
||||
FROM arCheckBill AS acb -- 應收確認單 |
|
||||
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細 |
|
||||
ON acb.BillNo = acbd.BillNo |
|
||||
WHERE 1 = 1 |
|
||||
AND acb.TypeId = 'RVS' |
|
||||
"; |
|
||||
$sql .= !empty($contractno) ? " AND acb.FromBillNo IN ($contractno) " : ""; |
|
||||
$sql .= " |
|
||||
) AS acb_tmp |
|
||||
ON siamd.RowNo = acb_tmp.FromRowCode |
|
||||
AND siamd.BillNo = acb_tmp.FromBillNo |
|
||||
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細 |
|
||||
ON asim.FromBillNo = acb_tmp.BillNo2 |
|
||||
AND asim.RowCode = acb_tmp.RowCode2 |
|
||||
LEFT JOIN arSellInvoice AS asi |
|
||||
ON asim.BillNo = asi.BillNo |
|
||||
WHERE 1 = 1 |
|
||||
"; |
|
||||
$sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : ""; |
|
||||
$data = $conn->query($sql); |
|
||||
|
|
||||
function getContractnoDetails($link, $user_id, $contractno = null) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
c.contractno |
|
||||
FROM contract AS c |
|
||||
LEFT JOIN con_maintance_examine_apply AS cmea |
|
||||
ON c.contractno = cmea.vol_no |
|
||||
WHERE 1 = 1 |
|
||||
AND cmea.salesman IN (" . getAccountids($link, $user_id) . ") |
|
||||
"; |
|
||||
if (!empty($contractno)) { |
|
||||
$sql .= " |
|
||||
AND c.contractno = '$contractno' |
|
||||
"; |
|
||||
} |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) { |
|
||||
array_push($data, $row['contractno']); |
|
||||
} |
|
||||
return "'" . implode("','", $data) . "'"; |
|
||||
} |
|
||||
|
|
||||
function getSalesmanNo($link, $contractno) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
cmea.salesman |
|
||||
FROM contract AS c |
|
||||
LEFT JOIN con_maintance_examine_apply AS cmea |
|
||||
ON c.contractno = cmea.vol_no |
|
||||
WHERE 1 = 1 |
|
||||
AND c.contractno IN ('$contractno') |
|
||||
"; |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) |
|
||||
return $row['salesman']; |
|
||||
return ""; |
|
||||
} |
|
||||
function getSalesmanName($link, $contractno) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
a.name |
|
||||
FROM contract AS c |
|
||||
LEFT JOIN con_maintance_examine_apply AS cmea |
|
||||
ON c.contractno = cmea.vol_no |
|
||||
LEFT JOIN account AS a |
|
||||
ON cmea.salesman = a.accountid |
|
||||
WHERE 1 = 1 |
|
||||
AND c.contractno IN ('$contractno') |
|
||||
"; |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) |
|
||||
return $row['name']; |
|
||||
return ""; |
|
||||
} |
|
||||
|
|
||||
function getAccountids($link, $user_id) |
|
||||
{ |
|
||||
$sql = " |
|
||||
SELECT |
|
||||
accountid |
|
||||
FROM account |
|
||||
WHERE 1 = 1 |
|
||||
AND (accountid = '$user_id' |
|
||||
OR accountid IN ( |
|
||||
SELECT |
|
||||
accountid |
|
||||
FROM account |
|
||||
WHERE 1 = 1 |
|
||||
AND manager = '$user_id' |
|
||||
AND accounttype IN ('B','E','M','W') |
|
||||
) |
|
||||
) |
|
||||
"; |
|
||||
$result = mysqli_query($link, $sql); |
|
||||
$data = []; |
|
||||
foreach ($result as $row) { |
|
||||
array_push($data, $row['accountid']); |
|
||||
} |
|
||||
return "'" . implode("','", $data) . "'"; |
|
||||
} |
|
||||
|
|
||||
function checkArCheckBillStatus($row) |
|
||||
{ |
|
||||
$CU_EstPayDate = $row['CU_EstPayDate']; |
|
||||
$BillNo2 = $row['BillNo2']; |
|
||||
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) { |
|
||||
if (empty($BillNo2)) { |
|
||||
return "<span class='text-danger'>未轉應收確認單</span>"; |
|
||||
} else { |
|
||||
return "<span class='text-primary'>已轉應收確認單</span>"; |
|
||||
} |
|
||||
} else { |
|
||||
return "時間未到"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
function arSellInvoiceMaterial($row) |
|
||||
{ |
|
||||
|
|
||||
$CU_EstPayDate = $row['CU_EstPayDate']; |
|
||||
$InvoiceName = $row['InvoiceName']; |
|
||||
|
|
||||
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) { |
|
||||
if (empty($InvoiceName)) { |
|
||||
return "<span class='text-danger'>未開發票</span>"; |
|
||||
} else { |
|
||||
return "<span class='text-primary'>已開發票</span>"; |
|
||||
} |
|
||||
} else { |
|
||||
return "時間未到"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
function checkArWriteOffBill($conn, $row) |
|
||||
{ |
|
||||
$BillNo = $row['BillNo2']; |
|
||||
|
|
||||
$sql = " |
|
||||
SELECT |
|
||||
* |
|
||||
-- a.BillNo, |
|
||||
-- a.WriteOffBizPartnerId, |
|
||||
-- a.PayWriteOffOAmount, |
|
||||
-- b.FromBillDate AS ReceivedDate, |
|
||||
-- b.CurrWOFeeOAmt AS Fee, |
|
||||
-- c.OrderBillNo, |
|
||||
-- c.checkBillNo, |
|
||||
-- c.InvoiceNo, |
|
||||
-- c.BillDate AS CheckBillDate |
|
||||
FROM arWriteOffBill AS a |
|
||||
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
|
||||
LEFT JOIN |
|
||||
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
|
||||
LEFT JOIN |
|
||||
(SELECT |
|
||||
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
|
||||
FROM arCheckBill |
|
||||
LEFT JOIN arCheckBillInvInfo |
|
||||
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
|
||||
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
|
||||
ON a.BillNo=c.BillNo |
|
||||
WHERE c.checkBillNo = '$BillNo' |
|
||||
"; |
|
||||
|
|
||||
$del = $conn->query($sql); |
|
||||
$i = 0; |
|
||||
foreach ($del as $row) |
|
||||
$i++; |
|
||||
if (empty($i)) { |
|
||||
return "<span class='text-danger'>未收款</span>"; |
|
||||
} else { |
|
||||
return "<span class='text-primary'>已收款</span>"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
|
|
||||
<?php if ($user_auth & 2) { ?> |
|
||||
<!-- <p> |
|
||||
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
|
||||
<span class="glyphicon glyphicon-plus"></span> |
|
||||
</a> |
|
||||
</p> --> |
|
||||
<?php |
|
||||
} |
|
||||
if ($data) : |
|
||||
?> |
|
||||
|
|
||||
<style> |
|
||||
table { |
|
||||
table-layout: fixed; |
|
||||
width: 100%; |
|
||||
} |
|
||||
|
|
||||
td { |
|
||||
word-wrap: break-word; |
|
||||
} |
|
||||
|
|
||||
img { |
|
||||
width: 125px; |
|
||||
} |
|
||||
|
|
||||
.width_style_1 { |
|
||||
width: 125px; |
|
||||
} |
|
||||
|
|
||||
table { |
|
||||
width: 100%; |
|
||||
} |
|
||||
|
|
||||
#table_index_filter { |
|
||||
float: right; |
|
||||
} |
|
||||
|
|
||||
#table_index_paginate { |
|
||||
float: right; |
|
||||
} |
|
||||
|
|
||||
label { |
|
||||
display: inline-flex; |
|
||||
margin-bottom: .5rem; |
|
||||
margin-top: .5rem; |
|
||||
|
|
||||
} |
|
||||
</style> |
|
||||
|
|
||||
<div style="overflow-x:auto;"> |
|
||||
<form id='myForm' method='post' action='maintainance_contract_payment_status.php?<?= $token_link ?>'> |
|
||||
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan="5"> |
|
||||
<h3 style='text-align:center'>保養合約-應收款項明細</h3> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<tr> |
|
||||
<th style='text-align:center;vertical-align: middle;'>合約號</th> |
|
||||
<td style='text-align:center;vertical-align: middle;'> |
|
||||
<input type="text" class='form-control' id='contractno' name='contractno' value=""> |
|
||||
</td> |
|
||||
<td style='text-align:left;vertical-align: middle;'> |
|
||||
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</form> |
|
||||
</div> |
|
||||
|
|
||||
<div style="overflow-x:auto;"> |
|
||||
<table id="table_index" class="table table-striped table-bordered" style="width:100%"> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>合約號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>電梯編號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>預計請款日</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>請款金額(未轉應收)</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>請款金額(已轉應收)</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>應收申請單號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>發票狀態</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:50px;'>發票單標示號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>發票單號</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>發票明細</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th> |
|
||||
<th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>核銷</th> |
|
||||
<!-- <th style='text-align:center;vertical-align: middle;'>核銷日期</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>未核銷金額</th> |
|
||||
<th style='text-align:center;vertical-align: middle;'>已核銷金額</th> --> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<?php foreach ($data as $row) { ?> |
|
||||
<tr> |
|
||||
<td> |
|
||||
<?php |
|
||||
echo getSalesmanNo($link, $row['BillNo']); |
|
||||
echo "<br/>"; |
|
||||
echo getSalesmanName($link, $row['BillNo']); |
|
||||
?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['BillNo']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['RowNo']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['CU_MaterialId']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo date('Y/m/d', strtotime($row['CU_EstPayDate'])); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo collect_month(strtotime($row['CU_EstPayDate'])); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo checkArCheckBillStatus($row); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo number_format(intval($row['UnTransCheckBLAmtWTax']), 0, '', ','); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo number_format(intval($row['HadTransCheckBLAmtWTax']), 0, '', ','); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['BillNo2']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo arSellInvoiceMaterial($row); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['RowCode2']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['BillNo3']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['InvoiceName']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo number_format(intval($row['OAmountWithTax']), 0, '', ','); ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php echo $row['InvoiceNo']; ?> |
|
||||
</td> |
|
||||
<td> |
|
||||
<?php |
|
||||
echo checkArWriteOffBill($conn, $row) |
|
||||
?> |
|
||||
</td> |
|
||||
</tr> |
|
||||
<?php } ?> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
<script> |
|
||||
$(function() { |
|
||||
document.getElementById('loadingOverlay').classList.add('hidden'); |
|
||||
}) |
|
||||
</script> |
|
||||
<?php |
|
||||
|
|
||||
else : |
|
||||
echo "<h2>There is no record!</h2>"; |
|
||||
endif; |
|
||||
|
|
||||
#代表結束連線 |
|
||||
mysqli_close($link); |
|
||||
|
|
||||
include "footer.php"; |
|
||||
?> |
|
@ -0,0 +1,87 @@ |
|||||
|
|
||||
|
<?php |
||||
|
require_once('../../contract/connt8.php'); |
||||
|
if (!empty($_GET['contract_no'])) { |
||||
|
try { |
||||
|
$contract_no = $_GET['contract_no']; |
||||
|
// $contract_no = 'Q23080067'; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
a.BillNo, |
||||
|
b.OTaxAmt as amount, |
||||
|
a.CU_EstPayDate as createDate, |
||||
|
b.PersonId as personId, |
||||
|
c.BillNo as CBno, |
||||
|
c.CU_MaterialId as facility |
||||
|
FROM salIncomeApplyDetail as a |
||||
|
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
||||
|
LEFT JOIN ( |
||||
|
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
||||
|
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
||||
|
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS' |
||||
|
) AS c ON a.BillNo = c.BizPartnerId |
||||
|
WHERE a.BillNo = '$contract_no' |
||||
|
AND a.RowNo = '1' |
||||
|
"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// $data['amount'] = intval($data['amount']); |
||||
|
if (!empty($data['CBno']) && $data['CBno'] != '') { |
||||
|
$checkBillNo = $data['CBno']; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
c.BillDate AS CheckBillDate |
||||
|
FROM arWriteOffBill AS a |
||||
|
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
||||
|
LEFT JOIN |
||||
|
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
||||
|
FROM arCheckBill |
||||
|
LEFT JOIN arCheckBillInvInfo |
||||
|
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
||||
|
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
||||
|
ON a.BillNo=c.BillNo |
||||
|
WHERE c.checkBillNo = '$checkBillNo' |
||||
|
"; |
||||
|
|
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$check = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
|
||||
|
|
||||
|
// $CU_MaterialId = $data['facility']; |
||||
|
// $sql = "SELECT SQuantity FROM salIncomeApplyDetail WHERE BillNo = :contract_no AND CU_MaterialId = :CU_MaterialId"; |
||||
|
// $stmt = $connT8->prepare($sql); |
||||
|
// $stmt->bindParam(':contract_no', $contract_no); |
||||
|
// $stmt->bindParam(':CU_MaterialId', $CU_MaterialId); |
||||
|
// $stmt->execute(); |
||||
|
// $result = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
// $count = COUNT($result); |
||||
|
// $data['maintain_month'] = intval($count * $result[0]['SQuantity']); |
||||
|
$reult = true; |
||||
|
echo '1'; |
||||
|
// return true; |
||||
|
} else { |
||||
|
$result = false; |
||||
|
echo '2'; |
||||
|
// return false; |
||||
|
} |
||||
|
} catch (PDOException $e) { |
||||
|
echo '111'; |
||||
|
return false; |
||||
|
// exit; |
||||
|
} |
||||
|
// if (($check['CheckBillDate']) !== '') { |
||||
|
// header('Content-Type: application/json'); |
||||
|
// echo $check['CheckBillDate']; |
||||
|
// } else { |
||||
|
// echo false; |
||||
|
// exit; |
||||
|
// } |
||||
|
} else { |
||||
|
exit(); |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
<?php |
||||
|
require('../../contract-repair/conn.php'); |
||||
|
$accountid = empty($_GET['accountid']) ? '' : $_GET['accountid']; |
||||
|
$sql = "SELECT name,manager FROM account WHERE accountid = :accountid"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->bindParam(':accountid', $accountid); |
||||
|
$stmt->execute(); |
||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
header('Content-Type: application/json'); |
||||
|
echo json_encode($result); |
@ -0,0 +1,111 @@ |
|||||
|
<?php |
||||
|
require_once("../../contract/conn.php"); |
||||
|
require_once("../other/maintenance_contract_bonus_v2_1.php"); |
||||
|
if (!empty($_POST)) { |
||||
|
$contract_no = empty($_POST['contract_no']) ? '' : $_POST['contract_no']; |
||||
|
$bonuns_verson = empty($_POST['bonuns_verson']) ? '' : $_POST['bonuns_verson']; |
||||
|
$client_type = empty($_POST['client_type']) ? '' : $_POST['client_type']; |
||||
|
$maintain_month = empty($_POST['maintain_month']) ? '' : $_POST['maintain_month']; |
||||
|
$maintain_price_total = empty($_POST['maintain_price_total']) ? '' : $_POST['maintain_price_total']; |
||||
|
$payDay = empty($_POST['payDay']) ? '' : $_POST['payDay']; |
||||
|
$receiver = empty($_POST['receiver']) ? '' : $_POST['receiver']; |
||||
|
$manager = empty($_POST['manager']) ? '' : $_POST['manager']; |
||||
|
$contract_manger = empty($_POST['contract_manger']) ? '' : $_POST['contract_manger']; |
||||
|
$pay_kind = empty($_POST['paykind']) ? '' : $_POST['paykind']; |
||||
|
$maintain_price_month = empty($_POST['maintain_price_month']) ? '' : $_POST['maintain_price_month']; |
||||
|
$commission_fee = empty($_POST['commission_fee']) ? '0' : $_POST['commission_fee']; |
||||
|
$checkbox = empty($_POST['checkbox']) ? '' : $_POST['checkbox']; |
||||
|
$fail_arr = []; |
||||
|
// if ($client_type == '') $fail_arr[] = '合約類行為必填'; |
||||
|
if (count($fail_arr) > 0) { |
||||
|
header("HTTP/1.1 422 Unprocessable Entity"); |
||||
|
echo json_encode($fail_arr); |
||||
|
exit(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 合約類型 |
||||
|
$clientType = [ |
||||
|
'1' => 'new', |
||||
|
'2' => 'free_to_charge', |
||||
|
'3' => 'renew_priceissue' |
||||
|
]; |
||||
|
|
||||
|
// 分期方式 |
||||
|
$paykind = [ |
||||
|
'1' => 'monthly', |
||||
|
'2' => 'bimonthly', |
||||
|
'3' => 'quarterly', |
||||
|
'6' => 'semiannually', |
||||
|
'12' => 'annually' |
||||
|
]; |
||||
|
|
||||
|
// 應付日期 |
||||
|
$day = DateTime::createFromFormat('Ymd', $payDay); |
||||
|
$pay_day = $day->format('Y-m-d'); |
||||
|
|
||||
|
$years = $maintain_month / 12; |
||||
|
$contract_years = ($years >= 2) ? 'above_two' : 'one'; |
||||
|
|
||||
|
|
||||
|
if ($checkbox == 13) { |
||||
|
// 保養獎金計算 |
||||
|
$results = maintenance_contract_bonus_v2_1( |
||||
|
$bonuns_verson, |
||||
|
$clientType[$client_type], |
||||
|
$paykind[$pay_kind], |
||||
|
$maintain_price_month, |
||||
|
$maintain_price_total, |
||||
|
$commission_fee, |
||||
|
$pay_day, |
||||
|
$receiver, |
||||
|
$manager, |
||||
|
$contract_manger |
||||
|
); |
||||
|
if ($results['result_status'] != 'error') { |
||||
|
array_push($bonus_json, [ |
||||
|
'maintain_type' => $maintain_type, |
||||
|
'total' => $maintain_price_month, |
||||
|
'fee_per_st' => $maintain_price_total, |
||||
|
'commission_fee' => $commission_fee, |
||||
|
'paykind' => $paykind[$pay_kind], |
||||
|
'receivable_date_due' => $pay_day, |
||||
|
]); |
||||
|
} |
||||
|
if (!empty($_POST['status']) && $_POST['status'] == 'save') { |
||||
|
foreach ($results['bonus_array'] as $i => $result) { |
||||
|
// echo '<pre>'; |
||||
|
// print_r($result); |
||||
|
// echo '</pre>'; |
||||
|
$bonus_type = $result['bonus_type']; |
||||
|
$pay_day = $result['pay_day_due']; |
||||
|
$amount = $result['bonus_amount']; |
||||
|
$receiver = $result['bonus_receiver']; |
||||
|
$discount = $result['discount']; |
||||
|
foreach ($bonus_json as $json) { |
||||
|
$json['discount'] = "$discount"; |
||||
|
$a = json_encode($json); |
||||
|
} |
||||
|
echo '<pre>'; |
||||
|
print_r($a); |
||||
|
echo '</pre>'; |
||||
|
// exit(); |
||||
|
// $sql = "INSERT INTO bonus |
||||
|
// (bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day,status,bonus_json,create_id,create_at) VALUES |
||||
|
// ($bonus_type,'$bonus_verson','$contract_no',$contract_type,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')"; |
||||
|
// $stmt = $conn->prepare($sql); |
||||
|
// $stmt->execute(); |
||||
|
// $count++; |
||||
|
// echo '<pre>'; |
||||
|
// print_r($count . '-- > Success'); |
||||
|
// echo '</pre>'; |
||||
|
|
||||
|
// exit; |
||||
|
} |
||||
|
} else { |
||||
|
header('Content-Type: application/json'); |
||||
|
echo json_encode($results); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
;<?php |
||||
|
require('../../contract-repair/conn.php'); |
||||
|
if (!empty($_POST)) { |
||||
|
$contract_no = empty($_POST['contract_no']) ? '' : $_POST['contract_no']; |
||||
|
$facility_no = empty($_POST['facility_no']) ? '' : $_POST['facility_no']; |
||||
|
$bonuns_verson = empty($_POST['bonuns_verson']) ? '' : $_POST['bonuns_verson']; |
||||
|
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id']; |
||||
|
$bonusArr = empty($_POST['bonusArr']) ? '' : json_decode($_POST['bonusArr'], true); |
||||
|
$contract_type = 3; |
||||
|
$date = date('Y-m-d'); |
||||
|
$sql = "INSERT INTO bonus |
||||
|
(bonus_type,bonus_verson,conreact_no,contract_type,facility_no,amount,receiver,pay_day,review_hr,review_at,create_id,create_at) VALUES |
||||
|
(:bonus_type,:bonus_verson,:conreact_no,:facility_no,:contract_type,:amount,:receiver,:pay_day,:review_hr,:review_at,:create_id,:create_at) |
||||
|
"; |
||||
|
foreach ($bonusArr as $data) { |
||||
|
$bonus_type = $data['bonus_type']; |
||||
|
$bonus_receiver = $data['bonus_receiver']; |
||||
|
$bonus_amount = $data['bonus_amount']; |
||||
|
$pay_day_due = $data['pay_day_due']; |
||||
|
$bonus_regulation = $data['bonus_regulation']; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->bindParam(':bonus_type', $bonus_type); |
||||
|
$stmt->bindParam(':bonus_verson', $bonus_verson); |
||||
|
$stmt->bindParam('conreact_no', $contract_no); |
||||
|
$stmt->bindParam(':contract_type', $contract_type); |
||||
|
} |
||||
|
} |
@ -0,0 +1,301 @@ |
|||||
|
<?php |
||||
|
include_once("../header.php"); |
||||
|
// require_once('./connT8.php'); |
||||
|
require("../contract/conn.php"); |
||||
|
|
||||
|
|
||||
|
$contract_type = [ |
||||
|
'1' => '新梯', |
||||
|
'2' => '汰改', |
||||
|
'3' => '保養' |
||||
|
]; |
||||
|
|
||||
|
$bonus_type = [ |
||||
|
'1' => '契約人獎金', |
||||
|
'2' => '區經理獎金', |
||||
|
'3' => '專任契約經理獎金' |
||||
|
]; |
||||
|
$clause = ''; |
||||
|
if (!empty($_GET['check'])) { |
||||
|
if ($_GET['check'] == 1) { |
||||
|
$clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)"; |
||||
|
} else if ($_GET['check'] == 2) { |
||||
|
$clause .= "AND status = 1"; |
||||
|
} else if ($_GET['check'] == 3) { |
||||
|
$clause .= "AND status = 2"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
$sql = "SELECT * FROM bonus WHERE 1=1 $clause LIMIT 50"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
|
||||
|
$now = new DateTime(); |
||||
|
$oneMonthAgo = $now->modify('+1 month'); |
||||
|
|
||||
|
// 查看 T8 是否有收款明細 |
||||
|
// require("./api/get.php"); |
||||
|
function isPay($contract_no, $connT8) |
||||
|
{ |
||||
|
// echo $contract_no; |
||||
|
$sql = "SELECT |
||||
|
a.BillNo, |
||||
|
b.OTaxAmt as amount, |
||||
|
a.CU_EstPayDate as createDate, |
||||
|
b.PersonId as personId, |
||||
|
c.BillNo as CBno, |
||||
|
c.CU_MaterialId as facility |
||||
|
FROM salIncomeApplyDetail as a |
||||
|
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo |
||||
|
LEFT JOIN ( |
||||
|
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster |
||||
|
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo |
||||
|
WHERE aMaster.BizPartnerId = '$contract_no' AND aMaster.TypeId = 'RVS' |
||||
|
) AS c ON a.BillNo = c.BizPartnerId |
||||
|
WHERE a.BillNo = '$contract_no' |
||||
|
AND a.RowNo = '1' |
||||
|
"; |
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$data = $stmt->fetch(PDO::FETCH_ASSOC); |
||||
|
// $data['amount'] = intval($data['amount']); |
||||
|
if (!empty($data['CBno']) && $data['CBno'] != '') { |
||||
|
$checkBillNo = $data['CBno']; |
||||
|
|
||||
|
$sql = "SELECT |
||||
|
c.BillDate AS CheckBillDate |
||||
|
FROM arWriteOffBill AS a |
||||
|
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo |
||||
|
LEFT JOIN |
||||
|
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail |
||||
|
LEFT JOIN |
||||
|
(SELECT |
||||
|
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo |
||||
|
FROM arCheckBill |
||||
|
LEFT JOIN arCheckBillInvInfo |
||||
|
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1 |
||||
|
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c |
||||
|
ON a.BillNo=c.BillNo |
||||
|
WHERE c.checkBillNo = '$checkBillNo' |
||||
|
"; |
||||
|
|
||||
|
$stmt = $connT8->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
|
||||
|
return '1'; |
||||
|
} else { |
||||
|
return '2'; |
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<!-- <script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> --> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
<div class="bonus_index"> |
||||
|
<!-- <input type="button" hidden x-ref="initbtn" @click="isPay()" /> --> |
||||
|
|
||||
|
<div style="overflow-x:auto;margin-top:12px"> |
||||
|
<a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm"> |
||||
|
<span class="glyphicon glyphicon-plus"></span> |
||||
|
</a> |
||||
|
<a href="/wms/bonus/bonus.php?function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=1&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 應發獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=2&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 未發獎金</a> |
||||
|
<a href="/wms/bonus/bonus.php?check=3&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 已發獎金</a> |
||||
|
|
||||
|
<table id="table_index" 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> |
||||
|
<th>牌價</th> |
||||
|
<th>服務費</th> |
||||
|
<th>應發人員</th> |
||||
|
<th>預計發放時間</th> |
||||
|
<th>獎金水庫</th> |
||||
|
<!-- <th>是否發放</th> --> |
||||
|
<th>狀態</th> |
||||
|
<th>檢視/發放</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php if (!empty($datas)) { |
||||
|
foreach ($datas as $key => $data) : |
||||
|
|
||||
|
$contract_no = $data['contract_no']; |
||||
|
$json = json_decode($data['bonus_json']); |
||||
|
|
||||
|
$total = empty($json->total) ? 0 : $json->total; |
||||
|
$fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st; |
||||
|
$commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee; |
||||
|
$isPay = isPay($data['contract_no'], $connT8); |
||||
|
|
||||
|
?> |
||||
|
<tr> |
||||
|
<td><?= $data['id'] ?></td> |
||||
|
<td><?= $contract_type[$data['contract_type']] ?></td> |
||||
|
<td><?= $data['contract_no'] ?></td> |
||||
|
<td><?= $data['facility_no'] ?></td> |
||||
|
<td><?= $bonus_type[$data['bonus_type']] ?></td> |
||||
|
<td><?= $data['bonus_verson'] ?></td> |
||||
|
<td><?= $total ?></td> |
||||
|
<td><?= $fee_per_st ?></td> |
||||
|
<td><?= $commission_fee ?></td> |
||||
|
<td><?= $data['receiver'] ?></td> |
||||
|
<td><?= $data['pay_day'] ?></td> |
||||
|
<td><?= $data['amount'] ?></td> |
||||
|
<!-- <td><?= ($data['status'] == 1) ? '未發放' : '已發放' ?></td> --> |
||||
|
<td> |
||||
|
<!-- <input type="text" x-model="isPays[<?php echo $key; ?>]" /> --> |
||||
|
<span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span> |
||||
|
</td> |
||||
|
<td> |
||||
|
<?php |
||||
|
// 判斷時間是否為一個月內 |
||||
|
$payday = new DateTime($data['pay_day']); |
||||
|
if ($isPay == 1) { |
||||
|
?> |
||||
|
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtn" style="">發放獎金</a> |
||||
|
<?php |
||||
|
} else if ($payday < $oneMonthAgo) { |
||||
|
?> |
||||
|
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a> |
||||
|
<?php |
||||
|
} |
||||
|
?> |
||||
|
</td> |
||||
|
|
||||
|
</tr> |
||||
|
<?php |
||||
|
endforeach; |
||||
|
} ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<style> |
||||
|
table { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
td { |
||||
|
word-wrap: break-word; |
||||
|
} |
||||
|
|
||||
|
.width_style_1 { |
||||
|
width: 125px; |
||||
|
} |
||||
|
|
||||
|
table { |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
#table_index_filter { |
||||
|
float: right; |
||||
|
} |
||||
|
|
||||
|
#table_index_paginate { |
||||
|
table-layout: fixed; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
label { |
||||
|
display: inline-flex; |
||||
|
margin-bottom: .5rem; |
||||
|
margin-top: .5rem; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.btn-secondary { |
||||
|
color: #fff; |
||||
|
background-color: #6c757d; |
||||
|
border-color: #6c757d; |
||||
|
} |
||||
|
|
||||
|
.btn-secondary:hover { |
||||
|
color: #fff; |
||||
|
background-color: #5a6268; |
||||
|
border-color: #545b62; |
||||
|
} |
||||
|
|
||||
|
.applybtn { |
||||
|
color: #fff; |
||||
|
background-color: #1484c4; |
||||
|
/* display: block; */ |
||||
|
border-radius: 5px; |
||||
|
padding: 5px 2px; |
||||
|
font-size: 13px; |
||||
|
line-height: 1; |
||||
|
display: grid; |
||||
|
place-items: center; |
||||
|
/* 水平和垂直居中 */ |
||||
|
height: 2%vh; |
||||
|
/* 100%视窗高度,可根据需要调整 */ |
||||
|
} |
||||
|
|
||||
|
.applybtncheck { |
||||
|
color: #fff; |
||||
|
background-color: #eea236; |
||||
|
/* display: block; */ |
||||
|
border-radius: 4px; |
||||
|
padding: 4px 2px; |
||||
|
font-size: 13px; |
||||
|
line-height: 1; |
||||
|
display: grid; |
||||
|
place-items: center; |
||||
|
/* 水平和垂直居中 */ |
||||
|
height: 2%vh; |
||||
|
/* 100%视窗高度,可根据需要调整 */ |
||||
|
} |
||||
|
|
||||
|
.applybtncheck:hover { |
||||
|
background-color: #f0ad4e; |
||||
|
color: #fff; |
||||
|
} |
||||
|
|
||||
|
.applybtn:hover { |
||||
|
background-color: #1494f9; |
||||
|
color: #fff; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<script> |
||||
|
const datas = <?php echo json_encode($datas); ?>; |
||||
|
|
||||
|
// function init() { |
||||
|
// this.isPay(); |
||||
|
|
||||
|
// } |
||||
|
// const bonusIndex = () => { |
||||
|
// return { |
||||
|
// async isPay() { |
||||
|
// // console.log(123) |
||||
|
// for (let i = 0; i < datas.length; i++) { |
||||
|
// await axios.get('./api/get.php?contract_no=' + datas[i].contract_no).then(res => { |
||||
|
// let isPay = res.data; |
||||
|
// // this.data.isPay.push(isPay); // 更新 x-data 中的数据 |
||||
|
// this.isPays.push(isPay); |
||||
|
// }).catch(err => { |
||||
|
|
||||
|
// }) |
||||
|
// } |
||||
|
|
||||
|
// console.log(this.isPays); |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
</script> |
@ -0,0 +1,378 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('../contract-repair/conn.php'); |
||||
|
?> |
||||
|
|
||||
|
<link rel="stylesheet" href="../contract-repair/styles/style.css"> |
||||
|
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script src="../contract-repair/js/alpine.js"></script> |
||||
|
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="../contract-repair/js/axios/axios.min.js"></script> |
||||
|
<script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> |
||||
|
<script src="../contract-repair/semantic/dist/semantic.min.js"></script> |
||||
|
|
||||
|
<div class="bonuns_index" x-data="bonunsIndexTest"> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data"> |
||||
|
<input type="hidden" name="form_name" value="main_form"> |
||||
|
<div> |
||||
|
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style='text-align:center'>獎金計算</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight: bolder;margin: botton 20px;"> |
||||
|
<tr> |
||||
|
<td style="vertical-align: middle;">獎金類型</td> |
||||
|
<td colspan="7"> |
||||
|
<div> |
||||
|
<input type="radio" name="contact" x-model="data.checkbox" value=11> |
||||
|
<label for="new_v1">新梯_V1</label><br> |
||||
|
<input type="radio" name="contact" x-model="data.checkbox" value=12> |
||||
|
<label for="new_v2">新梯_V2</label><br> |
||||
|
<input type="radio" name="contact" x-model="data.checkbox" value=13> |
||||
|
<label for="maintain">保養</label> |
||||
|
</div> |
||||
|
</td> |
||||
|
<!-- <td colspan="2" style="vertical-align:middle"></td> --> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算 新梯V1 --> |
||||
|
<template x-if="checkbox==11"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==11"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項(新梯V1)</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
|
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="client_type" x-model="data.client_type"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續簽約</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> --> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">契約人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">付款方式(月/次)</td> |
||||
|
<td> |
||||
|
<select x-model="data.paykind"> |
||||
|
<template x-for="paykind in data.paykindArr" :key="paykind"> |
||||
|
<option x-text="paykind"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">應收款日期(月/次)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay"> |
||||
|
<p>(Ex:20240101)</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養金額(月)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">牌價</td> |
||||
|
<td colspan='3'> |
||||
|
<input type="text" x-model="data.maintain_price_total"> |
||||
|
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle" @click="test()">服務費</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.commission_fee"> |
||||
|
</td> |
||||
|
<!-- <td></td> |
||||
|
<td></td> --> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算,新梯V2 --> |
||||
|
<template x-if="step==12"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==12"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項(新梯V2)</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
|
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="client_type" x-model="data.client_type"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續簽約</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> --> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">契約人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">付款方式(月/次)</td> |
||||
|
<td> |
||||
|
<select x-model="data.paykind"> |
||||
|
<template x-for="paykind in data.paykindArr" :key="paykind"> |
||||
|
<option x-text="paykind"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">應收款日期(月/次)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay"> |
||||
|
<p>(Ex:20240101)</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養金額(月)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">牌價</td> |
||||
|
<td colspan='3'> |
||||
|
<input type="text" x-model="data.maintain_price_total"> |
||||
|
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle" @click="test()">服務費</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.commission_fee"> |
||||
|
</td> |
||||
|
<!-- <td></td> |
||||
|
<td></td> --> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
|
||||
|
<template x-if=" (checkbox==13&&step==2); "> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="(checkbox==13&&step==2)"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項(保養)</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border: left 0px;"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
|
||||
|
<td style="vertical-align:middle">合約類別</td> |
||||
|
<td> |
||||
|
<select id="client_type" x-model="data.client_type"> |
||||
|
<option value="">--請選擇--</option> |
||||
|
<option value="1">新簽約</option> |
||||
|
<option value="2">免保轉有費</option> |
||||
|
<option value="3">續簽約</option> |
||||
|
</select> |
||||
|
<p class="alerttext" x-show="data.client_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> |
||||
|
</td> |
||||
|
<!-- <td style="vertical-align:middle">作番號</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.facility_no" disabled="disabled"> |
||||
|
</td> --> |
||||
|
|
||||
|
<td style="vertical-align:middle">獎金適用版本</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonus_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">契約人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">付款方式(月/次)</td> |
||||
|
<td> |
||||
|
<select x-model="data.paykind"> |
||||
|
<template x-for="paykind in data.paykindArr" :key="paykind"> |
||||
|
<option x-text="paykind"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">應收款日期(月/次)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.payDay"> |
||||
|
<p>(Ex:20240101)</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地區經理經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.manager"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">專任契約經理員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.contract_manger"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">保養金額(月)</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_month"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">牌價</td> |
||||
|
<td colspan='3'> |
||||
|
<input type="text" x-model="data.maintain_price_total"> |
||||
|
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle" @click="test()">服務費</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.commission_fee"> |
||||
|
</td> |
||||
|
<!-- <td></td> |
||||
|
<td></td> --> |
||||
|
|
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算頁面 --> |
||||
|
<template x-if="step == 3"> |
||||
|
<template x-for="(bonusArr,index) in data.bonusArr" :key=""> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px" x-show="step==3"> |
||||
|
<!-- <tr x-if="index % 3 == 0 || index == 0"> |
||||
|
<td colspan=8> |
||||
|
<p x-text="'獎金' + Number(index+1)"></p> |
||||
|
</td> |
||||
|
</tr> --> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">獎金類型</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_type"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">發放人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_receiver"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle;">發放金額</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_amount"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">預計發放時間</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.bonusArr[index].pay_day_due"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">發放規定</td> |
||||
|
<td colspan="5"> |
||||
|
<input type="text" x-model="data.bonusArr[index].bonus_regulation"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
</template> |
||||
|
</table> |
||||
|
|
||||
|
<button x-show="step == 3" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>存檔</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>下一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>上一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<div class="loader"></div> |
||||
|
</template> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script> |
||||
|
const user_id = '<?= $user_id ?>'; |
||||
|
</script> |
@ -0,0 +1,15 @@ |
|||||
|
<?php |
||||
|
require_once dirname(__FILE__) . "/../../mkt/database.php"; |
||||
|
include_once '../fun_global.php'; |
||||
|
// phpinfo(); |
||||
|
// exit(); |
||||
|
try { |
||||
|
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E="); |
||||
|
if ($connT8) { |
||||
|
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
||||
|
} |
||||
|
} catch (PDOException $e) { |
||||
|
// echo "fail"; |
||||
|
// echo $e->getMessage(); |
||||
|
die("ERROR!!!: " . $e->getMessage()); |
||||
|
} |
@ -0,0 +1,307 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('../contract-repair/conn.php'); |
||||
|
require_once("./other/maintenance_contract_bonus_v2_1.php"); |
||||
|
$create_id = $user_id; |
||||
|
$create_at = date('Y-m-d H:i:s'); |
||||
|
// echo $create_id; |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0", "new", "one", 0.8, 4000, 333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#新簽約 |
||||
|
#月繳(monthly) |
||||
|
["2.1", "new", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1", "new", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1", "new", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1", "new", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1", "new", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "new", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "new", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "new", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "new", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "new", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#免保轉有費(free_to_charge) |
||||
|
#月繳(monthly) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "free_to_charge", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
|
||||
|
#續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
#月繳(monthly) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1", "renew_priceissue", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
]; |
||||
|
|
||||
|
$bonus_json = []; |
||||
|
$count = 0; |
||||
|
foreach ($examination_array as $key => $value) { |
||||
|
$bonus_verson = $value[0]; |
||||
|
$maintain_type = $value[1]; |
||||
|
$paykind = $value[2]; |
||||
|
$elevator_list_price = $value[3]; //標準價格 / 月 |
||||
|
$fee_per_st = $value[4]; //牌價 / 月 |
||||
|
$commission_fee = $value[5]; //服務費 / 年 |
||||
|
$receivable_date_due = $value[6]; // 應收時間 |
||||
|
$sal = $value[7]; // 銷售人員 |
||||
|
$mang = $value[8]; //經理 |
||||
|
$controct_mang = $value[9]; |
||||
|
$contract_no = 'TEST0' . $key; |
||||
|
$contract_type = 3; |
||||
|
$facility_no = 'TEST' . $key; |
||||
|
$status = 1; |
||||
|
|
||||
|
$results = maintenance_contract_bonus_v2_1( |
||||
|
$bonus_verson, |
||||
|
$maintain_type, |
||||
|
$paykind, |
||||
|
$elevator_list_price, |
||||
|
$fee_per_st, |
||||
|
$commission_fee, |
||||
|
$receivable_date_due, |
||||
|
$sal, |
||||
|
$mang, |
||||
|
$controct_mang |
||||
|
); |
||||
|
|
||||
|
|
||||
|
if ($results['result_status'] == 'error') { |
||||
|
} else { |
||||
|
array_push($bonus_json, [ |
||||
|
'maintain_type' => $maintain_type, |
||||
|
'total' => $elevator_list_price, |
||||
|
'fee_per_st' => $fee_per_st, |
||||
|
'commission_fee' => $commission_fee, |
||||
|
'paykind' => $paykind, |
||||
|
'receivable_date_due' => $receivable_date_due, |
||||
|
]); |
||||
|
// foreach ($bonus_json as $json) { |
||||
|
// $a = json_encode($json); |
||||
|
// } |
||||
|
foreach ($results['bonus_array'] as $i => $result) { |
||||
|
// echo '<pre>'; |
||||
|
// print_r($result); |
||||
|
// echo '</pre>'; |
||||
|
$bonus_type = $result['bonus_type']; |
||||
|
$pay_day = $result['pay_day_due']; |
||||
|
$amount = $result['bonus_amount']; |
||||
|
$receiver = $result['bonus_receiver']; |
||||
|
$discount = $result['discount']; |
||||
|
foreach ($bonus_json as $json) { |
||||
|
$json['discount'] = "$discount"; |
||||
|
$a = json_encode($json); |
||||
|
} |
||||
|
// echo '<pre>'; |
||||
|
// print_r($a); |
||||
|
// echo '</pre>'; |
||||
|
// exit(); |
||||
|
$sql = "INSERT INTO bonus |
||||
|
(bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day,status,bonus_json,create_id,create_at) VALUES |
||||
|
($bonus_type,'$bonus_verson','$contract_no',$contract_type,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')"; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
$stmt->execute(); |
||||
|
$count++; |
||||
|
echo '<pre>'; |
||||
|
print_r($count . '-- > Success'); |
||||
|
echo '</pre>'; |
||||
|
|
||||
|
// exit; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// $sql = "INSERT INTO bonus |
||||
|
// (bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day,status,bonus_json,create_id,create_at) VALUES |
||||
|
// ($bonus_type,'$bonus_verson','$contract_no',$contract_type,'$facility_no',$amount,'$receiver','$pay_day',$status,'$bonus_json','$create_id','$create_at')"; |
||||
|
// echo '<pre>'; |
||||
|
// print_r($sql); |
||||
|
// echo '</pre>'; |
||||
|
// if ($key == 2) { |
||||
|
// exit; |
||||
|
// } |
||||
|
} |
@ -0,0 +1,159 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function elevator_renew_noninstallment_bonus_v2_1($ver, $contract_type, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $sales_id, $region_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1"){ |
||||
|
$discount = round(($elevator_knockdown_price - $commission_fee) / $elevator_list_price, 2); #銷售點數,取到小數點第2位。 |
||||
|
|
||||
|
#折扣率 |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.018; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 600; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount >= 0.60 and $discount < 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.0144; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 300; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount < 0.60): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 200; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----訂金已收款100%,發放總獎金30% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.3), #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金30%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款100%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "shipping", #出貨前期所有款項已收齊,且出貨款已收款100% |
||||
|
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款100%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款100%,發放總獎金30% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus) - round($sales_bonus * 0.3) - round($sales_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "acceptance", #驗收前期所有款項已收齊,且驗收款已收款100% |
||||
|
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款100%,發放總獎金20%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金100% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => $region_manager_bonus, #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}else{ |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"payment_schedul_due" => "9999-1-1", #預計發放時間 |
||||
|
"payment_schedul_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"error", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}; |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
||||
|
|
||||
|
?> |
@ -0,0 +1,83 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("elevator_renew_noninstallment_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $sales_id, $region_manger_id |
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","strategy_customer",1000000,1000000,100000,"M0001", "M0003"], |
||||
|
#戰略客戶(strategy_customer) |
||||
|
["2.1","strategy_customer",1000000,900000,100000,"M0001", "M0003"], #戰略客戶、折扣率80% |
||||
|
["2.1","strategy_customer",1000000,700000,100000,"M0001", "M0003"], #戰略客戶、折扣率60% |
||||
|
["2.1","strategy_customer",1000000,690000,100000,"M0001", "M0003"], #戰略客戶、折扣率59% |
||||
|
|
||||
|
#一般客戶(general_customer) |
||||
|
["2.1","general_customer",1000000,900000,100000,"M0001", "M0003"], #一般客戶、折扣率80% |
||||
|
["2.1","general_customer",1000000,700000,100000,"M0001", "M0003"], #一般客戶、折扣率60% |
||||
|
["2.1","general_customer",1000000,690000,100000,"M0001", "M0003"] #一般客戶、折扣率59% |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = elevator_renew_noninstallment_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " " |
||||
|
. $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,160 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
總支付期數$payment_period_amount: 總支付期數,依規定至少13期, |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function elevator_renew_withinstallment_bonus_v2_1($ver, $contract_type, $payment_period_amount, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $receivable_date_due, $sales_id, $region_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1"){ |
||||
|
$discount = round(($elevator_knockdown_price - $commission_fee) / $elevator_list_price, 2); #銷售點數,取到小數點第2位。 |
||||
|
|
||||
|
#折扣率 |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.018; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 600; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount >= 0.60 and $discount < 0.8): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.0144; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 300; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
case ($discount < 0.60): |
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = ($elevator_knockdown_price - $commission_fee) * 0.01; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 200; |
||||
|
break; |
||||
|
} |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#產生契約員每個月的獎金應發比例 |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1/$payment_period_amount); |
||||
|
}; |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payday_due_array, $i+1 ); |
||||
|
}; |
||||
|
|
||||
|
for($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if($i < count($payment_ratio_due_array) - 1){ |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
}else{ |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"payment_schedul_due" => date("Y-m-d",strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"payment_schedul_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
}; |
||||
|
|
||||
|
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金100% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => $region_manager_bonus, #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}else{ |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"payment_schedul_due" => "9999-1-1", #預計發放時間 |
||||
|
"payment_schedul_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"error", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
}; |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
||||
|
|
||||
|
?> |
@ -0,0 +1,85 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
簽約價格($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
一般客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price) - 服務費($commission_fee)】 除以 牌價($elevator_list_price) *100% |
||||
|
戰略客戶汰改折扣率($discount):【簽約價格($elevator_knockdown_price)】 除以 牌價($elevator_list_price) *100% |
||||
|
營業員獎金($sales_bonus) |
||||
|
區域經理提成獎金($region_manager_bonus) |
||||
|
獎金預計發放階段($payment_schedule_due):deposit(訂金款)、shipping(出貨款)、deliveried(貨到工地時)、acceptance(驗收款) |
||||
|
獎金預計發放規定($payment_schedule_regulation):訂金收齊、出貨款收齊、驗收款收齊 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
payment_schedul_due:預計發放階段 |
||||
|
payment_schedul_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("elevator_renew_withinstallment_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $payment_period_amount, $elevator_list_price, $elevator_knockdown_price, $commission_fee, $receivable_date_due, $sales_id, $region_manger_id |
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","strategy_customer",13,1000000,1000000,100000,"2014-07-01","M0001", "M0003"], |
||||
|
#戰略客戶(strategy_customer) |
||||
|
["2.1","strategy_customer",13,1000000,900000,100000,"2014-07-01","M0001", "M0003"], #戰略客戶、折扣率80% |
||||
|
["2.1","strategy_customer",13,1000000,700000,100000,"2014-07-01","M0001", "M0003"], #戰略客戶、折扣率60% |
||||
|
["2.1","strategy_customer",13,1000000,690000,100000,"2014-07-01","M0001", "M0003"], #戰略客戶、折扣率59% |
||||
|
|
||||
|
#一般客戶(general_customer) |
||||
|
["2.1","general_customer",13,1000000,900000,100000,"2014-07-01","M0001", "M0003"], #一般客戶、折扣率80% |
||||
|
["2.1","general_customer",13,1000000,700000,100000,"2014-07-01","M0001", "M0003"], #一般客戶、折扣率60% |
||||
|
["2.1","general_customer",13,1000000,690000,100000,"2014-07-01","M0001", "M0003"] #一般客戶、折扣率59% |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = elevator_renew_withinstallment_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6], |
||||
|
$examination_array[$i][7], |
||||
|
$examination_array[$i][8] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7] . " " . $examination_array[$i][8] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["payment_schedul_due"] . " " |
||||
|
. $result["bonus_array"][$j]["payment_schedul_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,299 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id) |
||||
|
{ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1") { |
||||
|
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2); |
||||
|
#契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
switch ($contract_type) { |
||||
|
case "new": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st < 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3000 and $fee_per_st < 3500): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st < 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.8; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.9; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount >= 0.6 and $discount < 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.48; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.64; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.72; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount < 0.6): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.42; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.49; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.63; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
|
||||
|
case "free_to_charge": |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.4; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.45; |
||||
|
break; |
||||
|
}; |
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
|
||||
|
case "renew_priceissue": |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.25; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st >= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.4; |
||||
|
break; |
||||
|
}; |
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金 |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "2", #獎金名稱 |
||||
|
"bonus_receiver" => $region_director_id, #發放人員 |
||||
|
"bonus_amount" => round($region_director_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
]); |
||||
|
|
||||
|
#專任契約經理獎金 |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "3", #獎金名稱 |
||||
|
"bonus_receiver" => $regular_contract_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($regular_contract_manger_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
]); |
||||
|
|
||||
|
#契約員獎金 |
||||
|
switch ($payment_period) { |
||||
|
#年付 |
||||
|
case "annually": |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
break; |
||||
|
|
||||
|
#半年付 |
||||
|
case "semiannually": |
||||
|
$payment_ratio_due_array = array(0.5, 0.5); |
||||
|
$payday_due_array = array(1, 7); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
#季付 |
||||
|
case "quarterly": |
||||
|
$payment_ratio_due_array = array(0.25, 0.25, 0.25, 0.25); |
||||
|
$payday_due_array = array(1, 4, 7, 10); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
#2月1次 |
||||
|
case "bimonthly": |
||||
|
$payment_ratio_due_array = array(0.166, 0.166, 0.166, 0.166, 0.166, 0.166); |
||||
|
$payday_due_array = array(1, 3, 5, 7, 9, 11); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
|
||||
|
#月付 |
||||
|
case "monthly": |
||||
|
$payment_ratio_due_array = array(0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083, 0.083); |
||||
|
$payday_due_array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); |
||||
|
for ($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if ($i < count($payment_ratio_due_array) - 1) { |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
} else { |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "1", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定 |
||||
|
'discount' => $discount //折扣率 |
||||
|
|
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver" => $ver, #獎金版本 |
||||
|
"result_status" => "success", #計算結果 |
||||
|
"bonus_array" => $bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} else { |
||||
|
array_push($bonus_array, [ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"pay_day_due" => "9999-1-1", #預計發放時間 |
||||
|
"bonus_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
$result_array = [ |
||||
|
"ver" => $ver, #獎金版本 |
||||
|
"result_status" => "error", #計算結果 |
||||
|
"bonus_array" => $bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
@ -0,0 +1,291 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("maintenance_contract_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $payment_period, $discount, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id |
||||
|
|
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","new","one",0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#新簽約 |
||||
|
#月繳(monthly) |
||||
|
["2.1","new","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1","new","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1","new","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1","new","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1","new","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","new","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","new","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","new","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","new","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","new","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#免保轉有費(free_to_charge) |
||||
|
#月繳(monthly) |
||||
|
["2.1","free_to_charge","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1","free_to_charge","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1","free_to_charge","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1","free_to_charge","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","free_to_charge","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","free_to_charge","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","free_to_charge","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","free_to_charge","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","free_to_charge","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
|
||||
|
#續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
#月繳(monthly) |
||||
|
["2.1","renew_priceissue","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#2月1次繳(bimonthly) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
#季付(quarterly) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#半年付(semiannually) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
|
||||
|
#年付(annually) |
||||
|
["2.1","renew_priceissue","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","renew_priceissue","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","renew_priceissue","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59) |
||||
|
["2.1","renew_priceissue","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = maintenance_contract_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6], |
||||
|
$examination_array[$i][7], |
||||
|
$examination_array[$i][8], |
||||
|
$examination_array[$i][9] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7]. " " . $examination_array[$i][8] . " " |
||||
|
. $examination_array[$i][9] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,196 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期, |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
|
||||
|
function maintenance_longterm_contract_m1_free_charge_bonus_v2_1($ver, $contract_type, $payment_period_amount, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.1"){ |
||||
|
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2); |
||||
|
#契約總類($contract_type):簽長約並免費送M1 (longcontract_m1_free_charge) |
||||
|
switch ($contract_type){ |
||||
|
case "longcontract_m1_free_charge": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6; |
||||
|
break; |
||||
|
case ($fee_per_st > 300 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
case ($fee_per_st > 4000 and $fee_per_st <= 5000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.8; |
||||
|
break; |
||||
|
case ($fee_per_st > 5000 and $fee_per_st <= 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.9; |
||||
|
break; |
||||
|
case ($fee_per_st > 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 1.0; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount >= 0.6 and $discount < 0.8): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.42; |
||||
|
break; |
||||
|
case ($fee_per_st > 300 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.49; |
||||
|
break; |
||||
|
case ($fee_per_st > 4000 and $fee_per_st <= 5000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.56; |
||||
|
break; |
||||
|
case ($fee_per_st > 5000 and $fee_per_st <= 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.63; |
||||
|
break; |
||||
|
case ($fee_per_st > 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
case ($discount < 0.6): |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.3; |
||||
|
break; |
||||
|
case ($fee_per_st > 300 and $fee_per_st <= 4000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.35; |
||||
|
break; |
||||
|
case ($fee_per_st > 4000 and $fee_per_st <= 5000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.4; |
||||
|
break; |
||||
|
case ($fee_per_st > 5000 and $fee_per_st <= 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.45; |
||||
|
break; |
||||
|
case ($fee_per_st > 6000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.5; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金($region_director_bonus) |
||||
|
$region_director_bonus = 170; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 300; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#地區處長獎金、專任契約經理、契約員獎金 |
||||
|
switch ($payment_period_amount){ |
||||
|
#簽長約免費贈送控制系統,因屬於公司特殊政策,所以無汰改獎金,合約期內每月領取契約獎金 |
||||
|
#總支付期數$payment_period_amount: 總支付期數,依規定5年約至少60期, |
||||
|
case $payment_period_amount >= 60: |
||||
|
#地區處長獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "地區處長獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $region_director_id, #發放人員 |
||||
|
"bonus_amount" => round($region_director_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "訂金收回後次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#專任契約經理獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "專任契約經理獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $regular_contract_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($regular_contract_manger_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "訂金收回後次月發放" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#產生契約員每個月的獎金應發比例 |
||||
|
$payment_ratio_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payment_ratio_due_array, 1/$payment_period_amount); |
||||
|
} |
||||
|
|
||||
|
$payday_due_array = array(); |
||||
|
for ($i = 0; $i < $payment_period_amount; $i++) { |
||||
|
array_push($payday_due_array, $i+1 ); |
||||
|
} |
||||
|
|
||||
|
for($i = 0; $i < count($payment_ratio_due_array); $i++) { |
||||
|
if($i < count($payment_ratio_due_array) - 1){ |
||||
|
$current_bonus = round($sales_bonus * $payment_ratio_due_array[$i]); #金額 |
||||
|
}else{ |
||||
|
$current_bonus = round($sales_bonus - $i * round($sales_bonus * $payment_ratio_due_array[$i])); #最後一次金額 |
||||
|
}; |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($current_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間 |
||||
|
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定 |
||||
|
]); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
}else{ |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "error", #獎金名稱 |
||||
|
"bonus_receiver" => "error", #發放人員 |
||||
|
"bonus_amount" => 0, #金額 |
||||
|
"pay_day_due" => "9999-1-1", #預計發放時間 |
||||
|
"bonus_regulation" => "error" #發放規定 |
||||
|
]); |
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"error", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
return $result_array; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -0,0 +1,101 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.1 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價 |
||||
|
付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區處長員工號($region_director_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區處長獎金($region_director_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放比例($payment_ratio_due_array) |
||||
|
當次應發獎金($current_bonus) |
||||
|
獎金預計發放日($payday_due_array) |
||||
|
獎金預計發放規定($payday_due_regulation):合約簽回及保養款項收回的次月一次性發 |
||||
|
計算結果($result_status):success, error |
||||
|
獎金水庫(bonus_array)[ |
||||
|
bonus_type:獎金名稱, |
||||
|
bonus_receiver:發放人員, |
||||
|
bonus_amount:金額, |
||||
|
pay_day_due:預計發放時間 |
||||
|
bonus_regulation, 發放規定 |
||||
|
] |
||||
|
|
||||
|
【3.輸出數據】 |
||||
|
result_array[ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"$bonus_array"=>$bonus_array #所有獎金水庫 |
||||
|
]; |
||||
|
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
require_once("maintenance_longterm_contract_m1_free_charge_bonus_v2_1.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $payment_period_amount, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id |
||||
|
|
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","longcontract_m1_free_charge",60,0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#60期 |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價3000元、服務費600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價4000元、服務費1600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,5000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價5000元、服務費2600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,6000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價6000元、服務費3600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,7000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價7000元、服務費4600元(折扣率0.8) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價3000元、服務費1200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價4000元、服務費2200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,5000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價5000元、服務費3200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,6000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價6000元、服務費4200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,7000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價7000元、服務費5200元(折扣率0.6) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價3000元、服務費1230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價4000元、服務費2230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,5000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價5000元、服務費3230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,6000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #牌價3000、簽約價6000元、服務費4230元(折扣率0.59) |
||||
|
["2.1","longcontract_m1_free_charge",60,3000,7000,1600,"2014-07-01", "M0001", "M0002", "M0003"] #牌價3000、簽約價7000元、服務費5230元(折扣率0.59) |
||||
|
|
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = maintenance_longterm_contract_m1_free_charge_bonus_v2_1( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4], |
||||
|
$examination_array[$i][5], |
||||
|
$examination_array[$i][6], |
||||
|
$examination_array[$i][7], |
||||
|
$examination_array[$i][8], |
||||
|
$examination_array[$i][9] |
||||
|
); |
||||
|
echo "獎金版本:" . $result["ver"] . "<br>"; |
||||
|
echo "計算結果:" . $result["result_status"] . "<br>"; |
||||
|
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " " |
||||
|
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7]. " " . $examination_array[$i][8] . " " |
||||
|
. $examination_array[$i][9] . "<br>"; |
||||
|
for($j = 0; $j<count($result["bonus_array"]); $j++){ |
||||
|
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " " |
||||
|
. $result["bonus_array"][$j]["bonus_regulation"] . "<br>"; |
||||
|
}; |
||||
|
echo "-------------------------" . "<br>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
@ -1,62 +0,0 @@ |
|||||
<?php |
|
||||
use PHPMailer\PHPMailer\PHPMailer; |
|
||||
use PHPMailer\PHPMailer\SMTP; |
|
||||
use PHPMailer\PHPMailer\Exception; |
|
||||
|
|
||||
class Cmail |
|
||||
{ |
|
||||
public $charset = ""; |
|
||||
public $host = ""; |
|
||||
public $port = ""; |
|
||||
public $smtp_user = ""; |
|
||||
public $smtp_pwd = ""; |
|
||||
|
|
||||
function __construct($charset='', $fromemail='') |
|
||||
{ |
|
||||
include dirname(__DIR__)."/PHPMailer/Exception.php"; |
|
||||
include dirname(__DIR__)."/PHPMailer/PHPMailer.php"; |
|
||||
include dirname(__DIR__)."/PHPMailer/SMTP.php"; |
|
||||
|
|
||||
$this->charset = "UTF-8"; |
|
||||
$this->host = "mail.masada.com.tw"; |
|
||||
$this->port = 25; |
|
||||
$this->smtp_user = "notice"; // 這裡填寫SMTP登入帳號, 例如 your.gmail.name@gmail.com 則填寫your.gmail.name |
|
||||
$this->smtp_pwd = "90493119"; // 這裡填寫SMTP登入密碼 |
|
||||
} |
|
||||
|
|
||||
function sendx($subject="", $em_body="", $sendlist=array(), $from="永佳捷科技", $bcc="", $files=array()) |
|
||||
{ |
|
||||
if (!$sendlist) return; |
|
||||
$em_body = nl2br($em_body); |
|
||||
$em_body .= "<p>※此信件為系統發出信件,請勿直接回覆。</p>"; |
|
||||
|
|
||||
$mail = new PHPMailer(true); |
|
||||
$mail->IsHTML(true); //設定是否使用HTML格式 |
|
||||
$mail->CharSet = $this->charset; |
|
||||
$mail->isSMTP(); |
|
||||
$mail->SMTPAuth = true; |
|
||||
$mail->Host = $this->host; |
|
||||
$mail->Port = $this->port; |
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //使用SSL, 如果是TLS 請改為 PHPMailer::ENCRYPTION_STARTTLS |
|
||||
$mail->Username = $this->smtp_user; |
|
||||
$mail->Password = $this->smtp_pwd; |
|
||||
$mail->SMTPSecure = ""; |
|
||||
$mail->From = "notice@masada.com.tw"; |
|
||||
$mail->FromName = $from; |
|
||||
$mail->Subject = $subject; |
|
||||
$mail->Body = $em_body; |
|
||||
foreach ($sendlist as $v) { // $sendlist[0]=['M0044', 'jrbin@masada.com.tw'] |
|
||||
list($name, $email) = $v; |
|
||||
if ($email) $mail->addAddress($email, $name); |
|
||||
} |
|
||||
//$mail->addCC("personC@gmail.com", "person C"); |
|
||||
//$mail->addBCC("personD@gmail.com", "person D"); |
|
||||
//$mail->addAttachment("image1.jpg", "picture.jpg"); //設定附件, 對方會看到附件名稱為 picture.jpg |
|
||||
//print_r($mail);exit; |
|
||||
if (!$mail->Send()){ |
|
||||
// echo "Mailer error: " . $mail->ErrorInfo; |
|
||||
} else { |
|
||||
//echo "Email sent"; |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,109 +0,0 @@ |
|||||
<?php |
|
||||
//ini_set('display_errors', 'on'); |
|
||||
|
|
||||
class Cnotice |
|
||||
{ |
|
||||
|
|
||||
function __construct() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
function connectionDB() |
|
||||
{ |
|
||||
$envFile = __DIR__ . '/../../.env'; |
|
||||
if (file_exists($envFile)) { |
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
||||
if ($lines !== false) { |
|
||||
foreach ($lines as $line) { |
|
||||
list($key, $value) = explode('=', $line, 2); |
|
||||
$key = trim($key); |
|
||||
$value = trim($value); |
|
||||
putenv("$key=$value"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
date_default_timezone_set("Asia/Taipei"); |
|
||||
$host = getenv('DB_HOST'); |
|
||||
$dbport = getenv('DB_PORT'); |
|
||||
$dbuser = getenv('DB_USERNAME'); |
|
||||
$dbpassword = getenv('DB_PASSWORD'); |
|
||||
$dbname = getenv('DB_DATABASE'); |
|
||||
|
|
||||
try { |
|
||||
$options = [ |
|
||||
PDO::ATTR_PERSISTENT => false, |
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
|
||||
PDO::ATTR_EMULATE_PREPARES => false, |
|
||||
PDO::ATTR_STRINGIFY_FETCHES => false, |
|
||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', |
|
||||
]; |
|
||||
$pdo = new PDO('mysql:host=' . $host . ';port=' . $dbport . ';dbname=' . $dbname . '', $dbuser, $dbpassword, $options); |
|
||||
$pdo->exec('SET CHARACTER SET utf8mb4'); |
|
||||
return $pdo; |
|
||||
} catch (PDOException $e) { |
|
||||
die("Something wrong: {$e->getMessage()}"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 結束資料庫連線 |
|
||||
*/ |
|
||||
function endConnectionDB($pdo) |
|
||||
{ |
|
||||
unset($pdo); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 提交消息 notice |
|
||||
* @param string $kind : 類別 1=系統 2=會議 |
|
||||
* @param int $related_id : 關聯序號 |
|
||||
* @param string $title : 標題 |
|
||||
* @param string $title : 內容 |
|
||||
* @param string $permission : 瀏覽權限 員編/ALL=全體 |
|
||||
* @param string $creater : 建立者 |
|
||||
* @param string $create_at : 建立時間 |
|
||||
*/ |
|
||||
function sendx($data) |
|
||||
{ |
|
||||
|
|
||||
$kind = $data['kind']; |
|
||||
$related_id = $data['related_id']; |
|
||||
$title = $data['title']; |
|
||||
$content = $data['content']; |
|
||||
$permission = $data['permission']; |
|
||||
$creater = $data['creater']; |
|
||||
$create_at = $data['create_at']; |
|
||||
|
|
||||
$pdo = $this->connectionDB(); |
|
||||
$pdo->exec('SET CHARACTER SET utf8mb4'); |
|
||||
$str = " |
|
||||
INSERT INTO `notice` (`kind`, `related_id`, `title`, `content`, `permission`, `creater`, `create_at`) |
|
||||
VALUES (?,?,?,?,?,?,?) |
|
||||
"; |
|
||||
|
|
||||
$sth = $pdo->prepare($str); |
|
||||
$sth->bindValue(1, $kind); |
|
||||
$sth->bindValue(2, $related_id); |
|
||||
$sth->bindValue(3, $title); |
|
||||
$sth->bindValue(4, $content); |
|
||||
$sth->bindValue(5, $permission); |
|
||||
$sth->bindValue(6, $creater); |
|
||||
$sth->bindValue(7, $create_at); |
|
||||
|
|
||||
$sth->execute(); |
|
||||
|
|
||||
$this->endConnectionDB($pdo); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// $cn = new Cnotice(); |
|
||||
// $data = array( |
|
||||
// 'kind' => 1, |
|
||||
// 'related_id' => 1, |
|
||||
// 'title' => "標題", |
|
||||
// 'content' => "內容", |
|
||||
// 'permission' => "M0117", |
|
||||
// 'creater' => "M0117", |
|
||||
// 'create_at' => date("Y-m-d H:i:s") |
|
||||
// ); |
|
||||
// $cn->sendx($data); |
|
@ -1,509 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
|
|
||||
class FormHelper |
|
||||
{ |
|
||||
/** |
|
||||
* Form opening tag |
|
||||
* |
|
||||
* @static |
|
||||
* @param string $action |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function open($action = '', array $attributes = array()) |
|
||||
{ |
|
||||
if (isset($attributes['multipart']) && $attributes['multipart']) { |
|
||||
$attributes['enctype'] = 'multipart/form-data'; |
|
||||
unset($attributes['multipart']); |
|
||||
} |
|
||||
$attributes = array_merge(array('method' => 'post', 'accept-charset' => 'utf-8'), $attributes); |
|
||||
|
|
||||
return "<form action=\"{$action}\"" . self::attributes($attributes) . '>'; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Form closing tag |
|
||||
* |
|
||||
* @static |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function close() |
|
||||
{ |
|
||||
return '</form>'; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a label for an input |
|
||||
* |
|
||||
* @param string $text The label text |
|
||||
* @param string $fieldName Name of the input element |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function label($text, $fieldName = null, array $attributes = array()) |
|
||||
{ |
|
||||
if (!isset($attributes['for']) && $fieldName !== null) { |
|
||||
$attributes['for'] = static::autoId($fieldName); |
|
||||
} |
|
||||
if (!isset($attributes['id']) && isset($attributes['for'])) { |
|
||||
$attributes['id'] = $attributes['for'] . '-label'; |
|
||||
} |
|
||||
|
|
||||
return self::tag('label', $attributes, $text); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a text field |
|
||||
* |
|
||||
* @param string $name |
|
||||
* @param string $value |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function text($name, $value = null, array $attributes = array(),$type='text') |
|
||||
{ |
|
||||
$attributes = array_merge(array( |
|
||||
'id' => static::autoId($name), |
|
||||
'name' => $name, |
|
||||
'type' => $type, |
|
||||
'value' => $value, |
|
||||
), $attributes); |
|
||||
|
|
||||
return self::tag('input', $attributes); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a password input field |
|
||||
* |
|
||||
* @static |
|
||||
* @param string $name |
|
||||
* @param string $value |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function password($name, $value = null, array $attributes = array()) |
|
||||
{ |
|
||||
$attributes = array_merge(array( |
|
||||
'id' => static::autoId($name), |
|
||||
'name' => $name, |
|
||||
'type' => 'password', |
|
||||
'value' => $value, |
|
||||
), $attributes); |
|
||||
|
|
||||
return self::tag('input', $attributes); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a hidden input field |
|
||||
* |
|
||||
* @static |
|
||||
* @param string $name |
|
||||
* @param string $value |
|
||||
* @param array $attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function hidden($name, $value, array $attributes = array()) |
|
||||
{ |
|
||||
$attributes = array_merge(array( |
|
||||
'id' => static::autoId($name), |
|
||||
'name' => $name, |
|
||||
'type' => 'hidden', |
|
||||
'value' => $value, |
|
||||
), $attributes); |
|
||||
|
|
||||
return self::tag('input', $attributes); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a textarea |
|
||||
* |
|
||||
* @param string $name |
|
||||
* @param string $text |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function textArea($name, $text = null, array $attributes = array()) |
|
||||
{ |
|
||||
$attributes = array_merge(array( |
|
||||
'id' => static::autoId($name), |
|
||||
'name' => $name, |
|
||||
), $attributes); |
|
||||
|
|
||||
return self::tag('textarea', $attributes, (string)$text); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a check box. |
|
||||
* By default creates a hidden field with the value of 0, so that the field is present in $_POST even when not checked |
|
||||
* |
|
||||
* @param string $name |
|
||||
* @param bool $checked |
|
||||
* @param mixed $value Checked value |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @param bool|string $withHiddenField Pass false to omit the hidden field or "array" to return both parts as an array |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function checkBox( |
|
||||
$name, |
|
||||
$checked = false, |
|
||||
$value = 1, |
|
||||
array $attributes = array(), |
|
||||
$withHiddenField = true |
|
||||
) { |
|
||||
$auto_id = static::autoId($name); |
|
||||
|
|
||||
$checkboxAttributes = array_merge(array( |
|
||||
'name' => $name, |
|
||||
'type' => 'checkbox', |
|
||||
'value' => $value, |
|
||||
'id' => $auto_id, |
|
||||
'checked' => (bool)$checked, |
|
||||
), $attributes); |
|
||||
$checkbox = self::tag('input', $checkboxAttributes); |
|
||||
|
|
||||
if ($withHiddenField === false) { |
|
||||
return $checkbox; |
|
||||
} |
|
||||
|
|
||||
$hiddenAttributes = array( |
|
||||
'name' => $name, |
|
||||
'type' => 'hidden', |
|
||||
'value' => 0, |
|
||||
'id' => $auto_id . '-hidden', |
|
||||
); |
|
||||
$hidden = self::tag('input', $hiddenAttributes); |
|
||||
|
|
||||
return $withHiddenField === 'array' |
|
||||
? array($hidden, $checkbox) |
|
||||
: $hidden . $checkbox; |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates multiple checkboxes for a has-many association. |
|
||||
* |
|
||||
* @param string $name |
|
||||
* @param array $collection |
|
||||
* @param array|\Traversable $checked Collection of checked values |
|
||||
* @param array $labelAttributes |
|
||||
* @param bool $returnAsArray |
|
||||
* @throws \InvalidArgumentException |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function collectionCheckBoxes($name, array $collection, $checked, array $labelAttributes = array(), $returnAsArray = false) |
|
||||
{ |
|
||||
// TODO: Does this check cover all options? |
|
||||
if (!(is_array($checked) || $checked instanceof \Traversable)) { |
|
||||
throw new \InvalidArgumentException("$name must be an array or Traversable!"); |
|
||||
} |
|
||||
|
|
||||
$checkBoxes = array(); |
|
||||
foreach ($collection as $value => $label) { |
|
||||
$checkBoxes[] = self::tag( |
|
||||
'label', |
|
||||
$labelAttributes, |
|
||||
FormHelper::checkBox("{$name}[]", in_array($value, $checked, true), $value, array(), false) . self::escape($label), |
|
||||
false |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
return $returnAsArray ? $checkBoxes : implode('', $checkBoxes); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a radio button |
|
||||
* |
|
||||
* @static |
|
||||
* @param string $name |
|
||||
* @param string $value |
|
||||
* @param bool $checked |
|
||||
* @param array $attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function radio($name, $value, $checked = false, array $attributes = array()) |
|
||||
{ |
|
||||
$attributes = array_merge(array( |
|
||||
'type' => 'radio', |
|
||||
'name' => $name, |
|
||||
'value' => $value, |
|
||||
'checked' => (bool)$checked, |
|
||||
), $attributes); |
|
||||
|
|
||||
return self::tag('input', $attributes); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates multiple radio buttons with labels |
|
||||
* |
|
||||
* @static |
|
||||
* @param string $name |
|
||||
* @param array $collection |
|
||||
* @param mixed $checked Checked value |
|
||||
* @param array $labelAttributes |
|
||||
* @param bool $returnAsArray |
|
||||
* @return array|string |
|
||||
*/ |
|
||||
public static function collectionRadios($name, array $collection, $checked, array $labelAttributes = array(), $returnAsArray = false) |
|
||||
{ |
|
||||
$radioButtons = array(); |
|
||||
foreach ($collection as $value => $label) { |
|
||||
$radioButtons[] = self::tag( |
|
||||
'label', |
|
||||
$labelAttributes, |
|
||||
FormHelper::radio($name, $value, $value === $checked) . self::escape($label), |
|
||||
false |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
return $returnAsArray ? $radioButtons : implode('', $radioButtons); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates a select tag |
|
||||
* <code> |
|
||||
* // Simple select |
|
||||
* select('coffee_id', array('b' => 'black', 'w' => 'white')); |
|
||||
* |
|
||||
* With option groups |
|
||||
* select('beverage', array( |
|
||||
* 'Coffee' => array('bc' => 'black', 'wc' => 'white'), |
|
||||
* 'Tea' => array('gt' => 'Green', 'bt' => 'Black'), |
|
||||
* )); |
|
||||
* </code> |
|
||||
* |
|
||||
* @param string $name Name of the attribute |
|
||||
* @param array $collection An associative array used for the option values |
|
||||
* @param mixed $selected Selected option Can be array or scalar |
|
||||
* @param array $attributes HTML attributes |
|
||||
* @return string |
|
||||
*/ |
|
||||
public static function select($name, array $collection, $selected = null, array $attributes = array()) |
|
||||
{ |
|
||||
$attributes = array_merge(array( |
|
||||
'name' => $name, |
|
||||
'id' => static::autoId($name), |
|
||||
'multiple' => false, |
|
||||
), $attributes); |
|
||||
|
|
||||
if (is_string($selected) || is_numeric($selected)) { |
|
||||
$selected = array($selected => 1); |
|
||||
} else if (is_array($selected)) { |
|
||||
$selected = array_flip($selected); |
|
||||
} else { |
|
||||
$selected = array(); |
|
||||
} |
|
||||
|
|
||||
$content = self::option('', '', $selected); |
|
||||
foreach ($collection as $value => $element) { |
|
||||
// Element is an optgroup |
|
||||
$content .= self::option($element['value'], $element['label'], $selected); |
|
||||
} |
|
||||
|
|
||||
return self::tag('select', $attributes, $content, false); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* Creates an option tag |
|
||||
* |
|
||||
* @param string $value |
|
||||
* @param string $label |
|
||||
* @param array $selected |
|
||||
* @return string |
|
||||
*/ |
|
||||
private static function option($value, $label, $selected) |
|
||||
{ |
|
||||
// Special handling of option tag contents to enable indentation with |
|
||||
//$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>"; |
|
||||
} |
|
||||
} |
|
@ -1,324 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
|
|
||||
require_once '../../workflow/lib/DB.php'; |
|
||||
class MICalculator |
|
||||
{ |
|
||||
/** |
|
||||
* 計算MI |
|
||||
* |
|
||||
* @param array $param |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function cal(array $param) |
|
||||
{ |
|
||||
$elevator_type = $param['elevator_type']; |
|
||||
$func = $elevator_type . "_price"; |
|
||||
if (method_exists($this, $elevator_type . "_price")) { |
|
||||
|
|
||||
return call_user_func([$this, $func], $param); |
|
||||
} |
|
||||
return self::error(); |
|
||||
} |
|
||||
/** |
|
||||
* 客梯報價 maintain_kind='A' |
|
||||
* 1.每月2次保養價格*1.25倍 |
|
||||
* 2.全包價格按半包價+1500元/臺 |
|
||||
* 3.簽5年長約免費送M1係統的+2600元/臺" |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function A_price(array $item) |
|
||||
{ |
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_mi_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['speed'] . " between min_speed and max_speed |
|
||||
and " . $item['persons'] . " between min_persons and max_persons |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
|
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 貨梯報價 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function B_price($item) |
|
||||
{ |
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_mi_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['weight'] . " between min_weight and max_weight |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
/** |
|
||||
* 病床梯報價 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function C_price($item) |
|
||||
{ |
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_mi_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['weight'] . " between min_weight and max_weight |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 無機房報價 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function D_price($item) |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_mi_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['persons'] . " between min_persons and max_persons |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
/** |
|
||||
*家用梯報價 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function E_price(array $item) |
|
||||
{ |
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_mi_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['persons'] . " between min_persons and max_persons |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_period= " . $item['maintain_period'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
// echo $sql_get_price; |
|
||||
|
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
public function error() |
|
||||
{ |
|
||||
return [ |
|
||||
'status' => 'fail', |
|
||||
'message' => '無此項目,請聯係業務部創建MI' |
|
||||
]; |
|
||||
} |
|
||||
public function success($price) |
|
||||
{ |
|
||||
return [ |
|
||||
'status' => 'ok', |
|
||||
'price' => $price |
|
||||
]; |
|
||||
} |
|
||||
} |
|
@ -1,322 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
|
|
||||
require_once '../../workflow/lib/DB.php'; |
|
||||
class MSCalculator |
|
||||
{ |
|
||||
/** |
|
||||
* 計算报价 |
|
||||
* |
|
||||
* @param array $param |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function cal(array $param) |
|
||||
{ |
|
||||
$elevator_type = $param['elevator_type']; |
|
||||
$func = $elevator_type . "_price"; |
|
||||
if (method_exists($this, $elevator_type . "_price")) { |
|
||||
|
|
||||
return call_user_func([$this, $func], $param); |
|
||||
} |
|
||||
return self::error(); |
|
||||
} |
|
||||
/** |
|
||||
* 客梯成本maintain_kind='A' |
|
||||
* 1.每月2次保養價格*1.25倍 |
|
||||
* 2.全包價格按半包價+1500元/臺 |
|
||||
* 3.簽5年長約免費送M1係統的+2600元/臺" |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function A_price(array $item) |
|
||||
{ |
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
SELECT |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_standard_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['speed'] . " between min_speed and max_speed |
|
||||
and " . $item['persons'] . " between min_persons and max_persons |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
|
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 貨梯成本 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function B_price($item) |
|
||||
{ |
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_standard_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['weight'] . " between min_weight and max_weight |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
/** |
|
||||
* 病床梯成本 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function C_price($item) |
|
||||
{ |
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_standard_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['weight'] . " between min_weight and max_weight |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 無機房成本 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function D_price($item) |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_standard_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['persons'] . " between min_persons and max_persons |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_months= " . $item['maintain_months'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
/** |
|
||||
*家用梯成本 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
|
|
||||
public function E_price(array $item) |
|
||||
{ |
|
||||
|
|
||||
$floors = $item['floors']; |
|
||||
$maintain_times = $item['maintain_times']; |
|
||||
|
|
||||
$sql_get_price = " |
|
||||
select |
|
||||
elevator_type, |
|
||||
base_price, |
|
||||
floors_price, |
|
||||
min_floors, |
|
||||
min_maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_kind, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
all_inclusive_fee, |
|
||||
maintenance_fee_coefficient, |
|
||||
m1_bundle_fee |
|
||||
from maintain_standard_option where |
|
||||
elevator_type='" . $item['elevator_type'] . "' |
|
||||
and " . $item['floors'] . " between min_floors and max_floors |
|
||||
and " . $item['persons'] . " between min_persons and max_persons |
|
||||
and " . $item['maintain_times'] . " between min_maintain_times and max_maintain_times |
|
||||
and maintain_period= " . $item['maintain_period'] . " |
|
||||
and maintain_kind='" . $item['maintain_kind'] . "' |
|
||||
and is_m1_bundle='" . $item['is_m1_bundle'] . "' |
|
||||
"; |
|
||||
list($row) = DB::result($sql_get_price); |
|
||||
if (empty($row)) return self::error(); |
|
||||
#1基礎價格 |
|
||||
$floors = $item['floors'] - $row['min_floors']; |
|
||||
$price1 = $row['base_price'] + ($floors) * $row['floors_price']; |
|
||||
// echo $price1; |
|
||||
#判斷是否全包 |
|
||||
$price2 = $row['maintain_kind'] == 3 ? $price1 + $row['all_inclusive_fee'] : $price1; |
|
||||
// echo $price2; |
|
||||
#判斷是否五年M1套餐 |
|
||||
$price3 = $row['is_m1_bundle'] == 'Y' ? $price2 + $row['m1_bundle_fee'] : $price2; |
|
||||
// echo $price3; |
|
||||
if ($maintain_times - $row['min_maintain_times'] < 1) return self::success($price3); |
|
||||
#判斷是否增加保養次數 用戶輸入的保養次數大於min_maintain_times |
|
||||
$price4 = $price3; |
|
||||
for ($i = 0; $i < $maintain_times - $row['min_maintain_times']; $i++) { |
|
||||
|
|
||||
$price4 = $price4 + $price3 * $row['maintenance_fee_coefficient']; |
|
||||
} |
|
||||
return self::success($price4); |
|
||||
} |
|
||||
public function error() |
|
||||
{ |
|
||||
return [ |
|
||||
'status' => 'fail', |
|
||||
'message' => '無此項目,請聯係業務部創建標準成本' |
|
||||
]; |
|
||||
} |
|
||||
public function success($price) |
|
||||
{ |
|
||||
return [ |
|
||||
'status' => 'ok', |
|
||||
'price' => $price |
|
||||
]; |
|
||||
} |
|
||||
} |
|
@ -1,22 +0,0 @@ |
|||||
<?php |
|
||||
|
|
||||
/** |
|
||||
* 发起流程 |
|
||||
*/ |
|
||||
error_reporting(E_ALL); |
|
||||
ini_set("display_errors", "on"); |
|
||||
require_once "./wf_common.php"; |
|
||||
require_once "../database.php"; |
|
||||
#系统ID |
|
||||
$system_id = 'psm'; |
|
||||
#流程ID |
|
||||
$flow_id = 'psm01'; |
|
||||
|
|
||||
#表单号 $form_id; |
|
||||
$form_id = ""; |
|
||||
$wf = new WorkFlow($system_id, $flow_id, $form_id); |
|
||||
$wf->initWorkFlow(ID); |
|
||||
|
|
||||
//加载视图 |
|
||||
|
|
||||
echo '<a href="https://www.masada.com.tw/wms/sign/list.php">查看全部待签</a>'; |
|
@ -1,859 +0,0 @@ |
|||||
<?php |
|
||||
require_once '../header_nomenu.php'; |
|
||||
require_once './FormHelper.php'; |
|
||||
require_once './wf_common.php'; |
|
||||
// require_once('./conn.php'); |
|
||||
|
|
||||
$vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no']; |
|
||||
|
|
||||
|
|
||||
/*** |
|
||||
* 检查是否重复生成价审单 |
|
||||
* con_maintance_examine_apply |
|
||||
*/ |
|
||||
/* |
|
||||
list($cnt)=DB::fields("select count(*) cnt from con_maintance_examine_apply where vol_no='$vol_no'"); |
|
||||
if($cnt>0) { |
|
||||
echo"<script>alert('卷號".$vol_no."已生成價審單,請勿重複生成!');history.go(-1);</script>"; |
|
||||
exit; |
|
||||
} |
|
||||
*/ |
|
||||
|
|
||||
#係統ID |
|
||||
$system_id = 'con'; |
|
||||
#流程ID |
|
||||
$flow_id = 'con01'; |
|
||||
#表單號 $form_id; |
|
||||
$form_id = ""; |
|
||||
#價審單狀態 |
|
||||
$apply_st = ""; |
|
||||
list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1"); |
|
||||
// echo '<pre>'; |
|
||||
// print_r($apply_key); |
|
||||
// echo '</pre>'; |
|
||||
// exit; |
|
||||
// if ($salesman != $user_id) { |
|
||||
// echo '<script>alert("您並不是該單營業員,無法訪問。");history.go(-1);</script>'; |
|
||||
// exit; |
|
||||
// } |
|
||||
if (empty($apply_key)) $apply_st = 1; // 準備新增 |
|
||||
else { |
|
||||
//list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); |
|
||||
list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); |
|
||||
if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 |
|
||||
else $apply_st = 9; // 已到下一關,無法䖺改 |
|
||||
} |
|
||||
|
|
||||
// if ($apply_st > 2) { |
|
||||
// echo "<script>alert('卷號" . $vol_no . "已生成價審單,請勿重複生成!');history.go(-1);</script>"; |
|
||||
// exit; |
|
||||
// } |
|
||||
|
|
||||
if ($apply_st == 1) { |
|
||||
$wf = new WorkFlow($system_id, $flow_id, $form_id); |
|
||||
$wf->initWorkFlow($user_id); |
|
||||
$form_key = $wf->flowContext->getFormKey(); |
|
||||
} else { |
|
||||
$wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); |
|
||||
} |
|
||||
|
|
||||
#獲取簽核意見 |
|
||||
$assign_opinions = Assign::get_records($form_key); |
|
||||
|
|
||||
#會簽部門意見 |
|
||||
$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); |
|
||||
|
|
||||
//預設冇有摺扣 |
|
||||
$wf->setFormData(['discount' => 100]); |
|
||||
$flowName = $wf->getFlowName(); |
|
||||
$assigner = $wf->getAssignerList(); |
|
||||
$assign_status = $wf->getAssignStatus($assigner); |
|
||||
|
|
||||
$if_show_assign = true; |
|
||||
//加載流程圖 |
|
||||
//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); |
|
||||
//$path = $fc[0]->wf_file; |
|
||||
//echo dirname(__DIR__)."/../"."$path"; |
|
||||
|
|
||||
//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); |
|
||||
#是否可會簽 |
|
||||
$isSplitable = $wf->isSplitable(); |
|
||||
|
|
||||
//表單數據 |
|
||||
#客戶表 |
|
||||
#1.電梯品牌選項 |
|
||||
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='elevator_brand' order by code_name asc "; |
|
||||
$elevator_brand_opt = DB::result($sql); |
|
||||
#2.保養方式 |
|
||||
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='maintain_kind'"; |
|
||||
$maintain_kind_opt = DB::result($sql); |
|
||||
#3.電梯類型 |
|
||||
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='maintain_elevator_kind'"; |
|
||||
$elevator_kind_opt = DB::result($sql); |
|
||||
#4.付款方式 |
|
||||
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='payment_kind' order by code_name+ 0 asc"; |
|
||||
$payment_kind_opt = DB::result($sql); |
|
||||
#5.契約性質 |
|
||||
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='contract_kind'"; |
|
||||
$contract_kind_opt = DB::result($sql); |
|
||||
#6.是否贈送M1 |
|
||||
$is_m1_bundle_opt = [ |
|
||||
['label' => '是', 'value' => 'Y'], |
|
||||
['label' => '否', 'value' => 'N'] |
|
||||
|
|
||||
]; |
|
||||
#7.機種 |
|
||||
$sql = "SELECT code_name value ,content label FROM code WHERE field_name='fp_kind'"; |
|
||||
$fp_kind_opt = DB::result($sql); |
|
||||
#抓取有望客戶資料 |
|
||||
|
|
||||
|
|
||||
$vol_no = $_GET['vol_no']; |
|
||||
$where = " and vol_no='$vol_no'"; |
|
||||
$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; |
|
||||
// print_r($sql); |
|
||||
$hope_contract = DB::result($sql); |
|
||||
$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; |
|
||||
#寫入 con_maintance_examine_apply |
|
||||
if ($apply_st == 1) { |
|
||||
#獲取評審單號 |
|
||||
$apply_key = get_sequnece_no('cmea_apply_key', date('ym')); |
|
||||
//var_dump($hope_contract); |
|
||||
$insert_data = [ |
|
||||
'apply_key' => $apply_key, |
|
||||
'vol_no' => $vol_no, |
|
||||
'form_key' => $form_key, |
|
||||
'address' => $hope_contract['address'], |
|
||||
'case_name' => $hope_contract['customer'], |
|
||||
'num' => $hope_contract['num'], |
|
||||
'brand' => '', |
|
||||
'customer' => $hope_contract['customer'], |
|
||||
'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], |
|
||||
'progress_remark' => $hope_contract['progress_status'] |
|
||||
//'platform_company'=>'', |
|
||||
// 'platforom_company_tel'=> '' |
|
||||
|
|
||||
]; |
|
||||
//var_dump($insert_data); |
|
||||
DB::insert_table('con_maintance_examine_apply', $insert_data); |
|
||||
} |
|
||||
|
|
||||
$table = 'con_maintance_examine_apply'; |
|
||||
#可編輯的列 |
|
||||
$editableColumn = [ |
|
||||
'apply_key' => [ |
|
||||
'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', |
|
||||
'attr' => [ |
|
||||
'readonly=true ', |
|
||||
'class' => 'form-control form-control-sm' |
|
||||
] |
|
||||
], |
|
||||
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
|
||||
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], |
|
||||
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], |
|
||||
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], |
|
||||
'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
|
||||
|
|
||||
]; |
|
||||
$where = " and apply_key='$apply_key'"; |
|
||||
|
|
||||
$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; |
|
||||
$data = []; |
|
||||
$data = DB::result($sql); |
|
||||
|
|
||||
#電梯詳細資料 |
|
||||
$con_maintance_examine_clear_columm = [ |
|
||||
'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], |
|
||||
'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], |
|
||||
'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], |
|
||||
'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], |
|
||||
'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
|
||||
'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], |
|
||||
'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], |
|
||||
|
|
||||
'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], |
|
||||
'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'placeholder' => '契約成交價', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
]; |
|
||||
$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . |
|
||||
" FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); |
|
||||
|
|
||||
$j = 0; |
|
||||
$col_count = 12; |
|
||||
$cmecRow = " <tr>"; |
|
||||
foreach ($con_maintance_examine_clear_columm as $key => $val) { |
|
||||
$fieldVal = ""; |
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select('', $val['options'], $fieldVal, $val['attr']) |
|
||||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|
||||
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>"; |
|
||||
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>"; |
|
||||
if ((++$j % $col_count) == 0) { |
|
||||
if ($j == $col_count) $cmecRow .= "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>"; |
|
||||
$cmecRow .= "</tr><tr>"; |
|
||||
} |
|
||||
} |
|
||||
$cmecRow .= "</tr>"; |
|
||||
function base_url($url) |
|
||||
{ |
|
||||
return "https://www.masada.com.tw/static/" . $url; |
|
||||
} |
|
||||
function get_sequnece_no($seq_name = '', $p_yyyymm = '') |
|
||||
{ |
|
||||
|
|
||||
if (empty($p_yyyymm) || empty($seq_name)) return null; |
|
||||
#當前年月 |
|
||||
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); |
|
||||
if ($p_yyyymm != $yyyymm) { |
|
||||
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); |
|
||||
} |
|
||||
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; |
|
||||
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); |
|
||||
|
|
||||
|
|
||||
return $seq_no; |
|
||||
} |
|
||||
$sql = "SELECT * FROM account WHERE accountid = '$user_id' "; |
|
||||
list($result) = DB::result($sql); |
|
||||
if ($result['department_id'] == '511') { |
|
||||
$managerid = 'M0137'; |
|
||||
$managername = '劉永德'; |
|
||||
} else if ($result['department_id'] == '512') { |
|
||||
$managerid = 'M0054'; |
|
||||
$managername = '陳志文'; |
|
||||
} else if ($result['department_id'] == '513') { |
|
||||
$managerid = 'M0086'; |
|
||||
$managername = '李烘銘'; |
|
||||
} else if ($result['department_id'] == '514') { |
|
||||
$managerid = 'M0033'; |
|
||||
$managername = '吳育宗'; |
|
||||
} else if ($user_id == 'TEST01') { |
|
||||
$managerid = 'TEST04'; |
|
||||
$managername = '區經理'; |
|
||||
} |
|
||||
|
|
||||
if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') { |
|
||||
$managerid = 'M0008'; |
|
||||
$managername = '詹益彰'; |
|
||||
} |
|
||||
|
|
||||
?> |
|
||||
<style> |
|
||||
button.disabled { |
|
||||
cursor: not-allowed; |
|
||||
background: #555; |
|
||||
} |
|
||||
</style> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100); ?>" /> |
|
||||
<script type="text/javascript"> |
|
||||
window.param = { |
|
||||
elevator_type: '', |
|
||||
floors: 1, |
|
||||
speed: 1, |
|
||||
persons: 6, |
|
||||
weight: 1000, |
|
||||
maintain_times: 1, //病床梯一月2次保養 |
|
||||
maintain_months: 12, |
|
||||
maintain_kind: 2, |
|
||||
maintain_period: 1, //預設為1月1次, 2是為2月一次 |
|
||||
is_m1_bundle: 'N', |
|
||||
}; |
|
||||
|
|
||||
let regDelStr = ""; |
|
||||
|
|
||||
$(document).ready(function() { |
|
||||
var tag_data; |
|
||||
$.ajax({ |
|
||||
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner', |
|
||||
//url: 'http://localhost/fds/index.php/DesignFlow/get_assigner', |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
window.tag_data = data; |
|
||||
$('#selectPage').selectPage({ |
|
||||
showField: 'show_name', |
|
||||
keyField: 'val', |
|
||||
data: data, |
|
||||
multiple: true, |
|
||||
multipleControlbar: true, |
|
||||
pagination: false, |
|
||||
focusDropList: false |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
$.validator.addMethod('gt', function(value, element, param) { |
|
||||
return value > param; |
|
||||
}, $.validator.format("輸入值必須大於0")); |
|
||||
var assigner = eval('<?= json_encode($assigner) ?>'); |
|
||||
//console.log(assigner); |
|
||||
|
|
||||
var cmecRow = "<?= str_replace('"', '\'', $cmecRow) ?>"; |
|
||||
// $('#cmecTbody').append(cmecRow); |
|
||||
$('.sp_element_box').attr("disabled", true); |
|
||||
$("#assign_opinion").cleditor({ |
|
||||
height: 100, // height not including margins, borders or padding |
|
||||
controls: // controls to add to the toolbar |
|
||||
"bold italic underline strikethrough subscript superscript | font size " + |
|
||||
"style | color highlight removeformat | bullets numbering | outdent " + |
|
||||
"indent | alignleft center alignright justify | undo redo | " |
|
||||
}); |
|
||||
|
|
||||
$('#contract_begin_date').on('input propertychange', function(e) { |
|
||||
|
|
||||
var date = new Date(e.target.value); |
|
||||
var yyyy = date.getFullYear() + 1; |
|
||||
var mm = date.getMonth() + 1; |
|
||||
var dd = date.getDate(); |
|
||||
var time = yyyy + `-` + (mm < 10 ? '0' + mm : mm) + '-' + (dd < 10 ? '0' + dd : dd); |
|
||||
$('#contract_end_date').val(time); |
|
||||
}); |
|
||||
|
|
||||
$('#brand').change(function() { |
|
||||
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
|
||||
if (_selected_status == 'Z') { |
|
||||
$('#brandModal').modal('show') |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
$('#assign_status').change(function() { |
|
||||
$("#next_users").empty(); |
|
||||
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
|
||||
var _option_tmp = ""; //獲取下拉列表 |
|
||||
// for (a in assigner) { //遍曆assigner |
|
||||
// if (assigner[a][0] == _selected_status) { |
|
||||
// _tmp = assigner[a][1].split(','); |
|
||||
// for (var b in _tmp) { |
|
||||
// if (_tmp[b] == '') { |
|
||||
// continue; |
|
||||
// } |
|
||||
// _uname = _tmp[b].split('-')[1]; |
|
||||
// _uid = _tmp[b].split('-')[0]; |
|
||||
// /* console.log(_tmp[b]);*/ |
|
||||
// _option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>'; |
|
||||
// } |
|
||||
// } |
|
||||
// } |
|
||||
_option_tmp = '<option value=' + '<?php echo $managerid ?>' + '>' + '<?php echo $managername ?>' + '</option>'; |
|
||||
$("#next_users").append(_option_tmp); |
|
||||
}); |
|
||||
$('#maintain_kind').change(function() { |
|
||||
if ($('#cmecTbody tr').length > 0) { |
|
||||
alert("保養方式已更動,請開始輸入電梯資料!"); |
|
||||
$('#cmecTbody').find(':input').val(''); |
|
||||
return false; |
|
||||
} |
|
||||
}); |
|
||||
$("#form").validate(); |
|
||||
$("form").submit(function(e) { |
|
||||
$('#reg_del').val(regDelStr); |
|
||||
}); |
|
||||
}); |
|
||||
const addRow = function() { |
|
||||
if ($('#maintain_kind').val() == "") { |
|
||||
alert("請選擇保養方式!"); |
|
||||
$('#maintain_kind').eq(0).focus(); |
|
||||
return false; |
|
||||
} |
|
||||
var cmecRow = "<?= $cmecRow ?>"; |
|
||||
$('#cmecTbody').append(cmecRow); |
|
||||
$("select[name^='elevator_kind'],select[name^='is_m1_bundle']").on('change', function(obj) { |
|
||||
//console.log('#'+$(this).attr('name')+'#'); |
|
||||
var elen = 1; |
|
||||
if ('elevator_kind[]' == $(this).attr('name')) { |
|
||||
var children = $(this).parent().parent().parent(); |
|
||||
var elementObj = $(children).next('tr').find("input[name^='stand_price']"); |
|
||||
//var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
|
||||
} else if ('is_m1_bundle[]' == $(this).attr('name')) { |
|
||||
var children = $(this).parent().parent().parent().prev('tr'); |
|
||||
var elementObj = $(this).parent().parent().parent().find("input[name^='stand_price']"); |
|
||||
//var is_m1_bundle = $(this).val(); |
|
||||
} |
|
||||
|
|
||||
var element = elementObj; |
|
||||
if ('elevator_kind[]' == $(this).attr('name')) { |
|
||||
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
|
||||
} else if ('is_m1_bundle[]' == $(this).attr('name')) { |
|
||||
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle']").val(); |
|
||||
} |
|
||||
|
|
||||
var floors = $(children).find("input[name^='floors']").val(); |
|
||||
var speed = $(children).find("input[name^='speed']").val(); |
|
||||
var weight = $(children).find("input[name^='weight']").val(); |
|
||||
var persons = $(children).find("input[name^='persons']").val(); |
|
||||
var maintain_times = $(children).find("input[name^='maintain_times']").val(); |
|
||||
var maintain_months = $(children).find("input[name^='maintain_months']").val(); |
|
||||
var maintain_period = $(children).find("input[name^='maintain_period']").val(); |
|
||||
var maintain_kind = $('#maintain_kind').val(); |
|
||||
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val(); |
|
||||
|
|
||||
var param1 = { |
|
||||
...param, |
|
||||
persons, |
|
||||
floors, |
|
||||
speed, |
|
||||
weight, |
|
||||
maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_period, |
|
||||
maintain_kind, |
|
||||
elevator_type, |
|
||||
is_m1_bundle |
|
||||
} |
|
||||
setStandPrice(param1, element); |
|
||||
// console.log(param1); |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
$("input[name^='floors']" + |
|
||||
",input[name^='speed']" + |
|
||||
",input[name^='persons']" + |
|
||||
",input[name^='weight']" + |
|
||||
",input[name^='maintain_times']" + |
|
||||
",input[name^='maintain_months']" + |
|
||||
",input[name^='maintain_period']" |
|
||||
).on('input propertychange', function(obj) { |
|
||||
// $(obj).parent().parent().parent().remove(); |
|
||||
var children = $(this).parent().parent().parent().children(); |
|
||||
var floors = $(children).find("input[name^='floors']").val(); |
|
||||
var speed = $(children).find("input[name^='speed']").val(); |
|
||||
var weight = $(children).find("input[name^='weight']").val(); |
|
||||
var persons = $(children).find("input[name^='persons']").val(); |
|
||||
var maintain_times = $(children).find("input[name^='maintain_times']").val(); |
|
||||
var maintain_months = $(children).find("input[name^='maintain_months']").val(); |
|
||||
var maintain_period = $(children).find("input[name^='maintain_period']").val(); |
|
||||
var maintain_kind = $('#maintain_kind').val(); |
|
||||
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val(); |
|
||||
var is_m1_bundle = $(this).parent().parent().parent().next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
|
||||
|
|
||||
var param1 = { |
|
||||
...param, |
|
||||
persons, |
|
||||
floors, |
|
||||
speed, |
|
||||
weight, |
|
||||
maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_period, |
|
||||
maintain_kind, |
|
||||
elevator_type, |
|
||||
is_m1_bundle |
|
||||
} |
|
||||
var element = $(this).parent().parent().parent().next().children().find("input[name^='stand_price']"); |
|
||||
setStandPrice(param1, element); |
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
const delRow = function(btn) { |
|
||||
if ($(btn).attr('name') == 'btn1') { |
|
||||
//console.log($(btn).parent().parent().prev('tr').find('input[id=register_code]').val()); |
|
||||
regDelStr += $(btn).parent().parent().find('input[id=register_code]').val() + ","; |
|
||||
$(btn).parent().parent().next('tr').remove(); |
|
||||
} else { |
|
||||
//console.log($(btn).parent().parent().find('input[id=register_code]').val()); |
|
||||
$(btn).parent().parent().next('tr').remove(); |
|
||||
$(btn).parent().parent().remove(); |
|
||||
} |
|
||||
$(btn).parent().parent().remove(); |
|
||||
} |
|
||||
const setStandPrice = function(p, obj) { |
|
||||
$.ajax({ |
|
||||
url: '../cont/t.php', |
|
||||
data: p, |
|
||||
type: 'get', |
|
||||
dataType: 'json', |
|
||||
//success: function(data) {}, |
|
||||
success: function(data) { |
|
||||
console.log(data.price); |
|
||||
if (data.status == 'ok') { |
|
||||
$(obj).val(data.price); |
|
||||
} else { |
|
||||
$(obj).val(data.message); |
|
||||
} |
|
||||
if (data.message == '無此項目,請聯係業務部創建標準成本') { |
|
||||
console.log('1'); |
|
||||
// $("button[name^=btn_save]").attr('disabled', true); |
|
||||
// $("button[name^=btn_save]").css('cursor', 'not-allowed') |
|
||||
$("#submit").css('background-color', '#666') |
|
||||
document.querySelector('#submit').classList.add('disabled') |
|
||||
document.querySelector('#submit').disabled = true |
|
||||
} |
|
||||
if (data.price) { |
|
||||
document.querySelector('#submit').classList.remove('disabled') |
|
||||
document.querySelector('#submit').disabled = false |
|
||||
$("#submit").css('background-color', '#007bff') |
|
||||
// $("button[name^=btn_save]").attr('disabled', false); |
|
||||
// $("button[name^=btn_save]").css('cursor', 'default') |
|
||||
// $("button[name^=btn_save]").css('background-color', '#666') |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
|
|
||||
} |
|
||||
const addNewBrand = function() { |
|
||||
var new_brand = $("#new_brand").val(); |
|
||||
if (new_brand != '') { |
|
||||
p = { |
|
||||
new_brand: new_brand, |
|
||||
method: 'add_brand' |
|
||||
} |
|
||||
$.ajax({ |
|
||||
url: 'async_req.php', |
|
||||
data: p, |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
// console.info(data); |
|
||||
$("#brand").append("<option value='" + data.seq + "'>" + new_brand + "</option>"); |
|
||||
}, |
|
||||
error: function(data) { |
|
||||
// console.info(data); |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
$("input[name^='stand_price']").bind('input propertychang', function() { |
|
||||
if ($("input[name^='stand_price']").val() == '') { |
|
||||
console.log('無值'); |
|
||||
$("button[name^=btn_save]").attr('disabled', true); |
|
||||
} |
|
||||
}); |
|
||||
</script> |
|
||||
|
|
||||
|
|
||||
<body> |
|
||||
|
|
||||
<div id="toolbarmenu"> |
|
||||
<!--<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span>--> |
|
||||
<!-- 導航欄 --> |
|
||||
|
|
||||
<ul class="nav nav-tabs" role="tablist" id="tablist"> |
|
||||
<li class=" nav-item "> |
|
||||
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">簽核表單</a> |
|
||||
</li> |
|
||||
|
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<!-- 導航欄 END--> |
|
||||
<div class="tab-content "> |
|
||||
|
|
||||
<div class="tab-pane active assign_content " id="tabassign"> |
|
||||
<form action="submit.php" id='form' method="post" style='width:98%;margin:0 auto'> |
|
||||
<!-- hidden域 --> |
|
||||
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' /> |
|
||||
<input type="hidden" name="token" value='<?= $_GET['token'] ?>' /> |
|
||||
<input type="hidden" name="reg_del" id="reg_del"> |
|
||||
<input type="hidden" name="form_src" id="form_src" value="apply_form"> |
|
||||
<!--表單start--> |
|
||||
<div class=" form container-fluid pt-5"> |
|
||||
<div class="row form_head "> |
|
||||
<div class=" col-12 form_head_title "> |
|
||||
<h4> 保養契約價格審核單</h4> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="row " style='padding-top:30px;'> |
|
||||
<div class=" col-lg-12 form_row_header "> |
|
||||
<b>契約信息</b> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<?php |
|
||||
//一行顯示三列 |
|
||||
$i = 0; |
|
||||
echo " <div class='row '>"; |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
$j = (($i++) % 4); |
|
||||
$fieldVal = empty($data) ? "" : $data[0][$key]; |
|
||||
|
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) |
|
||||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|
||||
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "' |
|
||||
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>"; |
|
||||
if ($i != 1 && $j == 0) { |
|
||||
echo " |
|
||||
</div> |
|
||||
<div class='row'> |
|
||||
"; |
|
||||
} |
|
||||
echo " <div class='col-1 form_field_title'> |
|
||||
" . $val['label'] . " |
|
||||
</div> |
|
||||
<div class=' col-2 form_field_content ' > |
|
||||
$_input |
|
||||
</div> |
|
||||
"; |
|
||||
} |
|
||||
echo "</div>"; |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>洽商進度</b> |
|
||||
</div> |
|
||||
<div class="col-12 " style="padding:0"> |
|
||||
|
|
||||
<textarea class='form-control textarea' id="progress_remark" name="progress_remark" value='12' rows='6'><?= $hope_contract['progress_status'] ?></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div id="elevator_list_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>電梯詳細資料</b> |
|
||||
</div> |
|
||||
<table style='margin-top:0px;text-align:center' class=' table-condensed' id='elevator_list'> |
|
||||
|
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan='18' style='text-align:left;font-size:13px'> |
|
||||
<b>註意事項:</b> |
|
||||
<p>1.速度單位是 米/分.</p> |
|
||||
<p>2.選擇贈送M1,保養月數需填寫60.</p> |
|
||||
<p>3.標準價格未帶出,請聯係業務部建立該規格報價.</p> |
|
||||
<p>4.無機房速度20~60米 以60米為標準.</p> |
|
||||
|
|
||||
|
|
||||
</td> |
|
||||
</tr> |
|
||||
<tr> |
|
||||
<td colspan='18'><button onClick='addRow()' type="button" style='float:right' class="btn btn-link btn-md">+新增</button></td> |
|
||||
</tr> |
|
||||
<!-- <tr style='margin-top:0px;text-align:center'> --> |
|
||||
<?php |
|
||||
$j = 0; |
|
||||
echo "<tr style='margin-top:0px;text-align:center'>"; |
|
||||
|
|
||||
$i = 0; |
|
||||
$cmecRow = '<tr>'; |
|
||||
foreach ($con_maintance_examine_clear_columm as $col => $col_def) { |
|
||||
echo FormHelper::tag("th", ['colspan' => empty($col_def['attr']['colspan']) ? 1 : $col_def['attr']['colspan']], $col_def['label']); |
|
||||
|
|
||||
if ((++$j % $col_count) == 0) { |
|
||||
if ($j == $col_count) echo "<th>操作</th>"; |
|
||||
echo "</tr><tr style='margin-top:0px;text-align:center'>"; |
|
||||
} |
|
||||
} |
|
||||
echo '</tr>'; |
|
||||
|
|
||||
|
|
||||
?> |
|
||||
|
|
||||
|
|
||||
</thead> |
|
||||
<tbody id='cmecTbody'> |
|
||||
<tr> |
|
||||
<?php |
|
||||
foreach ($con_maintance_examine_clear as $key => $val) { |
|
||||
$j = 0; |
|
||||
$cmecRow = "<tr>"; |
|
||||
foreach ($con_maintance_examine_clear_columm as $col => $col_def) { |
|
||||
|
|
||||
$fieldVal = empty($val) ? "" : $val[$col]; |
|
||||
$_input = $col_def['tag'] == 'select' ? |
|
||||
FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr']) |
|
||||
: FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']); |
|
||||
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' : |
|
||||
$col_def['attr']['colspan']) . "' ><div class=' col-12'> |
|
||||
$_input</td>"; |
|
||||
if ((++$j % $col_count) == 0) { |
|
||||
$cmecRow .= "<td><button name='btn1' onClick='delRow(this)' type='button' class='btn btn-link btn-md '>刪除</button></td>"; |
|
||||
$cmecRow .= "</tr><tr>"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
echo $cmecRow . "</tr>"; |
|
||||
} |
|
||||
?> |
|
||||
</tr> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>簽核操作</b> |
|
||||
</div> |
|
||||
<div class="col-12 col-3 form_field_content " style="padding:0"> |
|
||||
<textarea id="assign_opinion" name="assign_opinion" required></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class=" col-3 form_field_title"> |
|
||||
<b style='float:right'>簽核狀態</b> |
|
||||
</div> |
|
||||
<div class=" col-2 form_field_content "> |
|
||||
<select name="assign_status" id="assign_status" required class='form-control form-control form-control-sm '> |
|
||||
<?php echo $assign_status; ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
|
|
||||
<div class=" col-2 form_field_title"> |
|
||||
<b>下位簽核者</b> |
|
||||
</div> |
|
||||
<div class="col-2 form_field_content"> |
|
||||
<select name="next_users" id="next_users" class='form-control form-control-sm '></select> |
|
||||
|
|
||||
</div> |
|
||||
<div class="col-3 form_field_title "> |
|
||||
<button type="submit" name="btn_save" class="btn btn-warning btn-sm" value="save" style='float:left;margin-right:4px;'>保存</button> |
|
||||
<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> |
|
@ -1,912 +0,0 @@ |
|||||
<?php |
|
||||
require_once '../header_nomenu.php'; |
|
||||
require_once './FormHelper.php'; |
|
||||
require_once './wf_common.php'; |
|
||||
$vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no']; |
|
||||
|
|
||||
|
|
||||
/*** |
|
||||
* 检查是否重复生成价审单 |
|
||||
* con_maintance_examine_apply |
|
||||
*/ |
|
||||
/* |
|
||||
list($cnt)=DB::fields("select count(*) cnt from con_maintance_examine_apply where vol_no='$vol_no'"); |
|
||||
if($cnt>0) { |
|
||||
echo"<script>alert('卷號".$vol_no."已生成價審單,請勿重複生成!');history.go(-1);</script>"; |
|
||||
exit; |
|
||||
} |
|
||||
*/ |
|
||||
|
|
||||
#係統ID |
|
||||
$system_id = 'con'; |
|
||||
#流程ID |
|
||||
$flow_id = 'con01'; |
|
||||
#表單號 $form_id; |
|
||||
$form_id = ""; |
|
||||
#價審單狀態 |
|
||||
$apply_st = ""; |
|
||||
list($apply_key, $form_key, $salesman) = DB::fields("SELECT apply_key, form_key,salesman FROM con_maintance_examine_apply WHERE vol_no='$vol_no' ORDER BY apply_key desc limit 0, 1"); |
|
||||
// echo '<pre>'; |
|
||||
// print_r($salesman); |
|
||||
// echo '</pre>'; |
|
||||
// exit; |
|
||||
if ($salesman != $user_id) { |
|
||||
echo '<script>alert("您並不是該單營業員,無法訪問。");history.go(-1);</script>'; |
|
||||
exit; |
|
||||
} |
|
||||
if (empty($apply_key)) $apply_st = 1; // 準備新增 |
|
||||
else { |
|
||||
//list($flow_code)=DB::fields("select flow_code from flow where form_key = '$form_key' and system_id = '$system_id' and flow_id = '$flow_id'"); |
|
||||
list($current_assigner) = DB::fields("SELECT current_assigner FROM subflow WHERE form_key = '$form_key' ORDER BY seq desc limit 0, 1"); |
|
||||
if ($current_assigner == $user_id) $apply_st = 2; // 修改中,還未提交 |
|
||||
else $apply_st = 9; // 已到下一關,無法䖺改 |
|
||||
} |
|
||||
|
|
||||
// if ($apply_st > 2) { |
|
||||
// echo "<script>alert('卷號" . $vol_no . "已生成價審單,請勿重複生成!');history.go(-1);</script>"; |
|
||||
// exit; |
|
||||
// } |
|
||||
|
|
||||
if ($apply_st == 1) { |
|
||||
$wf = new WorkFlow($system_id, $flow_id, $form_id); |
|
||||
$wf->initWorkFlow($user_id); |
|
||||
$form_key = $wf->flowContext->getFormKey(); |
|
||||
} else { |
|
||||
$wf = new WorkFlow($system_id, $flow_id, $form_id, $form_key); |
|
||||
} |
|
||||
|
|
||||
#獲取簽核意見 |
|
||||
$assign_opinions = Assign::get_records($form_key); |
|
||||
|
|
||||
#會簽部門意見 |
|
||||
$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); |
|
||||
|
|
||||
//預設冇有摺扣 |
|
||||
$wf->setFormData(['discount' => 100]); |
|
||||
$flowName = $wf->getFlowName(); |
|
||||
$assigner = $wf->getAssignerList(); |
|
||||
$assign_status = $wf->getAssignStatus($assigner); |
|
||||
$if_show_assign = true; |
|
||||
//加載流程圖 |
|
||||
//$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); |
|
||||
//$path = $fc[0]->wf_file; |
|
||||
//echo dirname(__DIR__)."/../"."$path"; |
|
||||
|
|
||||
//$flow_chart = file_get_contents(dirname(__DIR__) . '/' . $path); |
|
||||
#是否可會簽 |
|
||||
$isSplitable = $wf->isSplitable(); |
|
||||
|
|
||||
//表單數據 |
|
||||
#客戶表 |
|
||||
#1.電梯品牌選項 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by code_name asc "; |
|
||||
$elevator_brand_opt = DB::result($sql); |
|
||||
#2.保養方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; |
|
||||
$maintain_kind_opt = DB::result($sql); |
|
||||
#3.電梯類型 |
|
||||
$sql = "select code_name value ,content label from code where field_name='maintain_elevator_kind'"; |
|
||||
$elevator_kind_opt = DB::result($sql); |
|
||||
#4.付款方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='payment_kind' order by code_name+ 0 asc"; |
|
||||
$payment_kind_opt = DB::result($sql); |
|
||||
#5.契約性質 |
|
||||
$sql = "select code_name value ,content label from code where field_name='contract_kind'"; |
|
||||
$contract_kind_opt = DB::result($sql); |
|
||||
#6.是否贈送M1 |
|
||||
$is_m1_bundle_opt = [ |
|
||||
['label' => '是', 'value' => 'Y'], |
|
||||
['label' => '否', 'value' => 'N'] |
|
||||
|
|
||||
]; |
|
||||
#7.機種 |
|
||||
$sql = "select code_name value ,content label from code where field_name='fp_kind'"; |
|
||||
$fp_kind_opt = DB::result($sql); |
|
||||
#抓取有望客戶資料 |
|
||||
|
|
||||
$vol_no = $_GET['vol_no']; |
|
||||
$where = " and vol_no='$vol_no'"; |
|
||||
$sql = "SELECT * FROM hope_contract_customer where 1=1 $where ORDER BY vol_no"; |
|
||||
$hope_contract = DB::result($sql); |
|
||||
$hope_contract = empty($hope_contract) ? [] : $hope_contract[0]; |
|
||||
#寫入 con_maintance_examine_apply |
|
||||
if ($apply_st == 1) { |
|
||||
#獲取評審單號 |
|
||||
$apply_key = get_sequnece_no('cmea_apply_key', date('ym')); |
|
||||
//var_dump($hope_contract); |
|
||||
$insert_data = [ |
|
||||
'apply_key' => $apply_key, |
|
||||
'vol_no' => $vol_no, |
|
||||
'form_key' => $form_key, |
|
||||
'address' => $hope_contract['address'], |
|
||||
'case_name' => $hope_contract['customer'], |
|
||||
'num' => $hope_contract['num'], |
|
||||
'brand' => '', |
|
||||
'customer' => $hope_contract['customer'], |
|
||||
'salesman' => empty($hope_contract['salesman']) ? $user_id : $hope_contract['salesman'], |
|
||||
'progress_remark' => $hope_contract['progress_status'] |
|
||||
//'platform_company'=>'', |
|
||||
// 'platforom_company_tel'=> '' |
|
||||
|
|
||||
]; |
|
||||
//var_dump($insert_data); |
|
||||
DB::insert_table('con_maintance_examine_apply', $insert_data); |
|
||||
} |
|
||||
#抓使用者主管 |
|
||||
$sql = "SELECT * FROM account WHERE accountid = '$user_id' "; |
|
||||
list($result) = DB::result($sql); |
|
||||
if ($result['department_id'] == '511') { |
|
||||
$managerid = 'M0137'; |
|
||||
$managername = '劉永德'; |
|
||||
} else if ($result['department_id'] == '512') { |
|
||||
$managerid = 'M0137'; |
|
||||
$managername = '劉永德'; |
|
||||
} else if ($result['department_id'] == '513') { |
|
||||
$managerid = 'M0086'; |
|
||||
$managername = '李烘銘'; |
|
||||
} else if ($result['department_id'] == '514') { |
|
||||
$managerid = 'M0033'; |
|
||||
$managername = '吳育宗'; |
|
||||
} |
|
||||
|
|
||||
if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' || $result['department_id'] == 'M0033') { |
|
||||
$managerid = 'M0008'; |
|
||||
$managername = '詹益彰'; |
|
||||
} |
|
||||
|
|
||||
if ($result['department_id'] == 'M0008') { |
|
||||
$managerid = 'M0008'; |
|
||||
$managername = '詹益彰'; |
|
||||
} |
|
||||
$table = 'con_maintance_examine_apply'; |
|
||||
#可編輯的列 |
|
||||
$editableColumn = [ |
|
||||
'apply_key' => [ |
|
||||
'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', |
|
||||
'attr' => [ |
|
||||
'readonly=true ', |
|
||||
'class' => 'form-control form-control-sm' |
|
||||
] |
|
||||
], |
|
||||
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
|
||||
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'num' => ['label' => "數量", "value" => "", "tag" => 'digits', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], |
|
||||
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], |
|
||||
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], |
|
||||
'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
|
||||
|
|
||||
]; |
|
||||
$where = " and apply_key='$apply_key'"; |
|
||||
|
|
||||
$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; |
|
||||
$data = []; |
|
||||
$data = DB::result($sql); |
|
||||
|
|
||||
#電梯詳細資料 |
|
||||
$con_maintance_examine_clear_columm = [ |
|
||||
'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], |
|
||||
'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], |
|
||||
'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'weight[]', "placeholder" => "載重", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', "placeholder" => "速度", 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', "placeholder" => "停數", 'class' => 'form-control form-control-sm']], |
|
||||
'floors' => ['label' => "層數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'floors[]', 'min=1', 'required', "placeholder" => "層數", 'class' => 'form-control form-control-sm']], |
|
||||
'persons' => ['label' => "人乘", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'persons[]', 'min=1', 'required', "placeholder" => "人乘", 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
|
||||
'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'digits', 'attr' => ['colspan' => 2, 'required', "placeholder" => "竣工檢查年度", 'gt=0', 'min=0', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], |
|
||||
'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'last_check_date[]', "placeholder" => "上次年檢日期", 'colspan' => 2, 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', "placeholder" => "年檢費用", 'colspan' => 2, 'class' => 'form-control form-control-sm ']], |
|
||||
|
|
||||
'maintain_times' => ['label' => "保養次數", "tag" => 'digits', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'register_code' => ['label' => "電梯許可證代碼", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', "placeholder" => "無證號請輸入A,B...", 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "tag" => 'digits', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "tag" => 'digits', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'option' => 'disable', 'options' => $is_m1_bundle_opt], |
|
||||
'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, "placeholder" => "契約報價", 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
]; |
|
||||
$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . |
|
||||
" FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); |
|
||||
$j = 0; |
|
||||
$col_count = 12; |
|
||||
$cmecRow = " <tr>"; |
|
||||
|
|
||||
foreach ($con_maintance_examine_clear_columm as $key => $val) { |
|
||||
$fieldVal = ""; |
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select('', $val['options'], $fieldVal, $val['attr']) |
|
||||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|
||||
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='請輸入'>"; |
|
||||
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>"; |
|
||||
if ((++$j % $col_count) == 0) { |
|
||||
if ($j == $col_count) $cmecRow .= "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md'>刪除</button></td>"; |
|
||||
$cmecRow .= "</tr><tr>"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
$cmecRow .= "</tr>"; |
|
||||
function base_url($url) |
|
||||
{ |
|
||||
return "https://www.masada.com.tw/static/" . $url; |
|
||||
} |
|
||||
function get_sequnece_no($seq_name = '', $p_yyyymm = '') |
|
||||
{ |
|
||||
|
|
||||
if (empty($p_yyyymm) || empty($seq_name)) return null; |
|
||||
#當前年月 |
|
||||
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); |
|
||||
if ($p_yyyymm != $yyyymm) { |
|
||||
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); |
|
||||
} |
|
||||
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; |
|
||||
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring( appwms.nextval('$seq_name'),2)) seq_no "); |
|
||||
|
|
||||
|
|
||||
return $seq_no; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
?> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"> |
|
||||
|
|
||||
</script> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100); ?>" /> |
|
||||
<script type="text/javascript"> |
|
||||
window.param = { |
|
||||
elevator_type: '', |
|
||||
floors: 1, |
|
||||
speed: 1, |
|
||||
persons: 6, |
|
||||
weight: 1000, |
|
||||
maintain_times: 1, //病床梯一月2次保養 |
|
||||
maintain_months: 12, |
|
||||
maintain_kind: 2, |
|
||||
maintain_period: 1, //預設為1月1次, 2是為2月一次 |
|
||||
is_m1_bundle: 'N', |
|
||||
}; |
|
||||
|
|
||||
let regDelStr = ""; |
|
||||
|
|
||||
$(document).ready(function() { |
|
||||
var tag_data; |
|
||||
$.ajax({ |
|
||||
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner', |
|
||||
//url: 'http://localhost/fds/index.php/DesignFlow/get_assigner', |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
window.tag_data = data; |
|
||||
$('#selectPage').selectPage({ |
|
||||
showField: 'show_name', |
|
||||
keyField: 'val', |
|
||||
data: data, |
|
||||
multiple: true, |
|
||||
multipleControlbar: true, |
|
||||
pagination: false, |
|
||||
focusDropList: false |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
$.validator.addMethod('gt', function(value, element, param) { |
|
||||
return value > param; |
|
||||
}, $.validator.format("輸入值必須大於0")); |
|
||||
var assigner = eval('<?= json_encode($assigner) ?>'); |
|
||||
//console.log(assigner); |
|
||||
|
|
||||
var cmecRow = "<?= str_replace('"', '\'', $cmecRow) ?>"; |
|
||||
// $('#cmecTbody').append(cmecRow); |
|
||||
$('.sp_element_box').attr("disabled", true); |
|
||||
$("#assign_opinion").cleditor({ |
|
||||
height: 100, // height not including margins, borders or padding |
|
||||
controls: // controls to add to the toolbar |
|
||||
"bold italic underline strikethrough subscript superscript | font size " + |
|
||||
"style | color highlight removeformat | bullets numbering | outdent " + |
|
||||
"indent | alignleft center alignright justify | undo redo | " |
|
||||
}); |
|
||||
|
|
||||
$('#contract_begin_date').on('input propertychange', function(e) { |
|
||||
|
|
||||
var date = new Date(e.target.value); |
|
||||
var yyyy = date.getFullYear() + 1; |
|
||||
var mm = date.getMonth() + 1; |
|
||||
var dd = date.getDate(); |
|
||||
var time = yyyy + `-` + (mm < 10 ? '0' + mm : mm) + '-' + (dd < 10 ? '0' + dd : dd); |
|
||||
$('#contract_end_date').val(time); |
|
||||
}); |
|
||||
|
|
||||
$('#brand').change(function() { |
|
||||
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
|
||||
if (_selected_status == 'Z') { |
|
||||
$('#brandModal').modal('show') |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
$('#assign_status').change(function() { |
|
||||
$("#next_users").empty(); |
|
||||
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
|
||||
var _option_tmp = ""; //獲取下拉列表 |
|
||||
// for (a in assigner) { //遍曆assigner |
|
||||
// if (assigner[a][0] == _selected_status) { |
|
||||
// _tmp = assigner[a][1].split(','); |
|
||||
// for (var b in _tmp) { |
|
||||
// if (_tmp[b] == '') { |
|
||||
// continue; |
|
||||
// } |
|
||||
// _uname = _tmp[b].split('-')[1]; |
|
||||
// _uid = _tmp[b].split('-')[0]; |
|
||||
// /* console.log(_tmp[b]);*/ |
|
||||
// _option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>'; |
|
||||
// } |
|
||||
// } |
|
||||
// } |
|
||||
_option_tmp += '<option value=' + '<?php echo $managerid ?>' + '>' + '<?php echo $managername ?>' + '</option>'; |
|
||||
console.log(_option_tmp); |
|
||||
$("#next_users").append(_option_tmp); |
|
||||
}); |
|
||||
$('#maintain_kind').change(function() { |
|
||||
if ($('#cmecTbody tr').length > 0) { |
|
||||
alert("保養方式已更動,請開始輸入電梯資料!"); |
|
||||
$('#cmecTbody').find(':input').val(''); |
|
||||
return false; |
|
||||
} |
|
||||
}); |
|
||||
$("#form").validate(); |
|
||||
$("form").submit(function(e) { |
|
||||
$('#reg_del').val(regDelStr); |
|
||||
}); |
|
||||
}); |
|
||||
addRow = function() { |
|
||||
if ($('#maintain_kind').val() == "") { |
|
||||
alert("請選擇保養方式!"); |
|
||||
$('#maintain_kind').eq(0).focus(); |
|
||||
return false; |
|
||||
} |
|
||||
const cmecRow = $('#elevator_list').html(); |
|
||||
console.log(cmecRow); |
|
||||
$('#elevator_list').append(cmecRow); |
|
||||
$("select[name^='elevator_kind'],select[name^='is_m1_bundle']").on('change', function(obj) { |
|
||||
//console.log('#'+$(this).attr('name')+'#'); |
|
||||
var elen = 1; |
|
||||
if ('elevator_kind[]' == $(this).attr('name')) { |
|
||||
var children = $(this).parent().parent().parent(); |
|
||||
var elementObj = $(children).next('tr').find("input[name^='stand_price']"); |
|
||||
//var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
|
||||
} else if ('is_m1_bundle[]' == $(this).attr('name')) { |
|
||||
var children = $(this).parent().parent().parent().prev('tr'); |
|
||||
var elementObj = $(this).parent().parent().parent().find("input[name^='stand_price']"); |
|
||||
//var is_m1_bundle = $(this).val(); |
|
||||
} |
|
||||
|
|
||||
var element = elementObj; |
|
||||
if ('elevator_kind[]' == $(this).attr('name')) { |
|
||||
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle'] option: selected").val(""); |
|
||||
} else if ('is_m1_bundle[]' == $(this).attr('name')) { |
|
||||
var is_m1_bundle = $(children).next('tr').find("select[name^='is_m1_bundle']").val(); |
|
||||
} |
|
||||
|
|
||||
var floors = $(children).find("input[name^='floors']").val(); |
|
||||
var speed = $(children).find("input[name^='speed']").val(); |
|
||||
var weight = $(children).find("input[name^='weight']").val(); |
|
||||
var persons = $(children).find("input[name^='persons']").val(); |
|
||||
var maintain_times = $(children).find("input[name^='maintain_times']").val(); |
|
||||
var maintain_months = $(children).find("input[name^='maintain_months']").val(); |
|
||||
var maintain_period = $(children).find("input[name^='maintain_period']").val(); |
|
||||
var maintain_kind = $('#maintain_kind').val(); |
|
||||
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val(); |
|
||||
|
|
||||
var param1 = { |
|
||||
...param, |
|
||||
persons, |
|
||||
floors, |
|
||||
speed, |
|
||||
weight, |
|
||||
maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_period, |
|
||||
maintain_kind, |
|
||||
elevator_type, |
|
||||
is_m1_bundle |
|
||||
} |
|
||||
setStandPrice(param1, element); |
|
||||
//console.info(param1); |
|
||||
}); |
|
||||
|
|
||||
$("input[name^='floors']" + |
|
||||
",input[name^='speed']" + |
|
||||
",input[name^='persons']" + |
|
||||
",input[name^='weight']" + |
|
||||
",input[name^='maintain_times']" + |
|
||||
",input[name^='maintain_months']" + |
|
||||
",input[name^='maintain_period']" |
|
||||
).on('input propertychange', function(obj) { |
|
||||
// $(obj).parent().parent().parent().remove(); |
|
||||
var children = $(this).parent().parent().parent().children(); |
|
||||
var floors = $(children).find("input[name^='floors']").val(); |
|
||||
var speed = $(children).find("input[name^='speed']").val(); |
|
||||
var weight = $(children).find("input[name^='weight']").val(); |
|
||||
var persons = $(children).find("input[name^='persons']").val(); |
|
||||
var maintain_times = $(children).find("input[name^='maintain_times']").val(); |
|
||||
var maintain_months = $(children).find("input[name^='maintain_months']").val(); |
|
||||
var maintain_period = $(children).find("input[name^='maintain_period']").val(); |
|
||||
var maintain_kind = $('#maintain_kind').val(); |
|
||||
var elevator_type = $(children).find("select[name^='elevator_kind'] option:selected").val(); |
|
||||
var is_m1_bundle = $(this).parent().parent().parent().next('tr').find("select[name^='is_m1_bundle'] option:selected").val(); |
|
||||
|
|
||||
var param1 = { |
|
||||
...param, |
|
||||
persons, |
|
||||
floors, |
|
||||
speed, |
|
||||
weight, |
|
||||
maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_period, |
|
||||
maintain_kind, |
|
||||
elevator_type, |
|
||||
is_m1_bundle |
|
||||
} |
|
||||
var element = $(this).parent().parent().parent().next().children().find("input[name^='stand_price']"); |
|
||||
setStandPrice(param1, element); |
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
delRow = function(btn) { |
|
||||
if ($(btn).attr('name') == 'btn1') { |
|
||||
// console.log($(btn).parent().parent().prev('tr').find('input[id=register_code]').val()); |
|
||||
regDelStr += $(btn).parent().parent().parent().find('input[id=register_code]').val() + ","; |
|
||||
$(btn).parent().parent().next('tr').remove(); |
|
||||
console.log(regDelStr) |
|
||||
} else { |
|
||||
// console.log($(btn).parent().parent().find('input[id=register_code]').val()); |
|
||||
$(btn).parent().parent().next('tr').remove(); |
|
||||
$(btn).parent().parent().remove(); |
|
||||
} |
|
||||
$(btn).parent().parent().parent().parent().remove(); |
|
||||
} |
|
||||
setStandPrice = function(p, obj) { |
|
||||
$.ajax({ |
|
||||
url: '../cont/t.php', |
|
||||
data: p, |
|
||||
type: 'get', |
|
||||
dataType: 'json', |
|
||||
//success: function(data) {}, |
|
||||
success: function(data) { |
|
||||
console.info(data); |
|
||||
if (data.status == 'ok') { |
|
||||
$(obj).val(data.price); |
|
||||
} else { |
|
||||
$(obj).val(data.message); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
addNewBrand = function() { |
|
||||
var new_brand = $("#new_brand").val(); |
|
||||
if (new_brand != '') { |
|
||||
p = { |
|
||||
new_brand: new_brand, |
|
||||
method: 'add_brand' |
|
||||
} |
|
||||
$.ajax({ |
|
||||
url: 'async_req.php', |
|
||||
data: p, |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
console.info(data); |
|
||||
$("#brand").append("<option value='" + data.seq + "'>" + new_brand + "</option>"); |
|
||||
}, |
|
||||
error: function(data) { |
|
||||
console.info(data); |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
|
|
||||
<body> |
|
||||
|
|
||||
<div id="toolbarmenu"> |
|
||||
<!--<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span>--> |
|
||||
<!-- 導航欄 --> |
|
||||
|
|
||||
<ul class="nav nav-tabs" role="tablist" id="tablist"> |
|
||||
<li class=" nav-item "> |
|
||||
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">簽核表單</a> |
|
||||
</li> |
|
||||
|
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<!-- 導航欄 END--> |
|
||||
<div class="tab-content "> |
|
||||
|
|
||||
<div class="tab-pane active assign_content " id="tabassign"> |
|
||||
<form action="submit.php" id='form' method="post" style='width:98%;margin:0 auto'> |
|
||||
<!-- hidden域 --> |
|
||||
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' /> |
|
||||
<input type="hidden" name="token" value='<?= $_GET['token'] ?>' /> |
|
||||
<input type="hidden" name="reg_del" id="reg_del"> |
|
||||
<input type="hidden" name="form_src" id="form_src" value="apply_form"> |
|
||||
<!--表單start--> |
|
||||
<div class=" form container-fluid pt-5"> |
|
||||
<div class="row form_head "> |
|
||||
<div class=" col-12 form_head_title "> |
|
||||
<h4> 保養契約價格審核單</h4> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="row " style='padding-top:30px;'> |
|
||||
<div class=" col-lg-12 form_row_header "> |
|
||||
<b>契約信息</b> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<?php |
|
||||
//一行顯示三列 |
|
||||
$i = 0; |
|
||||
echo " <div class='row '>"; |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
$j = (($i++) % 4); |
|
||||
$fieldVal = empty($data) ? "" : $data[0][$key]; |
|
||||
|
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) |
|
||||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|
||||
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "' |
|
||||
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>"; |
|
||||
if ($i != 1 && $j == 0) { |
|
||||
echo " |
|
||||
</div> |
|
||||
<div class='row'> |
|
||||
"; |
|
||||
} |
|
||||
echo " <div class='col-1 form_field_title'> |
|
||||
" . $val['label'] . " |
|
||||
</div> |
|
||||
<div class=' col-2 form_field_content ' > |
|
||||
$_input |
|
||||
</div> |
|
||||
"; |
|
||||
} |
|
||||
echo "</div>"; |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>洽商進度</b> |
|
||||
</div> |
|
||||
<div class="col-12 " style="padding:0"> |
|
||||
|
|
||||
<textarea class='form-control textarea' id="progress_remark" name="progress_remark" value='12' rows='6'><?= $hope_contract['progress_status'] ?></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div id="elevator_list_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>電梯詳細資料</b> |
|
||||
</div> |
|
||||
<table style='margin-top:0px;text-align:center' class=' table-condensed' id='elevator_list1'> |
|
||||
|
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan='18' style='text-align:left;font-size:13px'> |
|
||||
<b>註意事項:</b> |
|
||||
<p>1.速度單位是 米/分.</p> |
|
||||
<p>2.選擇贈送M1,保養月數需填寫60.</p> |
|
||||
<p>3.標準價格未帶出,請聯係業務部建立該規格報價.</p> |
|
||||
<p>4.無機房速度20~60米 以60米為標準.</p> |
|
||||
|
|
||||
|
|
||||
</td> |
|
||||
</tr> |
|
||||
<tr> |
|
||||
<td colspan='18' ;><button onClick='addRow()' type="button" style='float:right' class="btn btn-link btn-md">+新增</button></td> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
</table> |
|
||||
<table class=' table-condensed' id='elevator_list'> |
|
||||
<thead> |
|
||||
<tr style=' margin-top:0px;text-align:center'> |
|
||||
<th colspan="2">電梯許可代碼</th> |
|
||||
<th colspan="2">品牌</th> |
|
||||
<th colspan="2">電梯類型</th> |
|
||||
<th colspan="2">規格型號</th> |
|
||||
<th>載重(KG)</th> |
|
||||
<th colspan="2">速度(m/min)</th> |
|
||||
<th>停數</th> |
|
||||
<th>層數</th> |
|
||||
<th>人乘</th> |
|
||||
<th colspan="2">保養次數</th> |
|
||||
<th>保養月數</th> |
|
||||
<th>保養周期</th> |
|
||||
<th>贈送M1</th> |
|
||||
</tr> |
|
||||
|
|
||||
</thead> |
|
||||
<tbody id='cmecTbody'> |
|
||||
<tr> |
|
||||
<td colspan="2"> |
|
||||
<div class=' col-12'><input id="register_code" name="register_code[]" type="text" value placeholder="無證號請輸入A、B..." repuired class="form-control form=control-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class=' col-12'> |
|
||||
<select name="elevator_brand[]" id="" class="form-control form-control-sm"> |
|
||||
<option value=""></option> |
|
||||
<?php foreach ($elevator_brand_opt as $data) : ?> |
|
||||
<option value="<?php echo $data['value']; ?>"><?php echo $data['label'] ?></option> |
|
||||
<?php endforeach ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class=' col-12'> |
|
||||
<select name="elevator_kind[]" id="" class="form-control form-control-sm"> |
|
||||
<option value=""></option> |
|
||||
<?php foreach ($elevator_kind_opt as $data) : ?> |
|
||||
<option value="<?php echo $data['value'] ?>"><?php echo $data['label'] ?></option> |
|
||||
<?php endforeach ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class=' col-12'> |
|
||||
<select name="spec[]" id="" class="form-control form-control-sm"> |
|
||||
<option value=""></option> |
|
||||
<?php foreach ($fp_kind_opt as $data) : ?> |
|
||||
<option value="<?php echo $data['value'] ?>"><?php echo $data['label'] ?></option> |
|
||||
<?php endforeach ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
</td> |
|
||||
<!-- <td><section name='spec'></section></td> --> |
|
||||
<td> |
|
||||
<div class=' col-12'><input type="digits" id="weight" name="weight[]" value gt="0" min="0" required class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class=' col-12'><input type="number" id="speed" name="speed[]" valaue gt="0" min="0" require class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class=' col-12'><input type="number" id="stop" name="stop[]" class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class=' col-12'><input type="digits" id="floors" name="floors[]" value min="1" required class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class=' col-12'><input type="digits" id="persons" name="persons[]" value min='1' required class="form-control form-contorl-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class=' col-12'><input type="digits" id="maintain_times" name="maintain_times[]" value='1' min='1' required class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class=' col-12'><input type="digits" id="maintain_months" name="maintain_months[]" value="12" min='12' required class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class=' col-12'><input type="digits" id="maintain_period" name="maintain_period[]" value="1" min='1' require class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class='col-12'> |
|
||||
<select name="is_m1_bundle[]" id required class="form-control form-control-sm" id=""> |
|
||||
<option value=""></option> |
|
||||
<?php foreach ($is_m1_bundle_opt as $data) : ?> |
|
||||
<option value="<?php $data['value'] ?>"><?php echo $data['label'] ?></option> |
|
||||
<?php endforeach ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</tbody> |
|
||||
<thead> |
|
||||
<tr style='margin-top:0px;text-align:center'> |
|
||||
<th colspan="2">竣工檢查年度</th> |
|
||||
<th colspan="2">上次年檢日期</th> |
|
||||
<th colspan="2">年檢費用(元)</th> |
|
||||
<th colspan="2">標準價格(元/月)</th> |
|
||||
<th colspan="2">契約報價(元/月)</th> |
|
||||
<th colspan="2">契約成交價(元/月)</th> |
|
||||
<th>刪除</th> |
|
||||
|
|
||||
<th colspan="6"></th> |
|
||||
|
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody id='cmecTbody2'> |
|
||||
<tr> |
|
||||
<td colspan="2"> |
|
||||
<div class="col-12"><input type="text" id="useful_years" name="useful_years[]" type="digits" value colspan='2' required gt='0' min='0' class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class="col-12"><input type="number" id="last_check_date" name="last_check_date[]" value required colspan="2" class="form-control form-control-sn"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class="col-12"><input type="text" id="annual_survey_expense" name="annual_survey_exoense[]" type="number" value required colspan='2' class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class="col-12"><input type="text" id='stand_price' name="stand_price[]" value required readonly colspan='2' class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class="col-12"><input type="number" id="contract_price" name="contract_price[]" required colsapn="2" class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td colspan="2"> |
|
||||
<div class="col-12"><input type="number" id="sold_price" name="sold_price[]" colspan='2' class="form-control form-control-sm"></div> |
|
||||
</td> |
|
||||
<td> |
|
||||
<div class=' col-12'><button onclick="delRow(this)" name='btn1' type="button" class="btn btn-link btn md">刪除</button></div> |
|
||||
</td> |
|
||||
<td colspan="6"></td> |
|
||||
|
|
||||
</tr> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>簽核操作</b> |
|
||||
</div> |
|
||||
<div class="col-12 col-3 form_field_content " style="padding:0"> |
|
||||
<textarea id="assign_opinion" name="assign_opinion" required></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class=" col-3 form_field_title"> |
|
||||
<b style='float:right'>簽核狀態</b> |
|
||||
</div> |
|
||||
<div class=" col-2 form_field_content "> |
|
||||
<select name="assign_status" id="assign_status" required class='form-control form-control form-control-sm '> |
|
||||
<?php echo $assign_status; ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
|
|
||||
<div class=" col-2 form_field_title"> |
|
||||
<b>下位簽核者</b> |
|
||||
</div> |
|
||||
<div class="col-2 form_field_content"> |
|
||||
<select lect name="next_users" id="next_users" class='form-control form-control-sm '></select> |
|
||||
|
|
||||
</div> |
|
||||
<div class="col-3 form_field_title "> |
|
||||
<button type="submit" name="btn_save" class="btn btn-warning btn-sm" value="save" style='float:left;margin-right:4px;'>保存</button> |
|
||||
<button type="submit" name="btn_save" class="btn btn-primary btn-sm" value="tosign" style='float:left'>提交</button> |
|
||||
</div> |
|
||||
|
|
||||
</div> |
|
||||
<div id="opinion_area " class="row form_comment "> |
|
||||
<div class='col-12 '> |
|
||||
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'> |
|
||||
<li class="active nav-item "> |
|
||||
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a> |
|
||||
</li> |
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<div class="tab-content col-12"> |
|
||||
<div role="tabpanel" class="tab-pane active" id="main_flow_assign"> |
|
||||
|
|
||||
<div class="comment_items "> |
|
||||
<?php $cnt = 1; |
|
||||
$tmp_code = "0"; |
|
||||
foreach ($assign_opinions as $as) { ?> |
|
||||
<div class="comment-item"> |
|
||||
|
|
||||
<!-- <div class="comment-title"> |
|
||||
<b>大 </b> |
|
||||
</div>--> |
|
||||
<?php |
|
||||
if (($as['flow_code']) != $tmp_code) |
|
||||
echo ' <div class="comment-title"> |
|
||||
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b> |
|
||||
</div>'; |
|
||||
$tmp_code = $as['flow_code']; |
|
||||
?> |
|
||||
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>"> |
|
||||
<div class="comment-content-header"> |
|
||||
<span> |
|
||||
|
|
||||
<strong> |
|
||||
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?> |
|
||||
|
|
||||
<?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> |
|
@ -1,20 +0,0 @@ |
|||||
<?php |
|
||||
require_once './wf_common.php'; |
|
||||
|
|
||||
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST; |
|
||||
//echo json_encode($request); |
|
||||
$func = $request['method']; |
|
||||
if (function_exists($func)) { |
|
||||
call_user_func($func, $request); |
|
||||
} |
|
||||
|
|
||||
function add_brand($req) |
|
||||
{ |
|
||||
$new_brand = $req['new_brand']; |
|
||||
list($code_name) = DB::fields("select cast(count(code_name) as SIGNED) +1 from code where field_name='elevator_brand' and code_name!='Z' "); |
|
||||
|
|
||||
DB::query("INSERT INTO `code` (`field_name`, `code_name`, `content`, `remark`, `creator`, `create_at`) VALUES |
|
||||
('elevator_brand', '$code_name', '$new_brand', '电梯品牌', '', now()); |
|
||||
"); |
|
||||
echo json_encode(['seq' => $code_name]); |
|
||||
} |
|
@ -1,14 +0,0 @@ |
|||||
<?php |
|
||||
#电梯详细资料 |
|
||||
$con_maintance_examine_clear_columm = [ |
|
||||
'register_code' => ['label' => "电梯注册代码", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'brand' => ['label' => "品牌", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'spec' => ['label' => "规格型号", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'weight' => ['label' => "载重", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'speed' => ['label' => "速度", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'stop' => ['label' => "停数", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'useful_years' => ['label' => "使用年限", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'last_check_date' => ['label' => "最近一次年检日期", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
'speed_governors_check_expense' => ['label' => "限速器校验费", "value" => "", "tag" => 'text', 'class' => ''], |
|
||||
]; |
|
||||
$con_maintance_examine_clear = DB::result("SELECT * FROM con_maintance_examine_clear where 1=1 and cmstatus='Y' "); |
|
@ -1,42 +0,0 @@ |
|||||
<?php |
|
||||
$envFile = __DIR__ . '/.env'; // .env 文件的路径 |
|
||||
|
|
||||
if (file_exists($envFile)) { |
|
||||
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
|
||||
if ($lines !== false) { |
|
||||
foreach ($lines as $line) { |
|
||||
list($key, $value) = explode('=', $line, 2); |
|
||||
$key = trim($key); |
|
||||
$value = trim($value); |
|
||||
// 设置环境变量 |
|
||||
putenv("$key=$value"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
$db_hostname = getenv('DB_HOST'); //資料庫主機名稱 |
|
||||
$db_username = getenv('DB_USERNAME'); //登入資料庫的管理者的帳號 |
|
||||
$db_password = getenv('DB_PASSWORD'); //登入密碼 |
|
||||
$db_name = getenv('DB_DATABASE'); //使用的資料庫 |
|
||||
$db_charset = 'utf8'; //設定字元編碼 |
|
||||
|
|
||||
//建立PDO的指定工作 |
|
||||
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset"; |
|
||||
|
|
||||
try { |
|
||||
//使用PDO連接到MySQL資料庫,建立PDO物件 |
|
||||
$conn = new PDO($dsn, $db_username, $db_password); |
|
||||
|
|
||||
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException) |
|
||||
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定 |
|
||||
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊 |
|
||||
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯 |
|
||||
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。 |
|
||||
//設定主動以警告的形式報錯 |
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
||||
//如果連接錯誤,將抛出一個PDOException異常對象 |
|
||||
} catch (PDOException $e) { |
|
||||
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 |
|
||||
die("ERROR!!!: " . $e->getMessage()); |
|
||||
} |
|
||||
|
|
||||
//$conn = null; //關閉資料庫的連線 |
|
@ -1,21 +0,0 @@ |
|||||
<?php |
|
||||
error_reporting(E_ALL); |
|
||||
ini_set("display_errors", "On"); |
|
||||
require_once './wf_common.php'; |
|
||||
|
|
||||
require_once './model/HopeContractCustomerModel.php'; |
|
||||
|
|
||||
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST; |
|
||||
|
|
||||
$hecm = new HopeContractCustomerModel(); |
|
||||
$cols = $hecm->fillable; |
|
||||
foreach ($cols as $col) { |
|
||||
if (!in_array($col, array_keys($request))) { |
|
||||
continue; |
|
||||
} |
|
||||
$data[$col] = empty($request[$col]) ? NULL : $request[$col]; |
|
||||
} |
|
||||
$hecm->create( $data); |
|
||||
|
|
||||
|
|
||||
echo"<script>alert('已保存');history.go(-1);</script>"; |
|
@ -1,168 +0,0 @@ |
|||||
<?php |
|
||||
error_reporting(E_ALL); |
|
||||
ini_set("display_errors", "on"); |
|
||||
/** |
|
||||
* 显示所有的待签 员工所有待签 |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
// 載入db.php來連結資料庫 |
|
||||
require_once "../database.php"; |
|
||||
require_once "../header.php"; |
|
||||
|
|
||||
|
|
||||
|
|
||||
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id']; |
|
||||
$where_system_id = " and a.system_id like '" . $system_id . "%'"; |
|
||||
|
|
||||
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id']; |
|
||||
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'"; |
|
||||
|
|
||||
$sql_get = "select c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner, |
|
||||
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name , |
|
||||
flow_name,c.update_date ,c.create_date from system_main a,flow_main b ,subflow c,flow d |
|
||||
where a.system_id=b.system_id |
|
||||
and b.flow_id=d.flow_id |
|
||||
and d.flow_id=b.flow_id |
|
||||
and c.form_key=d.form_key |
|
||||
$where_system_id |
|
||||
$where_flow_id |
|
||||
"; |
|
||||
//echo $sql_get; |
|
||||
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); |
|
||||
|
|
||||
$system_name_opt = array_map(function ($item) { |
|
||||
return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']); |
|
||||
}, $res_get); |
|
||||
$system_name_opt = (array_unique($system_name_opt, SORT_REGULAR)); |
|
||||
|
|
||||
|
|
||||
$flow_name_opt = array_map(function ($item) { |
|
||||
return array('flow_id' => $item['flow_id'], 'flow_name' => $item['flow_name']); |
|
||||
}, $res_get); |
|
||||
$flow_name_opt = (array_unique($flow_name_opt, SORT_REGULAR)); |
|
||||
|
|
||||
?> |
|
||||
<style> |
|
||||
table { |
|
||||
table-layout: fixed; |
|
||||
width: 90%; |
|
||||
} |
|
||||
|
|
||||
td { |
|
||||
word-wrap: break-word; |
|
||||
} |
|
||||
|
|
||||
img { |
|
||||
width: 125px; |
|
||||
} |
|
||||
|
|
||||
.width_style_1 { |
|
||||
width: 125px; |
|
||||
} |
|
||||
|
|
||||
.table>tbody>tr>td, |
|
||||
.table>tbody>tr>th, |
|
||||
.table>tfoot>tr>td, |
|
||||
.table>tfoot>tr>th, |
|
||||
.table>thead>tr>td, |
|
||||
.table>thead>tr>th { |
|
||||
vertical-align: middle !important; |
|
||||
} |
|
||||
|
|
||||
#table_index_filter { |
|
||||
float: right; |
|
||||
} |
|
||||
|
|
||||
#table_index_paginate { |
|
||||
float: right; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
table.query-table th { |
|
||||
text-align: right; |
|
||||
} |
|
||||
</style> |
|
||||
<form method='post' action='#'> |
|
||||
<table class='table query-table table-striped table-bordered display compact' style='width:90%;text-align:center;margin:0 auto'> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan="8"> |
|
||||
<h3 style='text-align:center'>待签查询</h3> |
|
||||
</td> |
|
||||
</tr> |
|
||||
|
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<tr> |
|
||||
<th style='width:50px'>系统名称</th> |
|
||||
<td colspan='1'> |
|
||||
<select class='form-control' name='system_id'> |
|
||||
<?php |
|
||||
echo " <option class='form-control' value='%' >全部</option>"; |
|
||||
foreach ($system_name_opt as $opt) { |
|
||||
echo " <option class='form-control' value=" . $opt['system_id'] . " >" . $opt['system_name'] . "</option>"; |
|
||||
} |
|
||||
?> |
|
||||
</select> |
|
||||
</td> |
|
||||
<th>流程名称</th> |
|
||||
<td colspan='1'> <select class='form-control' name='flow_id'> |
|
||||
<?php |
|
||||
echo " <option class='form-control' value='%' >全部</option>"; |
|
||||
foreach ($flow_name_opt as $opt) { |
|
||||
echo " <option class='form-control' value=" . $opt['flow_id'] . " >" . $opt['flow_name'] . "</option>"; |
|
||||
} |
|
||||
?> |
|
||||
</select> </td> |
|
||||
|
|
||||
</tr> |
|
||||
</tbody> |
|
||||
<tfoot> |
|
||||
<tr> |
|
||||
<td colspan="8" style='text-align:center'> |
|
||||
<button type="submit" style='text-align:center; margin:0 auto;width:50px' class="btn btn-primary">查询</button> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</tfoot> |
|
||||
</table> |
|
||||
<div style="overflow-x:auto;width:92%;margin:0 auto"> |
|
||||
<table id="table_index" style='width:100%;margin:0 auto' class="table table-striped table-bordered display compact"> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<th>序号</th> |
|
||||
<th>系统名称</th> |
|
||||
<th>流程名称</th> |
|
||||
<th>接收日期</th> |
|
||||
<th>当前签核者</th> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
|
|
||||
<?php |
|
||||
$rowspan = 1; |
|
||||
foreach ($res_get as $key => $data) : |
|
||||
?> |
|
||||
<tr> |
|
||||
<td><a href="sign_form.php?form_key=<?= $data['form_key']; ?>"><?= $data['form_key']; ?></a></td> |
|
||||
<td><?php echo $data['system_name']; ?></td> |
|
||||
<td><?php echo $data['flow_name']; ?></td> |
|
||||
<td><?php echo $data['update_date']; ?></td> |
|
||||
<td><?php echo $data['current_assigner_name']; ?></td> |
|
||||
|
|
||||
|
|
||||
</tr> |
|
||||
|
|
||||
|
|
||||
<?php endforeach; ?> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
</form> |
|
||||
<?php |
|
||||
#代錶結束連線 |
|
||||
mysqli_close($link); |
|
||||
require_once "../footer.php"; |
|
||||
|
|
||||
|
|
||||
?> |
|
@ -1,29 +0,0 @@ |
|||||
<?php |
|
||||
require_once 'Model.php'; |
|
||||
class ConMaintanceExamineApplyModel extends Model |
|
||||
{ |
|
||||
protected $table = 'con_maintance_examine_apply'; |
|
||||
protected $fillable = [ |
|
||||
'apply_key', |
|
||||
'vol_no', |
|
||||
'form_key', |
|
||||
'customer', |
|
||||
'address', |
|
||||
'case_name', |
|
||||
'brand', |
|
||||
'num', |
|
||||
'salesman', |
|
||||
'maintain_kind', |
|
||||
'contract_begin_date', |
|
||||
'contract_end_date', |
|
||||
'contract_kind', |
|
||||
'platform_company', |
|
||||
'platforom_company_tel', |
|
||||
'payment_kind', |
|
||||
|
|
||||
'progress_remark', |
|
||||
'introducer', |
|
||||
'creater', |
|
||||
'updated_at', |
|
||||
]; |
|
||||
} |
|
@ -1,33 +0,0 @@ |
|||||
<?php |
|
||||
require_once 'Model.php'; |
|
||||
class ConMaintanceExamineClearModel extends Model |
|
||||
{ |
|
||||
protected $table = 'con_maintance_examine_clear'; |
|
||||
public $fillable = [ |
|
||||
'apply_key', |
|
||||
'register_code', |
|
||||
'elevator_brand', |
|
||||
'elevator_kind', |
|
||||
'spec', |
|
||||
'weight', |
|
||||
'speed', |
|
||||
'stop', |
|
||||
'floors', |
|
||||
'persons', |
|
||||
'elevator_num', |
|
||||
'useful_years', |
|
||||
'last_check_date', |
|
||||
'speed_governors_check_expense', |
|
||||
'maintain_times', |
|
||||
'is_m1_bundle', |
|
||||
'maintain_months', |
|
||||
'maintain_period', |
|
||||
'stand_price', |
|
||||
'contract_price', |
|
||||
'sold_price', |
|
||||
// 'commission_expense', |
|
||||
//// 'management_expense', |
|
||||
'annual_survey_expense', |
|
||||
// 'service_expense', |
|
||||
]; |
|
||||
} |
|
@ -1,53 +0,0 @@ |
|||||
<?php |
|
||||
class Model |
|
||||
{ |
|
||||
protected $table = ''; |
|
||||
protected $fillable = []; |
|
||||
/** |
|
||||
* 创建记录 |
|
||||
* |
|
||||
* @param array $data |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function create(array $data) |
|
||||
{ |
|
||||
$_data = []; |
|
||||
foreach ($this->fillable as $col) { |
|
||||
$_data[$col] = empty($data[$col]) ? '' : $data[$col]; |
|
||||
} |
|
||||
DB::insert_table($this->table, $_data); |
|
||||
} |
|
||||
/** |
|
||||
* 创建或更新 |
|
||||
* |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function createOrUpdate(array $keyCol, array $data) |
|
||||
{ |
|
||||
list($cnt) = DB::fields( |
|
||||
"select count(*) from $this->table where " . $keyCol[0] . " = '" . $keyCol[1] . "'" |
|
||||
); |
|
||||
if ($cnt == 0) { |
|
||||
self::create(array_merge($data, $keyCol)); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public function update(array $keyCol, array $data) |
|
||||
{ |
|
||||
$_data = []; |
|
||||
foreach ($this->fillable as $col) { |
|
||||
if (in_array($col, array_keys($data))) $_data[$col] = empty($data[$col]) ? '' : $data[$col]; |
|
||||
} |
|
||||
DB::update_table($this->table, $_data, $keyCol[0] . '=\'' . $keyCol[1] . '\''); |
|
||||
} |
|
||||
/** |
|
||||
* 获取记录 |
|
||||
* |
|
||||
* @param array $cond |
|
||||
* @return void |
|
||||
*/ |
|
||||
public function get(array $cond) |
|
||||
{ |
|
||||
return []; |
|
||||
} |
|
||||
} |
|
@ -1,511 +0,0 @@ |
|||||
<?php |
|
||||
error_reporting(E_ALL); |
|
||||
ini_set("display_errors", "On"); |
|
||||
|
|
||||
require_once "../header_nomenu.php"; |
|
||||
$apply_key = $_GET['apply_key']; |
|
||||
#$vol_no = $qword->vol_no; |
|
||||
require_once './MICalculator.php'; |
|
||||
require_once './FormHelper.php'; |
|
||||
require_once './wf_common.php'; |
|
||||
list($form_key) = DB::fields("select form_key from con_maintance_examine_apply where apply_key='$apply_key'"); |
|
||||
//echo $form_key; |
|
||||
$flow = new Flow($form_key); |
|
||||
// 當前節點簽核開始 |
|
||||
//var_dump($flow); |
|
||||
$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); |
|
||||
#獲取簽核意見 |
|
||||
$assign_opinions = Assign::get_records($form_key); |
|
||||
$flowName = $wf->getFlowName(); |
|
||||
$assigner = $wf->getAssignerList(); |
|
||||
$assign_status = $wf->getAssignStatus($assigner); |
|
||||
//表單數據 |
|
||||
#客戶表 |
|
||||
#客戶表 |
|
||||
#1.電梯品牌選項 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; |
|
||||
$elevator_brand_opt = DB::result($sql); |
|
||||
#2.保養方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; |
|
||||
$maintain_kind_opt = DB::result($sql); |
|
||||
#3.電梯類型 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; |
|
||||
$elevator_kind_opt = DB::result($sql); |
|
||||
#4.付款方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='payment_kind'"; |
|
||||
$payment_kind_opt = DB::result($sql); |
|
||||
#5.契約性質 |
|
||||
$sql = "select code_name value ,content label from code where field_name='contract_kind'"; |
|
||||
$contract_kind_opt = DB::result($sql); |
|
||||
#6.是否贈送M1 |
|
||||
$is_m1_bundle_opt = [ |
|
||||
['label' => '是', 'value' => 'Y'], |
|
||||
['label' => '否', 'value' => 'N'] |
|
||||
]; |
|
||||
#7.機種 |
|
||||
$sql = "select code_name value ,content label from code where field_name='fp_kind'"; |
|
||||
$fp_kind_opt = DB::result($sql); |
|
||||
$table = 'con_maintance_examine_apply'; |
|
||||
#可編輯的列 |
|
||||
$editableColumn = [ |
|
||||
'apply_key' => [ |
|
||||
'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', |
|
||||
'attr' => [ |
|
||||
'readonly=true ', |
|
||||
'class' => 'form-control form-control-sm' |
|
||||
] |
|
||||
], |
|
||||
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
|
||||
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'num' => ['label' => "數量", "value" => "", "tag" => 'number', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], |
|
||||
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], |
|
||||
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], |
|
||||
'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
// 'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
// 'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
|
||||
|
|
||||
]; |
|
||||
$where = " and apply_key='$apply_key'"; |
|
||||
|
|
||||
$sql = "SELECT * FROM $table where 1=1 $where ORDER BY apply_key"; |
|
||||
$data = []; |
|
||||
list($data) = DB::result($sql); |
|
||||
|
|
||||
#電梯詳細資料 |
|
||||
$con_maintance_examine_clear_columm = [ |
|
||||
'register_code' => ['label' => "電梯許可證代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], |
|
||||
//'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], |
|
||||
'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], |
|
||||
'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
//'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], |
|
||||
'floors' => ['label' => "層數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
|
||||
|
|
||||
|
|
||||
// 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], |
|
||||
'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], |
|
||||
'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], |
|
||||
//'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
// 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], |
|
||||
// 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
// 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], |
|
||||
//'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], |
|
||||
'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
|
||||
'stand_price' => ['label' => "標準價格A(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'contract_price' => ['label' => "契約報價B(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
|
|
||||
'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], |
|
||||
'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], |
|
||||
'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['readonly=true', 'disabled', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
]; |
|
||||
$con_maintance_examine_clear = DB::result("SELECT register_code, |
|
||||
f_return_content('elevator_brand',elevator_brand) elevator_brand, |
|
||||
f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, |
|
||||
elevator_kind con_elevator_kind, |
|
||||
spec, |
|
||||
weight, |
|
||||
speed, |
|
||||
floors, |
|
||||
persons, |
|
||||
maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
|
|
||||
useful_years, |
|
||||
last_check_date, |
|
||||
speed_governors_check_expense, |
|
||||
service_expense, |
|
||||
commission_expense, |
|
||||
management_expense, |
|
||||
annual_survey_expense, |
|
||||
stand_price, |
|
||||
contract_price, |
|
||||
sold_price, |
|
||||
0 mi_cost , |
|
||||
0 discount, |
|
||||
0 gross_profit |
|
||||
FROM |
|
||||
con_maintance_examine_clear |
|
||||
WHERE |
|
||||
1 = 1 |
|
||||
AND apply_key='" . $apply_key . "' and cmstatus = 'Y'"); |
|
||||
|
|
||||
function base_url($url) |
|
||||
{ |
|
||||
return "https://www.masada.com.tw/static/" . $url; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
?> |
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
||||
<html> |
|
||||
|
|
||||
<head> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf8" /> |
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
||||
<title> <?php echo $flowName; ?></title> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|
||||
|
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" /> |
|
||||
|
|
||||
<script type="text/javascript"> |
|
||||
$(document).ready(function() { |
|
||||
var tag_data; |
|
||||
$.ajax({ |
|
||||
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner', |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
window.tag_data = data; |
|
||||
$('#selectPage').selectPage({ |
|
||||
showField: 'show_name', |
|
||||
keyField: 'val', |
|
||||
data: data, |
|
||||
multiple: true, |
|
||||
multipleControlbar: true, |
|
||||
pagination: false, |
|
||||
focusDropList: false |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
var assigner = eval('<?= json_encode($assigner) ?>'); |
|
||||
|
|
||||
|
|
||||
// $('#cmecTbody').append(cmecRow); |
|
||||
$('.sp_element_box').attr("disabled", true); |
|
||||
$("#assign_opinion").cleditor({ |
|
||||
height: 100, // height not including margins, borders or padding |
|
||||
controls: // controls to add to the toolbar |
|
||||
"bold italic underline strikethrough subscript superscript | font size " + |
|
||||
"style | color highlight removeformat | bullets numbering | outdent " + |
|
||||
"indent | alignleft center alignright justify | undo redo | " |
|
||||
}); |
|
||||
$('#assign_status').change(function() { |
|
||||
$("#next_users").empty(); |
|
||||
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
|
||||
var _option_tmp = ""; //獲取下拉列表 |
|
||||
for (a in assigner) { //遍曆assigner |
|
||||
if (assigner[a][0] == _selected_status) { |
|
||||
_tmp = assigner[a][1].split(','); |
|
||||
for (var b in _tmp) { |
|
||||
if (_tmp[b] == '') { |
|
||||
continue; |
|
||||
} |
|
||||
_uname = _tmp[b].split('-')[1]; |
|
||||
_uid = _tmp[b].split('-')[0]; |
|
||||
/* console.log(_tmp[b]);*/ |
|
||||
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>'; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
$("#next_users").append(_option_tmp); |
|
||||
}); |
|
||||
|
|
||||
}); |
|
||||
</script> |
|
||||
|
|
||||
</head> |
|
||||
|
|
||||
<body> |
|
||||
<!-- 導航欄 END--> |
|
||||
<div class="tab-content "> |
|
||||
|
|
||||
<div class="tab-pane active assign_content " id="tabassign"> |
|
||||
<form action="submit.php" method="post" style='width:98%;margin:0 auto'> |
|
||||
<!-- hidden域 --> |
|
||||
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' /> |
|
||||
<input type="hidden" name="apply_key" value='<?php echo $apply_key; ?>' /> |
|
||||
<!--表單start--> |
|
||||
<div class=" form container-fluid pt-5"> |
|
||||
<div class="row form_head "> |
|
||||
<div class=" col-12 form_head_title "> |
|
||||
<h4> 保養契約價格審核單</h4> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="row " style='padding-top:30px;'> |
|
||||
<div class=" col-lg-12 form_row_header "> |
|
||||
<b>契約信息</b> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<?php |
|
||||
//一行顯示三列 |
|
||||
$i = 0; |
|
||||
echo " <div class='row '>"; |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
// print_r($val['label']); |
|
||||
$j = (($i++) % 4); |
|
||||
$fieldVal = empty($data) ? "" : $data[$key]; |
|
||||
$fieldVal = empty($data) ? "" : $data[$key]; |
|
||||
|
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : |
|
||||
FormHelper::tag("label", $val['attr'], $fieldVal); |
|
||||
|
|
||||
// "<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "' |
|
||||
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>"; |
|
||||
if ($i != 1 && $j == 0) { |
|
||||
echo " |
|
||||
</div> |
|
||||
<div class='row'> |
|
||||
"; |
|
||||
} |
|
||||
echo " <div class='col-1 form_field_title'> |
|
||||
" . $val['label'] . " |
|
||||
</div> |
|
||||
<div class=' col-2 form_field_content ' > |
|
||||
$_input |
|
||||
</div> |
|
||||
"; |
|
||||
} |
|
||||
echo "</div>"; |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>洽商進度</b> |
|
||||
</div> |
|
||||
<div class="col-12 " style="padding:0"> |
|
||||
|
|
||||
<textarea class='form-control textarea' disabled id="progress_remark" name="progress_remark" value='12' rows='6'><?= $data['progress_remark'] ?></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div id="elevator_list_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>電梯詳細資料</b> |
|
||||
</div> |
|
||||
<table style='margin-top:0px;text-align:center' id='elevator_list'> |
|
||||
|
|
||||
<thead> |
|
||||
|
|
||||
<tr style='margin-top:0px;text-align:center'> |
|
||||
<?php |
|
||||
$j = 0; |
|
||||
foreach ($con_maintance_examine_clear_columm as $val) { |
|
||||
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan']) |
|
||||
? 1 : $val['attr']['colspan']], $val['label']); |
|
||||
|
|
||||
if ((++$j % 14) == 0) { |
|
||||
// if ($j == 12) echo "<th>操作</th>"; |
|
||||
|
|
||||
|
|
||||
echo "</tr><tr style='margin-top:0px;text-align:center'>"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody id='cmecTbody'> |
|
||||
<?php |
|
||||
|
|
||||
$i = 0; |
|
||||
$tr_class = "odd"; |
|
||||
foreach ($con_maintance_examine_clear as $key => $val) { |
|
||||
$j = 0; |
|
||||
|
|
||||
$cmecRow = " <tr $i class='$tr_class'>"; |
|
||||
|
|
||||
foreach ($con_maintance_examine_clear_columm as $col => $col_def) { |
|
||||
$fieldVal = empty($val) ? "" : $val[$col]; |
|
||||
if ($col == 'mi_cost') { |
|
||||
$param = [ |
|
||||
'elevator_type' => $val['con_elevator_kind'], |
|
||||
'floors' => $val['floors'], |
|
||||
'speed' => $val['speed'], |
|
||||
'persons' => $val['persons'], |
|
||||
'weight' => $val['weight'], |
|
||||
'maintain_times' => $val['maintain_times'], |
|
||||
'maintain_months' => $val['maintain_months'], |
|
||||
'maintain_kind' => $data['maintain_kind'], |
|
||||
'maintain_period' => $val['maintain_period'], |
|
||||
'is_m1_bundle' => $val['is_m1_bundle'], |
|
||||
]; |
|
||||
$mic = new MICalculator(); |
|
||||
$res = $mic->cal($param); |
|
||||
#MI報價 |
|
||||
$con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = $res['status'] == 'ok' ? $res['price'] : $res['message']; |
|
||||
$con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" |
|
||||
#扣率 |
|
||||
$val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; |
|
||||
} |
|
||||
|
|
||||
$_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 |
|
||||
: $col_def['attr']['colspan']], $fieldVal); |
|
||||
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' |
|
||||
: $col_def['attr']['colspan']) . "' ><div class=' col-12'> $_input</td>"; |
|
||||
|
|
||||
$cmecRow = (++$j % 14 == 0) ? $cmecRow . "</tr ><tr $i class='$tr_class'>" : $cmecRow; |
|
||||
} |
|
||||
$tr_class = $tr_class == 'odd' ? "even" : "odd"; |
|
||||
echo $cmecRow . "</tr>"; |
|
||||
} |
|
||||
?> |
|
||||
</tbody> |
|
||||
<tfoot> |
|
||||
<?php |
|
||||
#總臺數 |
|
||||
$count = count($con_maintance_examine_clear); |
|
||||
#總成交價 |
|
||||
$total_sold_price = 0; |
|
||||
#總標準價格 |
|
||||
$total_stand_price = 0; |
|
||||
#總標準成本 |
|
||||
$total_mi_cost = 0; |
|
||||
foreach ($con_maintance_examine_clear as $val) { |
|
||||
$total_sold_price += $val['sold_price']; |
|
||||
$total_stand_price += $val['stand_price']; |
|
||||
$total_mi_cost += $val['mi_cost']; |
|
||||
} |
|
||||
$total_discount_rate = $total_sold_price == 0 ? 0 : (100 * round($total_sold_price / $total_stand_price, 4)) . "%" |
|
||||
|
|
||||
?> |
|
||||
<tr> |
|
||||
<td colspan='20'> |
|
||||
<div style='float:right'> |
|
||||
|
|
||||
<label>合計成交價:<?= $count == 0 ? $count : $total_sold_price ?>; </label> |
|
||||
<label>合計成本:<?= $count == 0 ? $count : $total_mi_cost ?>; </label> |
|
||||
<label>折扣率(C/A):<?= $total_discount_rate ?>; </label> |
|
||||
<label>毛利率:/</label> |
|
||||
</div> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</tfoot> |
|
||||
</table> |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<div id="opinion_area " class="row form_comment "> |
|
||||
<div class='col-12 '> |
|
||||
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'> |
|
||||
<li class="active nav-item "> |
|
||||
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a> |
|
||||
</li> |
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<div class="tab-content col-12"> |
|
||||
<div role="tabpanel" class="tab-pane active" id="main_flow_assign"> |
|
||||
<?php |
|
||||
$assign_departs = array(); |
|
||||
foreach ($assign_opinions as $as) { |
|
||||
$assign_departs[$as['assign_depart']] = $as['assign_depart_name']; |
|
||||
} |
|
||||
?> |
|
||||
|
|
||||
<div class="comment_items "> |
|
||||
<?php $cnt = 1; |
|
||||
$tmp_code = "0"; |
|
||||
foreach ($assign_opinions as $as) { ?> |
|
||||
<div class="comment-item"> |
|
||||
|
|
||||
<!-- <div class="comment-title"> |
|
||||
<b>大 </b> |
|
||||
</div>--> |
|
||||
<?php |
|
||||
if (($as['flow_code']) != $tmp_code) |
|
||||
echo ' <div class="comment-title"> |
|
||||
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b> |
|
||||
</div>'; |
|
||||
$tmp_code = $as['flow_code']; |
|
||||
?> |
|
||||
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>"> |
|
||||
<div class="comment-content-header"> |
|
||||
<span> |
|
||||
|
|
||||
<strong> |
|
||||
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?> |
|
||||
|
|
||||
<?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> |
|
@ -1,507 +0,0 @@ |
|||||
<?php |
|
||||
error_reporting(E_ALL); |
|
||||
ini_set("display_errors", "On"); |
|
||||
$q = empty($_GET['q']) ? "" : $_GET['q']; |
|
||||
$qword = json_decode(base64_decode(pack("H*", $q))); |
|
||||
$user_id = $qword->user_id; |
|
||||
$apply_key = 'MB23060422'; |
|
||||
require_once './FormHelper.php'; |
|
||||
require_once './wf_common.php'; |
|
||||
#系统ID |
|
||||
$system_id = 'con'; |
|
||||
#流程ID |
|
||||
$flow_id = 'con01'; |
|
||||
#表单号 $form_id; |
|
||||
$form_id = ""; |
|
||||
|
|
||||
$wf = new WorkFlow($system_id, $flow_id, $form_id); |
|
||||
$wf->initWorkFlow($user_id); |
|
||||
|
|
||||
$form_key = $wf->flowContext->getFormKey(); |
|
||||
|
|
||||
#获取签核意见 |
|
||||
$assign_opinions = Assign::get_records($form_key); |
|
||||
|
|
||||
#会签部门意见 |
|
||||
$subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); |
|
||||
|
|
||||
$flowName = $wf->getFlowName(); |
|
||||
$assigner = $wf->getAssignerList(); |
|
||||
$assign_status = $wf->getAssignStatus($assigner); |
|
||||
$if_show_assign = true; |
|
||||
|
|
||||
#是否可会签 |
|
||||
$isSplitable = $wf->isSplitable(); |
|
||||
|
|
||||
//表单数据 |
|
||||
#客户表 |
|
||||
#1.电梯品牌选项 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_brand' order by convert(content using gbk) asc "; |
|
||||
$elevator_brand_opt = DB::result($sql); |
|
||||
#2.保养方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; |
|
||||
$maintain_kind_opt = DB::result($sql); |
|
||||
#3.电梯类型 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; |
|
||||
$elevator_kind_opt = DB::result($sql); |
|
||||
#4.付款方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='payment_kind'"; |
|
||||
$payment_kind_opt = DB::result($sql); |
|
||||
#5.合约性质 |
|
||||
$sql = "select code_name value ,content label from code where field_name='hope_contract_customer_kind'"; |
|
||||
$contract_kind_opt = DB::result($sql); |
|
||||
|
|
||||
#抓取有 |
|
||||
|
|
||||
$where = " and apply_key='$apply_key'"; |
|
||||
$sql = "SELECT * FROM con_maintance_examine_apply where 1=1 $where "; |
|
||||
$res_cmea = DB::result($sql); |
|
||||
$cmea = empty($res_cmea) ? [] : $res_cmea[0]; |
|
||||
#写入 con_maintance_review_apply |
|
||||
#获取评审单号 |
|
||||
//$cmea['payment_kind']; //付款方式 |
|
||||
//月付 12; 季付 三月一次;半年付 6个月一次, 年付 12个月 |
|
||||
// |
|
||||
$insert_data = [ |
|
||||
'apply_key' => $apply_key, |
|
||||
'vol_no' => $cmea['vol_no'], |
|
||||
'form_key' => $cmea, |
|
||||
'address' => $cmea['address'], |
|
||||
'case_name' => $cmea['case_name'], |
|
||||
'num' => $cmea['num'], |
|
||||
'brand' => $cmea['brand'], |
|
||||
'customer' => $hope_contract['customer'], |
|
||||
'salesman' => $hope_contract['salesman'], |
|
||||
'progress_remark' => $hope_contract['progress_remark'], |
|
||||
'platform_company' => empty(trim($hope_contract['common_platform_company'])) ? $hope_contract['sales_platform_company'] : $hope_contract['common_platform_company'], |
|
||||
'platforom_company_tel' => empty(trim($hope_contract['common_platform_tel'])) ? $hope_contract['sales_platform_tel'] : $hope_contract['common_platform_tel'] |
|
||||
|
|
||||
]; |
|
||||
//var_dump($insert_data); |
|
||||
DB::insert_table('con_maintance_examine_apply', $insert_data); |
|
||||
// $ins_sql="INSERT INTO `adm824727563_db`.`hope_contract_customer` (`vol_no`, `customer_kind`, `num`, `case_name`, `customer`, |
|
||||
// `salesman`, `address`, `lm_name`, `lm_tel`, `pre_order_date`, `order_rate`, `visit_date`, `progress_remark`, `common_platform_lm`, `common_platform_tel`, |
|
||||
// `common_platform_company`, `sales_platform_lm`, `sales_platform_tel`, `sales_platform_company`, `is_strategic_customer`, |
|
||||
// `strategic_customer`, `brand`, `partya_end_date`, `created_at`, `creator`, `updated_at`) VALUES ('Q2305047', '1', '47', '辰富佳苑', '上海新桃源物业管理有限公司', 'P0053', '松江广富林路3939弄', '周总', '13482376166', '2023-06-30 00:00:00', '中', '2023-05-23 18:13:05', '该物业为国有企业,本次 拜访物业沈经理引荐周总。经过与周总交流要求我司进行投标,今天进公司注册云采购账号,等公示后进一步了解如何投标再与周总会面细谈。', NULL, NULL, NULL, NULL, NULL, NULL, 'N', NULL, '永大', '2023-06-30 00:00:00', '2023-05-25 10:15:31', 'P0053', '2023-05-29 14:22:35'); |
|
||||
// "; |
|
||||
$table = 'con_maintance_examine_apply'; |
|
||||
#可编辑的列 |
|
||||
$editableColumn = [ |
|
||||
'apply_key' => [ |
|
||||
'label' => "评审单号", "value" => "$apply_key", "tag" => 'text', |
|
||||
'attr' => [ |
|
||||
'readonly=true ', |
|
||||
'class' => 'form-control form-control-sm' |
|
||||
] |
|
||||
], |
|
||||
'vol_no' => ['label' => "卷号", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
|
||||
//'form_key' => ['label' => "表单号", "value" => "", "tag" => 'text', 'attr'=>['class' => 'form-control form-control-sm' ]], |
|
||||
'address' => ['label' => "现场地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'case_name' => ['label' => "现场名称", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'brand' => ['label' => "电梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'num' => ['label' => "电梯台数", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'salesman' => ['label' => "营业员", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_kind' => ['label' => "保养方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], |
|
||||
'contract_begin_date' => ['label' => "合约期限开始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_end_date' => ['label' => "合约期限结束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'elevator_kind' => ['label' => "电梯类型", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], |
|
||||
'contract_kind' => ['label' => "合约性质", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], |
|
||||
'platform_company' => ['label' => "加盟公司名称", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
'platforom_company_tel' => ['label' => "加盟公司电话", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
'stand_price' => ['label' => "标准价格(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'contract_price' => ['label' => "合约报价(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'sold_price' => ['label' => "合约成交价(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
|
||||
'commission_expense' => ['label' => "加盟分成费(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'management_expense' => ['label' => "我司管理费(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'annual_survey_expense' => ['label' => "年检费用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'date form-control form-control-sm ']], |
|
||||
'service_expense' => ['label' => "服务费", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => ' form-control form-control-sm ']], |
|
||||
// 'postgress_remark' => ['label' => "洽商进度", "value" => "", "tag" => 'text', 'attr'=>['class' => 'form-control form-control-sm' ]] |
|
||||
|
|
||||
]; |
|
||||
$vol_no = empty($_GET['vol_no']) ? "" : $_GET['vol_no']; |
|
||||
$where = " and apply_key='$apply_key'"; |
|
||||
|
|
||||
$sql = "SELECT * FROM $table where 1=1 $where ORDER BY vol_no"; |
|
||||
$data = []; |
|
||||
$data = DB::result($sql); |
|
||||
|
|
||||
#电梯详细资料 |
|
||||
$con_maintance_examine_clear_columm = [ |
|
||||
'register_code' => ['label' => "电梯注册代码", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], |
|
||||
'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'spec' => ['label' => "规格型号", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm']], |
|
||||
'weight' => ['label' => "载重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'class' => 'form-control form-control-sm']], |
|
||||
'speed' => ['label' => "速度(m/s)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm']], |
|
||||
'stop' => ['label' => "停数", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], |
|
||||
'elevator_num' => ['label' => "台数", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], |
|
||||
'useful_years' => ['label' => "使用年限", "value" => "", "tag" => 'number', 'attr' => ['name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], |
|
||||
'last_check_date' => ['label' => "最近一次年检日期", "value" => "", "tag" => 'date', 'attr' => ['name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], |
|
||||
'speed_governors_check_expense' => ['label' => "限速器校验费", "value" => "", "tag" => 'number', 'attr' => ['name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
]; |
|
||||
$con_maintance_examine_clear = DB::result("SELECT " . implode(',', array_keys($con_maintance_examine_clear_columm)) . |
|
||||
" FROM con_maintance_examine_clear where 1=1 and apply_key='$apply_key' and cmstatus='Y' "); |
|
||||
$i = 0; |
|
||||
$cmecRow = " <tr>"; |
|
||||
foreach ($con_maintance_examine_clear_columm as $key => $val) { |
|
||||
$fieldVal = ""; |
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select('', $val['options'], $fieldVal, $val['attr']) |
|
||||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|
||||
// : "<input type='" . $val['tag'] . "' class=' form-control form-control-sm' " . $val['attr'] . " value='" . $fieldVal . "' name='${key}[]' id='$key' placeholder='请输入'>"; |
|
||||
$cmecRow .= "<td colspan='" . (empty($val['attr']['colspan']) ? '' : $val['attr']['colspan']) . "' ><div class=' col-12' > $_input</td>"; |
|
||||
} |
|
||||
$cmecRow .= "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md'>删除</button></td>"; |
|
||||
function base_url($url) |
|
||||
{ |
|
||||
return "https://web.platform-cn.com/static/" . $url; |
|
||||
} |
|
||||
function get_sequnece_no($seq_name = '', $p_yyyymm = '') |
|
||||
{ |
|
||||
|
|
||||
if (empty($p_yyyymm) || empty($seq_name)) return null; |
|
||||
#当前年月 |
|
||||
//echo "select yyyymm from sequence where seq_name='$seq_name' "; |
|
||||
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); |
|
||||
if ($p_yyyymm != $yyyymm) { |
|
||||
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); |
|
||||
} |
|
||||
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; |
|
||||
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring(nextval('$seq_name'),2)) seq_no "); |
|
||||
|
|
||||
|
|
||||
return $seq_no; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
?> |
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
||||
<html> |
|
||||
|
|
||||
<head> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf8" /> |
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
||||
<title> <?php echo $flowName; ?></title> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="https://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script> |
|
||||
<script src="https://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" /> |
|
||||
|
|
||||
<script type="text/javascript"> |
|
||||
$(document).ready(function() { |
|
||||
var tag_data; |
|
||||
$.ajax({ |
|
||||
url: 'https://web.platform-cn.com/fds/index.php/DesignFlow/get_assigner', |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
window.tag_data = data; |
|
||||
$('#selectPage').selectPage({ |
|
||||
showField: 'show_name', |
|
||||
keyField: 'val', |
|
||||
data: data, |
|
||||
multiple: true, |
|
||||
multipleControlbar: true, |
|
||||
pagination: false, |
|
||||
focusDropList: false |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
var assigner = eval('<?= json_encode($assigner) ?>'); |
|
||||
|
|
||||
var cmecRow = "<?= str_replace('"', '\'', $cmecRow) ?>"; |
|
||||
// $('#cmecTbody').append(cmecRow); |
|
||||
$('.sp_element_box').attr("disabled", true); |
|
||||
$("#assign_opinion").cleditor({ |
|
||||
height: 100, // height not including margins, borders or padding |
|
||||
controls: // controls to add to the toolbar |
|
||||
"bold italic underline strikethrough subscript superscript | font size " + |
|
||||
"style | color highlight removeformat | bullets numbering | outdent " + |
|
||||
"indent | alignleft center alignright justify | undo redo | " |
|
||||
}); |
|
||||
$('#assign_status').change(function() { |
|
||||
$("#next_users").empty(); |
|
||||
var _selected_status = $(this).children('option:selected').val(); //获取被选择的状态 |
|
||||
var _option_tmp = ""; //获取下拉列表 |
|
||||
for (a in assigner) { //遍历assigner |
|
||||
if (assigner[a][0] == _selected_status) { |
|
||||
_tmp = assigner[a][1].split(','); |
|
||||
for (var b in _tmp) { |
|
||||
if (_tmp[b] == '') { |
|
||||
continue; |
|
||||
} |
|
||||
_uname = _tmp[b].split('-')[1]; |
|
||||
_uid = _tmp[b].split('-')[0]; |
|
||||
/* console.log(_tmp[b]);*/ |
|
||||
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>'; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
$("#next_users").append(_option_tmp); |
|
||||
}); |
|
||||
$("#form").validate(); |
|
||||
|
|
||||
}); |
|
||||
addRow = function() { |
|
||||
var cmecRow = "<?= $cmecRow ?>"; |
|
||||
$('#cmecTbody').append(cmecRow); |
|
||||
} |
|
||||
delRow = function(btn) { |
|
||||
$(btn).parent().parent().remove(); |
|
||||
|
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
</head> |
|
||||
|
|
||||
<body> |
|
||||
|
|
||||
<div id="toolbarmenu"> |
|
||||
<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span> |
|
||||
<!-- 导航栏 --> |
|
||||
|
|
||||
<ul class="nav nav-tabs" role="tablist" id="tablist"> |
|
||||
<li class=" nav-item "> |
|
||||
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">签核表单</a> |
|
||||
</li> |
|
||||
|
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<!-- 导航栏 END--> |
|
||||
<div class="tab-content "> |
|
||||
|
|
||||
<div class="tab-pane active assign_content " id="tabassign"> |
|
||||
<form action="submit.php" id='form' method="post" style='width:98%;margin:0 auto'> |
|
||||
<!-- hidden域 --> |
|
||||
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' /> |
|
||||
<input type="hidden" value="" name="sheet_no" /> |
|
||||
<!--表单start--> |
|
||||
<div class=" form container-fluid pt-5"> |
|
||||
<div class="row form_head "> |
|
||||
<div class=" col-12 form_head_title "> |
|
||||
<h4> 保養合約價格審核單</h4> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="row " style='padding-top:30px;'> |
|
||||
<div class=" col-lg-12 form_row_header "> |
|
||||
<b>合约信息</b> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<?php |
|
||||
//一行显示三列 |
|
||||
$i = 0; |
|
||||
echo " <div class='row '>"; |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
$j = (($i++) % 4); |
|
||||
$fieldVal = empty($data) ? "" : $data[0][$key]; |
|
||||
|
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) |
|
||||
: FormHelper::text("$key", $fieldVal, $val['attr'], $val['tag']); |
|
||||
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "' |
|
||||
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='请输入'>"; |
|
||||
if ($i != 1 && $j == 0) { |
|
||||
echo " |
|
||||
</div> |
|
||||
<div class='row'> |
|
||||
"; |
|
||||
} |
|
||||
echo " <div class='col-1 form_field_title'> |
|
||||
" . $val['label'] . " |
|
||||
</div> |
|
||||
<div class=' col-2 form_field_content ' > |
|
||||
$_input |
|
||||
</div> |
|
||||
"; |
|
||||
} |
|
||||
echo "</div>"; |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>洽商进度</b> |
|
||||
</div> |
|
||||
<div class="col-12 " style="padding:0"> |
|
||||
|
|
||||
<textarea class='form-control textarea' id="progress_remark" name="progress_remark" value='12' rows='6'><?= $data[0]['progress_remark'] ?></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div id="elevator_list_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>电梯详细资料</b> |
|
||||
</div> |
|
||||
<table style='margin-top:0px;text-align:center' id='elevator_list'> |
|
||||
|
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan='15' ;><button onClick='addRow()' type="button" style='float:right' class="btn btn-link btn-md">+新增</button></td> |
|
||||
</tr> |
|
||||
<tr style='margin-top:0px;text-align:center'> |
|
||||
<?php |
|
||||
foreach ($con_maintance_examine_clear_columm as $val) { |
|
||||
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan']) ? 1 : $val['attr']['colspan']], $val['label']); |
|
||||
//echo "<th>" . $val['label'] . "</th>"; |
|
||||
} |
|
||||
echo "<th>操作</th>"; |
|
||||
?> |
|
||||
|
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody id='cmecTbody'> |
|
||||
<?php |
|
||||
foreach ($con_maintance_examine_clear as $key => $val) { |
|
||||
$cmecRow = " <tr>"; |
|
||||
foreach ($con_maintance_examine_clear_columm as $col => $col_def) { |
|
||||
$fieldVal = empty($val) ? "" : $val[$col]; |
|
||||
$_input = $col_def['tag'] == 'select' ? |
|
||||
FormHelper::select($col, $col_def['options'], $fieldVal, $col_def['attr']) |
|
||||
: FormHelper::text($col, $fieldVal, $col_def['attr'], $col_def['tag']); |
|
||||
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' : $col_def['attr']['colspan']) . "' ><div class=' col-12'> $_input</td>"; |
|
||||
} |
|
||||
echo $cmecRow . "<td><button onClick='delRow(this)' type='button' class='btn btn-link btn-md '>删除</button></td></tr>"; |
|
||||
} |
|
||||
?> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>签核操作</b> |
|
||||
</div> |
|
||||
<div class="col-12 col-3 form_field_content " style="padding:0"> |
|
||||
<textarea id="assign_opinion" name="assign_opinion" required></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class=" col-3 form_field_title"> |
|
||||
<b style='float:right'>签核状态</b> |
|
||||
</div> |
|
||||
<div class=" col-2 form_field_content "> |
|
||||
<select name="assign_status" id="assign_status" required class='form-control form-control form-control-sm '> |
|
||||
<?php echo $assign_status; ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
|
|
||||
<div class=" col-2 form_field_title"> |
|
||||
<b>下位签核者</b> |
|
||||
</div> |
|
||||
<div class="col-2 form_field_content"> |
|
||||
<select name="next_users" id="next_users" required class='form-control form-control-sm '></select> |
|
||||
|
|
||||
</div> |
|
||||
<div class="col-3 form_field_title "> |
|
||||
<button type="submit" class="btn btn-primary btn-sm" style='float:left'>提交</button> |
|
||||
</div> |
|
||||
|
|
||||
</div> |
|
||||
<div id="opinion_area " class="row form_comment "> |
|
||||
<div class='col-12 '> |
|
||||
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'> |
|
||||
<li class="active nav-item "> |
|
||||
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">签核意见</a> |
|
||||
</li> |
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<div class="tab-content col-12"> |
|
||||
<div role="tabpanel" class="tab-pane active" id="main_flow_assign"> |
|
||||
<?php |
|
||||
$assign_departs = array(); |
|
||||
foreach ($assign_opinions as $as) { |
|
||||
$assign_departs[$as['assign_depart']] = $as['assign_depart_name']; |
|
||||
} |
|
||||
?> |
|
||||
|
|
||||
<div class="comment_items "> |
|
||||
<?php $cnt = 1; |
|
||||
$tmp_code = "0"; |
|
||||
foreach ($assign_opinions as $as) { ?> |
|
||||
<div class="comment-item"> |
|
||||
|
|
||||
<!-- <div class="comment-title"> |
|
||||
<b>大 </b> |
|
||||
</div>--> |
|
||||
<?php |
|
||||
if (($as['flow_code']) != $tmp_code) |
|
||||
echo ' <div class="comment-title"> |
|
||||
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b> |
|
||||
</div>'; |
|
||||
$tmp_code = $as['flow_code']; |
|
||||
?> |
|
||||
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>"> |
|
||||
<div class="comment-content-header"> |
|
||||
<span> |
|
||||
|
|
||||
<strong> |
|
||||
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?> |
|
||||
|
|
||||
<?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> |
|
@ -1,577 +0,0 @@ |
|||||
<?php |
|
||||
// phpinfo(); |
|
||||
// exit; |
|
||||
#error_reporting(E_ALL); |
|
||||
|
|
||||
#ini_set("display_errors", "On"); |
|
||||
require_once '../header_nomenu.php'; |
|
||||
//echo $user_id; |
|
||||
$apply_key = ""; |
|
||||
$form_key = $_GET['form_key']; |
|
||||
$token = $_GET['token']; |
|
||||
|
|
||||
#$vol_no = $qword->vol_no; |
|
||||
require_once './FormHelper.php'; |
|
||||
require_once '../cont/MICalculator.php'; |
|
||||
|
|
||||
require_once './wf_common.php'; |
|
||||
$flow = new Flow($form_key); |
|
||||
// 當前節點簽核開始 |
|
||||
|
|
||||
$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $form_key); |
|
||||
#獲取簽核意見 |
|
||||
$assign_opinions = Assign::get_records($form_key); |
|
||||
$flowName = $wf->getFlowName(); |
|
||||
|
|
||||
//表單數據 |
|
||||
#客戶表 |
|
||||
#1.電梯品牌選項 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_brand'"; |
|
||||
$elevator_brand_opt = DB::result($sql); |
|
||||
#2.保養方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='maintain_kind'"; |
|
||||
$maintain_kind_opt = DB::result($sql); |
|
||||
#3.電梯類型 |
|
||||
$sql = "select code_name value ,content label from code where field_name='elevator_kind'"; |
|
||||
$elevator_kind_opt = DB::result($sql); |
|
||||
#4.付款方式 |
|
||||
$sql = "select code_name value ,content label from code where field_name='payment_kind'"; |
|
||||
$payment_kind_opt = DB::result($sql); |
|
||||
#5.契約性質 |
|
||||
$sql = "select code_name value ,content label from code where field_name='contract_kind'"; |
|
||||
$contract_kind_opt = DB::result($sql); |
|
||||
#6.是否贈送M1 |
|
||||
$is_m1_bundle_opt = [ |
|
||||
['label' => '是', 'value' => 'Y'], |
|
||||
['label' => '否', 'value' => 'N'] |
|
||||
]; |
|
||||
#7.機種 |
|
||||
$sql = "select code_name value ,content label from code where field_name='fp_kind'"; |
|
||||
$fp_kind_opt = DB::result($sql); |
|
||||
$table = 'con_maintance_examine_apply'; |
|
||||
#可編輯的列 |
|
||||
$editableColumn = [ |
|
||||
'apply_key' => [ |
|
||||
'label' => "評審單號", "value" => "$apply_key", "tag" => 'text', |
|
||||
'attr' => [ |
|
||||
'readonly=true ', |
|
||||
'class' => 'form-control form-control-sm' |
|
||||
] |
|
||||
], |
|
||||
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
|
||||
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'num' => ['label' => "數量", "value" => "", "tag" => 'number', 'attr' => ['required', 'min=1', 'class' => 'form-control form-control-sm']], |
|
||||
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $maintain_kind_opt], |
|
||||
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm'], 'options' => $contract_kind_opt], |
|
||||
'introducer' => ['label' => "介紹人", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
|
||||
|
|
||||
]; |
|
||||
$where = " and form_key='$form_key'"; |
|
||||
|
|
||||
$sql = "SELECT " . implode(',', array_keys($editableColumn)) . |
|
||||
" ,progress_remark FROM $table where 1=1 $where ORDER BY apply_key"; |
|
||||
|
|
||||
$data = []; |
|
||||
list($data) = DB::result($sql); |
|
||||
|
|
||||
#電梯詳細資料 |
|
||||
$con_maintance_examine_clear_columm = [ |
|
||||
'register_code' => ['label' => "電梯註冊代碼", "value" => "", "tag" => 'text', 'attr' => ['colspan' => 2, 'name' => 'register_code[]', 'class' => 'form-control form-control-sm']], |
|
||||
//'elevator_brand' => ['label' => "品牌", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'elevator_brand[]', 'class' => 'form-control form-control-sm'], 'options' => $elevator_brand_opt], |
|
||||
'elevator_kind' => ['label' => "電梯類型", "value" => "", "tag" => 'select', 'attr' => ['name' => 'elevator_kind[]', 'required', 'colspan' => 2, 'class' => 'form-control form-control-sm'], 'options' => $elevator_kind_opt], |
|
||||
'spec' => ['label' => "規格型號", "value" => "", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'spec[]', 'class' => 'form-control form-control-sm'], 'options' => $fp_kind_opt], |
|
||||
'weight' => ['label' => "載重(KG)", "value" => "", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'speed' => ['label' => "速度(m/min)", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed[]', 'min=0', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
//'stop' => ['label' => "停數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'class' => 'form-control form-control-sm']], |
|
||||
'floors' => ['label' => "層數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'floors[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'persons' => ['label' => "人乘", "value" => "", "tag" => 'number', 'attr' => ['name' => 'persons[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
'maintain_times' => ['label' => "保養次數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "value" => "", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
|
||||
|
|
||||
|
|
||||
// 'elevator_num' => ['label' => "臺數", "value" => "", "tag" => 'number', 'attr' => ['name' => 'brand_num[]', 'class' => 'form-control form-control-sm']], |
|
||||
'useful_years' => ['label' => "竣工檢查年度", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'required', 'name' => 'useful_years[]', 'class' => 'form-control form-control-sm']], |
|
||||
'last_check_date' => ['label' => "上次年檢日期", "value" => "", "tag" => 'date', 'attr' => ['required', 'name' => 'last_check_date[]', 'colspan' => 2, 'type' => 'date', 'class' => 'form-control form-control-sm']], |
|
||||
//'speed_governors_check_expense' => ['label' => "限速器校驗費", "value" => "", "tag" => 'number', 'attr' => ['colspan' => 2, 'name' => 'speed_governors_check_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
// 'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], |
|
||||
// 'commission_expense' => ['label' => "分成費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'commission_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
// 'management_expense' => ['label' => "管理費(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'management_expense[]', 'class' => 'form-control form-control-sm']], |
|
||||
//'annual_survey_expense' => ['label' => "年檢費用(元)", "value" => "", "tag" => 'number', 'attr' => ['required', 'name' => 'annual_survey_expense[]', 'colspan' => 2, 'class' => 'date form-control form-control-sm ']], |
|
||||
//'service_expense' => ['label' => "服務費", "value" => "", "tag" => 'text', 'attr' => ['required', 'name' => 'service_expense[]', 'class' => ' form-control form-control-sm ']], |
|
||||
'maintain_times' => ['label' => "保養次數", "tag" => 'number', 'attr' => ['name' => 'maintain_times[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_months' => ['label' => "保養月數", "tag" => 'number', 'attr' => ['name' => 'maintain_months[]', "value" => "12", 'min=12', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_period' => ['label' => "保養周期", "tag" => 'number', 'attr' => ['name' => 'maintain_period[]', "value" => "1", 'min=1', 'required', 'class' => 'form-control form-control-sm']], |
|
||||
'is_m1_bundle' => ['label' => "贈送M1", "value" => "", "tag" => 'select', 'attr' => ['name' => 'is_m1_bundle[]', 'required', 'class' => 'form-control form-control-sm'], 'options' => $is_m1_bundle_opt], |
|
||||
'stand_price' => ['label' => "標準價格(元/月)", "value" => "", "tag" => 'text', 'attr' => ['required', "readonly", 'colspan' => 2, 'name' => 'stand_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'contract_price' => ['label' => "契約報價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'contract_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'sold_price' => ['label' => "契約成交價(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
|
|
||||
'sold_price' => ['label' => "契約成交價C(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'sold_price[]', 'class' => 'form-control form-control-sm']], |
|
||||
'mi_cost' => ['label' => "標準成本D(元/月)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost[]', 'class' => 'form-control form-control-sm']], |
|
||||
'discount' => ['label' => "折扣率E(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'mi_cost_rate[]', 'class' => 'form-control form-control-sm']], |
|
||||
'gross_profit' => ['label' => "毛利率F(%)", "value" => "", "tag" => 'number', 'attr' => ['required', 'colspan' => 2, 'name' => 'gross_profit[]', 'class' => 'form-control form-control-sm']], |
|
||||
|
|
||||
]; |
|
||||
$con_maintance_examine_clear = DB::result("SELECT register_code, |
|
||||
f_return_content('elevator_brand',elevator_brand) elevator_brand, |
|
||||
f_return_content('maintain_elevator_kind',elevator_kind) elevator_kind, |
|
||||
elevator_kind con_elevator_kind, |
|
||||
spec, |
|
||||
weight, |
|
||||
speed, |
|
||||
floors, |
|
||||
persons, |
|
||||
maintain_times, |
|
||||
maintain_months, |
|
||||
maintain_period, |
|
||||
is_m1_bundle, |
|
||||
|
|
||||
useful_years, |
|
||||
last_check_date, |
|
||||
speed_governors_check_expense, |
|
||||
service_expense, |
|
||||
|
|
||||
stand_price, |
|
||||
contract_price, |
|
||||
sold_price, |
|
||||
0 mi_cost , |
|
||||
0 discount, |
|
||||
0 gross_profit |
|
||||
FROM |
|
||||
con_maintance_examine_clear |
|
||||
WHERE |
|
||||
1 = 1 |
|
||||
AND apply_key='" . $data['apply_key'] . "' and cmstatus='Y'"); |
|
||||
|
|
||||
#總臺數 |
|
||||
$count = count($con_maintance_examine_clear); |
|
||||
$total_sold_price = 0; |
|
||||
#總成交價 |
|
||||
#總標準價格 |
|
||||
$total_stand_price = 0; |
|
||||
#總標準成本 |
|
||||
foreach ($con_maintance_examine_clear as $val) { |
|
||||
$total_sold_price += $val['sold_price']; |
|
||||
$total_stand_price += $val['stand_price']; |
|
||||
} |
|
||||
$total_discount_rate = $total_sold_price == 0 ? 0 |
|
||||
: (100 * round($total_sold_price / $total_stand_price, 4)) . "%"; |
|
||||
|
|
||||
$wf->setFormData(['discount' => substr($total_discount_rate, 0, -1)]); |
|
||||
$assigner = $wf->getAssignerList(); |
|
||||
$assign_status = $wf->getAssignStatus($assigner); |
|
||||
|
|
||||
|
|
||||
function base_url($url) |
|
||||
{ |
|
||||
return "https://www.masada.com.tw/static/" . $url; |
|
||||
} |
|
||||
function get_sequnece_no($seq_name = '', $p_yyyymm = '') |
|
||||
{ |
|
||||
|
|
||||
if (empty($p_yyyymm) || empty($seq_name)) return null; |
|
||||
#當前年月 |
|
||||
//echo "select yyyymm from sequence where seq_name='$seq_name' "; |
|
||||
list($yyyymm, $prefix) = DB::fields("select yyyymm ,prefix from sequence where seq_name='$seq_name' "); |
|
||||
if ($p_yyyymm != $yyyymm) { |
|
||||
DB::query("update sequence set yyyymm='$p_yyyymm' , current_val='10000' where seq_name='$seq_name' "); |
|
||||
} |
|
||||
// echo "SELECT concat( $prefix,,substring(nextval('$seq_name'),2)) seq_no "; |
|
||||
list($seq_no) = DB::fields("SELECT concat( '$prefix','$p_yyyymm',substring(nextval('$seq_name'),2)) seq_no "); |
|
||||
|
|
||||
|
|
||||
return $seq_no; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
?> |
|
||||
|
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/jquery.cleditor.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('bootstrap4/css/bootstrap.min.css'); ?>" /> |
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/layui.css'); ?>" /> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery3.7.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/selectpage.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/jquery.cleditor.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('bootstrap4/js/bootstrap.min.js'); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/layui.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/wf_property.js?') . rand(10, 100); ?>"></script> |
|
||||
<script type="text/javascript" src="<?php echo base_url('js/flow_chart.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="<?php echo base_url('js/validate/jquery.validate.min.js?' . rand(10, 100)); ?>"></script> |
|
||||
<script src="<?php echo base_url('js/validate/messages_zh_TW.js?' . rand(10, 100)); ?>"></script> |
|
||||
|
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/form.css?') . rand(10, 100);; ?>" /> |
|
||||
|
|
||||
<script type="text/javascript"> |
|
||||
$(document).ready(function() { |
|
||||
var tag_data; |
|
||||
$.ajax({ |
|
||||
url: 'https://www.masada.com.tw/fds/index.php/DesignFlow/get_assigner', |
|
||||
type: 'post', |
|
||||
dataType: 'json', |
|
||||
success: function(data) { |
|
||||
window.tag_data = data; |
|
||||
$('#selectPage').selectPage({ |
|
||||
showField: 'show_name', |
|
||||
keyField: 'val', |
|
||||
data: data, |
|
||||
multiple: true, |
|
||||
multipleControlbar: true, |
|
||||
pagination: false, |
|
||||
focusDropList: false |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
|
|
||||
var assigner = eval('<?= json_encode($assigner) ?>'); |
|
||||
|
|
||||
$("#form").validate(); |
|
||||
|
|
||||
// $('#cmecTbody').append(cmecRow); |
|
||||
$('.sp_element_box').attr("disabled", true); |
|
||||
$("#assign_opinion").cleditor({ |
|
||||
height: 100, // height not including margins, borders or padding |
|
||||
controls: // controls to add to the toolbar |
|
||||
"bold italic underline strikethrough subscript superscript | font size " + |
|
||||
"style | color highlight removeformat | bullets numbering | outdent " + |
|
||||
"indent | alignleft center alignright justify | undo redo | " |
|
||||
}); |
|
||||
$('#assign_status').change(function() { |
|
||||
$("#next_users").empty(); |
|
||||
var _selected_status = $(this).children('option:selected').val(); //獲取被選擇的狀態 |
|
||||
var _option_tmp = ""; //獲取下拉列表 |
|
||||
for (a in assigner) { //遍曆assigner |
|
||||
if (assigner[a][0] == _selected_status) { |
|
||||
_tmp = assigner[a][1].split(','); |
|
||||
for (var b in _tmp) { |
|
||||
if (_tmp[b] == '') { |
|
||||
continue; |
|
||||
} |
|
||||
_uname = _tmp[b].split('-')[1]; |
|
||||
_uid = _tmp[b].split('-')[0]; |
|
||||
/* console.log(_tmp[b]);*/ |
|
||||
_option_tmp += '<option value=' + _uid + '>' + _tmp[b] + '</option>'; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
$("#next_users").append(_option_tmp); |
|
||||
}); |
|
||||
|
|
||||
}); |
|
||||
</script> |
|
||||
|
|
||||
</head> |
|
||||
|
|
||||
<body> |
|
||||
|
|
||||
<div id="toolbarmenu"> |
|
||||
<span id="objName" style="font-size:16px;margin-bottom:0px;margin-top:1px">流程:<?php echo $flowName; ?></span> |
|
||||
<!-- 導航欄 --> |
|
||||
|
|
||||
<ul class="nav nav-tabs" role="tablist" id="tablist"> |
|
||||
<li class=" nav-item "> |
|
||||
<a href="#tabassign" aria-controls="tabassign" role="tab" class=" active nav-link" data-toggle="tab">簽核表單</a> |
|
||||
</li> |
|
||||
|
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<!-- 導航欄 END--> |
|
||||
<div class="tab-content "> |
|
||||
|
|
||||
<div class="tab-pane active assign_content " id="tabassign"> |
|
||||
<form action="submit.php" method="post" id='form' style='width:98%;margin:0 auto'> |
|
||||
<!-- hidden域 --> |
|
||||
<input type="hidden" name="form_key" value='<?php echo $form_key; ?>' /> |
|
||||
<input type="hidden" name="apply_key" value='<?php echo $data['apply_key']; ?>' /> |
|
||||
<input type="hidden" name="token" value='<?php echo $token; ?>' /> |
|
||||
<input type="hidden" name="form_src" id="form_src"> |
|
||||
|
|
||||
<!--表單start--> |
|
||||
<div class=" form container-fluid pt-5"> |
|
||||
<div class="row form_head "> |
|
||||
<div class=" col-12 form_head_title "> |
|
||||
<h4> 保養契約價格審核單</h4> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<div class="row " style='padding-top:30px;'> |
|
||||
<div class=" col-lg-12 form_row_header "> |
|
||||
<b>契約信息</b> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<?php |
|
||||
//一行顯示三列 |
|
||||
$i = 0; |
|
||||
echo " <div class='row '>"; |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
$j = (($i++) % 4); |
|
||||
$fieldVal = empty($data) ? "" : $data[$key]; |
|
||||
|
|
||||
$_input = $val['tag'] == 'select' ? |
|
||||
FormHelper::select("$key", $val['options'], $fieldVal, $val['attr']) : |
|
||||
FormHelper::tag("label", $val['attr'], $fieldVal); |
|
||||
|
|
||||
//"<input type='" . $val['tag'] . "' class=' form-control form-control-sm " . $val['class'] . "' |
|
||||
// value='" . $fieldVal . "' name='$key' id='$key' placeholder='請輸入'>"; |
|
||||
if ($i != 1 && $j == 0) { |
|
||||
echo " |
|
||||
</div> |
|
||||
<div class='row'> |
|
||||
"; |
|
||||
} |
|
||||
echo " <div class='col-1 form_field_title'> |
|
||||
" . $val['label'] . " |
|
||||
</div> |
|
||||
<div class=' col-2 form_field_content ' > |
|
||||
$_input |
|
||||
</div> |
|
||||
"; |
|
||||
} |
|
||||
echo "</div>"; |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>洽商進度</b> |
|
||||
</div> |
|
||||
<div class="col-12 " style="padding:0"> |
|
||||
|
|
||||
<textarea class='form-control textarea' disabled id="progress_remark" name="progress_remark" value='12' rows='6'> <?php echo empty($data['progress_remark']) ? '' : $data['progress_remark'] ?> </textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div id="elevator_list_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>電梯詳細資料</b> |
|
||||
</div> |
|
||||
<table style='margin-top:0px;text-align:center' id='elevator_list'> |
|
||||
|
|
||||
<thead> |
|
||||
|
|
||||
<tr style='margin-top:0px;text-align:center'> |
|
||||
<?php |
|
||||
$j = 0; |
|
||||
foreach ($con_maintance_examine_clear_columm as $val) { |
|
||||
echo FormHelper::tag("th", ['colspan' => empty($val['attr']['colspan']) |
|
||||
? 1 : $val['attr']['colspan']], $val['label']); |
|
||||
|
|
||||
if ((++$j % 14) == 0) { |
|
||||
// if ($j == 12) echo "<th>操作</th>"; |
|
||||
|
|
||||
|
|
||||
echo "</tr><tr style='margin-top:0px;text-align:center'>"; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
</tr> |
|
||||
</thead> |
|
||||
<tbody id='cmecTbody'> |
|
||||
<?php |
|
||||
|
|
||||
$i = 0; |
|
||||
$tr_class = "odd"; |
|
||||
foreach ($con_maintance_examine_clear as $key => $val) { |
|
||||
$j = 0; |
|
||||
|
|
||||
$cmecRow = " <tr $i class='$tr_class'>"; |
|
||||
|
|
||||
foreach ($con_maintance_examine_clear_columm as $col => $col_def) { |
|
||||
$fieldVal = empty($val) ? "" : $val[$col]; |
|
||||
if ($col == 'mi_cost') { |
|
||||
$param = [ |
|
||||
'elevator_type' => $val['con_elevator_kind'], |
|
||||
'floors' => $val['floors'], |
|
||||
'speed' => $val['speed'], |
|
||||
'persons' => $val['persons'], |
|
||||
'weight' => $val['weight'], |
|
||||
'maintain_times' => $val['maintain_times'], |
|
||||
'maintain_months' => $val['maintain_months'], |
|
||||
'maintain_kind' => $data['maintain_kind'], |
|
||||
'maintain_period' => $val['maintain_period'], |
|
||||
'is_m1_bundle' => $val['is_m1_bundle'], |
|
||||
]; |
|
||||
$mic = new MICalculator(); |
|
||||
$res = $mic->cal($param); |
|
||||
#MI報價 |
|
||||
$con_maintance_examine_clear[$key]['mi_cost'] = $fieldVal = ($res['status'] |
|
||||
== 'ok' ? $res['price'] : $res['message']); |
|
||||
$con_maintance_examine_clear[$key]['gross_profit'] = $val['gross_profit'] = "/"; //$fieldVal==0?0: (round(($val['sold_price'] - $val['mi_cost']) / $fieldVal, 2) * 100) . "%" |
|
||||
#扣率 |
|
||||
$val['discount'] = (100 * round($val['sold_price'] / $val['stand_price'], 4)) . "%"; |
|
||||
} |
|
||||
|
|
||||
$_input = FormHelper::tag("label", ['colspan' => empty($col_def['attr']['colspan']) ? 1 |
|
||||
: $col_def['attr']['colspan']], $fieldVal); |
|
||||
$cmecRow .= "<td colspan='" . (empty($col_def['attr']['colspan']) ? '' |
|
||||
: $col_def['attr']['colspan']) . "' ><div class=' col-12'> $_input</td>"; |
|
||||
|
|
||||
$cmecRow = (++$j % 14 == 0) ? $cmecRow . "</tr ><tr $i class='$tr_class'>" : $cmecRow; |
|
||||
} |
|
||||
$tr_class = $tr_class == 'odd' ? "even" : "odd"; |
|
||||
echo $cmecRow . "</tr>"; |
|
||||
} |
|
||||
?> |
|
||||
</tbody> |
|
||||
<tfoot> |
|
||||
<?php |
|
||||
$total_mi_cost = 0; |
|
||||
foreach ($con_maintance_examine_clear as $val) { |
|
||||
$total_mi_cost += $val['mi_cost']; |
|
||||
} |
|
||||
?> |
|
||||
<tr> |
|
||||
<td colspan='20'> |
|
||||
<div style='float:right'> |
|
||||
|
|
||||
<label>合計成交價:<?= $count == 0 ? $count : $total_sold_price ?>; </label> |
|
||||
<label>合計成本:<?= $count == 0 ? $count : $total_mi_cost ?>; </label> |
|
||||
<label>折扣率(C/A):<?= $total_discount_rate ?>; </label> |
|
||||
<label>毛利率:/</label> |
|
||||
</div> |
|
||||
</td> |
|
||||
</tr> |
|
||||
</tfoot> |
|
||||
</table> |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
<div id="assign_area " class="row "> |
|
||||
<div class="col-12 form_row_header "> |
|
||||
<b>簽核意見</b> |
|
||||
</div> |
|
||||
|
|
||||
<div class="col-12 form_field_content " style="padding:0"> |
|
||||
<textarea id="assign_opinion" name="assign_opinion"></textarea> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class=" col-3 form_field_title"> |
|
||||
<b style='float:right'>簽核狀態</b> |
|
||||
</div> |
|
||||
<div class=" col-2 form_field_content "> |
|
||||
<select name="assign_status" id="assign_status" class='form-control form-control form-control-sm '> |
|
||||
<?php echo $assign_status; ?> |
|
||||
</select> |
|
||||
</div> |
|
||||
|
|
||||
<div class=" col-2 form_field_title"> |
|
||||
<b>下位簽核者</b> |
|
||||
</div> |
|
||||
<div class="col-2 form_field_content"> |
|
||||
<select name="next_users" id="next_users" class='form-control form-control-sm '></select> |
|
||||
|
|
||||
</div> |
|
||||
<div class="col-3 form_field_title "> |
|
||||
<button type="submit" name="btn_save" class="btn btn-primary btn-sm" value="tosign" style='float:left'>提交</button> |
|
||||
</div> |
|
||||
|
|
||||
</div> |
|
||||
<div id="opinion_area " class="row form_comment "> |
|
||||
<div class='col-12 '> |
|
||||
<ul class=" form-control-md nav nav-tabs" role="tablist" style='line-height:20px'> |
|
||||
<li class="active nav-item "> |
|
||||
<a href="#main_flow_assign" aria-controls="main_flow_assign" role="tab" class=" active nav-link" role="tab" data-toggle="tab">簽核意見</a> |
|
||||
</li> |
|
||||
|
|
||||
</ul> |
|
||||
</div> |
|
||||
<div class="tab-content col-12"> |
|
||||
<div role="tabpanel" class="tab-pane active" id="main_flow_assign"> |
|
||||
<?php |
|
||||
$assign_departs = array(); |
|
||||
foreach ($assign_opinions as $as) { |
|
||||
$assign_departs[$as['assign_depart']] = $as['assign_depart_name']; |
|
||||
} |
|
||||
?> |
|
||||
|
|
||||
<div class="comment_items "> |
|
||||
<?php $cnt = 1; |
|
||||
$tmp_code = "0"; |
|
||||
foreach ($assign_opinions as $as) { ?> |
|
||||
<div class="comment-item"> |
|
||||
|
|
||||
<!-- <div class="comment-title"> |
|
||||
<b>大 </b> |
|
||||
</div>--> |
|
||||
<?php |
|
||||
if (($as['flow_code']) != $tmp_code) |
|
||||
echo ' <div class="comment-title"> |
|
||||
<b>' . $wf->getNodeDescriptions($as['flow_code']) . '</b> |
|
||||
</div>'; |
|
||||
$tmp_code = $as['flow_code']; |
|
||||
?> |
|
||||
<div class="comment-content <?php if ($cnt++ % 2 == 0) echo "comment-odd" ?>"> |
|
||||
<div class="comment-content-header"> |
|
||||
<span> |
|
||||
|
|
||||
<strong> |
|
||||
<?php echo Employee::get_employee($as['assigner'], 'name-employee_no') ?> |
|
||||
|
|
||||
<?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> |
|
@ -1,225 +0,0 @@ |
|||||
<?php |
|
||||
require_once "../header.php"; |
|
||||
// 載入db.php來連結資料庫 |
|
||||
|
|
||||
$table = 'con_maintance_examine_apply'; |
|
||||
// 待我簽核進入 |
|
||||
if (!empty($_GET['system_id']) && !empty($_GET['flow_id'])) { |
|
||||
$system_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['system_id'] : @$_POST['system_id']; |
|
||||
$where_system_id = " and a.system_id like '" . $system_id . "%'"; |
|
||||
|
|
||||
$flow_id = $_SERVER['REQUEST_METHOD'] == 'GET' ? @$_GET['flow_id'] : @$_POST['flow_id']; |
|
||||
$where_flow_id = " and b.flow_id like '" . $flow_id . "%'"; |
|
||||
|
|
||||
$sql_get = "SELECT d.form_id,c.form_key, a.system_id,b.flow_id ,a.system_name,c.current_assigner, |
|
||||
concat(c.current_assigner ,'-',f_return_name(c.current_assigner)) current_assigner_name , |
|
||||
flow_name,c.update_date ,c.create_date,b.path,d.flow_code FROM system_main a,flow_main b ,subflow |
|
||||
c,flow d |
|
||||
WHERE a.system_id=b.system_id |
|
||||
AND b.flow_id=d.flow_id |
|
||||
AND c.current_assigner='$user_id' |
|
||||
AND d.flow_id=b.flow_id |
|
||||
AND c.form_key=d.form_key |
|
||||
$where_system_id |
|
||||
$where_flow_id |
|
||||
"; |
|
||||
// echo '<pre>'; |
|
||||
// print_r($sql_get); |
|
||||
// echo '</pre>'; |
|
||||
|
|
||||
$result = mysqli_query($link, $sql_get); |
|
||||
if ($result == false) { |
|
||||
die(mysqli_error($link)); |
|
||||
} |
|
||||
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); |
|
||||
|
|
||||
|
|
||||
foreach ($res_get as $key => $data) { |
|
||||
// 結案隱藏 |
|
||||
if ($data['flow_code'] !== 'Z') { |
|
||||
$test = $data['form_key']; |
|
||||
// $sql = "SELECT mid FROM pricereview_sign WHERE id = $test"; |
|
||||
// $result = mysqli_fetch_all(mysqli_query($link, $sql), MYSQLI_ASSOC); |
|
||||
// echo '<pre>'; |
|
||||
// print_r($result); |
|
||||
// echo '</pre>'; |
|
||||
$id[] = $test; |
|
||||
} |
|
||||
} |
|
||||
$inClause = implode(',', $id); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
#可編輯的列 |
|
||||
$editableColumn = [ |
|
||||
'apply_key' => [ |
|
||||
'label' => "評審單號", "value" => "", "tag" => 'text', |
|
||||
'attr' => [ |
|
||||
'readonly=true ', |
|
||||
'class' => 'form-control form-control-sm' |
|
||||
] |
|
||||
], |
|
||||
'vol_no' => ['label' => "卷號", "value" => "", "tag" => 'text', 'attr' => ['readonly=true ', 'class' => 'form-control form-control-sm']], |
|
||||
'address' => ['label' => "現場地址", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'case_name' => ['label' => "現場名稱", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'brand' => ['label' => "電梯品牌", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'num' => ['label' => "電梯臺數", "value" => "", "tag" => 'number', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'salesman' => ['label' => "營業員", "value" => "", "tag" => 'text', 'attr' => ['required', 'class' => 'form-control form-control-sm']], |
|
||||
'maintain_kind' => ['label' => "保養方式", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
'contract_begin_date' => ['label' => "契約期限開始", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_end_date' => ['label' => "契約期限結束", "value" => "", "tag" => 'date', 'attr' => ['required', 'class' => 'date form-control form-control-sm']], |
|
||||
'contract_kind' => ['label' => "契約性質", "value" => "", "tag" => 'select', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
'platform_company' => ['label' => "加盟公司名稱", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
'platforom_company_tel' => ['label' => "加盟公司電話", "value" => "", "tag" => 'text', 'attr' => ['class' => 'form-control form-control-sm']], |
|
||||
//'payment_kind' => ['label' => "付款方式", "value" => "", "tag" => 'select', 'attr' => ['required', 'class' => 'form-control form-control-sm'], 'options' => $payment_kind_opt], |
|
||||
|
|
||||
]; |
|
||||
// 設置一個空陣列來放資料 |
|
||||
$data = array(); |
|
||||
|
|
||||
$salesman = empty($_GET['salesman']) ? $user_id : $_GET['salesman']; |
|
||||
//$where = " and salesman like '%'"; |
|
||||
$where = " and salesman = '$salesman'"; |
|
||||
|
|
||||
// 可瀏覽全部資料的部門 |
|
||||
$depart_arr = ["220"]; |
|
||||
$sql = "select department_id from account where accountid = '$user_id'"; |
|
||||
$res = mysqli_query($link, $sql); |
|
||||
$row = mysqli_fetch_row($res); |
|
||||
$user_department_id = $row[0]; |
|
||||
mysqli_free_result($res); |
|
||||
if (in_array($user_department_id, $depart_arr) || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0006" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04") $where = ""; |
|
||||
|
|
||||
// 電梯廠牌 |
|
||||
$elevator_brand_arr = []; |
|
||||
$sql = "select code_name ,content from code where field_name='elevator_brand'"; |
|
||||
$res = mysqli_query($link, $sql); |
|
||||
while ($row = mysqli_fetch_row($res)) { |
|
||||
$elevator_brand_arr[$row[0]] = $row[1]; |
|
||||
} |
|
||||
mysqli_free_result($res); |
|
||||
if (!empty($res_get)) { |
|
||||
$sql = "SELECT |
|
||||
apply_key, |
|
||||
vol_no, |
|
||||
address, |
|
||||
case_name, |
|
||||
brand , |
|
||||
num , |
|
||||
f_return_name(salesman) salesman, |
|
||||
f_return_content('maintain_kind',maintain_kind ) maintain_kind, |
|
||||
date_format(contract_begin_date,'%Y/%m/%d') contract_begin_date, |
|
||||
date_format(contract_end_date,'%Y/%m/%d') contract_end_date , |
|
||||
f_return_content('contract_kind',contract_kind ) contract_kind, |
|
||||
platform_company, |
|
||||
platforom_company_tel, |
|
||||
form_key, |
|
||||
|
|
||||
f_return_content('payment_kind',payment_kind ) payment_kind FROM $table WHERE form_key IN ($inClause) "; |
|
||||
} else { |
|
||||
$sql = "SELECT |
|
||||
apply_key, |
|
||||
vol_no, |
|
||||
address, |
|
||||
case_name, |
|
||||
brand , |
|
||||
num , |
|
||||
f_return_name(salesman) salesman, |
|
||||
f_return_content('maintain_kind',maintain_kind ) maintain_kind, |
|
||||
date_format(contract_begin_date,'%Y/%m/%d') contract_begin_date, |
|
||||
date_format(contract_end_date,'%Y/%m/%d') contract_end_date , |
|
||||
f_return_content('contract_kind',contract_kind ) contract_kind, |
|
||||
platform_company, |
|
||||
platforom_company_tel, |
|
||||
form_key, |
|
||||
|
|
||||
f_return_content('payment_kind',payment_kind ) payment_kind FROM $table |
|
||||
where 1=1 $where ORDER BY vol_no"; |
|
||||
} |
|
||||
// echo $sql; |
|
||||
$data = mysqli_query($link, $sql); |
|
||||
// echo '<pre>'; |
|
||||
// print_r($data); |
|
||||
// echo '</pre>'; |
|
||||
?> |
|
||||
|
|
||||
<?php |
|
||||
|
|
||||
if ($data) : |
|
||||
|
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|
||||
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) { |
|
||||
echo "<p class='error'>Please fill up the required field!</p>"; |
|
||||
} else { |
|
||||
header("Location:repair-index.php"); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
?> |
|
||||
<link rel="stylesheet" href="common.css"> |
|
||||
|
|
||||
<div style="overflow-x:auto;"> |
|
||||
<form method='get' action='#'> |
|
||||
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'> |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<td colspan="8"> |
|
||||
<h3 style='text-align:center'>(契約)價審單查詢</h3> |
|
||||
</td> |
|
||||
</tr> |
|
||||
|
|
||||
</thead> |
|
||||
|
|
||||
</table> |
|
||||
<table id="table_index" class="table table-striped table-bordered" style="width:98%"> |
|
||||
<thead> |
|
||||
<?php |
|
||||
echo "<tr>"; |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
|
|
||||
echo "<th>" . $val['label'] . "</th>"; |
|
||||
} |
|
||||
echo "<th>是否結案</th>"; |
|
||||
// echo "<th>刪除</th>"; |
|
||||
echo "</tr>"; |
|
||||
?> |
|
||||
</thead> |
|
||||
<tbody> |
|
||||
<?php foreach ($data as $row) : ?> |
|
||||
<tr> |
|
||||
<?php |
|
||||
foreach ($editableColumn as $key => $val) { |
|
||||
if ($key == 'apply_key') { |
|
||||
echo "<td> <a href='query_form.php?apply_key=$row[$key]&token=" . $_GET['token'] . "'>" . $row[$key] . "</td>"; |
|
||||
} elseif ($key == 'brand') { |
|
||||
echo "<td>" . (!empty($row[$key]) ? $elevator_brand_arr[$row[$key]] : "") . "</td>"; |
|
||||
} else { |
|
||||
echo "<td>" . $row[$key] . "</td>"; |
|
||||
} |
|
||||
} |
|
||||
//list($signer)=DB::fields("); |
|
||||
//echo " select f_return_name(current_assigner) signer from subflow where form_key='". $row['form_key'] ."'"; ". (is_array($row['form_key'])?'': $row['form_key']) ." |
|
||||
list($signer) = mysqli_fetch_array(mysqli_query($link, "select max(f_return_name(current_assigner) ) signer from subflow where form_key='" . $row['form_key'] . "'")); |
|
||||
|
|
||||
echo "<td>" . (empty($signer) ? "結案" : "N") . "</td>"; |
|
||||
|
|
||||
?> |
|
||||
|
|
||||
</tr> |
|
||||
<?php endforeach; ?> |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
|
|
||||
<?php |
|
||||
|
|
||||
else : |
|
||||
echo "<h2>There is no record!</h2>"; |
|
||||
endif; |
|
||||
|
|
||||
#代表結束連線 |
|
||||
mysqli_close($link); |
|
||||
|
|
||||
include "../footer.php"; |
|
||||
|
|
||||
?> |
|
@ -1,79 +0,0 @@ |
|||||
<?php |
|
||||
//require_once "../database.php"; |
|
||||
require_once './wf_common.php'; |
|
||||
require_once './model/ConMaintanceExamineApplyModel.php'; |
|
||||
require_once './model/ConMaintanceExamineClearModel.php'; |
|
||||
$request = $_SERVER['REQUEST_METHOD'] == "GET" ? $_GET : $_POST; |
|
||||
// print_r($request); |
|
||||
// exit; |
|
||||
$tosign = ($request["btn_save"] == "tosign") ? 1 : 0; // 1:提交 |
|
||||
|
|
||||
if ($request["form_src"] == "apply_form" && $tosign && (!isset($request["register_code"]) || empty($request["register_code"][0]) || !isset($request["next_users"]) || empty($request["next_users"]))) { |
|
||||
echo "<script type = 'text/JavaScript'>"; |
|
||||
echo "alert('請確認電梯資料或未選擇下位簽核者!');"; |
|
||||
echo "history.go(-1);"; |
|
||||
echo "</script>"; |
|
||||
exit; |
|
||||
} |
|
||||
|
|
||||
//更新表单ConMaintanceExamineApplyModel |
|
||||
$cmea = new ConMaintanceExamineApplyModel(); |
|
||||
$apply_key = $request['apply_key']; |
|
||||
$cmea->update(['apply_key', $apply_key], array_diff_key($request, ['apply_key' => ''])); |
|
||||
//更新电梯列表 |
|
||||
if (!empty($request["reg_del"])) { |
|
||||
$register_code_del_arr = explode(",", rtrim($request["reg_del"], ",")); |
|
||||
foreach ($register_code_del_arr as $val) { |
|
||||
$sql = "UPDATE con_maintance_examine_clear SET cmstatus = 'D' WHERE apply_key = '$apply_key' AND register_code = '$val' AND cmstatus <> 'D'"; |
|
||||
DB::query($sql); |
|
||||
} |
|
||||
} |
|
||||
if (!empty($request['register_code']) && count($request['register_code']) > 0) { |
|
||||
$cmec = new ConMaintanceExamineClearModel(); |
|
||||
for ($i = 0; $i < count($request['register_code']); $i++) { |
|
||||
$data = [ |
|
||||
'apply_key' => $request['apply_key'] |
|
||||
]; |
|
||||
$cols = array_diff($cmec->fillable, ['apply_key']); |
|
||||
foreach ($cols as $col) { |
|
||||
$data[$col] = empty($request[$col][$i]) ? '' : $request[$col][$i]; |
|
||||
if ($col == "annual_survey_expense") $data[$col] = '0.00'; |
|
||||
} |
|
||||
$cmec->create($data); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//var_dump($_POST); |
|
||||
//var_dump($_GET); |
|
||||
|
|
||||
if ($tosign) { |
|
||||
#流程开始,var_dump($request); |
|
||||
$flow = new Flow($request['form_key']); |
|
||||
// 当前节点签核开始 |
|
||||
$wf = new WorkFlow($flow->system_id, $flow->flow_id, $flow->form_id, $request['form_key']); |
|
||||
$wf->setFormData($request); |
|
||||
$wf->submit($request['next_users'], $request['assign_status'], $request['assign_opinion']); |
|
||||
//当前节点签核结束 |
|
||||
$responses['flowName'] = $wf->getFlowName(); |
|
||||
$responses['form_key'] = $request['form_key']; |
|
||||
//var_dump($request); |
|
||||
#結案發通知給營業員 |
|
||||
if ($request['assign_status'] == 'F4') { |
|
||||
|
|
||||
list($salesman, $case_name) = DB::fields("select salesman ,case_name from con_maintance_examine_apply where apply_key='" . $apply_key . "' "); |
|
||||
$ins_notice_sql = "INSERT INTO `notice` ( `kind`,`title`, `content`, `permission`) |
|
||||
VALUES ( '1', '契約價審單結案通知(" . $case_name . ")', '契約價審單結案通知(" . $case_name . ")', ' $salesman')"; |
|
||||
DB::query($ins_notice_sql); |
|
||||
// echo $ins_notice_sql; |
|
||||
} |
|
||||
} |
|
||||
echo "<script type = 'text/JavaScript'>"; |
|
||||
//echo "<h4 style='text-align:center'>成功提交<a href='https://www.masada.com.tw/wms/sign/list.php?function_name=show&token=" . $request['token'] . "'>返回待签 </a></h4>"; |
|
||||
if ($tosign) { |
|
||||
echo "alert('成功提交');"; |
|
||||
echo "location.href='../wms/index.php.php?function_name=sign_list&token=" . $request['token'] . "';"; |
|
||||
} else { |
|
||||
echo "alert('資料已保存');"; |
|
||||
echo "location.href='../crm/crmm02-index.php?function_name=contract_customer&token=" . $request['token'] . "';"; |
|
||||
} |
|
||||
echo "</script>"; |
|
@ -1 +0,0 @@ |
|||||
<h4 style='text-align:center'>成功提交<a href='https://crm.platform-cn.com/pqm/pqmm01'>返回待签 </a></h4> |
|
@ -1,84 +0,0 @@ |
|||||
<?php |
|
||||
error_reporting(E_ALL); |
|
||||
ini_set('dispaly_errors', "On"); |
|
||||
require_once './MSCalculator.php'; |
|
||||
|
|
||||
|
|
||||
//客梯 |
|
||||
$param = [ |
|
||||
|
|
||||
'elevator_type' => 'A', |
|
||||
'floors' => 7, |
|
||||
'speed' => 1, |
|
||||
'persons' => 6, |
|
||||
'weight' => 1000, |
|
||||
'maintain_times' => 1, |
|
||||
'maintain_months' => 12, |
|
||||
'maintain_kind' => 2, |
|
||||
'maintain_period' => 1, //默认为1月1次, 2是为2月一次 |
|
||||
'is_m1_bundle' => 'N', |
|
||||
]; |
|
||||
|
|
||||
//货梯 |
|
||||
$param = [ |
|
||||
|
|
||||
'elevator_type' => 'B', |
|
||||
'floors' => 7, |
|
||||
'speed' => 1, |
|
||||
'persons' => 6, |
|
||||
'weight' => 1000, |
|
||||
'maintain_times' => 1, |
|
||||
'maintain_months' => 12, |
|
||||
'maintain_kind' => 2, |
|
||||
'maintain_period' => 1, //默认为1月1次, 2是为2月一次 |
|
||||
'is_m1_bundle' => 'N', |
|
||||
]; |
|
||||
|
|
||||
|
|
||||
//病床梯 |
|
||||
$param = [ |
|
||||
|
|
||||
'elevator_type' => 'C', |
|
||||
'floors' => 28, |
|
||||
'speed' => 1, |
|
||||
'persons' => 6, |
|
||||
'weight' => 1000, |
|
||||
'maintain_times' => 2, //病床梯一月2次保养 |
|
||||
'maintain_months' => 12, |
|
||||
'maintain_kind' => 2, |
|
||||
'maintain_period' => 1, //默认为1月1次, 2是为2月一次 |
|
||||
'is_m1_bundle' => 'N', |
|
||||
]; |
|
||||
|
|
||||
//无机房 |
|
||||
$param = [ |
|
||||
'elevator_type' => 'D', |
|
||||
'floors' => 3, |
|
||||
'speed' => 1, |
|
||||
'persons' => 6, |
|
||||
'weight' => 1000, |
|
||||
'maintain_times' => 1, //病床梯一月2次保养 |
|
||||
'maintain_months' => 12, |
|
||||
'maintain_kind' => 3, |
|
||||
'maintain_period' => 1, //默认为1月1次, 2是为2月一次 |
|
||||
'is_m1_bundle' => 'N', |
|
||||
]; |
|
||||
|
|
||||
|
|
||||
//家用梯 |
|
||||
$param = [ |
|
||||
'elevator_type' => 'E', |
|
||||
'floors' => 3, |
|
||||
'speed' => 1, |
|
||||
'persons' => 6, |
|
||||
'weight' => 1000, |
|
||||
'maintain_times' => 1, //病床梯一月2次保养 |
|
||||
'maintain_months' => 60, |
|
||||
'maintain_kind' => 2, |
|
||||
'maintain_period' => 1, //默认为1月1次, 2是为2月一次 |
|
||||
'is_m1_bundle' => 'Y', |
|
||||
]; |
|
||||
|
|
||||
$mic = new MSCalculator(); |
|
||||
$price = $mic->cal($_GET); |
|
||||
echo json_encode($price); |
|
@ -1,174 +0,0 @@ |
|||||
<?php |
|
||||
require_once './wf_common.php'; |
|
||||
|
|
||||
|
|
||||
#遍历所有大区 |
|
||||
$yyyymm = '202306'; |
|
||||
$res_regions = DB::result("select code_name,content from code where field_name='regions' "); |
|
||||
$region_data = []; |
|
||||
#遍历所有大区 |
|
||||
foreach ($res_regions as $regions) { |
|
||||
echo $regions['code_name']; |
|
||||
$region_data[$regions['code_name']] = [ |
|
||||
'depart_name' => $regions['content'], |
|
||||
#当月件数 |
|
||||
'd_item_cnt' => 0, |
|
||||
#当月台数 |
|
||||
'd_mfg_cnt' => 0, |
|
||||
#直销件数 |
|
||||
'z_item_cnt' => 0, |
|
||||
#直销台数 |
|
||||
'z_mfg_cnt' => 0, |
|
||||
#平台件数 |
|
||||
'p_item_cnt' => 0, |
|
||||
#平台台数 |
|
||||
'p_mfg_cnt' => 0, |
|
||||
#台数合计 |
|
||||
'mfg_total' => 0, |
|
||||
#件数合计 |
|
||||
'item_total' => 0, |
|
||||
#营业人数 |
|
||||
'persons' => 0, |
|
||||
#人均台数 |
|
||||
'avg_mfg_total' => 0, |
|
||||
#人均件数 |
|
||||
'avg_item_total' => 0, |
|
||||
]; |
|
||||
#遍历大区下面所有分公司 |
|
||||
$res_branch = DB::result("select depart_no,depart_name from depart where regions='" . $regions['code_name'] . "' "); |
|
||||
foreach ($res_branch as $branch) { |
|
||||
#遍历分公司下面所有人 |
|
||||
$depart_data = []; |
|
||||
$res_salesman = DB::result("select employee_no,name from employee |
|
||||
where depart_no='" . $branch['depart_no'] . "' "); |
|
||||
$depart_data = [ |
|
||||
'depart_name' => $branch['depart_name'], |
|
||||
|
|
||||
]; |
|
||||
foreach ($res_salesman as $salesman) { |
|
||||
//当月预定成交台数 件数 |
|
||||
$d_item_cnt = $d_mfg_cnt = $z_item_cnt = $z_mfg_cnt = $p_item_cnt = $p_mfg_cnt = 0; |
|
||||
list($d_item_cnt, $d_mfg_cnt) = DB::fields("select count(vol_no) item_cnt ,sum(num) mfg_cnt |
|
||||
From hope_contract_customer where salesman='" . $salesman['employee_no'] . "' |
|
||||
and pre_order_date between DATE_FORMAT(concat('$yyyymm','01'),'%Y-%m-%d') |
|
||||
and LAST_DAY(STR_TO_DATE('$yyyymm', '%Y%m'))"); |
|
||||
// 直销 台数 件数 |
|
||||
list($z_item_cnt, $z_mfg_cnt) = DB::fields("select count(vol_no) z_item_cnt ,sum(num) |
|
||||
z_mfg_cnt From hope_contract_customer where salesman=''" . $salesman['employee_no'] . "' |
|
||||
and customer_kind='1'"); |
|
||||
// 平台 台数 件数 |
|
||||
list($p_item_cnt, $p_mfg_cnt) = DB::fields("select count(vol_no) p_item_cnt ,sum(num) |
|
||||
p_mfg_cnt From hope_contract_customer where salesman='" . $salesman['employee_no'] . "' |
|
||||
and customer_kind!='1' |
|
||||
"); |
|
||||
#当月件数 |
|
||||
$d_item_cnt = empty($d_item_cnt) ? 0 : $d_item_cnt; |
|
||||
#当月台数 |
|
||||
$d_mfg_cnt = empty($d_mfg_cnt) ? 0 : $d_mfg_cnt; |
|
||||
#直销件数 |
|
||||
$z_item_cnt = empty($z_item_cnt) ? 0 : $z_item_cnt; |
|
||||
#直销台数 |
|
||||
$z_mfg_cnt = empty($z_mfg_cnt) ? 0 : $z_mfg_cnt; |
|
||||
#平台件数 |
|
||||
$p_item_cnt = empty($p_item_cnt) ? 0 : $p_item_cnt; |
|
||||
#平台台数 |
|
||||
$p_mfg_cnt = empty($p_mfg_cnt) ? 0 : $p_mfg_cnt; |
|
||||
#台数合计 |
|
||||
$mfg_total = $z_mfg_cnt + $p_mfg_cnt; |
|
||||
#件数合计 |
|
||||
$item_total = $z_item_cnt + $p_item_cnt; |
|
||||
#营业人数 |
|
||||
$persons = 1; |
|
||||
#人均台数 |
|
||||
$avg_mfg_total = $z_mfg_cnt + $p_mfg_cnt; |
|
||||
#人均件数 |
|
||||
$avg_item_total = $z_item_cnt + $p_item_cnt; |
|
||||
|
|
||||
#部门数据 |
|
||||
$depart_data = [ |
|
||||
#当月件数 |
|
||||
'd_item_cnt' => $depart_data['d_item_cnt'] + $d_item_cnt, |
|
||||
#当月台数 |
|
||||
'd_mfg_cnt' => $depart_data['d_mfg_cnt'] + $d_mfg_cnt, |
|
||||
#直销件数 |
|
||||
'z_item_cnt' => $depart_data['z_item_cnt'] + $z_item_cnt, |
|
||||
#直销台数 |
|
||||
'z_mfg_cnt' => $depart_data['z_mfg_cnt'] + $z_mfg_cnt, |
|
||||
#平台件数 |
|
||||
'p_item_cnt' => $depart_data['p_item_cnt'] + $p_item_cnt, |
|
||||
#平台台数 |
|
||||
'p_mfg_cnt' => $depart_data['p_mfg_cnt'] + $p_mfg_cnt, |
|
||||
#台数合计 |
|
||||
'mfg_total' => $depart_data['mfg_total'] + $mfg_total, |
|
||||
#件数合计 |
|
||||
'item_total' => $depart_data['item_total'] + $item_total, |
|
||||
#营业人数 |
|
||||
'persons' => $depart_data['persons'] + $persons, |
|
||||
#人均台数 $z_mfg_cnt + $p_mfg_cnt |
|
||||
'avg_mfg_total' => ($depart_data['z_mfg_cnt'] + $z_mfg_cnt) / ($depart_data['persons'] + $persons), |
|
||||
#人均件数 |
|
||||
'avg_item_total' => ($depart_data['z_item_cnt'] + $z_item_cnt) / ($depart_data['persons'] + $persons) |
|
||||
]; |
|
||||
|
|
||||
|
|
||||
$region_data[$regions['code_name']] = [ |
|
||||
#当月件数 |
|
||||
'd_item_cnt' => $region_data[$regions['code_name']]['d_item_cnt'] + $depart_data['d_item_cnt'], |
|
||||
#当月台数 |
|
||||
'd_mfg_cnt' => $region_data[$regions['code_name']]['d_mfg_cnt'] + $depart_data['d_mfg_cnt'], |
|
||||
#直销件数 |
|
||||
'z_item_cnt' => $region_data[$regions['code_name']]['z_item_cnt'] + $depart_data['z_item_cnt'], |
|
||||
#直销台数 |
|
||||
'z_mfg_cnt' => $region_data[$regions['code_name']]['z_mfg_cnt'] + $depart_data['z_mfg_cnt'], |
|
||||
#平台件数 |
|
||||
'p_item_cnt' => $region_data[$regions['code_name']]['p_item_cnt'] + $depart_data['p_item_cnt'], |
|
||||
#平台台数 |
|
||||
'p_mfg_cnt' => $region_data[$regions['code_name']]['p_mfg_cnt'] + $depart_data['p_mfg_cnt'], |
|
||||
#台数合计 |
|
||||
'mfg_total' => $region_data[$regions['code_name']]['mfg_total'] + $depart_data['mfg_total'], |
|
||||
#件数合计 |
|
||||
'item_total' => $region_data[$regions['code_name']]['item_total'] + $depart_data['item_total'], |
|
||||
#营业人数 |
|
||||
'persons' => $region_data[$regions['code_name']]['persons'] + $depart_data['persons'], |
|
||||
#人均台数 $z_mfg_cnt + $p_mfg_cnt |
|
||||
'avg_mfg_total' => ($region_data[$regions['code_name']]['z_mfg_cnt']) |
|
||||
/ ($region_data[$regions['persons']]), |
|
||||
#人均件数 |
|
||||
'avg_item_total' => ($region_data[$regions['code_name']]['z_item_cnt']) |
|
||||
/ ($region_data[$regions['persons']]), |
|
||||
|
|
||||
]; |
|
||||
$depart_data['children'][] = [ |
|
||||
'depart_name' => $salesman['name'], |
|
||||
#当月件数 |
|
||||
'd_item_cnt' => $d_item_cnt, |
|
||||
#当月台数 |
|
||||
'd_mfg_cnt' => $d_mfg_cnt, |
|
||||
#直销件数 |
|
||||
'z_item_cnt' => $z_item_cnt, |
|
||||
#直销台数 |
|
||||
'z_mfg_cnt' => $z_mfg_cnt, |
|
||||
#平台件数 |
|
||||
'p_item_cnt' => $p_item_cnt, |
|
||||
#平台台数 |
|
||||
'p_mfg_cnt' => $p_mfg_cnt, |
|
||||
#台数合计 |
|
||||
'mfg_total' => $z_mfg_cnt + $p_mfg_cnt, |
|
||||
#件数合计 |
|
||||
'item_total' => $z_item_cnt + $p_item_cnt, |
|
||||
#营业人数 |
|
||||
'persons' => 1, |
|
||||
#人均台数 |
|
||||
'avg_mfg_total' => $z_mfg_cnt + $p_mfg_cnt, |
|
||||
#人均件数 |
|
||||
'avg_item_total' => $z_item_cnt + $p_item_cnt, |
|
||||
]; |
|
||||
} |
|
||||
#大区资料 |
|
||||
if (empty($region_data[$regions['code_name']])) $region_data[$regions['code_name']] = []; |
|
||||
if ($region_data[$regions['code_name']]['children']) $region_data[$regions['code_name']]['children'] = []; |
|
||||
array_push($region_data[$regions['code_name']]['children'], $depart_data); |
|
||||
} |
|
||||
echo "<pre>"; |
|
||||
var_dump($region_data); |
|
||||
} |
|
@ -1,20 +0,0 @@ |
|||||
<?php |
|
||||
//require_once "../header_nomenu.php"; |
|
||||
#当前登陆者 |
|
||||
|
|
||||
|
|
||||
define("ID", 'P0044'); |
|
||||
$arr = array( |
|
||||
'../../workflow/impl/*.php', |
|
||||
'../../workflow/model/*.php', |
|
||||
'../../workflow/lib/*.php', |
|
||||
'../../workflow/Handler/*.php', |
|
||||
'../../workflow/*.php' |
|
||||
); |
|
||||
|
|
||||
foreach ($arr as $dir) { |
|
||||
$files = glob($dir); |
|
||||
foreach ($files as $file) { |
|
||||
require_once $file; |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,263 @@ |
|||||
|
<?php |
||||
|
include('../header.php'); |
||||
|
require_once('./conn.php'); |
||||
|
$sql = "SELECT * FROM employee WHERE depart_no IN ('320','311','312','313','314','315','511','512','513','514','515') "; |
||||
|
$stmt = $conn->prepare($sql); |
||||
|
// $stmt->bindParam(':depart_no', $depart_no); |
||||
|
$stmt->execute(); |
||||
|
$contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
// echo '<pre>'; |
||||
|
// print_r($contractSalesman); |
||||
|
// echo '</pre>'; |
||||
|
?> |
||||
|
|
||||
|
<link rel="stylesheet" href="./styles/style.css"> |
||||
|
<link rel="stylesheet" href="./semantic/dist/semantic.min.css"> |
||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> |
||||
|
<script src="./js/alpine.js"></script> |
||||
|
<script defer src="./js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="./js/axios/axios.min.js"></script> |
||||
|
<script src="./js/jquery/jquery-3.1.1.min.js"></script> |
||||
|
<script src="./semantic/dist/semantic.min.js"></script> |
||||
|
|
||||
|
<div class="renovate_input" x-data="renovateInput"> |
||||
|
<div class="form" method="post" id="form" enctype="multipart/form-data"> |
||||
|
<input type="hidden" name="form_name" value="main_form"> |
||||
|
<div> |
||||
|
<table class="table table-borderd query-table table-striped table-bordered display compact" style="width:99%; margin-left:.5%"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td colspan="8"> |
||||
|
<h3 style="text-align:center">汰改合約入力</h3> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight:bolder; margin:botton 20px"> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle;">合約號</td> |
||||
|
<td colspan="6"> |
||||
|
<input type="text" class="form-control" @keyup="nextStepKeyupFn($event)" name="contract_no" x-model="data.contract_no"> |
||||
|
</td> |
||||
|
<td colspan="1" style="vertical-align:middle"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<template x-if="step==1"> |
||||
|
<tbody style="font-weight:bolder; margin:botton 20px" x-show="step==1"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px;"> |
||||
|
<h4>業務確認項</h4> |
||||
|
</td> |
||||
|
<td class="text-right" style="border-left:0px"> |
||||
|
<button type="button" id="btn_back" class="btn btn-default" onclick="location.reload()">返回</button> |
||||
|
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">立約人</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.customer"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">營業員</td> |
||||
|
<td> |
||||
|
<!-- <input x-show="data.salesman" type="text" x-model="data.salesman" name="promiser"> --> |
||||
|
<select x-model="data.salesman" class="ui fluid search dropdown" name="salesman"> |
||||
|
<option value="">------</option> |
||||
|
<?php foreach ($contractSalesman as $salesman) : ?> |
||||
|
<option value="<?= $salesman['employee_no'] ?>"><?= $salesman['name'] ?></option> |
||||
|
<?php endforeach; ?> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">地址</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.address"> |
||||
|
</td> |
||||
|
<td></td> |
||||
|
</tr> |
||||
|
<!-- 客戶款別分別如何分期 --> |
||||
|
<div> |
||||
|
<tr> |
||||
|
<td colspan='8' style="vertical-align:middle ">款別分期</td> |
||||
|
</tr> |
||||
|
|
||||
|
|
||||
|
<tr> |
||||
|
<td colspan='1'>付款辦法</td> |
||||
|
<td colspan='1'>款別</td> |
||||
|
<td colspan='1'>比例%</td> |
||||
|
<td colspan='2'>金額</td> |
||||
|
<td colspan='1'>繳款方式(月)</td> |
||||
|
</tr> |
||||
|
|
||||
|
|
||||
|
<tr> |
||||
|
<td rowspan="4">材料</td> |
||||
|
<td>1、訂金</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[0] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>2、二次款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[1] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>3、貨到工地款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[2] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<!-- <tr> |
||||
|
<td>4、其他</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[3] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> --> |
||||
|
|
||||
|
<tr> |
||||
|
<td rowspan="3">安裝</td> |
||||
|
<td>5、安裝完畢款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[4] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>6、驗收款</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[5] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>7、其他</td> |
||||
|
<td> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text"> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select x-model=data.paykind[6] @change="totalFn()"> |
||||
|
<template x-for="pay in data.payarr" :key="pay"> |
||||
|
<!-- <option value=""></option> --> |
||||
|
<option :value="pay" x-text="pay"></option> |
||||
|
</template> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
|
||||
|
<tr> |
||||
|
<td colspan="2">合計</td> |
||||
|
<td> |
||||
|
<input type="text" disabled> |
||||
|
</td> |
||||
|
<td colspan="2"> |
||||
|
<input type="text" disabled> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.total" disabled> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</div> |
||||
|
</tbody> |
||||
|
|
||||
|
</template> |
||||
|
</table> |
||||
|
|
||||
|
<button x-show="step==3" @click="save()" type="button" class="btn btn-primary btn-lg pull-right savebutton" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>存檔</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<span class="loader"></span> |
||||
|
</template> |
||||
|
</button> |
||||
|
|
||||
|
<button x-show="step<2" @click="nextStepFn()" class="btn btn-primary btn-lg pull-right savebutton" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>下一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<span class="loader"></span> |
||||
|
</template> |
||||
|
</button> |
||||
|
|
||||
|
<button x-show="step>1" @click="preStepFn()" class="btn btn-primary btn-lg pull-right savebutton" :disabled="isLoading"> |
||||
|
<template x-if="!isLoading"> |
||||
|
<span>上一步</span> |
||||
|
</template> |
||||
|
<template x-if="isLoading"> |
||||
|
<span class="loaders"></span> |
||||
|
</template> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
@ -1,19 +1,21 @@ |
|||||
<?php |
<?php |
||||
$date = Date('Y-m-d'); |
$date = Date('Y-m-d'); |
||||
$date1 = Date('Y-m-d', strtotime("$date +1 months")); |
$date1 = Date('Y-m-d', strtotime("$date +1 months")); |
||||
|
// $paymonth = $i * $SQuantity; |
||||
|
// $countDay = date('Y-m-d', strtotime("$date + $paymonth months")); |
||||
|
// $payDay = str_replace('-', '', $countDay); |
||||
// $countDay = date('Ymd', strtotime("$date1 + 1 months")); |
// $countDay = date('Ymd', strtotime("$date1 + 1 months")); |
||||
// echo '<pre>'; |
// echo '<pre>'; |
||||
// print_r($countDay); |
// print_r($countDay); |
||||
// echo '</pre>'; |
// echo '</pre>'; |
||||
// exit(); |
// exit(); |
||||
$a = 0; |
$SQuantity = 2; |
||||
// $b = 24 / $a; |
// $b = 24 / $a; |
||||
for ($i = 0; $i < 2; $i++) { |
for ($i = 0; $i < 12; $i++) { |
||||
for ($j = 0; $j < 12; $j++) { |
$paymonth = $i * $SQuantity; |
||||
$a++; |
$countDay = date('Y-m-d', strtotime("$date + $paymonth months")); |
||||
echo '<pre>'; |
$payDay = str_replace('-', '', $countDay); |
||||
print_r($a); |
echo '<pre>'; |
||||
echo '</pre>'; |
print_r($payDay); |
||||
} |
echo '</pre>'; |
||||
} |
} |
||||
|
Binary file not shown.
Loading…
Reference in new issue