<style type="text/css">
@media print {
    *{
        box-sizing: border-box;
    }
    .table-tree{
        width:100%;
        text-align:left;
        padding-left:10px !important;
        font-size: 14px;
        border-collapse: collapse;
        border-spacing: 0;
    }
    .table-tree th{
        padding-top:5px;
        padding-bottom:5px;
        padding-left: 5px;
        padding-right: 5px;
        border-top:1px solid #000;
        border-bottom:1px solid #000;
    }
    .table th, td{
        border-left: 0;
        border-right: 0;
        margin: 0;
        padding: 3 5px;
    }
    .box-pad,.box-pad *{
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }
    .tre td{
        border:none;
    }
    .level-1{
        padding-left:5px !important;
    }
    .level-2{
        padding-left: 20px !important;
    }
    .level-3{
        padding-left: 35px !important;
    }
    .level-4{
        padding-left: 50px !important;
    }
    .txt-right{
        text-align: right !important;
    }
    .tittle{
        width: 100%;
        margin: 0 0 10px 0;
        float: left;
        text-align: center;
    }
    .tittle h6{
        border-bottom:2px solid #000;
        width: 150px;
        max-width: 300px;
        font-size: 16px;
        margin: 10px auto;
    }
    .date{
        width:100%;
        float: left;
        font-size: 12px;
        font-weight: 600;
        text-align: right;
    }
    .date span{
        width: 150px;
        display: inline-block;
    }
    .clear{
        clear: both;
    }
    .br-top{
        border-top: 1px solid #000;
        border-bottom: 3px double #000;
    }
    .r-col-1{
        width: 80px;
        float: right;
        text-align: left;
    }
    .r-col-2{
        width: 100px;
        float: right;
        text-align: left;
    }
    .footer {
      width:100%;
      float:left;
      font-size:11px;
      position:absolute;
      bottom:0px;
      left:0px;
      text-align:center !important;
      line-height:18px;
      border-top: 1px dotted #000;
      padding: 5px;
  }
}
</style>

 <div class="container">
        <div class="heading">
            <div class="heading tittle">
                    <div><h2><?php echo Yii::app()->user->master_company_name;?></h2></div>
            </div>
        </div>
    </div>
    <div class="tittle"><h6>Allocation Report</h6></div>
    <?php
    $allocation = FinVoucherAllocation::model()->find(array('condition'=>'allocation_id='.$id));
    ?>
    <div class="date"><div class="r-col-1"><b>:</b> <?php echo $id?></div><div class="r-col-2"><b>Allocation ID </b></div> </div>


    <div class="date"><div class="r-col-1"><b>:</b> <?php echo date_format(date_create($allocation->allocate_date),'d-m-Y');?></div><div class="r-col-2"><b>Allocation Date </b></div>
</div>
<div class="clear"></div>
<table class="table-tree">
  <thead>
    <tr>
        <th class="cell-left">Voucher No</th>
        <th class="cell-left">Date</th>
        <th class="cell-left">Invoice</th>
        <th class="cell-left" width="100">Cheque No.</th>
        <th class="cell-left" width="">Cheque Date</th>
        <th class="cell-left" width="400">Comments</th>
        <th class="cell-right">Debit</th>
        <th class="cell-right">Credit</th>
    </tr>
  </thead>
    <?php

    $allocateAll=FinVoucherAllocation::model()->findAll(array('condition'=>'allocation_id='.$id));
    $debit_tot=0;
    $credit_tot=0;
    foreach ($allocateAll as $eachaccounts){
        ?>
        <tr>
           <td class="cell-left"><?php echo  $eachaccounts->voucher_no; ?></td>
           <td class="cell-left"><?php
           $rest = substr($eachaccounts->voucher_no, 0, 2);
           if($rest=='P1')
           {
           $voucher=FinGeneralLedger::model()->find(array('condition'=>'voucher_no="'.$eachaccounts->voucher_no.'"','order'=>'id desc'));  
           }
           else {
           $voucher=FinGeneralLedger::model()->findByPk($eachaccounts->invoice_id);
           }
           echo date_format(date_create($voucher->date),'d-m-Y'); ?></td>
           <td class="cell-left"><?php echo  $eachaccounts->invoice_id; ?></td>
           <td class="cell-left"><?php if($voucher->chk_no!="XXX" && $voucher->chk_no!="NULL" && $voucher->chk_no!=NULL && $voucher->chk_no!="") { echo  $voucher->chk_no; } ?></td>
           <td class="cell-left"><?php if($voucher->cheque_date!="1111-11-11" && $voucher->cheque_date!="0000-00-00" && $voucher->chk_no!=NULL && $voucher->chk_no!="") { echo  date_format(date_create($voucher->cheque_date),'d-m-Y'); }
           ?></td>
           <td class="cell-left"><?php
           if($voucher->item_description!='')
           {
           echo $voucher->item_description;   
           }
           else {
           echo $voucher->narration; 
           }
           ?></td>
           <td class="cell-right"><?php
           echo $eachaccounts->debit_allocate_amount;
           $debit_tot+=$eachaccounts->debit_allocate_amount;
           ?></td>
           <td  class="cell-right"><?php
           echo $eachaccounts->credit_allocate_amount;
           $credit_tot+=$eachaccounts->credit_allocate_amount;
           ?></td>
       </tr>
       <?php   }
       ?>
       <tr>  <td class="cell-right" colspan="5"></td> <td class="cell-right"><b>Total</b></td>
        <td class="cell-right br-top"><b><?php echo Yii::app()->numberFormatter->formatCurrency($debit_tot,''); ?></b></td>
        <td class="cell-right br-top"><b><?php echo Yii::app()->numberFormatter->formatCurrency($credit_tot,''); ?></b></td>
    </tr>




</table>
</div>

        <!--mpdf
        <htmlpagefooter name="myfooter">
            <div style="border-top: 1px dotted #000000; font-size: 12px; text-align: center; padding-top: 10px; ">
                <div style="text-align:left;width:50%;float:left">Printed on <?php
                  date_default_timezone_set("Asia/Dubai");
                 echo date('d/m/Y')." ".date("h:i:sa"); ?> </div>
                <div style="text-align:right;width:50%;float:left">Page {PAGENO} of {nb} </div>
            </div>
        </htmlpagefooter>
        <sethtmlpagefooter name="myfooter" page="all" value="on" />
        mpdf-->