12 changed files with 1301 additions and 14 deletions
@ -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>"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
?> |
Loading…
Reference in new issue