Bläddra i källkod

Currency of total row in reports

version-14
Nabin Hait 9 år sedan
förälder
incheckning
c1bab9d5d0
1 ändrade filer med 17 tillägg och 12 borttagningar
  1. +17
    -12
      frappe/desk/query_report.py

+ 17
- 12
frappe/desk/query_report.py Visa fil

@@ -113,22 +113,27 @@ def get_report_module_dotted_path(module, report_name):
def add_total_row(result, columns):
total_row = [""]*len(columns)
has_percent = []
for row in result:
for i, col in enumerate(columns):
fieldtype = None
if isinstance(col, basestring):
col = col.split(":")
if len(col) > 1:
fieldtype = col[1]
if "/" in fieldtype:
fieldtype = fieldtype.split("/")[0]
else:
fieldtype = col.get("fieldtype")

for i, col in enumerate(columns):
fieldtype, options = None, None
if isinstance(col, basestring):
col = col.split(":")
if len(col) > 1:
fieldtype = col[1]
if "/" in fieldtype:
fieldtype, options = fieldtype.split("/")
else:
fieldtype = col.get("fieldtype")
options = col.get("options")
for row in result:
if fieldtype in ["Currency", "Int", "Float", "Percent"] and flt(row[i]):
total_row[i] = flt(total_row[i]) + flt(row[i])
if fieldtype == "Percent" and i not in has_percent:
has_percent.append(i)
if fieldtype=="Link" and options == "Currency":
total_row[i] = result[0][i]

for i in has_percent:
total_row[i] = total_row[i] / len(result)


Laddar…
Avbryt
Spara