Support link between accounting/transaction and membership/member_payment.
authorgniibe <gniibe@fsij.org>
Thu, 27 May 2010 02:20:12 +0000 (11:20 +0900)
committergniibe <gniibe@fsij.org>
Thu, 27 May 2010 02:20:12 +0000 (11:20 +0900)
ChangeLog
membership/views.py
templates/accounting/tr_le.html
templates/accounting/transaction_list.html
templates/membership/edit_member_payment.html
templates/membership/member_payment.html

index 263d688..ab7a597 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2010-05-27  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * templates/membership/member_payment.html: Added link to transaction.
+       Handle Maeuke-kin.
+
+       * templates/membership/edit_member_payment.html: Show person.name
+       (Fix for corporate member).
+       Added "selected" attribute for fee_year.
+       Show all payments for the user.
+
+       * templates/accounting/transaction_list.html: Added link to member
+       payment.
+       Fixed for Maeuke-kin, added for Mishuu-kin.
+       Added margin-bottom style for form.
+
+       * templates/accounting/tr_le.html: Added margin-bottom style for
+       form.
+       No submit button (use onChange).
+
+       * membership/views.py (member_payment): Sorting order change.
+       (edit_member_payment): Rename local var from referrer to orig_url.
+       Filtering out fee_list is only for new entry.
+       Show all payments for the user.
+
 2010-05-26  NIIBE Yutaka  <gniibe@fsij.org>
 
        * templates/accounting/transaction_list.html: Added interface for
index 76f2cd4..3e06179 100644 (file)
@@ -124,7 +124,7 @@ def register_member_address(request, member):
 
 def member_payment(request, member, manage=False):
     try:
-        payments = member.memberpayment_set.order_by('-fee_year', '-date')
+        payments = member.memberpayment_set.order_by('-date', '-fee_year')
     except (MemberPayment.DoesNotExist):
         payments = None
     if manage:
@@ -189,8 +189,8 @@ def add_member_payment_with_le(request):
     return HttpResponseRedirect(reverse('fsij.membership.views.manage_edit_member_payment', args=(p.id,)))
 
 def edit_member_payment(request, member_payment):
-    try: referrer = request.META['HTTP_REFERER']
-    except: referrer = None
+    try: orig_url = request.META['HTTP_REFERER']
+    except: orig_url = request.path
     errors = None
     try:
         member_payment_data = request.session['member_payment_data']
@@ -205,6 +205,7 @@ def edit_member_payment(request, member_payment):
     else:
         date = datetime.date.today()
     member = member_payment.member
+    orig_fee_year = member_payment.fee_year
     if member:
         start_year = member.date_joined.year
         if member.date_joined.month < FY_START_MONTH:
@@ -217,17 +218,24 @@ def edit_member_payment(request, member_payment):
             fee_list.append(0)    # Advance payment
             fee_list.append(9999) # Admission fee
         fee_list_in_payments = map(lambda (p): p.fee_year, member.memberpayment_set.all())
-        fee_list = filter(lambda (f): not f in fee_list_in_payments, fee_list)
+        if orig_fee_year == 0:
+            fee_list = filter(lambda (f): not f in fee_list_in_payments, fee_list)
     else:
         fee_list = None
+    try:
+        payments = member.memberpayment_set.order_by('-date', '-fee_year')
+    except (MemberPayment.DoesNotExist):
+        payments = None
     return render_to_response('membership/edit_member_payment.html',
                               {'date': date,
                                'errors': errors,
+                               'orig_fee_year': orig_fee_year,
+                               'payments': payments,
                                'member': member,
                                'members': Member.objects.all(),
                                'fee_list': fee_list,
                                'member_type_list': MEMBER_TYPE,
-                               'original_path': referrer,
+                               'original_path': orig_url,
                                })
 
 def register_member_payment(request, member_payment):
index d342daf..9967509 100644 (file)
@@ -1,11 +1,11 @@
 {% if not t.get_credit.memberpayment_set.get %}
-<form action="../../membership/add_member_payment_with_le/" method="POST">
-  <select name="member_id">
+<form action="../../membership/add_member_payment_with_le/" method="POST" style="margin-bottom: 0px">
+  <select name="member_id" onChange="this.form.submit();">
   {% for person in members %}
     <option value="{{ person.member_id }}">{{ person.member_id }} {{ person.name }}</option>
   {% endfor %}
   </select>
-<input type="submit" value="編集" />
-<input type="hidden" value="{{ t.get_credit.id }}" name="le_id" />
+  <input type="hidden" value="{{ t.get_credit.id }}" name="le_id" />
+{# <input type="submit" value="編集" /> #}
 </form>
 {% endif %}
index e1b04a0..6152bef 100644 (file)
   <td>{% ifequal 0 forloop.counter0 %}{{ t.business.name }}{% endifequal %}</a></td>
   <td align=left>{{ t.get_debit.account.name }}</td>
   <td align=right>{{ t.get_debit.amount }}</td>
-  <td align=left>{{ t.get_credit.account.name }}</td>
+  <td align=left>
+  {% if t.get_credit.memberpayment_set.get %}
+  <a href="../../membership/edit_member_payment/{{ t.get_credit.memberpayment_set.get.id }}/">{{ t.get_credit.account.name }}</a>
+  {% else %}
+  {{ t.get_credit.account.name }}
+  {% endif %}
+  </td>
   <td align=right>{{ t.get_credit.amount }}</td>
   <td align=left>
    {% ifequal t.get_credit.account.name '会費収入' %}
      {% include "accounting/tr_le.html" %}
    {% else %}
-   {% ifequal t.get_debit.account.name '前受金' %}
+   {% ifequal t.get_credit.account.name '前受金' %}
+     {% include "accounting/tr_le.html" %}
+   {% else %}
+   {% ifequal t.get_credit.account.name '未収金' %}
      {% include "accounting/tr_le.html" %}
    {% else %}
      {% ifequal 0 forloop.counter0 %}{{ t.memo }}{% endifequal %}
    {% endifequal %}
    {% endifequal %}
+   {% endifequal %}
   </td>
   <td align=left>{% ifequal 0 forloop.counter0 %}{{ t.memo_detail }}{% endifequal %}</td>
   <td>{% if not year %}{% ifequal 0 forloop.revcounter0 %}
-    <form action="{{ t.id }}/delete/" method="POST">
+    <form action="{{ t.id }}/delete/" method="POST" style="margin-bottom: 0px">
     <input type="hidden" value="{{ original_path }}" name="original_path" />
-    <input type="submit" name="delete" value="{% trans 'Delete' %}"/>
+    <input type="submit" name="delete" value="{% trans 'Delete' %}" />
     </form>{% endifequal %}{% endif %}
   </td>
 </tr>
index e7112d2..dc94517 100644 (file)
 <li>会員番号
   <select name="member_id">
   {% for person in members %}
-    <option value="{{ person.member_id }}" {% ifequal person.member_id member.member_id %}selected{% endifequal %}>
-{{ person.member_id }}
-{{ person.user.last_name }} {{ person.user.first_name }}</option>
+    <option value="{{ person.member_id }}"
+     {% ifequal person.member_id member.member_id %}selected{% endifequal %}>
+    {{ person.member_id }} {{ person.name }}
+    </option>
   {% endfor %}
   </select>
 </li>
 <li>支払い年度
 <select name="fee_year">
 {% for fee_year in fee_list %}
-<option value="{{ fee_year }}">
+<option value="{{ fee_year }}"
+ {% ifequal fee_year orig_fee_year %}selected{% endifequal %}>
 {% ifequal fee_year 0 %}前受金{% else %}
 {% ifequal fee_year 9999 %}入会金{% else %}{{ fee_year }}年度{% endifequal %}
 {% endifequal %}
 <input type="submit" value="登録" />
 <input type="hidden" value="{{ original_path }}" name="original_path" />
 </form>
+
+<table>
+<tr><th>日付</th><th>内容</th></tr>
+{% for p in payments %}
+<tr bgcolor={% cycle lightcyan,white %}>
+<td>
+{% if p.le %}<a href="../../../accounting/transaction/{{ p.le.t.id }}/">{% endif %}
+{{ p.date }}
+{% if p.le %}</a>{% endif %}
+</td>
+<td>
+{% ifequal p.fee_year 0 %}前受金{% else %}
+{% ifequal p.fee_year 9999 %}入会金{% else %}{{ p.fee_year }}年度{% endifequal %}
+{% endifequal %}
+{% ifnotequal p.member_type member.member_type %}
+[ {{ p.get_member_type_display }} ]
+{% endifnotequal %}
+{% ifequal p.member_type 'A' %}
+( {{ p.contribution }} )
+{% endifequal %}
+</td></tr>
+{% endfor %}
+</table>
index 38efcfb..444705b 100644 (file)
@@ -22,7 +22,11 @@ parent.list.location.reload()
 {% for p in payments %}
 <tr bgcolor={% cycle lightcyan,white %}>
 <form action="delete/{{ p.id }}/" method="POST">
-<td>{{ p.date }}</td>
+<td>
+{% if p.le %}<a href="../../../accounting/transaction/{{ p.le.t.id }}/">{% endif %}
+{{ p.date }}
+{% if p.le %}</a>{% endif %}
+</td>
 <td>
   {% ifequal p.fee_year 0 %}
   前受金
@@ -31,9 +35,8 @@ parent.list.location.reload()
   入会金
   {% else %}
   {{ p.fee_year }}年度
-  {% endifequal%}
-  {% endifequal%}
-  {% ifequal p.fee_year 9999 %}
+  {% endifequal %}
+  {% endifequal %}
 </td>
 <td>
   {% ifnotequal p.member_type member.member_type %}
@@ -76,8 +79,14 @@ parent.list.location.reload()
 <table>
 <tr><th>日付</th><th>内容</th></tr>
 {% for p in payments %}
-<tr bgcolor={% cycle lightcyan,white %}><td>{{ p.date }}</td>
-<td>{% ifequal p.fee_year 9999 %}入会金{% else %}{{ p.fee_year }}年度{% endifequal %}
+<tr bgcolor={% cycle lightcyan,white %}>
+<td>
+{{ p.date }}
+</td>
+<td>
+{% ifequal p.fee_year 0 %}前受金{% else %}
+{% ifequal p.fee_year 9999 %}入会金{% else %}{{ p.fee_year }}年度{% endifequal %}
+{% endifequal %}
 {% ifnotequal p.member_type member.member_type %}
 [ {{ p.get_member_type_display }} ]
 {% endifnotequal %}