Revenue report updated all the lines

This commit is contained in:
prakash 2022-04-27 17:31:14 +05:30
parent af77ddde0a
commit 9d050f312a
1 changed files with 7 additions and 7 deletions

View File

@ -237,25 +237,25 @@ class ProjectRevenueCustomReport(models.Model):
actual_cost = line['actual_cost']
if 'actual_cost' in line:
hourly_rate = line['pro_hourly_rate']
if 'unit_amount' in line and 'pro_hourly_rate' in line and 'id' in line:
if 'unit_amount' in line and 'pro_hourly_rate' in line: # and 'id' in line
if hourly_rate != 0:
line['actual_revenue'] = hourly_rate * line['unit_amount']
if 'unit_amount' in line and 'timesheet_cost' in line and 'id' in line:
if 'unit_amount' in line and 'timesheet_cost' in line:
line['actual_cost'] = line['timesheet_cost'] * line['unit_amount']
if 'overall_budgeted_revenue' in line and 'budgeted_hours' in line and 'id' in line:
if 'overall_budgeted_revenue' in line and 'budgeted_hours' in line:
if line['budgeted_hours'] > 0:
line['overall_hourly_rate'] = line['overall_budgeted_revenue'] / line['budgeted_hours']
if 'pro_hourly_rate' in line and 'budgeted_hours' in line and 'id' in line:
if 'pro_hourly_rate' in line and 'budgeted_hours' in line:
if line['budgeted_hours'] > 0:
line['pro_hourly_rate'] = line['budgeted_revenue'] / line['budgeted_hours']
if 'actual_revenue' in line and 'actual_cost' in line and 'expenses_amt' in line and 'id' in line:
if 'actual_revenue' in line and 'actual_cost' in line and 'expenses_amt' in line:
line['profit_amt'] = line['actual_revenue'] - line['actual_cost'] - line['expenses_amt']
if 'profit_amt' in line and 'actual_revenue' in line and 'id' in line:
if 'profit_amt' in line and 'actual_revenue' in line:
try:
line['profit_per'] = (line['profit_amt'] / line['actual_revenue']) * 100
except ZeroDivisionError:
pass
if 'unit_amount' in line and 'id' in line:
if 'unit_amount' in line:
try:
line['timesheet_cost'] = actual_cost / line['unit_amount']
except ZeroDivisionError: