RWSN#38671 Ratio (%) kolom in usrraps

svn path=/Website/trunk/; revision=31964
This commit is contained in:
Peter Feij
2016-12-14 09:32:50 +00:00
parent b42fe85ee5
commit 7d6ed65c9a
2 changed files with 19 additions and 2 deletions

View File

@@ -175,7 +175,7 @@ function model_reports(fac_usrrap_key)
model.styling = usrrap.styling;
model.graph_options = usrrap.graph_options;
model.graph_type = usrrap.graph_type;
model.list = { columns : [], groupby : [], canGroup: true, canCSV: true, autoCount: usrrap.count.id, autoPivot: usrrap.pivot.id, autoGraph: usrrap.graph.id };
model.list = { columns : [], groupby : [], canGroup: true, canCSV: true, autoCount: usrrap.count.id, autoPivot: usrrap.pivot.id, autoGraph: usrrap.graph.id, autoRatio: usrrap.ratio.id };
if (model.styling && (model.styling.id & 1))
model.list.fixedColumns = true;
model.search.title = L("lcl_usrrap_report") + " " + usrrap.name;
@@ -272,6 +272,11 @@ function model_reports(fac_usrrap_key)
model.list.columns.push("scf_count");
model.list.groupby.push("");
}
if ((model.list.autoRatio & 2) == 2)
{
model.list.columns.push("scf_ratio");
model.list.groupby.push("");
}
return model;
}
@@ -298,9 +303,18 @@ function report_GET(params)
{
if (params.columns.length == 1)
shared.simpel_page(L("lcl_empty_rstable"));
this.fields["scf_count"] = { dbs: "scf_count", sql: "COUNT(*)", typ: "number", label: L("lcl_count"), orglabel: L("lcl_count"), total: true };
hasAggregate = true;
}
if (params.columns && inArray("scf_ratio", params.columns))
{
if (params.columns.length == 1)
shared.simpel_page(L("lcl_empty_rstable"));
this.fields["scf_ratio"] = { dbs: "scf_ratio", sql: "ROUND(RATIO_TO_REPORT(COUNT(*)) OVER() *100,2)", typ: "float", label: L("lcl_ratio"), orglabel: L("lcl_ratio"), total: true };
hasAggregate = true;
}
if (params.columns && params.groupby && params.groupby.length > 0)
{
if (params.columns.length != params.groupby.length)
@@ -359,7 +373,7 @@ function report_GET(params)
for (var i=0; i < params.columns.length; i++)
{
var fld = params.columns[i];
if (fld == "scf_count")
if (fld == "scf_count" || fld == "scf_ratio" )
continue;
var field = this.fields[fld];
var field_expression = (field.sql ? field.sql : field.dbs);

View File

@@ -38,6 +38,8 @@ function model_reportsx(usrrap_key, rapparams)
"autorefresh" : { dbs: "fac_usrrap_autorefresh", typ: "check", label: L("lcl_usrrap_autorefresh")},
"count" : { dbs: "fac_usrrap_count", typ: "number", label: L("lcl_usrrap_showcount"),
required: true, defaultvalue: 1, LOV: L("lcl_usrrap_showcountLOV")}, // 0;Uit, verborgen;1;Uit, kiesbaar;2;Aan, verborgen;3;Aan, kiesbaar
"ratio" : { dbs: "fac_usrrap_ratio", typ: "number", label: L("lcl_usrrap_showratio"),
required: true, defaultvalue: 1, LOV: L("lcl_usrrap_showcountLOV")}, // 0;Uit, verborgen;1;Uit, kiesbaar;2;Aan, verborgen;3;Aan, kiesbaar
"pivot" : { dbs: "fac_usrrap_pivot", typ: "number", label: L("lcl_usrrap_showpivot"),
required: true, defaultvalue: 0, LOV: L("lcl_usrrap_showcountLOV")},
"graph" : { dbs: "fac_usrrap_graph", typ: "number", label: L("lcl_usrrap_showgraph"),
@@ -259,6 +261,7 @@ function model_reportsx(usrrap_key, rapparams)
if (S("fac_usrrap_mode") != 1)
{
this.fields["count"].readonly = true;
this.fields["ratio"].readonly = true; // denk ik dan
this.fields["pivot"].readonly = true;
this.fields["graph"].readonly = true;
}