2015-01-23 13:09:30 +00:00
|
|
|
|
2015-09-22 07:20:47 +00:00
|
|
|
Vn.Report = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2015-08-17 18:02:14 +00:00
|
|
|
Extends: Vn.Object
|
|
|
|
|
2015-10-21 23:42:52 +00:00
|
|
|
,open: function () {}
|
|
|
|
|
|
|
|
,print: function ()
|
2015-09-22 07:20:47 +00:00
|
|
|
{
|
2015-10-21 23:42:52 +00:00
|
|
|
this.window.print ();
|
2015-07-28 19:14:26 +00:00
|
|
|
}
|
|
|
|
|
2015-10-21 23:42:52 +00:00
|
|
|
,includeCss: function (path)
|
2015-07-28 19:14:26 +00:00
|
|
|
{
|
2015-10-21 23:42:52 +00:00
|
|
|
var basePath = location.protocol +'//'+ location.host;
|
|
|
|
basePath += location.port ? ':'+ location.port : '';
|
|
|
|
basePath += location.pathname.substring (0,
|
|
|
|
location.pathname.lastIndexOf ('/'));
|
2015-09-22 07:20:47 +00:00
|
|
|
|
2015-10-21 23:42:52 +00:00
|
|
|
var link = this.doc.createElement ('link');
|
|
|
|
link.rel = 'stylesheet';
|
|
|
|
link.type = 'text/css';
|
|
|
|
link.href = basePath +'/'+ path + Vn.getVersion ();
|
|
|
|
|
|
|
|
var head = this.doc.getElementsByTagName ('head')[0];
|
|
|
|
head.appendChild (link);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
2015-08-17 18:02:14 +00:00
|
|
|
|
2015-10-21 23:42:52 +00:00
|
|
|
,createWindow: function (reportPath)
|
2015-08-17 18:02:14 +00:00
|
|
|
{
|
2015-10-21 23:42:52 +00:00
|
|
|
var reportWindow = window.open (''/*'js/hedera/report.html'*/, '_blank'/*reportPath*/,
|
2015-11-05 07:30:19 +00:00
|
|
|
'resizable=yes,height=900,width=900,scrollbars=yes,menubar=false');
|
2015-10-21 23:42:52 +00:00
|
|
|
|
|
|
|
if (!reportWindow)
|
|
|
|
{
|
|
|
|
Htk.Toast.showError (
|
2015-11-05 07:30:19 +00:00
|
|
|
_('Please unlock popups and try again'));
|
|
|
|
return null;
|
2015-10-21 23:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.window = reportWindow;
|
|
|
|
this.doc = reportWindow.document
|
|
|
|
|
|
|
|
this.includeCss ('js/hedera/report.css');
|
|
|
|
this.includeCss ('reports/'+ reportPath +'/style.css');
|
|
|
|
|
|
|
|
var printButton = this.doc.createElement ('button');
|
|
|
|
printButton.className = 'print-button';
|
|
|
|
printButton.appendChild (this.doc.createTextNode (_('Print')));
|
|
|
|
printButton.addEventListener ('click', this.print.bind (this));
|
|
|
|
this.doc.body.appendChild (printButton);
|
|
|
|
|
|
|
|
return reportWindow;
|
2015-08-17 18:02:14 +00:00
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
});
|
|
|
|
|