mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-03-25 18:32:17 -04:00
Fix: Add Debit Card filter to Daily Sales and Takings
Add 'only_debit' filter to Daily Sales and Takings dropdown. Reuses existing 'Sales.debit' language string for the filter label. Includes filter default initialization in getSearch() to prevent PHP warnings. Fixes #4439
This commit is contained in:
@@ -92,6 +92,7 @@ class Sales extends Secure_Controller
|
||||
'only_due' => lang('Sales.due_filter'),
|
||||
'only_check' => lang('Sales.check_filter'),
|
||||
'only_creditcard' => lang('Sales.credit_filter'),
|
||||
'only_debit' => lang('Sales.debit'),
|
||||
'only_invoices' => lang('Sales.invoice_filter'),
|
||||
'selected_customer' => lang('Sales.selected_customer')
|
||||
];
|
||||
@@ -154,6 +155,7 @@ class Sales extends Secure_Controller
|
||||
'only_check' => false,
|
||||
'selected_customer' => false,
|
||||
'only_creditcard' => false,
|
||||
'only_debit' => false,
|
||||
'only_invoices' => $this->config['invoice_enable'] && $this->request->getGet('only_invoices', FILTER_SANITIZE_NUMBER_INT),
|
||||
'is_valid_receipt' => $this->sale->is_valid_receipt($search)
|
||||
];
|
||||
|
||||
@@ -273,6 +273,10 @@ class Sale extends Model
|
||||
$builder->like('payment_type', lang('Sales.credit'));
|
||||
}
|
||||
|
||||
if ($filters['only_debit']) {
|
||||
$builder->like('payment_type', lang('Sales.debit'));
|
||||
}
|
||||
|
||||
$builder->groupBy('payment_type');
|
||||
|
||||
$payments = $builder->get()->getResultArray();
|
||||
@@ -1494,6 +1498,10 @@ class Sale extends Model
|
||||
$builder->like('payments.payment_type', lang('Sales.credit'));
|
||||
}
|
||||
|
||||
if ($filters['only_debit']) {
|
||||
$builder->like('payments.payment_type', lang('Sales.debit'));
|
||||
}
|
||||
|
||||
if ($filters['only_due']) {
|
||||
$builder->like('payments.payment_type', lang('Sales.due'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user