non riesco ad inviare degli allegati. copio qui sotto il codice sorgente dove viene rilevato l'errore (reports/summary_sales.php):
-----------------------------------------------------------------------------------------
Codice PHP:
<?php
require_once("report.php");
class Summary_sales extends Report
{
function __construct()
{
parent::__construct();
}
public function getDataColumns()
{
return array($this->lang->line('reports_date'), $this->lang->line('reports_subtotal'), $this->lang->line('reports_total'), $this->lang->line('reports_tax'), $this->lang->line('reports_profit'));
}
public function getData(array $inputs)
{
$this->db->select('sale_date, sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit');
$this->db->from('sales_items_temp');
$this->db->group_by('sale_date');
$this->db->having('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
$this->db->order_by('sale_date');
return $this->db->get()->result_array();
}
public function getSummaryData(array $inputs)
{
$this->db->select('sum(subtotal) as subtotal, sum(total) as total, sum(tax) as tax,sum(profit) as profit');
$this->db->from('sales_items_temp');
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
return $this->db->get()->row_array();
}
}
?>
-----------------------------------------------------------------------------------------
Il sorgente dove viene generata la richiesta è troppo grande. ricopio qui sotto la parte (che io penso sia) rilevante.
-----------------------------------------------------------------------------------------
Codice PHP:
<?php
require_once ("secure_area.php");
require_once (APPPATH."libraries/ofc-library/open-flash-chart.php");
class Reports extends Secure_area
{
function __construct()
{
parent::__construct('reports');
$this->load->helper('report');
}
//Initial report listing screen
function index()
{
$this->load->view("reports/listing",array());
}
function _get_common_report_data()
{
$data = array();
$data['report_date_range_simple'] = get_simple_date_ranges();
$data['months'] = get_months();
$data['days'] = get_days();
$data['years'] = get_years();
$data['selected_month']=date('n');
$data['selected_day']=date('d');
$data['selected_year']=date('Y');
return $data;
}
//Input for reports that require only a date range and an export to excel. (see routes.php to see that all summary reports route here)
function date_input_excel_export()
{
$data = $this->_get_common_report_data();
$this->load->view("reports/date_input_excel_export",$data);
}
//Summary sales report
function summary_sales($start_date, $end_date, $export_excel=0)
{
$this->load->model('reports/Summary_sales');
$model = $this->Summary_sales;
$tabular_data = array();
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date));
foreach($report_data as $row)
{
$tabular_data[] = array($row['sale_date'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
}
$data = array(
"title" => $this->lang->line('reports_sales_summary_report'),
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
"headers" => $model->getDataColumns(),
"data" => $tabular_data,
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date)),
"export_excel" => $export_excel
);
$this->load->view("reports/tabular",$data);
}
//...