<?php 
  $tdNoFormat = isset($tdNoFormat)?$tdNoFormat:array(); 
?>
<style>
    .table th,.table td{
        line-height:10px;
    }
</style>
    <tr>
        <td>
            <table  style="width:95%; margin-top:20px; margin:auto;" class="printTbl">
                <tbody>
                    <tr>
                        <td>
                            <span class="db nrmTxt"><?php echo $this->lang->line('ref'); ?> : </span>
                            <span class="db nrmTxt"><?php echo $this->lang->line('date')." : ".date("d-m-Y"); ?></span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span class="db mt20 nameAdd">
                              <?php 
                                if(!empty($nameNaddress)):
                                    foreach($nameNaddress as $v):
                                        if($v != ''){
                                            echo $v."<br />";                              
                                        }
                                    endforeach;
                                endif;
                              ?>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span class="db mt20 mb20 nrmTxt"><?php echo $this->lang->line('dearSir'); ?>,</span>
                            <span class="db mt20 mb20 nrmTxt" style="text-align:justify;">
                                <?php echo str_replace('{name}','<b>'.$info[0]->mastercodeName.'</b>',str_replace("{amount}",number_format($total,2),$this->lang->line('letterCont'))); ?>
                            </span>
                        </td>
                    </tr>
                    <?php if(isset($beneficiary) && !empty($beneficiary)): ?>
                    <tr>
                        <td>
                            <table  style="width:100%; margin-top:20px; margin:auto;" class="printTbl">
                                <tbody>
                                    <tr>
                                        <td class="nrmTxt" colspan="2" style="padding:0 0 20px;margin-bottom:10px;">
                                            <table  style="width:100%; margin-top:20px; margin:auto;" class="printTbl">
                                                <tbody>
                                                    <tr>
                                                        <?php $total = 0; if(isset($beneficiary) && !empty($beneficiary)): ?>
                                                        <td>
                                                            <table  style="width:100%; margin-top:20px; margin:auto;" class="printTbl wakafData">
                                                                <tbody>
                                                                    <tr>
                                                                        <td class="solidL1T" colspan="4" style="line-height:2px;">&nbsp;</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td><?php echo $this->lang->line('beneficiary'); ?></td>
                                                                        <td><?php echo $this->lang->line('description'); ?></td>
                                                                        <td class="tar">%</td>
                                                                        <td class="tar">RM</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="solidL1T" colspan="4" style="line-height:2px;">&nbsp;</td>
                                                                    </tr>
                                                                <?php foreach($beneficiary as $row): ?>
                                                                    <tr>
                                                                        <td><?php echo $row['0']; ?></td>
                                                                        <td><?php echo $row['1']; ?></td>
                                                                        <td class="tar"><?php echo $row['2']; ?></td>
                                                                        <td class="tar"><?php echo number_format($row['3'],2); ?></td>
                                                                    </tr>
                                                                <?php $total += floatval($row['3']); endforeach; ?>
                                                                    <tr>
                                                                        <td class="solidL1" colspan="4">&nbsp;</td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>                                                       
                                                        </td>  
                                                        <?php endif; ?>  
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" style="height:20px">&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td class="nrmTxt">
                                            <?php echo $this->lang->line('provisionForCash'); ?> <?php echo date("d-m-Y"); ?>
                                        </td>
                                        <td class="nameAdd tar">
                                            RM <?php echo number_format($total,2); ?>
                                        </td>
                                    </tr>
                                    <?php if(isset($cashPaidAmount) && !empty($cashPaidAmount)): ?>
                                    <tr>
                                        <td class="nrmTxt">
                                            Cash paid as at <?php echo date("d-m-Y",strtotime($cashPaidDate)); ?>
                                        </td>
                                        <td class="nrmTxt tar">
                                            <?php echo number_format($cashPaidAmount,2); ?>
                                        </td>
                                    </tr>
                                    <?php endif; ?>
                                    <?php if(isset($cashPayableAmount) && !empty($cashPayableAmount)): ?>
                                    <tr>
                                        <td class="nrmTxt">
                                            Cash payable as at <?php echo date("d-m-Y",strtotime($cashPayableDate)); ?>
                                        </td>
                                        <td class="nameAdd tar">
                                            <?php echo number_format($cashPayableAmount,2); ?>
                                        </td>
                                    </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>    
                        </td>
                    </tr>
                    <?php endif; ?>
                    <tr>
                        <td >
                            <span class="db mt20 mb20">&nbsp;</span>
                            <span class="db mt20 mb20 nrmTxt"><?php echo $this->lang->line('stampSignature'); ?></span>
                            <span class="db">-----------------------------------------</span>
                            <span class="db mb20 nrmTxt"><?php echo $this->lang->line('nameDesignation'); ?></span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>
    <tr>
        <td></td>
    </tr>
    <tr>
        <td></td>
    </tr>
    <tr>
        <td></td>
    </tr>