mahdiak
چهارشنبه 24 آذر 1395, 10:25 صبح
سلام
لطفا کد زیر را ببینید
<table class="table table-striped jambo_table bulk_action">
<thead>
<tr class="headings">
<th class="column-title text-center">ردیف</th>
<th class="column-title text-center">توضیحات</th>
<th class="column-title text-center">تاریخ</th>
<th class="column-title text-center">بدهکار</th>
<th class="column-title text-center">بستانکار</th>
<th class="column-title text-center">مانده حساب ( تومان )</th>
</tr>
</thead>
<?php $radif = 0; $sum = 0;?>
<?php foreach ($malis as $mali) : ?>
<?php $radif++?>
<tbody>
<tr class="even pointer">
<td class="text-center"><?=$radif?></td>
<td class="text-center"><?=Html::encode($mali->comment)?></td>
<td class="text-center"><?=Jdf::jdate('d F Y', Html::encode($mali->ts))?></td>
<td class="text-center"><?=number_format(Html::encode($mali->bed))?></td>
<td class="text-center"><?=number_format(Html::encode($mali->bes))?></td>
<td class="text-center">
<?php
$sum = $sum + ($mali->bed - $mali->bes);
echo number_format(abs($sum));
?>
</td>
</tr>
</tbody>
<?php endforeach; ?>
</table>
و نتیجه را در فایل ضمیمه مشاهده کنید !!!!
سوال من اینجاست ... مشکل کجاست چرا کد بنده جمع ساده رو اشتباه انجام میده !!! در ستون مانده حساب ...
لطفا کد زیر را ببینید
<table class="table table-striped jambo_table bulk_action">
<thead>
<tr class="headings">
<th class="column-title text-center">ردیف</th>
<th class="column-title text-center">توضیحات</th>
<th class="column-title text-center">تاریخ</th>
<th class="column-title text-center">بدهکار</th>
<th class="column-title text-center">بستانکار</th>
<th class="column-title text-center">مانده حساب ( تومان )</th>
</tr>
</thead>
<?php $radif = 0; $sum = 0;?>
<?php foreach ($malis as $mali) : ?>
<?php $radif++?>
<tbody>
<tr class="even pointer">
<td class="text-center"><?=$radif?></td>
<td class="text-center"><?=Html::encode($mali->comment)?></td>
<td class="text-center"><?=Jdf::jdate('d F Y', Html::encode($mali->ts))?></td>
<td class="text-center"><?=number_format(Html::encode($mali->bed))?></td>
<td class="text-center"><?=number_format(Html::encode($mali->bes))?></td>
<td class="text-center">
<?php
$sum = $sum + ($mali->bed - $mali->bes);
echo number_format(abs($sum));
?>
</td>
</tr>
</tbody>
<?php endforeach; ?>
</table>
و نتیجه را در فایل ضمیمه مشاهده کنید !!!!
سوال من اینجاست ... مشکل کجاست چرا کد بنده جمع ساده رو اشتباه انجام میده !!! در ستون مانده حساب ...