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:
Ollama
2026-03-16 06:30:07 +00:00
committed by jekkos
parent e01dad728f
commit 9820beb0e1
2 changed files with 10 additions and 0 deletions

View File

@@ -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)
];

View File

@@ -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'));
}