{assign var = tsellbilldetailquantity  value = 0}
{assign var = tsellbilldetailtotalprice  value = 0}
{assign var = tsr  value = 0}
{assign var = treturnsellbilldetailquantity  value = 0}
{assign var = treturnsellbilldetailtotalprice  value = 0}
{assign var = tec  value = 0}



<div class="row" style="text-align: center;">
    <div class="col-lg-2">
               <h3>    ك المبيعات   :   <span id="tsqunt"> {$tsellbilldetailquantity} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>    ك المردود     :  <span id="trqunt">{$treturnsellbilldetailquantity} </span></h3> 
    </div>
    <div class="col-lg-2">
               <h3>    الكميه      :   <span id="tsr"> {$tsr} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>  ج  المبيعات     : <span id="trqunt">{$tsellbilldetailtotalprice} </span></h3> 
    </div>
    <div class="col-lg-2">
            <h3 > ج المردود    :  <span id="trtotal"> {$treturnsellbilldetailtotalprice} </span></h3> 
    </div>
    <div class="col-lg-2">
               <h3>    الاجمالى   :   <span id="tec"> {$tec} </span></h3> 
    </div>
</div>  
<!-- 
<div class="row" style="text-align: center;">
      <h1 id="tcspaids"> {$tsellbill - ($tsrealestateunitspaids - $texpenses)} </h1> 
</div>  
 -->


<div class="row">
        <h3 style="text-align:center;">المبيعات </h3>
        <table class="table table-bordered">
         
          <thead>
            <tr>
              <th scope="col">الرقم</th>
              <th scope="col">الكميه</th>
              <th scope="col">القيمه</th>
            </tr>
            
          </thead>
          <tbody>
             {foreach $sellbill as $selldetail}
            <tr>
              <td>{$selldetail.sellbilldetailid}</td>
              <td>{$selldetail.sellbilldetailquantity}</td>
              <td>{$selldetail.sellbilldetailtotalprice}</td>
            </tr>
              {assign  var = tsellbilldetailquantity value = $tsellbilldetailquantity + $selldetail.sellbilldetailquantity}
              {assign  var = tsellbilldetailtotalprice value = $tsellbilldetailtotalprice + $selldetail.sellbilldetailtotalprice}
            {/foreach}
          </tbody>           
        </table>

        <h3 style="text-align:center;">المردود </h3>
        <table class="table table-bordered">
         
          <thead>
            <tr>
              <th scope="col">الرقم</th>
              <th scope="col">الكميه</th>
              <th scope="col">القيمه</th>
            </tr>
            
          </thead>
          <tbody>
             {foreach $returnsellbill as $returnbill}
            <tr>
              <td>{$returnbill.returnsellbilldetailid}</td>
              <td>{$returnbill.returnsellbilldetailquantity}</td>
              <td>{$selldetail.returnsellbilldetailtotalprice}</td>
            </tr>
              {assign  var = treturnsellbilldetailquantity value = $treturnsellbilldetailquantity + $returnbill.returnsellbilldetailquantity}
              {assign  var = treturnsellbilldetailtotalprice value = $treturnsellbilldetailtotalprice + $returnbill.returnsellbilldetailtotalprice}
            {/foreach}
          </tbody>           
        </table>
   
</div>

<div class="row" style="text-align: center;">
   <div class="col-lg-2">
               <h3>    ك المبيعات   :   <span id="tsqunt"> {$tsellbilldetailquantity} </span></h3> 
    </div>
    <div class="col-lg-2">
              <h3>    ك المردود     :  <span id="trqunt">{$treturnsellbilldetailquantity} </span></h3> 
    </div>
    <div class="col-lg-2">
               <h3>    الكميه      :   <span id="gtsr">{$tsellbilldetailquantity  - $treturnsellbilldetailquantity}  </span></h3> 
    </div>
     <div class="col-lg-2">
              <h3>  ج  المبيعات     : <span id="trqunt">{$tsellbilldetailtotalprice} </span></h3> 
    </div>
    <div class="col-lg-2">
            <h3 > ج المردود    :  <span id="trtotal"> {$treturnsellbilldetailtotalprice} </span></h3> 
    </div>
    <div class="col-lg-2">
               <h3>    الاجمالى   :   <span id="gtec"> {$tsellbilldetailtotalprice  - $treturnsellbilldetailtotalprice} </span></h3> 
    </div>

</div>  



{literal}
<script type="text/javascript">
$(document).ready(function () {
      $("#tsqunt").html($("#gtsqunt").text());
      $("#trqunt").html($("#gtrqunt").text());
      $("#tsr").html($("#gtsr").text());
      $("#trqunt").html($("#gtrqunt").text());
      $("#trtotal").html($("#gtrtotal").text());
      $("#tec").html($("#gtec").text());
});  
</script>
{/literal}
