Browse Source

Change getMonths helper name to get_months

pull/20/head
Nafies Luthfi 7 years ago
parent
commit
b821618ab9
  1. 6
      app/Helpers/date_time.php
  2. 2
      app/Http/Controllers/Reports/SalesController.php
  3. 2
      resources/views/reports/sales/yearly.blade.php

6
app/Helpers/date_time.php

@ -26,7 +26,7 @@ function date_id($date)
$explodedDate = explode('-', $date); $explodedDate = explode('-', $date);
if (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[2], $explodedDate[0])) { if (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[2], $explodedDate[0])) {
$months = getMonths();
$months = get_months();
return $explodedDate[2].' '.$months[$explodedDate[1]].' '.$explodedDate[0]; return $explodedDate[2].' '.$months[$explodedDate[1]].' '.$explodedDate[0];
} }
@ -45,13 +45,13 @@ function monthId($monthNumber)
return $monthNumber; return $monthNumber;
} }
$months = getMonths();
$months = get_months();
$monthNumber = monthNumber($monthNumber); $monthNumber = monthNumber($monthNumber);
return $months[$monthNumber]; return $months[$monthNumber];
} }
function getMonths()
function get_months()
{ {
return [ return [
'01' => __('time.months.01'), '01' => __('time.months.01'),

2
app/Http/Controllers/Reports/SalesController.php

@ -28,7 +28,7 @@ class SalesController extends Controller
public function monthly(Request $request) public function monthly(Request $request)
{ {
$years = getYears(); $years = getYears();
$months = getMonths();
$months = get_months();
$year = $request->get('year', date('Y')); $year = $request->get('year', date('Y'));
$month = $request->get('month', date('m')); $month = $request->get('month', date('m'));
$reports = $this->getMonthlyReports($year, $month); $reports = $this->getMonthlyReports($year, $month);

2
resources/views/reports/sales/yearly.blade.php

@ -32,7 +32,7 @@
</thead> </thead>
<tbody> <tbody>
@php $chartData = []; @endphp @php $chartData = []; @endphp
@foreach(getMonths() as $monthNumber => $monthName)
@foreach(get_months() as $monthNumber => $monthName)
@php @php
$any = isset($reports[$monthNumber]); $any = isset($reports[$monthNumber]);
$omzet = $any ? $reports[$monthNumber]->omzet : 0 $omzet = $any ? $reports[$monthNumber]->omzet : 0

Loading…
Cancel
Save