from decimal import Decimal
from django.conf import settings
from django.db import models
class FinanceEntry(models.Model):
 class Scope(models.TextChoices): CAMPUS='CAMPUS','Campus'; NATIONAL='NATIONAL','National'
 class Direction(models.TextChoices): INCOME='INCOME','Income'; EXPENSE='EXPENSE','Expense'
 class Category(models.TextChoices): OFFERTORY='OFFERTORY','Offertory'; DONATION='DONATION','Donation'; DUES='DUES','Dues'; PROGRAM='PROGRAM','Program income'; TRANSPORT='TRANSPORT','Transport'; WELFARE='WELFARE','Welfare'; VENUE='VENUE','Venue'; OTHER='OTHER','Other'
 scope=models.CharField(max_length=15,choices=Scope.choices); campus=models.ForeignKey('core.Campus',null=True,blank=True,on_delete=models.CASCADE,related_name='finance_entries'); direction=models.CharField(max_length=10,choices=Direction.choices); category=models.CharField(max_length=20,choices=Category.choices); amount=models.DecimalField(max_digits=14,decimal_places=2,default=Decimal('0')); currency=models.CharField(max_length=3,default='GHS'); transaction_date=models.DateField(); reference=models.CharField(max_length=100,blank=True); description=models.CharField(max_length=255); submitted_by=models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.PROTECT); submitted_at=models.DateTimeField(auto_now_add=True); approved=models.BooleanField(default=False)
 class Meta: ordering=['-transaction_date','-submitted_at']
