1 | from django.db import models |
---|
2 | import settings |
---|
3 | from finance_core.models import BudgetArea, BudgetTerm |
---|
4 | |
---|
5 | import datetime |
---|
6 | |
---|
7 | APPROVAL_STATES = ( |
---|
8 | ( 0, 'None'), |
---|
9 | ( 1, 'Approved'), |
---|
10 | (-1, 'Rejected'), |
---|
11 | ) |
---|
12 | |
---|
13 | class ReimbursementRequest(models.Model): |
---|
14 | submitter = models.CharField(max_length=10) # MIT username of submitter |
---|
15 | check_to_first_name = models.CharField(max_length=50, verbose_name="check recipient's first name") |
---|
16 | check_to_last_name = models.CharField(max_length=50, verbose_name="check recipient's last name") |
---|
17 | check_to_email = models.EmailField(verbose_name="email address for check pickup") |
---|
18 | check_to_addr = models.TextField(blank=True, verbose_name="address for check mailing", help_text="For most requests, this should be blank for pickup in SAO (W20-549)") |
---|
19 | amount = models.DecimalField(max_digits=7, decimal_places=2, help_text='Do not include "$"') |
---|
20 | budget_area = models.ForeignKey(BudgetArea, related_name='as_budget_area') |
---|
21 | budget_term = models.ForeignKey(BudgetTerm) |
---|
22 | expense_area = models.ForeignKey(BudgetArea, related_name='as_expense_area') # ~GL |
---|
23 | request_time = models.DateTimeField(default=datetime.datetime.now) |
---|
24 | approval_time = models.DateTimeField(blank=True, null=True,) |
---|
25 | approval_status = models.IntegerField(default=0, choices=APPROVAL_STATES) |
---|
26 | printing_time = models.DateTimeField(blank=True, null=True,) |
---|
27 | name = models.CharField(max_length=50, verbose_name='short description', ) |
---|
28 | description = models.TextField(blank=True, verbose_name='long description', ) |
---|
29 | |
---|
30 | def __unicode__(self, ): |
---|
31 | return "%s: %s %s (%s) (by %s) for $%s" % ( |
---|
32 | self.name, |
---|
33 | self.check_to_first_name, |
---|
34 | self.check_to_last_name, |
---|
35 | self.check_to_email, |
---|
36 | self.submitter, |
---|
37 | self.amount, |
---|
38 | ) |
---|
39 | |
---|
40 | |
---|
41 | class Voucher(models.Model): |
---|
42 | group_name = models.CharField(max_length=10) |
---|
43 | account = models.IntegerField() |
---|
44 | signatory = models.CharField(max_length=50) |
---|
45 | first_name = models.CharField(max_length=20) |
---|
46 | last_name = models.CharField(max_length=20) |
---|
47 | email_address = models.EmailField(max_length=50) |
---|
48 | mailing_address = models.TextField() |
---|
49 | amount = models.DecimalField(max_digits=7, decimal_places=2,) |
---|
50 | description = models.TextField() |
---|
51 | gl = models.IntegerField() |
---|