FSN#31698 Rapportgenerator fixes

svn path=/Website/trunk/; revision=24704
This commit is contained in:
Jos Groot Lipman
2015-04-07 11:52:06 +00:00
parent 3c4dbf3f94
commit 805396cf06
9 changed files with 133 additions and 17 deletions

View File

@@ -419,8 +419,40 @@ api2 = {
Response.End; Response.End;
} }
break; break;
case "varchar": case "varchar": // Als fld.match(/^fclt_d_/) dan is het een old-style rapport filterveld
var safe_val = (filter == "exact" ? safe.quoted_sql(filterval) : safe.quoted_sql_wild("%"+filterval+"%")); switch (filter)
{
case "exact":
var safe_val = safe.quoted_sql(filterval);
break;
case "like":
var safe_val = safe.quoted_sql_wild("%"+filterval+"%");
case "range":
var safe_val;
if (filterval1) {
if (fld.match(/^fclt_d_/))
safe_val1 = api2.toDate(filterval1).beginToSQL();
else
safe_val1 = safe.quoted_sql(filterval1);
}
if (filterval2) {
if (fld.match(/^fclt_d_/))
safe_val2 = api2.toDate(filterval2).endToSQL();
else
safe_val2 = safe.quoted_sql(filterval2);
}
if (filterval1 && filterval2) {
operand = " BETWEEN ";
safe_val = safe_val1+" AND "+safe_val2;
} else if (filterval1) {
operand = " >= ";
safe_val = safe_val1;
} else if (filterval2) {
operand = " <= ";
safe_val = safe_val2;
}
break;
}
break; break;
case "date": // onderscheid date en datetime? case "date": // onderscheid date en datetime?
case "datetime": case "datetime":
@@ -473,6 +505,10 @@ api2 = {
safe_val = safe_val.toUpperCase(); safe_val = safe_val.toUpperCase();
} }
} }
if (filter == "range" && fld.match(/^fclt_d_/))
{
dbs = "TO_DATE(" + dbs + ",'dd-mm-yyyy')";
}
if (filter == "exact" && (field.typ == "date" || field.typ == "datetime")) if (filter == "exact" && (field.typ == "date" || field.typ == "datetime"))
{ {
dbs = "TRUNC("+dbs+")"; dbs = "TRUNC("+dbs+")";

View File

@@ -115,6 +115,7 @@ function model_reportcolumns(usrrap_key, params)
var special_cols = ucolname.match(/^(HIDE_F_|FCLT_X_|FCLT_3D_|FCLT_KEY|FCLT_F_|HTML_|FCLT_D_|FCLT_C_)/); var special_cols = ucolname.match(/^(HIDE_F_|FCLT_X_|FCLT_3D_|FCLT_KEY|FCLT_F_|HTML_|FCLT_D_|FCLT_C_)/);
if (special_cols) if (special_cols)
colpar.caption = colpar.caption.substring(special_cols[0].length); colpar.caption = colpar.caption.substring(special_cols[0].length);
colpar.caption = colpar.caption.replace(/\_/g, " "); // underscores er uit
if (ucolname.match(/^(HIDE_F_|FCLT_3D_|FCLT_KEY)/)) if (ucolname.match(/^(HIDE_F_|FCLT_3D_|FCLT_KEY)/))
colpar.visible = 'H'; // Hidden colpar.visible = 'H'; // Hidden
@@ -125,8 +126,10 @@ function model_reportcolumns(usrrap_key, params)
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_|FCLT_X_)/)) if (ucolname.match(/^(FCLT_F_|FCLT_X_)/))
colpar.filter = 'A'; colpar.filter = 'A';
if (ucolname.match(/^(FCLT_D_)/))
colpar.filter = 'R'; // Altijd range
var ora_type = oRs("data_type").Value; var ora_type = oRs("data_type").Value;
var ora_length = oRs("data_length").Value; var ora_length = oRs("data_length").Value;

View File

@@ -26,7 +26,65 @@
rapport.list.canGraph = (S("fac_usrrap_mode") & 4) == 4; rapport.list.canGraph = (S("fac_usrrap_mode") & 4) == 4;
//if (rapport.styling) if (rapport.styling && (rapport.styling.id & 2)) // view proc doen we 'old style'
Response.Redirect("fac_usrrap_search.asp?usrrap_key=" + usrrap_key);
if (rapport.styling && (rapport.styling.id & 1)) // XSL proc doen we niet via resultsettable
{
// Overrule scaffolding_list
scaffolding_list = function (model, scf_params)
{
var xxx_params = { filter : scf_params.filter || api2.qs2json() };
var wheres = api2.sqlfilter(xxx_params, rapport);
var sql_where = null;
if (wheres && wheres.length)
sql_where = "WHERE " + wheres.join(" AND " );
var outputmode = getQParamInt("outputmode", 0);
var nohtml = getQParamInt("nohtml", 0) == 1;
if (nohtml) // Die is simpel
{
Response.Clear();
FCLT2XMLResponse ({xmlnode: 'rapport', key: usrrap_key, mode: mode, where: sql_where });
Response.End;
}
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>
<% } %>
</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, where: sql_where});
%>
</body>
</html>
<%
}
}
else
{ {
if (getQParam("graph", "") == "G") if (getQParam("graph", "") == "G")
{ {

View File

@@ -22,7 +22,8 @@ JSON_Result = true;
var rapport = model_reports(usrrap_key); var rapport = model_reports(usrrap_key);
var filter = api2.qs2json(); var filter = api2.qs2json();
var columns = [getQParam("distinct")]; var distinct = getQParam("distinct"); // deze kolom zoeken we
var columns = [distinct.replace(/^(start_|end_)/,"")];
var xxx_params = { filter : api2.qs2json(), columns: columns, groupby: ["U"] }; // U=distinct var xxx_params = { filter : api2.qs2json(), columns: columns, groupby: ["U"] }; // U=distinct
xxx_params.filter.showall = 1; xxx_params.filter.showall = 1;

View File

@@ -1,4 +1,14 @@
<%@language = "javascript" %> <%@language = "javascript" %>
<% /*
$Revision$
$Id$
File fac_reportx_show.asp
Description: Laat een eindgebruiker een rapport kiezen om uit te voeren
Parameters:
Note:
*/
%>
<!-- #include file="../scf/scaffolding.inc" --> <!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../api2/model_reportsx.inc" --> <!-- #include file="../api2/model_reportsx.inc" -->

View File

@@ -15,7 +15,7 @@ if (mode == "save" || mode == "delete")
%> %>
<!-- #include file="../Shared/common.inc" --> <!-- #include file="../Shared/common.inc" -->
<!-- #include file="./scaffolding_common.inc" --> <!-- #include file="./scaffolding_common.inc" -->
<% if (mode != "save" && mode != "delete") { %> <% if (mode != "save" && mode != "delete" && mode != "wrap") { %>
<% if (mode != "list") { %> <% if (mode != "list") { %>
<!-- #include file="../Shared/iface.inc" --> <!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/calendar.inc" --> <!-- #include file="../Shared/calendar.inc" -->
@@ -47,6 +47,7 @@ function scaffolding(model, scf_params)
if (model.includes && imodel in model.includes) if (model.includes && imodel in model.includes)
{ {
model = model.includes[imodel].model; model = model.includes[imodel].model;
model.REST_POST = false; // ondersteunen we nog even niet
scf_params.transit = { name: "model", val: imodel }; scf_params.transit = { name: "model", val: imodel };
} }
@@ -242,6 +243,12 @@ function scf_RWFIELDTR(model, fld, val, key)
} }
else if (field.typ == "check" || field.typ == "check0") else if (field.typ == "check" || field.typ == "check0")
RWCHECKBOXTR(fld, "fldcheck", field.label, val); RWCHECKBOXTR(fld, "fldcheck", field.label, val);
else if (fld.match(/^(start_|end_)fclt_d_/))
FCLTcalendar (fld, { initEmpty: 1,
label: field.label,
volgnr: fld.match(/^start_/)?1:2,
required: true
});
else if (field.typ == "date") else if (field.typ == "date")
FCLTcalendar(fld, { label : field.label, FCLTcalendar(fld, { label : field.label,
datum : val, datum : val,

View File

@@ -40,7 +40,7 @@ function scaffolding_list(model, scf_params)
else else
var authparams = { PRSreadlevel: -1, ALGreadlevel: -1, PRSwritelevel: -1, ALGwritelevel: -1 }; var authparams = { PRSreadlevel: -1, ALGreadlevel: -1, PRSwritelevel: -1, ALGwritelevel: -1 };
var showall = getQParamInt("showall", 0) == 1; var showAll = getQParamInt("showall", 0) == 1;
var outputmode = getQParamInt("outputmode", 0) var outputmode = getQParamInt("outputmode", 0)
var default_url = model.list.default_url; var default_url = model.list.default_url;
@@ -107,14 +107,18 @@ function scaffolding_list(model, scf_params)
} }
var xxx_params = { filter : scf_params.filter || api2.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups }; var xxx_params = { filter : scf_params.filter || api2.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
if (!("limit" in xxx_params.filter))
{
xxx_params.filter.limit = showAll?S("qp_maxrows2"):S("qp_maxrows")
}
var xxx_array = model.REST_GET(xxx_params); var xxx_array = model.REST_GET(xxx_params);
var rst = new ResultsetTable({ dataset: xxx_array, var rst = new ResultsetTable({ dataset: xxx_array,
hasMore: model.total_count > xxx_array.length,
keyColumn: ("id" in model.fields?"id":null), keyColumn: ("id" in model.fields?"id":null),
ID: model.table, ID: model.table,
title: model.records_title, title: model.records_title,
showAll: showall, showAll: showAll,
outputmode: outputmode, outputmode: outputmode,
buttons: buttons buttons: buttons
}); });

View File

@@ -51,10 +51,6 @@ function scaffolding_wrap(model, scf_params)
<% } <% }
else else
{ /* Bestaand object bewerkt, switch naar show-mode */ %> { /* Bestaand object bewerkt, switch naar show-mode */ %>
if (params.close)
{
FcltMgr.closeDetail(window, { close: true})
}
if (!params.keepForm && !params.deleted) if (!params.keepForm && !params.deleted)
$("#scfFrame")[0].src = "<%=scf_params.this_fullpath%>?mode=show<%=transit%>&id=<%=key%>"; $("#scfFrame")[0].src = "<%=scf_params.this_fullpath%>?mode=show<%=transit%>&id=<%=key%>";

View File

@@ -817,7 +817,7 @@ function __rsProcessResultset(processParams) // processParams wordt blind aan al
html += "</tbody>"; html += "</tbody>";
if (!oRs.EOF && !isPrinting && !isExcel) if ((!oRs.EOF || this.hasMore) && !isPrinting && !isExcel)
{ {
var a_element = ""; var a_element = "";
if (Request.ServerVariables("REQUEST_METHOD") == "POST") if (Request.ServerVariables("REQUEST_METHOD") == "POST")
@@ -880,7 +880,8 @@ function __rsProcessResultset(processParams) // processParams wordt blind aan al
Response.Write(html); Response.Write(html);
endTable(); endTable();
if (!oRs.EOF) // 'Klik voor meer' onderaan de tabel
if (!oRs.EOF || this.hasMore)
{ {
var a_element = ""; var a_element = "";
if (Request.ServerVariables("REQUEST_METHOD") == "POST") if (Request.ServerVariables("REQUEST_METHOD") == "POST")
@@ -911,7 +912,7 @@ function __rsProcessResultset(processParams) // processParams wordt blind aan al
Response.Write(html); Response.Write(html);
} }
if (!isExcel && oRs.EOF) if (!isExcel && oRs.EOF && !this.hasMore)
{ {
// MGE: Alleen sortable als alle regels getoond zijn en niet bij excel // MGE: Alleen sortable als alle regels getoond zijn en niet bij excel
%> %>
@@ -929,7 +930,7 @@ function __rsProcessResultset(processParams) // processParams wordt blind aan al
if (summaryShow) if (summaryShow)
{ {
var summaryInfo = (!oRs.EOF? "<span class='summaryincomplete'>" + L("lcl_suminfo_incomplete") + "</span>&nbsp;" : "") + (summaryShow(rowNum) || ""); var summaryInfo = ((!oRs.EOF || this.hasMore)? "<span class='summaryincomplete'>" + L("lcl_suminfo_incomplete") + "</span>&nbsp;" : "") + (summaryShow(rowNum) || "");
} }
if (!this.noSetSummary) if (!this.noSetSummary)
{ {