Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

admin.finances.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <div class="block" id="overview">
  2. <h2>Overview</h2>
  3. <table class="innerblock">
  4. <tr>
  5. <th>ID</th>
  6. <th>Date</th>
  7. <th>Description</th>
  8. <th>User</th>
  9. <th>Receipts</th>
  10. <th>Payments</th>
  11. <th>Balance</th>
  12. </tr>
  13. <?PHP
  14. function fn($n, $hl = false) {
  15. $r = '&pound;'.abs(intval($n/100)).'.'.str_pad(abs($n%100),2,'0',STR_PAD_LEFT);
  16. if ($n < 0) { $r = '-'.$r; }
  17. if ($hl && $n < 0) {
  18. $r = '<span style="color: red;">'.$r.'</span>';
  19. }
  20. return $r;
  21. }
  22. $sql = 'SELECT finance_id, finance_time, finance_desc, user_name, ';
  23. $sql .= 'finance_receipts, finance_payments, finance_balance FROM ';
  24. $sql .= 'finances NATURAL JOIN users ORDER BY finance_time';
  25. $res = mysql_query($sql) or print(mysql_error());
  26. $i = 0;
  27. $n = 0;
  28. while ($row = mysql_fetch_assoc($res)) {
  29. $i = 1 - $i;
  30. $n++;
  31. ?>
  32. <tr class="<?PHP echo ($i == 1) ? 'even' : 'odd'; ?>">
  33. <td><?PHP echo $n; ?>.</td>
  34. <td><?PHP echo date('Y-m-d', $row['finance_time']); ?></td>
  35. <td><?PHP echo htmlentities($row['finance_desc']); ?></td>
  36. <td>
  37. <?PHP
  38. if ($row['user_name'] != 'admin') {
  39. echo $row['user_name'];
  40. } else {
  41. echo '---';
  42. }
  43. ?>
  44. </td>
  45. <td><?PHP echo fn($row['finance_receipts']); ?></td>
  46. <td><?PHP echo fn($row['finance_payments']); ?></td>
  47. <td><?PHP echo fn($row['finance_balance'],true); ?></td>
  48. </tr>
  49. <?PHP
  50. }
  51. ?>
  52. </table>
  53. </div>