2017-03-09 51 views
-2

现在我正在使用Laravel Framework 5.4开发发票应用程序。Laravel 5.4信用卡,借记卡和余额计算

我在交易表中保存贷方和借方金额。我想显示信用额度,借方发生额,余额发生额在刀片模板(同像下面)

enter image description here

+0

你尝试过这么远吗? – EddyTheDove

+0

Transaction :: Select('*','(credit - debit)as Balance') - > get(); @EddyTheDove – Karthik

+0

请在问题 – Nevermore

回答

0

在你的控制器:

$交易= DB ::表( '交易') - >获得();

在刀片:

 <?php $tbalance=0; ?> 
     @foreach($transaction as $trans) 
     <tr> 
<td>{{$invaccstatements->ref_no}} </td> 
<td>{{number_format($invaccstatements->credit, 2)}}</td> 
<td>{{number_format($invaccstatements->debit, 2)}}</td> 
<td align="right"><?php $chkbala = $invaccstatements->credit - $invaccstatements->debit; echo $tbalance += $chkbala; ?></td> 
</tr> 
    @endforeach 
+1

<?php $ tbalance = 0中添加代码片段? ?> @foreach($交易为$反) ​​{{$反> ref_no}} ​​{{number_format($反式>信贷,2)}} ​​{{number_format($ trans-> debit,2)}} <?php $ chkbala = $ trans-> credit - $ trans-> debit; echo $ tbalance + = $ chkbala; ?> @endforeach – Karthik

相关问题