Formatting
[memberdb.git] / include / payments.php
index 5156f27..ee7b683 100644 (file)
@@ -1,13 +1,12 @@
 <?php
 
 // NOTE: combination of earnings and expenses
-
 $ACCOUNT_TYPES = array(
     'bank' => 'Konto',
     'cash' => 'Kasse'
 );
 
-/* DB functions {{{ */
+// DB functions
 function db_get_payments($offset, $count, $where)
 {
     $limit = '';
@@ -89,11 +88,9 @@ function db_get_open_payments($offset, $count)
     return db_get_payments($offset, $count, " WHERE status='open'");
 }
 
-/* }}} */
-
 function render_finished_payments($count = 100)
-{/*{{{*/
-    global $EXPENSE_TYPES, $EARNING_TYPES, $ACCOUNT_TYPES;
+{
+    global $EXPENSE_TYPES, $EARNING_TYPES;
     $page = 1;
     if (!empty($_REQUEST['page'])) {
         $page = max(1, (int)$_REQUEST['page']);
@@ -116,19 +113,19 @@ function render_finished_payments($count = 100)
             <th>Gesamt</th>
         </tr>
         <?php foreach ($payments as $payment) : ?>
-            <tr class="<?= $payment['ptype'] ?>">
-                <td style="text-align: right;"><a href="<?= html_escape(link_to('change_' . $payment['ptype'],
-                        array('id' => $payment['id']))) ?>"><?= html_escape($payment['id']) ?></a></td>
-                <td><?= html_escape(format_date(db_date2unixtime($payment['date']))) ?></td>
-                <td><?= html_escape($payment['ptype'] == 'earning' ? $EARNING_TYPES[$payment['type']] : $EXPENSE_TYPES[$payment['type']]) ?></td>
-                <td><?php if ($payment['member_id'] != 0) : ?><a href="<?= html_escape(link_to('view_member',
-                        array('id' => $payment['member_id']))) ?>"><?= html_escape($payment['nickname']) ?><?php endif ?></a>
+            <tr class="<?php echo $payment['ptype'] ?>">
+                <td style="text-align: right;"><a href="<?php echo html_escape(link_to('change_' . $payment['ptype'],
+                        array('id' => $payment['id']))) ?>"><?php echo html_escape($payment['id']) ?></a></td>
+                <td><?php echo html_escape(format_date(db_date2unixtime($payment['date']))) ?></td>
+                <td><?php echo html_escape($payment['ptype'] == 'earning' ? $EARNING_TYPES[$payment['type']] : $EXPENSE_TYPES[$payment['type']]) ?></td>
+                <td><?php if ($payment['member_id'] != 0) : ?><a href="<?php echo html_escape(link_to('view_member',
+                        array('id' => $payment['member_id']))) ?>"><?php echo html_escape($payment['nickname']) ?><?php endif ?></a>
                 </td>
-                <td style="text-align: right;"><?= html_escape(format_money(($payment['ptype'] == 'earning' ? 1 : -1) * $payment['value'])) ?></td>
-                <td><?= html_escape($payment['description']) ?></td>
-                <td style="text-align: right;<?php if ($payment['account'] == 'bank') : ?> text-decoration:underline;<?php endif ?>"><?= html_escape(format_money($payment['bank'])) ?></td>
-                <td style="text-align: right;<?php if ($payment['account'] == 'cash') : ?> text-decoration:underline;<?php endif ?>"><?= html_escape(format_money($payment['cash'])) ?></td>
-                <td style="text-align: right;"><?= html_escape(format_money($payment['total'])) ?></td>
+                <td style="text-align: right;"><?php echo html_escape(format_money(($payment['ptype'] == 'earning' ? 1 : -1) * $payment['value'])) ?></td>
+                <td><?php echo html_escape($payment['description']) ?></td>
+                <td style="text-align: right;<?php if ($payment['account'] == 'bank') : ?> text-decoration:underline;<?php endif ?>"><?php echo html_escape(format_money($payment['bank'])) ?></td>
+                <td style="text-align: right;<?php if ($payment['account'] == 'cash') : ?> text-decoration:underline;<?php endif ?>"><?php echo html_escape(format_money($payment['cash'])) ?></td>
+                <td style="text-align: right;"><?php echo html_escape(format_money($payment['total'])) ?></td>
             </tr>
         <?php endforeach ?>
     </table>
@@ -137,13 +134,11 @@ function render_finished_payments($count = 100)
     <p>Bisher gibt's noch keine abgeschlossenen Zahlungen.</p>
 <?php endif ?>
     <?php
-
-}/*}}}*/
+}
 
 function render_open_payments($offset = 0, $count = 25)
-{/*{{{*/
+{
     global $EXPENSE_TYPES, $EARNING_TYPES, $ACCOUNT_TYPES;
-    global $EXPENSE_TYPES, $EARNING_TYPES;
     $payments = db_get_open_payments($offset, $count);
     ?>
     <h3>Offene Zahlungen</h3>
@@ -159,17 +154,17 @@ function render_open_payments($offset = 0, $count = 25)
             <th>Beschreibung</th>
         </tr>
         <?php foreach ($payments as $payment) : ?>
-            <tr class="<?= $payment['ptype'] ?>">
-                <td style="text-align: right;"><a href="<?= html_escape(link_to('change_' . $payment['ptype'],
-                        array('id' => $payment['id']))) ?>"><?= html_escape($payment['id']) ?></a></td>
-                <td><?= html_escape(format_date(db_date2unixtime($payment['date']))) ?></td>
-                <td><?= html_escape($payment['ptype'] == 'earning' ? $EARNING_TYPES[$payment['type']] : $EXPENSE_TYPES[$payment['type']]) ?></td>
-                <td><?php if ($payment['member_id'] != 0) : ?><a href="<?= html_escape(link_to('view_member',
-                        array('id' => $payment['member_id']))) ?>"><?= html_escape($payment['nickname']) ?><?php endif ?></a>
+            <tr class="<?php echo $payment['ptype'] ?>">
+                <td style="text-align: right;"><a href="<?php echo html_escape(link_to('change_' . $payment['ptype'],
+                        array('id' => $payment['id']))) ?>"><?php echo html_escape($payment['id']) ?></a></td>
+                <td><?php echo html_escape(format_date(db_date2unixtime($payment['date']))) ?></td>
+                <td><?php echo html_escape($payment['ptype'] == 'earning' ? $EARNING_TYPES[$payment['type']] : $EXPENSE_TYPES[$payment['type']]) ?></td>
+                <td><?php if ($payment['member_id'] != 0) : ?><a href="<?php echo html_escape(link_to('view_member',
+                        array('id' => $payment['member_id']))) ?>"><?php echo html_escape($payment['nickname']) ?><?php endif ?></a>
                 </td>
-                <td><?= html_escape($ACCOUNT_TYPES[$payment['account']]) ?></td>
-                <td style="text-align: right;"><?= html_escape(format_money(($payment['ptype'] == 'earning' ? 1 : -1) * $payment['value'])) ?></td>
-                <td><?= html_escape($payment['description']) ?></td>
+                <td><?php echo html_escape($ACCOUNT_TYPES[$payment['account']]) ?></td>
+                <td style="text-align: right;"><?php echo html_escape(format_money(($payment['ptype'] == 'earning' ? 1 : -1) * $payment['value'])) ?></td>
+                <td><?php echo html_escape($payment['description']) ?></td>
             </tr>
         <?php endforeach ?>
     </table>
@@ -177,5 +172,4 @@ function render_open_payments($offset = 0, $count = 25)
     <p>Bisher gibt's noch keine abgeschlossenen Zahlungen.</p>
 <?php endif ?>
     <?php
-
-}/*}}}*/
+}