@ -37,21 +37,246 @@ $stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$stmt->execute();
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sql_str = "SELECT * FROM pricereview_maintain_item WHERE (mid, item_group) = (:apply_key, 'E') ORDER BY item_no ASC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$otherOptions = $stmt->fetchAll(PDO::FETCH_ASSOC);
$contract_begin_date = new DateTime($contract['contract_begin_date']);
$contract_end_date = new DateTime($contract['contract_end_date']);
// 計算差異
$interval = $contract_begin_date->diff($contract_end_date);
// 獲取總月數
$contract_months = $interval->m + 12 * $interval->y + 1;
if($contract_months < = 0){ $contract_months = 1;}
$sql_str = "SELECT * FROM pricereview_maintain_sign WHERE mid = :apply_key ORDER BY id ASC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$sign_all = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sign = $sign_all ? $sign_all[count($sign_all)-1] : [];
$currentSigner = '';
$currentSign = 0;
$currentSignId = $sign['id'] ?? '';
$historySign = [];
if($sign_all){
foreach($sign_all as $key=>$sign_item){
if($key == count($sign_all)-1){
break;
}
$signer1 = getSignerName(explode(",", $sign_item['sign1'])[0]);
$sign1_result = explode(",", $sign_item['sign1'])[1];
$sign1_date = explode(",", $sign_item['sign1'])[2];
$sign1_note = $sign_item['sign1_note'];
if($sign1_result == "Y"){
$sign1_result = "同意";
}elseif($sign1_result == "YY"){
$sign1_result = "結案同意";
}elseif($sign1_result == "N"){
$sign1_result = "不同意";
}else{
$sign1_result = "---";
}
if(!empty($sign_item['sign2'])){
$signer2 = getSignerName(explode(",", $sign_item['sign2'])[0]);
$sign2_result = explode(",", $sign_item['sign2'])[1];
$sign2_note = $sign_item['sign2_note'];
$sign2_date = explode(",", $sign_item['sign2'])[2];
if($sign2_result == "Y"){
$sign2_result = "同意";
}elseif($sign2_result == "YY"){
$sign2_result = "結案同意";
}elseif($sign2_result == "N"){
$sign2_result = "不同意";
}else{
$sign2_result = "---";
}
}else{
$signer2 = "---";
$sign2_result = "---";
$sign2_note = "---";
$sign2_date = "---";
$sign2_result = "---";
}
$signer3 = getSignerName(explode(",", $sign_item['sign3'])[0]);
$sign3_result = explode(",", $sign_item['sign3'])[1];
$sign3_note = $sign_item['sign3_note'];
$sign3_date = explode(",", $sign_item['sign3'])[2];
if($sign3_result == "Y"){
$sign3_result = "同意";
}elseif($sign3_result == "YY"){
$sign3_result = "結案同意";
}elseif($sign3_result == "N"){
$sign3_result = "不同意";
}else{
$sign3_result = "---";
}
if(!empty($sign_item['sign4'])){
$signer4 = getSignerName(explode(",", $sign_item['sign4'])[0]);
$sign4_result = explode(",", $sign_item['sign4'])[1];
$sign4_note = $sign_item['sign4_note'];
$sign4_date = explode(",", $sign_item['sign4'])[2];
if($sign4_result == "Y"){
$sign4_result = "同意";
}elseif($sign4_result == "YY"){
$sign4_result = "結案同意";
}elseif($sign4_result == "N"){
$sign4_result = "不同意";
}else{
$sign4_result = "---";
}
}else{
$signer4 = "---";
$sign4_result = "---";
$sign4_note = "---";
$sign4_date = "---";
$sign4_result = "---";
}
$historySign[] = [
'signer1'=>$signer1,
'sign1_result'=> $sign1_result,
'sign1_note'=>$sign1_note,
'sign1_date'=>$sign1_date,
'signer2'=>$signer2,
'sign2_result'=> $sign2_result,
'sign2_note'=>$sign2_note,
'sign2_date'=>$sign2_date,
'signer3'=>$signer3,
'sign3_result'=> $sign3_result,
'sign3_note'=>$sign3_note,
'sign3_date'=>$sign3_date,
'signer4'=>$signer4,
'sign4_result'=> $sign4_result,
'sign4_note'=>$sign4_note,
'sign4_date'=>$sign4_date,
];
}
}
if($sign){
// Y:已同意 N:不同意 W:待簽
// sign1 => 處長, sign2 => 業務承辦人, sign3 => 協理, sign4 => 總經理
if($sign['sign1'] == NULL || $sign['sign1'] ==''){
$sign1 = NULL;
}else{
if( explode(",", $sign['sign1'])[1] != ''){
$sign1 = explode(",", $sign['sign1'])[1] == 'Y' ? 'Y' : 'N';
}else{
$sign1 = 'W';
}
}
if($sign['sign2'] == NULL || $sign['sign2'] ==''){
$sign2 = NULL;
}else{
if( explode(",", $sign['sign2'])[1] != ''){
$sign2 = explode(",", $sign['sign2'])[1] == 'Y' ? 'Y' : 'N';
}else{
$sign2 = 'W';
}
}
if($sign['sign3'] == NULL || $sign['sign3'] ==''){
$sign3 = NULL;
}else{
if( explode(",", $sign['sign3'])[1] != ''){
// $sign3 = explode(",", $sign['sign3'])[1] == 'Y' ? 'Y' : 'N';
if(explode(",", $sign['sign3'])[1] == 'YY') $sign3 = 'YY';
if(explode(",", $sign['sign3'])[1] == 'Y') $sign3 = 'Y';
if(explode(",", $sign['sign3'])[1] == 'N') $sign3 = 'N';
}else{
$sign3 = 'W';
}
}
if($sign['sign4'] == NULL || $sign['sign4'] ==''){
$sign4 = NULL;
}else{
if( explode(",", $sign['sign4'])[1] != ''){
// $sign4 = explode(",", $sign['sign4'])[1] == 'Y' ? 'Y' : 'N';
if(explode(",", $sign['sign4'])[1] == 'YY') $sign4 = 'YY';
if(explode(",", $sign['sign4'])[1] == 'Y') $sign4 = 'Y';
if(explode(",", $sign['sign4'])[1] == 'N') $sign4 = 'N';
}else{
$sign4 = 'W';
}
}
if($sign1 == 'W'){
$currentSigner = explode(",", $sign['sign1'])[0];
$currentSign = 1;
}elseif($sign2 == 'W'){
$currentSigner = explode(",", $sign['sign2'])[0];
$currentSign = 2;
}elseif($sign3 == 'W'){
$currentSigner = explode(",", $sign['sign3'])[0];
$currentSign = 3;
}elseif($sign4 == 'W'){
$currentSigner = explode(",", $sign['sign4'])[0];
$currentSign = 4;
}
}else{
$sign1 = NULL;
$sign2 = NULL;
$sign3 = NULL;
$sign4 = NULL;
}
$permissions = false;
$permissions = false;
//開啟工務權限
//開啟工務權限
if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012" || $user_id == "M0007" ){
$permissions = true;
$permissions = true;
}
}
function getSignerName($signer){
if($signer == null || $signer == '') return "---";
global $conn;
$sql_str = "SELECT name FROM account WHERE accountid = :signer";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':signer', $signer);
$stmt->execute();
$signer = $stmt->fetch(PDO::FETCH_ASSOC);
return $signer['name'];
}
?>
?>
< link rel = "stylesheet" href = "./css/pricereview.css" >
< link rel = "stylesheet" href = "./css/pricereview.css" >
< script src = "https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity = "sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin = "anonymous" referrerpolicy = "no-referrer" > < / script >
< script src = "./js/axios.min.js" integrity = "sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin = "anonymous" referrerpolicy = "no-referrer" > < / script >
< script defer src = "./js/alpinejs/cdn.min.js" > < / script >
< script defer src = "./js/alpinejs/cdn.min.js" > < / script >
< script src = "./js/pricereviewAlpine.js" > < / script >
< script src = "./js/pricereviewAlpine.js" > < / script >
< div id = "pricereviewCheck" x-data = pricereviewCheck >
< div id = "pricereviewCheck" x-data = pricereviewCheck >
< div class = "container" >
< div class = "container" >
< table class = "table customerinfo-table" >
< tbody >
< tr >
< th > 價審單號< / th >
< th > 卷號< / th >
< th > 營業員< / th >
< th > 客戶名稱< / th >
< th > 牌價總額(A)< / th >
< th > 售價總額(B)< / th >
< th > 破價總額(B-A)< / th >
< / tr >
< tr >
< td > < input type = "text" class = "form-control" x-model = "apply_key" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "contractno" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "salesman" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "customer" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(total_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(total_sale_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "(total_sale_price - total_price).toLocaleString()" disabled / > < / td >
< / tr >
< / tbody >
< / table >
< table class = "table mi-table" border = 1 >
< table class = "table mi-table" border = 1 >
< thead >
< thead >
< tr >
< tr >
@ -64,12 +289,12 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
< th > 項次< / th >
< th > 項次< / th >
< th > 規格< / th >
< th > 規格< / th >
< th > 單價(月)< / th >
< th > 單價(月)< / th >
< th > 月數< / th >
< th > 保養 月數< / th >
< th > 總價< / th >
< th > 總價< / th >
<?php if ( $permissions ) : ?>
<?php if ( $permissions ) : ?>
< th > 業務部MI < / th >
< th > 成本(月) < / th >
< th > 售價(月)< / th >
< th > 售價(月)< / th >
< th > 利潤< / th >
< th > 利潤(月) < / th >
< th > 利潤率(%)< / th >
< th > 利潤率(%)< / th >
<?php endif ; ?>
<?php endif ; ?>
< / tr >
< / tr >
@ -78,17 +303,17 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
< tbody >
< tbody >
< tr >
< tr >
< td x-html = "'<b>' + elevator.item_no + '</b>'" > < / td >
< td x-html = "'<b>' + elevator.item_no + '</b>'" > < / td >
< td > < a href = "javascript:;" x-text = "elevator.spec" > < / a > < / td >
< td > < a href = "javascript:;" x-text = "elevator.spec + '-' + elevator.persons + '*' + elevator.stop + '-' + elevator.speed " > < / a > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(elevator.stand_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(elevator.stand_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "elevator.maintain_months" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "elevator.maintain_months" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(elevator.stand_price * elevator.maintain_months).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(elevator.stand_price * elevator.maintain_months).toLocaleString()" disabled / > < / td >
<?php if ( $permissions ) : ?>
<?php if ( $permissions ) : ?>
< td >
< td >
< input x-show = "true" type = "text" class = "form-control" value = "找不到此規格 ">
< input x-show = "true" type = "text" class = "form-control" x-model = "Number(elevator.stand_price).toLocaleString() ">
< / td >
< / td >
< td > < input type = "text" class = "form-control" x-model = "(Number(elevator.contract_price)).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "(Number(elevator.contract_price)).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "(Number(elevator.contract_price) - Number(elevator.stand_price)).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "(Number(elevator.contract_price) - Number(elevator.stand_price)).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Math.round ((Number(elevator.contract_price) - Number(elevator.stand_price) ) / Number(elevator.stand_price)) *100 + '%'" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "((Number(elevator.contract_price) - Number(elevator.stand_price) ) / Number(elevator.stand_price) * 100).toFixed(1) + '%'" disabled / > < / td >
<?php endif ; ?>
<?php endif ; ?>
< / tr >
< / tr >
<?php if ( $permissions ) : ?>
<?php if ( $permissions ) : ?>
@ -96,14 +321,17 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
< td colspan = 5 > < / td >
< td colspan = 5 > < / td >
< td colspan = 4 style = "max-width:400px" >
< td colspan = 4 style = "max-width:400px" >
< div class = "mi-info" >
< div class = "mi-info" >
< span > 電梯設備< / span >
< span > 電梯規格< / span >
< ul >
< li x-html = "elevator.spec + '*'+elevator.maintain_months+':<b>' + (elevator.stand_price*elevator.maintain_months).toLocaleString() + '</b>'" > < / li >
< / ul >
< span > 除外項目< / span >
< span > 除外項目< / span >
< ul >
< ul >
< template x-for = "option in elevator.options" >
< template x-for = "option in elevator.otherO ptions" >
< li x-html = "option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'" > < / li >
< li x-html = "option.item_spec + (option.option_memo ? ('(' + option.option_memo + ')') : '') + '*' + option.item_qty + ':<b>' + (option.mi * option.item_qty).toLocaleString() + '</b>'" > < / li >
< / template >
< / template >
< / ul >
< / ul >
< p x-html = "'以上合計:<b>' + (Math.round(Number(elevator.optionsTotalPrice) + Number(elevator.otherOptionsTotalPrice) + Number(elevator.maintainOptionsTotalPrice)) + Number(elevator.demolishOptionsTotalPrice )).toLocaleString() + '</b>'" > < / p >
< p x-html = "'以上合計:<b>' + Math.round(Number(elevator.otherOptionsTotalPrice) + Number(elevator.stand_price*elevator.maintain_months )).toLocaleString() + '</b>'" > < / p >
< / div >
< / div >
< / td >
< / td >
@ -117,10 +345,317 @@ if($user_id == "M0174" || $user_id == "M0008" || $user_id == "M0012"){
< td > < input type = "text" class = "form-control" x-model = "elevators_total_price.toLocaleString()" disabled > < / td >
< td > < input type = "text" class = "form-control" x-model = "elevators_total_price.toLocaleString()" disabled > < / td >
< / tr >
< / tr >
< / table >
< / table >
< table class = "table mi-table" border = 1 >
< thead >
< tr >
< th colspan = 8 > 除外項目< / th >
< / tr >
< tr >
< th > 項次< / th >
< th > 詢價單號< / th >
< th > 名稱< / th >
< th > 單價< / th >
< th > 數量< / th >
< th > 複價< / th >
< th > 所屬電梯項次< / th >
< / tr >
< / thead >
< tbody >
< template x-for = "option in otherOptions" >
< tr >
< td x-html = "'<b>' + option.item_no + '</b>'" > < / td >
< td x-text = "option.price_id" > < / td >
< td > < input type = "text" class = "form-control" x-model = "option.item_spec" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(option.item_unit_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "option.item_qty" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "(option.item_unit_price * option.item_qty).toLocaleString()" disabled / > < / td >
< td x-text = "option.option_relate_spec" > < / td >
< / tr >
< / template >
< template x-if = "otherOptions.length > 0" >
< tr >
< td colspan = 5 > 小計< / td >
< td >
< input type = "text" x-model = "otherOptionsTotalPrice.toLocaleString()" disabled class = "form-control" >
< / td >
< td colspan = 3 > < / td >
< / tr >
< / template >
< / tbody >
< / table >
< table class = "table mi-table" border = 1 style = "width:800px" >
< thead >
< tr >
< th style = "width:100px" > 付款方式< / th >
< th > 金額(次)< / th >
< th > 付款次數< / th >
< th > 總付款金額< / th >
< / tr >
< / thead >
< tbody >
< tr >
< td x-text = "payment_kind" > < / td >
< td > < input type = "text" class = "form-control" x-model = "single_amount.amount_times.toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" :value = "single_amount.pay_times.toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "total_sale_price.toLocaleString()" disabled / > < / td >
< / tr >
< / tbody >
< / table >
< table class = "table customerinfo-table" >
< tbody >
< tr >
< th > 卷號< / th >
< th > 營業員< / th >
< th > 客戶名稱< / th >
< th > 案件名稱< / th >
< th colspan = "2" > 地址< / th >
< / tr >
< tr >
< td > < input type = "text" class = "form-control" x-model = "contractno" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "salesman" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "customer" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "case_name" disabled / > < / td >
< td colspan = "2" > < input type = "text" class = "form-control" x-model = "address" disabled / > < / td >
< / tr >
< tr >
< th > 牌價總額(A)< / th >
< th > 售價總額(B)< / th >
< th > 破價總額(B-A)< / th >
< th > 總台數< / th >
< th > 服務費(介紹費)< / th >
< th > 價率%(B/A)< / th >
< / tr >
< tr >
< td > < input type = "text" class = "form-control" x-model = "Number(total_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Number(total_sale_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "(total_sale_price - total_price).toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "elevators.length" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "service_fee.toLocaleString()" disabled / > < / td >
< td > < input type = "text" class = "form-control" x-model = "Math.round(total_sale_price/total_price * 1000)/10" disabled / > < / td >
< / tr >
< tr >
< th > 合約開始日< / th >
< th > 合約結束日< / th >
< th > < / th >
< th > < / th >
< th > < / th >
< th > < / th >
< / tr >
< tr >
< td > < input type = "date" disabled class = "form-control" x-model = "contract_begin_date" / > < / td >
< td > < input type = "date" disabled class = "form-control" x-model = "contract_end_date" / > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< / tr >
< tr >
< th > 罰則< / th >
< th > 訂金保證金(函)%< / th >
< th > 履約保證金(函)%< / th >
< th > 保固保證金(函)%< / th >
< th > < / th >
< th > < / th >
< / tr >
< tr >
< td > < input type = "text" disabled class = "form-control" x-model = "penalty" > < / td >
< td > < input type = "text" disabled class = "form-control" x-model = "deposit_rate" > < / td >
< td > < input type = "text" disabled class = "form-control" x-model = "keep_rate" > < / td >
< td > < input type = "text" disabled class = "form-control" x-model = "warranty_rate" > < / td >
< td > < / td >
< td > < / td >
< / tr >
< tr >
< th colspan = "6" > 特記事項< / th >
< / tr >
< tr >
< td colspan = "6" >
< textarea name = "" id = "" cols = "30" rows = "5" class = "form-control" x-model = "memo" disabled > < / textarea >
< / td >
< / tr >
< / tbody >
< / table >
< table class = "table" style = "width:700px" >
< thead >
< tr >
< th style = "width:150px" > 審核< / th >
< th style = "width:100px" > 審核人< / th >
< th > 結果< / th >
< th > 意見< / th >
< th > 時間< / th >
< / tr >
< / thead >
< tbody >
< tr >
< td > 區經理< / td >
< td x-text = "sign1" > < / td >
< td >
<?php
if($sign1 == 'Y'){
echo "同意";
}elseif($sign1 == 'N'){
echo "不同意";
}elseif($sign1 == 'W'){
echo "待簽核";
}else{
echo "---";
}
?>
< / td >
< td > <?php echo isset ( $sign [ 'sign1_note' ]) ? $sign [ 'sign1_note' ] : "" ?> </ td >
< td > <?php echo isset ( $sign [ 'sign1' ]) ? explode ( ',' , $sign [ 'sign1' ])[ 2 ] : "---" ?> </ td >
< / tr >
< tr >
< td x-text = "'服務助理'" > < / td >
< td x-text = "sign2" > < / td >
< td >
<?php
if($sign2 == 'Y'){
echo "同意";
}elseif($sign2 == 'N'){
echo "不同意";
}elseif($sign2 == 'W' & & $contract['status'] == 'YS'){
echo "待簽核";
}else{
echo "---";
}
?>
< / td >
< td > <?php echo ( isset ( $sign [ 'sign2' ]) && $sign [ 'sign2' ] != NULL ) ? $sign [ 'sign2_note' ] : '---' ?> </ td >
< td > <?php echo ( isset ( $sign [ 'sign2' ]) && $sign [ 'sign2' ] != NULL ) ? explode ( ',' , $sign [ 'sign2' ])[ 2 ] : '---' ?> </ td >
< / tr >
< tr >
< td x-text = "'服務副總'" > < / td >
< td x-text = "sign3" > < / td >
< td >
<?php
if($sign3 == 'Y'){
echo "同意";
}elseif($sign3 == 'YY'){
echo "結案同意";
}elseif($sign3 == 'N'){
echo "不同意";
}elseif($sign3 == 'W' & & $contract['status'] == 'YS'){
echo "待簽核";
}else{
echo "---";
}
?>
< / td >
< td > <?php echo ( isset ( $sign [ 'sign3' ]) && $sign [ 'sign3' ] != NULL ) ? $sign [ 'sign3_note' ] : '---' ?> </ td >
< td > <?php echo ( isset ( $sign [ 'sign3' ]) && $sign [ 'sign3' ] != NULL ) ? explode ( ',' , $sign [ 'sign3' ])[ 2 ] : '---' ?> </ td >
< / tr >
< tr >
< td > 總經理< / td >
< td x-text = "sign4" > < / td >
< td >
<?php
if($contract['status'] == 'YY'){
if($sign3 == 'YY'){
echo "---";
}elseif($sign3 == 'Y' & & $sign4 == 'YY'){
echo "結案同意";
}
}else{
if($sign4 == 'Y' & & $contract['status'] == 'YY'){
echo "同意";
}elseif($sign4 == 'N' & & $contract['status'] == 'YN'){
echo "不同意";
}elseif($sign4 == 'W' & & $contract['status'] == 'YS' ){
echo "待簽核";
}else{
echo "---";
}
}
?>
< / td >
< td > <?php echo ( isset ( $sign [ 'sign4' ]) && $sign [ 'sign4' ] != NULL ) ? $sign [ 'sign4_note' ] : '---' ?> </ td >
< td > <?php echo ( isset ( $sign [ 'sign4' ]) && $sign [ 'sign4' ] != NULL ) ? explode ( ',' , $sign [ 'sign4' ])[ 2 ] : '---' ?> </ td >
< / tr >
< / tbody >
< / table >
< table class = "table" style = "width:700px" >
< thead >
< tr >
< th > 審核意見< / th >
< th > 批示售價< / th >
< / tr >
< / thead >
< tbody >
< tr >
< td >
< textarea name = "" <?php if ( $currentSigner != $user_id ) echo "disabled" ?> class = "form-control" id = "" cols = "40" rows = "5" x-model = "reviewcomment" ></ textarea >
< / td >
< td >
< input type = "text" class = "form-control" disabled / >
< / td >
< / tr >
< / tbody >
< / table >
< div >
< button class = "btn btn-primary" @ click = "window.history.go(-1)" > 回上頁< / button >
<?php if ( $contract [ 'status' ] == "YS" ){ ?>
<?php if ( $currentSigner == "M0006" && $user_id == "M0008" ) : ?>
< button class = "btn btn-primary" @ click = "check( <?php echo $currentSign ; ?> , 'YN', 'M0006')" > 總經理權限(退回)</ button >
<?php endif ; ?>
<?php if ( $currentSigner == $user_id ) : ?>
< button class = "btn btn-primary" @ click = "check( <?php echo $currentSign ; ?> , 'YN')" > 不同意(退回)</ button >
<?php if ( $sign1 == 'W' || ( $sign1 == 'Y' && $sign2 == 'W' ) || ( $sign1 == 'Y' && ( $sign2 == 'Y' || $sign2 == NULL ) && $sign3 == 'W' && $sign4 == 'W' )) : ?>
< button class = "btn btn-primary" @ click = "check( <?php echo $currentSign ; ?> , 'YS')" > 同意(上呈)</ button >
<?php endif ; ?>
<?php if (( $sign3 == 'W' && $sign2 == 'Y' ) || ( $sign3 == 'W' && $sign2 == null && $sign1 == 'Y' ) || ( $sign3 == 'Y' && $sign4 == 'W' ) ) : ?>
< button class = "btn btn-primary" @ click = "check( <?php echo $currentSign ; ?> , 'YY')" > 同意(結案)</ button >
<?php endif ; ?>
<?php endif ; ?>
<?php } ?>
<?php if ( $contract [ 'attatch1' ] != null ) : ?>
< a class = "btn btn-primary" href = "./ <?php echo $contract [ 'attatch1' ]; ?> " download = " <?php echo $contract [ 'vol_no' ] . "報價單" ; ?> " > 下載報價單</ a >
<?php else : ?>
< a href = "javascript:;" class = "btn btn-primary" @ click = "alert('營業員未上傳報價單!')" > 下載報價單< / a >
<?php endif ; ?>
<?php if ( $contract [ 'attatch2' ] != null ) : ?>
< a class = "btn btn-primary" href = "./ <?php echo $contract [ 'attatch2' ]; ?> " download = " <?php echo $contract [ 'vol_no' ] . "合約用印申請表" ; ?> " > 下載合約用印申請表</ a >
<?php else : ?>
< a href = "javascript:;" style = "width:180px" class = "btn btn-primary" @ click = "alert('營業員未上傳合約用印申請表!')" > 下載合約用印申請表< / a >
<?php endif ; ?>
< / div >
< / div >
< / div >
< / div >
< / div >
< script >
< script >
const apply_key = '<?php echo $contract [ 'apply_key' ]; ?> ';
const vol_no = '<?php echo $contract [ 'vol_no' ]; ?> ';
const salesman = '<?php echo $contract [ 'salesman' ]; ?> ';
const customer = '<?php echo $contract [ 'customer' ]; ?> ';
const total_price = '<?php echo $contract [ 'total_price' ]; ?> ';
const total_sale_price = '<?php echo $contract [ 'total_sale_price' ]; ?> ';
const elevators = [...<?php echo json_encode ( $elevators ) ?> ];
const elevators = [...<?php echo json_encode ( $elevators ) ?> ];
const otherOptions = [...<?php echo json_encode ( $otherOptions ) ?> ];
const payment_kind = '<?php echo $contract [ 'payment_kind' ]; ?> ';
const case_name = '<?php echo $contract [ 'case_name' ]; ?> ';
const address = '<?php echo $contract [ 'address' ]; ?> ';
const service_fee = '<?php echo $contract [ 'service_fee' ]; ?> ';
const memo = `<?php echo $contract [ 'memo' ]; ?> `;
const maintain_months = '<?php echo $contract_months ; ?> ';
const penalty = '<?php echo $contract [ 'penalty' ]; ?> ';
const deposit_rate = '<?php echo $contract [ 'deposit_rate' ]; ?> ';
const keep_rate = '<?php echo $contract [ 'keep_rate' ]; ?> ';
const warranty_rate = '<?php echo $contract [ 'warranty_rate' ]; ?> ';
const contract_begin_date = '<?php echo $contract [ 'contract_begin_date' ]; ?> ';
const contract_end_date = '<?php echo $contract [ 'contract_end_date' ]; ?> ';
const sign1 = '<?php echo ( $sign ) ? explode ( ',' , $sign [ 'sign1' ])[ 0 ] : "---" ?> ';
const sign2 = '<?php echo ( $sign ) ? explode ( ',' , $sign [ 'sign2' ])[ 0 ] : "---" ?> ';
const sign3 = '<?php echo ( $sign ) ? explode ( ',' , $sign [ 'sign3' ])[ 0 ] : "---" ?> ';
const sign4 = '<?php echo ( $sign ) ? explode ( ',' , $sign [ 'sign4' ])[ 0 ] : "---" ?> ';
const currentSignId = '<?php echo $currentSignId ; ?> ';
const token = '<?php echo $para = "function_name=pricereview&" . $token_link ;; ?> ';
const form_key = '<?php echo $form_key ; ?> ';
const user_id = '<?php echo $user_id ; ?> ';
< / script >
< / script >