Update web view
This commit is contained in:
parent
e9e0e35c12
commit
54945703b6
17
www/User.php
17
www/User.php
|
@ -23,6 +23,7 @@ class User
|
|||
public $id;
|
||||
public $accounts;
|
||||
public $categories;
|
||||
public $tags;
|
||||
public $preferences;
|
||||
|
||||
function GetCategory($id)
|
||||
|
@ -44,6 +45,22 @@ class User
|
|||
return LoadCategory($this, $id);
|
||||
}
|
||||
|
||||
function GetTag($id)
|
||||
{
|
||||
if ($id == "" || $id == "0")
|
||||
{
|
||||
$tag["id"] = 0;
|
||||
$tag["name"] = "";
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
foreach($this->tags as $i => $tag)
|
||||
if ($tag["id"] == "$id") return $tag;
|
||||
|
||||
return LoadTag($this, $id);
|
||||
}
|
||||
|
||||
function IsAccountBlocked($id)
|
||||
{
|
||||
foreach($this->accounts as $i => $account)
|
||||
|
|
|
@ -140,6 +140,22 @@ function LoadCategory(&$user, $id)
|
|||
return "";
|
||||
}
|
||||
|
||||
function LoadTag(&$user, $id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$result = $db->query("SELECT * FROM tag WHERE id='$id'");
|
||||
|
||||
if ($row = $result->fetchArray())
|
||||
{
|
||||
array_push($user->tags, $row);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function GetAccountAmount($id, $month, $year)
|
||||
{
|
||||
global $db;
|
||||
|
|
|
@ -245,7 +245,7 @@ function toggleOperations(parent, operations)
|
|||
<br /><br />
|
||||
<div id="operations">
|
||||
<table>
|
||||
<tr class="header" bgcolor="#99CCFF"><td/><td>Description</td><td>Date</td><td>Debit</td><td>Credit</td><td>Category</td><td>Account</td></tr>
|
||||
<tr class="header" bgcolor="#99CCFF"><td/><td>Description</td><td>Date</td><td>Debit</td><td>Credit</td><td>Category</td><td>Account</td><td>Tag</td></tr>
|
||||
<?php
|
||||
$prev_week=-1;
|
||||
$operations = LoadMonth($_SESSION["user"], $_SESSION["cur_month"], $_SESSION["cur_year"]);
|
||||
|
@ -253,6 +253,7 @@ $operations = LoadMonth($_SESSION["user"], $_SESSION["cur_month"], $_SESSION["cu
|
|||
foreach($operations as $i => $operation)
|
||||
{
|
||||
$category = $_SESSION["user"]->GetCategory($operation["category"]);
|
||||
$tag = $_SESSION["user"]->GetTag($operation["tag"]);
|
||||
if ($operation["fix_cost"] == "0")
|
||||
{
|
||||
$cur_week = date("W", mktime(0, 0, 0, $operation["month"]+1, $operation["day"]+1, $operation["year"]));
|
||||
|
@ -294,6 +295,7 @@ foreach($operations as $i => $operation)
|
|||
else
|
||||
echo "<td />";
|
||||
echo "<td>" . $_SESSION["user"]->GetAccountName($operation["account"]) . "</td>";
|
||||
echo "<td>" . $tag["name"] . "</td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
?>
|
||||
|
@ -351,6 +353,6 @@ foreach($operations as $i => $operation)
|
|||
</div>
|
||||
</div>
|
||||
<br /><br />
|
||||
<center><a href="http://indefero.soutade.fr/p/kisscount">KissCount</a> © 2010-2012 Grégory Soutadé</center>
|
||||
<center><a href="http://indefero.soutade.fr/p/kisscount">KissCount</a> © 2010-2014 Grégory Soutadé</center>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user