|
|
@ -14,13 +14,30 @@ use App\Entities\Projects\Project; |
|
|
*/ |
|
|
*/ |
|
|
class ReportsRepository extends BaseRepository |
|
|
class ReportsRepository extends BaseRepository |
|
|
{ |
|
|
{ |
|
|
|
|
|
/** |
|
|
|
|
|
* Payment model. |
|
|
|
|
|
* |
|
|
|
|
|
* @var \App\Entities\Payments\Payment |
|
|
|
|
|
*/ |
|
|
protected $model; |
|
|
protected $model; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Create ReportsRepository class instance. |
|
|
|
|
|
* |
|
|
|
|
|
* @param \App\Entities\Payments\Payment $model |
|
|
|
|
|
*/ |
|
|
public function __construct(Payment $model) |
|
|
public function __construct(Payment $model) |
|
|
{ |
|
|
{ |
|
|
parent::__construct($model); |
|
|
parent::__construct($model); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Get payment daily report. |
|
|
|
|
|
* |
|
|
|
|
|
* @param string $date |
|
|
|
|
|
* @param string $q |
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Collection |
|
|
|
|
|
*/ |
|
|
public function getDailyReports($date, $q) |
|
|
public function getDailyReports($date, $q) |
|
|
{ |
|
|
{ |
|
|
return Payment::orderBy('date', 'desc') |
|
|
return Payment::orderBy('date', 'desc') |
|
|
@ -29,6 +46,13 @@ class ReportsRepository extends BaseRepository |
|
|
->get(); |
|
|
->get(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Get payment montly report by year and month. |
|
|
|
|
|
* |
|
|
|
|
|
* @param string $year |
|
|
|
|
|
* @param string $month |
|
|
|
|
|
* @return \Illuminate\Support\Collection |
|
|
|
|
|
*/ |
|
|
public function getMonthlyReports($year, $month) |
|
|
public function getMonthlyReports($year, $month) |
|
|
{ |
|
|
{ |
|
|
$rawQuery = 'date, count(`id`) as count'; |
|
|
$rawQuery = 'date, count(`id`) as count'; |
|
|
@ -52,6 +76,12 @@ class ReportsRepository extends BaseRepository |
|
|
return collect($reports); |
|
|
return collect($reports); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Get payment yearly report. |
|
|
|
|
|
* |
|
|
|
|
|
* @param string $year |
|
|
|
|
|
* @return \Illuminate\Support\Collection |
|
|
|
|
|
*/ |
|
|
public function getYearlyReports($year) |
|
|
public function getYearlyReports($year) |
|
|
{ |
|
|
{ |
|
|
$rawQuery = 'MONTH(date) as month'; |
|
|
$rawQuery = 'MONTH(date) as month'; |
|
|
@ -76,6 +106,11 @@ class ReportsRepository extends BaseRepository |
|
|
return collect($reports); |
|
|
return collect($reports); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Get current credit/receiveble earnings report. |
|
|
|
|
|
* |
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Collection |
|
|
|
|
|
*/ |
|
|
public function getCurrentCredits() |
|
|
public function getCurrentCredits() |
|
|
{ |
|
|
{ |
|
|
// On Progress, Done, On Hold
|
|
|
// On Progress, Done, On Hold
|
|
|
|