printf ("<option value=\"%s\">%s", $cat['category'], $cat['category']);
}
?></select><br>
+<b>Währung</b>: <input type=radio name=currency value=eur checked> Euro <input type=radio name=currency value=dm> DM<br>
<b>Zahlung</b>: <input type=checkbox name=input value=1 checked> Einnahmen <input type=checkbox name=output value=1 checked> Ausgaben<br>
<p><center><input type=submit value="Query"> <input type=reset value="Reset"></center><p>
</form>
<?
- $query = "SELECT nr,date,description,price FROM sales WHERE paid=0 ORDER BY date,nr";
+ $form = 0;
+ $query = "SELECT nr,date,description,price FROM sales_dm WHERE paid=0 ORDER BY date,nr";
$sth = pg_exec ($dbh, $query);
if (pg_NumRows ($sth) > 0) {
+ $form = 1;
+ echo ("<h3>Nicht bezahlte Rechnungen</h3>");
+ echo ("<form method=\"POST\" action=\"pay.php3\">");
+ }
+
+ for ($nr=0; $nr <pg_NumRows ($sth); $nr++) {
+ $row = pg_fetch_array ($sth, $nr);
+ $date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
+ printf (" <input type=\"checkbox\" name=\"pay_dm_%d\" value=\"1\">", $row['nr']);
+ printf ("%d. %s %s (%.2f DM)<br>", $row['nr'], $date, $row['description'], $row['price']);
+ }
+
+ $query = "SELECT nr,date,description,price FROM sales WHERE paid=0 ORDER BY date,nr";
+ $sth = pg_exec ($dbh, $query);
+
+ if (!form && pg_NumRows ($sth) > 0) {
+ $form = 1;
echo ("<h3>Nicht bezahlte Rechnungen</h3>");
echo ("<form method=\"POST\" action=\"pay.php3\">");
}
$row = pg_fetch_array ($sth, $nr);
$date = substr ($row['date'],6,2) . "." . substr ($row['date'],4,2) . "." . substr ($row['date'],0,4);
printf (" <input type=\"checkbox\" name=\"pay_%d\" value=\"1\">", $row['nr']);
- printf ("%d. %s %s (%.2f)<br>", $row['nr'], $date, $row['description'], $row['price']);
+ printf ("%d. %s %s (%.2f €)<br>", $row['nr'], $date, $row['description'], $row['price']);
}
- if (pg_NumRows ($sth) > 0) {
+ if ($form > 0) {
echo ("<p><input type=\"submit\" value=\"Bezahlen\"> <input type=\"reset\" value=\"Reset\"><p>");
echo ("</form>");
}