mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fix(profit-and-loss-statement-report): margin calculation the report showing null% for empty cell
(cherry picked from commit df6fd782b7)
This commit is contained in:
committed by
Mergify
parent
a403e85918
commit
04fe76bf83
@@ -785,11 +785,19 @@ def compute_margin_view_data(data, columns, accumulated_values):
|
||||
|
||||
for column in columns:
|
||||
curr_period = column.get("key")
|
||||
base_value = base_row[curr_period]
|
||||
curr_value = row[curr_period]
|
||||
|
||||
if curr_value is None or base_value <= 0:
|
||||
data[row_idx][curr_period] = None
|
||||
base_value = base_row.get(curr_period)
|
||||
curr_value = row.get(curr_period)
|
||||
|
||||
if base_value is None or curr_value is None:
|
||||
data[row_idx][curr_period] = "N/A"
|
||||
continue
|
||||
|
||||
if base_value == 0:
|
||||
if curr_value == 0:
|
||||
data[row_idx][curr_period] = ""
|
||||
else:
|
||||
data[row_idx][curr_period] = "N/A"
|
||||
continue
|
||||
|
||||
margin_percent = round((curr_value / base_value) * 100, 2)
|
||||
|
||||
Reference in New Issue
Block a user