endrasgusti

puyeng

Oct 17th, 2017
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $total_berjalan_debet=0;
  2. $total_berjalan_credit=0;
  3.  
  4. mysql_select_db($database_prathama, $prathama);
  5. $query_glku = "SELECT IFNULL(posting,'TOTAL')as posting ,descs, sum(debet) as debet, sum(credit) as credit, aperiod, fyear FROM gl where fyear=2015 GROUP BY aperiod, posting WITH ROLLUP";
  6. $glku = mysql_query($query_glku, $prathama) or die(mysql_error());
  7. $row_glku = mysql_fetch_assoc($glku);
  8. $totalRows_glku = mysql_num_rows($glku);
  9. ?>
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  14. <title>Untitled Document</title>
  15. </head>
  16.  
  17. <body>
  18. <table width="800" border="1">
  19.   <tr>
  20.     <td>posting</td>
  21.     <td>descs</td>
  22.     <td>aperiod</td>
  23.     <td>year</td>
  24.     <td>debet</td>
  25.     <td>credit</td>
  26.   </tr>
  27.   <?php
  28.   while($row_glku = mysql_fetch_assoc($glku)){
  29.      
  30.       if($row_glku['posting']=='TOTAL') {
  31.       $total_berjalan_debet=$total_berjalan_debet+$row_glku['debet'];
  32.       $total_berjalan_credit=$total_berjalan_credit+$row_glku['credit'];
  33.      
  34.       }
  35.      
  36. echo "<tr>
  37.      <td>".$row_glku['posting']."</td>
  38.      <td>".($row_glku['posting']=='TOTAL'?'':$row_glku['descs'])."</td>
  39.       <td>".$row_glku['aperiod']."</td>
  40.       <td>".$row_glku['fyear']."</td>
  41.      <td>".$row_glku['debet']."
  42.       ".$total_berjalan_debet."</td>
  43.      <td>".$row_glku['credit']."
  44.       ".$total_berjalan_credit."</td>
  45.    </tr>";
  46.   }
  47.      ?>
  48.  
  49. </table>
RAW Paste Data