Fix detailed sale + receiving report row update + currency sorting (#1003)

This commit is contained in:
jekkos
2016-11-25 20:57:39 +01:00
parent 2f8d66664b
commit 1666a3e689
6 changed files with 34 additions and 30 deletions

View File

@@ -121,11 +121,17 @@ function transform_headers_readonly($array)
return json_encode($result);
}
function transform_headers($array)
function transform_headers($array, $readonly = FALSE)
{
$result = array();
$array = array_merge(array(array('checkbox' => 'select', 'sortable' => FALSE)),
$array, array(array('edit' => '')));
if (!readonly)
{
$array = array_merge(array(array('checkbox' => 'select', 'sortable' => FALSE)), $array);
}
$array[] = array('edit' => '');
foreach($array as $element)
{
$result[] = array('field' => key($element),

View File

@@ -225,7 +225,7 @@ class Receiving extends CI_Model
*/
public function create_temp_table(array $inputs)
{
if(empty($input['receiving_id']))
if(empty($inputs['receiving_id']))
{
$where = 'WHERE DATE(receiving_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
}

View File

@@ -733,7 +733,7 @@ class Sale extends CI_Model
$decimals = totals_decimals();
if(empty($input['sale_id']))
if(empty($inputs['sale_id']))
{
$where = 'WHERE DATE(sales.sale_time) BETWEEN ' . $this->db->escape($inputs['start_date']) . ' AND ' . $this->db->escape($inputs['end_date']);
}

View File

@@ -19,16 +19,15 @@ class Detailed_receivings extends Report
{
$columns = array(
'summary' => array(
'id' => $this->lang->line('reports_receiving_id'),
'receiving_date' => $this->lang->line('reports_date'),
'quantity' => $this->lang->line('reports_quantity'),
'employee' => $this->lang->line('reports_received_by'),
'supplier' => $this->lang->line('reports_supplied_by'),
'total' => $this->lang->line('reports_total'),
'payment_type' => $this->lang->line('reports_payment_type'),
'reference' => $this->lang->line('receivings_reference'),
'comment' => $this->lang->line('reports_comments'),
'edit' => ''),
array('id' => $this->lang->line('reports_receiving_id')),
array('receiving_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('employee' => $this->lang->line('reports_received_by')),
array('supplier' => $this->lang->line('reports_supplied_by')),
array('total' => $this->lang->line('reports_total')),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('reference' => $this->lang->line('receivings_reference')),
array('comment' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_item_number'),
$this->lang->line('reports_name'),

View File

@@ -19,19 +19,18 @@ class Detailed_sales extends Report
{
return array(
'summary' => array(
'id' => $this->lang->line('reports_sale_id'),
'sale_date' => $this->lang->line('reports_date'),
'quantity' => $this->lang->line('reports_quantity'),
'employee' => $this->lang->line('reports_sold_by'),
'customer' => $this->lang->line('reports_sold_to'),
'subtotal' => $this->lang->line('reports_subtotal'),
'tax' => $this->lang->line('reports_tax'),
'total' => $this->lang->line('reports_total'),
'cost' => $this->lang->line('reports_cost'),
'profit' => $this->lang->line('reports_profit'),
'payment_type' => $this->lang->line('sales_amount_tendered'),
'comment' => $this->lang->line('reports_comments'),
'edit' => ''),
array('id' => $this->lang->line('reports_sale_id')),
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('employee' => $this->lang->line('reports_sold_by')),
array('customer' => $this->lang->line('reports_sold_to')),
array('subtotal' => $this->lang->line('reports_subtotal')),
array('total' => $this->lang->line('reports_total')),
array('tax' => $this->lang->line('reports_tax')),
array('cost' => $this->lang->line('reports_cost')),
array('profit' => $this->lang->line('reports_profit')),
array('payment_type' => $this->lang->line('sales_amount_tendered')),
array('comment' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_name'),
$this->lang->line('reports_category'),
@@ -100,7 +99,7 @@ class Detailed_sales extends Report
if($inputs['location_id'] != 'all')
{
$this->db->where('item_location', $inputs['location_id']);
$this->db->where('item_location', $inputs['location_id']);
}
if($inputs['sale_type'] == 'sales')

View File

@@ -35,7 +35,7 @@
};
$('#table').bootstrapTable({
columns: <?php echo transform_headers_readonly($headers['summary']); ?>,
columns: <?php echo transform_headers($headers['summary'], TRUE); ?>,
pageSize: <?php echo $this->config->item('lines_per_page'); ?>,
striped: true,
pagination: true,