My existing codes are doing the calculation wrong, I can't find the right code. For example, 14.75% commission, $100 transaction, 114.75 should be paid, while after the transaction it turns out to be $ 117.30. I am sharing my codes below, how can I calculate correctly?
$install = DB::getRow("SELECT installment FROM installments WHERE id='{$k}'");
$montly = round($mInfo->fPrice / (1 - str_replace(",", ".", $i) / 100) / $install->installment, 2);
$total = round($mInfo->fPrice / (1 - str_replace(",", ".", $i) / 100), 2);
CodePudding user response:
These codes will solve the problem my friend.
$montly = round(($mInfo->fPrice (100*$i/100))/$install->installment,2);
$total = round($mInfo->fPrice (100*$i/100),2);