رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
مشکل در حساب اعداد
#1
سلام

لطفا کد زیر را ببینید

                <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>

و نتیجه در عکس زیر :

   

سوال من اینجاست ... مشکل کجاست چرا کد بنده جمع ساده رو اشتباه انجام میده !!! در ستون مانده حساب ...
پاسخ
تشکر شده توسط:




کاربران در حال بازدید این موضوع: 1 مهمان