diff --git a/www/User.php b/www/User.php index aee11de..56f9411 100644 --- a/www/User.php +++ b/www/User.php @@ -27,6 +27,18 @@ class User function GetCategory($id) { + if ($id == "") + { + $cat["id"] = ""; + $cat["forecolor"] = "black"; + $cat["backcolor"] = "#3DEB3D"; + $s = "background-color:" . $cat["backcolor"] . ";"; + $s .= "color:" . $cat["forecolor"] . ";"; + $cat["style"] = $s; + + return $cat; + } + foreach($this->categories as $i => $category) if ($category["id"] == "$id") return $category; diff --git a/www/database.php b/www/database.php index 7b94323..77d5c7e 100644 --- a/www/database.php +++ b/www/database.php @@ -173,6 +173,20 @@ function LoadMonth($user, $month, $year) return $db->query($req); } +function MetaPositiveAmount($id) +{ + global $db; + + $req = "SELECT SUM(amount) as amount FROM operation WHERE amount > 0 AND parent='$id'"; + + $result = $db->query($req); + + if ($row = $result->fetchArray()) + return $row["amount"]; + else + return 0.0; +} + function GetAllOperations($user, &$last_year, &$last_month) { $res; diff --git a/www/index.php b/www/index.php index 73781a4..16f227f 100644 --- a/www/index.php +++ b/www/index.php @@ -86,6 +86,11 @@ else $_SESSION["cur_month"] = $_POST["month"]; } +if (isset($_POST["expand"])) + $_SESSION["expand"] = "1"; +else + $_SESSION["expand"] = "0"; + $operations = LoadMonth($_SESSION["user"], $_SESSION["cur_month"], $_SESSION["cur_year"]); $cur_date = mktime(0, 0, 0, date("m") , date("d"), date("Y")); $total_incomes = $total_outcomes = $cur_incomes = $cur_outcomes = 0; @@ -162,6 +167,7 @@ function changeMonths() } ?> + >Expand groups Disconnect @@ -175,7 +181,10 @@ function changeMonths() { $val = GetAccountAmount($account["id"], $_SESSION["cur_month"], $_SESSION["cur_year"]); echo "