angezeigte Buchungen können gefiltert werden

This commit is contained in:
Nikolaus Krondraf
2014-12-09 07:43:27 +00:00
parent bef73811e4
commit 88c2880265
2 changed files with 34 additions and 6 deletions
+23 -4
View File
@@ -51,10 +51,12 @@ $p = new phrasen(getSprache());
// Beginn und Ende des aktuellen Semesters ermitteln
$studiensemester->getTimestamp($studiensemester->getakt());
isset($_GET['von']) ? $von = $_GET['von'] : $von = $studiensemester->begin->start;
isset($_GET['bis']) ? $bis = $_GET['bis'] : $bis = $studiensemester->ende->ende;
!empty($_GET['von']) ? $von = $_GET['von'] : $von = date('d.m.Y', $studiensemester->begin->start);
!empty($_GET['bis']) ? $bis = $_GET['bis'] : $bis = date('d.m.Y', $studiensemester->ende->ende);
$buchung->getBuchungPerson($benutzer->person_id);
$options['von'] = $datum->formatDatum($von);
$options['bis'] = $datum->formatDatum($bis);
$buchung->getBuchungPerson($benutzer->person_id, $options);
// Ausgabe
?>
@@ -72,8 +74,11 @@ $buchung->getBuchungPerson($benutzer->person_id);
{
$("#t1").tablesorter(
{
sortList: [[0,0]],
widgets: ["zebra"]
});
$("#von, #bis").datepicker($.datepicker.regional["de"]);
});
-->
</script>
@@ -81,6 +86,12 @@ $buchung->getBuchungPerson($benutzer->person_id);
<body id="inhalt">
<H1><?php echo $p->t('buchungen/titel'); ?></H1>
<form method="get" action="mitarbeiter_buchung.php">
von <input type="text" id="von" name="von" value="<?php echo $von; ?>" />
bis <input type="text" id="bis" name="bis" value="<?php echo $bis; ?>" />
<input type="submit" value="filtern" />
</form>
<table id="t1" class="tablesorter">
<thead>
<tr>
@@ -90,19 +101,27 @@ $buchung->getBuchungPerson($benutzer->person_id);
<th><?php echo $p->t('buchungen/buchgstyp'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach($buchung->result as $row)
{
echo '<tr>';
echo '<td>' . $datum->formatDatum($row->buchungsdatum, 'd.m.Y') . '</td>';
echo '<td>' . $row->buchungstext . '</td>';
echo '<td>' . $row->betrag . '</td>';
echo '<td>' . str_replace('.', ',', $row->betrag) . '</td>';
echo '<td>' . $row->buchungstyp_kurzbz . '</td>';
echo '</tr>';
$summe += $row->betrag;
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="2" align="right"><b>Summe</b></td>
<th class="header"><?php echo number_format($summe, 2, ',', '') ?></th>
</tr>
</tfoot>
</table>
</body>
</html>
+11 -2
View File
@@ -395,15 +395,24 @@ class buchung extends basis_db
* @param person_id ID der Person
* @return true wenn ok, false im Fehlerfall
*/
public function getBuchungPerson($person_id)
public function getBuchungPerson($person_id, $options = null)
{
// Filter für Query aufbereiten
$filter = "";
if(!empty($options['von']))
$filter .= " AND buchungsdatum >= " . $this->db_add_param($options['von']) . " ";
if(!empty($options['bis']))
$filter .= " AND buchungsdatum <= " . $this->db_add_param($options['bis']) . " ";
$qry = "SELECT
tbl_buchung.*
FROM
wawi.tbl_buchung
JOIN wawi.tbl_konto USING(konto_id)
WHERE
tbl_konto.person_id=".$this->db_add_param($person_id, FHC_INTEGER)."
tbl_konto.person_id=".$this->db_add_param($person_id, FHC_INTEGER).
$filter ."
ORDER BY buchungsdatum";
if($result = $this->db_query($qry))