1bdfa1640cafc90493519a189cc9ed406e56b091
[infodrom.org/service.infodrom.org] / src / InfoCon / account / edit.wml
1 #include <infocon.style>
2 #include "account.inc"
3
4 <future>
5 <page func=InfoCon title="Kontoführung">
6 <calendar_init 5>
7
8 <?
9   $table = "account";
10   $value = "value_eur";
11   $add = '';
12   $hidden = '';
13   if ((strlen ($_GET['cur']) > 0) && ($_GET['cur'] == "dm")) {
14     $table = "account_dm";
15     $value = "value_dm";
16     $hidden = '<input type=hidden name=currency value="dm">';
17     $add = "&currency=dm";
18   }
19
20   if (!isset($_GET['blzkto']) && isset($_GET['id'])) {
21     if ($table == 'account')
22       $accounting = new Accounting($_GET['id']);
23     else
24       $accounting = new AccountingDM($_GET['id']);
25     $row = $accounting->fetch();
26
27     if ($row) {
28       $date = explode (" ", $row->datum);
29       $date = explode ("-", $date[0]);
30       $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
31       $blzkto = $row->blz_kto;
32       $add .= '&blzkto='. $blzkto;
33     }
34   } else {
35     $accounting = new Accounting(false);
36     $blzkto = $_GET['blzkto'];
37   }
38   $account = new AccountName($blzkto);
39 ?>
40
41 <style type="text/css">
42 label {
43   display: block;
44   font-weight: bold;
45   font-size: 12px;
46   width: 160px;
47   text-align: left;
48   padding-left: 5px;
49   padding-top: 0px;
50   padding-bottom: 0px;
51   background-color: #1aa2fe;
52   color: white;
53 }
54 input {
55   width: 400px;
56   margin-bottom: 10px;
57   border: solid #1aa2fe;
58   border-width: 1px;
59 }
60 select {
61   display: block;
62   width: 400px;
63   margin-bottom: 10px;
64   border: solid #1aa2fe;
65   border-width: 1px;
66 }
67 textarea {
68   width: 400px;
69   border: 1px solid #1aa2fe;
70   border-width: 1px;
71   margin-top: -1px;
72 }
73 </style>
74
75 <h3 class=bar><?=$account->fetch()->name;?></h3>
76
77 <form method=post action="update.php">
78 <input class=none type="hidden" name="id" value="<? echo $_GET[id]; ?>">
79 <?
80   echo ("<input class=\"none\" type=\"hidden\" name=\"blzkto\" value=\"$blzkto\">");
81   echo $hidden;
82 ?>
83
84 <label for=statement>Auszug</label>
85 <input id=statement name=statement size=15 maxlength=15 value="<?=$row->statement?>" tabindex=1>
86
87 <br class="none">
88 <label for=datum>Datum</label>
89 <input id=datum name=datum size=15 maxlength=10 value="<?=$date?>" tabindex=2>
90 <calendar "datum">
91
92 <br class="none">
93 <label for=category>Kategorie</label>
94 <select id=category name=category tabindex=3>
95 <option>
96 <?
97   foreach ($accounting->distinctCategories($blzkto) as $cat)
98     printf ("<option value=\"%s\"%s>%s", $cat->category, $cat->category == $row->category?" selected":"", $cat->category);
99
100 ?></select> <input id=category name=newcategory size=20 maxlength=50 value="" tabindex=4>
101
102 <br class="none">
103 <label for=from_to>Abs./Empf.</label>
104 <select id=from_to name=from_to tabindex=5>
105 <option>
106 <?
107   foreach ($accounting->distinctFromTo($blzkto, isset($_GET['id']) ? false : "datum >= now() - interval '2 years'") as $name)
108     printf ("<option value=\"%s\"%s>%s", $name->from_to, $name->from_to == $row->from_to?" selected":"", $name->from_to);
109
110 ?></select> <input id=from_to name=newfrom_to size=30 maxlength=120 value="" tabindex=6>
111
112 <br class="none">
113 <label for=value>Betrag</label>
114 <input id=value name=value size=40 maxlength=20 value="<? echo $row->$value; ?>" tabindex=7>
115
116 <br class="none">
117 <label for=descr>Verwendungszweck</label>
118 <textarea id=descr name=descr rows=5 cols=67 tabindex=8><? echo $row->descr; ?></textarea>
119
120 <p><center>
121 <? if (isset ($_GET[id])) { ?>
122 <input class=button type=submit value="Update" tabindex=9>
123 &nbsp;&nbsp;&nbsp;
124 <input class=button type=submit value="Delete" name=delete tabindex=9>
125 <? } else { ?>
126 <input class=button type=submit value="Insert" tabindex=9>
127 <? } ?>
128 </center><p>
129 </form>
130
131 <h3 class=bar>Hinweise zur Bearbeitung</h3>
132
133 <ul>
134
135 <li> Das Datum wird in der Form dd.mm.yyyy erwartet
136
137 <li> Wenn die Kategorie bzw. Absender/Empfänger noch nicht existieren,
138      werden diese manuell im Textfeld eingegeben
139
140 <li> Betrag als 999.44 angeben.
141
142 <li> Die erste Zeile des Verwendungszwecks wird in der Übersicht angezeigt
143
144 </ul>
145
146 </page>
147
148 # Local variables:
149 # mode: text
150 # mode: auto-fill
151 # end: