Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

akaunting/akaunting

9348 stars
1 code files
View akaunting/akaunting on GitHub

app/Http/Controllers/Purchases/Vendors.php

Open in GitHub
use App\Abstracts\Http\Controller;
use App\Models\Banking\Transaction;
 
class Vendors extends Controller
{
//
public function show(Contact $vendor)
{
$amounts = [
'paid' => 0,
'open' => 0,
'overdue' => 0,
];
//
$transactions = Transaction::with('account', 'category')->where('contact_id', $vendor->id)->expense()->get();
 
$counts['transactions'] = $transactions->count();
 
$transactions->each(function ($item) use (&$amounts) {
$amounts['paid'] += $item->getAmountConvertedToDefault();
});
//
}
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.