Nazirul_Fitri Posted September 8, 2016 Share Posted September 8, 2016 Hi there, can anyone help me on this one. I need to produce table like picture Result.png, but as you can see the first row i need to display it verticallly but the second column i need to display it as horizontal. Plus, the 'Jumlah' at the end column is the total of each row and i need to put another total below all the row to calculate the total by column. I have try for a weeks and got stuck. Please help. below is my code: <html> <head> <meta charset="utf-8"> <title><?php echo $report_title ?></title> <link href="wilma2/css/buttons.dataTables.min.css" rel="stylesheet" type="text/css"> <link href="wilma2/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"> <link href="css/custom2.css" rel="stylesheet" type="text/css"> <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> </head> <body> <?php $total_pkutip2 = 0; $total_amt2 = 0; $jum_kutip = 0; $jum_amt = 0; while (($row = oci_fetch_assoc($stid)) != false) { $kmn_produk = $row['PRODUK']; $kmn_state = $row['STATE']; $kmn_branch = $row['BRANCHNAME']; $kmn_kutip .= '<td align="right">'.number_format ($row['PKUTIP'],2).'<br>'.number_format ($row['AMOUNT'],2).'</td>'; $kmn_mth .= '<td>'.$row['MTH'].'</td>'; $jum_kutip += $row['PKUTIP']; $jum_amt += $row['AMOUNT']; //$jum_kutip[$kmn_mth] = $jum_kutip[$kmn_mth] + $kmn_kutip; //ni equivalent line atas ni. $total_pkutip2 = $total_pkutip2 + $kmn_kutip; $total_amt2 = $total_amt2 + $kmn_amt; } echo ' <h3>LAPORAN KUTIPAN MENGIKUT NEGERI DAN KAWASAN BAGI TAHUN '.$getyear.' </h3> <h4>PRODUK : '.$kmn_produk.'</h4> <table width="100%" border="1" cellspacing="0" cellpadding="0" id="table1" class="display"> <thead> <tr> <th style="text-align:center" bgcolor="#CCCCCC" scope="col" align="center">NEGERI | KAWASAN<br></th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">JAN '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">FEB '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">MAC '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">APR '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">MEI '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">JUN '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">JUL '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">AUG '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">SEP '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">OKT '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">NOV '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">DEC '.$getyear.'<br>PATUT KUTIP<br>KUTIPAN</th> <th style="text-align:center" bgcolor="#CCCCCC" scope="col">JUMLAH</th> </tr> </thead> <tbody> <tr> <td><b>'.$kmn_state.'</b><br>   '.$kmn_branch.'</td> '.$kmn_kutip.' <td align="right">'.number_format ($jum_kutip,2).'<br>'.number_format ($jum_amt,2).'</td> </tr> </tbody> </table> '; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.