first
This commit is contained in:
commit
d731fb6608
486 files changed
+251018
No files matched your search
@@ -0,0 +1,31 @@
|
||||
from django.db.models import Count, Sum
|
||||
from django.db.models import Q
|
||||
|
||||
from .models import *
|
||||
|
||||
def dashBoxData(request):
|
||||
|
||||
debit = Article.objects.filter().aggregate(Sum('debit'))['debit__sum']
|
||||
credit = Article.objects.filter().aggregate(Sum('credit'))['credit__sum']
|
||||
try:
|
||||
mandehesab = debit - credit
|
||||
except:
|
||||
mandehesab = 0
|
||||
countCustomers = Customer.objects.all().count()
|
||||
allUsers = User.objects.filter().exclude(username='admin').exclude(username='fesahat')
|
||||
ActionCount = Action.objects.filter(forUser=request.user.id, status='waite').count()
|
||||
rezayatCount = Action.objects.exclude(actionType='vosol').filter(Q(nazar='') | Q(nazar=None) & Q(status='finish')).count()
|
||||
try:
|
||||
entezarbazdid = CacheTable.objects.get(key='9mahbazdid').value
|
||||
except Exception as exp:
|
||||
entezarbazdid = 0
|
||||
|
||||
data = {
|
||||
'mandehesab': mandehesab,
|
||||
'countCustomers': countCustomers,
|
||||
'ActionCount': ActionCount,
|
||||
'allUsers': allUsers,
|
||||
'rezayatCount': rezayatCount,
|
||||
'entezarbazdid': entezarbazdid
|
||||
}
|
||||
return data
|
||||
Reference in new issue
Block a user