FSN#31698 Rapportgenerator aan- en uit- te zetten via fac_usrrap_mode
Ook: beter omgaan met HIDE_F_ velden Ook: groep veld bewerkbaar Ook: mobiel bit in 'styling' gebruiken Ook: eerste grafiek aanzet svn path=/Website/trunk/; revision=24510
This commit is contained in:
@@ -49,7 +49,7 @@ model_reportcolumns =
|
|||||||
{
|
{
|
||||||
case "date":
|
case "date":
|
||||||
case "datetime":
|
case "datetime":
|
||||||
model_reportcolumns.fields.group.LOV = api2.filterLOV(L("lcl_rap_groupbyLOV"), "G,D,W,M,Y,H");
|
model_reportcolumns.fields.group.LOV = api2.filterLOV(L("lcl_rap_groupbyLOV"), "G,D,W,M,Q,Y,H");
|
||||||
model_reportcolumns.fields.datatype.LOV = api2.filterLOV(L("lcl_rap_datatypeLOV"), "date,datetime,time");
|
model_reportcolumns.fields.datatype.LOV = api2.filterLOV(L("lcl_rap_datatypeLOV"), "date,datetime,time");
|
||||||
break;
|
break;
|
||||||
case "time":
|
case "time":
|
||||||
@@ -122,7 +122,7 @@ model_reportcolumns =
|
|||||||
if (view_name_short.match(/_V_UDR/))
|
if (view_name_short.match(/_V_UDR/))
|
||||||
colpar.visible = 'H'; // Hidden, die hebben te veel kolommen
|
colpar.visible = 'H'; // Hidden, die hebben te veel kolommen
|
||||||
|
|
||||||
if (ucolname.match(/^(FCLT_F_|FCLT_D_)/))
|
if (ucolname.match(/^(FCLT_F_|FCLT_D_|FCLT_X_)/))
|
||||||
colpar.filter = 'A';
|
colpar.filter = 'A';
|
||||||
|
|
||||||
var ora_type = oRs("data_type").Value;
|
var ora_type = oRs("data_type").Value;
|
||||||
@@ -130,11 +130,7 @@ model_reportcolumns =
|
|||||||
var ora_precision = oRs("data_precision").Value;
|
var ora_precision = oRs("data_precision").Value;
|
||||||
var ora_scale = oRs("data_scale").Value;
|
var ora_scale = oRs("data_scale").Value;
|
||||||
|
|
||||||
if (ucolname.match("^FCLT_F_|FCLT_X_")) // Filter, altijd varchar
|
if (ucolname.match("^FCLT_C_")) // Currency
|
||||||
{
|
|
||||||
colpar.filter = 'A';
|
|
||||||
}
|
|
||||||
else if (ucolname.match("^FCLT_C_")) // Currency
|
|
||||||
{
|
{
|
||||||
colpar.datatype = 'currency';
|
colpar.datatype = 'currency';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,16 @@ function model_reports_template()
|
|||||||
if (this.list && this.list.default_url && fld == "id")
|
if (this.list && this.list.default_url && fld == "id")
|
||||||
groupbys.push(this.fields["id"].dbs);
|
groupbys.push(this.fields["id"].dbs);
|
||||||
else
|
else
|
||||||
this.fields[fld].hidden = true; // Onnodige velden niet ophalen
|
{
|
||||||
|
if (this.fields[fld].dbs.match(/^hide_f/)) // Meenemen om te sorteren
|
||||||
|
{
|
||||||
|
this.fields[fld].hidden = false;
|
||||||
|
params.columns.splice(0, 0, fld);
|
||||||
|
params.groupby.splice(0, 0, "G");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.fields[fld].hidden = true; // Onnodige velden niet ophalen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +118,12 @@ function model_reports_template()
|
|||||||
groupbys.push(field.sql);
|
groupbys.push(field.sql);
|
||||||
field.label = L("lcl_usrrap_label_MONTH").format(field.label);
|
field.label = L("lcl_usrrap_label_MONTH").format(field.label);
|
||||||
break;
|
break;
|
||||||
|
case "Q":
|
||||||
|
field.sql = "TO_CHAR(" + field.dbs + ", 'YYYY-Q')";
|
||||||
|
field.newtyp = "varchar";
|
||||||
|
groupbys.push(field.sql);
|
||||||
|
field.label = L("lcl_usrrap_label_QUARTER").format(field.label);
|
||||||
|
break;
|
||||||
case "Y":
|
case "Y":
|
||||||
field.sql = "TO_CHAR(" + field.dbs + ", 'YYYY')";
|
field.sql = "TO_CHAR(" + field.dbs + ", 'YYYY')";
|
||||||
field.newtyp = "varchar";
|
field.newtyp = "varchar";
|
||||||
@@ -118,6 +133,16 @@ function model_reports_template()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (var i=0; i < params.columns.length; i++)
|
||||||
|
{
|
||||||
|
var fld = params.columns[i];
|
||||||
|
if (this.fields[fld].dbs.match(/^hide_f/)) // Die willen we uiteindelijk niet zien
|
||||||
|
{
|
||||||
|
params.columns.splice(i, 1);
|
||||||
|
params.groupby.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var query = api2.sqlfields(params, this);
|
var query = api2.sqlfields(params, this);
|
||||||
|
|
||||||
params.filter.fclt_3d_user_key = user_key; // Die is gemakkelijk
|
params.filter.fclt_3d_user_key = user_key; // Die is gemakkelijk
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ function model_reportsx(usrrap_key, params)
|
|||||||
"description" : { dbs: "fac_usrrap_info", typ: "varchar", label: L("lcl_usrrap_info"), filter: "like", translate: true },
|
"description" : { dbs: "fac_usrrap_info", typ: "varchar", label: L("lcl_usrrap_info"), filter: "like", translate: true },
|
||||||
"viewname" : { dbs: "fac_usrrap_view_name", typ: "varchar", label: L("lcl_usrrap_viewname"), filter: "like"},
|
"viewname" : { dbs: "fac_usrrap_view_name", typ: "varchar", label: L("lcl_usrrap_viewname"), filter: "like"},
|
||||||
"authorisation": { dbs: "fac_functie_key", typ: "key", label: L("lcl_usrrap_functie"), foreign: "fac_functie"},
|
"authorisation": { dbs: "fac_functie_key", typ: "key", label: L("lcl_usrrap_functie"), foreign: "fac_functie"},
|
||||||
|
"group" : { dbs: "fac_usrrap_groep", typ: "varchar", label: L("lcl_usrrap_groep"), filter: "like" },
|
||||||
"styling" : { dbs: "fac_usrrap_functie", typ: "key", label: L("lcl_usrrap_styling"),
|
"styling" : { dbs: "fac_usrrap_functie", typ: "key", label: L("lcl_usrrap_styling"),
|
||||||
LOV: L("lcl_usrrap_stylingLOV") }, // 0;on-gestylede;1;gestylede;2;procedure;3;procedure gestyled;8;Via tabelizer
|
LOV: L("lcl_usrrap_stylingLOV") }, // 0;on-gestylede;1;gestylede;2;procedure;3;procedure gestyled;8;Via tabelizer;16;mobile
|
||||||
|
|
||||||
"urllink" : { dbs: "fac_usrrap_urllink", typ: "varchar", label: L("lcl_usrrap_urllink")},
|
"urllink" : { dbs: "fac_usrrap_urllink", typ: "varchar", label: L("lcl_usrrap_urllink")},
|
||||||
"autorefresh" : { dbs: "fac_usrrap_autorefresh", typ: "check", label: L("lcl_usrrap_autorefresh")}
|
"autorefresh" : { dbs: "fac_usrrap_autorefresh", typ: "check", label: L("lcl_usrrap_autorefresh")}
|
||||||
@@ -176,7 +177,10 @@ function model_reportsx(usrrap_key, params)
|
|||||||
if (user.oslogin() != "_FACILITOR") // Alleen _FACILITOR mag nieuwe rapporten toevoegen
|
if (user.oslogin() != "_FACILITOR") // Alleen _FACILITOR mag nieuwe rapporten toevoegen
|
||||||
{ // (PRSSYS mag wel clonen)
|
{ // (PRSSYS mag wel clonen)
|
||||||
this.REST_POST = false;
|
this.REST_POST = false;
|
||||||
|
this.fields["viewname"].readonly = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
settings.overrule_setting("fac_usrrap_mode", 0xff); // _FACILITOR mag alles
|
||||||
|
|
||||||
if (!user.checkAutorisation("WEB_PRSSYS", true))
|
if (!user.checkAutorisation("WEB_PRSSYS", true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,58 +21,186 @@
|
|||||||
Server.ScriptTimeout=600; // extra tijd
|
Server.ScriptTimeout=600; // extra tijd
|
||||||
|
|
||||||
var rapport = model_reports(usrrap_key);
|
var rapport = model_reports(usrrap_key);
|
||||||
if (rapport.styling)
|
if ((S("fac_usrrap_mode") & 2) == 0)
|
||||||
{
|
rapport.list.canGroup = false;
|
||||||
if ((rapport.styling.id & 2) == 2) // view proc doen we 'old style'
|
|
||||||
Response.Redirect("fac_usrrap_search.asp?usrrap_key=" + usrrap_key);
|
|
||||||
|
|
||||||
if ((rapport.styling.id & 1) == 1) // XSL proc doen we niet via resultsettable
|
rapport.list.canGraph = (S("fac_usrrap_mode") & 4) == 4;
|
||||||
|
|
||||||
|
//if (rapport.styling)
|
||||||
|
{
|
||||||
|
if (getQParam("graph", "") == "G")
|
||||||
{
|
{
|
||||||
|
FCLTHeader.Requires({plugins: ["jQuery"],
|
||||||
|
js: ["../Localscripts/jqPlot/dist/excanvas.js",
|
||||||
|
"../Localscripts/jqPlot/dist/jquery.jqplot.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.canvasTextRenderer.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.canvasAxisLabelRenderer.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.canvasAxisTickRenderer.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.categoryAxisRenderer.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.barRenderer.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.meterGaugeRenderer.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.pieRenderer.min.js",
|
||||||
|
"../Localscripts/jqPlot/dist/plugins/jqplot.highlighter.min.js"
|
||||||
|
],
|
||||||
|
css: ["../Localscripts/jqPlot/dist/jquery.jqplot.css"]
|
||||||
|
});
|
||||||
// Overrule scaffolding_list
|
// Overrule scaffolding_list
|
||||||
scaffolding_list = function (model, scf_params)
|
scaffolding_list = function (model, scf_params)
|
||||||
{
|
{
|
||||||
var outputmode = getQParamInt("outputmode", 0);
|
scf_params.list = scf_params.list || {};
|
||||||
var nohtml = getQParamInt("nohtml", 0) == 1;
|
scf_params.list.columns = scf_params.list.columns || [];
|
||||||
if (nohtml) // Die is simpel
|
|
||||||
{
|
|
||||||
Response.Clear();
|
|
||||||
FCLT2XMLResponse ({xmlnode: 'rapport', key: usrrap_key, mode: mode, xwhere: "sql_where"});
|
|
||||||
Response.End;
|
|
||||||
}
|
|
||||||
|
|
||||||
var mode = '';
|
var transit = "";
|
||||||
if (outputmode==2) mode = 'excel';
|
if ("transit" in scf_params)
|
||||||
if (outputmode==1) mode = 'print';
|
transit = "&" + scf_params.transit.name + "=" + safe.url(scf_params.transit.val);
|
||||||
%><html>
|
|
||||||
<head>
|
var cols = getQParamArray("columns", []);
|
||||||
<% FCLTHeader.Generate({ outputmode: outputmode }); %>
|
if (cols.length && cols[0])
|
||||||
<% if (outputmode == 0) {%>
|
scf_params.list.columns = cols;
|
||||||
<script type="text/javascript">
|
|
||||||
function rap_print()
|
var grps = getQParamArray("groups", []);
|
||||||
|
if (grps.length)
|
||||||
|
scf_params.list.groups = grps;
|
||||||
|
|
||||||
|
if (!scf_params.list.columns.length && "list" in model)
|
||||||
|
scf_params.list.columns = model.list.columns;
|
||||||
|
|
||||||
|
var xxx_params = { filter : scf_params.filter || api2.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
|
||||||
|
var xxx_array = model.REST_GET(xxx_params);
|
||||||
|
|
||||||
|
graphData = { teller: xxx_array.length
|
||||||
|
, arr_x: []
|
||||||
|
, arr_y: []
|
||||||
|
, arr_xy: []
|
||||||
|
};
|
||||||
|
|
||||||
|
graphAxes = { url: null
|
||||||
|
, xas: { naam: model.fields[scf_params.list.columns[0]].label}
|
||||||
|
, yas: []
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var c=1; c < scf_params.list.columns.length; c++)
|
||||||
|
{
|
||||||
|
graphData.arr_y.push([]);;
|
||||||
|
graphAxes.yas.push({ naam: model.fields[scf_params.list.columns[c]].label });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i=0; i < xxx_array.length; i++)
|
||||||
|
{
|
||||||
|
graphData.arr_x.push(xxx_array[i][scf_params.list.columns[0]]);
|
||||||
|
for (var c=1; c < scf_params.list.columns.length; c++)
|
||||||
|
{
|
||||||
|
graphData.arr_y[c-1].push(xxx_array[i][scf_params.list.columns[c]]);
|
||||||
|
graphData.arr_xy.push([xxx_array[i][scf_params.list.columns[c]], xxx_array[i][scf_params.list.columns[c]]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
graphInit = { title : model.records_title
|
||||||
|
, type : 1
|
||||||
|
, maxrows : 0
|
||||||
|
, limiet : [] //limiet_arr
|
||||||
|
, fac_options : "{}" // fac_option
|
||||||
|
, sql_orderby : "" //oRs("fac_usrgraph_orderby").Value || ""
|
||||||
|
//, sql : sql_select
|
||||||
|
};
|
||||||
|
|
||||||
|
var outputmode = getQParamInt("outputmode", 0);
|
||||||
|
var nohtml = getQParamInt("nohtml", 0) == 1;
|
||||||
|
var mode = '';
|
||||||
|
if (outputmode==2) mode = 'excel';
|
||||||
|
if (outputmode==1) mode = 'print';
|
||||||
|
%><html>
|
||||||
|
<head>
|
||||||
|
<% FCLTHeader.Generate({ outputmode: outputmode }); %>
|
||||||
|
<% if (outputmode == 0) {%>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function rap_print()
|
||||||
|
{
|
||||||
|
window.open("fac_report.asp?outputmode=1<%=safe.jsstring(transitQS())%>");
|
||||||
|
}
|
||||||
|
function rap_excel()
|
||||||
|
{
|
||||||
|
window.open("fac_report.asp?outputmode=2<%=safe.jsstring(transitQS())%>");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
|
<script>
|
||||||
|
var JSONdata = '<%=safe.jsstring(JSON.stringify(graphInit))%>';
|
||||||
|
var l_init = eval('(' + JSONdata + ')');
|
||||||
|
var fac_options = eval('(' + l_init.fac_options + ')');
|
||||||
|
|
||||||
|
var JSONdata = '<%=safe.jsstring(JSON.stringify(graphAxes))%>';
|
||||||
|
var l_axes = eval('(' + JSONdata + ')');
|
||||||
|
|
||||||
|
var JSONdata = '<%=safe.jsstring(JSON.stringify(graphData))%>';
|
||||||
|
var l_data = eval('(' + JSONdata + ')');
|
||||||
|
|
||||||
|
var l_arr_x = l_data.arr_x;
|
||||||
|
var l_arr_y = l_data.arr_y;
|
||||||
|
var l_xas_naam = l_axes.xas.naam;
|
||||||
|
var l_yas_naam = l_axes.yas[0].naam;
|
||||||
|
var l_yas_count = l_axes.yas.length;
|
||||||
|
//debugger;
|
||||||
|
var l_colors = (l_yas_count==1?<%=S("fac_graph_colors1")%>:<%=S("fac_graph_colors2")%>);
|
||||||
|
var l_labels = [];
|
||||||
|
for (y=0; y<l_axes.yas.length; y++)
|
||||||
|
{
|
||||||
|
l_labels.push(l_axes.yas[y].naam);
|
||||||
|
}
|
||||||
|
|
||||||
|
var props = { seriesDefaults: { xrenderer: $.jqplot.BarRenderer
|
||||||
|
, pointLabels: { show: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, stackSeries: false
|
||||||
|
, title: l_init.title
|
||||||
|
, seriesColors: l_colors
|
||||||
|
, legend: { show: (l_yas_count>1)
|
||||||
|
, placement: (l_yas_count>1?'outsideGrid': 'intsideGrind')
|
||||||
|
, location: 'ne'
|
||||||
|
, labels: l_labels
|
||||||
|
}
|
||||||
|
, axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer
|
||||||
|
, ticks: l_arr_x
|
||||||
|
, label: l_xas_naam
|
||||||
|
, tickRenderer: $.jqplot.CanvasAxisTickRenderer
|
||||||
|
, tickOptions: { enableFontSupport: true
|
||||||
|
, angle: 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, yaxis: { label: (l_yas_count==1?l_yas_naam:'')
|
||||||
|
, tickOptions: { formatString: '%.1f'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, highlighter: { show: true
|
||||||
|
, showMarker: false
|
||||||
|
, tooltipAxes: 'y'
|
||||||
|
, tooltipLocation: 'n'
|
||||||
|
, formatString: '<table style="background-color: #cccccc" class="xjqplot-highlighter"><tr><td>%s</td></tr></table>'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$(function () {
|
||||||
|
plot1 = $.jqplot( 'myGraph'
|
||||||
|
, l_arr_y
|
||||||
|
, $.extend(true, props, fac_options)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body id="listbody">
|
||||||
|
<%
|
||||||
|
if(outputmode==0)
|
||||||
{
|
{
|
||||||
window.open("fac_report.asp?outputmode=1<%=safe.jsstring(transitQS())%>");
|
var buttons = [ { icon: "print.png", title: L("lcl_print_table"), action: 'rap_print()' },
|
||||||
|
{ icon: "excel.png", title: L("lcl_export_to_excel"), action: 'rap_excel() ' }
|
||||||
|
];
|
||||||
|
IFRAMER_HEADER(model.records_title, buttons);
|
||||||
}
|
}
|
||||||
function rap_excel()
|
%>
|
||||||
{
|
<div id="myGraph" style="height:500px;"></div>
|
||||||
window.open("fac_report.asp?outputmode=2<%=safe.jsstring(transitQS())%>");
|
</body>
|
||||||
}
|
</html>
|
||||||
</script>
|
|
||||||
<% } %>
|
|
||||||
</head>
|
|
||||||
<body id="listbody">
|
|
||||||
<%
|
<%
|
||||||
if(outputmode==0)
|
|
||||||
{
|
|
||||||
var buttons = [ { icon: "print.png", title: L("lcl_print_table"), action: 'rap_print()' },
|
|
||||||
{ icon: "excel.png", title: L("lcl_export_to_excel"), action: 'rap_excel() ' }
|
|
||||||
];
|
|
||||||
IFRAMER_HEADER(model.records_title, buttons);
|
|
||||||
}
|
|
||||||
FCLT2XMLResponse ({xmlnode: 'rapport', key: usrrap_key, mode: mode, xwhere: "sql_where"});
|
|
||||||
%>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,12 @@
|
|||||||
<%
|
<%
|
||||||
var reportsx = new model_reportsx();
|
var reportsx = new model_reportsx();
|
||||||
|
|
||||||
|
var show_buttons = [{ title: L("lcl_usrrap_show"), action: "show_report", icon: "doc_text_image.png" }];
|
||||||
|
if (S("fac_usrrap_mode") & 1)
|
||||||
|
show_buttons.push({ title: L("lcl_usrrap_clone"), action: "clone_report", icon: "copy.png" });
|
||||||
|
else
|
||||||
|
reportsx.includes = []; // Geen kolom details laten zien
|
||||||
|
|
||||||
scaffolding(reportsx,
|
scaffolding(reportsx,
|
||||||
{
|
{
|
||||||
"search": {
|
"search": {
|
||||||
@@ -23,8 +29,7 @@
|
|||||||
},
|
},
|
||||||
"show": {
|
"show": {
|
||||||
requires: { js: ["./fac_reportx.js"] },
|
requires: { js: ["./fac_reportx.js"] },
|
||||||
buttons: [{ title: L("lcl_usrrap_show"), action: "show_report", icon: "doc_text_image.png" },
|
buttons: show_buttons
|
||||||
{ title: L("lcl_usrrap_clone"), action: "clone_report", icon: "copy.png" }]
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<!-- #include file='../api2/model_reportsx.inc' -->
|
<!-- #include file='../api2/model_reportsx.inc' -->
|
||||||
<%
|
<%
|
||||||
params = { list: {},
|
params = { list: {},
|
||||||
filter: {}
|
filter: { "styling" : 16 } // Alleen de mobiele
|
||||||
};
|
};
|
||||||
|
|
||||||
var usrrap_key = getQParamInt("usrrap_key", -1);
|
var usrrap_key = getQParamInt("usrrap_key", -1);
|
||||||
|
|||||||
@@ -136,8 +136,10 @@ function scaffolding_search(model, scf_params)
|
|||||||
|
|
||||||
BLOCK_END();
|
BLOCK_END();
|
||||||
var buttons = [];
|
var buttons = [];
|
||||||
// buttons.push({title: L("lcl_menu_fac_graphs"), action: "doSubmit('G')" });
|
|
||||||
buttons.push({title: L("lcl_search"), action: "doSubmit()" });
|
buttons.push({title: L("lcl_search"), action: "doSubmit()" });
|
||||||
|
|
||||||
|
if (model.list && model.list.canGraph)
|
||||||
|
buttons.push({title: L("lcl_menu_fac_graphs"), action: "doSubmit('G')" });
|
||||||
buttons.push({title: L("lcl_scf_columns"), action: "pick_columns(this)" });
|
buttons.push({title: L("lcl_scf_columns"), action: "pick_columns(this)" });
|
||||||
CreateButtons(buttons, { entersubmit: true });
|
CreateButtons(buttons, { entersubmit: true });
|
||||||
%>
|
%>
|
||||||
|
|||||||
Reference in New Issue
Block a user