pelmered / filament-money-field

Money field powered by Money PHP
MIT License
40 stars 19 forks source link

Using in Summarize Problem #19

Closed ahmetkocabiyik closed 3 months ago

ahmetkocabiyik commented 3 months ago

When we use in summerize it not working properly

Tables\Columns\TextColumn::make('product.name')
                ->label("Ürün Adı"),
                Tables\Columns\TextColumn::make("quantity")
                ->label("Adet"),
                MoneyColumn::make("total_price")
                ->label("Fiyat"),

                MoneyColumn::make('total_price')
                    ->summarize(Sum::make())
Screenshot 2024-03-31 at 14 35 45
ahmetkocabiyik commented 3 months ago
MoneyColumn::make("total_price")
                ->label("Fiyat")
                ->summarize(Sum::make()->money("TRY",100,"tr_TR"))

I chaange code like this problem solved

pelmered commented 3 months ago

Hm, this looks like a bug actually. Looks like the sum should be divided by 100 somewhere. But good that you found a solution.

pelmered commented 3 months ago

Yes, I have been looking into this a bit more and that seems like the way to do it: https://filamentphp.com/docs/3.x/tables/summaries#currency-formatting The only way I can see to avoid that is the include our own summarizers, but that is out of scope for this package.