application/controllers/Reports.php
/* 
	* Nge redirects ke report product page
	* mengambil semua data orders database sesuai dari tahun
    */
Nge redirects ke report product page
mengambil semua data orders database sesuai dari tahun
Nge redirects ke report product page mengambil semua data orders database sesuai dari tahun
public function index()
	{
		if(!in_array('viewReport', $this->permission)) {
            redirect('dashboard', 'refresh');
        }
		$today_year = date('Y');
		if($this->input->post('select_year')) {
			$today_year = $this->input->post('select_year');
		}
		$order_data = $this->model_reports->getOrderData($today_year);
		$this->data['report_years'] = $this->model_reports->getOrderYear();
		$final_order_data = array();
		foreach ($order_data as $k => $v) {
			if(count($v) > 1) {
				$total_amount_earned = array();
				foreach ($v as $k2 => $v2) {
					if($v2) {
						$total_amount_earned[] = $v2['net_amount'];						
					}
				}
				$final_order_data[$k] = array_sum($total_amount_earned);	
			}
			else {
				$final_order_data[$k] = 0;	
			}
		}
		$this->data['selected_year'] = $today_year;
		$this->data['company_currency'] = $this->company_currency();
		$this->data['results'] = $final_order_data;
		$this->render_template('reports/index', $this->data);
	}
public function index ( ) { if ( ! in_array ( 'viewReport' , $ this -> permission ) ) { redirect ( 'dashboard' , 'refresh' ) ; } $ today_year = date ( 'Y' ) ; if ( $ this -> input -> post ( 'select_year' ) ) { $ today_year = $ this -> input -> post ( 'select_year' ) ; } $ order_data = $ this -> model_reports -> getOrderData ( $ today_year ) ; $ this -> data [ 'report_years' ] = $ this -> model_reports -> getOrderYear ( ) ; $ final_order_data = array ( ) ; foreach ( $ order_data as $ k => $ v ) { if ( count ( $ v ) > 1 ) { $ total_amount_earned = array ( ) ; foreach ( $ v as $ k2 => $ v2 ) { if ( $ v2 ) { $ total_amount_earned [ ] = $ v2 [ 'net_amount' ] ; } } $ final_order_data [ $ k ] = array_sum ( $ total_amount_earned ) ; } else { $ final_order_data [ $ k ] = 0 ; } } $ this -> data [ 'selected_year' ] = $ today_year ; $ this -> data [ 'company_currency' ] = $ this -> company_currency ( ) ; $ this -> data [ 'results' ] = $ final_order_data ; $ this -> render_template ( 'reports/index' , $ this -> data ) ; }
Nge redirects ke report product page
 mengambil semua data orders database sesuai dari tahun
Nge redirects ke report product page mengambil semua data orders database sesuai dari tahun