mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-10 23:17:08 -04:00
Allowed search box and filters to be contextual to selected date range (#667)
This commit is contained in:
@@ -62,11 +62,9 @@ class Item extends CI_Model
|
||||
$this->db->where('location_id', $filters['stock_location_id']);
|
||||
}
|
||||
|
||||
if(empty($search))
|
||||
{
|
||||
$this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
else
|
||||
$this->db->where('DATE_FORMAT(trans_date, "%Y-%m-%d") BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
|
||||
if(!empty($search))
|
||||
{
|
||||
if($filters['search_custom'] == FALSE)
|
||||
{
|
||||
|
||||
@@ -39,18 +39,15 @@ class Sale extends CI_Model
|
||||
$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))
|
||||
{
|
||||
$this->db->where('DATE(sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
else
|
||||
$this->db->where('DATE(sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
|
||||
if(!empty($search))
|
||||
{
|
||||
if($filters['is_valid_receipt'] != FALSE)
|
||||
{
|
||||
$pieces = explode(' ', $search);
|
||||
$this->db->where('sales_items_temp.sale_id', $pieces[1]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$this->db->group_start();
|
||||
@@ -108,11 +105,9 @@ class Sale extends CI_Model
|
||||
$this->db->join('sales_payments', 'sales_payments.sale_id = sales.sale_id');
|
||||
$this->db->join('people', 'people.person_id = sales.customer_id', 'left');
|
||||
|
||||
if(empty($search))
|
||||
{
|
||||
$this->db->where('DATE(sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
}
|
||||
else
|
||||
$this->db->where('DATE(sale_time) BETWEEN ' . $this->db->escape($filters['start_date']) . ' AND ' . $this->db->escape($filters['end_date']));
|
||||
|
||||
if(!empty($search))
|
||||
{
|
||||
if($filters['is_valid_receipt'] != FALSE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user