{assign var = tsellbill  value = 0}
{assign var = treturnsellbill  value = 0}
{assign var = tsr  value = 0}
{assign var = texpenses  value = 0}
{assign var = tclientdebtchange  value = 0}
{assign var = tec  value = 0}



<div class="row" style="text-align: center;">
    <div class="col-lg-2">
               <h3>    المبيعات   :   <span id="tsellbill"> {$tsellbill} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>    المردود     :  <span id="treturnsellbill">{$treturnsellbill} </span></h3> 
    </div>
    <div class="col-lg-2">
               <h3>    صافى المبيعات      :   <span id="tsr"> {$tsr} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>  المصروفات     : <span id="texpenses">{$texpenses} </span></h3> 
    </div>
    <div class="col-lg-2">
            <h3 > التحصيل    :  <span id="tclientdebtchange"> {$tclientdebtchange} </span></h3> 
    </div>
    <div class="col-lg-2">
               <h3>    الربح   :   <span id="tec"> {$tec} </span></h3> 
    </div>
</div>  


<div class="row">
        <table class="table table-bordered">
          <thead>
            <tr>
              <th scope="col">العميل</th>
              <th scope="col">دين العميل</th>
              <th scope="col">المبيعات</th>
              <th scope="col">المردود</th>
              <th scope="col">صافى المبيعات   </th>
              <th scope="col">المصروفات</th>
              <th scope="col">الربح</th>
              <th scope="col">التحصيل</th>
             
            
            </tr>
          </thead>
          <tbody>
             {foreach $clientsdatas as $clientsdata}
            <tr>
              <td>{$clientsdata.clientname}</td>
              <td>{$clientsdata.clientdebt}</td>
              <td>{$clientsdata.sellbill}</td>
              <td>{$clientsdata.returnsellbill}</td>
              <td>{$clientsdata.sellbill - $clientsdata.returnsellbill}</td>
              <td>{$clientsdata.expenses}</td>
               <td>{$clientsdata.sellbill - $clientsdata.expenses}</td>
              <td>{$clientsdata.clientdebtchange}</td>
            
              
            </tr>
              {assign  var = tsellbill value = $tsellbill + $clientsdata.sellbill}
              {assign  var = treturnsellbill value = $treturnsellbill + $clientsdata.returnsellbill}
               {assign  var = tsr value = $tsr + ($clientsdata.sellbill - $clientsdata.returnsellbill)}
              {assign  var = tclientdebtchange value = $tclientdebtchange + $clientsdata.clientdebtchange}
              {assign  var = texpenses value = $texpenses + $clientsdata.expenses}
               {assign  var = tec value = $tec + ($clientsdata.sellbill - $clientsdata.expenses)}
            {/foreach}
          </tbody>           
        </table>
</div>

<div class="row" style="text-align: center;">
    <div class="col-lg-2">
               <h3>      المبيعات      :   <span id="gtsellbill"> {$tsellbill} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>     المردود     :   <span id="gtreturnsellbill">{$treturnsellbill} </span></h3> 
    </div>
       <div class="col-lg-2">
               <h3>    صافى المبيعات   :   <span id="gtsr"> {$tsr} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>  المصروفات     : <span id="gtexpenses">{$texpenses} </span></h3> 
    </div>
    <div class="col-lg-2">
            <h3 >  التحصيل    :  <span id="gtclientdebtchange"> {$tclientdebtchange} </span></h3> 
    </div>
     <div class="col-lg-2">
               <h3>    الربح   :   <span id="gtec"> {$tec} </span></h3> 
    </div>



</div>  



{literal}
<script type="text/javascript">
$(document).ready(function () {
      $("#tsellbill").html($("#gtsellbill").text());
      $("#treturnsellbill").html($("#gtreturnsellbill").text());
      $("#tsr").html($("#gtsr").text());
      $("#texpenses").html($("#gtexpenses").text());
      $("#tclientdebtchange").html($("#gtclientdebtchange").text());
      $("#tec").html($("#gtec").text());
});  
</script>
{/literal}
