formatForHumans
in cash flow widget
This commit is contained in:
parent
e3edfcfc83
commit
3f20c1f8c4
@ -53,10 +53,17 @@ class CashFlow extends Widget
|
|||||||
->setDataset(trans('general.outgoing'), 'column', $expense)
|
->setDataset(trans('general.outgoing'), 'column', $expense)
|
||||||
->setDataset(trans_choice('general.profits', 1), 'line', $profit);
|
->setDataset(trans_choice('general.profits', 1), 'line', $profit);
|
||||||
|
|
||||||
|
$incoming_amount = money(array_sum($income), setting('default.currency'), true);
|
||||||
|
$outgoing_amount = money(abs(array_sum($expense)), setting('default.currency'), true);
|
||||||
|
$profit_amount = money(array_sum($profit), setting('default.currency'), true);
|
||||||
|
|
||||||
$totals = [
|
$totals = [
|
||||||
'incoming' => money(array_sum($income), setting('default.currency'), true),
|
'incoming_exact' => $incoming_amount->format(),
|
||||||
'outgoing' => money(abs(array_sum($expense)), setting('default.currency'), true),
|
'incoming_for_humans' => $incoming_amount->formatForHumans(),
|
||||||
'profit' => money(array_sum($profit), setting('default.currency'), true),
|
'outgoing_exact' => $outgoing_amount->format(),
|
||||||
|
'outgoing_for_humans' => $outgoing_amount->formatForHumans(),
|
||||||
|
'profit_exact' => $profit_amount->format(),
|
||||||
|
'profit_for_humans' => $profit_amount->formatForHumans(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->view('widgets.cash_flow', [
|
return $this->view('widgets.cash_flow', [
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
<div class="w-full lg:w-1/12 mt-11 space-y-2">
|
<div class="w-full lg:w-1/12 mt-11 space-y-2">
|
||||||
<div class="flex flex-col items-center justify-between text-center">
|
<div class="flex flex-col items-center justify-between text-center">
|
||||||
<div class="flex justify-end lg:block text-lg">
|
<div class="flex justify-end lg:block text-lg">
|
||||||
{{ $totals['incoming'] }}
|
<x-tooltip id="tooltip-cashflow-incoming" placement="top" message="{{ $totals['incoming_exact'] }}">
|
||||||
|
{{ $totals['incoming_for_humans'] }}
|
||||||
|
</x-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="text-green text-xs">
|
<span class="text-green text-xs">
|
||||||
@ -21,7 +23,9 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center justify-between">
|
<div class="flex flex-col items-center justify-between">
|
||||||
<div class="flex justify-end lg:block text-lg">
|
<div class="flex justify-end lg:block text-lg">
|
||||||
{{ $totals['outgoing'] }}
|
<x-tooltip id="tooltip-cashflow-outgoing" placement="top" message="{{ $totals['outgoing_exact'] }}">
|
||||||
|
{{ $totals['outgoing_for_humans'] }}
|
||||||
|
</x-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="text-rose text-xs">
|
<span class="text-rose text-xs">
|
||||||
@ -33,7 +37,9 @@
|
|||||||
|
|
||||||
<div class="flex flex-col items-center justify-between">
|
<div class="flex flex-col items-center justify-between">
|
||||||
<div class="flex justify-end lg:block text-lg">
|
<div class="flex justify-end lg:block text-lg">
|
||||||
{{ $totals['profit'] }}
|
<x-tooltip id="tooltip-cashflow-profit" placement="top" message="{{ $totals['profit_exact'] }}">
|
||||||
|
{{ $totals['profit_for_humans'] }}
|
||||||
|
</x-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="text-purple text-xs">{{ trans_choice('general.profits', 1) }}</span>
|
<span class="text-purple text-xs">{{ trans_choice('general.profits', 1) }}</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user