public function statistics()
{
$json = array();
$stat_range = 'today';
if ($this->input->get('stat_range')) {
$stat_range = $this->input->get('stat_range');
}
$result = $this->Dashboard_model->getStatistics($stat_range);
$json['sales'] = empty($result['sales']) ? $this->currency->format('0.00') : $this->currency->format($result['sales']);
$json['lost_sales'] = empty($result['lost_sales']) ? $this->currency->format('0.00') : $this->currency->format($result['lost_sales']);
$json['cash_payments'] = empty($result['cash_payments']) ? $this->currency->format('0.00') : $this->currency->format($result['cash_payments']);
$json['customers'] = empty($result['customers']) ? '0' : $result['customers'];
$json['orders'] = empty($result['orders']) ? '0' : $result['orders'];
$json['orders_completed'] = empty($result['orders_completed']) ? '0' : $result['orders_completed'];
$json['delivery_orders'] = empty($result['delivery_orders']) ? '0' : $result['delivery_orders'];
$json['collection_orders'] = empty($result['collection_orders']) ? '0' : $result['collection_orders'];
$json['tables_reserved'] = empty($result['tables_reserved']) ? '0' : $result['tables_reserved'];
$this->output->set_output(json_encode($json));
}