Fix detailed receivings/sales report issues (#68)

This commit is contained in:
jekkos
2018-09-06 01:12:47 +02:00
committed by jekkos
parent 83dc1de6d6
commit 9d0da3e6b8
4 changed files with 8 additions and 8 deletions

View File

@@ -1251,7 +1251,7 @@ class Reports extends Secure_Controller
{
$quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']';
}
$details_data[$row['sale_id']][] = $this->xss_clean(array(
$details_data[$row['sale_id']][] = $this->xss_clean(array_merge(array(
$drow['name'],
$drow['category'],
$drow['serialnumber'],
@@ -1262,7 +1262,8 @@ class Reports extends Secure_Controller
to_currency($drow['total']),
to_currency($drow['cost']),
to_currency($drow['profit']),
($drow['discount_type'] == PERCENT)? $drow['discount'].'%':to_currency($drow['discount'])));
($drow['discount_type'] == PERCENT)? $drow['discount'].'%':to_currency($drow['discount']),
explode('|', (isset($drow['attribute_values'])) ? $drow['attribute_values'] : ""))));
}
if(isset($report_data['rewards'][$key]))
@@ -1370,8 +1371,7 @@ class Reports extends Secure_Controller
$quantity_purchased,
to_currency($drow['total']),
($drow['discount_type'] == PERCENT)? $drow['discount'].'%':to_currency($drow['discount'])),
explode(',', $drow['attribute_values'])
));
explode('|', (isset($drow['attribute_values'])) ? $drow['attribute_values'] : "")));
}
}

View File

@@ -88,7 +88,7 @@ class Receiving extends CI_Model
$receivings_items_data = array(
'receiving_id' => $receiving_id,
'item_id' => $item['item_id'],
'linae' => $item['line'],
'line' => $item['line'],
'description' => $item['description'],
'serialnumber' => $item['serialnumber'],
'quantity_purchased' => $item['quantity'],

View File

@@ -97,12 +97,12 @@ class Detailed_receivings extends Report
foreach($data['summary'] as $key=>$value)
{
$this->db->select('name, item_number, category, quantity_purchased, serialnumber, total, discount_percent, item_location, receivings_items_temp.receiving_quantity');
$this->db->select('name, item_number, category, quantity_purchased, serialnumber, total, discount, discount_type, item_location, receivings_items_temp.receiving_quantity');
$this->db->from('receivings_items_temp');
$this->db->join('items', 'receivings_items_temp.item_id = items.item_id');
if (count($inputs['definition_ids']) > 0)
{
$this->db->select('GROUP_CONCAT(attribute_value) AS attribute_values');
$this->db->select('GROUP_CONCAT(attribute_value SEPARATOR \'|\') AS attribute_values');
$this->db->join('attribute_links', 'attribute_links.item_id = items.item_id AND attribute_links.receiving_id = receivings_items_temp.receiving_id AND definition_id IN (' . implode(',', $inputs['definition_ids']) . ')', 'left');
$this->db->join('attribute_values', 'attribute_values.attribute_id = attribute_links.attribute_id', 'left');
$this->db->order_by('definition_id');

View File

@@ -148,7 +148,7 @@ class Detailed_sales extends Report
$this->db->from('sales_items_temp');
if (count($inputs['definition_ids']) > 0)
{
$this->db->select('GROUP_CONCAT(attribute_value) AS attribute_values');
$this->db->select('GROUP_CONCAT(attribute_value SEPARATOR \'|\') AS attribute_values');
$this->db->join('attribute_links', 'attribute_links.item_id = sales_items_temp.item_id AND attribute_links.sale_id = sales_items_temp.sale_id AND definition_id IN (' . implode(',', $inputs['definition_ids']) . ')', 'left');
$this->db->join('attribute_values', 'attribute_values.attribute_id = attribute_links.attribute_id', 'left');
$this->db->order_by('definition_id');