
		<table class="table" cellpadding="0" cellspacing="0" width="80%">
					
			<thead>
			<tr 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;
                        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)){
                                        $tr .= "<td style='text-align:right;'>".number_format($array[$selectFields[$p]],2)."</td>";
                                    }else{
                                        $tr .= "<td>".$array[$selectFields[$p]]."</td>";
                                    }
                                }  else {
                                    $tr .= "<td>".$array[$selectFields[$p]]."</td>";
                                }
                              
                            }
                            $tr .= "</tr>";
                            echo $tr;
                        }
                    ?>
                    	
                    
                        <?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>  