mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Fix Summary Takings including not completed transactions (#1886)
This commit is contained in:
@@ -998,7 +998,7 @@ class Sales extends Secure_Controller
|
||||
$data['taxes'] = $this->sale_lib->get_taxes();
|
||||
$data['discount'] = $this->sale_lib->get_discount();
|
||||
$data['payments'] = $this->sale_lib->get_payments();
|
||||
// sale_type (0=pos, 1=invoice, 2=work order, 3=quote, 4=return
|
||||
// sale_type (0=pos, 1=invoice, 2=work order, 3=quote, 4=return)
|
||||
$sale_type = $this->sale_lib->get_sale_type();
|
||||
|
||||
// Returns 'subtotal', 'total', 'cash_total', 'payment_total', 'amount_due', 'cash_amount_due', 'payments_cover_total'
|
||||
|
||||
@@ -285,7 +285,7 @@ class Sale extends CI_Model
|
||||
public function get_payments_summary($search, $filters)
|
||||
{
|
||||
// get payment summary
|
||||
$this->db->select('payment_type, count(*) AS count, SUM(payment_amount) AS payment_amount');
|
||||
$this->db->select('payment_type, count(payment_amount) AS count, SUM(payment_amount) AS payment_amount');
|
||||
$this->db->from('sales AS sales');
|
||||
$this->db->join('sales_payments', 'sales_payments.sale_id = sales.sale_id');
|
||||
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'LEFT');
|
||||
@@ -334,6 +334,10 @@ class Sale extends CI_Model
|
||||
{
|
||||
$this->db->where('sales.sale_status = ' . COMPLETED . ' AND payment_amount < 0');
|
||||
}
|
||||
elseif($filters['sale_type'] == 'all')
|
||||
{
|
||||
$this->db->where('sales.sale_status = ' . COMPLETED);
|
||||
}
|
||||
|
||||
if($filters['only_invoices'] != FALSE)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user