Fix customer search in takings (#654)

Replace payment type label with amount tendered (#513)
This commit is contained in:
jekkos
2016-06-15 08:44:24 +02:00
parent 1861f4f71f
commit 4b0badfb30
3 changed files with 6 additions and 5 deletions

View File

@@ -31,12 +31,13 @@ class Sale extends CI_Model
public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 'sale_date', $order = 'desc')
{
$this->db->select('sale_id, sale_date, sale_time, SUM(quantity_purchased) AS items_purchased,
CONCAT(customer.first_name, " ", customer.last_name) AS customer_name,
CONCAT(person.first_name, " ", person.last_name) AS customer_name, customer.company_name,
SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(tax) AS tax, SUM(cost) AS cost, SUM(profit) AS profit,
sale_payment_amount AS amount_tendered, SUM(total) AS amount_due, (sale_payment_amount - SUM(total)) AS change_due,
payment_type, invoice_number');
$this->db->from('sales_items_temp');
$this->db->join('people AS customer', 'sales_items_temp.customer_id = customer.person_id', 'left');
$this->db->join('people AS person', 'sales_items_temp.customer_id = person.person_id', 'left');
$this->db->join('customers AS customer', 'sales_items_temp.customer_id = customer.person_id', 'left');
if(empty($search))
{
@@ -55,7 +56,7 @@ class Sale extends CI_Model
$this->db->group_start();
$this->db->like('last_name', $search);
$this->db->or_like('first_name', $search);
$this->db->or_like('CONCAT(customer.first_name, " ", last_name)', $search);
$this->db->or_like('CONCAT(first_name, " ", last_name)', $search);
$this->db->or_like('company_name', $search);
$this->db->group_end();
}

View File

@@ -21,7 +21,7 @@ class Detailed_sales extends Report
'tax' => $this->lang->line('reports_tax'),
'cost' => $this->lang->line('reports_cost'),
'profit' => $this->lang->line('reports_profit'),
'payment_type' => $this->lang->line('reports_payment_type'),
'payment_type' => $this->lang->line('sales_amount_tendered'),
'comment' => $this->lang->line('reports_comments'),
'edit' => ''),
'details' => array(

View File

@@ -9,7 +9,7 @@ class Summary_payments extends Report
public function getDataColumns()
{
return array($this->lang->line('reports_payment_type'), $this->lang->line('reports_count'), $this->lang->line('reports_total'));
return array($this->lang->line('reports_payment_type'), $this->lang->line('reports_count'), $this->lang->line('sales_amount_tendered'));
}
public function getData(array $inputs)