Add stock location as filter to detailed sales + receivings reports

This commit is contained in:
jekkos
2015-07-10 19:04:52 +02:00
parent 70b7a03c63
commit 83a297cf15
9 changed files with 61 additions and 71 deletions

View File

@@ -333,9 +333,11 @@ class Reports extends Secure_area
}
//Input for reports that require only a date range. (see routes.php to see that all graphical summary reports route here)
function date_input()
function date_input_sales()
{
$data = $this->_get_common_report_data();
$stock_locations = $this->Stock_locations->get_allowed_locations('sales');
$data['stock_locations'] = array_merge(array('all' => $this->lang->line('reports_all')), $stock_locations);
$data['mode'] = 'sale';
$this->load->view("reports/date_input",$data);
}
@@ -343,14 +345,9 @@ class Reports extends Secure_area
function date_input_recv()
{
$data = $this->_get_common_report_data();
$data['mode'] = 'receiving';
$this->load->view("reports/date_input",$data);
}
function date_input_reqs()
{
$data = $this->_get_common_report_data();
$data['mode'] = 'requisition';
$stock_locations = $this->Stock_locations->get_allowed_locations('receivings');
$data['stock_locations'] = array_merge(array('all' => $this->lang->line('reports_all')), $stock_locations);
$data['mode'] = 'receiving';
$this->load->view("reports/date_input",$data);
}
@@ -843,13 +840,13 @@ class Reports extends Secure_area
}
function detailed_sales($start_date, $end_date, $sale_type, $export_excel=0)
function detailed_sales($start_date, $end_date, $sale_type, $location_id='all', $export_excel=0)
{
$this->load->model('reports/Detailed_sales');
$model = $this->Detailed_sales;
$headers = $model->getDataColumns();
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type, 'location_id' => $location_id));
$summary_data = array();
$details_data = array();
@@ -886,13 +883,13 @@ class Reports extends Secure_area
$this->load->view("reports/tabular_details",$data);
}
function detailed_receivings($start_date, $end_date, $receiving_type, $export_excel=0)
function detailed_receivings($start_date, $end_date, $receiving_type, $location_id='all', $export_excel=0)
{
$this->load->model('reports/Detailed_receivings');
$model = $this->Detailed_receivings;
$headers = $model->getDataColumns();
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'receiving_type'=>$receiving_type));
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'receiving_type'=>$receiving_type, 'location_id' => $location_id));
$summary_data = array();
$details_data = array();
@@ -930,39 +927,6 @@ class Reports extends Secure_area
$this->load->view("reports/tabular_details",$data);
}
function detailed_requisition($start_date, $end_date , $export_excel=0)
{
$this->load->model('reports/Detailed_requisition');
$model = $this->Detailed_requisition;
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date));
$summary_data = array();
$details_data = array();
foreach($report_data['summary'] as $key=>$row)
{
$summary_data[] = array(anchor('receivings/requisition_receipt/'.$row['requisition_id'], 'REQS '.$row['requisition_id'], array('target' => '_blank')), $row['requisition_date'], $row['employee_name'], $row['comment']);
foreach($report_data['details'][$key] as $drow)
{
$details_data[$key][] = array($drow['name'], $drow['requisition_quantity'],
$drow['related_item_id'], $drow['related_item_quantity'],
$drow['related_item_total_quantity']);
}
}
$data = array(
"title" =>$this->lang->line('reports_detailed_requisition_report'),
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
"headers" => $model->getDataColumns(),
"summary_data" => $summary_data,
"details_data" => $details_data,
"overall_summary_data" => '',
"export_excel" => $export_excel
);
$this->load->view("reports/tabular_details",$data);
}
function excel_export()
{
$this->load->view("reports/excel_export",array());