/* ¾à¹°°è»ê½Ä°ü¸®(SMMNR02200.xfm - JScript ) - Version : 1) : Ver.1.00.01 */ var xItemListPath = "/root/main/iteminfo/itemlist"; // SET ±×·ì Á¤º¸ var xElmtListPath = "/root/main/elmtinfo/elmtlist"; // SET Áø¼ú¹® Á¤º¸ /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : È­¸é ÃʱâÈ­ * @param : pFlag * @return : * @--------------------------------------------------- */ function fInitialize(){ model.removenodeset(xItemListPath); model.removenodeset(xElmtListPath); fSrchItemList("item"); model.refresh(); } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : ±×¸®µå ÆË¾÷¸Þ´º SETTING * @param : pFlag * @return : * @--------------------------------------------------- */ function fSettingPopUpMenu(pFlag){ if(event.button == 3){ switch(pFlag){ case "item" : if(grd_itemlist.isCell(event.target) && grd_itemlist.mouseRow >= 0){ window.setPopupMenu(true, "/root/temp/popmenu/iteminfo/menu", "name", "func", false); }else{ window.setPopupMenu(false); } break; case "elmt" : if(grd_elmtlist.isCell(event.target) && grd_elmtlist.mouseRow >= 0){ window.setPopupMenu(true, "/root/temp/popmenu/elmtinfo/menu", "name", "func", false); }else{ window.setPopupMenu(false); } break; } } } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : Ç׸ñ Ãß°¡ * @param : * @return : * @--------------------------------------------------- */ function fAddItem(){ grd_itemlist.addRow(); var iRow = grd_itemlist.rows - grd_itemlist.fixedrows; model.setValue(xItemListPath+"["+iRow+"]/supcd","*"); model.setValue(xItemListPath+"["+iRow+"]/refseq",0); } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : Ç׸ñ »èÁ¦ * @param : * @return : * @--------------------------------------------------- */ function fDelItem(){ var iRow = grd_itemlist.row; if(iRow < 1) return; var sStatus = grd_itemlist.rowstatus(iRow); if(sStatus != 2 && sStatus != 4){ grd_itemlist.deleteItem(iRow); }else{ grd_itemlist.rowstatus(iRow) = 4; } } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : ¿ä¼Ò Ãß°¡ * @param : * @return : * @--------------------------------------------------- */ function fAddElmt(){ var iItemRow = grd_itemlist.row; if(iItemRow<1){ messageBox("Ç׸ñÀ» ¸ÕÀú","C002"); return; } var sItemCD = model.getValue(xItemListPath+"["+iItemRow+"]/itemcd"); if(sItemCD == ""){ messageBox( "°è»êÇ׸ñÀ» ¸ÕÀú ÀúÀåÇØ¾ß ÇÕ´Ï´Ù. ¿ä¼Ò¸¦ Ãß°¡ÇÒ ¼ö", "I004"); return; } grd_elmtlist.addRow(); var iRow = grd_elmtlist.rows - grd_elmtlist.fixedrows; model.setValue(xElmtListPath+"["+iRow+"]/supcd",sItemCD); model.setValue(xElmtListPath+"["+iRow+"]/refseq",0); } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : ¿ä¼Ò »èÁ¦ * @param : * @return : * @--------------------------------------------------- */ function fDelElmt(){ var iRow = grd_elmtlist.row; if(iRow < 1) return; var sStatus = grd_elmtlist.rowstatus(iRow); if(sStatus == 1 || sStatus == 3){ grd_elmtlist.deleteItem(iRow); }else{ grd_elmtlist.rowstatus(iRow) = 4; } } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : Ç׸ñ Á¶È¸ * @param : pFlag (item : Ç׸ñ, elmt : ¿ä¼Ò) * @return : * @--------------------------------------------------- */ function fSrchItemList(pFlag){ model.removenode("/root/send"); if(pFlag == "item"){ model.removenodeset(xElmtListPath); grd_elmtlist.rebuild(); model.makeValue("/root/send/supcd","*"); if(submit("TRMNR02201")){ model.setValue("/root/main/itemcalform",""); tar_calform.refresh(); } }else{ var iRow = grd_itemlist.row; var sItemCD = model.getValue(xItemListPath+"["+iRow+"]/itemcd"); if(sItemCD == ""){ model.removenodeset(xElmtListPath); grd_elmtlist.rebuild(); return; } model.makeValue("/root/send/supcd",model.getValue(xItemListPath+"["+iRow+"]/itemcd")); if(submit("TRMNR02202")){ model.setValue("/root/main/itemcalform",model.getValue(xItemListPath+"["+iRow+"]/calform")); model.refresh(); } } } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : Ç׸ñ ÀúÀå * @param : pFlag (item : Ç׸ñ, elmt : ¿ä¼Ò) * @return : * @--------------------------------------------------- */ function fSaveItemList(pFlag){ model.removenode("/root/send"); switch(pFlag){ case "item" : if(fChkItemInfo(pFlag)) return; model.makeValue("/root/send/itemlist", grd_itemlist.getUpdateData()); model.makeValue("/root/send/supcd","*"); submit("TXMNR02201"); break; case "elmt" : var iItemRow = grd_itemlist.row; var sItemCD = model.getValue(xItemListPath+"["+iItemRow+"]/itemcd"); var sStatus = grd_itemlist.rowstatus(iItemRow); var iElmtStatus = 0; if(sStatus == 1 || sStatus == 3){ messageBox( "°è»êÇ׸ñÀ» ¸ÕÀú ÀúÀåÇØ¾ß ÇÕ´Ï´Ù. ¿ä¼Ò ÀúÀåÀ» ÇÒ ¼ö", "I004"); return; } var sItemCalForm = model.getValue("/root/main/itemcalform"); // °è»ê½Ä °ËÁõ var sTmpItemCalForm = sItemCalForm; var sElmtNM = ""; for(var iRow=grd_elmtlist.fixedrows; iRow<= grd_elmtlist.rows-grd_elmtlist.fixedrows; iRow++){ iElmtStatus = grd_elmtlist.rowstatus(iRow); if(iElmtStatus == 4) continue; sElmtNM = model.getValue(xElmtListPath+"["+iRow+"]/itemnm"); while(sTmpItemCalForm.indexOf(sElmtNM) >= 0){ sTmpItemCalForm = sTmpItemCalForm.replace(sElmtNM,1); } } // °è»ê½Ä¿¡ »ç¿ëÇÒ ¼ö Àִ Ư¼ö±âÈ£, ¼ýÀÚ Á¦¿ÜÇϱâ if(sTmpItemCalForm.replace(/[\+,\-,\/,\*,\(,\), ,0-9,\n]/g,"") != ""){ messageBox( "°è»ê½ÄÀÌ À߸ø µÇ¾ú½À´Ï´Ù. ´Ù½Ã", "C001"); return; } // °è»ê½Ä¿¡¼­ ÁÙ¹Ù²Þ ¹®ÀÚ »©ÁÖ±â sTmpItemCalForm = sTmpItemCalForm.replace(/\n/g,""); if(model.getValue(xItemListPath+"["+iItemRow+"]/calform") != sItemCalForm){ if(sStatus == 0 || sStatus == 4){ grd_itemlist.rowstatus(iItemRow) = 2; } model.setValue(xItemListPath+"["+iItemRow+"]/calform", sItemCalForm); } model.makeValue("/root/send/itemlist", grd_itemlist.getUpdateData()); model.makeValue("/root/send/elmtlist", grd_elmtlist.getUpdateData()); model.makeValue("/root/send/supcd", sItemCD); if(submit("TXMNR02202")){ copyNodesetType(xItemListPath,"/root/temp/iteminfo/itemlist","replace"); copyNodesetType(xElmtListPath,"/root/temp/iteminfo/elmtlist","replace"); grd_elmtlist.rebuild(); grd_itemlist.rebuild(); iItemRow = grd_itemlist.findRow(sItemCD,1,4); grd_itemlist.row = iItemRow; model.setValue("/root/main/itemcalform",model.getValue(xItemListPath+"["+iItemRow+"]/calform")); tar_calform.refresh(); } break; } } /** * @group : * @ver : 2007.05.29 * @by : ÀÌÀº¿µ * @--------------------------------------------------- * @type : function * @access : public * @desc : ºó Ç׸ñ¸íÀÌ ÀÖ´ÂÁö üũ * @param : pFlag (item : Ç׸ñ, elmt : ¿ä¼Ò) * @return : * @--------------------------------------------------- */ function fChkItemInfo(pFlag){ switch(pFlag){ case "item" : for(var iRow=grd_itemlist.fixedrows; iRow<=grd_itemlist.rows-grd_itemlist.fixedrows; iRow++){ if(model.getValue(xItemListPath+"["+iRow+"]/itemnm") == ""){ messageBox("Ç׸ñ¸íÀº","I003"); return true; } } break; } return false; } function fChangedGridRow(pFlag){ var iRow = 0; var iStatus = 0; switch(pFlag){ case "item" : iRow = grd_itemlist.row; iStatus = grd_itemlist.rowstatus(iRow); if(iStatus == 1 || iStatus == 3) return; grd_itemlist.rowstatus(iRow) = 2; break; } }