diff --git a/app/Entities/Reports/ReportsRepository.php b/app/Entities/Reports/ReportsRepository.php
index e07d769..8ab63a0 100755
--- a/app/Entities/Reports/ReportsRepository.php
+++ b/app/Entities/Reports/ReportsRepository.php
@@ -31,12 +31,25 @@ class ReportsRepository extends BaseRepository
public function getMonthlyReports($year, $month)
{
- return Payment::select(DB::raw("date, count(`id`) as count, sum(if(in_out = 1, amount, 0)) AS cashin, sum(if(in_out = 0, amount, 0)) AS cashout, in_out"))
+ $rawQuery = "date, count(`id`) as count";
+ $rawQuery .= ", sum(if(in_out = 1, amount, 0)) AS cashin";
+ $rawQuery .= ", sum(if(in_out = 0, amount, 0)) AS cashout";
+
+ $reportsData = DB::table('payments')->select(DB::raw($rawQuery))
->where(DB::raw('YEAR(date)'), $year)
->where(DB::raw('MONTH(date)'), $month)
->groupBy('date')
->orderBy('date', 'asc')
->get();
+
+ $reports = [];
+ foreach ($reportsData as $report) {
+ $key = substr($report->date, -2);
+ $reports[$key] = $report;
+ $reports[$key]->profit = $report->cashin - $report->cashout;
+ }
+
+ return collect($reports);
}
public function getYearlyReports($year)
diff --git a/app/helpers.php b/app/helpers.php
index 113569d..51a3f2b 100755
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -237,6 +237,22 @@ function paymentTypes($paymentTypeId = null)
function appLogoImage()
{
$logoString = '';
+ $logoString .= 'src="'.appLogoPath().'">';
return $logoString;
}
+
+function appLogoPath()
+{
+ return asset('assets/imgs/'.Option::get('agency_logo_path', 'default-logo.png'));
+}
+
+function monthDateArray($year, $month)
+{
+ $dateCount = Carbon::parse($year.'-'.$month)->format('t');
+ $dates = [];
+ foreach (range(1, $dateCount) as $dateNumber) {
+ $dates[] = str_pad($dateNumber, 2, '0', STR_PAD_LEFT);
+ }
+
+ return $dates;
+}
diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php
index ec573bd..c602d26 100755
--- a/resources/views/layouts/partials/sidebar.blade.php
+++ b/resources/views/layouts/partials/sidebar.blade.php
@@ -10,7 +10,7 @@