large figures upset the total
mbuk opened this issue · 5 comments
mbuk commented
The total price calculation breaks in here
(it's something to do with bcmul)
If the inputs to the method are:
$name = 'blah';
$price = '8,333.325';
$ammount = 1;
$id = '';
$this->decimals is the default (2)
The output will return 0.00
public function addItem($name, $price, $ammount = 1, $id = '-')
{
$price = number_format($price, $this->decimals);
$this->items->push(Collection::make([
'name' => $name,
'price' => $price,
'ammount' => $ammount,
'totalPrice' => number_format(bcmul($price, $ammount, $this->decimals), $this->decimals),
'id' => $id,
]));
return $this;
}
BTW amount is mispelt here 😄
ConsoleTVs commented
You can't have a coma in the price input.
I will work on fancier outputs but talking about php floats, the value must be:
$price = 8333.325;
Not:
$price = '8,333.325';
$price = '8333.325';
$price = '8.333,325';
mbuk commented
Understood thanks.
Is there any work going on to allow customisation of the PDF output?
Specifically the template
If not I might have some free time to look at it
Matt
---
Sent from my iPhone
… On 13 Aug 2017, at 09:05, Erik Campobadal ***@***.***> wrote:
You can't have a coma in the price input.
I will work on fancier outputs but talking about php floats, the value must be:
$price = 8333.325;
Not:
$price = '8,333.325';
$price = '8333.325';
$price = '8.333,325';
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
ConsoleTVs commented
Yes indeed, that's already possible:
php artisan vendor:publish
location: at the vendor folder in resources/views/vendor/invoices
PS; Sorry for the poor docs, I will work on them
mbuk commented
Cheers!
Matt
---
Sent from my iPhone
… On 13 Aug 2017, at 09:10, Erik Campobadal ***@***.***> wrote:
Yes indeed, that's already possible:
php artisan vendor:publish
location: at the vendor folder in resources/views/vendor/invoices
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
ConsoleTVs commented
You're welcome ^^