[go: up one dir, main page]

Menu

[728b31]: / saldos.php  Maximize  Restore  History

Download this file

52 lines (47 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* General functions
*
* @author Antonio Henrique Oliveira
* @copyright (c) 2017, Antonio Henrique Oliveira
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License (GPL) v3
*
*/include_once 'contas_config.php';
include_once 'functions/functions.php';
include_once 'functions/html.php';
include 'objects/Account.php';
$sql = "SELECT contas_" . Config::$caixa . ".conta_id, conta_nome, SUM(ROUND(IF(deb_cred='1',valor_euro,0),2)) AS dep, SUM(ROUND(IF(deb_cred='-1',-valor_euro,0),2)) AS lev, ROUND(SUM(ROUND(IF(NOT ISNULL(valor_euro),valor_euro,0),5)),2) AS saldo " .
"FROM contas_" . Config::$caixa . " LEFT JOIN movimentos_" . Config::$caixa . " " .
"ON movimentos_" . Config::$caixa . ".conta_id = contas_" . Config::$caixa . ".conta_id " .
"WHERE contas_" . Config::$caixa . ".activa=1 " .
"GROUP BY contas_" . Config::$caixa . ".conta_id " .
"ORDER BY conta_nome";
dtd_hdr("strict");
echo "<html>\n";
echo "<head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
echo "<link rel=\"StyleSheet\" href=\"contas.css\" type=\"text/css\">\n";
echo "<title>" . Config::$caixa_nome . " - Saldos</title>\n";
echo "</head>\n";
echo "<body>\n";
include("menu.inc");
print "<div id=\"main\">\n";
echo "<table class=\"saldos\">\n";
echo "<thead><tr><th>Conta<th>Depositos<th>Levantam.<th>Saldo<th>Lista\n";
echo "<tbody>\n";
$result = mysql_query($sql, $db_link);
while ($row = mysql_fetch_array($result)) {
echo "<tr>\n";
echo "<td style=\"text-align: left\"><a href=\"contas.php?conta_id={$row["conta_id"]}\">{$row["conta_nome"]}</a></td>";
echo "<td>{$row["dep"]}</td>\n";
echo "<td>{$row["lev"]}</td>\n";
echo "<td>{$row["saldo"]}</td>\n";
echo "<td><a href=\"movimentos.php?conta_id={$row["conta_id"]}\">Lista</a></td>\n";
echo "</tr>\n";
}
mysql_free_result($result);
mysql_close($db_link);
print "</table>\n";
print "</div>\n";
print "</body>\n";
print "</html>\n";