first commit
This commit is contained in:
commit
3e4574dcdd
163 files changed
+3559
No files matched your search
@@ -0,0 +1,20 @@
|
||||
from django.db.models import Sum
|
||||
|
||||
from apps.emtiyazat.models import Emtiyazat as EmtiyazatModel, ArzeshEmtiyaz as ArzeshEmtiyazModel
|
||||
|
||||
|
||||
def get_arzesh_emtiyaz():
|
||||
arzesh_obj = ArzeshEmtiyazModel.objects.filter().last()
|
||||
return arzesh_obj.price
|
||||
|
||||
|
||||
def get_emtiyaz_mojri(cuser) -> int:
|
||||
sum_credit = EmtiyazatModel.objects.filter(cuser=cuser).aggregate(Sum('credit'))
|
||||
sum_debit = EmtiyazatModel.objects.filter(cuser=cuser).aggregate(Sum('debit'))
|
||||
|
||||
if sum_credit['credit__sum'] is None:
|
||||
sum_credit['credit__sum'] = 0
|
||||
if sum_debit['debit__sum'] is None:
|
||||
sum_debit['debit__sum'] = 0
|
||||
|
||||
return sum_credit['credit__sum'] - sum_debit['debit__sum']
|
||||
Reference in new issue
Block a user