Mon Apr 14, 2014 11:45 am
With this report you can see all attachments inserted in MMEX.
Currently links to open directly attachment on filename works only if you use a custom directory as attachments archive.
SQL
LUA
TEMPLATE
Currently links to open directly attachment on filename works only if you use a custom directory as attachments archive.
SQL
- Code: Select all
SELECT A.reftype AS Type, A.refid AS Nr,
C.transdate||' | '||AC.AccountName||' | '|| CURR.pfx_symbol||round(C.Transamount, 2) ||CURR.sfx_symbol AS Reference,
A.description AS Description, A.filename AS File,
(SELECT infovalue FROM infotable_v1 WHERE infoname = 'ATTACHMENTSFOLDER:Win' COLLATE NOCASE) AS BasePath,
"\"||A.reftype||"\"||A.filename AS FilePath, '' AS BasepathLUA
FROM attachment_v1 A
INNER JOIN checkingaccount_v1 C ON C.transid = A.refid
INNER JOIN accountlist_v1 AC ON C.accountid = AC.accountid
INNER JOIN currencyformats_v1 CURR ON AC.currencyid = CURR.currencyid
ORDER BY A.reftype,A.refid,A.filename;
LUA
- Code: Select all
function get_base_path (BasePath,FilePath)
if BasePath == "DOCSDIR" then
BasePath = "#";
elseif BasePath == "MMEXDIR" then
BasePath = "#";
elseif BasePath == "DBDIR" then
BasePath = "#";
else
BasePath = "file:///" .. BasePath .. FilePath;
end
return BasePath;
end
function handle_record(record)
record:set("BasepathLUA", get_base_path(record:get("BasePath"),record:get("FilePath")));
end
TEMPLATE
- Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http - equiv = "Content-Type" content = "text/html" />
<title><TMPL_VAR REPORTNAME></title>
<script src = "Chart.js"></script>
<link href = "master.css" rel = "stylesheet" />
</head>
<body>
<div class = "container">
<h3><TMPL_VAR REPORTNAME></h3>
<TMPL_VAR TODAY><hr>
<div class = "row">
<div class = "col-xs-2"></div>
<div class = "col-xs-8">
<table class = "table">
<thead>
<tr>
<th>Type</th>
<th>Nr</th>
<th>Reference</th>
<th>Description</th>
<th>File</th>
</tr>
</thead>
<tbody>
<TMPL_LOOP NAME=CONTENTS>
<tr>
<td><TMPL_VAR "Type"></td>
<td class = "text-right"><TMPL_VAR "Nr"></td>
<td><TMPL_VAR "Reference"></td>
<td><TMPL_VAR "Description"></td>
<td><a href="<TMPL_VAR "BasePathLUA">"><TMPL_VAR "File"></a></td>
</tr>
</TMPL_LOOP>
</tbody>
</table>
</div>
<TMPL_LOOP ERRORS>
<hr>
<TMPL_VAR ERROR>
</TMPL_LOOP>
</div>
</div>
</body>
<script>
<!--Format numbers-->
function currency(n) { n = parseFloat(n); return isNaN(n) ? 0 : n.toFixed(2); }
var elements = document.getElementsByClassName("money, text-right");
for (var i = 0; i < elements.length; i++)
{ elements[i].innerHTML = "<TMPL_VAR PFX_SYMBOL>" + currency(elements[i].innerHTML) + "<TMPL_VAR SFX_SYMBOL>"; }
</script>
</html>