Fixed bug of transaction list. Display current total advance payment by payment...
authorgniibe <gniibe@fsij.org>
Mon, 31 May 2010 08:52:34 +0000 (17:52 +0900)
committergniibe <gniibe@fsij.org>
Mon, 31 May 2010 08:52:34 +0000 (17:52 +0900)
ChangeLog
TODO
membership/views.py
templates/accounting/transaction_list.html
templates/membership/member_payment.html

index a514173..51138d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-05-31  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * templates/membership/member_payment.html: Display calculated
+       current total advance payment.
+
+       * membership/views.py (member_payment): Calculate current total
+       advance payment from payment records.
+
+       * templates/accounting/transaction_list.html: Enable payment
+       input for 'Maeuke-kin'.
+
 2010-05-27  NIIBE Yutaka  <gniibe@fsij.org>
 
        * templates/accounting/bs_pl_cf.html: C/F drawing with
diff --git a/TODO b/TODO
index 107be6a..2a315b3 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,26 +1,19 @@
-transaction -> member payment
-   show amount
+* New interface for update the web
+  * www.fsij.org
+  * members.fsij.org Django application
 
-Fix membership/XXXX/payment ->delete (browser no return)
+* Push this code into Hg service at members.fsij.org 
 
-advance payment -> calculate from record not using member.advance_payment
+* improvements
+  * transaction -> member payment
+    * show amount
+  * member_payment -> display payment records of advance payments better
 
-member_payment -> show payment using advance payment
+* bug fixes
+  * Fix membership/XXXX/payment ->delete (browser no return)
 
-input 2008 fy payment -- transaction relations
-
-* kurikosi
-  * not in B/S
-  * not in C/F
-
-* Fix bug for C/F kisho / genkin kisho / yokin
-
-* Fix bug for C/F
-  * should be debit side???
-    * kaikakekin
-    * tanki kariire kin
-  * should be credit side???
-    * mishuu kin
+* Data input
+  * input 2008 fy payment -- transaction relations
 \f
 * old data for accounting
 * old data for members (historical)
index d6c29c9..68dfce2 100644 (file)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8-*-
 from django.shortcuts import render_to_response, get_object_or_404
 from django.contrib.auth.decorators import login_required, user_passes_test
 from fsij.membership.models import *
@@ -127,6 +128,23 @@ def member_payment(request, member, manage=False):
         payments = member.memberpayment_set.order_by('-date', '-fee_year')
     except (MemberPayment.DoesNotExist):
         payments = None
+    advance_payment = 0
+    for p in payments:
+        if p.fee_year == 9999: # Advance Payment
+            if p.le:
+                advance_payment = advance_payment + p.le.amount
+            else:               # (old record with no transaction data)
+                # Guess amount of money by member_type
+                if member.member_type == 'M':
+                    advance_payment = advance_payment + 7000
+                elif member.member_type == 'S':
+                    advance_payment = advance_payment + 4000
+        elif p.le and p.le.t:
+            for i in p.le.t.num_line():
+                debit = p.le.t.get_debit()
+                if debit and debit.account.name == u'前受金':
+                    advance_payment = advance_payment - debit.amount
+                p.le.t.next()
     if manage:
         start_year = member.date_joined.year
         if member.date_joined.month < FY_START_MONTH:
@@ -151,6 +169,7 @@ def member_payment(request, member, manage=False):
     return render_to_response('membership/member_payment.html',
                               {'member': member,
                                'payments': payments,
+                               'cur_advance_payment': advance_payment,
                                'reload_parent': parent_is_list and manage,
                                'manage' : manage,
                                'fee_list' : fee_list,
index 9dbfd83..023b360 100644 (file)
    {% ifequal t.get_credit.account.name '前受金' %}
    {% if not t.get_debit.account %}
      {% include "accounting/tr_le.html" %}
+   {% else %}
+   {% ifnotequal t.get_debit.account.name '繰越' %}
+     {% include "accounting/tr_le.html" %}
+   {% endifnotequal %}
    {% endif %}
    {% else %}
    {% ifequal t.get_credit.account.name '未収金' %}
index e4b95e0..f365fd5 100644 (file)
@@ -11,8 +11,8 @@ parent.list.location.reload()
 <table>
 <tr><td>会員番号</td><td>{{ member.member_id }}</td></tr>
 <tr><td>会員種別</td><td>{{ member.get_member_type_display }}</td></tr>
-{% ifnotequal member.advance_payment 0 %}
-<tr><td>前受金</td><td>{{ member.advance_payment }}</td></tr>
+{% ifnotequal cur_advance_payment 0 %}
+<tr><td>前受金</td><td>{{ cur_advance_payment }}</td></tr>
 {% endifnotequal %}
 </table>