Selaa lähdekoodia

[query report] Formatting & Minor UI Fixes

version-14
Rushabh Mehta 11 vuotta sitten
vanhempi
commit
af53b85e47
3 muutettua tiedostoa jossa 14 lisäystä ja 5 poistoa
  1. +1
    -1
      public/js/wn/form/formatters.js
  2. +2
    -1
      public/js/wn/views/query_report.js
  3. +11
    -3
      webnotes/widgets/query_report.py

+ 1
- 1
public/js/wn/form/formatters.js Näytä tiedosto

@@ -17,7 +17,7 @@ wn.form.formatters = {
format_number(value, null, decimals)) + "</div>";
},
Int: function(value) {
return value==null ? "": cint(value);
return value==null ? "": "<div style='text-align: right'>" + cint(value) + "</div>";
},
Percent: function(value) {
return "<div style='text-align: right'>" + flt(value, 2) + "%" + "</div>";


+ 2
- 1
public/js/wn/views/query_report.js Näytä tiedosto

@@ -136,8 +136,9 @@ wn.views.QueryReport = Class.extend({
refresh: function() {
// Run
var me =this;
this.waiting = wn.messages.waiting(this.wrapper.find(".waiting-area").toggle(true),
this.waiting = wn.messages.waiting(this.wrapper.find(".waiting-area").empty().toggle(true),
"Loading Report...");
this.wrapper.find(".results").toggle(false);
var filters = {};
$.each(this.filters || [], function(i, f) {
filters[f.df.fieldname] = f.get_parsed_value();


+ 11
- 3
webnotes/widgets/query_report.py Näytä tiedosto

@@ -95,13 +95,21 @@ def run(report_name, filters=None):
def add_total_row(result, columns):
total_row = [""]*len(columns)
has_percent = []
for row in result:
for i, col in enumerate(columns):
col = col.split(":")
if len(col) > 1 and col[1] in ["Currency", "Int", "Float"] and flt(row[i]):
total_row[i] = flt(total_row[i]) + flt(row[i])
if len(col) > 1:
if col[1] in ["Currency", "Int", "Float", "Percent"] and flt(row[i]):
total_row[i] = flt(total_row[i]) + flt(row[i])
if col[1] == "Percent" and i not in has_percent:
has_percent.append(i)
for i in has_percent:
total_row[i] = total_row[i] / len(result)
first_col = columns[0].split(":")
if len(first_col) > 1 and first_col[1] not in ["Currency", "Int", "Float"]:
if len(first_col) > 1 and first_col[1] not in ["Currency", "Int", "Float", "Percent"]:
total_row[0] = "Total"
result.append(total_row)


Ladataan…
Peruuta
Tallenna