Repository navigation
Expand file tree
/
Copy pathbookkeepingrequest.php
More file actions
167 lines (123 loc) · 4.96 KB
/
Copy pathbookkeepingrequest.php
File metadata and controls
167 lines (123 loc) · 4.96 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
/**************************************************************************\
* PHPAdvocat *
* http://phpadvocat.sourceforge.net *
* By Burkhard Obergoeker <phpadvocat@obergoeker.de> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
require("./include/phpadvocat.inc.php");
/* Get User Account from Session Vars */
$user = $_SESSION["dbuser"];
$passwd = $_SESSION["dbpasswd"];
$changecheck="";
/* initiate database */
$db = new www_db;
$db->connect($user, $passwd);
/*++++++++++++ handle changed data from GET or POST +++++++++*/
/****************** end insert new pfile with known partner **********/
/* add new record from last line form */
if($_POST["accountaddbutton"])
{
/************ begin insert new account **********/
$description=$_POST["description"];
$querystring = sprintf("insert into phpa_accounts (description) ".
"values ('%s')", $description);
// echo "<hr>". $querystring . "<hr>";
if (!$db->query($querystring)) {
$changecheck="Neues Konto";
}
/* delete record from clicked link in table*/
} elseif(1 == $_GET["accountdel"])
{
$number=$_GET["number"];
/* since all usabel databases are able to keep the referntial*/
/* integrity, there is no need to delete the details */
$querystring = sprintf("delete from phpa_accounts where number=%s",
$number);
// echo "<hr>". $querystring . "<hr>";
if (!$db->query($querystring)) {
$changecheck="Konto gelöscht";
}
}
/*++++++++++++ end of Data handling +++++++++++++++++++++++++*/
/* Begin HTML page */
echo "<HTML><HEAD>";
echo "<TITLE>PHPAdvocat - Liste Konten</TITLE>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-15\">\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"include/phpadvocat.css\">";
echo "</HEAD>";
echo "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n";
/* create frame; left side for menu */
echo "<TABLE width=100%><TR><TD width=200 valign=\"top\">\n";
/* here comes the navigation menue */
$phpa_menue->account=$user;
$phpa_menue->selected=4;
$phpa_menue->draw_menue();
echo "<hr><a href=categoryrequest.php>Übersicht Kategorien</a>";
echo "</TD><TD>\n";
/* display title */
echo "<CENTER><H1>Liste Konten</H1></CENTER>\n";
echo "<table width=100%><tr>\n";
echo "<td>" . date("d.m.Y", time()) . "</td>";
echo "<TD ALIGN=RIGHT>".$changecheck ."</TD>";
print "</tr></table>\n";
print "<hr><center>";
$querystring =
"select c.number, c.description, ".
"(select sum(a.incomingamount)-".
"sum(a.outgoingamount) ".
"from phpa_amounts as a ".
"where a.exp_account = c.number) as sum ".
"from phpa_accounts as c ";
/* Sort by table header */
switch ($_GET["fsort"]) {
case "number" :$querystring .= "order by c.number";
break;
case "description" :$querystring .= "order by c.description";
break;
default :$querystring .= "order by c.number";
}
// echo "<hr>" . $querystring . "<hr>";
$db->query($querystring);
printf("<table class=listtable>\n");
/* table header */
printf("<th><a href=$PHP_SELF?fsort=number>Nummer</a></th>");
printf("<th><a href=$PHP_SELF?fsort=description>Beschreibung</a></th>");
printf("<th><a href=$PHP_SELF?fsort=value>Wert</a></th>");
printf("<th></th>");
while($db->next_record()) {
if(0 <= $db->record["sum"] ) {
printf("<tr>");
} else {
/* make row red if account is negative */
printf("<tr bgcolor=red>");
}
/* printf("<td>%s</td>", $db->row); */
printf("<td><a href=\"bookedit.php?number=%s\">%05.0f</a></td>",
$db->record["number"], $db->record["number"]);
printf("<td>%s</td>", $db->record["description"]);
printf("<td align=right>%s</td>", tolocalnum($db->record["sum"],$LOCALE));
/* delete this record */
printf("<td><a href=\"$PHP_SELF?number=%s&accountdel=1\" " .
"onClick=\"return confirm('Komplettes Konto loeschen?')" .
"\"><img alt=Del src=\"images/trash-x.png\" border=0>".
"</a></td></tr>\n", $db->record["number"]);
printf("</tr>\n");
}
/* last row is an input for new categories */
printf("<tr><FORM METHOD=POST ACTION=\"$PHP_SELF\">");
printf("<td>Neu</td>");
printf("<td><input name=description type=text size=50></td>\n");
printf("<td><input name=accountaddbutton type=submit value=Neu></td>");
printf("</FORM></tr>");
/* end of input row */
printf("</table>\n");
printf("</table></form></center>");
$db->close();
/* end of page */
echo "<hr></TD></TR></TABLE></BODY></HTML>";
?>