/* --------------------------------------------------------------------- SMRSC03801_¹°Ç°ÄÚµå Master Excelµî·Ï.xrw (SMRSC03801.xfm - JScript ) - Version : 1) : Ver.1.00.01 : Create By Francis Choi : 2015.05.02 ---------------------------------------------------------------------- */ // -------------------------------------------------- // È­¸é open½Ã¿Í ÃʱâÈ­ ¹öư Ŭ¸¯½Ã È­¸é ÃʱâÈ­ ±â´ÉÀ» ¼öÇàÇÑ´Ù. // -------------------------------------------------- function fInitialize() { model.resetInstanceNode("/root/send"); misfGridInit(grd_instexcellist); // misfGridInit(grd_excelmaplist); // misfGridInit(grd_rscdexcellist); // Spec Àϰý º¯°æ¿¡¼­ »ç¿ëÇÏ´Â ±âÁ¸ ¸íΰú Çö ¸íĪÀ» ºñ±³Çϱâ À§ÇÑ ±¸ºÐÀ¸·Î // premodel µî.. ±âÁ¸ µ¥ÀÌÅ͸¦ °®°í ÀÖ´Â º¯¼ö ¼³Á¤ÀÌ ¹Ýµå½Ã ÇÊ¿äÇÏ´Ù. model.makeNode("/root/send/save/setautoins/setyn"); model.setValue("/root/send/save/setautoins/setyn","N"); // rszfUserGoodFlagList(cmb_goodflag,getUserInfo("userid")); rszfGoodFlagListByPgmGubn(cmb_goodflag,"2","N"); rszfUserInstList(cmb_instcd,getUserInfo("userid")); //±â°üÄÚµå Àоî¿À´Â ºÎºÐ ³Ö±â var instcd = getUserInfo("dutplceinstcd"); var instnm = getUserInfo("dutplceinstnm"); if(instcd.length > 0)model.setValue(cmb_instcd.attribute("ref"), instcd); else { if(cmb_instcd.length> 0) cmb_instcd.selectedindex= 0; } //¹°Ç°±¸ºÐÀÏ °æ¿ì ù¹øÂ° index ÀÚµ¿ ¼³Á¤ if(cmb_goodflag.length> 0) cmb_goodflag.selectedindex= 0; // Ãʱâ ÀúÀ屸ºÐ : 2 (¹ÌÀúÀå) rdo_saveyn.selectedindex = 2; // misfMsterDetailSet(grd_excelmaplist,null, "TRRSC00601" ,"Y"); /********************************** * GOODFLAG ¹°Ç°±¸ºÐ R0025 * ASETFLAG Àڻ걸ºÐ R0043 * PRODDRUGSETFLAG Á¦Á¦¾à SET ±¸ºÐ R0068 * STOCMNGTFLAG Àç°í°ü¸®±âÁØ R0069 * REQMTHD û±¸¹æ¹ý R0092 * REQPRID û±¸ÁÖ±â R0093 * PRODPLCE Á¦Á¶±¹ R0035 * CONFLAG °è¾à±¸ºÐ R0095 * CURNCYUNIT È­Æó´ÜÀ§ R0047 * PURCFLAG ±¸¸Å±¸ºÐ R0111 * SETPLCEORDFLAG SET ¹ßÁÖ±¸ºÐ R0110 * PLCEORDBASE ¹ßÁÖ±âÁØ R0107 * PLCEORDQTYCRETFLAG ¹ßÁÖ·®»ý¼º±¸ºÐ R0106 * MNGTFLAG °ü¸®±¸ºÐ R0094 * IOPSNFLAG ³»¿ÜÀÚ±¸ºÐ * KEEPMTHD º¸°ü¹æ¹ý 1:½Ç¿Â 2:³Ã¼Ò 3:³ÃÀå 4:³Ãµ¿ * GNRLSPCL ÀϹÝ-Àü¹® 1:Àü¹® 2:ÀÏ¹Ý 3:°ø»êǰ 4:ÀǾà¿Üǰ 5:±âŸ ***********************************/ misfComboComCdListMulti("Z0007,R0025,R0043,R0068,R0069,R0092,R0093,R0035,R0095,R0047,R0111,R0110,R0107,R0106,R0094", "grd_excelmaplist.instcd,grd_excelmaplist.goodflag,grd_excelmaplist.asetflag,grd_excelmaplist.proddrugsetflag,grd_excelmaplist.stocmngtflag,grd_excelmaplist.reqmthd,grd_excelmaplist.reqprid,grd_excelmaplist.prodplce,grd_excelmaplist.conflag,grd_excelmaplist.curncyunit,grd_excelmaplist.purcflag,grd_excelmaplist.setplceordflag,grd_excelmaplist.plceordbase,grd_excelmaplist.plceordqtycretflag,grd_excelmaplist.mngtflag"); rszfComboUnitList (cmb_purcunit, model.getValue(cmb_instcd.attribute("ref")), model.getValue(cmb_goodflag.attribute("ref"))); // Æ÷Àå´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_rscdexcellist, "purcunit" ); //±Ô°Ý´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_rscdexcellist, "specunit" ); //±Ô°Ý´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_rscdexcellist, "cntsunit" ); //ÇÔ·®´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_rscdexcellist, "deliveunit" ); //¼öºÒ´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_excelmaplist, "purcunit" ); //±Ô°Ý´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_excelmaplist, "specunit" ); //±Ô°Ý´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_excelmaplist, "cntsunit" ); //ÇÔ·®´ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_excelmaplist, "deliveunit" ); //¼öºÒ´ÜÀ§ rszfComboUnitList (cmb_prcpunit,model.getValue(cmb_instcd.attribute("ref")),"D"); // 󹿴ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_rscdexcellist, "prcpunit" ); //󹿴ÜÀ§ misfComboCopyItemSet(cmb_purcunit, "", grd_excelmaplist, "prcpunit" ); //󹿴ÜÀ§ // misfMsterDetailSet(grd_rscdexcellist,null, "TRRSC03801" ,"Y"); misfMsterDetailSet(grd_excelmaplist,null, "TRRSC03801" ,"Y"); // fSetGoodFlagAuth(); grd_excelmaplist.explorerbar = "sortshow"; grd_excelmaplist.selectionmode = "list"; model.setFocus("ipt_lrgcd_search"); model.refresh(); } // -------------------------------------------------- // Excel ÀÚ·á¿Í ÀÔ·Â ÀÚ·á ºñ±³ // -------------------------------------------------- function fGoodDataCampare(pIdx){ var sPath = "/root/main/ExlMasterLists/exlmasterlist"; var tPath = "/root/init/CompareData"; model.setValue(tPath + "/goodcd" , model.getValue(sPath + "["+pIdx+"]/goodcd" )); model.setValue(tPath + "/goodflag" , model.getValue(sPath + "["+pIdx+"]/goodflag" )); model.setValue(tPath + "/goodnm" , model.getValue(sPath + "["+pIdx+"]/goodnm" )); model.setValue(tPath + "/goodhngnm" , model.getValue(sPath + "["+pIdx+"]/goodhngnm" )); model.setValue(tPath + "/goodengnm" , model.getValue(sPath + "["+pIdx+"]/goodengnm" )); model.setValue(tPath + "/goodspec" , model.getValue(sPath + "["+pIdx+"]/goodspec" )); model.setValue(tPath + "/goodmodel" , model.getValue(sPath + "["+pIdx+"]/goodmodel" )); model.setValue(tPath + "/asetflag" , model.getValue(sPath + "["+pIdx+"]/asetflag" )); model.setValue(tPath + "/lrgcd" , model.getValue(sPath + "["+pIdx+"]/lrgcd" )); model.setValue(tPath + "/lrgnm" , model.getValue(sPath + "["+pIdx+"]/lrgnm" )); model.setValue(tPath + "/mdlcd" , model.getValue(sPath + "["+pIdx+"]/mdlcd" )); model.setValue(tPath + "/mdlnm" , model.getValue(sPath + "["+pIdx+"]/mdlnm" )); model.setValue(tPath + "/smlcd" , model.getValue(sPath + "["+pIdx+"]/smlcd" )); model.setValue(tPath + "/smlnm" , model.getValue(sPath + "["+pIdx+"]/smlnm" )); model.setValue(tPath + "/edicd" , model.getValue(sPath + "["+pIdx+"]/edicd" )); model.setValue(tPath + "/prodcmpycd" , model.getValue(sPath + "["+pIdx+"]/prodcmpycd" )); model.setValue(tPath + "/prodcmpynm" , model.getValue(sPath + "["+pIdx+"]/prodcmpynm" )); model.setValue(tPath + "/cmt" , model.getValue(sPath + "["+pIdx+"]/cmt" )); model.setValue(tPath + "/goodcd_2" , model.getValue(sPath + "["+pIdx+"]/goodcd_2" )); model.setValue(tPath + "/goodflag_2" , model.getValue(sPath + "["+pIdx+"]/goodflag_2" )); model.setValue(tPath + "/goodnm_2" , model.getValue(sPath + "["+pIdx+"]/goodnm_2" )); model.setValue(tPath + "/goodhngnm_2" , model.getValue(sPath + "["+pIdx+"]/goodhngnm_2" )); model.setValue(tPath + "/goodengnm_2" , model.getValue(sPath + "["+pIdx+"]/goodengnm_2" )); model.setValue(tPath + "/goodspec_2" , model.getValue(sPath + "["+pIdx+"]/goodspec_2" )); model.setValue(tPath + "/goodmodel_2" , model.getValue(sPath + "["+pIdx+"]/goodmodel_2" )); model.setValue(tPath + "/asetflag_2" , model.getValue(sPath + "["+pIdx+"]/asetflag_2" )); model.setValue(tPath + "/lrgcd_2" , model.getValue(sPath + "["+pIdx+"]/lrgcd_2" )); model.setValue(tPath + "/lrgnm_2" , model.getValue(sPath + "["+pIdx+"]/lrgnm_2" )); model.setValue(tPath + "/mdlcd_2" , model.getValue(sPath + "["+pIdx+"]/mdlcd_2" )); model.setValue(tPath + "/mdlnm_2" , model.getValue(sPath + "["+pIdx+"]/mdlnm_2" )); model.setValue(tPath + "/smlcd_2" , model.getValue(sPath + "["+pIdx+"]/smlcd_2" )); model.setValue(tPath + "/smlnm_2" , model.getValue(sPath + "["+pIdx+"]/smlnm_2" )); model.setValue(tPath + "/edicd_2" , model.getValue(sPath + "["+pIdx+"]/edicd_2" )); model.setValue(tPath + "/prodcmpycd_2" , model.getValue(sPath + "["+pIdx+"]/prodcmpycd_2" )); model.setValue(tPath + "/prodcmpynm_2" , model.getValue(sPath + "["+pIdx+"]/prodcmpynm_2" )); model.setValue(tPath + "/cmt_2" , model.getValue(sPath + "["+pIdx+"]/cmt_2" )); grp_disp.attribute("visibility") ="visible" ; opt_goodcd.dispatch("xforms-value-changed"); grp_disp.refresh(); } // -------------------------------------------------- // Excel File¸¦ LoadÇÑ´Ù. // -------------------------------------------------- function fOldCodeAllSizeRead() { if (grd_ogoodcd.attribute("visibility") == "visible") { grd_ogoodcd.attribute("visibility") ="hidden" ; grd_allsize.attribute("visibility") ="hidden" ; return; } model.setValue("/root/send/selectcond/goodcd",model.getValue(opt_goodcd.attribute("ref"))); model.setValue("/root/send/selectcond/instcd",model.getValue(cmb_instcd.attribute("ref"))); submit("TRRSC03805"); submit("TRRSC03806"); grd_ogoodcd.attribute("visibility") ="visible" ; grd_ogoodcd.refresh(); // grd_allsize.refresh(); if (grd_allsize.rows < 2) { grd_allsize.attribute("visibility") ="hidden" ; } else { grd_allsize.attribute("visibility") ="visible" ; } grd_allsize.refresh(); } // -------------------------------------------------- // Excel File¸¦ LoadÇÑ´Ù. // -------------------------------------------------- function fLoadExcel(pCls) { if (model.getValue(cmb_instcd.attribute("ref")).length== 0 ) { messageBox("±â°üÄڵ带 " ,"C002"); model.setFocus("cmb_instcd"); return false; } var fileName = window.fileDialog("open", ",", false, "", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls"); if (pCls == "1") { grd_instexcellist.loadExcel(fileName, 1); //misfGridIUD(grd_instexcellist, "D"); //misfGridIUD(grd_instexcellist, "D"); } else { grd_rscdexcellist.loadExcel(fileName, 1); // fGridInsertChanged(); //misfGridIUD(grd_rscdexcellist, "D"); //misfGridIUD(grd_instexcellist, "D"); } model.refresh(); } // -------------------------------------------------- // Excel ÀڷḦ Àӽà ¹°Ç° Master¿¡ »ý¼ºÇÑ´Ù. // -------------------------------------------------- var CondData = "" ; var OldnewData = "" ; var MasterData = "" ; var AllsizeData = "" ; // var CondHeader = "" ; // var OldnewHeader = "" ; // var MasterHeader = "" ; // var AllsizeHeader = "" ; function fExcel2GoodMasterSave() { var cPath = "/root/init/CopyGoodList"; var sPath = "/root/main/ExcelLists/ExcelList"; var tPath = "/root/CopyData/CopyGoodLists/CopyGoodList"; var mPath = "/root/init/CopySizeList"; var aPath = "/root/CopyData/CopySizeLists/CopySizeList"; var oPath = "/root/init/CopyMapList"; var nPath = "/root/CopyData/CopyMapLists/CopyMapList"; var pRow = 1 ; var aRow = 1 ; var nRow = 1 ; var GoodCd = ""; var sRowCnt = grd_rscdexcellist.rows - grd_rscdexcellist.fixedrows; fExcelGoodHeader(); var vInstcd = model.getValue("/root/send/searchlist/instcd" ); CondData += model.getValue("/root/send/searchlist/instcd" ) + "¢Ë" // 01 ±â°üÄÚµå + model.getValue("/root/CopyData/CopyCond/mastercls" ) + "¢Ë" // 02 Master »ý¼º ±¸ºÐ + model.getValue("/root/CopyData/CopyCond/allsizecls") + "¢Ë" // 03 All Size »ý¼º ±¸ºÐ + model.getValue("/root/CopyData/CopyCond/oldnewcls" ) + "¢Ì"; // 04 ½Å±¸ÄÚµå »ý¼º model.removeNode(tPath); model.removeNode(aPath); model.removeNode(nPath); for (var i=1; i<= sRowCnt; i++) { GoodCd = model.getValue(sPath + "["+i+"]/ngood"); if (model.getValue(tPath +"[goodcd='"+ GoodCd + "']/goodcd") == "") { vGoodFlag = model.getValue(sPath + "["+i+"]/ngood").substr(0,1) ; model.setValue(cPath+ "/goodcd" , model.getValue(sPath + "["+i+"]/ngood" )); model.setValue(cPath+ "/goodflag" , vGoodFlag ); model.setValue(cPath+ "/goodnm" , model.getValue(sPath + "["+i+"]/goodnm" )); model.setValue(cPath+ "/goodspec" , model.getValue(sPath + "["+i+"]/goodspec" )); model.setValue(cPath+ "/goodmodel" , model.getValue(sPath + "["+i+"]/goodmodel" )); model.setValue(cPath+ "/asetflag" , "1" ); model.setValue(cPath+ "/lrgcd" , model.getValue(sPath + "["+i+"]/lrgcd" )); model.setValue(cPath+ "/mdlcd" , model.getValue(sPath + "["+i+"]/mdlcd" )); model.setValue(cPath+ "/smlcd" , "" ); model.setValue(cPath+ "/edicd" , model.getValue(sPath + "["+i+"]/edicode" )); model.setValue(cPath+ "/prodcmpycd", "" ); model.setValue(cPath+ "/prodcmpynm", model.getValue(sPath + "["+i+"]/prodcmpycd")); model.makeNode(tPath + "["+pRow+"]" ); model.copyNode(tPath + "["+pRow+"]", cPath ); MasterData += model.getValue(sPath + "["+i+"]/ngood" ) + "¢Ë" // 01 ¹°Ç°ÄÚµå + vGoodFlag + "¢Ë" // 02 ¹°Ç°±¸ºÐ + model.getValue(sPath + "["+i+"]/goodnm" ) + "¢Ë" // 03 ¹°Ç°¸í + model.getValue(sPath + "["+i+"]/goodspec" ) + "¢Ë" // 04 ¹°Ç°±Ô°Ý + model.getValue(sPath + "["+i+"]/goodmodel" ) + "¢Ë" // 05 ¸ðµ¨ + "1" + "¢Ë" // 06 Àڻ걸ºÐ + model.getValue(sPath + "["+i+"]/lrgcd" ) + "¢Ë" // 07 ´ëºÐ·ùÄÚµå + model.getValue(sPath + "["+i+"]/mdlcd" ) + "¢Ë" // 08 ÁߺзùÄÚµå + "" + "¢Ë" // 09 ¼ÒºÐ·ùÄÚµå + model.getValue(sPath + "["+i+"]/edicode" ) + "¢Ë" // 10 EDIÄÚµå + "" + "¢Ë" // 11 Á¦Á¶È¸»çÄÚµå + model.getValue(sPath + "["+i+"]/prodcmpycd") + "¢Ì"; // 12 Á¦Á¶È¸»ç¸íĪ pRow++; } if (model.getValue(sPath + "["+i+"]/allsizeid")!="") { model.setValue(mPath+ "/goodcd" , model.getValue(sPath + "["+i+"]/ngood" )); model.setValue(mPath+ "/goodnm" , model.getValue(sPath + "["+i+"]/goodnm" )); model.setValue(mPath+ "/allsizespecid" , model.getValue(sPath + "["+i+"]/allsizeid" )); model.setValue(mPath+ "/goodspec" , model.getValue(sPath + "["+i+"]/goodspec" )); model.makeNode(aPath + "["+aRow+"]" ); model.copyNode(aPath + "["+aRow+"]", mPath ); AllsizeData += vInstcd + "¢Ë" // 01 ±â°üÄÚµå + model.getValue(sPath + "["+i+"]/ngood" ) + "¢Ë" // 02 ¹°Ç°ÄÚµå + model.getValue(sPath + "["+i+"]/goodnm" ) + "¢Ë" // 03 ¹°Ç°¸í + model.getValue(sPath + "["+i+"]/allsizeid" ) + "¢Ë" // 04 ±Ô°ÝID + model.getValue(sPath + "["+i+"]/goodspec" ) + "¢Ì"; // 05 ¹°Ç°±Ô°Ý aRow++; } oGoodCd = model.getValue(sPath + "["+i+"]/ogood"); if ((model.getValue(sPath + "["+i+"]/ogood") != "") && (model.getValue(nPath +"[ogoodcd='"+ oGoodCd + "']/ogoodcd") == "")) { model.setValue(oPath+ "/ngoodcd" , model.getValue(sPath + "["+i+"]/ngood" )); model.setValue(oPath+ "/ogoodcd" , model.getValue(sPath + "["+i+"]/ogood" )); model.setValue(oPath+ "/goodnm" , model.getValue(sPath + "["+i+"]/goodnm" )); model.makeNode(nPath + "["+nRow+"]" ); model.copyNode(nPath + "["+nRow+"]", oPath ); OldnewData += model.getValue(sPath + "["+i+"]/ngood" ) + "¢Ë" // 01 ¹°Ç°ÄÚµå + model.getValue(sPath + "["+i+"]/ogood" ) + "¢Ë" // 02 ¹°Ç°ÄÚµå + model.getValue(sPath + "["+i+"]/goodnm" ) + "¢Ì"; // 03 ¹°Ç°¸í nRow++; } } goodoldnew.refresh(); allsizecopy.refresh(); mgoodcopy.refresh(); model.removenode("/root/send/copydata" ); // Á¶°ÇÀÚ·á model.makeValue("/root/send/copydata/copycond" ,CondData ); // Á¶°ÇÀÚ·á model.makeValue("/root/send/copydata/exlmasterlist" ,MasterData ); // ¹°Ç°¸¶½ºÅÍ model.makeValue("/root/send/copydata/exlallsizelist",AllsizeData); // All Size model.makeValue("/root/send/copydata/exloldnewlist" ,OldnewData ); // ½Å±¸¹°Ç° submit("TXRSC03804"); // if (model.getValue(gvErrorMsgPath + "/type") != "error") // { // misfGridInit(grd_rscdexcellist); // btn_cost.dispatch("DOMActivate"); // btn_cost.selected="true"; // btn_search.dispatch("DOMActivate"); // } } // -------------------------------------------------- // Excel ÀÚ·á Header ±¸¼º // -------------------------------------------------- function fExcelGoodHeader(){ CondData = "instcd" + "¢Ë" // 01 ±â°üÄÚµå + "mastercls" + "¢Ë" // 02 Master »ý¼º ±¸ºÐ + "allsizecls" + "¢Ë" // 03 All Size »ý¼º ±¸ºÐ + "oldnewcls" + "¢Ì"; // 04 ½Å±¸ÄÚµå »ý¼º MasterData = "goodcd" + "¢Ë" // 01 ¹°Ç°ÄÚµå + "goodflag" + "¢Ë" // 02 ¹°Ç°±¸ºÐ + "goodnm" + "¢Ë" // 03 ¹°Ç°¸í + "goodspec" + "¢Ë" // 04 ¹°Ç°±Ô°Ý + "goodmodel" + "¢Ë" // 05 ¸ðµ¨ + "asetflag" + "¢Ë" // 06 Àڻ걸ºÐ + "lrgcd" + "¢Ë" // 07 ´ëºÐ·ùÄÚµå + "mdlcd" + "¢Ë" // 08 ÁߺзùÄÚµå + "smlcd" + "¢Ë" // 09 ¼ÒºÐ·ùÄÚµå + "edicd" + "¢Ë" // 10 EDIÄÚµå + "prodcmpycd" + "¢Ë" // 11 Á¦Á¶È¸»çÄÚµå + "prodcmpynm" + "¢Ì"; // 12 Á¦Á¶È¸»ç¸íĪ AllsizeData = "instcd" + "¢Ë" // 01 ±â°üÄÚµå + "goodcd" + "¢Ë" // 02 ¹°Ç°ÄÚµå + "goodnm" + "¢Ë" // 03 ¹°Ç°¸í + "allsizespecid" + "¢Ë" // 04 ±Ô°ÝID + "goodspec" + "¢Ì"; // 05 ¹°Ç°±Ô°Ý OldnewData = "ngoodcd" + "¢Ë" // 01 ¹°Ç°ÄÚµå + "ogoodcd" + "¢Ë" // 02 ¹°Ç°ÄÚµå + "goodnm" + "¢Ì"; // 03 ¹°Ç°¸í } // -------------------------------------------------- // Excel File¸¦ LoadÇÑ´Ù. // -------------------------------------------------- function fGridInsertChanged() { for(var fRow = grd_rscdexcellist.fixedRows; fRow < grd_rscdexcellist.rows; fRow++) { grd_rscdexcellist.addStatus(fRow, "insert"); grd_rscdexcellist.valueMatrix(fRow, grd_rscdexcellist.colRef("instcd")) = model.getValue(cmb_instcd.attribute("ref")); grd_rscdexcellist.valueMatrix(fRow, grd_rscdexcellist.colRef("goodflag")) = model.getValue(cmb_goodflag.attribute("ref")); grd_rscdexcellist.valueMatrix(fRow, grd_rscdexcellist.colRef("ifflag")) = "E"; // Interface ±¸ºÐ : E (excel ÀÔ·Â) } } function fSetGoodSpec() { model.setValue(opt_poptitle.attribute("ref"), "¹°Ç° ±Ô°ÝÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title","opt_poptitle"); model.refresh(); fSetAllApply(grd_excelmaplist,"goodspec", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetGoodModel() { model.setValue(opt_poptitle.attribute("ref"), "¹°Ç° ¸ðµ¨À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title","opt_poptitle"); model.refresh(); fSetAllApply(grd_excelmaplist,"goodmodel", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetGoodnm() { model.setValue(opt_poptitle.attribute("ref"), "¹°Ç°¸í ÀÔ·ÂÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title","opt_poptitle"); model.refresh(); fSetAllApply(grd_excelmaplist,"goodnm", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetGoodUnitCost() { model.setValue(opt_poptitle.attribute("ref"), "Á¦Ç° ´Ü°¡¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä"); model.setValue(opt_popformat.attribute("ref"), "#,###"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title,format","opt_poptitle,opt_popformat"); model.refresh(); fSetAllApply(grd_excelmaplist,"goodunitcost", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetExchQty() { model.setValue(opt_poptitle.attribute("ref"), "ȯ»ê¼ö·®À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä"); model.setValue(opt_popformat.attribute("ref"), "#,###"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title,format","opt_poptitle,opt_popformat"); model.refresh(); fSetAllApply(grd_excelmaplist,"exchqty", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetMainCustLastSuplplce() { model.setValue(opt_popcond.attribute("ref"),"custom"); model.setValue(opt_poptitle.attribute("ref"), "ÁÖ°Å·¡Ã³¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd,popinputnm","SMRSC03801" ,"title,cond,instcd","opt_poptitle,opt_popcond,cmb_instcd"); model.refresh(); fSetAllApply(grd_excelmaplist,"maincustlastsuplplce,maincustlastsuplplcenm", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetSuppCustCd() { model.setValue(opt_popcond.attribute("ref"),"custom"); model.setValue(opt_poptitle.attribute("ref"), "º¸Á¶ °Å·¡Ã³¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd,popinputnm","SMRSC03801" ,"title,cond,instcd","opt_poptitle,opt_popcond,cmb_instcd"); model.refresh(); fSetAllApply(grd_excelmaplist,"suppcustcd,suppcustnm", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetGoodProdCmpy() { model.setValue(opt_popcond.attribute("ref"),"prodcmpy"); model.setValue(opt_poptitle.attribute("ref"), "Á¦Á¶È¸»ç¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd,popinputnm","SMRSC03801" ,"title,cond,instcd","opt_poptitle,opt_popcond,cmb_instcd"); model.refresh(); fSetAllApply(grd_excelmaplist,"prodcmpycd,prodcmpynm", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetPurcUnit() { model.setValue(opt_popcond.attribute("ref"),"purcunit"); model.setValue(opt_poptitle.attribute("ref"), "Æ÷Àå´ÜÀ§¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title,cond","opt_poptitle,opt_popcond"); model.refresh(); fSetAllApply(grd_excelmaplist,"purcunit", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetDeliveUnit() { model.setValue(opt_popcond.attribute("ref"),"deliveunit"); model.setValue(opt_poptitle.attribute("ref"), "¼öºÒ´ÜÀ§¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03801" ,"title,cond","opt_poptitle,opt_popcond"); model.refresh(); fSetAllApply(grd_excelmaplist,"deliveunit", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetLargeCd() { model.setValue(opt_popcond.attribute("ref"),"lrgnm"); model.setValue(opt_poptitle.attribute("ref"), "ºÐ·ùÄڵ带 ¼±ÅÃÇØ ÁÖ¼¼¿ä"); rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd,popinputnm","SMRSC03801" ,"title,cond,instcd,goodflag","opt_poptitle,opt_popcond,cmb_instcd,cmb_goodflag"); fSetAllApply(grd_excelmaplist,"lrgcd,lrgnm,mdlcd,mdlnm,smlcd,smlnm", model.getValue(opt_popinputcd.attribute("ref"))); } function fSetAllApply(f_grid, f_id , f_value) { if(f_id == null || f_id.length == 0 || f_value == null || f_value.length == 0 )return; var f_selid = f_id.split(","); var f_selvalue = f_value.split(","); for(currow = 0 ; currow < f_grid.selectedRows; currow++) { for (var k = 0; k < f_selid.length; k++) { if(f_grid.colRef(f_selid[k]) != -1) { if(model.getValue(f_grid.nodeset + "[" + (f_grid.selectedRow(currow)- f_grid.fixedRows + 1) + "]/" + f_selid[k]) != f_selvalue[k]) { if(f_grid.valueMatrix( (f_grid.selectedRow(currow)- f_grid.fixedRows + 1) , f_grid.colRef("saveyn")) == "N") { // alert ( currow + " ¹øÂ° ÇàÀÇ " + f_grid.colRef("saveyn") + "¹øÂ° Ç׸ñÀÇ °ª " + f_grid.valueMatrix( , f_grid.colRef("saveyn")) ); model.setValue(f_grid.nodeset + "[" + (f_grid.selectedRow(currow)- f_grid.fixedRows + 1) + "]/" + f_selid[k] ,f_selvalue[k]); if(f_grid.rowStatus(f_grid.selectedRow(currow)) == "0") { f_grid.rowStatus(f_grid.selectedRow(currow)) = "2"; // Update } if ( f_selid[k] == "lrgcd" || f_selid[k] == "lrgnm" || f_selid[k] == "mdlcd" || f_selid[k] == "mdlnm" || f_selid[k] == "smlcd" || f_selid[k] == "smlnm") { // ºÐ·ùÄÚµå º¯°æ½Ã¸¸ º¯°æ model.setValue(f_grid.nodeset + "[" + (f_grid.selectedRow(currow)- f_grid.fixedRows + 1) + "]/" + "getgubunchk", "0*0*0"); // ´ë, Áß, ¼ÒºÐ·ù °ªÀÌ ¼öÁ¤ÀÌ µÇ¸é ¿À·ù °ªÀ» ¼öÁ¤Ã³¸® ÇÑ´Ù. fMapListValid(f_grid, (f_grid.selectedRow(currow)- f_grid.fixedRows), (f_grid.selectedRow(currow)- f_grid.fixedRows +1) ); // ¿À·ù ¼öÁ¤¿¡ µû¸¥ »ö»ó ¼öÁ¤ } } } } } } } function fCheckRetrieveData() { if(model.getValue(cmb_instcd.attribute("ref")).length== 0 ) { messageBox("±â°üÄڵ带 " ,"C002"); model.setFocus("cmb_instcd"); return false; } if(model.getValue(cmb_goodflag.attribute("ref")).length== 0 ) { messageBox("¹°Ç°±¸ºÐÀ» " ,"C002"); model.setFocus("cmb_goodflag"); return false; } /* if(model.getValue(ipt_lrgcd_search.attribute("ref")).length== 0 ) { messageBox("´ëºÐ·ùÄڵ带 " ,"C002"); model.setFocus("ipt_lrgcd_search"); return false; } if(model.getValue(ipt_goodcd.attribute("ref")).length < 3 && model.getValue(ipt_goodnm.attribute("ref")).length < 3) { messageBox("¹°Ç°ÄÚµå ¶Ç´Â ¹°Ç°¸í¿¡ ÃÖ¼Ò 2ÀÚ¸®¸¦" ,"C001"); model.setFocus("ipt_goodcd_search"); return false; } */ return true; } // ¹°Ç°±¸ºÐº° ±ÇÇÑüũ. function fSetGoodFlagAuth() { btn_save.disabled=true; rszfGetPurcGoodFlagAuthInfo(cmb_instcd.value , cmb_goodflag.value, getUserInfo("userid"), "%"); if(rszfGetGoodFlagAuthInfoByCond("goodflagauth") =="Y") { btn_save.disabled=false; } } /****************************************** * ´ë, Áß, ¼ÒºÐ·ù¿¡ ´ëÇÑ valid check¿¡ ´ëÇÑ err ½Ã »ö»ó º¯È­ * pGrd = ´ë»óÀÌ µÇ´Â Å×À̺í * pFromRow = Grid ½ÃÀÛ À§Ä¡ * pToRow = Grid Á¾·á À§Ä¡ * getgubunchk Ç׸ñ¿¡¼­ À¯È¿¼º °ª ¹Ýȯ = 0 : ÀÌ»ó ¾øÀ½, 9 : ¿¡·¯ * ex) 0*0*0 : ´ë, Áß, ¼ÒºÐ·ù À¯È¿ÇÑ °ª * 0*9*9 : Áß, ¼ÒºÐ·ù ¿À·ù * »óÀ§ ºÐ·ù ¿¡·¯ ¹ß»ý½Ã ÇÏÀ§ ºÐ·ù¿¡ ´ëÇÑ À¯È¿¼ºÀº º¸Àå ÇÒ ¼ö ¾ø±â ¶§¹®¿¡ err ó¸® ******************************************/ function fMapListValid(pGrd, pFromRow, pToRow) { var temValidItem = new Array("lrgcd","mdlcd","smlcd"); var rowcnt = 0; if(pFromRow != "" || pFromRow != null) { rowcnt = pGrd.fixedRows; } else { rowcnt = pFromRow; } if(pToRow != "" || pToRow != null) { grdRow = pGrd.rows; } else { grdRow = pToRow; } for ( rowcnt ; rowcnt 0 ) { var currow = 0; for(currow = grd_id.fixedRows ; currow < grd_id.rows ; currow++) { if ( grd_id.colRef("getgubunchk") != -1 ) { // var temValidItem = new Array("´ëºÐ·ù","Áߺзù","¼ÒºÐ·ù","lgrnm","mdlnm","smlnm"); var temValidItem = new Array("´ëºÐ·ù","Áߺзù","¼ÒºÐ·ù"); var tmp_getgubunchk = grd_id.valueMatrix(currow , grd_id.colRef("getgubunchk")).split("*"); for( cnt = 0; cnt < tmp_getgubunchk.length; cnt++ ) { if ( tmp_getgubunchk[cnt] != "0" ) { messageBox( grd_id.valueMatrix(currow , grd_id.colRef("no")) + " ¹øÂ° " + temValidItem[cnt] + "°¡ À¯È¿ÇÏÁö", "I004"); grd_id.row = currow; return false; // grd_id.col = grd_id.colRef( temValidItem[cnt+3] ); } } } if(grd_id.valueMatrix(currow, grd_id.colRef("lrgcd")).length == 0) { messageBox(currow + " ¹øÂ° ´ëºÐ·ùÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("lrgcd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("mdlcd")).length == 0) { messageBox(currow + " ¹øÂ° ÁߺзùÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("mdlcd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("smlcd")).length == 0) { messageBox(currow + " ¹øÂ° ¼ÒºÐ·ùÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("smlcd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("welfprt")).length == 0) { messageBox(currow + " ¹øÂ° º¹ÁöºÎºÐ·ùÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("welfprt"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("goodcd")).length == 0) { messageBox(currow + " ¹øÂ° ½Å¾àǰÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("goodcd"); grd_id.editCell(); return false; } else { for(srcrow = currow + 1 ; srcrow < grd_id.rows ; srcrow++) { if(grd_id.valueMatrix(currow , grd_id.colRef("goodcd")) == grd_id.valueMatrix(srcrow , grd_id.colRef("goodcd")) ) { messageBox("µ¿ÀÏ ¹°Ç°Äڵ尡 [" + grd_id.valueMatrix(currow , grd_id.colRef("no")) + ", " + grd_id.valueMatrix(srcrow , grd_id.colRef("no")) + "->" + grd_id.valueMatrix(currow , grd_id.colRef("goodcd")) + "] Á¸ÀçÇÏ¿© ÀúÀå " ,"E001"); return false; } } } if(grd_id.valueMatrix(currow, grd_id.colRef("oldcd")).length == 0) { messageBox(currow + " ¹øÂ° ±¸Äڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("oldcd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("bnscd")).length == 0) { messageBox(currow + " ¹øÂ° º¸³ª¿¡½ºÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("bnscd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("edicd")).length == 0) { messageBox(currow + " ¹øÂ° EDIÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("edicd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("prodcmpycd")).length == 0) { messageBox(currow + " ¹øÂ° Á¦Á¶È¸»çÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("prodcmpycd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("suppcustcd")).length == 0) { messageBox(currow + " ¹øÂ° ÆÇ¸Åȸ»çÄڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("suppcustcd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("goodnm")).length == 0) { messageBox(currow + " ¹øÂ° ǰ¸íÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("goodnm "); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("com")).length == 0) { messageBox(currow + " ¹øÂ° ¼ººÐ(ÄÚµå)¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("com"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("comnm")).length == 0) { messageBox(currow + " ¹øÂ° ¼ººÐ(¸í)À» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("comnm"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("cntsqty")).length == 0) { messageBox(currow + " ¹øÂ° ÇÔ·®À» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("cntsqty"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("cntsunit")).length == 0) { messageBox(currow + " ¹øÂ° ÇÔ·®´ÜÀ§¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("cntsunit"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("specvol")).length == 0) { messageBox(currow + " ¹øÂ° ±Ô°ÝÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("specvol"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("specunit")).length == 0) { messageBox(currow + " ¹øÂ° ±Ô°Ý´ÜÀ§¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("specunit"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("prcpqty")).length == 0) { messageBox(currow + " ¹øÂ° 󹿼ö·®À» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("prcpqty"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("prcpunit")).length == 0) { messageBox(currow + " ¹øÂ° 󹿴ÜÀ§¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("prcpunit"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("prcpexchqty")).length == 0) { messageBox(currow + " ¹øÂ° ó¹æÈ¯»êÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("prcpexchqty "); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("exchqty")).length == 0) { messageBox(currow + " ¹øÂ° Æ÷Àåȯ»êÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("exchqty"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("deliveunit")).length == 0) { messageBox(currow + " ¹øÂ° ³¹°³´ÜÀ§¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("deliveunit"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("purcunit")).length == 0) { messageBox(currow + " ¹øÂ° Æ÷Àå´ÜÀ§¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("purcunit"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("gnrlspcl")).length == 0) { messageBox(currow + " ¹øÂ° ÀϹÝ/Àü¹®Äڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("gnrlspcl"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("winacnt")).length == 0) { messageBox(currow + " ¹øÂ° ÀÔ°í°èÁ¤Äڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("winacnt"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("amtacnt")).length == 0) { messageBox(currow + " ¹øÂ° ºñ¿ë°èÁ¤Äڵ带 " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("amtacnt "); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("keepmthd")).length == 0) { messageBox(currow + " ¹øÂ° º¸°ü¹ýÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("keepmthd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("pemtkeepmthd")).length == 0) { messageBox(currow + " ¹øÂ° º¸°ü¹ý ¼³¸íÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("pemtkeepmthd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("fromdd")).length == 0) { messageBox(currow + " ¹øÂ° Àû¿ëÀÏÀÚ¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("fromdd"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("insucost")).length == 0) { messageBox(currow + " ¹øÂ° º¸Çè´Ü°¡¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("insucost"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("estmamt")).length == 0) { messageBox(currow + " ¹øÂ° 󹿴ܰ¡¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("estmamt"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("goodunitcost")).length == 0) { messageBox(currow + " ¹øÂ° ±¸ÀԴܰ¡¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("goodunitcost"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("goodpurccost")).length == 0) { messageBox(currow + " ¹øÂ° ±¸ÀÔ°¡¸¦ " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("goodpurccost"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("reqflag")).length == 0) { messageBox(currow + " ¹øÂ° û±¸±¸ºÐÀ» " ,"C001"); grd_id.row = currow; grd_id.col = grd_id.colRef("reqflag"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("workvalid")) == "N") { messageBox(currow + " ¹øÂ° ½Å±Ô/º¯°æ ±¸ºÐÀÌ","E016"); grd_id.row = currow; grd_id.col = grd_id.colRef("workflag"); grd_id.editCell(); return false; } if(grd_id.valueMatrix(currow, grd_id.colRef("fromdd")) < grd_id.valueMatrix(currow, grd_id.colRef("prefromdd"))) { messageBox(currow + " ¹øÂ° Àû¿ëÀÏÀÚ°¡","E016"); grd_id.row = currow; grd_id.col = grd_id.colRef("fromdd"); grd_id.editCell(); return false; } } } else { messageBox("ÀúÀå µ¥ÀÌÅͰ¡","I004"); return false; } } function fSetSaveData( grd_id ) { if ( getGridUpdateData(grd_id) != "" ) { messageBox("º¯°æ µ¥ÀÌÅÍ ÀúÀå ÈÄ Master Àû¿ëÀÌ","I006"); return false; } var currow = 0; for(currow = grd_id.fixedRows ; currow < grd_id.rows ; currow++) { if(grd_id.valueMatrix(currow, grd_id.colRef("saveyn")) == "N") { if(grd_id.valueMatrix(currow, grd_id.colRef("workflag")) == "I") grd_id.rowStatus(currow) = "1"; else if (grd_id.valueMatrix(currow, grd_id.colRef("workflag")) == "U") grd_id.rowStatus(currow) = "2"; } } } /* ------------------------------------------------- */ /* ------End Of List ------------------------------- */ /* -------------------------------------------------- */