here's my question in detail I have an invoice table, with date and payment_term column.
date is a date column payment_term is an integer column, with the number of days an invoice is due for payment.
I'm trying to do a selectRaw in the Model (Fat Model, Skinny Controller thing)
public static function sumOfInvoiceOverdue() {
return Invoice::selectRaw('SUM(net_amount - paid_amount) as overdueAmount')->whereDate('date'+'payment_term', '<', Carbon::now())->get();
}
So if I have an invoice date of 1st April And it's due in 10 days
1/4/2020 + 10 = 11/4/2020 If Now is larger than 11/4/2020 it'll mean that this invoice is overdue, and should be returned as a result.
My question is, is it possible to do something like this? whereDate('date'+'payment_term', '<', carbon:now())
Thank you, I've tried my best to google, and search, but the specifics of this question makes it rather hard for me to find an answer.
Much thanks again, and hope everyone is well in these trying times.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire