Reputation: 43
I am looking to make a percentage calculation on an FPDF based invoice template which contains $total
(e.g 1000) and a number value $percentage
(e.g. 20)
Ideally I would like this to display as discount
$pdf->Cell(100, 5, 'Discount' .$discountresult. '', 0, 'L');
How to achieve this? Some advice would be appreciated.
Upvotes: 0
Views: 556
Reputation: 999
Like this:
$total = 1000;
$percentage = 20;
$discountResult = $total - (($percentage / 100) * $total);
$pdf->Cell(100, 5, 'Discount' . $discountResult, 0, 'L');
Upvotes: 1