mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-02 06:27:50 -05:00
Add stock location as filter to detailed sales + receivings reports
This commit is contained in:
@@ -50,9 +50,9 @@ $route['reports/graphical_:any'] = "reports/date_input";
|
||||
$route['reports/(inventory_:any)/(:any)'] = "reports/$1/$2";
|
||||
$route['reports/inventory_:any'] = "reports/excel_export";
|
||||
|
||||
$route['reports/(detailed_sales)/(:any)/(:any)'] = "reports/$1/$2/$3";
|
||||
$route['reports/detailed_sales'] = "reports/date_input";
|
||||
$route['reports/(detailed_receivings)/(:any)/(:any)'] = "reports/$1/$2/$3";
|
||||
$route['reports/(detailed_sales)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3$/$4";
|
||||
$route['reports/detailed_sales'] = "reports/date_input_sales";
|
||||
$route['reports/(detailed_receivings)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3/$4";
|
||||
$route['reports/detailed_receivings'] = "reports/date_input_recv";
|
||||
$route['reports/(specific_:any)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3/$4";
|
||||
$route['reports/specific_customer'] = "reports/specific_customer_input";
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -30,7 +30,11 @@ class Detailed_receivings extends Report
|
||||
$this->db->from('receivings_items_temp');
|
||||
$this->db->join('people as employee', 'receivings_items_temp.employee_id = employee.person_id');
|
||||
$this->db->join('people as supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left');
|
||||
$this->db->where('receiving_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
|
||||
$this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' and '. $this->db->escape($inputs['end_date']));
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
$this->db->where('item_location', $inputs['location_id']);
|
||||
}
|
||||
if ($inputs['receiving_type'] == 'receiving')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
@@ -67,7 +71,7 @@ class Detailed_receivings extends Report
|
||||
{
|
||||
$this->db->select('sum(total) as total');
|
||||
$this->db->from('receivings_items_temp');
|
||||
$this->db->where('receiving_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
|
||||
$this->db->where('receiving_date BETWEEN '. $this->db->escape($inputs['start_date']). ' and '. $this->db->escape($inputs['end_date']));
|
||||
if ($inputs['receiving_type'] == 'receiving')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
|
||||
@@ -30,7 +30,11 @@ class Detailed_sales extends Report
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->join('people as employee', 'sales_items_temp.employee_id = employee.person_id');
|
||||
$this->db->join('people as customer', 'sales_items_temp.customer_id = customer.person_id', 'left');
|
||||
$this->db->where('sale_date BETWEEN "'. $inputs['start_date']. '" and "'. $inputs['end_date'].'"');
|
||||
$this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' and '. $this->db->escape($inputs['end_date']));
|
||||
if ($inputs['location_id'] != 'all')
|
||||
{
|
||||
$this->db->where('item_location', $inputs['location_id']);
|
||||
}
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
@@ -51,7 +55,7 @@ class Detailed_sales extends Report
|
||||
$this->db->select('name, category, quantity_purchased, item_location, serialnumber, sales_items_temp.description, subtotal,total, tax, profit, discount_percent');
|
||||
$this->db->from('sales_items_temp');
|
||||
$this->db->join('items', 'sales_items_temp.item_id = items.item_id');
|
||||
$this->db->where('sale_id = '.$value['sale_id']);
|
||||
$this->db->where('sale_id', $value['sale_id']);
|
||||
$data['details'][$key] = $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
@@ -62,7 +66,7 @@ class Detailed_sales extends Report
|
||||
{
|
||||
$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'].'"');
|
||||
$this->db->where('sale_date BETWEEN '. $this->db->escape($inputs['start_date']). ' and '. $this->db->escape($inputs['end_date']));
|
||||
if ($inputs['sale_type'] == 'sales')
|
||||
{
|
||||
$this->db->where('quantity_purchased > 0');
|
||||
|
||||
@@ -416,8 +416,7 @@ class Sale extends CI_Model
|
||||
.$this->db->dbprefix('sales_items').'.line='.$this->db->dbprefix('sales_items_taxes').'.line'."
|
||||
GROUP BY sale_id, item_id, line)");
|
||||
|
||||
//Update null item_tax_percents to be 0 instead of null
|
||||
$this->db->where('item_tax_percent IS NULL');
|
||||
//Update null item_tax_percents to be 0 instead of null$this->db->where('item_tax_percent IS NULL');
|
||||
$this->db->update('sales_items_temp', array('item_tax_percent' => 0));
|
||||
|
||||
//Update null tax to be 0 instead of null
|
||||
|
||||
@@ -39,7 +39,7 @@ class Stock_locations extends CI_Model
|
||||
{
|
||||
return $this->get_all()->num_rows() > 1;
|
||||
}
|
||||
|
||||
|
||||
function get_allowed_locations($module_id='items')
|
||||
{
|
||||
$stock = $this->get_undeleted_all($module_id)->result_array();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer"> <?php echo $this->lang->line('common_you_are_using_ospos'); ?> <?php echo $this->config->item('application_version'); ?>.
|
||||
<?php echo $this->lang->line('common_please_visit_my'); ?> <a href="http://sourceforge.net/projects/opensourcepos/" target="_blank"><?php echo $this->lang->line('common_website'); ?></a> <?php echo $this->lang->line('common_learn_about_project'); ?>.</div>
|
||||
<?php echo $this->lang->line('common_please_visit_my'); ?> <a href="https://github.com/jekkos/opensourcepos" target="_blank"><?php echo $this->lang->line('common_website'); ?></a> <?php echo $this->lang->line('common_learn_about_project'); ?>.</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -50,23 +50,36 @@ if(isset($error))
|
||||
'sales' => $this->lang->line('reports_sales'),
|
||||
'returns' => $this->lang->line('reports_returns')), 'all', 'id="input_type"'); ?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
if (count($stock_locations) > 1) {
|
||||
?>
|
||||
<?php echo form_label($this->lang->line('reports_stock_location'), 'reports_stock_location_label', array('class' => 'required')); ?>
|
||||
<div id='report_stock_location'>
|
||||
<?php echo form_dropdown('stock_location', $stock_locations, 'all', 'id="location_id"'); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
elseif($mode == 'receiving')
|
||||
{
|
||||
?>
|
||||
<?php echo form_label($this->lang->line('reports_receiving_type'), 'reports_receiving_type_label', array('class'=>'required')); ?>
|
||||
<div id='report_receiving_type'>
|
||||
<?php echo form_dropdown('receiving_type',array('all' => $this->lang->line('reports_all'),
|
||||
<?php echo form_dropdown('receiving_type',array('all' => $this->lang->line('reports_all'),
|
||||
'receiving' => $this->lang->line('reports_receivings'),
|
||||
'returns' => $this->lang->line('reports_returns'),
|
||||
'requisitions' => $this->lang->line('reports_requisitions')), 'all', 'id="input_type"'); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
elseif($mode == 'requisition')
|
||||
{
|
||||
//Do nothing
|
||||
<?php
|
||||
if (count($stock_locations) > 1)
|
||||
{
|
||||
?>
|
||||
<?php echo form_label($this->lang->line('reports_stock_location'), 'reports_stock_location_label', array('class'=>'required')); ?>
|
||||
<div id='report_stock_location'>
|
||||
<?php echo form_dropdown('stock_location',$stock_locations,'all','id="location_id"'); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
@@ -86,24 +99,30 @@ $(document).ready(function()
|
||||
$("#generate_report").click(function()
|
||||
{
|
||||
var input_type = $("#input_type").val();
|
||||
|
||||
var location_id = $("#location_id").val();
|
||||
var location = window.location;
|
||||
if ($("#simple_radio").attr('checked'))
|
||||
{
|
||||
window.location = window.location+'/'+$("#report_date_range_simple option:selected").val() + '/' + input_type;
|
||||
location += '/'+$("#report_date_range_simple option:selected").val() + '/' + input_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
var start_date = $("#start_year").val()+'-'+$("#start_month").val()+'-'+$('#start_day').val();
|
||||
var end_date = $("#end_year").val()+'-'+$("#end_month").val()+'-'+$('#end_day').val();
|
||||
if(input_type == null)
|
||||
if(!input_type)
|
||||
{
|
||||
window.location = window.location+'/'+start_date + '/'+ end_date;
|
||||
location += '/'+start_date + '/'+ end_date;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location = window.location+'/'+start_date + '/'+ end_date+ '/' + input_type;
|
||||
location += '/'+start_date + '/'+ end_date+ '/' + input_type;
|
||||
}
|
||||
}
|
||||
if (location_id)
|
||||
{
|
||||
location += '/' + location_id;
|
||||
}
|
||||
window.location = location;
|
||||
});
|
||||
|
||||
$("#start_month, #start_day, #start_year, #end_month, #end_day, #end_year").click(function()
|
||||
|
||||
@@ -75,7 +75,7 @@ reports_sales_summary_report,Overzicht Verkoop,Reporte de Resumen de Ventas,Sale
|
||||
reports_serial_number,Nummer,S/N:,Serial #,# Série,序號 #,серийный номер,Serial #,Seri No,Serial #
|
||||
reports_sold_by,Werknemer,Vendido Por,Sold By,Vendu par,銷售人,Продавал через,ขายโดย,Satışı Yapan,Dijual Oleh
|
||||
reports_sold_to,Klant,Vendido A,Sold To,Vendu à,購買人,Продано к,ขายไปที่,Satış Yapılan,Dijual Kepada
|
||||
reports_stock_location,,Ubicación de Inventario,Stock location,,,,,Stok Yeri,Lokasi Stock
|
||||
reports_stock_location,Stock Locatie,Ubicación de Inventario,Stock Location,,,,,Stok Yeri,Lokasi Stock
|
||||
reports_subtotal,Subtotaal,Subtotal,Subtotal,Sous-total,小計,Промежуточная сумма,ยอดรวมรอง,Ara Toplam,SubTotal
|
||||
reports_summary_reports,Overzicht Rapporten,Reportes Resumidos,Summary Reports,Rapports de Résumés,摘要報表,Сводные отчеты,สรุปรายงาน,Özet Raporları,Ringkasan Laporan
|
||||
reports_supplied_by,Geleverd door,Provisto por,Supplied by,Fournit par,付款人,Поставлял за,ผบิตโดย,Sağlayıcı,Pemasok
|
||||
|
||||
|
Reference in New Issue
Block a user