<?php namespace App\Controllers;
/**
 * File			: Report.php
 * Description  : Controller untuk halaman laporan penjualan
 * Created By	: Hendi
 * Created Date : 13 Apr 2021
 * Last Update  : 13 Apr 2021
**/
use \App\Models\TrxModel;
class Report extends MyBaseController
{
	public function index()
	{
	    # fn isLoggedIn di MyBaseController
		if (!$this->isLoggedIn()) return redirect()->to(base_url('/login'));
		# jika sudah menu dinamis diisi dari array hasil query
		$data_sidebar = []; 
		# jika dibutuhkan data untuk konten
		$tgl_awal = $this->request->getGet('tgl_awal') ?? date('Y-m-d');
		$tgl_akhir = $this->request->getGet('tgl_akhir') ?? date('Y-m-d');
		$data_content = [
			'mod' => 'laporan',
			'tgl_awal' => $tgl_awal,
			'tgl_akhir' => $tgl_akhir
		];
		$data = [
			'title' => 'Laporan',
			'sidebar' => view('contents/sidebar', $data_sidebar),
			'content' => view('contents/laporan/laporan_list', $data_content),
		];
		return view('templates/index', $data);
	}
}
