123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567 |
- /* ---------------------------------------------------------------------
-
- SMRSC03700_<input type="text" 자재Spec일괄변경>.xrw (SMRSC03700.xfm - JScript )
- - Version :
- 1) : Ver.1.00.01
- : Create By HR Choi
- : 2015.05.02
- ---------------------------------------------------------------------- */
-
- var xAuth = !(checkAuth("X"));
- var rAuth = !(checkAuth("R"));
-
- var vGoodNew = "U"; //U:UPDATE, N:NEW
- // --------------------------------------------------
- // 사용자권한 Check
- // --------------------------------------------------
- function fInitForm() {
- fInitialize();
- }
-
- // --------------------------------------------------
- // 사용자권한 Check
- // --------------------------------------------------
- function fCheckAuth() {
- // btn_search.disabled = rAuth ;
- btn_save.disabled = xAuth ;
- }
- // --------------------------------------------------
- // 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
- // --------------------------------------------------
- function fInitialize() {
- model.resetInstanceNode("/root/send");
- misfGridInit(grd_costlist);
- misfGridInit(grd_goodhistory);
- misfGridInit(grd_rscdgchglist);
- rszfGoodFlagListByPgmGubn(cmb_goodflag,"1","N");
- rszfUserInstList(cmb_instcd,getUserInfo("userid"));
-
- misfGridComboComCdList("R0111",grd_copygood, "purcflag");
- misfGridComboComCdList("R0093",grd_copygood, "reqprid");
- misfGridComboComCdList("R0092",grd_copygood, "reqmthd");
- //기관코드 읽어오는 부분 넣기
- 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;
-
- // 기관 코도, 물품 구분별 단위 셋팅을 한다.
- fUnitSet();
-
- misfMsterDetailSet(grd_costlist ,null , "TRRSC00601" ,"Y");
- misfMsterDetailSet(grd_rscdgchglist,null , "TXRSC03702" ,"Y");
- misfMsterDetailSet(grd_goodhistory ,grd_costlist, "TRRSC00602" ,"N");
-
- fSetGoodFlagAuth();
-
- grd_costlist.explorerbar = "sortshow";
- grd_goodhistory.explorerbar = "sortshow";
-
- grd_costlist.selectionmode = "list";
-
- model.setFocus("ipt_lrgcd_search");
- rbo_useyn.select(0);
- cap_cnt.value = "0";
-
- rszfLMSComboList(model.getValue(cmb_goodflag.attribute("ref")), "", "", "cmb_lrgcd_search", "", "L", "Y", "Y");
-
- model.refresh();
- }
-
- //
- function fUnitSet() {
- rszfComboUnitList (cmb_prcpunit,model.getValue(cmb_instcd.attribute("ref")),model.getValue(cmb_goodflag.attribute("ref")));
- misfComboCopyItemSet(cmb_prcpunit, "", grd_costlist, "purcunit"); //포장단위
- misfComboCopyItemSet(cmb_prcpunit, "", grd_costlist, "deliveunit"); //수불단위
- }
-
- // --------------------------------------------------
- // Excel File를 Load한다.
- // --------------------------------------------------
- function fLoadExcel_2(pCls,pGroup,pGrid)
- {
- pGroup.visible = true;
-
- var fileName = window.fileDialog("open", ",", false, "", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
- misfGridInit(pGrid);
-
- pGrid.loadExcel(fileName, 1);
-
- pGrid.refresh();
-
- }
-
- function fSaveDataSetting(pSubmit_Id) {
-
- if (swt_select.selectedIndex == 0) {
- fgrid = grd_costlist;
-
- var insfromdd = model.getValue(ipt_insfromdd.attribute("ref"));
- if(insfromdd.length == 0)
- {
- messageBox("적용시작일자를 " ,"C002");
- model.setFocus("insfromdd");
- return false;
- }
-
- model.removenode("/root/send/save");
- model.makeNode("/root/send/save/goodlist");
- model.makeNode("/root/send/save/gooddetlist");
- model.makeNode("/root/send/save/setautoins/setyn");
- model.makeNode("/root/send/save/setautoins/insfromdd")
-
- model.makeNode("/root/send/save/chngyn");
- model.setValue("/root/send/save/chngyn","Y");
- model.setValue("/root/send/save/setautoins/setyn","Y");
- model.setValue("/root/send/save/setautoins/insfromdd",insfromdd);
-
- model.refresh();
-
- if(swt_select.selectedIndex == 0)model.setValue("/root/send/save/goodlist" , fgrid.getUpdateData());
- model.setValue("/root/send/save/gooddetlist" , fgrid.getUpdateData());
-
- submit(pSubmit_Id);
-
- if (model.getValue(gvErrorMsgPath + "/type") != "error")btn_search.dispatch("DOMActivate");
- }
- else if (swt_select.selectedIndex == 1) {
- misfSave("TXRSC03702");
- }
- }
-
-
- function fLoadExcel()
- {
- if(model.getValue(cmb_instcd.attribute("ref")).length== 0 )
- {
- messageBox("기관코드를 " ,"C002");
- model.setFocus("cmb_instcd");
- return false;
- }
-
- if ( grd_rscdgchglist.rows - grd_rscdgchglist.fixedRows > 0) {
- misfGridInit(grd_rscdgchglist);
- cap_cnt.visible = "";
- }
-
- var fileName = window.fileDialog("open", ",", false, "", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
- grd_rscdgchglist.loadExcel(fileName, 1);
-
- fGridInsertChanged();
-
- grd_rscdgchglist.row = grd_rscdgchglist.fixedRows;
- misfGridIUD(grd_rscdgchglist, "D");
-
- cap_cnt.value = grd_rscdgchglist.rows- grd_rscdgchglist.fixedRows;
-
- model.refresh();
- }
-
- function fGridInsertChanged()
- {
- var vFromDD = "";
- for(var fRow = grd_rscdgchglist.fixedRows; fRow < grd_rscdgchglist.rows; fRow++)
- {
- grd_rscdgchglist.addStatus(fRow, "insert");
- vFromDD = model.getValue(grd_rscdgchglist.nodeset + "[" + fRow + "]/fromdd");
- vFromDD = vFromDD.replace(/-/gi,'');
-
- model.setValue(grd_rscdgchglist.nodeset + "[" + fRow + "]/fromdd", vFromDD);
- grd_rscdgchglist.valueMatrix(fRow, grd_rscdgchglist.colRef("instcd")) = cmb_instcd.value;
- }
- }
-
- function fSetGoodSpec()
- {
- model.setValue(opt_poptitle.attribute("ref"), "물품 규격을 입력해 주세요");
- rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03701" ,"title","opt_poptitle");
- model.refresh();
-
- fSetAllApply(grd_costlist,"goodspec", model.getValue(opt_popinputcd.attribute("ref")));
- }
-
- function fSetGoodModel()
- {
- model.setValue(opt_poptitle.attribute("ref"), "물품 모델을 입력해 주세요");
- rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03701" ,"title","opt_poptitle");
- model.refresh();
-
- fSetAllApply(grd_costlist,"goodmodel", model.getValue(opt_popinputcd.attribute("ref")));
- }
- function fSetGoodnm()
- {
- model.setValue(opt_poptitle.attribute("ref"), "물품명 입력해 주세요");
- rszfOpenPopUpListByWndName(opt_popinputcd,"","popinputcd","SMRSC03701" ,"title","opt_poptitle");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,format","opt_poptitle,opt_popformat");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,format","opt_poptitle,opt_popformat");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,cond,instcd","opt_poptitle,opt_popcond,cmb_instcd");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,cond,instcd","opt_poptitle,opt_popcond,cmb_instcd");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,cond,instcd","opt_poptitle,opt_popcond,cmb_instcd");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,cond","opt_poptitle,opt_popcond");
- model.refresh();
-
- fSetAllApply(grd_costlist,"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","SMRSC03701" ,"title,cond","opt_poptitle,opt_popcond");
-
- fSetAllApply(grd_costlist,"deliveunit", model.getValue(opt_popinputcd.attribute("ref")));
- model.refresh();
- }
-
- 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])
- {
- // model.setValue(f_grid.nodeset + "[" + (f_grid.selectedRow(currow)- f_grid.fixedRows + 1) + "]/" + f_selid[k] ,f_selvalue[k]);
- grd_costlist.valueMatrix( (f_grid.selectedRow(currow)- f_grid.fixedRows + 1), grd_costlist.colRef( f_selid[k] ) ) = f_selvalue[k];
- if(f_grid.rowStatus(f_grid.selectedRow(currow)) == "0")f_grid.rowStatus(f_grid.selectedRow(currow)) = "2";
- }
- }
- }
- }
- }
-
- // 조회버튼 click시 원래사이즈로 초기화
- function fZoomInOut(pCall)
- {
- var selrow = 0;
- var selzoomin = "N";
-
- // 조회버튼 click시 원래사이즈로 초기화
- if (pCall == "search")
- {
- for(currow = 0 ; currow < grd_costlist.Rows; currow++)
- {
- selrow = grd_costlist.selectedRow(currow);
- if(grd_costlist.rowHeight(selrow) == 50)
- {
- grd_costlist.rowHeight(selrow) = 23;
- grd_costlist.cellstyle("font-size",selrow, 1 , selrow, grd_costlist.cols -1) = "10pt";
- }
- }
-
- }
- else
- {
- for(currow = 0 ; currow < grd_costlist.selectedRows; currow++)
- {
- selrow = grd_costlist.selectedRow(currow);
- if(grd_costlist.rowHeight(selrow) == 23)
- {
- grd_costlist.rowHeight(selrow) = 50;
- grd_costlist.cellstyle("font-size",selrow, 1,selrow,grd_costlist.cols -1) = "15pt";
- selzoomin = "Y";
- }
- else
- {
- grd_costlist.rowHeight(selrow) = 23;
- grd_costlist.cellstyle("font-size",selrow, 1 , selrow, grd_costlist.cols -1) = "10pt";
- }
- }
- }
-
- if(selzoomin == "Y")grd_costlist.ellipsis ="false";
- else grd_costlist.ellipsis ="true";
- }
-
- // Zoom In Zoom Out
- function fWindowPosition(inout)
- {
- var sVisible = true;
-
- if (inout =="O") {
- swt_select.attribute("style") = "left:0px; top:180px; width:1195px; height:419px; border-style:solid; ";
- btn_cost.attribute("style") = "left:0px; top:159px; width:149px; height:22px; ";
- btn_excel.attribute("style") = "left:149px; top:159px; width:160px; height:22px; ";
- grd_costlist.attribute("style") = "left:0px; top:29px; width:1193px; height:379px;";
- }
- else {
- sVisible = false;
- swt_select.attribute("style") = "left:0px; top:31px; width:1195px; height:558px; border-style:solid; ";
- btn_cost.attribute("style") = "left:0px; top:10px; width:149px; height:22px; ";
- btn_excel.attribute("style") = "left:149px; top:10px; width:160px; height:22px; ";
- grd_costlist.attribute("style") = "left:0px; top:29px; width:1193px; height:518px; ";
- }
- roundrect2.visible = sVisible;
- cap_instcd.visible = sVisible;
- cmb_instcd.visible = sVisible;
- cap_goodflag.visible = sVisible;
- cmb_goodflag.visible = sVisible;
- cap_maincustlastsuplplce.visible= sVisible;
- ipt_maincustlastsuplplce.visible= sVisible;
- btn_maincustlastsuplplce.visible= sVisible;
- cap_lrgcd.visible = sVisible;
- ipt_lrgcd_search.visible = sVisible;
- btn_lrgcd.visible = sVisible;
- cap_goodcd.visible = sVisible;
- ipt_goodcd.visible = sVisible;
- cap_suppcustcd.visible = sVisible;
- ipt_suppcustcd.visible = sVisible;
- btn_suppcustcd.visible = sVisible;
- line_title.visible = sVisible;
-
- model.refresh();
- }
-
-
-
- function fSetDataCopy(pnode,nodename)
- {
- misfGridInit(grd_goodhistory);
-
- if (swt_select.selectedIndex == 0)
- {
- misfGridInit(grd_costlist);
- fgrid = grd_costlist;
- }
- else return;
-
- var codynode = instance1.selectNodes(pnode + "/*");
-
- var tmpdata = "";
- for (var j = 1; j <= codynode.length ; j++) {
- misfGridIUD(fgrid,"A");
- addRow = fgrid.rows - fgrid.fixedRows;
-
- for(var curcol = 1; curcol < fgrid.cols ; curcol++)
- {
- tmpdata = model.getValue(pnode +"/" + nodename + "[" + j + "]/" + fgrid.colAttribute(curcol, "ref"));
- if(tmpdata.length> 0)model.setValue(fgrid.nodeset + "[" + addRow + "]/" + fgrid.colAttribute(curcol, "ref") , tmpdata);
- }
- addRow = addRow + 1;
- }
- fgrid.clearStatus();
- model.refresh();
- }
-
-
- 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;
- }
- */
-
- model.setValue("/root/send/goodlist/offset","0");
- model.setValue("/root/send/goodlist/pagesize", 20);
- return true;
- }
- function zoomInAndOut(string) {
- if (string == "in") {
- currZoom = myContainer.style.zoom;
- currZoom = currZoom.substring(0, currZoom.length - 1);
- currZoom = parseInt(currZoom, 10);
- newZoom = currZoom + 1;
-
- if (newZoom> 10000) return;
-
- myContainer.style.zoom = newZoom + "%";
- }
- else if (string == "out") {
- currZoom = myContainer.style.zoom;
- currZoom = currZoom.substring(0, currZoom.length - 1);
- currZoom = parseInt(currZoom, 10);
- newZoom = currZoom - 1;
-
- if (newZoom <1) return;
-
- myContainer.style.zoom = newZoom + "%";
- }
- }
- function fSubmitOnScroll() {
- if (swt_select.selectedIndex == 0)fgrid = grd_costlist;
- else return;
- if(fgrid.vscroll.attribute("max") == fgrid.vscroll.attribute("pos")) {
- model.setValue("/root/send/goodlist/offset", fgrid.rows-fgrid.fixedRows);
- submit("TRRSC00601");
- }
- }
-
- // 물품구분별 권한체크.
- function fSetGoodFlagAuth()
- {
- btn_save.disabled=true;
-
- rszfGetPurcGoodFlagAuthInfo(cmb_instcd.value , cmb_goodflag.value, getUserInfo("userid"), "%");
-
- if(rszfGetGoodFlagAuthInfoByCond("goodflagauth") =="Y")
- {
- btn_save.disabled=false;
- }
- }
-
- //----------------------------
- // Save Excel Data
- //----------------------------
- function fSaveGoodExcel()
- {
- var tPath = "/root/send/save/excelgoodlists";
- var sPath = "/root/init/CopyData/CopyGoodLists";
-
- if (instance1.selectNodes(sPath+"/*").length < 1) return;
-
- var vData = "";
- var vHeader = "status" + "▦" // 입력(i), 수정(u), 삭제(d) 구분
- + "instcd" + "▦" // 기관코드
- + "goodcd" + "▦" // 물품코드
- + "fromdd" + "▦" // 사용시작일
- + "purcflag" + "▦" // 구매구분(구매, 수탁, 위탁)
- + "reqmthd" + "▦" // 처방집계,정량보충,일반청구
- + "reqprid" + "▦" // 청구주기
- + "prodcmpycd" + "▦" // 제조회사코드
- + "maincustlastsuplplce" + "▦" // 최종공급처
- + "suppcustcd" + "▦" // 보조거래처코드
- + "goodunitcost" + "▦" // 제품단가
- + "cmt" + "▩"; // 비고
-
- //
- for (var cRow = grd_copygood.fixedRows ; cRow < grd_copygood.rows ; cRow++)
- {
- vData += "i" + "▦" // 입력(i), 수정(u), 삭제(d) 구분
- + model.getValue(cmb_instcd.attribute("ref") ) + "▦" // 기관코드
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/goodcd" ) + "▦" // 물품코드
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/fromdd" ) + "▦" // 사용시작일
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/purcflag" ) + "▦" // 구매구분(구매, 수탁, 위탁)
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/reqmthd" ) + "▦" // 처방집계,정량보충,일반청구
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/reqprid" ) + "▦" // 청구주기
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/prodcmpycd" ) + "▦" // 제조회사코드
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/maincustlastsuplplce" ) + "▦" // 최종공급처
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/suppcustcd" ) + "▦" // 보조거래처코드
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/goodunitcost" ) + "▦" // 제품단가
- + model.getValue(grd_copygood.nodeset+"["+cRow+"]/cmt")+ "Excel 일괄변경" + "▩"; // 비고
- }
-
- //
- model.removenode(tPath);
-
- model.makeNode(tPath+"/goodexcel");
- model.setValue(tPath+"/goodexcel" ,vHeader+vData);
-
- submit("TXRSC03703");
-
- if (model.getValue(gvErrorMsgPath + "/type") != "error") {
- misfGridInit(grd_copygood);
- grp_copygood.visible = false;
- alert("자료처리완료!!! 확인요.");
- } else {
- alert("저장 실패!!! 확인요.");
- }
- }
- /* ------------------------------------------------- */
- /* ------End Of List ------------------------------- */
- /* -------------------------------------------------- */
|