<?php $tdNoFormat = isset($tdNoFormat)?$tdNoFormat:array(); ?>
<style>
	.table th,.table td{
		line-height:10px;
	}
</style>
    
    <tr>
       <td colspan="2" style="position: relative">
       			<img class="image" style="position:absolute;left:0;top:0;z-index: -1000" alt="" src="<?php echo base_url() ?>img/rptPaymentAdvice.png" /> 
                <table class="table" style="z-index: 100" cellpadding="0" cellspacing="0" width="80%">

                    <thead class="thPrint">
                        <tr <?php /*style="background:url(<?php echo base_url() ?>img/rptPaymentAdvice.png)" */ ?>>
                            <?php 
                                if (isset($tableHeader)){
                                    
                                 if (!in_array("#",$tableHeader))
                                     echo " <th>#</th>"; 
									 $p = 0;
								foreach ($tableHeader as $value) {
                                	if (isset($tdAmount) && in_array($selectFields[$p++],$tdAmount)) {	
										echo " <th style='text-align:right;'>".$value."</th>";
									}else{
										echo " <th>".$value."</th>";
									}
								}
                            }
                            ?>

                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $i = 1;
                        $total = 0;
                        $nHeader = 0;
                         if (isset($tableHeader))
                              $nHeader =  sizeof($tableHeader);
							  $i = 1;
                        if(!empty($rptDataDetail)):
                        foreach ($rptDataDetail as $row1) {
                          
                            $tr ="<tr><td>".$i++."</td>";
							
                            for ($p=0; $p<$nHeader; $p++){
                               $array = get_object_vars( $row1);
                              // var_dump($array);
                               if (in_array("lineNo",$selectFields))
                                   $tr ="<tr><td>".$array[$selectFields["lineNo"]]."</td>";
                                if (isset($tdAmount)) {
                                    if (in_array($selectFields[$p],$tdAmount) && !in_array($selectFields[$p],$tdNoFormat)){
                                        $tr .= "<td style='text-align:right;'>".number_format($array[$selectFields[$p]],2)."</td>";
                                    }elseif (in_array($selectFields[$p],$tdAmount) && in_array($selectFields[$p],$tdNoFormat)){
                                        $tr .= "<td style='text-align:right;'>".$array[$selectFields[$p]]."</td>";
                                    }else{
                                        $tr .= "<td>".$array[$selectFields[$p]]."</td>";
                                    }
                                }  else {
                                    $tr .= "<td>".$array[$selectFields[$p]]."</td>";
                                }
                              
                            }
                            $tr .= "</tr>";
                            echo $tr;
                        }
                        endif;
                    ?>
                    	
                    
                        <?php 
                            if (isset($tableFooter)){
                                if (in_array("#",$tableHeader)) 
                                    echo " <tr><td style='text-align:right;' colspan='".sizeof($tableHeader)."'>";
                                else 
                                    echo " <tr><td style='text-align:right;' colspan='".(sizeof($tableHeader)+1)."'>";
                                
                                 foreach ($tableFooter as $value) {
                                    echo "<p>".$value."</p>";
                              }
                              echo "</td></tr>";
                            }
                        ?>
                </tbody>
            </table>
      </td>
</tr>