Пример #1
0
 def render_as_text(self):
     membership = self.billingcycle.membership
     if not self.is_reminder():
         return render_to_string('membership/bill.txt', {
             'membership_type' : MEMBER_TYPES_DICT[membership.type],
             'membership_type_raw' : membership.type,
             'bill_id': self.id,
             'member_id': membership.id,
             'member_name': membership.name(),
             'billing_contact': membership.billing_contact,
             'billing_name': unicode(membership.get_billing_contact()),
             'street_address': membership.get_billing_contact().street_address,
             'postal_code': membership.get_billing_contact().postal_code,
             'post_office': membership.get_billing_contact().post_office,
             'billing_contact': membership.billing_contact,
             'billingcycle': self.billingcycle,
             'iban_account_number': settings.IBAN_ACCOUNT_NUMBER,
             'bic_code': settings.BIC_CODE,
             'due_date': self.due_date,
             'today': datetime.now(),
             'reference_number': group_right(self.billingcycle.reference_number),
             'sum': self.billingcycle.sum,
             'barcode': barcode_4(iban = settings.IBAN_ACCOUNT_NUMBER,
                                  refnum = self.billingcycle.reference_number,
                                  duedate = self.due_date,
                                  euros = self.billingcycle.sum)
             })
     else:
         amount_paid = self.billingcycle.amount_paid()
         sum = self.billingcycle.sum - amount_paid
         return render_to_string('membership/reminder.txt', {
             'membership_type' : MEMBER_TYPES_DICT[membership.type],
             'membership_type_raw' : membership.type,
             'bill_id': self.id,
             'member_id': membership.id,
             'member_name': membership.name(),
             'billing_contact': membership.billing_contact,
             'billing_name': unicode(membership.get_billing_contact()),
             'street_address': membership.get_billing_contact().street_address,
             'postal_code': membership.get_billing_contact().postal_code,
             'post_office': membership.get_billing_contact().post_office,
             'municipality': membership.municipality,
             'billing_email': membership.get_billing_contact().email,
             'email': membership.primary_contact().email,
             'billingcycle': self.billingcycle,
             'iban_account_number': settings.IBAN_ACCOUNT_NUMBER,
             'bic_code': settings.BIC_CODE,
             'today': datetime.now(),
             'latest_recorded_payment': Payment.latest_payment_date(),
             'reference_number': group_right(self.billingcycle.reference_number),
             'original_sum': self.billingcycle.sum,
             'amount_paid': amount_paid,
             'sum': sum,
             'barcode': barcode_4(iban = settings.IBAN_ACCOUNT_NUMBER,
                                  refnum = self.billingcycle.reference_number,
                                  duedate = None,
                                  euros = sum)
             })
Пример #2
0
 def render_as_text(self):
     membership = self.billingcycle.membership
     return render_to_string(
         "membership/bill.txt",
         {
             "membership_type": MEMBER_TYPES_DICT[membership.type],
             "membership_type_raw": membership.type,
             "bill_id": self.id,
             "member_id": membership.id,
             "billing_name": unicode(membership.get_billing_contact()),
             "street_address": membership.get_billing_contact().street_address,
             "postal_code": membership.get_billing_contact().postal_code,
             "post_office": membership.get_billing_contact().post_office,
             "billingcycle": self.billingcycle,
             "iban_account_number": settings.IBAN_ACCOUNT_NUMBER,
             "bic_code": settings.BIC_CODE,
             "due_date": self.due_date,
             "today": datetime.now(),
             "reference_number": group_right(self.billingcycle.reference_number),
             "sum": self.billingcycle.sum,
             "barcode": barcode_4(
                 iban=settings.IBAN_ACCOUNT_NUMBER,
                 refnum=self.billingcycle.reference_number,
                 duedate=self.due_date,
                 euros=self.billingcycle.sum,
             ),
         },
     )
Пример #3
0
 def render_as_text(self):
     membership = self.billingcycle.membership
     return render_to_string('membership/bill.txt', {
         'membership_type' : MEMBER_TYPES_DICT[membership.type],
         'membership_type_raw' : membership.type,
         'bill_id': self.id,
         'member_id': membership.id,
         'billing_name': unicode(membership.get_billing_contact()),
         'street_address': membership.get_billing_contact().street_address,
         'postal_code': membership.get_billing_contact().postal_code,
         'post_office': membership.get_billing_contact().post_office,
         'billingcycle': self.billingcycle,
         'iban_account_number': settings.IBAN_ACCOUNT_NUMBER,
         'bic_code': settings.BIC_CODE,
         'due_date': self.due_date,
         'today': datetime.now(),
         'reference_number': group_right(self.billingcycle.reference_number),
         'sum': self.billingcycle.sum,
         'barcode': barcode_4(iban = settings.IBAN_ACCOUNT_NUMBER,
                              refnum = self.billingcycle.reference_number,
                              duedate = self.due_date,
                              euros = self.billingcycle.sum)
         })
Пример #4
0
 def test_grouping(self):
     self.assertEqual(group_right('1'), '1')
     self.assertEqual(group_right('12'), '12')
     self.assertEqual(group_right('123'), '123')
     self.assertEqual(group_right('12345'), '12345')
     self.assertEqual(group_right('123456'), '1 23456')
     self.assertEqual(group_right('123456789'), '1234 56789')
     self.assertEqual(group_right('12345 333'), '123 45333')
     self.assertEqual(group_right('1111122222'), '11111 22222')
     self.assertEqual(group_right('1112222233333'), '111 22222 33333')
     self.assertEqual(group_right('15222333', group_size=3), '15 222 333')
     self.assertEqual(group_right(u'äkstestÖ'), u'äks testÖ')
Пример #5
0
 def test_grouping(self):
     self.assertEqual(group_right('1'), '1')
     self.assertEqual(group_right('12'), '12')
     self.assertEqual(group_right('123'), '123')
     self.assertEqual(group_right('12345'), '12345')
     self.assertEqual(group_right('123456'), '1 23456')
     self.assertEqual(group_right('123456789'), '1234 56789')
     self.assertEqual(group_right('12345 333'), '123 45333')
     self.assertEqual(group_right('1111122222'), '11111 22222')
     self.assertEqual(group_right('1112222233333'), '111 22222 33333')
     self.assertEqual(group_right('15222333', group_size=3), '15 222 333')
     self.assertEqual(group_right(u'äkstestÖ'), u'äks testÖ')