/**
  * Get a full report on the users incomes during the period for the given accounts.
  *
  * @param Carbon     $start
  * @param Carbon     $end
  * @param Collection $accounts
  *
  * @return Income
  */
 public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts) : Income
 {
     $object = new Income();
     /** @var AccountRepositoryInterface $repos */
     $repos = app(AccountRepositoryInterface::class);
     $journals = $repos->incomesInPeriod($accounts, $start, $end);
     foreach ($journals as $entry) {
         $amount = TransactionJournal::amount($entry);
         $object->addToTotal($amount);
         $object->addOrCreateIncome($entry);
     }
     return $object;
 }
Esempio n. 2
0
 /**
  * Get a full report on the users incomes during the period for the given accounts.
  *
  * @param Carbon     $start
  * @param Carbon     $end
  * @param Collection $accounts
  *
  * @return Income
  */
 public function getIncomeReport($start, $end, Collection $accounts)
 {
     $object = new Income();
     $set = $this->query->income($accounts, $start, $end);
     foreach ($set as $entry) {
         $object->addToTotal($entry->journalAmount);
         $object->addOrCreateIncome($entry);
     }
     return $object;
 }
Esempio n. 3
0
 /**
  * Get a full report on the users incomes during the period.
  *
  * @param Carbon  $start
  * @param Carbon  $end
  * @param boolean $shared
  *
  * @return Income
  */
 public function getIncomeReport($start, $end, $shared)
 {
     $object = new Income();
     $set = $this->query->incomeInPeriodCorrected($start, $end, $shared);
     foreach ($set as $entry) {
         $object->addToTotal($entry->amount);
         $object->addOrCreateIncome($entry);
     }
     return $object;
 }
Esempio n. 4
0
 /**
  * Get a full report on the users incomes during the period for the given accounts.
  *
  * @param Carbon     $start
  * @param Carbon     $end
  * @param Collection $accounts
  *
  * @return Income
  */
 public function getIncomeReport($start, $end, Collection $accounts)
 {
     $object = new Income();
     $set = $this->query->incomeInPeriod($start, $end, $accounts);
     foreach ($set as $entry) {
         $object->addToTotal($entry->amount_positive);
         $object->addOrCreateIncome($entry);
     }
     return $object;
 }