123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- /* ---------------------------------------------------------------------
- Count List 관리 (SMMNP00320_CountList관리.xrw - JScript )
- - Version :
- 1) : Ver.1.00.01
- : Create By taebum
- : 2008-11-21 오전 10:05:51
- ---------------------------------------------------------------------- */
- /* --------------------------------------------------*/
- /* type : function */
- /* access : public */
- /* desc : xforms-ready시 수행한다 */
- /* return : */
- /* --------------------------------------------------*/
- function fInit() {
- model.removeNodeSet("/root/main/countlists/countlist");
- datagrid1.refresh();
- //대분류 코드 로딩
- fGetCdList("Lrg");
- addComboItem( "combo1", "전체", "%", "above" );
- model.setValue("/root/hidden/condition/lrgclscd","%");
- combo1.refresh();
- addComboItem( "combo2", "전체", "%", "above" );
- model.setValue("/root/hidden/condition/kindcd","%");
- combo2.refresh();
- }
- /**
- * 분류코드 조회
- */
- function fGetCdList(pFlag){
- var sSubmitNm = "";
- switch(pFlag){
- case "Lrg" :
- model.removeNodeSet("/root/init/combolists/lrgcombolists/lrgcombo");
- sSubmitNm = "TRMNP00320";
- break;
- case "Kind" :
- var sLrgclscd = model.getValue("/root/hidden/condition/lrgclscd");
- var sLrgArr = sLrgclscd.split(",");
- if(combo1.selectedIndex == 1 || sLrgclscd == "%" ) {
- //instrument 또는 전체
- model.removeNodeSet("/root/init/combolists/kindcombolists/kindcombo");
- addComboItem( "combo2", "전체", "%", "above" );
- model.setValue("/root/hidden/condition/kindcd","%");
- combo2.refresh();
- return;
- }
- model.removeNodeSet("/root/init/combolists/kindcombolists/kindcombo");
- model.setValue("/root/send/lrgclscd", sLrgArr[0]);
- model.setValue("/root/send/codenm1", model.getValue("/root/init/combolists/lrgcombolists/lrgcombo["+(combo1.selectedIndex+1)+"]/nm"));
- sSubmitNm = "TRMNP00321";
- break;
- default :
- break;
- }
- if(sSubmitNm != ""){
- model.setValue("/root/send/temp","temp");
- submit(sSubmitNm);
- }
- }
- /**
- * Combo값 변경시 이벤트
- */
- function fValueChangedCombo(pFlag){
- switch(pFlag){
- case "Lrg" :
- if(model.getValue("/root/hidden/condition/lrgclscd") != "%"){
- //종류코드 리스트 조회
- fGetCdList("Kind");
- addComboItem( "combo2", "전체", "%", "above" );
- model.setValue("/root/hidden/condition/kindcd","%");
- combo2.refresh();
- }else{
- model.removeNodeSet("/root/init/combolists/kindcombolists/kindcombo");
- addComboItem( "combo2", "전체", "%", "above" );
- model.setValue("/root/hidden/condition/kindcd","%");
- combo2.refresh();
- fSelectCodeList();
- }
- break;
- case "Kind" :
- fSelectCodeList();
- break;
- default :
- break;
- }
- }
- /**
- * Count List 등록 내역 조회
- *
- */
- function fSelectCodeList(){
- model.setValue("/root/send/lrgclscd", model.getValue("/root/hidden/condition/lrgclscd"));
- model.setValue("/root/send/kindcd" , model.getValue("/root/hidden/condition/kindcd"));
- model.setValue("/root/send/codenm1" , model.getValue("/root/init/combolists/lrgcombolists/lrgcombo["+(combo1.selectedIndex+1)+"]/nm"));
- model.setValue("/root/send/codenm2" , model.getValue("/root/init/combolists/kindcombolists/kindcombo["+(combo2.selectedIndex+1)+"]/nm"));
- model.setValue("/root/send/frcd" , model.getValue("/root/hidden/condition/kindcd"));
- model.setValue("/root/send/tocd" , model.getValue("/root/init/combolists/kindcombolists/kindcombo["+(combo2.selectedIndex+1)+"]/cd2"));
- submit("TRMNP00322");
- }
- /**
- * 그리드 행추가 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickRowAddBtn(){
- var lrgclscd = model.getValue("/root/hidden/condition/lrgclscd");
- var kindcd = model.getValue("/root/hidden/condition/kindcd");
- if( lrgclscd == ""||lrgclscd == "%" ) {
- //-----------(20100811 경북대)
- //기존소스
- // messageBox("대분류를 선택하셔야 합니다.!", "E000");
- // model.setFocus("combo1");
- // return;
- messageBox("대분류를 선택되지 않았습니다. 대분류정보를 입력하십시오.!", "E000");
- //-----------(20100811 경북대)
- }
- if( kindcd == ""||kindcd == "%" ) {
- //-----------(20100811 경북대)
- //기존소스
- // messageBox("중분류를 선택하셔야 합니다.!", "E000");
- // model.setFocus("combo2");
- // return;
- messageBox("중분류를 선택되지 않았습니다. 중분류정보를 입력하십시오.!", "E000");
- //-----------(20100811 경북대)
- }
- var orglrgclscd = model.getValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/org_lrgclscd");
- if( orglrgclscd != "" ) {
- model.setValue("/root/send/lrgclscd", model.getValue("/root/hidden/condition/lrgclscd").substring(0,2));
- submit("TRMNP00325", false);
- datagrid1.addRow(); // 입력할 행 추가.
- //---(20100811 경북대)
- if (lrgclscd == ""||lrgclscd == "%") lrgclscd = '01';
- //---(20100811 경북대)
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/lrgclscd", lrgclscd.substring(0,2));
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/codenm1", combo1.label);
- if( !(kindcd == ""||kindcd == "%") ){
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/codenm2", combo2.label);
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/kindcd", model.getValue("/root/temp/kindcdinfo/maxkindcd"));
- }
- }else {
- datagrid1.addRow(); // 입력할 행 추가.
- //---(20100811 경북대)
- // model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/lrgclscd", lrgclscd.substring(0,2));
- if (lrgclscd == ""||lrgclscd == "%") lrgclscd = '01';
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/lrgclscd", lrgclscd.substring(0,2));
- //---(20100811 경북대)
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/codenm1", combo1.label);
- if( !(kindcd == ""||kindcd == "%") ){
- var tmpkindcd = eval(model.getValue("/root/main/countlists/countlist[" + (datagrid1.rows-2) + "]/kindcd"))+1;
- if( tmpkindcd < 10 ) {//10보다 작으면 0을 붙여준다.
- tmpkindcd = "0" + tmpkindcd;
- }
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/codenm2", combo2.label);
- model.setValue("/root/main/countlists/countlist[" + (datagrid1.rows-1) + "]/kindcd", tmpkindcd);
- }
- }
- model.refresh();
- //datagrid1.row = cur_row;
- //datagrid1.select(cur_row, 4) = true;
- //datagrid1.editcell();
- }
- /**
- * 삭제 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickDeleteBtn(){
- var cur_row = datagrid1.row; // 행 번호 가져오기
- var iStatus = datagrid1.rowstatus(cur_row);
- if(cur_row <= 0 || cur_row =="undefined") {
- alert("삭제할 행을 선택하시기 바랍니다...");
- return;
- }
- var org_sCodenm1 = model.getValue("/root/main/countlists/countlist["+cur_row+"]/org_codenm1");
- var org_sCodenm2 = model.getValue("/root/main/countlists/countlist["+cur_row+"]/org_codenm2");
- var org_sCodenm3 = model.getValue("/root/main/countlists/countlist["+cur_row+"]/org_codenm3");
- if(org_sCodenm1 == "INSTRUMENT" && org_sCodenm2 == "INSTRUMENT"
- && org_sCodenm3 == "INSTRUMENT"){
- messageBox("INSTRUMENT는 기본항목으로 삭제할 수 없습니다.", "I000");
- }
- if (iStatus == 1 || iStatus == 3){ // 새로 삽입된 행이면
- datagrid1.deleteitem(cur_row);
- }else if (iStatus == 4){ // 삭제로 표시된 행이면
- datagrid1.removestatus(cur_row, "delete");
- }else{
- datagrid1.addStatus(cur_row, "delete");
- }
- }
- /*
- * 저장 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fOnClickSaveBtn(){
- if(!checkGridUpdate(datagrid1)){
- alert("저장할 자료가 존재하지 않습니다.");
- return;
- }
- var kindcd = model.getValue("/root/hidden/condition/kindcd");
- var indexnum = combo2.selectedIndex;
- if(checkGridField(datagrid1,"codenm1▦kindcd▦codenm2▦codenm3▦refseq")==false){
- alert("데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- model.setValue("/root/send/listdata",datagrid1.getUpdateData());
- if ( submit("TXMNP00320") ) {
- //datagrid1.clearStatus(); // submit() 성공하면 그리드의 i,u,d 상태 제거
- fValueChangedCombo("Lrg");
- model.setValue("/root/hidden/condition/kindcd",kindcd);
- combo2.select(indexnum);
- fSelectCodeList();
- }
- }
- /**
- * @group :
- * @ver : 2006.12.20
- * @by :
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc :
- * @return : bool
- * @---------------------------------------------------
- */
- function checkGridUpdate(grid)
- {
- var iData = grid.getUpdateDataXml("insert");
- var uData = grid.getUpdateDataXml("update");
- var dData = grid.getUpdateDataXml("delete");
- if (iData=="" && uData=="" && dData=="") return false;
- else return true;
- }
- /**
- * @group :
- * @ver : 2006.12.20
- * @by :
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc :
- * @return : bool
- * @---------------------------------------------------
- */
- function checkGridField(grid, field){
- var nodeset = grid.nodeset;
- var iStatus;
- //var iData = grid.getUpdateDataXml("insert");
- for (i=grid.fixedRows; i<grid.rows; i++){
- iStatus = grid.rowstatus(i);
- if (iStatus == 1 || iStatus == 3){
- var fieldArr = field.split("▦");
- if(fieldArr.length < 1){
- return false;
- }
- for(var j = 0; j < fieldArr.length; j++){
- if(fieldArr[j] == null || fieldArr[j] == "" || fieldArr[j] == "undefined"){
- continue;
- }
- if(model.getValue(nodeset+"["+i+"]/"+fieldArr[j])=="") return false;
- }
- }
- }
- return true;
- }
|