123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 |
- /**
- * @desc : 화면 초기화
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fInitialize(){
- model.removeNodeset("/root/main/unprepmngt/unprepsublist");
- model.refresh();
- grd_unpreplist.mergecells = "byrestriccol";
- for ( var i = 3 ; i <20; i++) {
- grd_unpreplist.mergecol(i)=false;
- }
- submit("TRMRI02001");
- fItemCheck();
- }
- /**
- * @desc : sort 넘버 지정
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fSetSortNo(){
-
- /*var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
- if(curRow < 0){
- return;
- } */
-
- for(var j = grd_unpreplist.fixedRows; j < grd_unpreplist.rows; j++){
-
- model.setValue("/root/main/unprep/list["+ j +"]/sortno",j);
- model.setValue("/root/main/unprep/list["+ j +"]/jobposflag", -1);
- grd_unpreplist.rowStatus(j) = 1;
- } //end for
-
- model.makeValue("/root/temp/addflag","1");
- }
- /**
- * @desc : 아이템 체크
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fItemCheck(){
-
- /*var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
- if(curRow < 0){
- return;
- } */
-
- var fromdd;
- var todd;
- for(var j = grd_unpreplist.fixedRows; j < grd_unpreplist.rows; j++){
-
- fromdd = model.getValue("/root/main/unprep/list["+ j +"]/unprepbasefromdd");
- todd = model.getValue("/root/main/unprep/list["+ j +"]/unprepbasetodd");
-
- if(todd > getCurrentDate()){
- model.setValue("/root/main/unprep/list["+ j +"]/check", "true");
- }
- } //end for
-
- }
- /**
- * @desc : check된 미비 기준 표시
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fSetUnprepCheck(){
-
- //미비기준마스터테이블에서 가져온 데이터로 check표시
- var nodeList = model.instances(0).selectNodes("/root/main/unprep/templist");
- for(var i = 0; i < nodeList.length; i++)
- {
- var itemsNode = nodeList.item(i);
- var unprepitemcd = itemsNode.selectSingleNode("unprepitemcd").text;
- var degnitemlevlcd = itemsNode.selectSingleNode("degnitemlevlcd").text;
- var unprepbasefromdd = itemsNode.selectSingleNode("unprepbasefromdd").text;
- var unprepbasetodd = itemsNode.selectSingleNode("unprepbasetodd").text;
- var sortno = itemsNode.selectSingleNode("sortno").text;
- var jobposflag = itemsNode.selectSingleNode("jobposflag").text;
- var formcd = itemsNode.selectSingleNode("formcd").text;
- //alert(unprepitemcd+"-" + degnitemno +"-");
- model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/check", "true");
- model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/selectflag", "Y");
- model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/unprepbasefromdd", unprepbasefromdd);
- model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/unprepbasetodd", unprepbasetodd);
- model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/sortno", sortno);
- model.setValue("/root/main/unprep/list[ formcd = '"+ formcd + "' and unprepitemcd = '"+ unprepitemcd + "' and degnitemlevlcd = '" + degnitemlevlcd + "' ]/jobposflag", jobposflag);
-
- }
- grd_unpreplist.clearStatus();
- model.refresh();
-
- }
- /**
- * @desc : aa
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function aa(){
- var iRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
- var check = model.getValue("/root/main/unprep/list[" + iRow + "]/check");
- alert(check +"=="+ grd_unpreplist.col);
- }
- /**
- * @desc : 열 상태 확인
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fRowStatusCheck(){
- var iRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
-
- var check = model.getValue("/root/main/unprep/list[" + iRow + "]/check");
- var setdd = model.getValue("/root/main/unprep/list[" + iRow + "]/setdd");
- var todd = model.getValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd");
- var stat = grd_unpreplist.rowStatus(iRow);
- var addflag = model.getValue("/root/temp/addflag");
-
- if(addflag != "1"){
-
- // selectflag "N" 미비기준마스터테이블에 없는경우 , "Y" 조회된경우
- if(check == "true" && setdd == "" ){
- grd_unpreplist.rowStatus(iRow) = 2;
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , getCurrentDate());
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
- model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
- // alert(1);
- }
- // 종료일자 지난경우
- if(check == "true" && setdd != "" && (todd <= getCurrentDate() )){
- //grd_unpreplist.rowStatus(iRow) = 0;
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
- model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
- // alert(2);
- }else if(check == "true" && setdd != "" ){
- grd_unpreplist.rowStatus(iRow) = 0;
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
- model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
- // alert(3);
- }
- if(check == "false" && setdd == ""){
- grd_unpreplist.rowStatus(iRow) = 0;
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , "");
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "");
- model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "");
- // alert(4);
- }
- if(check == "false" && setdd != ""){
- grd_unpreplist.rowStatus(iRow) = 4;
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd" , getCurrentDate());
- // alert(5);
- }
- }else if(addflag == "1"){
-
- if(check == "true"){
- fromdd = model.getValue("/root/main/unprep/list["+ iRow +"]/unprepbasefromdd");
- todd = model.getValue("/root/main/unprep/list["+ iRow +"]/unprepbasetodd");
- //alert(fromdd+"=="+todd);
- if(fromdd =="" && todd =="" ){
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , getCurrentDate());
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd", "29991231");
- model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
- }
- }
- }
- }
- /**
- * @desc : 그리드 상태 변경시 check
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fGridValueChng(){
- var iRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
- var setdd = model.getValue("/root/main/unprep/list[" + iRow + "]/setdd");
- var check = model.getValue("/root/main/unprep/list[" + iRow + "]/check");
-
- if( setdd == "" && check =="false"){
-
- model.setValue("/root/main/unprep/list[" + iRow + "]/check","true");
- if(model.getValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd").getTrim() == ""){
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasefromdd" , getCurrentDate());
- }
-
- if(model.getValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd").getTrim() == ""){
- model.setValue("/root/main/unprep/list[" + iRow + "]/unprepbasetodd" ,"29991231");
- }
-
- model.setValue("/root/main/unprep/list[" + iRow + "]/jobposflag", "3");
- }
- }
- /**
- * @desc : 미비리스트 저장
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fSaveUnprepBase(){
-
- model.setValue("/root/send/savebase",grd_unpreplist.getUpdateData());
- model.removeNodeSet("/root/temp/unprepitem");
- var CSV = model.getValue("/root/send/savebase");
- model.makeNode("/root/temp/unprepitem");
- if(CSV != ""){
- setCSVToNode("/root/temp/unprepitem", CSV, "templist");
- }
- var nodeList = model.instances(0).selectNodes("/root/temp/unprepitem/templist");
- var iRow;
- var sTmp ="";
- var flag = false;
-
- if(nodeList.length == 0)
- return;
- for(var i = 0; i < nodeList.length; i++)
- {
- var itemsNode = nodeList.item(i);
- sTmp = itemsNode.selectSingleNode("unprepitemnm").text;
- if(sTmp.getTrim() ==""){
- messageBox("항목명칭을 ", "C001");
- flag = true;
- break;
- }
- }
-
- if(flag)
- return;
- model.makeValue("/root/temp/addflag",""); //서식추가, 항목추가 구분 flag
- submit("TXMRI02001");
- fItemCheck();
- }
-
- /**
- * @desc : 미비항목 한줄 추가
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fUnprepaddRow(){
- var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
- if(curRow < 0){
- messageBox("항목을 추가할 행을 ","C002");
- return;
- }
- var iRow = grd_unpreplist.row;
- grd_unpreplist.insertRow(iRow ,"below");
-
- var iRow1 = grd_unpreplist.row;
- var formcd = model.getValue("/root/main/unprep/list["+ iRow +"]/formcd");
- var formnm = model.getValue("/root/main/unprep/list["+ iRow +"]/formnm");
-
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/formcd", formcd);
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/formnm", formnm);
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/degnitemlevlcd", "0");
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/degnitemcd", "0");
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/sortno", "0");
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/check", "true");
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/unprepbasefromdd" , getCurrentDate());
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/unprepbasetodd", "29991231");
- model.setValue("/root/main/unprep/list[" + iRow1 +"]/jobposflag", "3");
- model.makeValue("/root/temp/addflag","1");
- model.refresh();
-
- }
- /**
- * @desc : 미비서식 한줄 추가
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fAddUnprepForm(){
- var CSV = model.getValue("/root/temp/unprepmngt");
- if(CSV != ""){
- setCSVToNode("/root/temp/unprepmngt", CSV, "unprepsublist");
- var formcd = model.getValue("/root/temp/unprepmngt/unprepsublist/formcd");
- var tmp = model.getValue("/root/main/unprep/list[ formcd = '" + formcd+ "']/formcd");
-
- if(tmp == ""){
-
- var formcd = model.getValue("/root/temp/unprepmngt/unprepsublist/formcd");
- model.makeValue("/root/send/reqdata/formcd", formcd);
- submit("TRMRI02002");
-
- fAddRow();
- fSetSortNo();
- }
- }
- }
- /**
- * @desc : 미비항목 없는경우(동의서)
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fAddRow(){
-
- var node = instance1.selectNodes("/root/main/unprep/list");
-
- if(node.length == 0 ){
- grd_unpreplist.addRow(false);
- var formcd = model.getValue("/root/temp/unprepmngt/unprepsublist/formcd");
- var formnm = model.getValue("/root/temp/unprepmngt/unprepsublist/formnm");
-
- model.setValue("/root/main/unprep/list["+ 1 +"]/formcd", formcd);
- model.setValue("/root/main/unprep/list["+ 1 +"]/formnm", formnm);
- model.refresh();
- }
- }
- /**
- * @desc : 엑셀 저장
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fSaveExcel(){
- var fileName = window.fileDialog("save", ",", false, "excel", "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
- if (fileName != "")
- {
- grd_unpreplist.saveExcel(fileName, "SheetName", true, true, "", "", "false");
- }
- }
- /**
- * @---------------------------------------------------
- * @desc : 문자열 앞뒤에있는 공백 제거
- * @param : N/A
- * @return : 공백을 제거한 결과 문자열
- * @---------------------------------------------------
- */
- String.prototype.getTrim = function()
- {
- var startPoint = 0; // subString 하기 위한 시작 포인트
- var endPoint = this.length; // subString 하기 위한 끝 포인트
- //문자열앞에 공백문자가 들어 있는 Index 추출
- while( (startPoint < endPoint) && (this.charCodeAt(startPoint) == 32) )
- {
- startPoint++;
- }
- //문자열뒤에 공백문자가 들어 있는 Index 추출
- while( (startPoint < endPoint) && (this.charCodeAt(endPoint-1) == 32) )
- {
- endPoint--;
- }
- // 공백을 제거했으면 subString하여 결과문자열을 리턴하고 제거한 내용이 없으면 그대로 리턴
- return ( (startPoint > 0) || (endPoint < this.length) ) ? this.substring(startPoint, endPoint) : this;
- }
-
- /**
- * @desc : 공통미비항목 한줄 추가
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fCommflagAddRow(){
- model.removeNodeset("/root/main/unprep/list");
- model.refresh();
- grd_unpreplist.addRow();
-
- var iRow = grd_unpreplist.row;
-
- model.setValue("/root/main/unprep/list[" + iRow +"]/formcd", "-");
- model.setValue("/root/main/unprep/list[" + iRow +"]/formnm", "-");
- model.setValue("/root/main/unprep/list[" + iRow +"]/degnitemlevlcd", "0");
- model.setValue("/root/main/unprep/list[" + iRow +"]/degnitemcd", "0");
- model.setValue("/root/main/unprep/list[" + iRow +"]/sortno", "0");
- model.setValue("/root/main/unprep/list[" + iRow +"]/check", "true");
- model.setValue("/root/main/unprep/list[" + iRow +"]/commflag", "true");
- model.setValue("/root/main/unprep/list[" + iRow +"]/unprepbasefromdd" , getCurrentDate());
- model.setValue("/root/main/unprep/list[" + iRow +"]/unprepbasetodd", "29991231");
- model.setValue("/root/main/unprep/list[" + iRow +"]/jobposflag", "3");
- model.makeValue("/root/temp/addflag","1");
- model.refresh();
-
- }
- /**
- * @desc : 미비항목 한줄삭제
- * @
- * @param :
- * @return :
- * @author : HIT EMR Team
- * @---------------------------------------------------
- */
- function fDelUnprepRow(){
-
- var curRow = grd_unpreplist.row - grd_unpreplist.fixedRows + 1;
-
- if(curRow < 1){
- alert("삭제할 아이템을 선택하세요");
- return;
- }
-
- var useYN = messageBox("선택된 미비기준을 삭제 ", "S001");
-
- if(useYN == 6 ){
-
- model.makeValue("/root/send/savedata/unprepitemcd", model.getValue("/root/main/unprep/list[" + curRow + "]/unprepitemcd"));
- model.makeValue("/root/send/savedata/total", model.getValue("/root/send/reqdata/total"));
-
- submit("TXMRI02002");
- }
- }
|