payable filters

This commit is contained in:
David Bomba 2022-04-26 18:07:52 +10:00
parent e521718605
commit 0a483275ad

View File

@ -138,6 +138,18 @@ class InvoiceFilters extends QueryFilters
});
}
public function payable(string $client_id)
{
if (strlen($client_id) == 0) {
return $this->builder;
}
return $this->builder->whereIn('status_id', [Invoice::STATUS_DRAFT, Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('balance', '>', 0)
->where('is_deleted', 0)
->where('client_id', $this->decodePrimaryKey($client_id));
}
/**
* Sorts the list based on $sort.
*