Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0
Solution

I've solved the problem using this:

DB::statement('set @balance := 0');
$entries = Voucher::with('chequeInfo')
			    ->select('receipt_no', 'particular', DB::raw('@balance := @balance + (deposite - expense) as cBal'))
			    ->where('receipt_type', 'LIKE', '%-fund')
			    ->where('ladger_id', $id)->get();

If there is any better way then please post here.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

heera heera Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.