mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-10 13:21:21 +00:00
Expand report email.
This commit is contained in:
@@ -90,7 +90,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
|||||||
// will now send email to users.
|
// will now send email to users.
|
||||||
foreach ($result as $userId => $journals) {
|
foreach ($result as $userId => $journals) {
|
||||||
//// random bunch to make mail.
|
//// random bunch to make mail.
|
||||||
$journals = TransactionJournal::where('user_id', $userId)->inRandomOrder()->take(1)->get();
|
//$journals = TransactionJournal::where('user_id', $userId)->inRandomOrder()->take(1)->get();
|
||||||
event(new RequestedReportOnJournals($userId, $journals));
|
event(new RequestedReportOnJournals($userId, $journals));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property bool $is_split
|
* @property bool $is_split
|
||||||
* @property int $attachmentCount
|
* @property int $attachmentCount
|
||||||
* @property int $transaction_currency_id
|
* @property int $transaction_currency_id
|
||||||
|
* @property int $foreign_currency_id
|
||||||
*/
|
*/
|
||||||
class Transaction extends Model
|
class Transaction extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -96,10 +96,51 @@ class TransactionJournal extends Twig_Extension
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function totalAmount(JournalModel $journal): string
|
public function totalAmount(JournalModel $journal): string
|
||||||
|
{
|
||||||
|
$type = $journal->transactionType->type;
|
||||||
|
$totals = $this->getTotalAmount($journal);
|
||||||
|
$array = [];
|
||||||
|
foreach ($totals as $total) {
|
||||||
|
if (TransactionType::WITHDRAWAL === $type) {
|
||||||
|
$total['amount'] = bcmul($total['amount'], '-1');
|
||||||
|
}
|
||||||
|
$array[] = app('amount')->formatAnything($total['currency'], $total['amount']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' / ', $array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param JournalModel $journal
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function totalAmountPlain(JournalModel $journal): string
|
||||||
|
{
|
||||||
|
$type = $journal->transactionType->type;
|
||||||
|
$totals = $this->getTotalAmount($journal);
|
||||||
|
$array = [];
|
||||||
|
|
||||||
|
foreach ($totals as $total) {
|
||||||
|
if (TransactionType::WITHDRAWAL === $type) {
|
||||||
|
$total['amount'] = bcmul($total['amount'], '-1');
|
||||||
|
}
|
||||||
|
$array[] = app('amount')->formatAnything($total['currency'], $total['amount'], false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' / ', $array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param JournalModel $journal
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getTotalAmount(JournalModel $journal): array
|
||||||
{
|
{
|
||||||
$transactions = $journal->transactions()->where('amount', '>', 0)->get();
|
$transactions = $journal->transactions()->where('amount', '>', 0)->get();
|
||||||
$totals = [];
|
$totals = [];
|
||||||
$type = $journal->transactionType->type;
|
|
||||||
/** @var TransactionModel $transaction */
|
/** @var TransactionModel $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$currencyId = $transaction->transaction_currency_id;
|
$currencyId = $transaction->transaction_currency_id;
|
||||||
@@ -128,14 +169,7 @@ class TransactionJournal extends Twig_Extension
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$array = [];
|
|
||||||
foreach ($totals as $total) {
|
|
||||||
if (TransactionType::WITHDRAWAL === $type) {
|
|
||||||
$total['amount'] = bcmul($total['amount'], '-1');
|
|
||||||
}
|
|
||||||
$array[] = app('amount')->formatAnything($total['currency'], $total['amount']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return implode(' / ', $array);
|
return $totals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class Journal extends Twig_Extension
|
|||||||
{
|
{
|
||||||
$filters = [
|
$filters = [
|
||||||
new Twig_SimpleFilter('journalTotalAmount', [TransactionJournalExtension::class, 'totalAmount'], ['is_safe' => ['html']]),
|
new Twig_SimpleFilter('journalTotalAmount', [TransactionJournalExtension::class, 'totalAmount'], ['is_safe' => ['html']]),
|
||||||
|
new Twig_SimpleFilter('journalTotalAmountPlain', [TransactionJournalExtension::class, 'totalAmountPlain'], ['is_safe' => ['html']]),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $filters;
|
return $filters;
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
{% if journals.count == 1 %}
|
{% if journals.count == 1 %}
|
||||||
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
<p style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;">
|
||||||
You can find in in your Firefly III installation:
|
You can find it in your Firefly III installation:<br />
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
<a href="{{ route('transactions.show', journal.id) }}">{{ journal.description }}</a>
|
<a href="{{ route('transactions.show', journal.id) }}">{{ journal.description }}</a> ({{ journal|journalTotalAmount }})
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -24,7 +24,9 @@
|
|||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
<li><a href="{{ route('transactions.show', journal.id) }}">{{ journal.description }}</a></li>
|
<li>
|
||||||
|
<a href="{{ route('transactions.show', journal.id) }}">{{ journal.description }}</a> ({{ journal|journalTotalAmount }})
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Firefly III has created {{ journals.count }} transactions for you.
|
|||||||
You can find in in your Firefly III installation:
|
You can find in in your Firefly III installation:
|
||||||
|
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
{{ journal.description }}: {{ route('transactions.show', journal.id) }}
|
{{ journal.description }}: {{ route('transactions.show', journal.id) }} ({{ journal|journalTotalAmountPlain }})
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ You can find in in your Firefly III installation:
|
|||||||
You can find them in your Firefly III installation:
|
You can find them in your Firefly III installation:
|
||||||
|
|
||||||
{% for journal in journals %}
|
{% for journal in journals %}
|
||||||
- {{ journal.description }}: {{ route('transactions.show', journal.id) }}
|
- {{ journal.description }}: {{ route('transactions.show', journal.id) }} ({{ journal|journalTotalAmountPlain }})
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user