this.id = id;
var timeout = 10;
- console.log("document.location" + document.location);
+ console.log("document.location= " + document.location);
+
+ if (!(window.location + '').match(/netsuite/)) {
+ // try
+ console.log("REDIRECT");
+ window.location = "https://system.netsuite.com/app/reporting/reportrunner.nl?reporttype=REGISTER&acctid=52"; // empty account register..
+ return;
+ }
// we really just want to send a series of download requests..
'https://system.netsuite.com/app/common/search/searchresults.csv' +
'?searchtype=Transaction' +
'&Transaction_ACCOUNT=' + id +
+ '&Transaction_DEPARTMENT=2' + // hk
'&sortcol=Transaction_TRANDATE_raw' +
'&sortdir=ASC'+
'&csv=Export'+
'&style=NORMAL'+
'&report='+
'&grid='+
- '&searchid=118'+
+ '&searchid=120'+
'&dle=F',
+
{
- id: data.id,
+ id: id,
+ pref : 'HK-Account'
//reportaction: 'exportcsv',
//apptype: 'html',
//visibleranges: '0,' + reportTable.getTotalRowCount()
);
-
-
+
return;
}
// location name for location download.
- var pref = '';
- if (document.getElementById('hddn_crit_32')) {
- //stock.
- pref = document.getElementById('hddn_crit_32').value ;
- } else {
- // accounts.
- pref = document.getElementsByClassName('pt_title')[0].innerText.replace(/\s+$/,'').replace(/\//g, '');
- }
+ var pref = data.pref;
console.log(
JSON.stringify ({
data: ar
}));
+ if (data.pref == 'SG-Account') {
+ console.log(
+ JSON.stringify ({
+ method : 'exit'
+ })
+ );
+ return;
+ }
+ NS.downloadgetdata(
+ 'https://system.netsuite.com/app/common/search/searchresults.csv' +
+ '?searchtype=Transaction' +
+ '&Transaction_ACCOUNT=' + data.id +
+ '&Transaction_DEPARTMENT=1' + // sg
+ '&sortcol=Transaction_TRANDATE_raw' +
+ '&sortdir=ASC'+
+ '&csv=Export'+
+ '&OfficeXML=F'+
+ '&pdf='+
+ '&style=NORMAL'+
+ '&report='+
+ '&grid='+
+ '&searchid=120'+
+ '&dle=F',
+
+ {
+ id: data.id,
+ pref: 'SG-Account'
+ //reportaction: 'exportcsv',
+ //apptype: 'html',
+ //visibleranges: '0,' + reportTable.getTotalRowCount()
+ }
+
+ );
+
+
+
}
xmlhttp.send();