62 changed files with 6037 additions and 3907 deletions
@ -1,89 +1,89 @@ |
|||||
<?php |
<?php |
||||
include "T8_Authorization.php"; |
include "T8_Authorization.php"; |
||||
echo "收貨申請單"; |
echo "收貨申請單"; |
||||
|
|
||||
?> |
?> |
||||
<script> |
<script> |
||||
console.log(<?= $now ?>); |
console.log(<?= $now ?>); |
||||
get_Auth(); |
get_Auth(); |
||||
window.addEventListener('message', function(event) { |
window.addEventListener('message', function(event) { |
||||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
||||
var validation = event.data; |
var validation = event.data; |
||||
console.log("event"); |
console.log("event"); |
||||
console.log(validation); |
console.log(validation); |
||||
|
|
||||
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
||||
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/PURRECEIVINGORDER/PostERPData'; |
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/PURRECEIVINGORDER/PostERPData'; |
||||
headerParam = { |
headerParam = { |
||||
CHI_Authorization: `${validation}`, |
CHI_Authorization: `${validation}`, |
||||
}; |
}; |
||||
var body = [ |
var body = [ |
||||
{ |
{ |
||||
"name": "purReceivingOrderMaster", |
"name": "purReceivingOrderMaster", |
||||
"rows": [ |
"rows": [ |
||||
{ |
{ |
||||
"BillNo": "Z003", |
"BillNo": "Z003", |
||||
"BillDate": 20210420, |
"BillDate": 20210420, |
||||
"ReceiveOrgId": "1000", |
"ReceiveOrgId": "1000", |
||||
"OrgId": "1000", |
"OrgId": "1000", |
||||
"DemandOrgId": "1000", |
"DemandOrgId": "1000", |
||||
"TypeId": "MA", |
"TypeId": "MA", |
||||
"FromSourceTag":"PO", |
"FromSourceTag":"PO", |
||||
"FromTransId":"Z003", |
"FromTransId":"Z003", |
||||
// "BizPartnerId": "16547907", |
// "BizPartnerId": "16547907", |
||||
// "PersonId": "M0122", |
// "PersonId": "M0122", |
||||
// "CurrId": "TWD", |
// "CurrId": "TWD", |
||||
// "CurrOAmount": 1, |
// "CurrOAmount": 1, |
||||
// "CurrLAmount": 1, |
// "CurrLAmount": 1, |
||||
// "ReciveDate": 20210420, |
// "ReciveDate": 20210420, |
||||
// "DueToId": "Z001", |
// "DueToId": "Z001", |
||||
// "TaxId": "ST005", |
// "TaxId": "ST005", |
||||
// "DebtorOrgId": "1000", |
// "DebtorOrgId": "1000", |
||||
// "DebtorCurrOAmount": 1, |
// "DebtorCurrOAmount": 1, |
||||
// "DebtorCurrLAmount": 1, |
// "DebtorCurrLAmount": 1, |
||||
// "ReceiveCompId": "1000", |
// "ReceiveCompId": "1000", |
||||
// "DebtorCompId": "1000", |
// "DebtorCompId": "1000", |
||||
// "DemandCompId": "1000", |
// "DemandCompId": "1000", |
||||
"InStoreState":2, |
"InStoreState":2, |
||||
"CurrentState":2 |
"CurrentState":2 |
||||
} |
} |
||||
] |
] |
||||
}, |
}, |
||||
{ |
{ |
||||
"name": "purReceivingOrderDetail", |
"name": "purReceivingOrderDetail", |
||||
"rows": [ |
"rows": [ |
||||
{ |
{ |
||||
// "TaxId": "ST005", |
// "TaxId": "ST005", |
||||
"FromSourceTag":"PO", |
"FromSourceTag":"PO", |
||||
"FromBillNo":"Z003", |
"FromBillNo":"Z003", |
||||
"BillNo": "Z002", |
"BillNo": "Z002", |
||||
"RowCode": "1", |
"RowCode": "1", |
||||
"ItemType": 0, |
"ItemType": 0, |
||||
"MaterialId": "MX01030018", |
"MaterialId": "MX01030018", |
||||
"ReceivingSQty": 1, |
"ReceivingSQty": 1, |
||||
// "SUnitId": "SET", |
// "SUnitId": "SET", |
||||
"SPrice": "100" |
"SPrice": "100" |
||||
} |
} |
||||
] |
] |
||||
} |
} |
||||
] |
] |
||||
; |
; |
||||
var json = JSON.stringify(body); |
var json = JSON.stringify(body); |
||||
obj = { |
obj = { |
||||
type: 'POST', |
type: 'POST', |
||||
// url: `${corsurl}${apiurl}`, |
// url: `${corsurl}${apiurl}`, |
||||
url: `${apiurl}`, |
url: `${apiurl}`, |
||||
// dataType: 'json', |
// dataType: 'json', |
||||
headers: headerParam, |
headers: headerParam, |
||||
data: json, |
data: json, |
||||
dataType: "json", |
dataType: "json", |
||||
success: function(res) { |
success: function(res) { |
||||
console.log(res.Status); |
console.log(res.Status); |
||||
console.log(res.ErrorMsg); |
console.log(res.ErrorMsg); |
||||
console.log(res.Data); |
console.log(res.Data); |
||||
} |
} |
||||
}; |
}; |
||||
jQuery.ajax(obj); |
jQuery.ajax(obj); |
||||
} |
} |
||||
}) |
}) |
||||
</script> |
</script> |
@ -1,89 +1,89 @@ |
|||||
<?php |
<?php |
||||
include "T8_Authorization.php"; |
include "T8_Authorization.php"; |
||||
echo "採購單"; |
echo "採購單"; |
||||
echo "111"; |
echo "111"; |
||||
?> |
?> |
||||
<script> |
<script> |
||||
console.log(<?= $now ?>); |
console.log(<?= $now ?>); |
||||
get_Auth(); |
get_Auth(); |
||||
window.addEventListener('message', function(event) { |
window.addEventListener('message', function(event) { |
||||
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
||||
var validation = event.data; |
var validation = event.data; |
||||
console.log("event"); |
console.log("event"); |
||||
console.log(validation); |
console.log(validation); |
||||
|
|
||||
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
||||
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/PURPURCHASEORDER/PostERPData'; |
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/PURPURCHASEORDER/PostERPData'; |
||||
headerParam = { |
headerParam = { |
||||
CHI_Authorization: `${validation}`, |
CHI_Authorization: `${validation}`, |
||||
}; |
}; |
||||
var body = [{ |
var body = [{ |
||||
"name": "purBillOrderMaster", |
"name": "purBillOrderMaster", |
||||
"rows": [{ |
"rows": [{ |
||||
"BillNo": "Z004", |
"BillNo": "Z004", |
||||
"BillDate": 20210420, |
"BillDate": 20210420, |
||||
"TypeId": "PO", |
"TypeId": "PO", |
||||
"OrgId": "1000", |
"OrgId": "1000", |
||||
"FOrgId": "1000", |
"FOrgId": "1000", |
||||
"BizPartnerId": "33709933", |
"BizPartnerId": "33709933", |
||||
"CurrId": "TWD", |
"CurrId": "TWD", |
||||
"CurrOAmount": 1.00000, |
"CurrOAmount": 1.00000, |
||||
"CurrLAmount": 1.00000, |
"CurrLAmount": 1.00000, |
||||
"PersonId": "M0122", |
"PersonId": "M0122", |
||||
"DueToId": "33709933", |
"DueToId": "33709933", |
||||
"TaxId": "ST005", |
"TaxId": "ST005", |
||||
// "DebtorOrgId": "1000", |
// "DebtorOrgId": "1000", |
||||
// "DebitorCurrId": "TWD", |
// "DebitorCurrId": "TWD", |
||||
// "DebtorCurrOAmount": 1.00000, |
// "DebtorCurrOAmount": 1.00000, |
||||
// "DebtorCurrLAmount": 1.00000, |
// "DebtorCurrLAmount": 1.00000, |
||||
"CompId": "1001", |
"CompId": "1001", |
||||
// "DebtorCompId": "1001", |
// "DebtorCompId": "1001", |
||||
"CurrentState": 2, |
"CurrentState": 2, |
||||
"FlowState": 2, |
"FlowState": 2, |
||||
"PermitState": 2, |
"PermitState": 2, |
||||
"Remark":"testtest", |
"Remark":"testtest", |
||||
"CreatorId": "M0122", |
"CreatorId": "M0122", |
||||
"IsPriceWithTax":1 |
"IsPriceWithTax":1 |
||||
|
|
||||
}] |
}] |
||||
}, |
}, |
||||
{ |
{ |
||||
"name": "purBillOrderDetail", |
"name": "purBillOrderDetail", |
||||
"rows": [{ |
"rows": [{ |
||||
"DemandOrgId": "1000", |
"DemandOrgId": "1000", |
||||
"TaxId": "ST005", |
"TaxId": "ST005", |
||||
"DeliveryDate": 20210420, |
"DeliveryDate": 20210420, |
||||
"ReceiveOrgId": "1000", |
"ReceiveOrgId": "1000", |
||||
"DebtorOrgId": "1000", |
"DebtorOrgId": "1000", |
||||
"ReceiveCompId": "1001", |
"ReceiveCompId": "1001", |
||||
"DemandCompId": "1001", |
"DemandCompId": "1001", |
||||
"BillNo": "Z004", |
"BillNo": "Z004", |
||||
"RowCode": 1, |
"RowCode": 1, |
||||
"ItemType": 0, |
"ItemType": 0, |
||||
"MaterialId": "MX23010003", |
"MaterialId": "MX23010003", |
||||
// "MaterialSpec": "LY-08/紅光/1", |
// "MaterialSpec": "LY-08/紅光/1", |
||||
"SQuantity": 1.00000, |
"SQuantity": 1.00000, |
||||
"PresentSQty":1, |
"PresentSQty":1, |
||||
"SPrice": 100 |
"SPrice": 100 |
||||
}] |
}] |
||||
} |
} |
||||
]; |
]; |
||||
var json = JSON.stringify(body); |
var json = JSON.stringify(body); |
||||
obj = { |
obj = { |
||||
type: 'POST', |
type: 'POST', |
||||
// url: `${corsurl}${apiurl}`, |
// url: `${corsurl}${apiurl}`, |
||||
url: `${apiurl}`, |
url: `${apiurl}`, |
||||
// dataType: 'json', |
// dataType: 'json', |
||||
headers: headerParam, |
headers: headerParam, |
||||
data: json, |
data: json, |
||||
dataType: "json", |
dataType: "json", |
||||
success: function(res) { |
success: function(res) { |
||||
console.log(res.Status); |
console.log(res.Status); |
||||
console.log(res.ErrorMsg); |
console.log(res.ErrorMsg); |
||||
console.log(res.Data); |
console.log(res.Data); |
||||
} |
} |
||||
}; |
}; |
||||
jQuery.ajax(obj); |
jQuery.ajax(obj); |
||||
} |
} |
||||
}) |
}) |
||||
</script> |
</script> |
Binary file not shown.
@ -0,0 +1,42 @@ |
|||||
|
<?php |
||||
|
include "./header.php"; |
||||
|
|
||||
|
require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php'; |
||||
|
|
||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet; |
||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
||||
|
|
||||
|
header('Content-Type: application/json'); |
||||
|
$type = $_GET['type']; |
||||
|
$array_data = array(); |
||||
|
$Bill = json_decode(file_get_contents("php://input"), true); |
||||
|
$spreadsheet = new Spreadsheet(); |
||||
|
$sheet = $spreadsheet->getActiveSheet(); |
||||
|
// file_put_contents('account-receivable.txt', json_encode($Bill)); |
||||
|
|
||||
|
$colomnHeader = [ |
||||
|
'合約號', '作番號', '部門編號', '部門名稱', '主管工號','主管名稱', '營業員工號', '營業員名稱', '客戶名稱', '抬頭', '統編', '通訊地址', |
||||
|
'收款階段名稱', '應收日期','是否應收', '應收金額', '已開金額','未開金額', '已收金額','催收金額', '催收次數' |
||||
|
]; |
||||
|
$sheet->fromArray($colomnHeader, NULL, 'A1'); |
||||
|
$rowIndex = 2; |
||||
|
foreach ($Bill as $key => $value) { |
||||
|
|
||||
|
$sheet->fromArray($value, NULL, 'A' . $rowIndex); |
||||
|
$column = [ |
||||
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R','S','T' |
||||
|
]; |
||||
|
foreach ($column as $col) { |
||||
|
$sheet->getColumnDimension($col)->setAutoSize(true); |
||||
|
} |
||||
|
$rowIndex++; |
||||
|
} |
||||
|
$writer = new Xlsx($spreadsheet); |
||||
|
$excelFileName = 'account-receivable-renovate.xlsx'; |
||||
|
$writer->save($excelFileName); |
||||
|
|
||||
|
echo $excelFileName; |
||||
|
?> |
||||
|
<!-- <script> |
||||
|
window.location.href = "account-receivable-index.php?<?= $token_link ?>"; |
||||
|
</script> --> |
@ -0,0 +1,773 @@ |
|||||
|
<?php |
||||
|
|
||||
|
include "header.php"; |
||||
|
|
||||
|
$sum_facility = 0; |
||||
|
// M1 |
||||
|
$sum_A40002 = 0; |
||||
|
// 設備 |
||||
|
$sum_A40009 = 0; |
||||
|
// 安裝 |
||||
|
$sum_A40010 = 0; |
||||
|
$sum_total_budget = 0; |
||||
|
$average_budget = 0; |
||||
|
$average_A40002 = 0; |
||||
|
$average_A40009 = 0; |
||||
|
$average_A40010 = 0; |
||||
|
|
||||
|
|
||||
|
$follower = find_follow($user_id); |
||||
|
$arrayData = []; |
||||
|
$receivable_array = []; |
||||
|
// T8所有合約號 |
||||
|
$sql_contractNumber = "SELECT Distinct BillNo FROM salSalesOrder WHERE ModeId = 'T' AND (CurrentState=2 OR CurrentState=4) "; |
||||
|
|
||||
|
// T8發票 (有專案的發票) |
||||
|
$sql_invoice = "SELECT DISTINCT |
||||
|
a.InvoiceNo, a.InvoiceTime,a.OAmountWithTax,a.InvoiceState, |
||||
|
b.FromSalSalesOrder |
||||
|
FROM arSellInvoice as a |
||||
|
LEFT JOIN (SELECT CH.FromSalSalesOrder, SE.* FROM arSellInvoiceMaterial AS SE |
||||
|
LEFT JOIN arCheckBillDetail AS CH ON SE.FromBillNo=CH.BillNo) as b |
||||
|
ON a.BillNo=b.BillNo |
||||
|
WHERE DATALENGTH(b.FromSalSalesOrder)>0 |
||||
|
ORDER BY InvoiceTime ASC"; |
||||
|
|
||||
|
// T8核銷 |
||||
|
$sql_received = "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 DATALENGTH(c.OrderBillNo) >0"; |
||||
|
|
||||
|
|
||||
|
// 期初收款資訊 |
||||
|
$sql_opening = " |
||||
|
SELECT * FROM account_received "; |
||||
|
// 設定權限:看到自己的/下屬的,資訊處跟財會處可以看全部的 |
||||
|
if ((in_array($user_id, array('M0060', 'M0175'))) || (in_array(accountidToDepartId($user_id), array('220', '210')))) { |
||||
|
} else { |
||||
|
$sql_opening .= " OR person_id = '$user_id'"; |
||||
|
$sql_contractNumber .= " AND (PersonId = '$user_id'"; |
||||
|
if (count($follower) > 0) { |
||||
|
$column_str = "('$user_id'" . ",'"; |
||||
|
$column_str .= implode("','", $follower); |
||||
|
$column_str .= "')"; |
||||
|
$sql_contractNumber .= " OR PersonId IN $column_str)"; |
||||
|
$sql_opening .= " OR person_id IN $column_str)"; |
||||
|
} else { |
||||
|
$sql_opening .= ")"; |
||||
|
$sql_contractNumber .= ")"; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
$contractNumbers = array(); |
||||
|
$query_contract_number = $conn->query($sql_contractNumber); |
||||
|
foreach ($query_contract_number as $contract_numbers) { |
||||
|
array_push($contractNumbers, $contract_numbers['BillNo']); |
||||
|
$str_numbers = "('" . implode("','", $contractNumbers) . "')"; |
||||
|
} |
||||
|
//作番大日程 |
||||
|
$sql = "SELECT |
||||
|
tmp2.*, |
||||
|
d.name AS depart_name |
||||
|
FROM( |
||||
|
SELECT |
||||
|
a.manager, |
||||
|
a2.name as manager_name, |
||||
|
a.name, |
||||
|
a.department_id, |
||||
|
w.salesid, |
||||
|
w.contractno, |
||||
|
w.facilityno, |
||||
|
w.estimated_shipping_date, |
||||
|
w.real_contract_arrival_date, |
||||
|
w.actual_tofactory_date, |
||||
|
w.real_arrival_date, |
||||
|
w.install_end_date, |
||||
|
w.tryrun_end_date, |
||||
|
w.official_check_date, |
||||
|
w.delivery_date |
||||
|
from wipwholestatus AS w |
||||
|
left join account AS a |
||||
|
ON w.salesid = a.accountid |
||||
|
left join account AS a2 |
||||
|
ON a2.accountid = a.manager |
||||
|
where w.status = '1' AND w.contract_type='B' |
||||
|
)AS tmp2 |
||||
|
left join ( |
||||
|
SELECT DISTINCT |
||||
|
department_id, |
||||
|
name |
||||
|
FROM department |
||||
|
|
||||
|
) AS d |
||||
|
ON d.department_id = tmp2.department_id"; |
||||
|
|
||||
|
//T8 銷售訂單 階段收款計畫 |
||||
|
$sql_contract = "SELECT a.BillNo,s.BillDate, a.RowNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, s.DeptId, s.DeptName, |
||||
|
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a |
||||
|
LEFT JOIN (SELECT O.*, DE.DeptName FROM salSalesOrder AS O LEFT JOIN comDepartment AS DE ON O.DeptId=DE.DeptId) AS s on a.BillNo = s.BillNo |
||||
|
LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId "; |
||||
|
if (isset($str_numbers)) { |
||||
|
$sql_contract .= "WHERE s.BillNo IN $str_numbers "; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// T8 銷售訂單 作番金額 |
||||
|
$sql_contract_budget = "SELECT A.BillNo,A.MaterialId, A.OAmountWithTax,A.CU_MaterialId FROM salSalesOrderDetail AS A |
||||
|
LEFT JOIN salSalesOrder AS B ON A.BillNo=B.BillNo |
||||
|
WHERE B.ModeId='T' AND A.ItemType=1 "; |
||||
|
if (isset($str_numbers)) { |
||||
|
$sql_contract_budget .= "AND A.BillNo IN $str_numbers "; |
||||
|
} |
||||
|
$contract = $conn->query($sql_contract); |
||||
|
$contract_data = array(); |
||||
|
// 將T8合約收款階段資料依據款別分類放進arraData裡 |
||||
|
foreach ($contract as $cont) { |
||||
|
$BillNo = $cont['BillNo']; |
||||
|
$BillDate = $cont['BillDate']; |
||||
|
$PayStage = $cont['PayStage']; |
||||
|
$PlanPayDate = $cont['PlanPayDate']; |
||||
|
$PayAmount = $cont['PlanPayAmt']; |
||||
|
$partnerName = $cont['BizPartnerName']; |
||||
|
$EnterpriseName = $cont['EnterpriseName']; |
||||
|
$TaxNo = $cont['TaxNo']; |
||||
|
$ContactAddress = $cont['ContactAddress']; |
||||
|
$RowNo = $cont['RowNo']; |
||||
|
$salesId = $cont['PersonId']; |
||||
|
|
||||
|
//['type'] A:比照新梯、B:純分期、C:其他 |
||||
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 |
||||
|
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 |
||||
|
//['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
||||
|
if (!(isset($arrayData[$BillNo]))) { |
||||
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 9 T8單據日期 10 合約號 |
||||
|
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
||||
|
$arrayData[$BillNo][0] = $cont['DeptId']; |
||||
|
$arrayData[$BillNo][1] = $cont['DeptName']; |
||||
|
$arrayData[$BillNo][3] = $salesId; |
||||
|
$arrayData[$BillNo][5] = $partnerName; |
||||
|
$arrayData[$BillNo][6] = $EnterpriseName; |
||||
|
$arrayData[$BillNo][7] = $TaxNo; |
||||
|
$arrayData[$BillNo][8] = $ContactAddress; |
||||
|
$arrayData[$BillNo][9] = $BillDate; |
||||
|
$arrayData[$BillNo][10] = $BillNo; |
||||
|
$arrayData[$BillNo]['total_budget'] = 0; |
||||
|
$arrayData[$BillNo]['invoice'] = array(); |
||||
|
$arrayData[$BillNo]['received_budget'] = 0; |
||||
|
$arrayData[$BillNo]['invoice_budget'] = 0; |
||||
|
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = 0; |
||||
|
$arrayData[$BillNo]['total_facility_num'] = 0; |
||||
|
} |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0; |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['name'] = $PayStage; |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['PlanPayDate'] = $PlanPayDate; |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['PayAmount'] = $PayAmount; |
||||
|
// 判斷type |
||||
|
$wipStage = ['簽約', '訂金', '貨抵工地', '完工', '試車', '安裝', '驗收', '完工', '交車', '尾款', '合約']; |
||||
|
foreach ($wipStage as $wipstage) { |
||||
|
if (strpos($PayStage, $wipstage) !== false) { |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = "A"; |
||||
|
} |
||||
|
} |
||||
|
$haveNumber = (int) filter_var(str_replace('-', '', $PayStage), FILTER_SANITIZE_NUMBER_INT); |
||||
|
if ($haveNumber > 0 && $arrayData[$BillNo]['PayStage'][$RowNo]['type'] === 0) { |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = "B"; |
||||
|
} elseif ($haveNumber > 0 && $arrayData[$BillNo]['PayStage'][$RowNo]['type'] == 'A') { |
||||
|
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = "C"; |
||||
|
} |
||||
|
} |
||||
|
$received_array = $conn->query($sql_received); |
||||
|
$opening_data = mysqli_query($link, $sql_opening); |
||||
|
$invoice_data = $conn->query($sql_invoice); |
||||
|
$contract_budget_data = $conn->query($sql_contract_budget); |
||||
|
|
||||
|
// 查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; |
||||
|
} |
||||
|
// 將T8銷售訂單明細 每個作番金額存入arrayData |
||||
|
$contract_budget = array(); |
||||
|
foreach ($contract_budget_data as $cont) { |
||||
|
$BillNo = $cont['BillNo']; |
||||
|
if (isset($arrayData[$BillNo])) { |
||||
|
$salesid = $arrayData[$BillNo][3]; |
||||
|
if (isset($find_manager[$salesid])) { |
||||
|
$arrayData[$BillNo][2] = $find_manager[$salesid]['manager_name']; |
||||
|
$arrayData[$BillNo][4] = $find_manager[$salesid]['name']; |
||||
|
$arrayData[$BillNo][11] = $find_manager[$salesid]['manager']; |
||||
|
} |
||||
|
$arrayData[$BillNo]['total_budget'] += $cont['OAmountWithTax']; |
||||
|
$sum_total_budget += $cont['OAmountWithTax']; |
||||
|
$arrayData[$BillNo][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
switch ($cont['MaterialId']) { |
||||
|
case "A40002": |
||||
|
$sum_A40002 += $cont['OAmountWithTax']; |
||||
|
break; |
||||
|
case "A40009": |
||||
|
$sum_A40009 += $cont['OAmountWithTax']; |
||||
|
break; |
||||
|
case "A40010": |
||||
|
$sum_A40010 += $cont['OAmountWithTax']; |
||||
|
break; |
||||
|
} |
||||
|
if (isset($arrayData[$BillNo]['facility'][$cont['CU_MaterialId']])) { |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] += $cont['OAmountWithTax']; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$sum_facility += 1; |
||||
|
$arrayData[$BillNo]['total_facility_num'] += 1; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] = $cont['OAmountWithTax']; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = 0; |
||||
|
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
||||
|
} |
||||
|
} |
||||
|
if (isset($contract_budget[$cont['BillNo']])) { |
||||
|
$contract_budget[$cont['BillNo']]['total'] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$contract_budget[$cont['BillNo']]['total'] = $cont['OAmountWithTax']; |
||||
|
} |
||||
|
if (isset($contract_budget[$cont['BillNo']][$cont['MaterialId']])) { |
||||
|
$contract_budget[$cont['BillNo']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$contract_budget[$cont['BillNo']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
||||
|
} |
||||
|
|
||||
|
if (isset($contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']])) { |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['total'] += $cont['OAmountWithTax']; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
||||
|
} else { |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['total'] = $cont['OAmountWithTax']; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40002'] = 0; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40009'] = 0; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40010'] = 0; |
||||
|
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/*計算作番佔合約的金額比例 |
||||
|
@param $facility_no string => 作番號 |
||||
|
@param $contract_budget_billno array => $contract_budget[合約號] |
||||
|
return float */ |
||||
|
function get_contract_ratio($facility_no, $contract_budget_billno) |
||||
|
{ |
||||
|
$ratio = 0; |
||||
|
if (isset($contract_budget_billno['facility'][$facility_no])) { |
||||
|
if (empty($contract_budget_billno['total'])) { |
||||
|
} else { |
||||
|
|
||||
|
$ratio += $contract_budget_billno['facility'][$facility_no]['total'] / $contract_budget_billno['total']; |
||||
|
} |
||||
|
} |
||||
|
return $ratio; |
||||
|
} |
||||
|
|
||||
|
/* 比較應收日期 |
||||
|
@param $a array |
||||
|
@param $b array |
||||
|
return int */ |
||||
|
function comparePlanPayDate($a, $b) |
||||
|
{ |
||||
|
return strtotime($a['PlanPayDate']) - strtotime($b['PlanPayDate']); |
||||
|
} |
||||
|
|
||||
|
//取作番大日程作番與時程 進arrayData |
||||
|
// real_contract_arrival_date 預計出貨日 |
||||
|
// real_arrival_date 實際出貨日 |
||||
|
$today = strtotime(date('Ymd')); |
||||
|
$wipwhole_array = mysqli_query($link, $sql); |
||||
|
$wipwhole_status = array(); |
||||
|
foreach ($wipwhole_array as $wip) { |
||||
|
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
||||
|
if (isset($arrayData[$wip['contractno']])) { |
||||
|
// 整理合約資料 |
||||
|
// $arrayData[$wip['contractno']][0] = $wip['department_id'];; |
||||
|
// $arrayData[$wip['contractno']][1] = $wip['depart_name']; |
||||
|
// $arrayData[$wip['contractno']][2] = $wip['manager_name']; |
||||
|
// $arrayData[$wip['contractno']][3] = $wip['salesid']; |
||||
|
// $arrayData[$wip['contractno']][4] = $wip['name']; |
||||
|
$arrayData[$wip['contractno']][10] = $wip['contractno']; |
||||
|
$arrayData[$wip['contractno']]['A40002'] = (isset($contract_budget[$wip['contractno']]['A40002']) && !is_null($contract_budget[$wip['contractno']]['A40002'])) ? $contract_budget[$wip['contractno']]['A40002'] : 0; |
||||
|
$arrayData[$wip['contractno']]['A40009'] = (isset($contract_budget[$wip['contractno']]['A40009']) && !is_null($contract_budget[$wip['contractno']]['A40009'])) ? $contract_budget[$wip['contractno']]['A40009'] : 0; |
||||
|
|
||||
|
// [合約號]['facility'][作番號]['no'] |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno']; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = ""; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['receivable_budget'] = 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['collect_budget'] = 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40002'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40002']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40002'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40002'] : 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40009'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40009']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40009'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40009'] : 0; |
||||
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40010'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40010']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40010'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40010'] : 0; |
||||
|
} |
||||
|
$wipwhole_status[$wip['facilityno']] = $wip; |
||||
|
} |
||||
|
|
||||
|
// 整理arrayData[合約]['PayStage']進 (新增) arrayData[合約]['facility'][作番號][PayStage] |
||||
|
$sign_array = ['訂金', '簽約', '合約']; |
||||
|
// 將所有facility的paystage放入一個array以便計算順序 |
||||
|
$allPayStages = []; |
||||
|
foreach ($arrayData as &$value) { |
||||
|
if (isset($value['facility']) && is_iterable($value['facility'])) { |
||||
|
foreach ($value['facility'] as $fakey => &$facility) { |
||||
|
if (isset($contract_budget[$value[10]])) { |
||||
|
$ratio = get_contract_ratio($fakey, $contract_budget[$value[10]]); |
||||
|
for ($stage = 1; $stage < (count($value['PayStage']) + 1); $stage++) { |
||||
|
$facility['PayStage'][$stage] = $value['PayStage'][$stage]; |
||||
|
$facility['PayStage'][$stage]['facilityno'] = $fakey; |
||||
|
//算每個作番的金額 |
||||
|
$facility['PayStage'][$stage]['PayAmount'] = $value['PayStage'][$stage]['PayAmount'] * $ratio; |
||||
|
//算每個作番每個收款階段的收款時間 |
||||
|
switch ($facility['PayStage'][$stage]['type']) { |
||||
|
case "A": |
||||
|
switch ($facility['PayStage'][$stage]['name']) { |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '試車')): |
||||
|
if (isset($wipwhole_status[$fakey]['tryrun_end_date']) && $wipwhole_status[$fakey]['tryrun_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['tryrun_end_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['tryrun_end_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '完工')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '尾款')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '交車')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '驗收')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['delivery_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '安裝')): |
||||
|
if (isset($wipwhole_status[$fakey]['install_end_date']) && $wipwhole_status[$fakey]['install_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['install_end_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['install_end_date'])); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '貨抵工地')): |
||||
|
if (isset($wipwhole_status[$fakey]['real_arrival_date']) && $wipwhole_status[$fakey]['real_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_arrival_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['real_arrival_date'])); |
||||
|
} elseif (isset($wipwhole_status[$fakey]['real_contract_arrival_date']) && $wipwhole_status[$fakey]['real_contract_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_contract_arrival_date'])) { |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime($wipwhole_status[$fakey]['real_contract_arrival_date'])); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
case "B": |
||||
|
|
||||
|
break; |
||||
|
case "C": |
||||
|
switch ($facility['PayStage'][$stage]['name']) { |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '試車')): |
||||
|
if (isset($wipwhole_status[$fakey]['tryrun_end_date']) && $wipwhole_status[$fakey]['tryrun_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['tryrun_end_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['tryrun_end_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '完工')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '尾款')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '交車')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '驗收')): |
||||
|
if (isset($wipwhole_status[$fakey]['delivery_date']) && $wipwhole_status[$fakey]['delivery_date'] !== NULL && !empty($wipwhole_status[$fakey]['delivery_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['delivery_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '安裝')): |
||||
|
if (isset($wipwhole_status[$fakey]['install_end_date']) && $wipwhole_status[$fakey]['install_end_date'] !== NULL && !empty($wipwhole_status[$fakey]['install_end_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['install_end_date']))); |
||||
|
} |
||||
|
break; |
||||
|
case (stristr($facility['PayStage'][$stage]['name'], '貨抵工地')): |
||||
|
if (isset($wipwhole_status[$fakey]['real_arrival_date']) && $wipwhole_status[$fakey]['real_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_arrival_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['real_arrival_date']))); |
||||
|
} elseif (isset($wipwhole_status[$fakey]['real_contract_arrival_date']) && $wipwhole_status[$fakey]['real_contract_arrival_date'] !== NULL && !empty($wipwhole_status[$fakey]['real_contract_arrival_date'])) { |
||||
|
$haveNumber = ((int) filter_var(str_replace('-', '', $facility['PayStage'][$stage]['name']), FILTER_SANITIZE_NUMBER_INT)) - 1; |
||||
|
$facility['PayStage'][$stage]['PlanPayDate'] = date("Ymd", strtotime("+ $haveNumber months", strtotime($wipwhole_status[$fakey]['real_contract_arrival_date']))); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
}; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
if (isset($allPayStages[$value[10]])) { |
||||
|
$allPayStages[$value[10]] = array_merge($allPayStages[$value[10]], $facility['PayStage']); |
||||
|
} else { |
||||
|
$allPayStages[$value[10]] = $facility['PayStage']; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
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) { |
||||
|
$final_paystage[$key][$pstage['sequenceNumber']] = $pstage; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// [invoice][發票號碼][0 發票日期, 1 發票金額, 2 發票狀態, 3 收款日期, 4 收款金額, 5 手續費, 6 核銷單號] |
||||
|
foreach ($invoice_data as $invoice) { |
||||
|
if (isset($arrayData[$invoice['FromSalSalesOrder']])) { |
||||
|
$arrayData[$invoice['FromSalSalesOrder']]['invoice_budget'] += intval($invoice['OAmountWithTax']); |
||||
|
$arrayData[$invoice['FromSalSalesOrder']]['invoice'][$invoice['InvoiceNo']] = [date("Ymd", strtotime($invoice['InvoiceTime'])), $invoice['OAmountWithTax'], $invoice['InvoiceState']]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 把核銷單的內容補到發票資料中 |
||||
|
foreach ($received_array as $received) { |
||||
|
$BillNo = $received['OrderBillNo']; |
||||
|
if (isset($arrayData[$BillNo])) { |
||||
|
if (isset($arrayData[$BillNo]['invoice'][$received['InvoiceNo']])) { |
||||
|
$arrayData[$BillNo]['received_budget'] += $received['PayWriteOffOAmount']; |
||||
|
array_push($arrayData[$BillNo]['invoice'][$received['InvoiceNo']], date($received['ReceivedDate']), $received['PayWriteOffOAmount'], $received['Fee'], $received['BillNo']); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// $final_paystage ['type'] ['PlanPayDate'] ['PayAmount'] ['facilityno'] ['sequenceNumber'] ['name'] ['InvoiceAmount'] ['receivedAmount'] |
||||
|
foreach ($final_paystage as $key => &$payStage) { |
||||
|
if (isset($arrayData[$key]['invoice_budget']) && isset($arrayData[$key]['received_budget'])) { |
||||
|
$tmpInvoice = $arrayData[$key]['invoice_budget']; |
||||
|
$tmpReceived = $arrayData[$key]['received_budget']; |
||||
|
for ($sequence = 1; $sequence <= count($payStage); $sequence++) { |
||||
|
$collect_month = collect_month(strtotime($payStage[$sequence]['PlanPayDate'])); |
||||
|
if ($tmpInvoice > $payStage[$sequence]['PayAmount']) { |
||||
|
$payStage[$sequence]['InvoiceAmount'] = $payStage[$sequence]['PayAmount']; |
||||
|
$tmpInvoice -= $payStage[$sequence]['PayAmount']; |
||||
|
} else { |
||||
|
$payStage[$sequence]['InvoiceAmount'] = $tmpInvoice; |
||||
|
$tmpInvoice = 0; |
||||
|
} |
||||
|
|
||||
|
if ($tmpReceived > $payStage[$sequence]['PayAmount']) { |
||||
|
|
||||
|
$payStage[$sequence]['receivedAmount'] = $payStage[$sequence]['PayAmount']; |
||||
|
$tmpReceived -= $payStage[$sequence]['PayAmount']; |
||||
|
} else { |
||||
|
$payStage[$sequence]['receivedAmount'] = $tmpReceived; |
||||
|
$tmpReceived = 0; |
||||
|
} |
||||
|
if ($collect_month > 0) { |
||||
|
// $arrayData[$key]['facility'][$payStage[$sequence]['facilityno']]['receivable_budget']+=$payStage[$sequence]['PayAmount']; |
||||
|
} |
||||
|
if ($collect_month > 0 && $payStage[$sequence]['PayAmount'] > $payStage[$sequence]['receivedAmount']) { |
||||
|
$payStage[$sequence]['collect_month'] = $collect_month; |
||||
|
} else { |
||||
|
$payStage[$sequence]['collect_month'] = 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 9 T8單據日期 10 合約號 |
||||
|
// 0 合約號 1 作番號 2 部門id 3 部門名稱 4 經理名稱 5 營業員id 6 營業員名稱 7 客戶名稱 8 抬頭 9 統編 10 通訊地址 |
||||
|
// 11 收款階段名稱 12 應收日期 13 收款金額 14 已開金額 15 已收金額 16 催收次數 |
||||
|
$excel_aray = array(); |
||||
|
$today = strtotime(date('Ymt')); |
||||
|
foreach ($arrayData as $key => $value) { |
||||
|
if (isset($final_paystage[$key])) { |
||||
|
for ($sequence = 1; $sequence <= count($final_paystage[$key]); $sequence++) { |
||||
|
$value[4] = (isset($value[4]) && !empty($value[4])) ? $value[4] : '--'; |
||||
|
$value[5] = (isset($value[5]) && !empty($value[5])) ? $value[5] : '--'; |
||||
|
$value[6] = (isset($value[6]) && !empty($value[6])) ? $value[6] : '--'; |
||||
|
$value[7] = (isset($value[7]) && !empty($value[7])) ? $value[7] : '--'; |
||||
|
$value[8] = (isset($value[8]) && !empty($value[8])) ? $value[8] : '--'; |
||||
|
$value[11] = (isset($value[11]) && !empty($value[11])) ? $value[11] : '--'; |
||||
|
$value[12] = (isset($value[12]) && !empty($value[12])) ? date('Y/m/d', strtotime($value[12])) : '--'; |
||||
|
$thisPayStage = $final_paystage[$key][$sequence]; |
||||
|
$keyname = $key . "/" . $final_paystage[$key][$sequence]['facilityno'] . "/" . $value[5]; |
||||
|
$havetopay = ($today >= strtotime($thisPayStage['PlanPayDate'])) ? "V" : "--"; |
||||
|
switch ($havetopay) { |
||||
|
case "V": |
||||
|
$unInvoiceAmount = $thisPayStage['PayAmount'] - $thisPayStage['InvoiceAmount']; |
||||
|
$unReceivedAmount = $thisPayStage['PayAmount'] - $thisPayStage['receivedAmount']; |
||||
|
break; |
||||
|
default: |
||||
|
$unInvoiceAmount = 0; |
||||
|
$unReceivedAmount = 0; |
||||
|
break; |
||||
|
} |
||||
|
$excel_aray[$keyname] = [ |
||||
|
$value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8], |
||||
|
$thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay, |
||||
|
number_format(round($thisPayStage['PayAmount'])), |
||||
|
number_format(round($thisPayStage['InvoiceAmount'])), number_format(round($unInvoiceAmount)), |
||||
|
number_format(round($thisPayStage['receivedAmount'])), number_format(round($unReceivedAmount)), |
||||
|
number_format(round($thisPayStage['collect_month'])) |
||||
|
|
||||
|
]; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
$total_data = json_encode($excel_aray); |
||||
|
//計算總作番數、金額、A40002、A40009、A40010金額與平均 |
||||
|
$average_budget = round($sum_total_budget / $sum_facility); |
||||
|
$average_A40002 = round($sum_A40002 / $sum_facility); |
||||
|
$average_A40009 = round($sum_A40009 / $sum_facility); |
||||
|
$average_A40010 = round($sum_A40010 / $sum_facility); |
||||
|
|
||||
|
foreach($arrayData as $key=> $data){ |
||||
|
echo $key."<br>"; |
||||
|
print_r($data); |
||||
|
echo "<br>-----------------------------<br>"; |
||||
|
} |
||||
|
exit(); |
||||
|
?> |
||||
|
<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"> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_total_budget">合約總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_total_budget" name="sum_total_budget" value="<?= number_format($sum_total_budget) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_A40002">M1總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_A40002" name="sum_A40002" value="<?= number_format($sum_A40002) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_A40009">設備總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_A40009" name="sum_A40009" value="<?= number_format($sum_A40009) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="sum_A40010">安裝總金額</label> |
||||
|
<input type="text" class="form-control" id="sum_A40010" name="sum_A40010" value="<?= number_format($sum_A40010) ?>" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-6"> |
||||
|
<label for="sum_facility">總台數</label> |
||||
|
<input type="text" class="form-control" id="sum_facility" name="sum_facility" value="<?= number_format($sum_facility) ?>" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_budget">平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_budget" name="average_budget" value="<?= number_format($average_budget) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_A40002">M1平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_A40002" name="average_A40002" value="<?= number_format($average_A40002) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_A40009">設備平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_A40009" name="average_A40009" value="<?= number_format($average_A40009) ?>" disabled> |
||||
|
</div> |
||||
|
<div class="col-md-3"> |
||||
|
<label for="average_A40010">安裝平均金額</label> |
||||
|
<input type="text" class="form-control" id="average_A40010" name="average_A40010" value="<?= number_format($average_A40010) ?>" disabled> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</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:120px'>合約號</th> |
||||
|
<th style='text-align:center;vertical-align: middle;width:120px'>作番號</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;width:130px'>客戶名稱</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:end;vertical-align: middle;'>應收金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>已開金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>未開金額</th> |
||||
|
<th style='text-align:end;vertical-align: middle;'>已收金額</th> |
||||
|
<th style='text-align:end;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><?= $row[0]; ?></td> |
||||
|
<td><?= $row[1]; ?></td> |
||||
|
<td><?= $row[2] . "<br>" . $row[3]; ?></td> |
||||
|
<td><?= $row[4] . "<br>" . $row[5]; ?></td> |
||||
|
<td><?= $row[6] . "<br>" . $row[7]; ?></td> |
||||
|
<td><?= $row[8]; ?></td> |
||||
|
<td><?= $row[12]; ?></td> |
||||
|
<td><?= $row[13]; ?></td> |
||||
|
<td><?= $row[14]; ?></td> |
||||
|
<td><?= $row[15]; ?></td> |
||||
|
<td><?= $row[16]; ?></td> |
||||
|
<td><?= $row[17]; ?></td> |
||||
|
<td><?= $row[18]; ?></td> |
||||
|
<td><?= $row[19]; ?></td> |
||||
|
<td><?= $row[20]; ?></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(); |
||||
|
// var rowText = rows[i].id.toLowerCase(); |
||||
|
if (rowText.includes(searchTerm)) { |
||||
|
console.log(rowText); |
||||
|
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=all&<?= $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-renovate.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> |
File diff suppressed because it is too large
Binary file not shown.
@ -0,0 +1,75 @@ |
|||||
|
<?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; |
||||
|
} |
||||
|
// } |
@ -0,0 +1,135 @@ |
|||||
|
<?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="bons_index" x-data="bonsIndex"> |
||||
|
<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="5"> |
||||
|
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contract_no" x-model="data.contract_no"> |
||||
|
</td> |
||||
|
<td colspan="2" style="vertical-align:middle"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
|
||||
|
<template x-if="step==2"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px"> |
||||
|
<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> |
||||
|
<input type="text" x-model="data.contract_no" disabled="disabled"> |
||||
|
</td> |
||||
|
<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> |
||||
|
</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.bons_verson" disabled="disabled"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td style="vertical-align:middle">獎金發放人員</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.receiver" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">保養月份</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_month" disabled="disabled"> |
||||
|
</td> |
||||
|
<td style="vertical-align:middle">保養總額</td> |
||||
|
<td> |
||||
|
<input type="text" x-model="data.maintain_price_toal" disabled="disabled"> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</template> |
||||
|
<!-- 獎金計算頁面 --> |
||||
|
<template x-if="step == 3"> |
||||
|
<tbody style="font-weight: bolder;margin-bottom:20px"> |
||||
|
<tr> |
||||
|
<td colspan="7" style="vertical-align:middle;border-right:0px"> |
||||
|
<h4>獎金確認項</h4> |
||||
|
</td> |
||||
|
<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> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</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> |
@ -0,0 +1,125 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):1.0 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
作番賣價($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
營業員獎金($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_new_deal_bonus_v1_0($ver, $contract_type, $elevator_knockdown_price, $sales_id, $region_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "1.0"){ |
||||
|
|
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.007; |
||||
|
#地區經理經理獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
|
||||
|
case "general_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.015; |
||||
|
#區域經理獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 600; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.2), #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款20% |
||||
|
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "shipping", #訂金已收款20% |
||||
|
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.3), #金額 |
||||
|
"payment_schedul_due" => "acceptance", #訂金已收款20% |
||||
|
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#區域經理獎金水庫-----訂金已收款100%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100% |
||||
|
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$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,72 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):1.0 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
作番賣價($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
營業員獎金($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_new_deal_bonus_v1_0.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $elevator_knockdown_price, $sales_id, $region_manger_id |
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["2.0","strategy_customer",1000000,"M0001", "M0003"], |
||||
|
#戰略客戶(strategy_customer) |
||||
|
["1.0","strategy_customer",1000000,"M0001", "M0003"], #戰略客戶 |
||||
|
|
||||
|
#一般客戶(general_customer) |
||||
|
["1.0","general_customer",1000000,"M0001", "M0003"] #一般客戶 |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = elevator_new_deal_bonus_v1_0( |
||||
|
$examination_array[$i][0], |
||||
|
$examination_array[$i][1], |
||||
|
$examination_array[$i][2], |
||||
|
$examination_array[$i][3], |
||||
|
$examination_array[$i][4] |
||||
|
); |
||||
|
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] . "<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,164 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.0 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
作番機種($elevator_type):客梯(passenger)、貨梯(cargo)、小電梯(dumbwaiter)、平台梯(flatbase)、強驅(positive_drive) |
||||
|
作番表價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
作番賣價($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
銷售點數($discount):作番賣價($elevator_knockdown_price) 除以 作番表價($elevator_list_price) |
||||
|
營業員獎金($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_new_deal_bonus_v2_0($ver, $contract_type, $elevator_type, $elevator_list_price, $elevator_knockdown_price, $sales_id, $region_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.0"){ |
||||
|
$discount = round($elevator_knockdown_price / $elevator_list_price, 3); #銷售點數,取到小數點第三位。 |
||||
|
|
||||
|
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
switch ($contract_type){ |
||||
|
case "strategy_customer": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.007; |
||||
|
#地區經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 400; |
||||
|
break; |
||||
|
|
||||
|
case "general_customer": |
||||
|
switch ($elevator_type) { |
||||
|
#客梯(passenger)、貨梯(cargo) |
||||
|
case ($elevator_type == "passenger" or $elevator_type == "cargo"): |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 1.0): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.02; |
||||
|
break; |
||||
|
case ($discount >= 0.9 and $discount < 1.0): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.018; |
||||
|
break; |
||||
|
case ($discount >= 0.75 and $discount < 0.9): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.015; |
||||
|
break; |
||||
|
case ($discount < 0.75): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.008; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
|
||||
|
#小電梯(dumbwaiter)、平台梯(flatbase)、強驅(positive_drive) |
||||
|
case ($elevator_type == "dumbwaiter" or $elevator_type == "flatbase" or $elevator_type == "positive_drive"): |
||||
|
switch ($discount) { |
||||
|
case ($discount >= 1.0): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.02; |
||||
|
break; |
||||
|
case ($discount >= 0.9 and $discount < 1.0): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.018; |
||||
|
break; |
||||
|
case ($discount >= 0.72 and $discount < 0.9): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.015; |
||||
|
break; |
||||
|
case ($discount < 0.72): |
||||
|
$sales_bonus = $elevator_knockdown_price * 0.008; |
||||
|
break; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
#區域經理提成獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 600; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.2), #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款20% |
||||
|
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "shipping", #訂金已收款20% |
||||
|
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus * 0.3), #金額 |
||||
|
"payment_schedul_due" => "acceptance", #訂金已收款20% |
||||
|
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "deposit", #訂金已收款100% |
||||
|
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50% |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_bonus * 0.5), #金額 |
||||
|
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100% |
||||
|
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$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,116 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.0 |
||||
|
合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer) |
||||
|
作番機種($elevator_type):客梯(passenger)、貨梯(cargo)、小電梯(dumbwaiter)、平台梯(flatbase)、強驅(positive_drive) |
||||
|
作番表價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格 |
||||
|
作番賣價($elevator_knockdown_price):電梯的合約最後成交價 |
||||
|
營業員員工號($sales_id) |
||||
|
區域經理員工號($region_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
銷售點數($discount):作番賣價($elevator_knockdown_price) 除以 作番表價($elevator_list_price) |
||||
|
營業員獎金($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_new_deal_bonus_v2_0.php"); |
||||
|
|
||||
|
#$ver, $contract_type, $elevator_type, $elevator_list_price, $elevator_knockdown_price, $sales_id, $region_manger_id |
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","strategy_customer","passenger",1000000,1000000,"M0001", "M0003"], |
||||
|
#戰略客戶(strategy_customer) |
||||
|
["2.0","strategy_customer","passenger",1000000,1000000,"M0001", "M0003"], #戰略客戶、客梯、銷售點數100% |
||||
|
["2.0","strategy_customer","passenger",1000000,900000,"M0001", "M0003"], #戰略客戶、客梯、銷售點數90% |
||||
|
["2.0","strategy_customer","passenger",1000000,750000,"M0001", "M0003"], #戰略客戶、客梯、銷售點數75% |
||||
|
["2.0","strategy_customer","passenger",1000000,600000,"M0001", "M0003"], #戰略客戶、客梯、銷售點數60% |
||||
|
["2.0","strategy_customer","cargo",1000000,1000000,"M0001", "M0003"], #戰略客戶、貨梯、銷售點數100% |
||||
|
["2.0","strategy_customer","cargo",1000000,900000,"M0001", "M0003"], #戰略客戶、貨梯、銷售點數90% |
||||
|
["2.0","strategy_customer","cargo",1000000,750000,"M0001", "M0003"], #戰略客戶、貨梯、銷售點數75% |
||||
|
["2.0","strategy_customer","cargo",1000000,600000,"M0001", "M0003"], #戰略客戶、貨梯、銷售點數60% |
||||
|
["2.0","strategy_customer","dumbwaiter",1000000,1000000,"M0001", "M0003"], #戰略客戶、小電梯、銷售點數100% |
||||
|
["2.0","strategy_customer","dumbwaiter",1000000,900000,"M0001", "M0003"], #戰略客戶、小電梯、銷售點數90% |
||||
|
["2.0","strategy_customer","dumbwaiter",1000000,720000,"M0001", "M0003"], #戰略客戶、小電梯、銷售點數75% |
||||
|
["2.0","strategy_customer","dumbwaiter",1000000,600000,"M0001", "M0003"], #戰略客戶、小電梯、銷售點數60% |
||||
|
["2.0","strategy_customer","flatbase",1000000,1000000,"M0001", "M0003"], #戰略客戶、平台梯、銷售點數100% |
||||
|
["2.0","strategy_customer","flatbase",1000000,900000,"M0001", "M0003"], #戰略客戶、平台梯、銷售點數90% |
||||
|
["2.0","strategy_customer","flatbase",1000000,720000,"M0001", "M0003"], #戰略客戶、平台梯、銷售點數75% |
||||
|
["2.0","strategy_customer","flatbase",1000000,600000,"M0001", "M0003"], #戰略客戶、平台梯、銷售點數60% |
||||
|
["2.0","strategy_customer","positive_drive",1000000,1000000,"M0001", "M0003"], #戰略客戶、強驅、銷售點數100% |
||||
|
["2.0","strategy_customer","positive_drive",1000000,900000,"M0001", "M0003"], #戰略客戶、強驅、銷售點數90% |
||||
|
["2.0","strategy_customer","positive_drive",1000000,720000,"M0001", "M0003"], #戰略客戶、強驅、銷售點數75% |
||||
|
["2.0","strategy_customer","positive_drive",1000000,600000,"M0001", "M0003"], #戰略客戶、強驅、銷售點數60% |
||||
|
|
||||
|
#一般客戶(general_customer) |
||||
|
["2.0","general_customer","passenger",1000000,1000000,"M0001", "M0003"], #一般客戶、客梯、銷售點數100% |
||||
|
["2.0","general_customer","passenger",1000000,900000,"M0001", "M0003"], #一般客戶、客梯、銷售點數90% |
||||
|
["2.0","general_customer","passenger",1000000,750000,"M0001", "M0003"], #一般客戶、客梯、銷售點數75% |
||||
|
["2.0","general_customer","passenger",1000000,600000,"M0001", "M0003"], #一般客戶、客梯、銷售點數60% |
||||
|
["2.0","general_customer","cargo",1000000,1000000,"M0001", "M0003"], #一般客戶、貨梯、銷售點數100% |
||||
|
["2.0","general_customer","cargo",1000000,900000,"M0001", "M0003"], #一般客戶、貨梯、銷售點數90% |
||||
|
["2.0","general_customer","cargo",1000000,750000,"M0001", "M0003"], #一般客戶、貨梯、銷售點數75% |
||||
|
["2.0","general_customer","cargo",1000000,600000,"M0001", "M0003"], #一般客戶、貨梯、銷售點數60% |
||||
|
["2.0","general_customer","dumbwaiter",1000000,1000000,"M0001", "M0003"], #一般客戶、小電梯、銷售點數100% |
||||
|
["2.0","general_customer","dumbwaiter",1000000,900000,"M0001", "M0003"], #一般客戶、小電梯、銷售點數90% |
||||
|
["2.0","general_customer","dumbwaiter",1000000,720000,"M0001", "M0003"], #一般客戶、小電梯、銷售點數75% |
||||
|
["2.0","general_customer","dumbwaiter",1000000,600000,"M0001", "M0003"], #一般客戶、小電梯、銷售點數60% |
||||
|
["2.0","general_customer","flatbase",1000000,1000000,"M0001", "M0003"], #一般客戶、平台梯、銷售點數100% |
||||
|
["2.0","general_customer","flatbase",1000000,900000,"M0001", "M0003"], #一般客戶、平台梯、銷售點數90% |
||||
|
["2.0","general_customer","flatbase",1000000,720000,"M0001", "M0003"], #一般客戶、平台梯、銷售點數75% |
||||
|
["2.0","general_customer","flatbase",1000000,600000,"M0001", "M0003"], #一般客戶、平台梯、銷售點數60% |
||||
|
["2.0","general_customer","positive_drive",1000000,1000000,"M0001", "M0003"], #一般客戶、強驅、銷售點數100% |
||||
|
["2.0","general_customer","positive_drive",1000000,900000,"M0001", "M0003"], #一般客戶、強驅、銷售點數90% |
||||
|
["2.0","general_customer","positive_drive",1000000,720000,"M0001", "M0003"], #一般客戶、強驅、銷售點數75% |
||||
|
["2.0","general_customer","positive_drive",1000000,600000,"M0001", "M0003"] #一般客戶、強驅、銷售點數60% |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = elevator_new_deal_bonus_v2_0( |
||||
|
$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,399 @@ |
|||||
|
<?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,248 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.0 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
簽約年數($contract_years):1年(one),超過1年(above_two) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區經理經理員工號($region_manger_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區經理經理獎金($region_manager_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放日($payday_due) |
||||
|
獎金預計發放規定($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_0($ver, $contract_type, $contract_years, $discount, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_manger_id, $regular_contract_manger_id){ |
||||
|
$bonus_array = []; |
||||
|
if ($ver == "2.0"){ |
||||
|
|
||||
|
#契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
switch ($contract_type){ |
||||
|
case "new": |
||||
|
#契約員獎金($sales_bonus) |
||||
|
switch ($fee_per_st) { |
||||
|
case ($fee_per_st <= 3000): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3001 and $fee_per_st <= 3499): |
||||
|
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7; |
||||
|
break; |
||||
|
case ($fee_per_st >= 3500 and $fee_per_st <= 3999): |
||||
|
$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; |
||||
|
}; |
||||
|
#地區經理經理獎金($region_manager_bonus) |
||||
|
$region_manager_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.5; |
||||
|
break; |
||||
|
}; |
||||
|
#地區經理經理獎金($region_manager_bonus) |
||||
|
$region_manager_bonus = 100; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 100; |
||||
|
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_manager_bonus) |
||||
|
$region_manager_bonus = 100; |
||||
|
#專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
$regular_contract_manger_bonus = 100; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
switch ($discount) { |
||||
|
case ($discount < 0.6): |
||||
|
$sales_bonus = $sales_bonus * 0.7; |
||||
|
break; |
||||
|
case ($discount >= 0.6 and $discount < 0.8): |
||||
|
$sales_bonus = $sales_bonus * 0.8; |
||||
|
break; |
||||
|
case ($discount >= 0.8): |
||||
|
$sales_bonus = $sales_bonus * 1.0; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
#簽約年數($contract_years):1年(1),超過1年(above) |
||||
|
|
||||
|
switch ($contract_years){ |
||||
|
case $contract_years == "one": |
||||
|
#契約員獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#地區經理經理獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "地區經理獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_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" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
break; |
||||
|
|
||||
|
case $contract_years == "above_two": |
||||
|
/*** 以下第1年獎金 ***/ |
||||
|
#契約員獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +1 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#地區經理經理獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "地區經理獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_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" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
/*** 以上第1年獎金 ***/ |
||||
|
|
||||
|
/*** 以下第2年獎金 ***/ |
||||
|
#第2年契約員獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "契約員獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $sales_id, #發放人員 |
||||
|
"bonus_amount" => round($sales_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +13 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#第2年地區經理經理獎金 |
||||
|
array_push($bonus_array,[ |
||||
|
"bonus_type" => "地區經理獎金", #獎金名稱 |
||||
|
"bonus_receiver" => $region_manger_id, #發放人員 |
||||
|
"bonus_amount" => round($region_manager_bonus), #金額 |
||||
|
"pay_day_due" => date("Y-m-d",strtotime("$receivable_date_due +13 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
|
||||
|
#第2年專任契約經理獎金 |
||||
|
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 +13 months")), #預計發放時間 |
||||
|
"bonus_regulation" => "合約簽回及保養款項收回的次月一次性發" #發放規定 |
||||
|
]); |
||||
|
/*** 以上第2年獎金 ***/ |
||||
|
|
||||
|
$result_array = [ |
||||
|
"ver"=>$ver, #獎金版本 |
||||
|
"result_status"=>"success", #計算結果 |
||||
|
"bonus_array"=>$bonus_array #獎金水庫 |
||||
|
]; |
||||
|
break; |
||||
|
} |
||||
|
}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,156 @@ |
|||||
|
<?php |
||||
|
/* 函數用法與參數 |
||||
|
【1.輸入參數:】 |
||||
|
獎金版本($ver):2.0 |
||||
|
契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上 |
||||
|
該作番所佔的服務費金額($commission_fee) |
||||
|
合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) |
||||
|
簽約年數($contract_years):1年(one),超過1年(above_two) |
||||
|
第一筆保養款項應收回日($receivable_date_due, array) |
||||
|
契約員員工號($sales_id) |
||||
|
地區經理經理員工號($region_manger_id) |
||||
|
專任契約經理員工號($regular_contract_manger_id) |
||||
|
|
||||
|
【2.函數中的變數說明】 |
||||
|
契約員獎金($sales_bonus) |
||||
|
地區經理經理獎金($region_manger_bonus) |
||||
|
專任契約經理獎金($regular_contract_manger_bonus) |
||||
|
獎金預計發放日($payday_due) |
||||
|
獎金預計發放規定($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_0.php"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
#獎金測試 |
||||
|
$examination_array = [ |
||||
|
#錯誤版本 |
||||
|
["1.0","new","one",0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"], |
||||
|
#新簽約 |
||||
|
["2.0","new","one",0.8,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3000元 |
||||
|
["2.0","new","one",0.8,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3200元 |
||||
|
["2.0","new","one",0.8,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3500元 |
||||
|
["2.0","new","one",0.8,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、4000元 |
||||
|
["2.0","new","one",0.7,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3000元 |
||||
|
["2.0","new","one",0.7,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3200元 |
||||
|
["2.0","new","one",0.7,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3500元 |
||||
|
["2.0","new","one",0.7,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、4000元 |
||||
|
["2.0","new","one",0.6,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3000元 |
||||
|
["2.0","new","one",0.6,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3200元 |
||||
|
["2.0","new","one",0.6,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3500元 |
||||
|
["2.0","new","one",0.6,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、4000元 |
||||
|
["2.0","new","above_two",0.8,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3000元 |
||||
|
["2.0","new","above_two",0.8,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3200元 |
||||
|
["2.0","new","above_two",0.8,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3500元 |
||||
|
["2.0","new","above_two",0.8,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、4000元 |
||||
|
["2.0","new","above_two",0.7,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3000元 |
||||
|
["2.0","new","above_two",0.7,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3200元 |
||||
|
["2.0","new","above_two",0.7,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3500元 |
||||
|
["2.0","new","above_two",0.7,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、4000元 |
||||
|
["2.0","new","above_two",0.6,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3000元 |
||||
|
["2.0","new","above_two",0.6,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3200元 |
||||
|
["2.0","new","above_two",0.6,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3500元 |
||||
|
["2.0","new","above_two",0.6,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、4000元 |
||||
|
|
||||
|
#免保轉有費(free_to_charge) |
||||
|
["2.0","free_to_charge","one",0.8,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3000元 |
||||
|
["2.0","free_to_charge","one",0.8,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3200元 |
||||
|
["2.0","free_to_charge","one",0.8,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3500元 |
||||
|
["2.0","free_to_charge","one",0.8,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、4000元 |
||||
|
["2.0","free_to_charge","one",0.7,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3000元 |
||||
|
["2.0","free_to_charge","one",0.7,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3200元 |
||||
|
["2.0","free_to_charge","one",0.7,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3500元 |
||||
|
["2.0","free_to_charge","one",0.7,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、4000元 |
||||
|
["2.0","free_to_charge","one",0.6,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3000元 |
||||
|
["2.0","free_to_charge","one",0.6,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3200元 |
||||
|
["2.0","free_to_charge","one",0.6,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3500元 |
||||
|
["2.0","free_to_charge","one",0.6,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、4000元 |
||||
|
["2.0","free_to_charge","above_two",0.8,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3000元 |
||||
|
["2.0","free_to_charge","above_two",0.8,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3200元 |
||||
|
["2.0","free_to_charge","above_two",0.8,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3500元 |
||||
|
["2.0","free_to_charge","above_two",0.8,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、4000元 |
||||
|
["2.0","free_to_charge","above_two",0.7,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3000元 |
||||
|
["2.0","free_to_charge","above_two",0.7,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3200元 |
||||
|
["2.0","free_to_charge","above_two",0.7,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3500元 |
||||
|
["2.0","free_to_charge","above_two",0.7,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、4000元 |
||||
|
["2.0","free_to_charge","above_two",0.6,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3000元 |
||||
|
["2.0","free_to_charge","above_two",0.6,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3200元 |
||||
|
["2.0","free_to_charge","above_two",0.6,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3500元 |
||||
|
["2.0","free_to_charge","above_two",0.6,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、4000元 |
||||
|
|
||||
|
#續簽約(原價或僅契約金額異動)(renew_priceissue) |
||||
|
["2.0","renew_priceissue","one",0.8,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3000元 |
||||
|
["2.0","renew_priceissue","one",0.8,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3200元 |
||||
|
["2.0","renew_priceissue","one",0.8,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、3500元 |
||||
|
["2.0","renew_priceissue","one",0.8,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.8、4000元 |
||||
|
["2.0","renew_priceissue","one",0.7,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3000元 |
||||
|
["2.0","renew_priceissue","one",0.7,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3200元 |
||||
|
["2.0","renew_priceissue","one",0.7,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、3500元 |
||||
|
["2.0","renew_priceissue","one",0.7,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.7、4000元 |
||||
|
["2.0","renew_priceissue","one",0.6,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3000元 |
||||
|
["2.0","renew_priceissue","one",0.6,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3200元 |
||||
|
["2.0","renew_priceissue","one",0.6,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、3500元 |
||||
|
["2.0","renew_priceissue","one",0.6,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、1年、折扣率0.6、4000元 |
||||
|
["2.0","renew_priceissue","above_two",0.8,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3000元 |
||||
|
["2.0","renew_priceissue","above_two",0.8,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3200元 |
||||
|
["2.0","renew_priceissue","above_two",0.8,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、3500元 |
||||
|
["2.0","renew_priceissue","above_two",0.8,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.8、4000元 |
||||
|
["2.0","renew_priceissue","above_two",0.7,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3000元 |
||||
|
["2.0","renew_priceissue","above_two",0.7,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3200元 |
||||
|
["2.0","renew_priceissue","above_two",0.7,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、3500元 |
||||
|
["2.0","renew_priceissue","above_two",0.7,4000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.7、4000元 |
||||
|
["2.0","renew_priceissue","above_two",0.6,3000,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3000元 |
||||
|
["2.0","renew_priceissue","above_two",0.6,3200,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3200元 |
||||
|
["2.0","renew_priceissue","above_two",0.6,3500,333,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2年以上、折扣率0.6、3500元 |
||||
|
["2.0","renew_priceissue","above_two",0.6,4000,333,"2014-07-01", "M0001", "M0002", "M0003"] #新簽約、2年以上、折扣率0.6、4000元 |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
|
||||
|
for($i = 0; $i<count($examination_array); $i++){ |
||||
|
$result = maintenance_contract_bonus_v2_0( |
||||
|
$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] . "<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,15 @@ |
|||||
|
<?php |
||||
|
require_once dirname(__FILE__) . "/../../mkt/database.php"; |
||||
|
include "/Users/LO_2342/Desktop/httpdocs/wms/fun_global.php"; |
||||
|
// phpinfo(); |
||||
|
// exit(); |
||||
|
try { |
||||
|
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8test", "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,114 @@ |
|||||
|
<?php |
||||
|
include("../header.php"); |
||||
|
require_once("./conn.php"); |
||||
|
$sql_str = "SELECT * FROM contract_b_signed_back "; |
||||
|
$stmt = $conn->prepare($sql_str); |
||||
|
$stmt->execute(); |
||||
|
$contracts= $stmt->fetchAll(PDO::FETCH_ASSOC); |
||||
|
|
||||
|
?> |
||||
|
|
||||
|
<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 defer src="./js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="./js/axios/axios.min.js"></script> |
||||
|
|
||||
|
|
||||
|
<div style="overflow-x:auto;margin-top:12px"> |
||||
|
<a href="contract-newelevator-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
||||
|
<span class="glyphicon glyphicon-plus"></span> |
||||
|
</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> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<?php foreach($contracts as $contract): ?> |
||||
|
<tr> |
||||
|
<td><?php echo $contract['id']; ?></td> |
||||
|
<td><?php echo $contract['contract_no'] ?></td> |
||||
|
<td><?php echo $contract['company'] ?></td> |
||||
|
<td><?php echo $contract['customer_no'] ?></td> |
||||
|
<td><?php echo $contract['salesperson'] ?></td> |
||||
|
<td><?php echo $contract['contract_start_date'] ?></td> |
||||
|
<td><?php echo $contract['contract_end_date'] ?></td> |
||||
|
<td> |
||||
|
<?php |
||||
|
$endDate = new DateTime($contract['contract_end_date']); |
||||
|
$now = new DateTime(); |
||||
|
$interval = $now->diff($endDate); |
||||
|
if ($interval->days <= 60) { |
||||
|
echo "60天以內。"; |
||||
|
} else { |
||||
|
echo "指定日期與當前日期相差超過60天。"; |
||||
|
} |
||||
|
|
||||
|
?> |
||||
|
</td> |
||||
|
<td><?php echo $contract['created_by'] ?></td> |
||||
|
<td><?php echo $contract['created_at'] ?></td> |
||||
|
<td style="width:30px"> |
||||
|
<p> |
||||
|
<a href="contract-newelevator-edit.php?contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm"> |
||||
|
<span class="glyphicon glyphicon-pencil"></span> |
||||
|
</a> |
||||
|
<a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>)"> |
||||
|
<span class="glyphicon glyphicon-remove"></span> |
||||
|
</a> |
||||
|
</p> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<?php endforeach ?> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<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> |
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,7 @@ |
|||||
|
const pricereviewCreate = ()=>{ |
||||
|
return { |
||||
|
init(){ |
||||
|
console.log(123) |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
#pricereviewCreate table, #pricereviewCreate th, #pricereviewCreate td { |
||||
|
border: 1px #ccc solid; |
||||
|
padding: 15px; |
||||
|
} |
||||
|
#pricereviewCreate table thead th { |
||||
|
background-color: #6D9EEB; |
||||
|
} |
||||
|
#pricereviewCreate table tbody td input { |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
#pricereviewCreate table tbody th { |
||||
|
background-color: #CCE4F8; |
||||
|
font-size: 14px; |
||||
|
padding: 15px 2px; |
||||
|
min-width: 100px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
#pricereviewCreate table input { |
||||
|
font-size: 13px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain { |
||||
|
background-color: #F2F2F2; |
||||
|
padding: 20px; |
||||
|
border-radius: 6px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain button { |
||||
|
color: #fff; |
||||
|
width: 55px; |
||||
|
height: 30px; |
||||
|
padding: 0; |
||||
|
margin-left: 10px; |
||||
|
font-size: 13px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain button.addbtn { |
||||
|
background-color: #337AB7; |
||||
|
width: 30px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain button.deleteBtn { |
||||
|
background-color: #D9534F; |
||||
|
color: #fff; |
||||
|
font-size: 12px; |
||||
|
width: 30px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain button.selectElevator { |
||||
|
background-color: #D9534F; |
||||
|
color: #fff; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem { |
||||
|
border: 1px #ccc solid; |
||||
|
padding: 10px; |
||||
|
border-radius: 4px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem .title { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
border-bottom: 1px #ccc solid; |
||||
|
padding: 10px 0; |
||||
|
margin-bottom: 10px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem .title h6 { |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table, #pricereviewCreate .pricreviewmain > .divitem th, #pricereviewCreate .pricreviewmain > .divitem td { |
||||
|
font-size: 14px; |
||||
|
background-color: transparent; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table input, #pricereviewCreate .pricreviewmain > .divitem table select, #pricereviewCreate .pricreviewmain > .divitem table textarea, #pricereviewCreate .pricreviewmain > .divitem th input, #pricereviewCreate .pricreviewmain > .divitem th select, #pricereviewCreate .pricreviewmain > .divitem th textarea, #pricereviewCreate .pricreviewmain > .divitem td input, #pricereviewCreate .pricreviewmain > .divitem td select, #pricereviewCreate .pricreviewmain > .divitem td textarea { |
||||
|
font-size: 13px; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table input[type=number]::-webkit-outer-spin-button, |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .pricreviewmain > .divitem th input[type=number]::-webkit-outer-spin-button, |
||||
|
#pricereviewCreate .pricreviewmain > .divitem th input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .pricreviewmain > .divitem td input[type=number]::-webkit-outer-spin-button, |
||||
|
#pricereviewCreate .pricreviewmain > .divitem td input[type=number]::-webkit-inner-spin-button { |
||||
|
-webkit-appearance: none; |
||||
|
margin: 0; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table tr:hover .deleteBtn { |
||||
|
opacity: 1; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table .saletd { |
||||
|
position: relative; |
||||
|
} |
||||
|
#pricereviewCreate .pricreviewmain > .divitem table .saletd > .deleteBtn { |
||||
|
position: absolute; |
||||
|
top: 50%; |
||||
|
transform: translateY(-50%); |
||||
|
right: 2px; |
||||
|
opacity: 0; |
||||
|
transition: 0.3s; |
||||
|
}/*# sourceMappingURL=pricereview.css.map */ |
@ -0,0 +1 @@ |
|||||
|
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,sBAAA;EACA,aAAA;ACAR;ADGQ;EACI,yBAAA;ACDZ;ADIY;EACI,eAAA;ACFhB;ADIY;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACFhB;ADKQ;EACI,eAAA;ACHZ;ADMI;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;ACJR;ADKQ;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACHZ;ADIY;EACI,yBAAA;EACA,WAAA;ACFhB;ADIY;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACFhB;ADIY;EACI,yBAAA;EACA,WAAA;ACFhB;ADMQ;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACJZ;ADKY;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACHhB;ADIgB;EACI,gBAAA;ACFpB;ADMY;EACI,eAAA;EACA,6BAAA;ACJhB;ADKgB;EACI,eAAA;ACHpB;ADKgB;;;;EAEA,wBAAA;EACA,SAAA;ACDhB;ADKgB;EACI,UAAA;ACHpB;ADKgB;EACI,kBAAA;ACHpB;ADIoB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACFxB","file":"pricereview.css"} |
@ -0,0 +1,98 @@ |
|||||
|
#pricereviewCreate{ |
||||
|
table, th, td{ |
||||
|
border:1px #ccc solid; |
||||
|
padding: 15px; |
||||
|
} |
||||
|
table{ |
||||
|
thead th{ |
||||
|
background-color: #6D9EEB; |
||||
|
} |
||||
|
tbody { |
||||
|
td input{ |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
th{ |
||||
|
background-color: #CCE4F8; |
||||
|
font-size: 14px; |
||||
|
padding: 15px 2px; |
||||
|
min-width: 100px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
} |
||||
|
input{ |
||||
|
font-size: 13px; |
||||
|
} |
||||
|
} |
||||
|
.pricreviewmain{ |
||||
|
background-color: #F2F2F2; |
||||
|
padding: 20px; |
||||
|
border-radius: 6px ; |
||||
|
button{ |
||||
|
color:#fff; |
||||
|
width: 55px; |
||||
|
height: 30px; |
||||
|
padding: 0; |
||||
|
margin-left: 10px; |
||||
|
font-size: 13px; |
||||
|
&.addbtn{ |
||||
|
background-color: #337AB7; |
||||
|
width: 30px; |
||||
|
} |
||||
|
&.deleteBtn{ |
||||
|
background-color: #D9534F; |
||||
|
color:#fff; |
||||
|
font-size: 12px; |
||||
|
width: 30px; |
||||
|
} |
||||
|
&.selectElevator{ |
||||
|
background-color: #D9534F; |
||||
|
color:#fff; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
>.divitem{ |
||||
|
border:1px #ccc solid; |
||||
|
padding: 10px; |
||||
|
border-radius: 4px ; |
||||
|
.title{ |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
border-bottom: 1px #ccc solid; |
||||
|
padding: 10px 0; |
||||
|
margin-bottom: 10px; |
||||
|
h6{ |
||||
|
font-weight: 600; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
table, th, td{ |
||||
|
font-size: 14px; |
||||
|
background-color: transparent; |
||||
|
input, select, textarea{ |
||||
|
font-size: 13px; |
||||
|
} |
||||
|
input[type=number]::-webkit-outer-spin-button, |
||||
|
input[type=number]::-webkit-inner-spin-button { |
||||
|
-webkit-appearance: none; |
||||
|
margin: 0; |
||||
|
} |
||||
|
} |
||||
|
table { |
||||
|
tr:hover .deleteBtn{ |
||||
|
opacity: 1; |
||||
|
} |
||||
|
.saletd{ |
||||
|
position: relative; |
||||
|
>.deleteBtn{ |
||||
|
position: absolute; |
||||
|
top: 50%; |
||||
|
transform: translateY(-50%); |
||||
|
right:2px; |
||||
|
opacity: 0; |
||||
|
transition: .3s; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,516 @@ |
|||||
|
<?php |
||||
|
|
||||
|
// include "../header.php"; |
||||
|
require_once("./conn.php"); |
||||
|
|
||||
|
?> |
||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"> |
||||
|
<link rel="stylesheet" href="./css/pricereview.css"> |
||||
|
<script src="./assets/js/alpinejs/cdn.min.js"></script> |
||||
|
<script src="./assets/js/pricereviewAlpine.js"></script> |
||||
|
<div id="pricereviewCreate" x-data="pricereviewCreate()"> |
||||
|
<div class="container"> |
||||
|
<table class="table" border="1"> |
||||
|
<thead > |
||||
|
<tr class="" > |
||||
|
<th scope="col" class="text-center " colspan="8">有望客戶基本資料</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<th >卷號</th> |
||||
|
<td><input class="form-control" type="text" disabled value="B123456789" /></td> |
||||
|
<th>客戶名稱</th> |
||||
|
<td><input class="form-control" type="text" disabled value="中華民國" /></td> |
||||
|
<th>負責人</th> |
||||
|
<td><input class="form-control" type="text" disabled value="馬英九" /></td> |
||||
|
<th>客戶來源</th> |
||||
|
<td><input class="form-control" type="text" disabled value="朋友介紹" /></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>地址</th> |
||||
|
<td><input class="form-control" type="text" disabled value="嘉義市東區日新街55巷13號" /></td> |
||||
|
<th>案件名稱</th> |
||||
|
<td><input class="form-control" type="text" disabled value="川勝開發營造(興美七街)" /></td> |
||||
|
<th>統編/身份證</th> |
||||
|
<td><input class="form-control" type="text" disabled value="83557587" /></td> |
||||
|
<th>業主方聯係人</th> |
||||
|
<td><input class="form-control" type="text" disabled value="曾祈達" /></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>市話/手機</th> |
||||
|
<td><input class="form-control" type="text" disabled value="0921361700" /></td> |
||||
|
<th>營業員</th> |
||||
|
<td><input class="form-control" type="text" disabled value="林易增" /></td> |
||||
|
<th>台數</th> |
||||
|
<td><input class="form-control" type="number" disabled value="1" /></td> |
||||
|
<th>預定成交日</th> |
||||
|
<td><input class="form-control" type="text" disabled value="2024/02/01" /></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th>有望客戶狀態</th> |
||||
|
<td><input class="form-control" type="text" disabled value="有望簽約(已報價)" /></td> |
||||
|
<th>汰改</th> |
||||
|
<td><input class="form-control" type="text" disabled value="否" /></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
|
||||
|
<table class="table" border="1"> |
||||
|
<thead > |
||||
|
<tr class="" > |
||||
|
<th scope="col" class="text-center " colspan="8">洽商進度</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td colspan=8> |
||||
|
<textarea class="form-control" name="progress" id="progress" cols="20" rows="5" disabled ></textarea> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<table class="table" border="1"> |
||||
|
<thead > |
||||
|
<tr class="" > |
||||
|
<th scope="col" class="text-center " colspan="8">電梯規格訊息</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<th >序號</th> |
||||
|
<th >規格</th> |
||||
|
<th >人乘/載重</th> |
||||
|
<th >停數</th> |
||||
|
<th >開門方式</th> |
||||
|
<th >速度(m/min)</th> |
||||
|
<th >數量</th> |
||||
|
<th >單價</th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="1"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="MAH100(家庭梯)"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="6人"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="4人"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="2S"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="45"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="1"></td> |
||||
|
<td ><input type="text" disabled class="form-control disabled" value="100000"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<div class="pricreviewmain container"> |
||||
|
<div class="divitem"> |
||||
|
<div class="title"> |
||||
|
<h6>整機單價</h6> |
||||
|
<button class="addbtn btn" x-ref="addElevatorBtn">+</button> |
||||
|
</div> |
||||
|
<table class="table" border=1> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td>電梯</td> |
||||
|
<td>人乘/載重</td> |
||||
|
<td>停數</td> |
||||
|
<td>速度(m/min)</td> |
||||
|
<td>開門方式</td> |
||||
|
<td>規格</td> |
||||
|
<td>單價</td> |
||||
|
<td>數量</td> |
||||
|
<td>複價</td> |
||||
|
<td>售價 </td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="MAE100">MAE100有機房</option> |
||||
|
<option value="MAM200">MAM200無機房</option> |
||||
|
<option value="MAH100">MAH100小電梯</option> |
||||
|
<option value="MAF100">MAE100貨梯(有機房)</option> |
||||
|
<option value="MAQ100">MAQ100強趨梯</option> |
||||
|
<option value="MAP100">MAP100平台梯</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="6">6</option> |
||||
|
<option value="8">8</option> |
||||
|
<option value="9">9</option> |
||||
|
<option value="10">10</option> |
||||
|
<option value="11">11</option> |
||||
|
<option value="12">12</option> |
||||
|
<option value="13">13</option> |
||||
|
<option value="15">15</option> |
||||
|
<option value="17">17</option> |
||||
|
<option value="20">20</option> |
||||
|
<option value="24">24</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input class="form-control" type="number" style="width:50px;padding-left:5px" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" style="width:80px"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="9">9</option> |
||||
|
<option value="24">24</option> |
||||
|
<option value="30">30</option> |
||||
|
<option value="45">45</option> |
||||
|
<option value="60">60</option> |
||||
|
<option value="90">90</option> |
||||
|
<option value="105">105</option> |
||||
|
<option value="120">120</option> |
||||
|
<option value="150">150</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" style="width:80px"> |
||||
|
<option value="CO">CO</option> |
||||
|
<option value="2S">2S</option> |
||||
|
<option value="2U">CO</option> |
||||
|
<option value="4PCO">4PCO</option> |
||||
|
<option value="6PCO">6PCO</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input type="text" class="form-control" disabled value="MAE100-6*7-CO45"> |
||||
|
</td> |
||||
|
<td><input type="text" class="form-control" disabled value="750000" style="width:100px"></td> |
||||
|
<td><input type="number" class="form-control " disabled value="1" style="width:40px;padding-left:5px"></td> |
||||
|
<td><input type="number" class="form-control " disabled value="750000" style="width:100px"></td> |
||||
|
<td class="saletd"> |
||||
|
<input type="number" class="form-control " disabled value="690000" style="width:100px"> |
||||
|
<button class="deleteBtn btn btn-danger">X</button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan=7>小計</td> |
||||
|
<td><input type="number" class="form-control" disabled value="1" style="width:40px;padding-left:5px"></td> |
||||
|
<td><input type="text" class="form-control" disabled value="750000" style="width:100px"></td> |
||||
|
<td><input type="text" class="form-control" disabled value="690000" style="width:100px"></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<div class="divitem"> |
||||
|
<div class="title"> |
||||
|
<h6>Option加價</h6> |
||||
|
<button class="addbtn btn" x-ref="addElevatorBtn">+</button> |
||||
|
</div> |
||||
|
<table class="table" border=1> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td>選配規格</td> |
||||
|
<td>單價</td> |
||||
|
<td>數量</td> |
||||
|
<td>複價</td> |
||||
|
<td>備註</td> |
||||
|
<td>所屬電梯</td> |
||||
|
<td>功能</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td><button class="btn btn-success">選擇</button></td> |
||||
|
<td><input type="text" class="form-control" value="35000"></td> |
||||
|
<td><input type="number" class="form-control" value="1"></td> |
||||
|
<td><input type="text" class="form-control" disabled value="35000"></td> |
||||
|
<td><input type="text" class="form-control"></td> |
||||
|
<td>MAE100-6*7-CO45</td> |
||||
|
<td> |
||||
|
<div class="d-flex"> |
||||
|
<button class="selectElevator btn btn-danger">電梯</button> |
||||
|
<button class="deleteBtn btn btn-danger">X</button> |
||||
|
</div> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan=3>小計</td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="350000" ></td> |
||||
|
<td colspan=4 ></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<div class="divitem"> |
||||
|
<div class="title"> |
||||
|
<h6>除外項目</h6> |
||||
|
<button class="addbtn btn" x-ref="addElevatorBtn">+</button> |
||||
|
</div> |
||||
|
<table class="table" border=1> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td>詢價單號</td> |
||||
|
<td>名稱</td> |
||||
|
<td>單價</td> |
||||
|
<td>數量</td> |
||||
|
<td>複價</td> |
||||
|
<td>所屬電梯</td> |
||||
|
<td>功能</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td><input type="text" class="form-control" value=""></td> |
||||
|
<td><input type="text" class="form-control" value=""></td> |
||||
|
<td><input type="text" class="form-control" value=""></td> |
||||
|
<td><input type="number" class="form-control" value=""></td> |
||||
|
<td><input type="text" class="form-control" disabled></td> |
||||
|
<td>MAE100-6*7-CO45</td> |
||||
|
<td> |
||||
|
<div class="d-flex"> |
||||
|
<button class="selectElevator btn btn-danger">電梯</button> |
||||
|
<button class="deleteBtn btn btn-danger">X</button> |
||||
|
</div> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan=3>小計</td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="0" ></td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="0" ></td> |
||||
|
<td colspan=3 ></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<div class="divitem"> |
||||
|
<div class="title"> |
||||
|
<h6>保固延長</h6> |
||||
|
<button class="addbtn btn" x-ref="addElevatorBtn">+</button> |
||||
|
</div> |
||||
|
<table class="table" border=1> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td>電梯</td> |
||||
|
<td>人乘/載重</td> |
||||
|
<td>停數</td> |
||||
|
<td>速度</td> |
||||
|
<td>單價</td> |
||||
|
<td>數量(月)</td> |
||||
|
<td>複價</td> |
||||
|
<td>備註</td> |
||||
|
<td>所屬電梯</td> |
||||
|
<td>功能</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="MAE100">MAE100有機房</option> |
||||
|
<option value="MAM200">MAM200無機房</option> |
||||
|
<option value="MAH100">MAH100小電梯</option> |
||||
|
<option value="MAF100">MAE100貨梯(有機房)</option> |
||||
|
<option value="MAQ100">MAQ100強趨梯</option> |
||||
|
<option value="MAP100">MAP100平台梯</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="6">6</option> |
||||
|
<option value="8">8</option> |
||||
|
<option value="9">9</option> |
||||
|
<option value="10">10</option> |
||||
|
<option value="11">11</option> |
||||
|
<option value="12">12</option> |
||||
|
<option value="13">13</option> |
||||
|
<option value="15">15</option> |
||||
|
<option value="17">17</option> |
||||
|
<option value="20">20</option> |
||||
|
<option value="24">24</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td> |
||||
|
<input class="form-control" type="number" style="width:50px;padding-left:5px" /> |
||||
|
</td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control" style="width:80px"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="9">9</option> |
||||
|
<option value="24">24</option> |
||||
|
<option value="30">30</option> |
||||
|
<option value="45">45</option> |
||||
|
<option value="60">60</option> |
||||
|
<option value="90">90</option> |
||||
|
<option value="105">105</option> |
||||
|
<option value="120">120</option> |
||||
|
<option value="150">150</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td><input type="text" class="form-control"></td> |
||||
|
<td><input type="number" class="form-control " value="1" style="width:40px;padding-left:5px"></td> |
||||
|
<td><input type="number" class="form-control " disabled value="750000" style="width:100px"></td> |
||||
|
<td><input type="text" class="form-control"></td> |
||||
|
<td>MAE100-6*7-CO45</td> |
||||
|
<td> |
||||
|
<div class="d-flex"> |
||||
|
<button class="selectElevator btn btn-danger">電梯</button> |
||||
|
<button class="deleteBtn btn btn-danger">X</button> |
||||
|
</div> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan=5>小計</td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="0" ></td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="0" ></td> |
||||
|
<td colspan=3 ></td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
<div class="divitem"> |
||||
|
<table style="width:800px" class="table" border=1> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<td>付款辦法</td> |
||||
|
<td>款別</td> |
||||
|
<td >比例(%)</td> |
||||
|
<td>金額</td> |
||||
|
<td>票期</td> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td rowspan="4">材料</td> |
||||
|
<td >1.訂金</td> |
||||
|
<td ><input type="number" class="form-control" value="20"></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td >2.二次款</td> |
||||
|
<td ><input type="number" class="form-control" ></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td >3.貨到工地款</td> |
||||
|
<td ><input type="number" class="form-control" value="50"></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td >4.其他</td> |
||||
|
<td ><input type="number" class="form-control"></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td rowspan="3">安裝</td> |
||||
|
<td >5.安裝完畢款</td> |
||||
|
<td ><input type="number" class="form-control" value="20"></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td >6.驗收款</td> |
||||
|
<td ><input type="number" class="form-control" value="10"></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td >7.其他</td> |
||||
|
<td ><input type="number" class="form-control"></td> |
||||
|
<td><input type="number" class="form-control" disabled></td> |
||||
|
<td> |
||||
|
<select name="" id="" class="form-control"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="7">7天</option> |
||||
|
<option value="30" selected>30天</option> |
||||
|
<option value="60">60天</option> |
||||
|
<option value="90">90天</option> |
||||
|
<option value="120">120天</option> |
||||
|
<option value="180">180天</option> |
||||
|
<option value="">其他</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan=2>合計</td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="0" ></td> |
||||
|
<td colspan=1 ><input type="number" class="form-control" disabled value="0" ></td> |
||||
|
<td colspan=3 ></td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan=2>備註</td> |
||||
|
<td colspan=4 > |
||||
|
<textarea name="" class="form-control" id="" cols="30" rows="5"></textarea> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
Loading…
Reference in new issue