I have table named particulars in my sql database, Am using two rows from two tables such as price from particular table and quantity from req table
$particulars =DB::table('particulars as A')
->leftjoin('reqs as B', function ($join) {
$join->on('A.particular_id', '=', 'B.particular_id');
})
->whereBetween('B.date_issued', [$start_date, $end_date]) >select('A.item_name','A.unit','A.price','B.quantity_issued',DB::raw('sum(A.price*B.quantity_issued) as total_cost'))
->groupBy('A.particular_id')
->get();
I want to get sum after multiplication of price and quantity means sum of Total cost that I get after multiplication. Here is My View <table cellspacing="0"> <thead style="background-color: grey"> <tr style=""> <th >Quantity</th> <th>price</th> <th>Total Cost</th> </tr> </thead> <tbody> @foreach($particulars as $particular) <tr> <td></td> please help
<td> </td> <td> </td> </tr> @endforeach </tbody> <tfoot> <tr> <td colspan="5" style="text-align: center">Total</td> <td class="total"></td> </tr> </tfoot> </table>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire