RexPreView.jsp 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767
  1. <%@ page contentType="text/html;charset=euc-kr"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=MS949">
  6. <title>Rexpert Preview</title>
  7. <script language="javascript" src="./rexscript/rexpert.js"></script>
  8. <script language="javascript" src="./rexscript/rexpert_properties.js"></script>
  9. <script language="javaScript">
  10. var goWin;
  11. var gsParamArr = "";
  12. var goCrypto;
  13. function OnLoad() {
  14. if ( opener != undefined ) { // window.open 시
  15. rex_goUserWindow = opener;
  16. rex_goRptMainParam = opener.rex_goRptMainParam;
  17. rex_goRptSubParams = opener.rex_goRptSubParams;
  18. rex_goRptMultiParam = opener.rex_goRptMultiParam;
  19. rex_goUserWindow.rex_gsPrintStatus = rex_gsPrintStatus;
  20. } else if ( parent.rex_goRptMainParam != undefined) { // iframe 시
  21. rex_goUserWindow = parent;
  22. rex_goRptMainParam = parent.rex_goRptMainParam;
  23. rex_goRptSubParams = parent.rex_goRptSubParams;
  24. rex_goRptMultiParam = parent.rex_goRptMultiParam;
  25. rex_goUserWindow.rex_gsPrintStatus = rex_gsPrintStatus;
  26. } else if (window.dialogArguments != undefined) { // window.showModalDialog 시
  27. rex_goUserWindow = window.dialogArguments;
  28. rex_goRptMainParam = window.dialogArguments.rex_goRptMainParam;
  29. rex_goRptSubParams = window.dialogArguments.rex_goRptSubParams;
  30. rex_goRptMultiParam = window.dialogArguments.rex_goRptMultiParam;
  31. rex_goUserWindow.rex_gsPrintStatus = rex_gsPrintStatus;
  32. }
  33. //fnPreView();
  34. //화면 늦게 뜨는거.
  35. setTimeout(fnPreView);
  36. var iAutoRefresh = 0;
  37. var oInterval;
  38. if (rex_goRptMainParam == undefined) return fnException();
  39. if (rex_goRptMainParam.get("rex_auto_refresh") != null) {
  40. iAutoRefresh = parseInt(rex_goRptMainParam.get("rex_auto_refresh"));
  41. if (iAutoRefresh > 0) {
  42. oInterval = window.setInterval("fnPreView()", iAutoRefresh * 1000);
  43. }
  44. }
  45. }
  46. var giMainDataSetRowCount;
  47. function fnPreView() {
  48. var oReport;
  49. var oSubReport;
  50. var oConnection;
  51. var oDataSet;
  52. var oSQL;
  53. var sVersion = "";
  54. this.focus();
  55. //alert(this.ksdfd());
  56. RexCtl.SaveAsOption("xls", "sheetoption=2;");
  57. //커넥정보 숨기기
  58. //RexCtl.EnableDebug = false;
  59. //뷰어50%축소
  60. //RexCtl.zoom("50");
  61. //툴바숨기기
  62. //RexCtl.ToolBarVisible = false;
  63. //버전정보보기 숨기기
  64. //RexCtl.ShowToolBarButton(14, false);
  65. //뷰어에서 파란색 테두리 숨김
  66. //RexCtl.FocusRectVisible = false;
  67. //RexCtl.EnableHotKey("all=0");
  68. try {
  69. RexCtl.ResourceLang = rex_gsLanguage;
  70. } catch(ex) {}
  71. try {
  72. sVersion = RexCtl.GetVersion();
  73. } catch (ex) {
  74. alert("ActiveX not Installed!!");
  75. return;
  76. }
  77. if (rex_goRptMainParam == undefined) return fnException();
  78. if (rex_goRptMainParam != null) {
  79. if (rex_goRptMainParam.get("rex_init") != null) {
  80. var sSetting = rex_goRptMainParam.get("rex_init");
  81. rex_gfShowToolBarButton(RexCtl, sSetting);
  82. }
  83. }
  84. // 초기화 콜백함수 실행
  85. if (rex_goRptMainParam.Init != null) {
  86. try {
  87. rex_goRptMainParam.Init(RexCtl);
  88. } catch(e) {
  89. //
  90. }
  91. }
  92. if (rex_goRptMainParam.get("rex_init_end") != null) {
  93. rex_goRptMainParam.InitEnd(RexCtl, rex_goRptMainParam.get("rex_init_end"));
  94. }
  95. if (rex_goRptMainParam.get("rex_print_printerpaperbin") != null) {
  96. RexCtl.PrinterPaperBin = parseInt(rex_goRptMainParam.get("rex_print_printerpaperbin"));
  97. }
  98. if (rex_goRptMainParam == null || rex_goRptMainParam.get("rex_rptname") == "") return fnException();
  99. //**************************************************************************
  100. // crypto install
  101. //**************************************************************************
  102. // crypto check
  103. goCrypto = rex_CheckCrypto();
  104. if(goCrypto.Crypto == true && goCrypto.Plugin == "inisafeweb60.krx") {
  105. RexCtl.InstallPlugIn(goCrypto.Plugin, goCrypto.Param);
  106. } else {
  107. //
  108. }
  109. //***********************************************************
  110. // 마크애니 모듈 로딩(2007-11-27)
  111. //***********************************************************
  112. if(rex_goRptMainParam.get("rex_markany") != null &&
  113. rex_goRptMainParam.get("rex_markany") == "true")
  114. {
  115. if(!fnInstallPlugIn())
  116. {
  117. return fnException();
  118. }
  119. }
  120. // progress 처리
  121. if (rex_goRptMainParam.get("rex_progress") != null &&
  122. rex_goRptMainParam.get("rex_progress") == "true") {
  123. var sPage = "Progress.jsp";
  124. var sWinSize = "center=yes,scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no,width=400,height=100,left=200,top=200";
  125. if (rex_goRptMainParam.get("rex_progress_page") != null &&
  126. rex_goRptMainParam.get("rex_progress_page") != "") {
  127. sPage = rex_goRptMainParam.get("rex_progress_page");
  128. }
  129. if (rex_goRptMainParam.get("rex_progress_window") != null &&
  130. rex_goRptMainParam.get("rex_progress_window") != "") {
  131. sWinSize = rex_goRptMainParam.get("rex_progress_window");
  132. }
  133. goWin = window.open(sPage, "progress", sWinSize);
  134. }
  135. ///////////////// multi //////////////////////////////////////////
  136. if (rex_goRptMultiParam != null) {
  137. /*
  138. try {
  139. oReport = RexCtl.OpenReport(rex_gsReportURL + "dummy.rex");
  140. } catch (e) {
  141. //
  142. }
  143. */
  144. var sRptName = "";
  145. var oRptDummyParam;
  146. if (typeof(rex_goRptMultiParam.get("rex_rptname")) == "object") {
  147. oRptDummyParam = rex_goRptMultiParam.get("rex_rptname");
  148. if (oRptDummyParam.get("rex_rptname") == null || oRptDummyParam.get("rex_rptname") == ""
  149. || oRptDummyParam.get("rex_rptname") == undefined) {
  150. if (oRptDummyParam.get("rex_rptxml") != null) {
  151. oReport = RexCtl.LoadReport( oRptDummyParam.get("rex_rptxml"), "xml", "" );
  152. } else {
  153. oReport = RexCtl.OpenReport(rex_gsReportURL + "dummy.rex");
  154. }
  155. } else {
  156. sRptName = oRptDummyParam.get("rex_rptname");
  157. if (sRptName.substring( 0, 7 ) == "http://") {
  158. oReport = RexCtl.OpenReport(oRptDummyParam.get("rex_rptname"));
  159. } else {
  160. oReport = RexCtl.OpenReport(rex_gsReportURL + oRptDummyParam.get("rex_rptname") + ".rex");
  161. }
  162. }
  163. } else {
  164. if (rex_goRptMultiParam.get("rex_rptname") == null || rex_goRptMultiParam.get("rex_rptname") == ""
  165. || rex_goRptMultiParam.get("rex_rptname") == undefined) {
  166. if (rex_goRptMultiParam.get("rex_rptxml") != null) {
  167. oReport = RexCtl.LoadReport( rex_goRptMultiParam.get("rex_rptxml"), "xml", "" );
  168. } else {
  169. oReport = RexCtl.OpenReport(rex_gsReportURL + "dummy.rex");
  170. }
  171. } else {
  172. sRptName = rex_goRptMultiParam.get("rex_rptname");
  173. if (sRptName.substring( 0, 7 ) == "http://") {
  174. oReport = RexCtl.OpenReport(rex_goRptMultiParam.get("rex_rptname"));
  175. } else {
  176. oReport = RexCtl.OpenReport(rex_gsReportURL + rex_goRptMultiParam.get("rex_rptname") + ".rex");
  177. }
  178. }
  179. }
  180. var oRptMultiParam = rex_goRptMultiParam.keys();
  181. var oRptParam;
  182. var i = 0;
  183. for(var key in oRptMultiParam) {
  184. i++;
  185. if (i > 1) {
  186. oRptParam = oRptMultiParam[key];
  187. var sLinkType = "followmainreport=1;usemainreportdata=0;pagereset=0";
  188. if (oRptParam.get("rex_addreportsection") != null) {
  189. sLinkType = oRptParam.get("rex_addreportsection");
  190. }
  191. if (oRptParam.get("rex_rptxml") != null) {
  192. //.LoadReport( strRex, "xml", "" );
  193. oReport.AddReportSection("", key, oRptParam.get("rex_rptxml") , "xml", sLinkType );
  194. } else {
  195. oReport.AddReportSection("", key, rex_gsReportURL + oRptParam.get("rex_rptname") + ".rex" , "", sLinkType );
  196. }
  197. }
  198. } // end for
  199. if(oReport == null) {
  200. fnAlert("can't open report file");
  201. return fnException();
  202. }
  203. oReport = RexCtl.rebuild();
  204. if (typeof(rex_goRptMultiParam.get("rex_rptname")) == "object") {
  205. var obj = oRptDummyParam.keys();
  206. for(var key in obj) {
  207. oReport.SetParameterFieldValue(key, obj[key]);
  208. }
  209. }
  210. rex_goMainReport = oReport;
  211. for(var i = 0 ; i < oReport.GetReportCountChild(); i++)
  212. {
  213. var oSubReport = oReport.OpenReportChild(i);
  214. oRptParam = rex_goRptMultiParam.get(oSubReport.GetName());
  215. var obj = oRptParam.keys();
  216. for(var key in obj) {
  217. oSubReport.SetParameterFieldValue(key, obj[key]);
  218. }
  219. oConnection = fnCreateConnection(oRptParam.get("rex_datatype"));
  220. fnGetData(oSubReport, oConnection, oRptParam.get("rex_datatype"),
  221. oRptParam.get("rex_userservice"),
  222. oRptParam.get("rex_data"), oRptParam);
  223. for (var j = 1; j <= oSubReport.GetReportCount(); j++) {
  224. oSubSubReport = oSubReport.OpenReport(j - 1);
  225. if (oSubSubReport == null) {
  226. fnAlert("can't open sub report");
  227. return fnException();
  228. }
  229. var obj = oRptParam.keys();
  230. for(var key in obj) {
  231. oSubSubReport.SetParameterFieldValue(key, obj[key]);
  232. }
  233. fnGetData(oSubSubReport, oConnection, oRptParam.get("rex_datatype"),
  234. oRptParam.get("rex_userservice"),
  235. oRptParam.get("rex_data"), oRptParam);
  236. } // end for
  237. if (oRptParam.get("rex_datatype") != "XMLSTR" &&
  238. oRptParam.get("rex_datatype") != "CSVSTR") {
  239. //try {
  240. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  241. oConnection.SendEncrypt("");
  242. } else {
  243. oConnection.Send();
  244. }
  245. if(rex_goRptMainParam.get("rex_send_end") != null)
  246. {
  247. rex_goRptMainParam.SendEnd(oSubReport.GetName(), oConnection, rex_goRptMainParam.get("rex_send_end"));
  248. }
  249. if (oRptParam.get("rex_datatype") == "XML_AJAX" || oRptParam.get("rex_datatype") == "CSV_AJAX" ||
  250. oRptParam.get("rex_datatype") == "XMLFILE_AJAX" || oRptParam.get("rex_datatype") == "CSVFILE_AJAX") {
  251. var oConn = RexCtl.CreateConnection("connectionstring");
  252. oConn.AddValue( "load", oConnection.Response() );
  253. oConnection = oConn;
  254. }
  255. //} catch(e) {
  256. // alert(e.message);
  257. //alert(oConnection.Response());
  258. // return;
  259. //}
  260. }
  261. var sXpath = "";
  262. sXpath = oRptParam.get("rex_xpath");
  263. if (oRptParam.get("rex_datatype") == "XML" ||
  264. oRptParam.get("rex_datatype") == "XML_AJAX" ||
  265. oRptParam.get("rex_datatype") == "" ||
  266. oRptParam.get("rex_datatype") == null) {
  267. if (sXpath == null || sXpath == undefined) sXpath = "";
  268. if (sXpath == "") sXpath = "root/main/rpt1/rexdataset/rexrow";
  269. } else if (oRptParam.get("rex_datatype") == "XMLSTR") {
  270. if (sXpath == null || sXpath == undefined) sXpath = "";
  271. }
  272. oDataSet = fnCreateDataSet(oSubReport, oConnection, oRptParam.get("rex_datatype"), oDataSet, sXpath, 0);
  273. giMainDataSetRowCount = oDataSet.RowCount;
  274. rex_goMainDataSet = oDataSet;
  275. if (oRptParam.CallBack != null) {
  276. try {
  277. oRptParam.CallBack(oSubReport, oDataSet);
  278. } catch(e) {
  279. //
  280. }
  281. }
  282. for (var j = 1; j <= oSubReport.GetReportCount(); j++) {
  283. oSubSubReport = oSubReport.OpenReport(j - 1);
  284. sXpath = "";
  285. sXpath = oRptParam.get("rex_xpath" + j);
  286. if (sXpath == null || sXpath == undefined) sXpath = "";
  287. if (oRptParam.get("rex_datatype") == "XML" ||
  288. oRptParam.get("rex_datatype") == "XMLSTR" ||
  289. oRptParam.get("rex_datatype") == "XML_AJAX" ||
  290. oRptParam.get("rex_datatype") == "" ||
  291. oRptParam.get("rex_datatype") == null) {
  292. if (sXpath == "") sXpath = "root/main/rpt" + (j + 1) + "/rexdataset/rexrow";
  293. }
  294. oDataSet = fnCreateDataSet(oSubSubReport, oConnection, oRptParam.get("rex_datatype"), oDataSet, sXpath, j);
  295. }
  296. }
  297. RexCtl.Run();
  298. return fnException();
  299. }
  300. ///////////////// end multi ///////////////////////////////////
  301. try {
  302. if (rex_goRptMainParam.get("rex_rptxml") != null) {
  303. oReport = RexCtl.LoadReport(rex_goRptMainParam.get("rex_rptxml"), "xml", "");
  304. } else {
  305. var sRptName = rex_goRptMainParam.get("rex_rptname");
  306. if (sRptName.substring( 0, 7 ) == "http://") {
  307. oReport = RexCtl.OpenReport(rex_goRptMainParam.get("rex_rptname"));
  308. } else {
  309. oReport = RexCtl.OpenReport(rex_gsReportURL + rex_goRptMainParam.get("rex_rptname") + ".rex");
  310. }
  311. }
  312. } catch (e) {
  313. fnAlert(e);
  314. return fnException();
  315. }
  316. if(oReport == null) {
  317. fnAlert("can't open report file");
  318. return fnException();
  319. }
  320. //alert(oReport.GetParameterFieldName(0));
  321. //var _oSQL = oReport.GetSQLControl();
  322. //alert(_oSQL.GetConnectionString());
  323. /*
  324. oServerConnection = oReport.GetServerConnection();
  325. alert(oServerConnection.GetParameterValue("service"));
  326. alert(rex_goRptMainParam.get("rex_userservice"));
  327. */
  328. /*
  329. alert(oReport.GetDataBaseFieldCount());
  330. for(i = 0; i < oReport.GetDataBaseFieldCount(); i++) {
  331. alert(oReport.GetDataBaseFieldName(i));
  332. }
  333. */
  334. rex_goMainReport = oReport;
  335. var obj = rex_goRptMainParam.keys();
  336. for(var key in obj) {
  337. oReport.SetParameterFieldValue(key, obj[key]);
  338. }
  339. if (rex_goRptMainParam.OpenReportEnd != null) {
  340. try {
  341. if (rex_goRptMainParam.get("rex_openreport_end") != null) {
  342. rex_goRptMainParam.OpenReportEnd(rex_goMainReport, rex_goRptMainParam.get("rex_openreport_end"));
  343. }
  344. } catch(e) {
  345. //
  346. }
  347. }
  348. oConnection = fnCreateConnection(rex_goRptMainParam.get("rex_datatype"));
  349. fnGetData(oReport, oConnection, rex_goRptMainParam.get("rex_datatype"),
  350. rex_goRptMainParam.get("rex_userservice"),
  351. rex_goRptMainParam.get("rex_data"), rex_goRptMainParam);
  352. if (fnGetSubReportData() == "each") {
  353. var sXpath = "";
  354. sXpath = rex_goRptMainParam.get("rex_xpath");
  355. if (sXpath == null || sXpath == undefined) sXpath = "";
  356. if (rex_goRptMainParam.get("rex_datatype") == "XML" ||
  357. rex_goRptMainParam.get("rex_datatype") == "XMLSTR" ||
  358. rex_goRptMainParam.get("rex_datatype") == "XML_AJAX" ||
  359. rex_goRptMainParam.get("rex_datatype") == "" ||
  360. rex_goRptMainParam.get("rex_datatype") == null) {
  361. if (sXpath == "") sXpath = "root/main/rpt1/rexdataset/rexrow";
  362. }
  363. oDataSet = fnCreateDataSet(oReport, oConnection, rex_goRptMainParam.get("rex_datatype"), oDataSet, sXpath, 0);
  364. giMainDataSetRowCount = oDataSet.RowCount;
  365. rex_goMainDataSet = oDataSet;
  366. if (rex_goRptMainParam.CallBack != null) {
  367. try {
  368. rex_goRptMainParam.CallBack(oReport, oDataSet);
  369. } catch(e) {
  370. //
  371. }
  372. }
  373. }
  374. //if (rex_gsRptParamShare == "share") {
  375. if (fnRptParamShare() == "share") {
  376. if (fnGetSubReportData() == "each") {
  377. if (rex_goRptSubParams.length > 0) {
  378. var sDataType = "";
  379. var sUserService = "";
  380. var sData = "";
  381. for (i = 1; i <= rex_goRptSubParams.length; i++) {
  382. oRptSubParam = rex_goRptSubParams.get("" + i);
  383. if (oRptSubParam.get("rex_rptname") != "") {
  384. oSubReport = oReport.OpenReport(oRptSubParam.get("rex_rptname"));
  385. } else {
  386. //oSubReport = oReport.OpenReport(i - 1);
  387. fnAlert("can't find subreport name");
  388. return fnException();
  389. }
  390. if (oSubReport == null) {
  391. fnAlert("can't open sub report");
  392. return fnException();
  393. }
  394. var obj = rex_goRptMainParam.keys();
  395. for(var key in obj) {
  396. oSubReport.SetParameterFieldValue(key, obj[key]);
  397. }
  398. if (oRptSubParam.get("rex_datatype") == null) {
  399. sDataType = rex_goRptMainParam.get("rex_datatype");
  400. } else {
  401. sDataType = oRptSubParam.get("rex_datatype");
  402. }
  403. if (oRptSubParam.get("rex_userservice") == null) {
  404. sUserService = rex_goRptMainParam.get("rex_userservice");
  405. } else {
  406. sUserService = oRptSubParam.get("rex_userservice");
  407. }
  408. if (oRptSubParam.get("rex_data") == null) {
  409. sData = rex_goRptMainParam.get("rex_data");
  410. } else {
  411. sData = oRptSubParam.get("rex_data");
  412. }
  413. oConnection = fnCreateConnection(sDataType);
  414. fnGetData(oSubReport, oConnection, sDataType, sUserService, sData, rex_goRptMainParam);
  415. var sXpath = "";
  416. sXpath = oRptSubParam.get("rex_xpath");
  417. if (sXpath == null || sXpath == undefined) sXpath = "";
  418. if (sDataType == "XML" ||
  419. sDataType == "XMLSTR" ||
  420. sDataType == "XML_AJAX" ||
  421. sDataType == "" || sDataType == null) {
  422. if (sXpath == "") sXpath = "root/main/rpt1/rexdataset/rexrow";
  423. }
  424. oDataSet = fnCreateDataSet(oSubReport, oConnection, sDataType, oDataSet, sXpath, 0);
  425. if (oRptSubParam.CallBack != null) {
  426. try {
  427. oRptSubParam.CallBack(oSubReport, oDataSet);
  428. } catch(e) {
  429. //
  430. }
  431. }
  432. } // end for
  433. } // end if
  434. } else { // once
  435. for (i = 1; i <= oReport.GetReportCount(); i++) {
  436. oSubReport = oReport.OpenReport(i - 1);
  437. if (oSubReport == null) {
  438. fnAlert("can't open sub report");
  439. return fnException();
  440. }
  441. var obj = rex_goRptMainParam.keys();
  442. for(var key in obj) {
  443. oSubReport.SetParameterFieldValue(key, obj[key]);
  444. }
  445. if (rex_goRptMainParam.get("rex_datatype") != "XMLSTR" &&
  446. rex_goRptMainParam.get("rex_datatype") != "CSVSTR") {
  447. fnGetData(oSubReport, oConnection, rex_goRptMainParam.get("rex_datatype"),
  448. rex_goRptMainParam.get("rex_userservice"),
  449. rex_goRptMainParam.get("rex_data"), rex_goRptMainParam);
  450. }
  451. } // end for
  452. } // end if
  453. } else { // each
  454. if (rex_goRptSubParams.length > 0) {
  455. var sDataType = "";
  456. var sUserService = "";
  457. var sData = "";
  458. for (i = 1; i <= rex_goRptSubParams.length; i++) {
  459. oRptSubParam = rex_goRptSubParams.get("" + i);
  460. if (oRptSubParam.get("rex_rptname") != "") {
  461. oSubReport = oReport.OpenReport(oRptSubParam.get("rex_rptname"));
  462. } else {
  463. //oSubReport = oReport.OpenReport(i - 1);
  464. fnAlert("can't find subreport name");
  465. return fnException();
  466. }
  467. if (oSubReport == null) {
  468. fnAlert("can't open sub report");
  469. return fnException();
  470. }
  471. var obj = oRptSubParam.keys();
  472. for(var key in obj) {
  473. oSubReport.SetParameterFieldValue(key, obj[key]);
  474. //alert(oSubReport.GetParameterFieldName(0));
  475. }
  476. if (oRptSubParam.get("rex_datatype") == null) {
  477. sDataType = rex_goRptMainParam.get("rex_datatype");
  478. } else {
  479. sDataType = oRptSubParam.get("rex_datatype");
  480. }
  481. if (oRptSubParam.get("rex_userservice") == null) {
  482. sUserService = rex_goRptMainParam.get("rex_userservice");
  483. } else {
  484. sUserService = oRptSubParam.get("rex_userservice");
  485. }
  486. if (oRptSubParam.get("rex_data") == null) {
  487. sData = rex_goRptMainParam.get("rex_data");
  488. } else {
  489. sData = oRptSubParam.get("rex_data");
  490. }
  491. oConnection = fnCreateConnection(sDataType);
  492. fnGetData(oSubReport, oConnection, sDataType, sUserService, sData, rex_goRptMainParam);
  493. //fnGetData(oSubReport, oConnection, sDataType, sUserService, sData, oRptSubParam);
  494. if (fnGetSubReportData() == "each") {
  495. var sXpath = "";
  496. sXpath = oRptSubParam.get("rex_xpath");
  497. if (sXpath == null || sXpath == undefined) sXpath = "";
  498. if (sDataType == "XML" ||
  499. sDataType == "XMLSTR" ||
  500. sDataType == "XML_AJAX" ||
  501. sDataType == "" || sDataType == null) {
  502. if (sXpath == "") sXpath = "root/main/rpt1/rexdataset/rexrow";
  503. }
  504. oDataSet = fnCreateDataSet(oSubReport, oConnection, sDataType, oDataSet, sXpath, 0);
  505. if (oRptSubParam.CallBack != null) {
  506. try {
  507. oRptSubParam.CallBack(oSubReport, oDataSet);
  508. } catch(e) {
  509. //
  510. }
  511. }
  512. }
  513. } // end for
  514. } // end if
  515. } // end if - share
  516. if (fnGetSubReportData() == "once") {
  517. var sDataType = "";
  518. sDataType = rex_goRptMainParam.get("rex_datatype");
  519. if (rex_goRptMainParam.get("rex_datatype") != "XMLSTR" &&
  520. rex_goRptMainParam.get("rex_datatype") != "CSVSTR") {
  521. //try {
  522. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  523. oConnection.SendEncrypt("");
  524. } else {
  525. oConnection.Send();
  526. }
  527. if(rex_goRptMainParam.get("rex_send_end") != null)
  528. {
  529. rex_goRptMainParam.SendEnd("", oConnection, rex_goRptMainParam.get("rex_send_end"));
  530. }
  531. //alert("oConnection.Response():" + fnBlockDec(oConnection.Response()));
  532. if (sDataType == "XML_AJAX" || sDataType == "CSV_AJAX" ||
  533. sDataType == "XMLFILE_AJAX" || sDataType == "CSVFILE_AJAX") {
  534. var oConn = RexCtl.CreateConnection("connectionstring");
  535. oConn.AddValue( "load", oConnection.Response() );
  536. oConnection = oConn;
  537. }
  538. //} catch(e) {
  539. // alert(e.message);
  540. //alert(oConnection.Response());
  541. // return;
  542. //}
  543. }
  544. var sXpath = "";
  545. sXpath = rex_goRptMainParam.get("rex_xpath");
  546. if (sXpath == null || sXpath == undefined) sXpath = "";
  547. if (rex_goRptMainParam.get("rex_datatype") == "XML" ||
  548. rex_goRptMainParam.get("rex_datatype") == "XMLSTR" ||
  549. rex_goRptMainParam.get("rex_datatype") == "XML_AJAX" ||
  550. rex_goRptMainParam.get("rex_datatype") == "" ||
  551. rex_goRptMainParam.get("rex_datatype") == null) {
  552. if (sXpath == "") sXpath = "root/main/rpt1/rexdataset/rexrow";
  553. }
  554. oDataSet = fnCreateDataSet(oReport, oConnection, rex_goRptMainParam.get("rex_datatype"), oDataSet, sXpath, 0);
  555. giMainDataSetRowCount = oDataSet.RowCount;
  556. rex_goMainDataSet = oDataSet;
  557. if (rex_goRptMainParam.CallBack != null) {
  558. try {
  559. rex_goRptMainParam.CallBack(oReport, oDataSet);
  560. } catch(e) {
  561. //
  562. }
  563. }
  564. for (i = 1; i <= oReport.GetReportCount(); i++) {
  565. oSubReport = oReport.OpenReport(i - 1);
  566. sXpath = "";
  567. sXpath = rex_goRptMainParam.get("rex_xpath" + i);
  568. if (sXpath == null || sXpath == undefined) sXpath = "";
  569. if (sDataType == "XML" ||
  570. sDataType == "XMLSTR" ||
  571. sDataType == "XML_AJAX" ||
  572. sDataType == "" || sDataType == null) {
  573. if (sXpath == "") sXpath = "root/main/rpt" + (i + 1) + "/rexdataset/rexrow";
  574. }
  575. oDataSet = fnCreateDataSet(oSubReport, oConnection, rex_goRptMainParam.get("rex_datatype"), oDataSet, sXpath, i);
  576. }
  577. }
  578. //***********************************************************
  579. // 보고서 생성 및 마크애니데이터 생성(2007-11-27)
  580. //***********************************************************
  581. if(rex_goRptMainParam.get("rex_markany") != null &&
  582. rex_goRptMainParam.get("rex_markany") == "true")
  583. {
  584. RexCtl.RunAsBlocking();
  585. // 마크애니 데이터 생성
  586. fnGenerate2D();
  587. }
  588. else
  589. {
  590. if (rex_goRptMainParam.get("rex_save") != null) {
  591. if (rex_goRptMainParam.get("rex_save") == "true") {
  592. RexCtl.RunAsBlocking();
  593. return fnException();
  594. }
  595. }
  596. RexCtl.Run();
  597. } // end if
  598. return fnException();
  599. } // end fnPreView
  600. // CreateConnection
  601. function fnCreateConnection(sDataType)
  602. {
  603. var oConnection;
  604. if (sDataType == "XMLFILE")
  605. {
  606. oConnection = RexCtl.CreateConnection("http.get");
  607. }
  608. else if (sDataType == "CSVFILE")
  609. {
  610. oConnection = RexCtl.CreateConnection("http.csv");
  611. //oConnection = RexCtl.CreateConnection("http.get");
  612. }
  613. else if (sDataType == "XML" || sDataType == "" || sDataType == null )
  614. {
  615. oConnection = RexCtl.CreateConnection("http.post");
  616. }
  617. else if (sDataType == "CSV" )
  618. {
  619. oConnection = RexCtl.CreateConnection("http.csv");
  620. }
  621. else if (sDataType=="XMLSTR" || sDataType=="CSVSTR" )
  622. {
  623. oConnection = RexCtl.CreateConnection("connectionstring");
  624. } else if (sDataType=="XML_AJAX" || sDataType=="CSV_AJAX" )
  625. {
  626. oConnection = rex_GetgoAjax();
  627. oConnection.Method = "POST";
  628. oConnection.isASync = false;
  629. var sPath = rex_gsRptServiceURL;
  630. /*
  631. if (sData != undefined) {
  632. if (sData != "") {
  633. sPath = sData;
  634. } // end if
  635. } // end if
  636. */
  637. oConnection.Path = sPath;
  638. oConnection.DataType = sDataType.substring( 0, 3 );
  639. oConnection.Open();
  640. if (rex_goRptMainParam.get("rex_ajax_requestheader_contenttype") != null) {
  641. oConnection.SetRequestHeader("Content-Type", rex_goRptMainParam.get("rex_ajax_requestheader_contenttype"));
  642. } else {
  643. oConnection.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=EUC-KR");
  644. //oConnection.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
  645. }
  646. } else if (sDataType=="XMLFILE_AJAX" || sDataType=="CSVFILE_AJAX" )
  647. {
  648. oConnection = rex_GetgoAjax();
  649. oConnection.Method = "GET";
  650. oConnection.isASync = false;
  651. }
  652. return oConnection;
  653. } // end fnCreateConnection
  654. // GetData
  655. function fnGetData(oReport, oConnection, sDataType, sUserService, sData, oRptParam)
  656. {
  657. var oSQL;
  658. var sSplitFields;
  659. var sImageFields;
  660. if (sDataType == "XML" || sDataType == "" || sDataType == "CSV" || sDataType == null)
  661. {
  662. //oConnection.AddParameter("datatype" + gsParamArr, sDataType);
  663. if (goCrypto.Crypto == true && goCrypto.Encode == true
  664. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  665. oConnection.AddParameter("datatype" + gsParamArr, gfEncrypt(sDataType));
  666. } else {
  667. oConnection.AddParameter("datatype" + gsParamArr, sDataType);
  668. }
  669. oSQL = oReport.GetSQLControl();
  670. //oConnection.AddParameter("sql" + gsParamArr, oSQL.GetSQL());
  671. if (goCrypto.Crypto == true && goCrypto.Encode == true
  672. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  673. oConnection.AddParameter("sql" + gsParamArr, gfEncrypt(oSQL.GetSQL()));
  674. } else {
  675. oConnection.AddParameter("sql" + gsParamArr, oSQL.GetSQL());
  676. }
  677. if (oRptParam.get("rex_split_fields") != null) {
  678. sSplitFields = fnGetSplitFields(oReport.GetName(), oRptParam.get("rex_split_fields"));
  679. //oConnection.AddParameter("split" + gsParamArr, sSplitFields);
  680. if (goCrypto.Crypto == true && goCrypto.Encode == true
  681. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  682. oConnection.AddParameter("split" + gsParamArr, gfEncrypt(sSplitFields));
  683. } else {
  684. oConnection.AddParameter("split" + gsParamArr, sSplitFields);
  685. }
  686. } else {
  687. oConnection.AddParameter("split" + gsParamArr, "");
  688. }
  689. // 2008-10-09
  690. if (oRptParam.get("rex_image_fields") != null) {
  691. sImageFields = fnGetImageFields(oReport.GetName(), oRptParam.get("rex_image_fields"));
  692. //oConnection.AddParameter("image" + gsParamArr, sSplitFields);
  693. if (goCrypto.Crypto == true && goCrypto.Encode == true
  694. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  695. oConnection.AddParameter("image" + gsParamArr, gfEncrypt(sImageFields));
  696. } else {
  697. oConnection.AddParameter("image" + gsParamArr, sImageFields);
  698. }
  699. } else {
  700. oConnection.AddParameter("image" + gsParamArr, "");
  701. }
  702. /*
  703. if (rex_goRptMainParam.get("rex_split_fields") != null) {
  704. sSplitFields = fnGetSplitFields(oReport.GetName(), rex_goRptMainParam.get("rex_split_fields"));
  705. oConnection.AddParameter("split", sSplitFields);
  706. } else {
  707. oConnection.AddParameter("split", "");
  708. }
  709. */
  710. if (sUserService == null) {
  711. //oConnection.AddParameter("userservice" + gsParamArr, rex_gsUserService);
  712. if (goCrypto.Crypto == true && goCrypto.Encode == true
  713. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  714. oConnection.AddParameter("userservice" + gsParamArr, gfEncrypt(rex_gsUserService));
  715. } else {
  716. oConnection.AddParameter("userservice" + gsParamArr, rex_gsUserService);
  717. }
  718. } else {
  719. //oConnection.AddParameter("userservice" + gsParamArr, sUserService);
  720. if (goCrypto.Crypto == true && goCrypto.Encode == true
  721. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  722. oConnection.AddParameter("userservice" + gsParamArr, gfEncrypt(sUserService));
  723. } else {
  724. oConnection.AddParameter("userservice" + gsParamArr, sUserService);
  725. }
  726. }
  727. /*
  728. if (rex_goRptMainParam.get("rex_userservice") == null) {
  729. oConnection.AddParameter("userservice", rex_gsUserService);
  730. } else {
  731. oConnection.AddParameter("userservice", rex_goRptMainParam.get("rex_userservice"));
  732. }
  733. */
  734. if(oRptParam.get("rex_server_param") != null) {
  735. var oServerParam = oRptParam.get("rex_server_param");
  736. //oConnection.AddParameter("rex_server_param" + gsParamArr, "true");
  737. if (goCrypto.Crypto == true && goCrypto.Encode == true
  738. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  739. oConnection.AddParameter("rex_server_param" + gsParamArr, gfEncrypt("true"));
  740. } else {
  741. oConnection.AddParameter("rex_server_param" + gsParamArr, "true");
  742. }
  743. var oTmp = oServerParam.keys();
  744. for(var key in oTmp) {
  745. //oConnection.AddParameter(key, oTmp[key]);
  746. if (goCrypto.Crypto == true && goCrypto.Encode == true
  747. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  748. oConnection.AddParameter(key, gfEncrypt(oTmp[key]));
  749. } else {
  750. oConnection.AddParameter(key, oTmp[key]);
  751. }
  752. } // end for
  753. } // end if
  754. //oConnection.AddParameter("rex_param_sql" + gsParamArr, fnGetParamSql(oReport.GetName(), oRptParam));
  755. if (goCrypto.Crypto == true && goCrypto.Encode == true
  756. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  757. oConnection.AddParameter("rex_param_sql" + gsParamArr, gfEncrypt(fnGetParamSql(oReport.GetName(), oRptParam)));
  758. } else {
  759. oConnection.AddParameter("rex_param_sql" + gsParamArr, fnGetParamSql(oReport.GetName(), oRptParam));
  760. }
  761. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin != "inisafeweb60.krx") {
  762. if (goCrypto.Plugin == "") {
  763. oConnection.AddParameter("pSessionKey" + gsParamArr, "internal");
  764. } else {
  765. oConnection.AddParameter("pSessionKey" + gsParamArr, gfGetSID());
  766. }
  767. }
  768. var sPath = rex_gsRptServiceURL;
  769. if (sData != undefined) {
  770. if (sData != "") {
  771. sPath = sData;
  772. } // end if
  773. } // end if
  774. oConnection.Path = sPath;
  775. //oConnection.Path = "http://" + location.host + "/web/rexpert/RexServer.jsp";
  776. if (fnGetSubReportData() == "each") {
  777. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  778. oConnection.SendEncrypt("");
  779. } else {
  780. oConnection.Send();
  781. }
  782. if(oRptParam.get("rex_send_end") != null)
  783. {
  784. oRptParam.SendEnd(oReport.GetName(), oConnection, oRptParam.get("rex_send_end"));
  785. }
  786. }
  787. }
  788. else if (sDataType=="XMLFILE")
  789. {
  790. oConnection.Path = sData;
  791. //oConnection.Path = "http://" + location.host + sData;
  792. //oConnection.Path = "http://" + location.host + "/web/xml/resolution/" + sDataName + ".xml";
  793. if (fnGetSubReportData() == "each") {
  794. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  795. oConnection.SendEncrypt("");
  796. } else {
  797. oConnection.Send();
  798. }
  799. if(oRptParam.get("rex_send_end") != null)
  800. {
  801. oRptParam.SendEnd(oReport.GetName(), oConnection, oRptParam.get("rex_send_end"));
  802. }
  803. }
  804. }
  805. else if (sDataType=="CSVFILE")
  806. {
  807. oConnection.Path = sData;
  808. //oConnection.Path = "http://" + location.host + sData;
  809. //oConnection.Path = "http://" + location.host + "/web/" + sDataName + ".txt";
  810. if (fnGetSubReportData() == "each") {
  811. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  812. oConnection.SendEncrypt("");
  813. } else {
  814. oConnection.Send();
  815. }
  816. if(oRptParam.get("rex_send_end") != null)
  817. {
  818. oRptParam.SendEnd(oReport.GetName(), oConnection, oRptParam.get("rex_send_end"));
  819. }
  820. }
  821. }
  822. else if (sDataType=="XMLSTR" || sDataType=="CSVSTR")
  823. {
  824. oConnection.AddValue("load", sData);
  825. }
  826. else if (sDataType=="XML_AJAX" || sDataType=="CSV_AJAX")
  827. {
  828. oConnection.AddParameter("datatype" + gsParamArr, sDataType.substring( 0, 3 ));
  829. oSQL = oReport.GetSQLControl();
  830. oConnection.AddParameter("sql", oSQL.GetSQL());
  831. if (oRptParam.get("rex_split_fields") != null) {
  832. sSplitFields = fnGetSplitFields(oReport.GetName(), oRptParam.get("rex_split_fields"));
  833. oConnection.AddParameter("split" + gsParamArr, sSplitFields);
  834. } else {
  835. oConnection.AddParameter("split" + gsParamArr, "");
  836. }
  837. // 2008-10-09
  838. if (oRptParam.get("rex_image_fields") != null) {
  839. sImageFields = fnGetImageFields(oReport.GetName(), oRptParam.get("rex_image_fields"));
  840. oConnection.AddParameter("image" + gsParamArr, sImageFields);
  841. } else {
  842. oConnection.AddParameter("image" + gsParamArr, "");
  843. }
  844. if (sUserService == null) {
  845. oConnection.AddParameter("userservice" + gsParamArr, rex_gsUserService);
  846. } else {
  847. oConnection.AddParameter("userservice" + gsParamArr, sUserService);
  848. }
  849. // ------------------------------------------
  850. //rex_gfAjaxExcute(sDataType, sMethod, sUrl, bASync, sRequestHeader)
  851. /*
  852. if (fnGetSubReportData() == "each") {
  853. rex_gfAjaxExcute(sDType, "POST", sUrl, true, "") ;
  854. oConnection.AddValue( "load", rex_gsAjax_ReturnData);
  855. }
  856. */
  857. if (fnGetSubReportData() == "each") {
  858. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  859. oConnection.SendEncrypt("");
  860. } else {
  861. oConnection.Send();
  862. }
  863. // 테스트 필요
  864. var oConn = RexCtl.CreateConnection("connectionstring");
  865. oConn.AddValue( "load", oConnection.Response() );
  866. oConnection = oConn;
  867. }
  868. }
  869. else if (sDataType=="XMLFILE_AJAX" || sDataType=="CSVFILE_AJAX")
  870. {
  871. oConnection.Path = sData;
  872. oConnection.DataType = sDataType.substring( 0, 3 );
  873. oConnection.Open();
  874. if (oRptParam.get("rex_ajax_requestheader_contenttype") != null) {
  875. oConnection.SetRequestHeader("Content-Type", oRptParam.get("rex_ajax_requestheader_contenttype"));
  876. } else {
  877. oConnection.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=EUC-KR");
  878. //oConnection.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
  879. }
  880. if (fnGetSubReportData() == "each") {
  881. if (goCrypto.Crypto == true && goCrypto.Encode == true && goCrypto.Plugin == "") {
  882. oConnection.SendEncrypt("");
  883. } else {
  884. oConnection.Send();
  885. }
  886. // 오류가능성..테스트 필요
  887. var oConn = RexCtl.CreateConnection("connectionstring");
  888. oConn.AddValue( "load", oConnection.Response() );
  889. oConnection = oConn;
  890. }
  891. }
  892. //return oConnection;
  893. } // end fnGetData
  894. function fnCreateDataSet(oReport, oConnection, sDataType, oDataSet, sXpath, idx)
  895. {
  896. if ((sDataType == "XML" || sDataType == "" || sDataType == null))
  897. {
  898. if (goCrypto.Crypto == true && goCrypto.Decode == true
  899. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "" && goCrypto.FlushCount > 0) {
  900. var sStr = oConnection.Response();
  901. var aStr = sStr.split(goCrypto.Separator);
  902. var sValue = "";
  903. var oConn = RexCtl.CreateConnection("connectionstring");
  904. for (var i = 0; i < aStr.length; i++) {
  905. sValue += gfDecrypt(aStr[i]);
  906. }
  907. oConn.AddValue( "load", sValue);
  908. oDataSet = oReport.CreateDataSetXML(oConn, sXpath, 0);
  909. } else {
  910. oDataSet = oReport.CreateDataSetXML(oConnection, sXpath, 0);
  911. //oDataSet = oReport.CreateDataSetXML(oConnection, "root/main/rpt1/rexdataset/rexrow", 0);
  912. if (goCrypto.Crypto == true && goCrypto.Decode == true
  913. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  914. for(var i = 0 ; i < oDataSet.RowCount; i++) {
  915. for(var j = 0 ; j < oDataSet.ColCount; j++) {
  916. oDataSet.SetValue(i,j, gfDecrypt(oDataSet.GetValue(i,j)));
  917. }
  918. }
  919. }
  920. } // end if
  921. }
  922. else if (sDataType == "XMLFILE" || sDataType == "XMLSTR" ||
  923. sDataType == "XML_AJAX" || sDataType == "XMLFILE_AJAX")
  924. {
  925. if (goCrypto.Crypto == true && goCrypto.Decode == true
  926. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "" && goCrypto.FlushCount > 0) {
  927. var sStr = oConnection.Response();
  928. var aStr = sStr.split(goCrypto.Separator);
  929. var sValue = "";
  930. var oConn = RexCtl.CreateConnection("connectionstring");
  931. for (var i = 0; i < aStr.length; i++) {
  932. sValue += gfDecrypt(aStr[i]);
  933. }
  934. oConn.AddValue( "load", sValue);
  935. oDataSet = oReport.CreateDataSetXML(oConn, sXpath, 0);
  936. } else {
  937. oDataSet = oReport.CreateDataSetXML(oConnection, sXpath, 0);
  938. if (goCrypto.Crypto == true && goCrypto.Decode == true
  939. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  940. for(var i = 0 ; i < oDataSet.RowCount; i++) {
  941. for(var j = 0 ; j < oDataSet.ColCount; j++) {
  942. oDataSet.SetValue(i,j, gfDecrypt(oDataSet.GetValue(i,j)));
  943. }
  944. }
  945. }
  946. } // end if
  947. //oDataSet = oReport.CreateDataSetXML(oConnection, "", 0);
  948. //oDataSet = oReport.CreateDataSetXML(oConnection, "rexdataset/rexrow", 0);
  949. }
  950. else if (sDataType == "CSV" || sDataType == "CSVFILE" || sDataType == "CSVSTR" ||
  951. sDataType == "CSV_AJAX" || sDataType == "CSVFILE_AJAX")
  952. {
  953. if (goCrypto.Crypto == true && goCrypto.Decode == true
  954. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "" && goCrypto.FlushCount > 0) {
  955. var sStr = oConnection.Response();
  956. var aStr = sStr.split(goCrypto.Separator);
  957. var sValue = "";
  958. var oConn = RexCtl.CreateConnection("connectionstring");
  959. for (var i = 0; i < aStr.length; i++) {
  960. sValue += gfDecrypt(aStr[i]);
  961. }
  962. oConn.AddValue( "load", sValue);
  963. oDataSet = oReport.CreateDataSetCSV(oConn, idx,
  964. rex_gsCsvSeparatorDataset,
  965. rex_gsCsvSeparatorRow,
  966. rex_gsCsvSeparatorColumn, rex_csv_encoding);
  967. } else {
  968. oDataSet = oReport.CreateDataSetCSV(oConnection, idx,
  969. rex_gsCsvSeparatorDataset,
  970. rex_gsCsvSeparatorRow,
  971. rex_gsCsvSeparatorColumn, rex_csv_encoding);
  972. //var myDate = new Date( );
  973. //alert(oDataSet.RowCount + ":" + myDate);
  974. if (goCrypto.Crypto == true && goCrypto.Decode == true
  975. && goCrypto.Plugin != "inisafeweb60.krx" && goCrypto.Plugin != "") {
  976. for(var i = 0 ; i < oDataSet.RowCount; i++) {
  977. for(var j = 0 ; j < oDataSet.ColCount; j++) {
  978. // idCnt.value = i + ":" + j;
  979. oDataSet.SetValue(i,j, gfDecrypt(oDataSet.GetValue(i,j)));
  980. }
  981. }
  982. }
  983. //var myDate2 = new Date( );
  984. //alert(oDataSet.RowCount + "건 : " + (myDate2 - myDate) / 1000 + "초");
  985. //oDataSet = oReport.CreateDataSetCSV(oConnection, 0, "@", "", "^", "");
  986. } // end if
  987. }
  988. return oDataSet;
  989. }
  990. //*****************************************************************
  991. //
  992. // * 마크애니 모듈 로딩 함수
  993. //
  994. //*****************************************************************
  995. function fnInstallPlugIn()
  996. {
  997. try
  998. {
  999. //**************************************************************************
  1000. // 사용가능 옵션
  1001. // * dllname : 마크애니 dll 명(MAePageSAFERRexpert.dll)
  1002. // * datafilename : 데이터 파일명(MaPrintInfoNhicRex.dat), MaPrintInfoMofe.dat
  1003. // * enablecapture : 화면캡처보안사용
  1004. // * enablespool : 스풀보안사용
  1005. // * enableprinter : 프린터보안사용
  1006. // * enableprinterinfo : 프린터정보보안사용
  1007. // * printeroption : 프린터보안옵션 설정
  1008. // - 0:등록프린터, 공유프린터 지원안함
  1009. // - 1:등록프린터, 공유프린터 지원
  1010. // - 2:모든프린터, 공유프린터 지원 안함
  1011. // - 3:모든프린터, 공유프린터 지원
  1012. // * imagesaferoption : 화면보안옵션 설정
  1013. // - 0: 리모트툴 제어
  1014. // - 1:리모트툴 제어안함
  1015. //**************************************************************************
  1016. //RexCtl.InstallPlugIn("markany", "dllname=MAePageSAFERRexpert.dll;datafilename=MaPrintInfoNhicRex.dat;enablecapture=1;enablespool=1;enableprinter=1;enableprinterInfo=1;printeroption=3;imagesaferoption=0");
  1017. //RexCtl.InstallPlugIn("markany", "dllname=MAePageSAFERRexpert.dll;datafilename=MaPrintInfoNhicRex.dat;enablecapture=0;enablespool=0;enableprinter=0;enableprinterInfo=0;printeroption=3;imagesaferoption=0");
  1018. var sMarkanyParam;
  1019. if(rex_goRptMainParam.get("rex_markany_param") != null)
  1020. sMarkanyParam = rex_goRptMainParam.get("rex_markany_param");
  1021. RexCtl.InstallPlugIn("markany", sMarkanyParam);
  1022. }
  1023. catch(e)
  1024. {
  1025. fnAlert(e.message);
  1026. return false;
  1027. }
  1028. return true;
  1029. }
  1030. //*****************************************************************
  1031. //
  1032. // * 마크애니 데이터 생성
  1033. //
  1034. //*****************************************************************
  1035. function fnGenerate2D()
  1036. {
  1037. var sCellWidth = "18"; // 기본 바코드 넓이
  1038. var sCellHeight = "2"; // 기본 바코드 높이
  1039. if(rex_goRptMainParam.get("rex_markany_cellwidth") != null)
  1040. sCellWidth = rex_goRptMainParam.get("rex_markany_cellwidth");
  1041. if(rex_goRptMainParam.get("rex_markany_cellheight") != null)
  1042. sCellHeight = rex_goRptMainParam.get("rex_markany_cellheight");
  1043. for(var i = 0; i < RexCtl.GetPageCount(); i++)
  1044. {
  1045. var oConnectionDRM = RexCtl.CreateConnection("http.csv");
  1046. try
  1047. {
  1048. //
  1049. //oConnectionDRM.Path = "http://" + location.host + "/portal/rexpert/MaFpsCommon.jsp";
  1050. //oConnectionDRM.Path = rex_gsRexServiceRootURL + "rexpert/jsp/MaFpsCommon.jsp";
  1051. oConnectionDRM.Path = rex_goRptMainParam.get("rex_markany_path");
  1052. oConnectionDRM.AddParameter("xml", RexCtl.GetPageRTX(i));
  1053. oConnectionDRM.AddParameter("cellwidth", sCellWidth);
  1054. oConnectionDRM.AddParameter("cellheight", sCellHeight);
  1055. oConnectionDRM.Send();
  1056. //RexCtl.SetPageData(i, "markany", oConnectionDRM.Response(), "MaPrintInfoNhicRex.dat", "");
  1057. RexCtl.SetPageData(i, "markany", oConnectionDRM.Response(), rex_goRptMainParam.get("rex_markany_setpagedata"), "");
  1058. }
  1059. catch(e)
  1060. {
  1061. fnAlert(e.message);
  1062. }
  1063. }
  1064. }
  1065. function fnGetSubReportData()
  1066. {
  1067. if (rex_goRptMainParam.get("rex_getsubreportdata") == null) {
  1068. return rex_gsGetSubReportData;
  1069. } else {
  1070. return rex_goRptMainParam.get("rex_getsubreportdata");
  1071. }
  1072. }
  1073. function fnGetSplitFields(sReportName, sSplitFields)
  1074. {
  1075. var aReport;
  1076. var aTmp;
  1077. if (sReportName == "") {
  1078. sReportName = "main";
  1079. }
  1080. aReport = sSplitFields.split(";");
  1081. for (var i = 0; i < aReport.length; i++) {
  1082. aTmp = aReport[i].split("=");
  1083. if (aTmp[0].trim() == sReportName) {
  1084. return aTmp[1].trim();
  1085. }
  1086. }
  1087. return "";
  1088. }
  1089. function fnGetImageFields(sReportName, sImageFields)
  1090. {
  1091. var aReport;
  1092. var aTmp;
  1093. if (sReportName == "") {
  1094. sReportName = "main";
  1095. }
  1096. aReport = sImageFields.split(";");
  1097. for (var i = 0; i < aReport.length; i++) {
  1098. aTmp = aReport[i].split("=");
  1099. if (aTmp[0].trim() == sReportName) {
  1100. return aTmp[1].trim();
  1101. }
  1102. }
  1103. return "";
  1104. }
  1105. function fnRptParamShare()
  1106. {
  1107. if (rex_goRptMainParam.get("rex_param_share") == null) {
  1108. return rex_gsRptParamShare;
  1109. } else {
  1110. return rex_goRptMainParam.get("rex_param_share");
  1111. }
  1112. }
  1113. function fnGetErrorMsg(oConnection)
  1114. {
  1115. var oXMLDOM = oConnection.GetXMLDOM();
  1116. if(oXMLDOM == null) {
  1117. fnAlert(oConnection.Response());
  1118. return fnException();
  1119. }
  1120. try {
  1121. oXMLDOM.setProperty("SelectionLanguage", "XPath");
  1122. var oNodes = oXMLDOM.selectSingleNode("gubun/error/msg");
  1123. if(oNodes == null) {
  1124. if (oXMLDOM.parseError.errorCode != 0) {
  1125. var oError = oXMLDOM.parseError;
  1126. fnAlert(oError.reason);
  1127. return "error";
  1128. } else {
  1129. return "";
  1130. }
  1131. } else {
  1132. fnAlert(oNodes.text);
  1133. return "error";
  1134. }
  1135. } catch(e) {
  1136. fnAlert(e.message);
  1137. return "error";
  1138. }
  1139. } // end fnGetErrorMsg
  1140. // 예외 발생시 처리 함수
  1141. function fnException() {
  1142. //rex_goUserWindow.rex_gsEndLoadReportStatus = "false";
  1143. fnCloseProgress();
  1144. }
  1145. function fnCloseProgress() {
  1146. // Progress 닫기
  1147. try
  1148. {
  1149. goWin.close();
  1150. } catch (e) {}
  1151. }
  1152. function fnAlert(sMsg) {
  1153. if(rex_goRptMainParam.get("rex_script_alert") != null &&
  1154. rex_goRptMainParam.get("rex_script_alert") == "false") {
  1155. return;
  1156. } else {
  1157. alert(sMsg);
  1158. }
  1159. }
  1160. function fnArrToStr(aInData) {
  1161. var sSplitRow = "|!|";
  1162. var sSplitCol = "|*|";
  1163. var sOut = "";
  1164. if (aInData == null) return sOut;
  1165. for(var i = 0; i < aInData.length; i++) {
  1166. if (i > 0) sOut += sSplitRow;
  1167. sOut += aInData[i][0] + sSplitCol;
  1168. sOut += aInData[i][1];
  1169. }
  1170. return sOut;
  1171. }
  1172. function fnGetParamSql(sReportName, oRptParam)
  1173. {
  1174. var sRptNmKey = "rex_param_sql";
  1175. if (sReportName != "") sRptNmKey += "_" + sReportName;
  1176. if (oRptParam.get(sRptNmKey) != null) {
  1177. return fnArrToStr(oRptParam.get(sRptNmKey));
  1178. }
  1179. return "";
  1180. }
  1181. function fnSave() {
  1182. if (rex_goRptMainParam.get("rex_save") != null) {
  1183. if (rex_goRptMainParam.get("rex_save") == "true") {
  1184. var sFileType = "";
  1185. var sFileName = "";
  1186. var sFileOption = "";
  1187. var bSaveDirect = true;
  1188. if (rex_goRptMainParam.get("rex_save_direct") == null) {
  1189. bSaveDirect = true;
  1190. } else {
  1191. if (rex_goRptMainParam.get("rex_save_direct") == "true") {
  1192. bSaveDirect = true;
  1193. } else {
  1194. bSaveDirect = false;
  1195. }
  1196. }
  1197. sFileName = rex_goRptMainParam.get("rex_save_file");
  1198. if (rex_goRptMainParam.get("rex_save_file_option") == null) {
  1199. sFileOption = "";
  1200. } else {
  1201. sFileOption = rex_goRptMainParam.get("rex_save_file_option");
  1202. }
  1203. if (rex_goRptMainParam.get("rex_save_file_type") == null) {
  1204. var aFileExt = sFileName.split(".");
  1205. sFileType = aFileExt[aFileExt.length - 1];
  1206. } else {
  1207. sFileType = rex_goRptMainParam.get("rex_save_file_type");
  1208. }
  1209. if (bSaveDirect == true) {
  1210. RexCtl.SaveAs(sFileType, sFileName, 1, -1, sFileOption);
  1211. } else {
  1212. RexCtl.SaveAsFilter = sFileType;
  1213. RexCtl.SaveAsDefaultFileName = sFileName;
  1214. RexCtl.SaveAsOption("xls",sFileOption);
  1215. RexCtl.SaveAsDialog(sFileOption);
  1216. }
  1217. if (rex_goRptMainParam.SaveEnd != null) {
  1218. try {
  1219. if (rex_goRptMainParam.get("rex_save_end") != null) {
  1220. rex_goRptMainParam.SaveEnd(sFileType, sFileName, rex_goRptMainParam.get("rex_save_end"));
  1221. }
  1222. } catch(e) {
  1223. //
  1224. }
  1225. }
  1226. }
  1227. }
  1228. }
  1229. </script>
  1230. <script LANGUAGE="JavaScript" FOR="RexCtl" EVENT="EndLoadReport">
  1231. //SaveAs([타입명], [저장 경로], [시작페이지], [끝페이지], [옵션리스트])
  1232. //RexCtl.SaveAs("xls", "c:\\test1.xls", 1, -1, "");
  1233. //RexCtl.SaveAs("rtf", "c:\\test.doc", 1, -1, "");
  1234. //RexCtl.SaveAsFilter = "doc";
  1235. //RexCtl.PrintEx2(true, 1, 1, 1, "printername=\\\\124.137.28.171\\HP LaserJet 4200 PCL 6");
  1236. //RexCtl.PrintEx2(false, 1, 1, 1, "printername=FinePrint");
  1237. //RexCtl.PrintEx2(false, 1, 1, 1, "hp LaserJet 1015");
  1238. //RexCtl.PrintEx2(false, 1, 1, 1, "printername=hp LaserJet 1015");
  1239. if (rex_goRptMainParam.get("rex_progress") != null &&
  1240. rex_goRptMainParam.get("rex_progress") == "true") {
  1241. fnCloseProgress();
  1242. }
  1243. if (rex_goRptMainParam.EndLoadEnd != null) {
  1244. try {
  1245. if (rex_goRptMainParam.get("rex_endload_end") != null) {
  1246. rex_goRptMainParam.EndLoadEnd(rex_goMainReport, rex_goMainDataSet, rex_goRptMainParam.get("rex_endload_end"));
  1247. }
  1248. } catch(e) {
  1249. //
  1250. }
  1251. }
  1252. fnSave();
  1253. if (rex_goRptMainParam.get("rex_print") != null) {
  1254. if (rex_goRptMainParam.get("rex_print") == "true" && rex_gsPrintStatus == "false") {
  1255. if (rex_goRptMainParam.get("rex_print_option") != null) {
  1256. RexCtl.PrintOption = rex_goRptMainParam.get("rex_print_option");
  1257. }
  1258. var bPrintDirect = rex_goRptMainParam.get("rex_printdirect");
  1259. if (bPrintDirect == "true") {
  1260. bPrintDirect = true;
  1261. } else {
  1262. bPrintDirect = false;
  1263. }
  1264. var sStartPage = rex_goRptMainParam.get("rex_print_startpage");
  1265. if (sStartPage == null) sStartPage = "1";
  1266. var sEndPage = rex_goRptMainParam.get("rex_print_endpage");
  1267. if (sEndPage == null) sEndPage = "-1";
  1268. var sCount = rex_goRptMainParam.get("rex_print_count");
  1269. if (sCount == null) sCount = "1";
  1270. var sPrintSkipZero = rex_goRptMainParam.get("rex_print_skipzero");
  1271. if (sPrintSkipZero == null) sPrintSkipZero = "false";
  1272. //if (sPrintSkipZero == "true" && rex_goMainDataSet.RowCount <= 0) {
  1273. if (sPrintSkipZero == "true" && giMainDataSetRowCount <= 0) {
  1274. // skip
  1275. } else {
  1276. if (rex_goRptMainParam.get("rex_print_printername") != null) {
  1277. RexCtl.PrintEx2(!bPrintDirect, parseInt(sStartPage), parseInt(sEndPage), parseInt(sCount),
  1278. "printername=" + rex_goRptMainParam.get("rex_print_printername"));
  1279. } else {
  1280. RexCtl.Print(!bPrintDirect, parseInt(sStartPage), parseInt(sEndPage), parseInt(sCount));
  1281. }
  1282. }
  1283. }
  1284. }
  1285. if (rex_goRptMainParam.get("rex_auto_next_page") != null) {
  1286. var iSec = parseInt(rex_goRptMainParam.get("rex_auto_next_page"));
  1287. window.setInterval("fnAutoNextPage();", iSec * 1000);
  1288. }
  1289. </script>
  1290. <script LANGUAGE="JavaScript" FOR="RexCtl" EVENT="FinishPrint">
  1291. if (rex_goRptMainParam.PrintEnd != null) {
  1292. try {
  1293. if (rex_goRptMainParam.get("rex_print_end") != null) {
  1294. rex_goRptMainParam.PrintEnd(rex_goMainReport, rex_goMainDataSet, giMainDataSetRowCount, rex_goRptMainParam.get("rex_print_end"), RexCtl);
  1295. }
  1296. } catch(e) {
  1297. //
  1298. }
  1299. }
  1300. if (rex_goRptMainParam.get("rex_print") != null) {
  1301. if (rex_goRptMainParam.get("rex_print") == "true") {
  1302. rex_gsPrintStatus = "true";
  1303. rex_goUserWindow.rex_gsPrintStatus = rex_gsPrintStatus;
  1304. }
  1305. }
  1306. //alert("출력이 완료 되었습니다.");
  1307. </script>
  1308. <!--script LANGUAGE="JavaScript" FOR="RexCtl" EVENT="HyperLinkClicked(bstrLink, bstrToolTip, vtCanceled)">
  1309. //window.open("http://www.naver.com", "", "center=yes,scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no,width=800,height=600");
  1310. alert(bstrLink);
  1311. vtCanceled = true;
  1312. if (rex_goRptMainParam.HyperLinkEnd != null) {
  1313. try {
  1314. if (rex_goRptMainParam.get("rex_hyperlink_end") != null) {
  1315. rex_goRptMainParam.HyperLinkEnd(rex_goMainReport, bstrLink, bstrToolTip, rex_goRptMainParam.get("rex_hyperlink_end"));
  1316. }
  1317. } catch(e) {
  1318. //alert(e);
  1319. }
  1320. }
  1321. </script -->
  1322. <script LANGUAGE="VBScript" FOR="RexCtl" EVENT="HyperLinkClicked(bstrLink, bstrToolTip, vtCanceled)">
  1323. ' Call window.open("http://www.naver.com", "", "center=yes,scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no,width=800,height=600")
  1324. vtCanceled = true
  1325. On Error Resume Next
  1326. If Not IsNull(rex_goRptMainParam.HyperLinkEnd) Then
  1327. If Not IsNull(rex_goRptMainParam.get("rex_hyperlink_end")) Then
  1328. Call rex_goRptMainParam.HyperLinkEnd(rex_goMainReport, bstrLink, bstrToolTip, rex_goRptMainParam.get("rex_hyperlink_end"))
  1329. End If
  1330. End If
  1331. Err.Clear
  1332. </script>
  1333. <script LANGUAGE="VBScript" FOR="RexCtl" EVENT="ButtonSaveAsClickBefore(Cancel)">
  1334. Dim sFileOption
  1335. If IsNull(rex_goRptMainParam.get("rex_save_file_option")) Then
  1336. sFileOption = ""
  1337. Else
  1338. sFileOption = rex_goRptMainParam.get("rex_save_file_option")
  1339. Call RexCtl.SaveAsOption("xls", sFileOption)
  1340. End If
  1341. If Not IsNull(rex_goRptMainParam.get("rex_save_file")) Then
  1342. RexCtl.SaveAsDefaultFileName = rex_goRptMainParam.get("rex_save_file")
  1343. End If
  1344. If Not IsNull(rex_goRptMainParam.get("rex_save_preview_direct")) Then
  1345. If rex_goRptMainParam.get("rex_save_preview_direct") = "true" Then
  1346. Cancel = true
  1347. Call rex_goRptMainParam.put("rex_save", "true")
  1348. Call fnSave()
  1349. End If
  1350. End If
  1351. </script>
  1352. <script LANGUAGE="JavaScript" >
  1353. var gnPageNo = 1;
  1354. function fnAutoNextPage()
  1355. {
  1356. if(gnPageNo == RexCtl.GetPageCount())
  1357. {
  1358. RexCtl.movefirstpage();
  1359. gnPageNo = 1;
  1360. }
  1361. else
  1362. {
  1363. RexCtl.movenextpage();
  1364. gnPageNo++;
  1365. }
  1366. }
  1367. </script>
  1368. <script LANGUAGE="JavaScript" FOR="RexCtl" EVENT="PrintBefore(PrinterName, StartPage, EndPage, Copies, Cancel)">
  1369. alert(PrinterName);
  1370. </script>
  1371. <script LANGUAGE="JavaScript" FOR="window" EVENT="onbeforeunload">
  1372. //RexCtl.CloseReport();
  1373. //alert("onfeforeunload");
  1374. </script>
  1375. </script>
  1376. </head>
  1377. <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" onload="OnLoad();" style="width:100%;height:100%">
  1378. <!--input type="text" id="idCnt"><br-->
  1379. <script src="./rexscript/rexplugin.js"></script>
  1380. <%
  1381. String rex_crypto = (request.getParameter("rex_crypto") == null ? "false" : request.getParameter("rex_crypto"));
  1382. String rex_crypto_plugin = (request.getParameter("rex_crypto_plugin") == null ? "" : request.getParameter("rex_crypto_plugin"));
  1383. if (rex_crypto.equals("true") && !rex_crypto_plugin.equals("")) {
  1384. %>
  1385. <script language="JavaScript" src="./rexscript/<%=rex_crypto_plugin%>"></script>
  1386. <% } %>
  1387. <!--script src="./rexscript/rex_addon.js"></script-->
  1388. </body>
  1389. </html>