Created
October 23, 2022 10:58
-
-
Save aklimaruhina/c21c2ccede3d9758d140bbee86296848 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When you need to find your sell price along with discount price | |
function getSalePrice($reg_price, $dis_amount, $dis_type) { | |
if($dis_type){ | |
// if discount amount percentage(%) | |
$sale_price = (float)$reg_price - ((float)$reg_price * (float)$dis_amount/100); | |
$sale_price = round($sale_price, 2); | |
} else{ | |
// if discount amount fixed | |
$sale_price = (float)$reg_price - (float)$dis_amount; | |
} | |
return $sale_price; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment