Informationen über offene Beiträge von Barzahlern auf Bankeinzugseite
authorPascal Hofmann <pascal@bigmac.local>
Mon, 31 Oct 2011 13:20:48 +0000 (14:20 +0100)
committerPascal Hofmann <pascal@bigmac.local>
Mon, 31 Oct 2011 13:20:48 +0000 (14:20 +0100)
include/dtaus.php

index 65f84ec..1efa0cf 100644 (file)
@@ -6,7 +6,20 @@ function action_dtaus() {
     if (empty($members)) return;
 
     $debits = array();
+    $cash_payments = array();
     foreach ($members as $member) {
+               if (empty($member['directdebit'])) {
+                       // Barzahler
+                       $open = bcsub(fees_sum_for_member($member['id'], time()), bcadd(finance_get_paid_fees_for_member($member['id']), finance_get_paid_fees_for_member($member['id'], true)));
+                       if ($open < 0) continue; // bccompare
+                       $cash_payments[] = array(
+                               'member_id'     => $member['id'],
+                               'member_number' => $member['number'],
+                               'nickname'      => $member['nickname'],
+                               'amount'        => $open
+                       );
+                       continue;
+               }
         $info = fee_next_directdebit_for_member($member['id'], time());
         if (empty($info)) continue;
         $debits[] = array(
@@ -26,13 +39,43 @@ function action_dtaus() {
     js_modal_windows();
     js_get_master_key();
 
-       $total = 0;
 ?>
     <noscript>
         <p class="error">
             <strong>Achtung:</strong> Ohne JavaScript geht hier gar nichts. Bitte aktivieren!
         </p>
     </noscript>
+<?php if (!empty($cash_payments)) : ?>
+<h2>Barzahler</h2>
+<table>
+    <tr>
+        <th>Mitgliedsnummer</th>
+        <th>Nickname</th>
+        <th style="text-align: right;">Betrag</th>
+               <th></th>
+       </tr>
+<?php foreach ($cash_payments as $payment) : ?>
+    <tr>
+        <td><a href="<?=html_escape(link_to('fees', array('member_id'=> $payment['member_id'])))?>"><?=html_escape($payment['member_number'])?></a></td>
+        <td><?=html_escape($payment['nickname'])?></td>
+        <td style="text-align: right;"><?=html_escape(format_money($payment['amount']))?></td>
+               <td>
+                       <form action="<?=link_to('create_earning')?>" method="post" class="clearfix">
+                               <?=html_hidden_field('date', format_date(time()))?>
+                               <?=html_hidden_field('type', 'fee')?>
+                               <?=html_hidden_field('status', 'paid')?>
+                               <?=html_hidden_field('value', format_money($payment['amount']))?>
+                               <?=html_hidden_field('member_id', $payment['member_id'])?>
+                               <?=html_hidden_field('description', '')?>
+                               <?=html_hidden_field('account', 'cash')?>
+                               <input class="submit" type="submit" name="submit" value="Einnahme verbuchen"/>
+                       </form>
+               </td>
+    </tr>
+<?php endforeach ?>
+</table>
+<?php endif ?>
+
 <h2>Bankeinzug</h2>
 <table>
     <tr>
@@ -41,6 +84,7 @@ function action_dtaus() {
         <th>Verwendungszweck</th>
         <th style="text-align: right;">Betrag</th>
     </tr>
+<?php $total = 0; ?>
 <?php foreach ($debits as $debit) : ?>
     <tr>
         <td><a href="<?=html_escape(link_to('fees', array('member_id'=> $debit['member_id'])))?>"><?=html_escape($debit['member_number'])?></a></td>