update for wage
This commit is contained in:
@@ -4002,18 +4002,42 @@ class TotalWageInformationSerializer(serializers.ModelSerializer):
|
||||
except:
|
||||
user = SystemUserProfile.objects.get(key=self.context.get('request').GET['key'])
|
||||
kill_house = KillHouse.objects.filter(kill_house_operator__user=user, trash=False).first()
|
||||
# if date1:
|
||||
# finance_info = get_finance_info(kill_house, date1, date2)
|
||||
# slaughter_transactions = InternalTransaction.objects.filter(
|
||||
# Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), date__date__gte=date1,
|
||||
# date__date__lte=date2, status='completed',
|
||||
# trash=False)
|
||||
#
|
||||
# else:
|
||||
# finance_info = get_finance_info(kill_house)
|
||||
# slaughter_transactions = InternalTransaction.objects.filter(
|
||||
# Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), status='completed',
|
||||
# trash=False)
|
||||
if date1:
|
||||
finance_info = get_finance_info(kill_house, date1, date2)
|
||||
slaughter_transactions = InternalTransaction.objects.filter(
|
||||
Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), date__date__gte=date1,
|
||||
date__date__lte=date2, status='completed',
|
||||
trash=False)
|
||||
if kill_house.killer and kill_house.type == 'public':
|
||||
slaughter_transactions = InternalTransaction.objects.filter(
|
||||
kill_house=kill_house,parent_kill_house=kill_house, date__date__gte=date1,
|
||||
date__date__lte=date2, status='completed',
|
||||
trash=False)
|
||||
else:
|
||||
slaughter_transactions = InternalTransaction.objects.filter(
|
||||
Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), date__date__gte=date1,
|
||||
date__date__lte=date2, status='completed',
|
||||
trash=False)
|
||||
|
||||
else:
|
||||
finance_info = get_finance_info(kill_house)
|
||||
slaughter_transactions = InternalTransaction.objects.filter(
|
||||
Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), status='completed',
|
||||
trash=False)
|
||||
if kill_house.killer and kill_house.type == 'public':
|
||||
|
||||
slaughter_transactions = InternalTransaction.objects.filter(
|
||||
kill_house=kill_house,parent_kill_house=kill_house, status='completed',
|
||||
trash=False)
|
||||
else:
|
||||
slaughter_transactions = InternalTransaction.objects.filter(
|
||||
Q(kill_house=kill_house) | Q(parent_kill_house=kill_house), status='completed',
|
||||
trash=False)
|
||||
|
||||
total_paid_wage += slaughter_transactions.aggregate(total=Sum('amount'))[
|
||||
'total'] or 0
|
||||
|
||||
Reference in New Issue
Block a user