diff --git a/ressources/icons/search.png b/ressources/icons/search.png index 04d0b5e..f98759e 100644 Binary files a/ressources/icons/search.png and b/ressources/icons/search.png differ diff --git a/www/User.php b/www/User.php index 41895e6..32c8c63 100755 --- a/www/User.php +++ b/www/User.php @@ -27,14 +27,13 @@ class User function GetCategory($id) { - if ($id == "") + if ($id == "" || $id == "0") { - $cat["id"] = ""; + $cat["id"] = "0"; $cat["forecolor"] = "black"; $cat["backcolor"] = "#3DEB3D"; - $s = "background-color:" . $cat["backcolor"] . ";"; - $s .= "color:" . $cat["forecolor"] . ";"; - $cat["style"] = $s; + $cat["font"] = ""; + ExtractStyle($cat); return $cat; } diff --git a/www/database.php b/www/database.php index bf2c361..8ab6e65 100755 --- a/www/database.php +++ b/www/database.php @@ -88,7 +88,7 @@ function LoadUser($name) $user->id = $row["id"]; - $result = $db->query("SELECT * FROM account WHERE user='$user->id' ORDER BY default_account DESC, virtual, blocked, name ASC"); + $result = $db->query("SELECT * FROM account WHERE user='$user->id' ORDER BY default_account DESC, hidden, blocked, virtual, name ASC"); $user->accounts = array(); @@ -96,7 +96,7 @@ function LoadUser($name) array_push($user->accounts, $row); // Shared accounts - $result = $db->query("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='$user->id') ORDER BY name, blocked, virtual ASC"); + $result = $db->query("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='$user->id') ORDER BY default_account DESC, hidden, blocked, virtual, name ASC"); while ($row = $result->fetchArray()) array_push($user->accounts, $row); @@ -125,6 +125,8 @@ function LoadUser($name) function LoadCategory(&$user, $id) { + global $db; + $result = $db->query("SELECT * FROM category WHERE id='$id'"); if ($row = $result->fetchArray()) diff --git a/www/index.php b/www/index.php index 2d4afe0..cd7e7b6 100755 --- a/www/index.php +++ b/www/index.php @@ -90,6 +90,18 @@ $operations = LoadMonth($_SESSION["user"], $_SESSION["cur_month"], $_SESSION["cu $cur_date = mktime(0, 0, 0, date("m") , date("d"), date("Y")); $total_incomes = $total_outcomes = $cur_incomes = $cur_outcomes = 0; $categories = array(); +$accounts = array(); + +// Init arrays +foreach($_SESSION["user"]->accounts as $i => $account) +{ + $accounts[$account["id"]]["total"] = 0; + $accounts[$account["id"]]["cur"] = 0; +} +foreach($_SESSION["user"]->categories as $i => $category) +{ + $categories[$category["id"]] = 0; +} // Statistics foreach($operations as $i => $operation) @@ -104,7 +116,12 @@ foreach($operations as $i => $operation) if ($date <= $cur_date) $accounts[$operation["account"]]["cur"] += $operation["amount"]; - if (!($operation["transfert"] == "" || ($operation["amount"] > 0 && $_SESSION["user"]->IsAccountBlocked($operation["account"])))) + // Forgive transfert on non blocked accounts + if ($operation["transfert"] != "" && !$_SESSION["user"]->IsAccountBlocked($operation["account"])) + continue; + + // Forgive credit on blocked account + if ($operation["transfert"] == "" && $_SESSION["user"]->IsAccountBlocked($operation["account"])) continue; @@ -206,7 +223,7 @@ function toggleOperations(parent, operations) accounts as $i => $account) { - if ($accounts["hidden"] == "1") continue; + if ($account["hidden"] == "1") continue; $val = GetAccountAmount($account["id"], $_SESSION["cur_month"], $_SESSION["cur_year"]); echo "
Cur credit | |||
Cur debit | |||
Total credit | |||
Total debit | |||
Cur credit | |||
Cur debit | |||
Total credit | |||
Total debit | |||
Remains | " . number_format($total_incomes - $total_outcomes, 2) . ""; + echo "" . number_format(($total_incomes - $total_outcomes)/100, 2) . " | "; else - echo "" . number_format($total_incomes - $total_outcomes, 2) . " | "; + echo "" . number_format(($total_incomes - $total_outcomes)/100, 2) . " | "; ?>
_ | |||
Non fix | " . number_format($value, 2) . " ($percent %) | ||
Non fix | " . number_format($value/100, 2) . " ($percent %) | ||
" . $category["name"]. " | " . number_format($categories[$category["id"]], 2) . " ($percent %) | ||
" . $category["name"]. " | " . number_format($categories[$category["id"]]/100, 2) . " ($percent %) |