{% block body %}
<body>
  <header>
     <table style="width: 100%;">
       <tbody>
	       <tr>
	        <td  style="width: 50%;">
             <p><strong style = "font-size: 18px;">Cross World Group</strong> <br> Plot 1/B, Road 90, Gulshan -2, Dhaka 1212. </p>
    	    	
	      	</td>

		      <td align="right" style="width: 50%;">
                 <img src="admin/images/cw_logo.jpg" width="150" height="50" />
              
	      	</td>
  
	     </tr>
       
	   </tbody>
  
    </table>
  </header>
  <footer>
   <p class="page">{{ "now"|date("d/m/Y") }} | Copyright &copy; Cross World Group <?php echo date("Y");?>  | Page </p>
   
  </footer>

  <main>
   <table style="font-size: 13px; width: 100%;">
    <tbody>
	    <tr>
	       <td colspan="3" style="width: 100%; text-align: center; ">
          <p> 
           <strong style = "font-size: 18px;"> DEPRECIATION SCHEDULE STATEMENT</strong> <br>
           
            For the period from {{ fromDate|date("d/m/Y") }} to {{ toDate|date("d/m/Y") }} <br>
            Print Date : {{ "now"|date("d/m/Y") }}
            
          </p>
        	    
	    	</td>
		     
	    </tr>
             
  	</tbody>
 
</table>
 
<table class="table-bordered" style="width: 100%; font-size: 12px;">
							<thead>
                     <tr>
                  <th colspan="5"> Particulars</th>                  
                  <th colspan="4">Cost</th>
                  <th colspan="4">Depreciation </th> 
                  <th> </th>                     
					</tr>
                    
					 <tr>
                  <th style="width: 3%;"> SL #</th>
                  <th style="width: 7%; text-align: center;">Group</th>
                  <th style="width: 7%;"> Sub Group </th>
                  <th style= "text-align: center; width: 13%;">Asset Name</th>
                  <th style="width:7 %;">Acquisition Date</th>
                  <th style="width:7 %;">Opening</th>
                  <th style="width:7 %;">Addition</th>
                  <th style="width:7 %;">Disposal</th>
                  <th style="width:7 %;">Closing</th>
                  <th style="width:7 %;">Opening</th>
                  <th style="width:7 %;">Depre. Charge</th>
                  <th style="width:7 %;">Disposal</th>
                  <th style="width:7 %;">Closing</th>
                  <th style="width:7 %;">WDV</th>                              
							  </tr>
							</thead>
							<tbody>

           {% set totalCostopening = 0 %}
           {% set totalCostaddition = 0 %}
           {% set totalCostdisposal = 0 %}
           {% set totalCostclosing = 0 %}
           {% set totalDepreciationopening = 0 %}
           {% set totalDepreciationcharge = 0 %}
           {% set totalDepreciationdisposal = 0 %}
           {% set totalDepreciationclosing = 0 %}
           {% set totalWDV = 0 %}

					 {% for depSchedule in depSchedules %} 

               {% set totalCostopening = ( totalCostopening | default(0) ) + depSchedule.costopening %}
               {% set totalCostaddition = ( totalCostaddition | default(0) ) + depSchedule.costaddition %}
               {% set totalCostdisposal = ( totalCostdisposal | default(0) ) + depSchedule.costdisposal %}
               {% set totalCostclosing = ( totalCostclosing | default(0) ) + depSchedule.costclosing %}
               {% set totalDepreciationopening = ( totalDepreciationopening | default(0) ) + depSchedule.depreciationopening %}
               {% set totalDepreciationcharge = ( totalDepreciationcharge | default(0) ) + depSchedule.depreciationcharge %}
               {% set totalDepreciationdisposal = ( totalDepreciationdisposal | default(0) ) + depSchedule.depreciationdisposal %}
               {% set totalDepreciationclosing = ( totalDepreciationclosing | default(0) ) + depSchedule.depreciationclosing %}
               {% set totalWDV = ( totalWDV | default(0) ) + depSchedule.WDV %}
                        
		          <tr>
		               <td style= "text-align: center;"> {{loop.index}}</td>		                                   
		               <td> &nbsp;{{depSchedule.groupname}} </td>
                   <td> &nbsp;{{depSchedule.subgroup}} </td>
                   <td> &nbsp;{{depSchedule.assetname}} </td>
                   <td style= "text-align: center;"> {{ depSchedule.acquisitiondate ? depSchedule.acquisitiondate|date('Y-m-d') : '' }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.costopening|number_format(2, '.', ',') }}</td>
		               <td style= "text-align: center;"> {{ depSchedule.costaddition|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.costdisposal|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.costclosing|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.depreciationopening|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.depreciationcharge|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.depreciationdisposal|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.depreciationclosing|number_format(2, '.', ',') }} </td>
                   <td style= "text-align: center;"> {{ depSchedule.WDV|number_format(2, '.', ',') }} </td>
                      	              						
		          </tr>
                    
		             {% endfor %}
					   <tr>
                        <td colspan="5" style="text-align:right;"> <strong>Grand Total : </strong></td>
                        <td style= "text-align: center;"><strong>{{ totalCostopening|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalCostaddition|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalCostdisposal|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalCostclosing|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalDepreciationopening|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalDepreciationcharge|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalDepreciationdisposal|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalDepreciationclosing|number_format(2, '.', ',') }}</strong> </td>
                        <td style= "text-align: center;"><strong>{{ totalWDV|number_format(2, '.', ',') }}</strong> </td>

                        </tr> 
						</tbody>

                       
	                </table>



 {# <table class="table-bordered" style="width: 100%; font-size: 12px;">
<tr>
    <td style="width: 7%;">
    </td>
    <td style="width: 38%;">
    </td>
    <td style="width: 10%;">
    </td>
    <td style="width: 10%;">
    </td>
    <td style="width: 15%; text-align:right;">
   <strong> Grand Total : </strong>
    </td>
    <td style="width: 20%; text-align: center;">
   <strong>{{ grandTotalAmount|number_format(2, '.', ',') }} </strong>
    </td>
</tr>
</table> #}


  </main>
</body>
{% endblock %}

<style>
  @page { 
    margin: 100px 45px 80px 45px; 
    }
    /** Define the header rules **/
    header { 
      position: fixed; 
      top: -100px; 
      left: 0px; 
      right: 0px; 
    /**  background-color: lightblue; **/
      height: 90px; 
      border-bottom:1px solid gray;
      }
    /** Define the footer rules **/
    footer { 
      position: fixed; 
      bottom: -60px; 
      left: 0px; 
      right: 0px; 
    /**  background-color: lightblue; **/
      height: 40px; 
      text-align: center;
      border-top:1px solid gray;
      }
    footer .page:after { 
	     content: counter(page, upper-roman); 
      }
    
    p { 
      page-break-after: auto; 
      }
    p:last-child { 
      page-break-after: never; 
      }

 .table-bordered {
    border-left: 0.09em solid #ccc;
    border-right: 0;
    border-top: 0.09em solid #ccc;
    border-bottom: 0;
    border-collapse: collapse;
}
.table-bordered td,
.table-bordered th {
    border-left: 0;
    border-right: 0.09em solid #ccc;
    border-top: 0;
    border-bottom: 0.09em solid #ccc;
}
</style>