/** * ÆÄ ÀÏ ¸í : SPADT61200.js * ¼³ ¸í : (ÆË¾÷)¿ø³»Ã³¹æÀüÃâ·Â Javascriot * ¼³ °è ÀÚ : °øµÎ°æ * ÀÛ ¼º ÀÚ : °øµÎ°æ * ¼öÁ¤ÀÌ·Â : 2007.10.2 / ÃÖÃÊÀÛ¼º / °øµÎ°æ */ /** * ÃʱâÈ­ */ function fInit() { var sParam = model.getAttribute("params"); model.makeValue("/root/send/prcpinfo/drugdd", astfMatrixData(sParam, 1, 0)); model.makeValue("/root/send/prcpinfo/drugno", astfMatrixData(sParam, 1, 1)); model.makeValue("/root/send/prcpinfo/ioflag", "O"); model.makeValue("/root/send/prcpinfo/pid", astfMatrixData(sParam, 1, 2)); model.makeValue("/root/send/prcpinfo/orddd", astfMatrixData(sParam, 1, 3)); model.makeValue("/root/send/prcpinfo/cretno", astfMatrixData(sParam, 1, 4)); model.makeValue("/root/send/prcpinfo/orddeptcd", astfMatrixData(sParam, 1, 5)); model.makeValue("/root/send/prcpinfo/prcpgenrflag", astfMatrixData(sParam, 1, 6)); model.makeValue("/root/send/prcpinfo/autoinprntyn", astfMatrixData(sParam, 1, 7)); model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 8)); model.makeValue("/root/send/prcpinfo/stocdeptcd", astfMatrixData(sParam, 1, 9)); // 2009.09.08 pymi model.makeValue("/root/send/prcpinfo/prntflag", "O"); model.refresh(); submit("TRADT61201"); //20101102 À̼±°æ ¼öÁ¤ : ÀÏÀϱâÁذú 1ȸ ±âÁØÀÇ ¿ë·®°ú ¼ö·®À» º¸¿©ÁÖ´Â °ÍÀ» °áÁ¤ÇÏ¿© °á°ú¸¦ ¸®ÅÏ var colHidnValue = grdBaseColHidn("D"); //1ȸ ±âÁØ if( colHidnValue == "C") { model.makeValue("/root/main/prcpdata/patinfo/prcpqty2chk", "Y"); } if(model.getValue("/root/main/prcpdata/patinfo/pid") != ""){ // 20100202_laboru_RFADT61200 ¸®Æ÷Æ®¿¡¼­ memo ÀÇ °¡·Î Å©±â¸¦ ´ÃÀÌ·Á¸é ¾Æ·¡ ¼öÄ¡ º¯°æ ÇÊ¿ä. var memo = model.getValue("/root/main/prcpdata/patinfo/memo"); var memoCnt = 0; var lineCnt = 0; var pageCnt = 0; var strMemo = ""; var tempStr = ""; var tempStr2 = ""; var nextMemo = ""; var strFlag = "N"; if ( memo.indexOf("\n", lineCnt ) >=0){ while ( (memoCnt = memo.indexOf("\n", lineCnt ))>=0){ if( pageCnt < 3) { if (lineCnt == 0) { strMemo = strMemo + memo.substring( lineCnt, memoCnt ); if(getByteLength(strMemo) > 78 && getByteLength(strMemo) <= 157) { pageCnt++; } else if(getByteLength(strMemo) > 157 && getByteLength(strMemo) <= 239) { pageCnt = pageCnt + 2; } else if(getByteLength(strMemo) > 239 ) { pageCnt = 100; strFlag = "1"; } } else { tempStr = memo.substring( lineCnt, memoCnt ) ; if(pageCnt > 1) { if(getByteLength(tempStr) > 74 ) { if(memo.indexOf("\n", memoCnt + 1 ) < 0 ) { pageCnt = 100; strFlag = "2"; } else { strMemo = strMemo + "\n" + fnGetByte(tempStr,0, 74); nextMemo = fnGetByte(tempStr, 74, getByteLength(tempStr)) + "\n"; } } else if(getByteLength(tempStr) <= 74) { strMemo = strMemo + "\n" + memo.substring( lineCnt, memoCnt ) ; } } else { if(getByteLength(tempStr) <= 78) { strMemo = strMemo + "\n" + memo.substring( lineCnt, memoCnt ) ; } else if(getByteLength(tempStr) > 78 && getByteLength(tempStr) <= 155) { strMemo = strMemo + "\n" + memo.substring( lineCnt, memoCnt ) ; pageCnt++; } else if(getByteLength(tempStr) > 155) { strMemo = strMemo + "\n" + fnGetByte(tempStr,0, 155); nextMemo = fnGetByte(tempStr, 155, getByteLength(tempStr)) ; pageCnt = pageCnt +2; } } } } else { if (pageCnt == 3) { nextMemo = nextMemo + memo.substring( lineCnt, memoCnt ); } else if(pageCnt > 3 && pageCnt < 10) { nextMemo = nextMemo + "\n" + memo.substring( lineCnt, memoCnt ) ; } } lineCnt = memoCnt + 1; pageCnt++; } if(strFlag == "1") { strMemo = fnGetByte(memo,0, 239); nextMemo = fnGetByte(memo, 239, getByteLength(memo)); } else if(strFlag == "2") { var line2temp = memo.substring( lineCnt, memo.length ); strMemo = strMemo + "\n" + fnGetByte(tempStr,0, 78); nextMemo = fnGetByte(tempStr, 78, getByteLength(tempStr)); nextMemo = nextMemo + "\n" + line2temp; } else if(strFlag == "3") { strMemo = strMemo + "\n" + tempStr.substring(0, 40); nextMemo = tempStr.substring(40, 500); nextMemo = nextMemo + "\n" + memo.substring(lineCnt,500); } else if(strFlag == "N") { if ( (lineCnt < memo.length) ) { nextMemo = nextMemo + "\n" + memo.substring( lineCnt, memo.length ); } } } else { strMemo = memo; } model.setValue("/root/main/prcpdata/patinfo/memo", strMemo); model.makeValue("/root/main/prcpdata/patinfo/memo1", nextMemo); //ó¹æÀü¿¡ DURÀÌ Á¸ÀçÇϸé RFADT61203 Á¸ÀçÇÏÁö ¾ÊÀ¸¸é RFADT61200 Ãâ·Â var resn = model.getValue("/root/main/prcpdata/resn/resnnm"); //alert(resn); // 20101106_wify_°æºÏ´ëº´¿ø_ÁֹιøÈ£ µÞÀÚ¸® º°Ç¥ ó¸® var rrgstno = model.getValue("/root/main/prcpdata/patinfo/rrgstno").split("-"); model.setValue("/root/main/prcpdata/patinfo/rrgstno", rrgstno[0] + "-" + rrgstno[1].substring(0, 1) + "******"); // 20101117_wify_°æºÏ´ëº´¿ø_º¸°í¼­Æû º¯°æ ó¸® // RFADT61200 ==> RFADT61204 // RFADT61201 ==> RFADT61207 // RFADT61203 ==> RFADT61206 if( resn == ""){ if ( nextMemo != "") { if(pageCnt >= 3) { makeReportPreview(0,0,10, 10, "grp_report1"); exeReportPreview("RFADT61204", "XMLSTR","","","true","","","","","","","grp_report1"); makeReportPreview(0,0,10, 10, "grp_report2"); exeReportPreview("RFADT61207", "XMLSTR","","","true","","","","","","","grp_report2"); } else { strMemo = strMemo + nextMemo; model.setValue("/root/main/prcpdata/patinfo/memo", strMemo); makeReportPreview(0,0,10, 10, "grp_report1"); exeReportPreview("RFADT61204", "XMLSTR","","","true","","","","","","","grp_report1"); } } else { makeReportPreview(0,0,10, 10); exeReportPreview("RFADT61204", "XMLSTR", "", "", "true","","","","","true"); } }else{ if ( nextMemo != "") { if(pageCnt >= 3) { makeReportPreview(0,0,10, 10, "grp_report1"); exeReportPreview("RFADT61206", "XMLSTR","","","true","","","","","","","grp_report1"); makeReportPreview(0,0,10, 10, "grp_report2"); exeReportPreview("RFADT61207", "XMLSTR","","","true","","","","","","","grp_report2"); } else { strMemo = strMemo + nextMemo; model.setValue("/root/main/prcpdata/patinfo/memo", strMemo); makeReportPreview(0,0,10, 10, "grp_report1"); exeReportPreview("RFADT61206", "XMLSTR","","","true","","","","","","","grp_report1"); } } else { makeReportPreview(0,0,10, 10); exeReportPreview("RFADT61206", "XMLSTR", "", "", "true","","","","","true"); } } } else { window.close(); } model.refresh(); window.close(); } /* // 20100202_laboru_¾à»ç¸Þ¸ð byte */ function getByteLength(str) { var byteLength = 0; for (inx = 0; inx < str.length; inx++) { var oneChar = escape(str.charAt(inx)); if ( oneChar.length == 1 ) { byteLength ++; } else if (oneChar.indexOf("%u") != -1) { byteLength += 2; } else if (oneChar.indexOf("%") != -1) { byteLength += oneChar.length/3; } } return byteLength; } /* // 20100202_laboru_¹®ÀÚ¿­ byte ´ÜÀ§·Î Àß¶ó¿À±â */ function fnGetByte(strInput, slimit, ilimit){ var i; var j; var strLen; var strByte = 0; var strRes = ""; var com = Number(ilimit) - Number(slimit); strLen = strInput.length; var tmp = strInput.charAt(i); var index = 0; for(var p = 0; p < strLen ; p++) { var tmp = strInput.charAt(p); if(tmp >= ' ' && tmp <= '~' ){ strByte++; }else{ strByte += 2; } if(strByte > Number(slimit)){ index = p; break; } } for(i=index, j=0, strByte=0; j< strLen; j++, i++) { var tmp = strInput.charAt(i); if(tmp >= ' ' && tmp <= '~' ){ strByte++; }else{ strByte += 2; } if(strByte > Number(com)){ break; } strRes += tmp; } return strRes; }