在此代码片段中,所有值都将由数据库驱动,我需要更好地替换此代码。
佣金百分比将根据任务价格范围计算。
$commission1=10;//in percentage
$commission2=20;
$commission3=30;
$taskprice =200;
if($taskprice >=0 && $taskprice <=150)
{
$adminearnings = ($taskprice *$commission1 ) / 100 ;
$Geniepayment = $taskprice - $adminearnings;
}
else if($taskprice >=151 && $taskprice <=300)
{
$adminearnings = ($taskprice * $commission2) / 100 ;
$Geniepayment = $taskprice - $adminearnings;
}
else if($taskprice >=301 && $taskprice <=450)
{
$adminearnings = ($taskprice * $commission3 ) / 100 ;
$Geniepayment = $taskprice - $adminearnings;
}
echo $taskprice.'</br>';
echo $adminearnings.'</br>';
echo $Geniepayment.'</br>';