Store full datetime in post_date; recalculate finances on every pirep

This commit is contained in:
Nabeel Shahzad
2018-03-17 22:20:08 -05:00
parent 6fa724d7b7
commit 6b002f24a8
10 changed files with 52 additions and 17 deletions

View File

@@ -112,10 +112,12 @@ class RecurringFinanceService extends BaseService
'journal_id' => $journal->id,
'ref_class' => Expense::class,
'ref_class_id' => $expense->id,
'post_date' => \Carbon::now('UTC')->format('Y-m-d'),
];
$found = JournalTransaction::where($w)->count(['id']);
$found = JournalTransaction::where($w)
->whereDate('post_date', '=', \Carbon::now('UTC')->toDateString())
->count(['id']);
if($found > 0) {
Log::info('Expense "'.$expense->name.'" already charged for today, skipping');
continue;