12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439 |
- /* ---------------------------------------------------------------------
-
- SMRSI00101_입고관리.xrw (SMRSI00101.xfm - JScript )
- - Version :
- 1) : Ver.1.00.01
- : Create By Francis Choi
- : 2015.05.02
- ---------------------------------------------------------------------- */
- var vWinQty = 0;
- var vWinAmt = 0;
- var vWinQtySel = 0;
- var vWinAmtSel = 0;
- var gIndex = ""; // 02 물품구분
- var gGoodflag = ""; // 02 물품구분
- var gSuplplcecd = ""; // 03 주거래처
- var gSuppcustcd = ""; // 04 보조거래처
- var gPurcCloseYymm = ""; // 05 최종마감년월
-
-
- var gTabIdx1 = "0"; //TAB INDEX
-
- var gPathName = "goodnonwin#goodwin"
- var gPathNm = gPathName.split("#");
- var gPathDetailName = "goodnonwinlist#goodwinlist"
- var gPathDetailNm = gPathDetailName.split("#");
- var gGridName = "nonwin#goodwin"
- var gGridNm = gGridName.split("#");
-
- // --------------------------------------------------
- // 화면 Control을 초기화한다
- // --------------------------------------------------
- function fInit() {
-
- //화면 Control을 초기화한다
- // fCheckAuth();
- fInitialize();
- }
-
- // --------------------------------------------------
- // 저장권한 설정한다
- // --------------------------------------------------
- function fCheckAuth() {
- btn_search.disabled = !checkAuth("R") ;
- btn_save.disabled = !checkAuth("X") ;
- }
-
-
- // --------------------------------------------------------------
- // 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
- // --------------------------------------------------------------
- function fInitialize() {
-
- // model.resetInstanceNode("/root/send");
-
- //rszfUserGoodFlagList(cmb_goodflag,getUserInfo("userid"));
- rszfGoodFlagListByPgmGubn(cmb_goodflag,"1","N");
-
- rszfUserInstList(cmb_instcd,getUserInfo("userid"));
-
- misfComboComCdList("R0111",cmb_purcflag,"Y");
- misfComboComCdList("R0109",cmb_calcdocukind);
- // misfComboComCdListMulti("R0109","cmb_calcdocukind");
- // 조회가 아닌데 전체는 의미가 없다...HBH . 2007.08.13
- //rszfComboAppendBlankChild("cmb_calcdocukind");
-
- misfGridInit(grd_goodwin);
- misfGridInit(grd_nonwin);
-
- misfMsterDetailSet(grd_goodwin,null , "TRRSI00101" ,"Y");
- misfMsterDetailSet(grd_goodreq,grd_goodwin, "TRRSD00410" ,"N");
-
- var curdate = getCurrentDate();
- var cvtdate = curdate.toDate("YYYYMMDD");
-
- model.setValue(ipt_windd.attribute("ref") , curdate);
- model.setValue(ipt_reqfrdd.attribute("ref") , cvtdate.getAddDate(-10,"D").getDateFormat("YYYYMMDD"));
- model.setValue(ipt_reqtodd.attribute("ref") , curdate);
-
- //입고조회시 입고일자 1주일 간격 기본 설정.
- model.setValue(ipt_winfrdd.attribute("ref") , cvtdate.getAddDate(-7, "D").getDateFormat("YYYYMMDD"));
- model.setValue(ipt_wintodd.attribute("ref") , curdate);
-
- //hidden
- model.setValue(ipt_iokind.attribute("ref") ,'1A'); // 입출유형.
- model.setValue(opt_interfacegubn.attribute("ref"),'P' ); // 'B' 평화드림.
-
- model.setValue(ipt_sumwinqty.attribute("ref"),0);
- model.setValue(opt_sumwinamt.attribute("ref"),0);
-
- // Total 발주건수, 발주금액 초기화
- model.setValue(opt_sumreqqty.attribute("ref"),0);
- model.setValue(opt_sumreqfla.attribute("ref"),0);
-
- rszfRscsysinftLists(getUserInfo("dutplceinstcd"));
- gPurcCloseYymm = getRscsysinftInfo("purccloseyymm");
-
- model.setValue(cmb_instcd.attribute("ref") , getUserInfo("dutplceinstcd"));
- model.setValue(ipt_windeptcd.attribute("ref") , getUserInfo("dutplcecd" ));
- model.setValue(ipt_windeptnm.attribute("ref") , getUserInfo("dutplcenm" ));
- model.setValue(ipt_winpsn.attribute("ref") , getUserInfo("userid" ));
- model.setValue(opt_winpsnnm.attribute("ref") , getUserInfo("usernm" ));
-
- if(getUserInfo("dutplceinstcd") == "014") {
- model.setValue(chk_reqpsnyn.attribute("ref") , "Y");
- model.setValue(ipt_reqpsn.attribute("ref") , getUserInfo("userid" ));
- model.setValue(ipt_reqpsnnm.attribute("ref") , getUserInfo("usernm" ));
-
- if(gPurcCloseYymm >= getCurrentDate().substr(0,6)) {
- messageBox("마감이 완료되어 입고처리가 불가능합니다.", "I");
- btn_save.disabled = true;
- } else {
- btn_save.disabled = false;
- }
-
- }
-
-
- rdo_paycond.select(0);
- cmb_calcdocukind.select(0);
- cmb_goodflag.select(0);
-
- grd_goodwin.explorerbar = "sortshow";
- grd_goodreq.explorerbar = "sortshow";
- grd_nonwin.explorerbar = "sortshow";
-
- // grd_goodwin.frozenCols = grd_goodwin.colRef("winunit");
-
- // 물품구분별 권한
- fSetGoodFlagAuth();
-
- fDtiOptionView();
- model.refresh();
- }
-
- // --------------------------------------------------------------
- // 물품구분별 권한체크.
- // --------------------------------------------------------------
- function fSetGoodFlagAuth()
- {
- btn_save.disabled =true;
- btn_select.disabled =true;
- btn_subdelive.disabled=true;
- btn_delive.disabled =true;
- btn_choidel.disabled =true;
- btn_insert.disabled =true;
-
- rszfGetPurcGoodFlagAuthInfo(cmb_instcd.value , cmb_goodflag.value, getUserInfo("userid"), "%");
-
- if (rszfGetGoodFlagAuthInfoByCond("goodflagauth") =="Y") {
- btn_save.disabled=false;
- btn_select.disabled=false;
- btn_subdelive.disabled=false;
- btn_delive.disabled=false;
- btn_choidel.disabled=false;
- btn_insert.disabled=false;
- }
- }
-
- // --------------------------------------------------------------
- // 거래처의 전화번호를 Setting한다.
- // --------------------------------------------------------------
- function fValiDataCheckSetting() {
- if (model.getValue("/root/init/main/reqcustomlist/entrregno") != "") {
- model.setValue(opt_cntctel.attribute("ref"), model.getValue("/root/init/main/reqcustomlist/cntctel"));
- }
-
- }
- // --------------------------------------------------------------
- // 평화드림 미입고 데이타 load
- // --------------------------------------------------------------
- function fDataLoadNoWin()
- {
- //messatgebox
- submit("TRRSI00103");
-
- for(var currow = grd_nonwin.fixedRows ; currow < grd_nonwin.rows ; currow++)
- {
- model.setValue(grd_nonwin.nodeset + "[" + (currow - grd_nonwin.fixedRows + 1)+ "]/select","Y");
- grd_nonwin.rowStatus(currow) = "2";
- }
- }
-
- // --------------------------------------------------------------
- // 조회 조건 데이타 Check
- // --------------------------------------------------------------
- function fCheckRetrieveData(pmsg)
- {
- if (fCheckIdValue(pmsg, "cmb_instcd" , "기관코드를 " , "C002")) return false;
- if (fCheckIdValue(pmsg, "cmb_goodflag" , "물품구분을 " , "C002")) return false;
- //if (fCheckIdValue(pmsg, "ipt_suplplcecd", "공급처를 " , "C001")) return false;
- if (fCheckIdValue(pmsg, "ipt_winpsn" , "입고담당자를 ", "C001")) return false;
- if (fCheckIdValue(pmsg, "ipt_windeptcd" , "입고부서를 " , "C001")) return false;
-
- if (sch_select.selectedIndex == 0) {
- if (fCheckIdValue(pmsg, "ipt_reqfrdd" , "발주시작일자 ", "C001")) return false;
- if (fCheckIdValue(pmsg, "ipt_reqtodd" , "발주종료일자 ", "C001")) return false;
- // if (fCheckIdValue(pmsg, "ipt_subsuplplcecd" , "보조거래처를 ", "C001")) return false;
- } else {
- if (fCheckIdValue(pmsg, "ipt_windd" , "입고일자를 " , "C001")) return false;
- }
-
- return true;
- }
-
- // ---------------------------------------------------
- // ID 값 Check
- // ---------------------------------------------------
- function fCheckIdValue(pMsgFlag, pIDNm, pMsg, pTail)
- {
- if (model.getValue(eval(pIDNm).attribute("ref")).length== 0 ) {
-
- if (pMsgFlag == true) {
- messageBox(pMsg , pTail);
- model.setFocus(pIDNm);
- }
- return true; // 필수 입력이 없음을 알림.
- }
-
- return false; // 필수입력 있음을 알림.
- }
-
- // ---------------------------------------------------
- // Grid 기본값 입력
- // ---------------------------------------------------
- function fDefaultSetting(prow)
- {
- var grd_setting = (sch_select.selectedIndex == 0) ? grd_nonwin : grd_goodwin;
- //
- model.setValue(grd_setting.nodeset+"["+prow+"]/instcd" ,model.getValue(cmb_instcd.attribute("ref") ));
- model.setValue(grd_setting.nodeset+"["+prow+"]/goodflag" ,model.getValue(cmb_goodflag.attribute("ref") ));
- model.setValue(grd_setting.nodeset+"["+prow+"]/windd" ,model.getValue(ipt_windd.attribute("ref") ));
- model.setValue(grd_setting.nodeset+"["+prow+"]/winpsn" ,model.getValue(ipt_winpsn.attribute("ref") ));
- model.setValue(grd_setting.nodeset+"["+prow+"]/windeptcd" ,model.getValue(ipt_windeptcd.attribute("ref") ));
- //model.setValue(grd_setting.nodeset+"["+prow+"]/installplcecd",model.getValue("/root/send/goodwin/installplcecd"));
- model.setValue(grd_setting.nodeset+"["+prow+"]/paycond" ,model.getValue("/root/send/goodwin/paycond" ));
- //model.setValue(grd_setting.nodeset+"["+prow+"]/temppay" ,model.getValue("/root/send/goodwin/temppay" ));
- model.setValue(grd_setting.nodeset+"["+prow+"]/calcdocukind" ,model.getValue(cmb_calcdocukind.attribute("ref" )));
-
- if (model.getValue(grd_setting.nodeset+"["+prow+"]/calcdocudd")== "") {
- model.setValue(grd_setting.nodeset+"["+prow+"]/calcdocudd" ,model.getValue(ipt_calcdocudd.attribute("ref" )));
- }
-
- //model.setValue(grd_setting.nodeset+"["+prow+"]/suplplcecd" ,model.getValue(ipt_suplplcecd.attribute("ref" )));
- model.setValue(grd_setting.nodeset+"["+prow+"]/winseqno" ,fGetMaxWinSeqNo() );
- model.setValue(grd_setting.nodeset+"["+prow+"]/delivedeptqty",0 );
- model.setValue(grd_setting.nodeset+"["+prow+"]/deliveno" ,0 );
- model.setValue(grd_setting.nodeset+"["+prow+"]/stocqty" ,0 );
- model.setValue(grd_setting.nodeset+"["+prow+"]/iokind" ,model.getValue(ipt_iokind.attribute("ref")) );
- model.setValue(grd_setting.nodeset+"["+prow+"]/paycond" ,model.getValue(rdo_paycond.attribute("ref") ));;
- }
-
- // ---------------------------------------------------
- // Max 입고번호 발취
- // ---------------------------------------------------
- function fGetMaxWinSeqNo()
- {
- var maxwinseqno = "";
- for (var currow = grd_goodwin.fixedRows ; currow < grd_goodwin.rows; currow++)
- {
- if (maxwinseqno < grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winseqno")))
- maxwinseqno = grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winseqno"));
- }
-
- maxwinseqno = "" +((maxwinseqno.length == 0) ? "001" : parseInt(maxwinseqno) + 1);
-
- return maxwinseqno.getLeftPad(3,"0");
- }
-
- // ---------------------------------------------------
- // 물품정보 LIST Setting
- // ---------------------------------------------------
- function fSettingGoodList(pnode, nodename, userqtynm){
-
- var codynode = instance1.selectNodes(pnode + "/*");
- var addRow = grd_goodwin.rows - grd_goodwin.fixedRows;
-
- if (model.getValue(grd_goodwin.nodeset + "[" + addRow + "]/goodcd").length > 0) addRow = addRow + 1;
-
- for (var j = 1; j <= codynode.length ; j++) {
- if (addRow > grd_goodwin.rows - grd_goodwin.fixedRows)
- {
- misfGridIUD(grd_goodwin,"A");
- addRow = grd_goodwin.rows - grd_goodwin.fixedRows;
- fDefaultSetting(addRow );
- }
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/goodcd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodcd" ));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/goodnm" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodnm" ));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/goodspec" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodspec" ));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/goodmodel" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodmodel" ));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/prodcmpynm" , model.getValue(pnode +"/" + nodename + "[" + j + "]/prodcmpynm" ));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/winpackqty" , model.getValue(pnode +"/" + nodename + "[" + j + "]/" + userqtynm));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/winpackunit", model.getValue(pnode +"/" + nodename + "[" + j + "]/purcunit" ));
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/winunit" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purcunit" ));
-
- if (model.getValue(pnode +"/" + nodename + "[" + j + "]/exchqty") != "0" &&
- model.getValue(pnode +"/" + nodename + "[" + j + "]/exchqty").length>0 )
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/winpackcntperunit" , model.getValue(pnode +"/" + nodename + "[" + j + "]/exchqty"));
- else
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/winpackcntperunit" ,"1");
-
- model.setValue(grd_goodwin.nodeset + "[" + addRow + "]/winunitcost" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodunitcost"));
-
- addRow = addRow + 1;
- }
-
- model.recalculate();
- model.refresh();
- }
-
- // ---------------------------------------------------
- // 출고생성되지 않은 데이타라면 출고시 입력을 위해 insert logic으로 구현한다
- // ---------------------------------------------------
- function fSettingPreSaveData()
- {
- for(var liRow = grd_goodreq.fixedRows ; liRow < grd_goodreq.rows ; liRow++)
- {
- //출고생성되지 않은 데이타라면 출고시 입력을 위해 insert logic으로 구현한다
- if((grd_goodreq.valueMatrix(liRow ,"delivedd").length == 0 ||
- grd_goodreq.valueMatrix(liRow ,"deliveno").length == 0 ||
- grd_goodreq.valueMatrix(liRow ,"deliveseqno").length == 0) &&
- grd_goodreq.rowStatus(liRow) == "1" ) grd_goodreq.rowStatus(liRow) = "2";
- }
- }
-
- // ---------------------------------------------------
- // 출고부서, 입고부서를 SETTING
- // ---------------------------------------------------
- function fSettingSaveInData()
- {
- for (var liRow = grd_nonwin.fixedRows; liRow < grd_nonwin.rows ; liRow++)
- {
- fDefaultSetting(liRow);
- model.setValue( grd_nonwin.nodeset + "[" + (liRow - grd_nonwin.fixedRows + 1) + "]/windeptcd"
- , model.getValue(ipt_windeptcd.attribute("ref")));
- model.setValue( grd_nonwin.nodeset + "[" + (liRow - grd_nonwin.fixedRows + 1) + "]/delivedeptcd"
- , model.getValue(ipt_windeptcd.attribute("ref")));
- }
- }
-
- // ---------------------------------------------------
- // 출고Data Save
- // ---------------------------------------------------
- function fSettingSaveOutData()
- {
- if ( getGridUpdateData(grd_goodreq) == "" ) {
- messageBox("변경내역이 없습니다. ", "I999");
- return;
- }
- var winqty = parseFloat(grd_goodwin.valueMatrix(grd_goodwin.row, grd_goodwin.colRef("remainderqty")));
- var outqty = 0.0;
-
- for (var liRow = grd_goodreq.fixedRows ; liRow < grd_goodreq.rows ; liRow++) {
- if((grd_goodreq.rowStatus(liRow) == "1" || grd_goodreq.rowStatus(liRow) == "2") &&
- (grd_goodreq.valueMatrix(liRow , grd_goodreq.colRef("deliveprcsflag") ) == "3") ) {
- grd_goodreq.rowStatus(liRow) = "1";
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/delivedeptcd", model.getValue(ipt_windeptcd.attribute("ref"))); // 출고부서(구매팀)
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/deliveunit" , grd_goodreq.valueMatrix(liRow ,grd_goodreq.colRef("requnit") )); // 출고단위(청구단위)
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/windeptcd" , grd_goodreq.valueMatrix(liRow ,grd_goodreq.colRef("reqdeptcd") )); // 입고부서(청구부서)
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/windd" , grd_goodwin.valueMatrix(grd_goodwin.row ,grd_goodwin.colRef("windd") )); // 입고일자
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/winno" , grd_goodwin.valueMatrix(grd_goodwin.row ,grd_goodwin.colRef("winno") )); // 입고번호
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/winseqno" , grd_goodwin.valueMatrix(grd_goodwin.row ,grd_goodwin.colRef("winseqno"))); // 입고순번
- }
-
- outqty = ( outqty + parseFloat(grd_goodreq.valueMatrix(liRow , grd_goodreq.colRef("delivedeptqty"))) );
-
- if (winqty < outqty) {
- messageBox(liRow + " 번째 누적 출고량이 입고량 보다 많습니다. 출고량을 조정하여" ,"C001");
- return;
- }
- }
-
- model.setValue("/root/send/gooddelive/gooddelivelist", grd_goodreq.getUpdateData());
- model.refresh();
-
- submit("TXRSO00101");
-
- if (model.getValue(gvErrorMsgPath + "/type") != "error") btn_search.dispatch("DOMActivate");
-
- //출고생성되지 않은 데이타라면 출고시 입력을 위해 insert logic으로 구현한다
- //[20090410] YYJ 현 페이지에서 출고에 대한 수정을 막는다.. ( 청구를 기준으로 하기 때문에 출고 수정시 정산 여부등을 판단하기 모호하다
- // 출고 관련 개별화된 화면 필요
- /* ================
- for (var liRow = grd_goodreq.fixedRows ; liRow < grd_goodreq.rows ; liRow++) {
-
- //출고생성되지 않은 데이타라면 출고시 입력을 위해 insert logic으로 구현한다
-
- if ((grd_goodreq.valueMatrix(liRow ,grd_goodreq.colRef("delivedd")).length == 0 ||
- grd_goodreq.valueMatrix(liRow ,grd_goodreq.colRef("deliveno")).length == 0 ||
- grd_goodreq.valueMatrix(liRow ,grd_goodreq.colRef("deliveseqno")).length == 0) && grd_goodreq.rowStatus(liRow) == "2")
- {
- grd_goodreq.rowStatus(liRow) = "1";
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/deliveunit" , grd_goodreq.valueMatrix(liRow ,grd_goodreq.colRef("requnit")));
- model.setValue(grd_goodreq.nodeset + "[" + (liRow - grd_goodreq.fixedRows + 1) + "]/delivedeptcd" , model.getValue(ipt_windeptcd.attribute("ref") ));
- }
- }
-
- model.setValue("/root/send/gooddelive/gooddelivelist", grd_goodreq.getUpdateData());
- model.refresh();
- submit("TXRSO00101");
-
- if (model.getValue(gvErrorMsgPath + "/type") != "error") btn_search.dispatch("DOMActivate");
- else
- {
- for(var liRow = grd_goodreq.fixedRows ; liRow < grd_goodreq.rows ; liRow++)
- {
- //출고생성되지 않은 데이타라면 출고시 입력을 위해 insert logic으로 구현한다
- if((grd_goodreq.valueMatrix(liRow , grd_goodreq.colRef("delivedd")).length == 0 ||
- grd_goodreq.valueMatrix(liRow , grd_goodreq.colRef("deliveno")).length == 0 ||
- grd_goodreq.valueMatrix(liRow , grd_goodreq.colRef("deliveseqno")).length == 0 ) &&
- grd_goodreq.rowStatus(liRow) == "1") grd_goodreq.rowStatus(liRow) = "2";
- }
- }
- ============== */
- }
- // --------------------------------------------------------------
- // 입력 데이타 Check
- // --------------------------------------------------------------
- function fCheckSaveData()
- {
- if (fCheckIdValue(true, "cmb_instcd" , "기관코드를 " , "C002")) return false;
- if (fCheckIdValue(true, "cmb_goodflag" , "물품구분을 " , "C002")) return false;
- if (fCheckIdValue(true, "ipt_windd" , "입고일자를 " , "C001")) return false;
- if (fCheckIdValue(true, "ipt_windeptcd", "입고부서를 " , "C001")) return false;
- if (sch_select.selectedIndex == 0)
- {
- if (fCheckIdValue(true, "ipt_windeptcd" , "입고부서를 " , "C001")) return false;
- if (fCheckIdValue(true, "ipt_winpsn" , "입고담당자를 " , "C001")) return false;
- if (fCheckIdValue(true, "rdo_paycond" , "계산방법을 " , "C001")) return false;
- if (fCheckIdValue(true, "cmb_calcdocukind", "계산서유형을 " , "C001")) return false;
- if (fCheckIdValue(true, "ipt_calcdocudd" , "계산서일자를 " , "C001")) return false;
-
- for (var currow = grd_nonwin.fixedRows ; currow < grd_nonwin.rows ; currow++)
- {
- if ((grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("select")) == "Y") &&
- (grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("winqty")).length == 0 ||
- grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("winqty")) == 0 )) {
- messageBox(currow + " 번째 입고량을 " ,"C001");
- grd_nonwin.endEditCell();
- grd_nonwin.row = currow;
- grd_nonwin.col= grd_nonwin.colRef("winqty");
- grd_nonwin.editCell();
- return false;
- }
-
- if((grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("select")) == "Y") &&
- (grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("goodunitcost")).length == 0 ||
- grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("goodunitcost")) == 0 ) ){
-
- messageBox(currow + " 번째 입고단가를 " ,"C001");
- grd_nonwin.endEditCell();
- grd_nonwin.row = currow;
- grd_nonwin.col= grd_nonwin.colRef("goodunitcost");
- grd_nonwin.editCell();
- return false;
- }
- }
- } else{
- // if (fCheckIdValue(true, "ipt_suplplcecd", "공급처를 ", "C001")) return false;
- var winqty = 0;
- var stocqty = 0;
- var delivedeptqty = 0;
-
- for (var currow = grd_goodwin.fixedRows ; currow < grd_goodwin.rows ; currow++)
- {
- if (grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("goodcd")).length == 0) {
- messageBox(currow + " 번째 물품코드를 " ,"C001");
- grd_goodwin.row = currow;
- grd_goodwin.col = grd_goodwin.colRef("goodcd");
- grd_goodwin.editCell();
- return false;
- }
- else {
-
- // for(srcrow = currow + 1 ; srcrow < grd_goodwin.rows ; srcrow++)
- // {
- // if(grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("goodcd")) == grd_goodwin.valueMatrix(srcrow , grd_goodwin.colRef("goodcd")))
- // {
- // messageBox("동일 물품코드가 [" + (currow - grd_goodwin.fixedRows + 1)+ "," + (srcrow - grd_goodwin.fixedRows + 1)+ "->" + grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("goodcd")) + "] 존재하여 저장 " ,"E001");
- // return false;
- // }
- // }
- }
- /* 20081202 YYJ 단가 입력 수정 [ 수량이 0인 발주 생성으로 인해 잠시 보류 ]
- if (grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winqty")).length == 0) {
- messageBox((currow)+ " 번째 요구량을 " ,"C001");
- grd_goodwin.row = currow;
- grd_goodwin.col= grd_goodwin.colRef("winqty");
- grd_goodwin.editCell();
- return false;
- }
-
- if (grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winunitcost")) == 0) {
- messageBox((currow)+ " 번째 단가를 " ,"C001");
- grd_goodwin.row = currow;
- grd_goodwin.col= grd_goodwin.colRef("winunitcost");
- grd_goodwin.editCell();
- return false;
- }
-
- if (grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winamt")) == 0) {
- messageBox((currow -1)+ " 번째 금액을 " ,"C001");
- grd_goodwin.row = currow;
- grd_goodwin.col = grd_goodwin.colRef("winamt");
- grd_goodwin.editCell();
- return false;
- }
- */
- winqty = grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winqty"));
- delivedeptqty = grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("delivedeptqty"));
- stocqty = winqty - delivedeptqty;
- model.setValue(grd_goodwin.nodeset + "[" + (currow - grd_goodwin.fixedRows + 1) + "]/stocqty" , stocqty);
- if(stocqty > 0)model.setValue(grd_goodwin.nodeset + "[" + (currow - grd_goodwin.fixedRows + 1) + "]/stocynindx" , "Y");
- else model.setValue(grd_goodwin.nodeset + "[" + (currow - grd_goodwin.fixedRows + 1) + "]/stocynindx" , "N");
-
- }
- }
-
- return true;
- }
-
- // --------------------------------------------------------------
- // 입력 데이타 Check
- // --------------------------------------------------------------
- function fAfterRetrieve()
- {
- if (sch_select.selectedIndex == 0)
- {
- var nonwinqty = 0;
- var nonwinamt = 0.0;
- for (var currow = grd_nonwin.fixedRows ; currow < grd_nonwin.rows ; currow++)
- {
- nonwinamt += parseFloat(grd_nonwin.valueMatrix(currow , grd_nonwin.colRef("reqfla")));
- }
-
- model.setValue(opt_sumreqqty.attribute("ref"),grd_nonwin.rows - grd_nonwin.fixedRows);
- model.setValue(opt_sumreqfla.attribute("ref"),nonwinamt);
-
- // 입고건수,금액 초기화
- model.setValue(opt_winqtycnt.attribute("ref") ,"0");
- model.setValue(opt_winqtytotal.attribute("ref"),"0");
-
- }else{
- var winqty = 0.0;
- var winamt = 0.0;
- for (var currow = grd_goodwin.fixedRows ; currow < grd_goodwin.rows ; currow++)
- {
- winqty += parseFloat(grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winqty")) );
- winamt += parseFloat(grd_goodwin.valueMatrix(currow , grd_goodwin.colRef("winamt")) );
-
- if (model.getValue(grd_goodwin.nodeset+"["+ currow + "]/slipno") != "") {
- grd_goodwin.isReadOnly(currow, grd_goodwin.colRef("winnum"), currow, grd_goodwin.colRef("slipno")) = true;
- }
- }
-
- model.setValue(ipt_sumwinqty.attribute("ref"),grd_goodwin.rows - grd_goodwin.fixedRows);
- model.setValue(opt_sumwinamt.attribute("ref"),winamt);
- }
-
- if (sch_select.selectedIndex == 0)
- {
- if (model.getValue("/root/main/list/goodnonwin/goodmaxwinno/winno").length > 0)
- model.setValue(ipt_winno.attribute("ref"),model.getValue("/root/main/list/goodnonwin/goodmaxwinno/winno"));
- }
- else {
- if (model.getValue("/root/main/list/goodwin/goodmaxwinno/winno").length > 0)
- model.setValue(ipt_winno.attribute("ref"),model.getValue("/root/main/list/goodwin/goodmaxwinno/winno"));
- }
-
- /* 왜 하는지 몰른다...막는다........2007.10.12 */
- //fArrangeControl("true");
-
- model.refresh();
- }
-
- // --------------------------------------------------------------
- // 입고번호 Control
- // --------------------------------------------------------------
- function fArrangeControl(pDisabled)
- {
- cmb_instcd.disabled = pDisabled;
- cmb_goodflag.disabled = pDisabled;
- ipt_windeptcd.disabled = pDisabled;
- ipt_winpsn.disabled = pDisabled;
-
- if (pDisabled == "true") {
- ipt_winno.attribute("editable") = "false";
- }
- else {
- model.removeNodeset(grd_goodwin.nodeset);
- model.removeNodeset(grd_nonwin.nodeset);
- model.removeNodeset(grd_goodreq.nodeset);
- ipt_winno.attribute("editable") = "true";
- }
-
- model.setFocus("ipt_winno");
- model.refresh();
- }
-
- // --------------------------------------------------------------
- // 입고수량 합계 Control
- // --------------------------------------------------------------
- function fWinqtyTotal()
- {
- var amt = 0.0;
- var amt2 = 0.0;
- var cnt = 0;
- var bigoamt = 0.0;
-
- bigoamt = parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("winqty" )))
- + parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("prewinqty")));
-
- if (parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("reqqty"))) < bigoamt) {
- grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("winqty")) = 0;
- messageBox("발주량을 초과하였습니다. 다시 입력하세요.", "");
- }
-
- grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("winqtytotal")) = parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("goodunitcost")))
- * parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("winqty" )));
- grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("reqfla")) = parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("goodunitcost")))
- * parseFloat(grd_nonwin.valueMatrix(grd_nonwin.row, grd_nonwin.colRef("reqqty" )));
- grd_nonwin.refresh();
-
- for (var r = grd_nonwin.fixedRows; r < grd_nonwin.rows; r++) {
- if (grd_nonwin.valueMatrix(r, grd_nonwin.colRef("select")) == 'Y' ) {
- amt = ( parseFloat(amt) + parseFloat( grd_nonwin.valueMatrix(r, grd_nonwin.colRef("winqtytotal"))));
- cnt ++;
- }
- amt2 = ( parseFloat(amt2) + parseFloat( grd_nonwin.valueMatrix(r, grd_nonwin.colRef("reqfla" ))));
- }
-
- model.setValue(opt_sumreqfla.attribute("ref") , amt2);
-
- model.setValue(opt_winqtycnt.attribute("ref") , cnt);
- model.setValue(opt_winqtytotal.attribute("ref"), amt);
-
- opt_sumreqfla.refresh();
- opt_winqtycnt.refresh();
- opt_winqtytotal.refresh();
- }
-
- // --------------------------------------------------------------
- // 출고완료여부 따라 출고량 수정여부 SETTING
- // --------------------------------------------------------------
- function fGoodReqListSetting()
- {
- grd_goodreq.colStyle(grd_goodreq.colRef("delivedeptqty"), "data", "color") = "black";
- for(var currow = grd_goodreq.fixedRows ; currow < grd_goodreq.rows ; currow++)
- {
- if (grd_goodreq.valueMatrix(currow, grd_goodreq.colRef("deliveprcsflag")) == "7" ) //출고 완료된 경우 출고량을 수정 하지 못하게 Grid를 막는다.
- grd_goodreq.isReadOnly(currow , grd_goodreq.colRef("delivedeptqty" )) = true;
- else
- grd_goodreq.isReadOnly(currow , grd_goodreq.colRef("delivedeptqty" )) = false;
- }
- }
-
- // --------------------------------------------------
- // View Option 처리하는 함수
- // --------------------------------------------------
- function fViewOptionSingle(pColName) {
-
- var vColName = "";
- var sNode = null;
- var oPath = "/root/init/Options/option_"+ gTabIdx1 +"/";
-
- var vOpTail = "_op_"+gTabIdx1;
- var pGrid = eval("grd_"+gGridNm[gTabIdx1])
- pGrid.colHidden(pGrid.colRef(pColName)) = (eval("chk_"+pColName + vOpTail).value =="Y") ? false : true;
-
- pGrid.refresh();
- }
- // --------------------------------------------------------------
- // 거래처 변경
- // --------------------------------------------------------------
- function fCustChange()
- {
-
- if ((model.getValue(chk_cust.attribute("ref") ) != "Y") &&
- (model.getValue(chk_cust2.attribute("ref")) != "Y") ) {
- alert("변경 여부를 선택하십시요.");
- return;
- };
-
- if ((model.getValue(chk_cust.attribute("ref") ) == "Y") &&
- ((model.getValue(ipt_frsuplplcecd.attribute("ref") ) == "") ||
- (model.getValue(ipt_frsuplplcenm.attribute("ref") ) == "") ||
- (model.getValue(ipt_tosuplplcecd.attribute("ref") ) == "") ||
- (model.getValue(ipt_tosuplplcenm.attribute("ref") ) == "")) ) {
-
- alert("주거래처 코드,명칭을 확인하십시요!!");
-
- return;
- };
-
- if ((model.getValue(chk_cust2.attribute("ref") ) == "Y") &&
- ((model.getValue(ipt_frsubsuplplcecd.attribute("ref") ) == "") ||
- (model.getValue(ipt_frsubsuplplcenm.attribute("ref") ) == "") ||
- (model.getValue(ipt_tosubsuplplcecd.attribute("ref") ) == "") ||
- (model.getValue(ipt_tosubsuplplcenm.attribute("ref") ) == "")) ) {
-
- alert("보조거래처 코드,명칭을 확인하십시요!!");
-
- return;
- };
- var pGrid = (gTabIdx1 == 0) ? grd_nonwin : grd_nonwin;
-
- alert(pGrid.rows);
-
- for (var r = pGrid.fixedRows; r < pGrid.rows; r++) {
- if (model.getValue(chk_cust.attribute("ref") ) == "Y") {
- if (model.getValue(pGrid.nodeset+"["+ r +"]/suplplcecd") == model.getValue(ipt_frsuplplcecd.attribute("ref"))) {
- model.setValue(pGrid.nodeset+"["+ r +"]/suplplcecd",model.getValue(ipt_tosuplplcecd.attribute("ref")));
- model.setValue(pGrid.nodeset+"["+ r +"]/suplplcenm",model.getValue(ipt_tosuplplcenm.attribute("ref")));
- }
- }
-
- //
- if (model.getValue(chk_cust2.attribute("ref") ) == "Y") {
- if (model.getValue(pGrid.nodeset+"["+ r +"]/subsuplplcecd") == model.getValue(ipt_frsubsuplplcecd.attribute("ref"))) {
-
- model.setValue(pGrid.nodeset+"["+ r +"]/subsuplplcecd",model.getValue(ipt_tosubsuplplcecd.attribute("ref")));
- model.setValue(pGrid.nodeset+"["+ r +"]/subsuplplcenm",model.getValue(ipt_tosubsuplplcenm.attribute("ref")));
- }
- }
- }
- pGrid.refresh();
- grp_cust.visible = false;
- }
-
- //==========================================================
-
-
- // --------------------------------------------------------------
- // 조회후 값 SUM처리한다
- // --------------------------------------------------------------
- function fDataSum(pGrid)
- {
- vWinQty = 0;
- vWinAmt = 0;
-
- // 결재 내역 List
- for (var fRow = pGrid.fixedRows ; fRow < pGrid.rows ; fRow++) {
-
- vWinQty += parseFloat(pGrid.valueMatrix(fRow, pGrid.colRef("winqty")));
- vWinAmt += parseFloat(pGrid.valueMatrix(fRow, pGrid.colRef("winamt")));
- }
- }
- // --------------------------------------------------
- // 화면 Control을 초기화한다
- // --------------------------------------------------
- function fClearData() {
-
- misfGridInit(eval("grd_"+gGridNm[gTabIdx1]+"_tree"));
- misfGridInit(eval("grd_"+gGridNm[gTabIdx1]));
-
- model.setValue(eval("opt_"+gGridNm[gTabIdx1]+"_qty").attribute("ref"),"");
- model.setValue(eval("opt_"+gGridNm[gTabIdx1]+"_amt").attribute("ref"),"");
-
- model.refresh();
- return;
- }
-
- // --------------------------------------------------------------
- // 조회후 값 SUM처리한다
- // pGrid : 선택그리드, pFlag : Y:선택, N :취소
- // --------------------------------------------------------------
- function fDataChkAllSelect(pFlag) {
- vWinQtySel = 0;
- vWinAmtSel = 0;
-
- var pGrid = eval("grd_"+gGridNm[gTabIdx1])
- // 결재 내역 List
- for (var fRow = pGrid.fixedRows ; fRow < pGrid.rows ; fRow++) {
- fDataCheckSelect(pGrid, fRow, pFlag);
- }
-
- pGrid.refresh();
- }
-
- function fDataCheckSelect(pGrid, pRow, pFlag) {
- vCheck = 0;
-
- if ((model.getValue(pGrid.nodeset+"["+pRow+"]/calccnfmyn") == "Y") &&
- (model.getValue(pGrid.nodeset+"["+pRow+"]/winprcsflag") == "9") ){
- vCheck = 1;
- }
-
- ChkFlag = model.getValue(pGrid.nodeset+"["+pRow+"]/oldchkyn");
-
- if (ChkFlag == "") ChkFlag = "N";
-
- if (ChkFlag == pFlag){
- vCheck = 1;
- }
- if (vCheck == 0) {
- pGrid.rowStatus(pRow) = "2";
- model.setValue(pGrid.nodeset + "[" + pRow + "]/chkyn", pFlag);
- } else {
- pGrid.removeStatus(pRow, "update");
- model.setValue(pGrid.nodeset + "[" + pRow + "]/chkyn", ChkFlag);
- }
-
- // pGrid.refresh();
- }
-
-
- // --------------------------------------------------------------
- // 조회후 값 SUM처리한다
- // --------------------------------------------------------------
- function fDataAllSelect(pFlag) {
- vWinQtySel = 0;
- vWinAmtSel = 0;
-
- // 결재 내역 List
- for (var fRow = grd_rsihdpaplist.fixedRows ; fRow < grd_rsihdpaplist.rows ; fRow++) {
- if (grd_rsihdpaplist.valueMatrix(fRow, grd_rsihdpaplist.colRef("slipdd")) == "") {
- if (pFlag == "Y") {
- vWinQtySel += parseFloat(grd_rsihdpaplist.valueMatrix(fRow, grd_rsihdpaplist.colRef("winqty")));
- vWinAmtSel += parseFloat(grd_rsihdpaplist.valueMatrix(fRow, grd_rsihdpaplist.colRef("winamt")));
-
- if (model.getValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkyn") !="Y") {
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkyn" ,pFlag);
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkpsn" ,getUserInfo("userid"));
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkpsnnm",getUserInfo("usernm"));
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkdd" ,getCurrentDate() );
- }
- } else {
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkpsn" , '');
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkpsnnm", '');
- model.setValue(grd_rsihdpaplist.nodeset+ "[" + fRow + "]/chkdd" , '');
- }
- }
- }
-
- //
- model.refresh();
- }
- // --------------------------------------------------------------
- // 조회후 값 SUM처리한다
- // --------------------------------------------------------------
- function fDataSelectSum(pGrid)
- {
- vWinQtySel = 0;
- vWinAmtSel = 0;
-
- // 결재 내역 List
- for (var fRow = pGrid.fixedRows ; fRow < pGrid.rows ; fRow++) {
- if (pGrid.valueMatrix(fRow, pGrid.colRef("slipdd")) == "" ) {
- if (pGrid.valueMatrix(fRow, pGrid.colRef("chkyn" )) == "Y") {
- vWinQtySel += parseFloat(pGrid.valueMatrix(fRow, pGrid.colRef("winqty")));
- vWinAmtSel += parseFloat(pGrid.valueMatrix(fRow, pGrid.colRef("winamt")));
- }
- }
- }
-
- model.setValue(opt_winqtysel.attribute("ref") ,vWinQtySel);
- model.setValue(opt_winamtsel.attribute("ref") ,vWinAmtSel);
- model.refresh();
- }
- // --------------------------------------------------------------
- // 조회후 값 SUM처리한다
- // --------------------------------------------------------------
- function fOnRowChanged(pGrid)
- {
- sPath ="/root/send/";
- tPath ="/root/send/windtl/";
-
- model.setValue(tPath + "instcd" , model.getValue(sPath + "instcd" )); // 기관코드
- model.setValue(tPath + "fromdd" , model.getValue(sPath + "fromdd" )); // 입고일자 FROM
- model.setValue(tPath + "todd" , model.getValue(sPath + "todd" )); // 입고일자 TO
- model.setValue(tPath + "chkyn" , model.getValue(sPath + "chkyn" )); // 검수유무
- model.setValue(tPath + "winpsn" , model.getValue(sPath + "winpsn" )); // 입고자
- model.setValue(tPath + "suppcustcd", model.getValue(sPath + "suppcustcd")); // 보조거래처
- model.setValue(tPath + "purcflag" , model.getValue(sPath + "purcflag" )); // 구매구분
- model.setValue(tPath + "paycond" , model.getValue(sPath + "paycond" )); // 1:정상, 2:지불필
- model.setValue(tPath + "windd" , "" ); // 입고일자
- model.setValue(tPath + "calcdocudd", "" ); // 계산서일자
- model.setValue(tPath +"goodflag" , pGrid.valueMatrix(pGrid.row, pGrid.colRef("goodflag" ))); // 물품구분
- model.setValue(tPath +"suplplcecd" , pGrid.valueMatrix(pGrid.row, pGrid.colRef("suplplcecd" ))); // 주거래처
- model.setValue(tPath +"purcflag" , pGrid.valueMatrix(pGrid.row, pGrid.colRef("purcflag" ))); // 구매구분
- model.setValue(tPath +"calcdocukind", pGrid.valueMatrix(pGrid.row, pGrid.colRef("calcdocukind"))); // 계산서구분
- model.setValue(tPath +"slipdd" , pGrid.valueMatrix(pGrid.row, pGrid.colRef("slipdd"))); // 전표일자
- model.setValue(tPath +"slipno" , pGrid.valueMatrix(pGrid.row, pGrid.colRef("slipno"))); // 전표번호
- model.setValue(tPath +"winpsn" , pGrid.valueMatrix(pGrid.row, pGrid.colRef("winpsn"))); // 입고자
- submit("TRRSI02706");
-
- fAfterRetrieve("2");
- model.refresh();
- }
- // --------------------------------------------------
- // Tree Click
- // --------------------------------------------------
- function fTreeGridClick() {
-
- var OpCode = "";
- var OpDepth = "";
-
- var pGrid = eval("grd_"+gGridNm[gTabIdx1]+"_tree")
- var Idx = pGrid.row;
- var TreePath = pGrid.nodeset;
-
- if (Idx == 0) return;
-
- if (gIndex == Idx) {
- return;
- } else {
- gIndex = Idx;
- }
-
- //
- var vDepth = ""; // 1 LEVEL
- var vPcode = ""; // 2 코드+상위코드
- var vCodecd = ""; // 3 코드
- var vCodenm = ""; // 4 코드명
- var vBasecd = ""; // 5 결합코드
- var vWincnt = ""; // 6 입고건수
- var vWinqty = ""; // 7 입고수량
- var vWinamt = ""; // 8 입고금액
- var vWincnt2 = ""; // 6 입고건수
- var vWinqty2 = ""; // 7 입고수량
- var vWinamt2 = ""; // 8 입고금액
- var vDispnm = ""; // 9 DISPLAY 분류명
- var DispData = ""; //
-
- var vGoodflag = ""; // 02 물품구분
- var vSuplplcecd = ""; // 03 주거래처
- var vSuppcustcd = ""; // 04 보조거래처
- vDepth = model.getValue(TreePath +"["+Idx+"]/depth" ); // 01 LEVEL
- vPcode = model.getValue(TreePath +"["+Idx+"]/pcode" ); // 02 코드+상위코드
- vCodecd = model.getValue(TreePath +"["+Idx+"]/codecd" ); // 03 코드
- vEcodecd = model.getValue(TreePath +"["+Idx+"]/ecodecd"); // 04 EDIT 코드
- vCodenm = model.getValue(TreePath +"["+Idx+"]/codenm" ); // 05 코드명
- vBasecd = model.getValue(TreePath +"["+Idx+"]/basecd" ); // 06 결합코드
- vWincnt = model.getValue(TreePath +"["+Idx+"]/wincnt" ); // 07 입고건수
- vWinqty = model.getValue(TreePath +"["+Idx+"]/winqty" ); // 08 입고수량
- vWinamt = model.getValue(TreePath +"["+Idx+"]/winamt" ); // 09 입고금액
- vWincnt2 = model.getValue(TreePath +"["+Idx+"]/wincnt2"); // 07 입고건수
- vWinqty2 = model.getValue(TreePath +"["+Idx+"]/winqty2"); // 08 입고수량
- vWinamt2 = model.getValue(TreePath +"["+Idx+"]/winamt2"); // 09 입고금액
- vDispnm = model.getValue(TreePath +"["+Idx+"]/dispnm" ); // 10 DISPLAY 분류명
- DispData = vEcodecd + " : " + vCodenm; //
-
- vGoodflag = vPcode.substr( 2, 1); // 02 물품구분
- vSuplplcecd = vPcode.substr( 3, 10); // 03 주거래처
- vSuppcustcd = vPcode.substr(13, 10); // 04 보조거래처
-
- model.setValue(eval("opt_"+gGridNm[gTabIdx1]+"_qty").attribute("ref"), vWinqty);
- model.setValue(eval("opt_"+gGridNm[gTabIdx1]+"_amt").attribute("ref"), vWinamt);
- // if (parseFloat(vWincnt) > 500) {
- // alert("조회량이 500건을 초과하여 시간이 지연됩니다. 하위레벨에서 조회 바랍니다!!");
- // misfGridInit(eval("grd_"+gGridNm[gTabIdx1]));
- // model.refresh();
- // return;
- // }
-
- sPath ="/root/send/";
- tPath ="/root/send/windtl/";
-
- model.setValue(tPath + "instcd" , model.getValue(sPath + "instcd" )); // 기관코드
- model.setValue(tPath + "fromdd" , model.getValue(sPath + "fromdd" )); // 입고일자 FROM
- model.setValue(tPath + "todd" , model.getValue(sPath + "todd" )); // 입고일자 TO
- model.setValue(tPath + "chkyn" , model.getValue(sPath + "chkyn" )); // 검수유무
- model.setValue(tPath + "winpsn" , model.getValue(sPath + "winpsn" )); // 입고자
- model.setValue(tPath + "suplplcecd" , model.getValue(sPath + "suplplcecd" )); // 주거래처
- model.setValue(tPath + "suppcustcd" , model.getValue(sPath + "suppcustcd" )); // 보조거래처
- model.setValue(tPath + "purcflag" , model.getValue(sPath + "purcflag" )); // 구매구분
- model.setValue(tPath + "paycond" , model.getValue(sPath + "paycond" )); // 1:정상, 2:지불필
- model.setValue(tPath + "searchflag" , model.getValue(sPath + "searchflag" )); // 조회구분
- model.setValue(tPath + "frcalcdocudd" , model.getValue(sPath + "frcalcdocudd")); // 계산서일자 FR
- model.setValue(tPath + "tocalcdocudd" , model.getValue(sPath + "tocalcdocudd")); // 계산서일자 TO
- model.setValue(tPath + "groupbugt" , model.getValue(sPath + "groupbugt" )); // 예산계정코드
- model.setValue(tPath + "calccnfmyn" , model.getValue(sPath + "calccnfmyn" )); // 정산확정여부
- model.setValue(tPath + "winprcsflag" , model.getValue(sPath + "winprcsflag" )); // 8:미처리, 9:처리
- model.setValue(tPath + "calccnfmdd" , model.getValue(sPath + "calccnfmdd" )); // 정산일자
- model.setValue(tPath + "frcalccnfmdd" , model.getValue(sPath + "frcalccnfmdd")); // 정산확정일자 FR
- model.setValue(tPath + "tocalccnfmdd" , model.getValue(sPath + "tocalccnfmdd")); // 정산확정일자 TO
- model.setValue(tPath +"goodflag" , vGoodflag ); // 물품구분
- model.setValue(tPath +"suplplcecd" , vSuplplcecd ); // 주거래처
- model.setValue(tPath +"suppcustcd" , vSuppcustcd ); // 보조거래처
-
-
- if (gTabIdx1 == "0") {
- submit("TRRSI02706");
- }
-
- if (gTabIdx1 == "2") {
- submit("TRRSI02712");
- }
-
- if (gTabIdx1 == "3") {
- submit("TRRSI02713");
- }
-
- var pGridDetail = eval("grd_"+gGridNm[gTabIdx1])
-
- fViewOptionToggleX(pGridDetail);
-
- fViewOptionToggle();
-
- // fCopy2DetailData(gTabIdx1, pGridDetail);
- pGridDetail.refresh();
-
- model.refresh();
- }
-
- /**
- * @group :
- * @ver : 2009.04.23
- * @by : 최학록
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 그리드를 트리구조로 만들어준다.
- * @param :
- * @return :
- * @---------------------------------------------------
- */
-
- function fCopy2DetailData(pIdx, pGrid){
-
- // model.removeNodeset(pGrid.nodeset);
-
- misfGridInit(pGrid);
- model.copyNode( "/root/init/"+gPathNm[pIdx], "/root/main/"+ gPathNm[pIdx]);
-
- model.removeNodeset("/root/main/"+ gPathNm[pIdx]);
-
- fViewOptionToggleX(pGrid);
- }
-
-
- // --------------------------------------------------
- // Data Part Toggle 속성Toggle 처리하는 함수
- // --------------------------------------------------
- function fDataPartToggle(pCls) {
-
- var pGrpDetail = eval("grp_"+gGridNm[gTabIdx1])
- var pGrdDetail = eval("grd_"+gGridNm[gTabIdx1])
- switch(pCls) {
- case 0 :
- // 메인 Grup
- pGrpDetail.attribute("left" ) = "457";
- pGrpDetail.attribute("width" ) = "731";
- pGrdDetail.attribute("width" ) = "731";
- break;
- case 1 :
- pGrpDetail.attribute("left" ) = "0";
- pGrpDetail.attribute("width" ) = "1188";
- pGrdDetail.attribute("width" ) = "1188";
- }
-
- pGrpDetail.refresh();
-
- }
-
- // --------------------------------------------------
- // View Option 처리하는 함수
- // --------------------------------------------------
- function fViewOptionToggleX(pGrid) {
-
- for (var fRow = 1; fRow < pGrid.rows ; fRow++) {
- if (model.getValue(pGrid.nodeset+"["+fRow+"]/winprcsflag")=="9") {
- pGrid.isReadOnly(fRow, pGrid.colRef("chkyn"), fRow, pGrid.colRef("chkyn")) = true;
- } else {
- pGrid.isReadOnly(fRow, pGrid.colRef("chkyn"), fRow, pGrid.colRef("chkyn")) = false;
- }
- }
-
- pGrid.refresh();
- }
-
- // --------------------------------------------------
- // View Option 처리하는 함수
- // --------------------------------------------------
- function fViewOptionToggle() {
-
- var vColName = "";
- var sNode = null;
- var oPath = "/root/init/Options/option_"+ gTabIdx1 +"/";
-
- var vOpTail = "_op_"+gTabIdx1;
- var pGrid = eval("grd_"+gGridNm[gTabIdx1])
-
- for (var fCol = 1; fCol < pGrid.cols ; fCol++) {
-
- vColName = pGrid.colAttribute(fCol,"ref");
-
- var sNode = instance1.selectSingleNode(oPath + vColName);
- if (sNode != null) {
- pGrid.colHidden(pGrid.colRef(vColName)) = (eval("chk_"+vColName + vOpTail).value =="Y") ? false : true;
-
- }
- }
-
- pGrid.refresh();
- grp_view.visible = false;
- }
-
- // --------------------------------------------------
- // Grid On Click 처리하는 함수
- // --------------------------------------------------
- function fGridConClick() {
-
- var vGrid = eval("grd_"+gGridNm[gTabIdx1])
-
- if ((vGrid.row == 0 ) ||
- (vGrid.col != vGrid.colRef("chkyn"))) return;
-
- ChkFlag = model.getValue(vGrid.nodeset + "[" + vGrid.row + "]/chkyn");
-
- fDataCheckSelect(vGrid, vGrid.row, ChkFlag);
-
- vGrid.refresh();
- }
- //-----------------------------------
- // 입고 검수 확인 저장
- //-----------------------------------
- function fCheckPersonSave(){
- var vCnt = 0 ;
-
- var pGrid = eval("grd_"+gGridNm[gTabIdx1])
-
- var sPath = pGrid.nodeset;
- var tPath = "/root/send/winchecklists";
- var tPath2 = "/root/send/winchecklists/winchecklist";
- var WincheckData = ""; // Send Data
- var WincheckHead = "instcd" + "▦" // 01 기관코드
- + "goodflag" + "▦" // 02 물품구분
- + "windd" + "▦" // 03 입고일자
- + "winno" + "▦" // 04 입고번호(0000)
- + "winseqno" + "▦" // 05 입고일련번호(000~999)
- + "windeptcd" + "▦" // 06 입고부서코드
- + "checkflag" + "▦" // 07 검수확인 UPDATE 여부
- + "chkyn" + "▦" // 08 검수확인여부
- + "chkpsn" + "▦" // 09 검수확인자
- + "chkdd" + "▦" // 10 검수확인년월
- + "calccnfmflag" + "▦" // 11 정산확정UPDATE 여부
- + "calccnfmpsn" + "▦" // 12 정산확정자
- + "calccnfmyn" + "▦" // 13 정산확정여부
- + "calccnfmdd" + "▦" // 14 정산확정년월
- + "winprcsflag" + "▦" // 15 정산상태 0:미결재,8:회계처리대상,9:회계처리완료
- + "slipflag" + "▦" // 16 전표UPDATE 여부
- + "slipdd" + "▦" // 17 전표일자
- + "slipno" + "▦" // 18 전표번호
- + "tableflag" + "▩"; // 19 검수테이블구분
- for (var fRow = pGrid.fixedRows; fRow < pGrid.rows ; fRow++ ) {
- if (pGrid.rowStatus(fRow) == 2) {
- WincheckData += model.getValue(sPath + "[" + fRow + "]/instcd" ) + "▦" // 01 기관코드
-
- if (gTabIdx1 == "3") {
- WincheckData += model.getValue(sPath + "[" + fRow + "]/fixtrseqmtflag" ) + "▦" // 02 물품구분
- WincheckData += model.getValue(sPath + "[" + fRow + "]/reqdd" ) + "▦" // 03 입고일자
- WincheckData += model.getValue(sPath + "[" + fRow + "]/reqno" ) + "▦" // 04 입고번호(0000)
- WincheckData += "" + "▦" // 05 입고일련번호(000~999)
- WincheckData += "" + "▦" // 06 입고부서코드
-
- } else {
- WincheckData += model.getValue(sPath + "[" + fRow + "]/goodflag" ) + "▦" // 02 물품구분
- WincheckData += model.getValue(sPath + "[" + fRow + "]/windd" ) + "▦" // 03 입고일자
- WincheckData += model.getValue(sPath + "[" + fRow + "]/winno" ) + "▦" // 04 입고번호(0000)
- WincheckData += model.getValue(sPath + "[" + fRow + "]/winseqno" ) + "▦" // 05 입고일련번호(000~999)
- if (gTabIdx1 == "2") {
- WincheckData += "" + "▦" // 06 입고부서코드
- } else {
- WincheckData += model.getValue(sPath + "[" + fRow + "]/windeptcd") + "▦" // 06 입고부서코드
- }
- }
-
- WincheckData += "Y" + "▦" // 07 검수확인 UPDATE 여부
- WincheckData += model.getValue(sPath + "[" + fRow + "]/chkyn" ) + "▦" // 08 검수확인여부
-
- if (model.getValue(sPath + "[" + fRow + "]/chkyn")=="Y") {
- WincheckData += getUserInfo("userid") + "▦" // 09 검수확인자
- WincheckData += getCurrentDate() + "▦" // 10 검수확인년월
- } else {
- WincheckData += "" + "▦" // 09 검수확인자
- WincheckData += "" + "▦" // 10 검수확인년월
- }
-
- WincheckData += "N" + "▦" // 11 정산확정UPDATE 여부
- WincheckData += "" + "▦" // 12 정산확정자
- WincheckData += "" + "▦" // 13 정산확정여부
- WincheckData += "" + "▦" // 14 정산확정년월
- WincheckData += "" + "▦" // 15 정산상태 0:미결재,8:회계처리대상,9:회계처리완료
- WincheckData += "N" + "▦" // 16 전표UPDATE 여부
- WincheckData += "" + "▦" // 17 전표일자
- WincheckData += "" + "▦" // 18 전표번호
-
- WincheckData += gTabIdx1 + "▩"; // 19 검수테이블구분
-
- vCnt++;
- }
- }
-
- if (vCnt > 0) {
- model.removenode(tPath);
- model.makeValue(tPath2, WincheckHead+WincheckData);
- submit("TXRSI02710");
- }
- }
-
- // --------------------------------------------------
- // 보기 Option 선택
- // --------------------------------------------------
- function fViewOptionClick() {
-
- switch(gTabIdx1) {
- case "0" :
- grp_rsihinptlist_op.visible = true;
- grp_rfchinpflist_op.visible = false;
- grp_rfehemhtlist_op.visible = false;
- break;
- case "2" :
- grp_rsihinptlist_op.visible = false;
- grp_rfchinpflist_op.visible = true;
- grp_rfehemhtlist_op.visible = false;
- break;
- case "3" :
- grp_rsihinptlist_op.visible = false;
- grp_rfchinpflist_op.visible = false;
- grp_rfehemhtlist_op.visible = true;
- }
-
- grp_view.visible = true;
-
- grp_view.refresh();
- }
-
- // --------------------------------------------------
- // Grid Excel 저장
- // --------------------------------------------------
- function fExcelDataSave() {
- switch(gTabIdx1) {
- case "0" :
- misfSaveExcel(grd_rsihinptlist);
- break;
- case "2" :
- misfSaveExcel(grd_rfchinpflist);
- break;
- case "3" :
- misfSaveExcel(grd_rfehemhtlist);
- }
- }
-
- // --------------------------------------------------
- // Grid Button 저장
- // --------------------------------------------------
- function fOnButtonClick(pCode, pName) {
-
- model.removenode("/root/copynode");
- model.removenode(gvParamPath +"/CUSTCD_/CUSTCD_value");
- model.makeNode("/root/copynode");
-
- rszfOpenPopUpListByWndName(grd_nonwin,"",pCode+","+pName,"SPRSD00220","instcd,goodflag","cmb_instcd,cmb_goodflag");
-
- var cur_row = grd_nonwin.row;
- var status = grd_nonwin.valueMatrix(cur_row, grd_nonwin.colRef("m"));
-
- var CSV = model.getValue(gvParamPath +"/CUSTCD_/CUSTCD_value");
- setCSVToNode("/root/copynode", CSV, "custlist");
-
- }
-
- //--------------------------------------
- // 전자 세금계산서 변경 컨트롤을 View
- //--------------------------------------
- function fUpdateDataView()
- {
- grp_invoice.visible = true;
- grp_main.disabled = true;
-
- grp_invoice.refresh();
- }
-
- //--------------------------------------
- // 발주용으로 화면 변경
- //--------------------------------------
- function fDtiOptionView()
- {
-
- // grp_cond.visible = false;
- grp_goodflag.visible = false;
-
- // grp_sup_reg_num.visible = true;
-
- dti_map.visible = "hidden";
- dti_select.visible = "visible";
-
- // cmb_supregnum.visible = "hidden";
-
- ckb_sameyn.disabled = true;
-
- ipt_fr_pub_date.attribute("editable") = true;
- ipt_to_pub_date.attribute("editable") = true;
- ipt_sup_reg_num.attribute("editable") = true;
-
- }
- //
- // 입고내역 세금계산서번호 매핑한다.
- //
-
- function fSelectInvoiceNo(vGride) {
-
- if (vGride.row < 1) {
- alert("세금계산서를 선택하십시요!!");
- return true;
- }
-
- // var pGrid = (gTabIdx1 == 0) ? grd_nonwin : grd_nonwin;
-
- var pGrid = grd_nonwin;
-
- var vNo = model.getValue(vGride.nodeset + "[" +vGride.row + "]/inv_no" ); // 17 전자계산서번호
- var vPub_date = model.getValue(vGride.nodeset + "[" +vGride.row + "]/pub_date" ); // 23 전자계산서일자
- var vSupRegNum = model.getValue(vGride.nodeset + "[" +vGride.row + "]/sup_reg_num" ); // 59 공급자 사업자번호
- for (var Idx = pGrid.fixedRows; Idx < pGrid.rows; Idx++) {
- if (model.getValue(pGrid.nodeset+"["+ Idx +"]/suplplcecd") == vSupRegNum) {
- vCheck = 0;
- if ((model.getValue(cmb_custselect.attribute("ref")) != "A" ) &&
- (model.getValue(pGrid.nodeset + "[" + Idx + "]/select") != "Y")){
- vCheck = 1;
- }
-
- // 전자세금계산서 매핑 안된 것만
- if ((model.getValue(ckb_mappingyn.attribute("ref") ) == "Y") &&
- (model.getValue(pGrid.nodeset + "[" + Idx + "]/inv_no") != "-" )){
- vCheck = 1;
- }
- //
- if (vCheck == 0) {
- pGrid.rowStatus(Idx) = "2";
- model.setValue(pGrid.nodeset + "[" + Idx + "]/inv_no" , vNo); // 전자계산서번호
- model.setValue(pGrid.nodeset + "[" + Idx + "]/select" ,"Y" ); // CHECK구분
- model.setValue(pGrid.nodeset + "[" + Idx + "]/elctstmntyn","Y" ); // 계산서여부
- //
- if (model.getValue(ckb_calcdocuddyn.attribute("ref") ) == "Y") {
- model.setValue(pGrid.nodeset + "[" + Idx + "]/calcdocudd", vPub_date);
- }
-
- grd_goodwin.valueMatrix(Idx , grd_goodwin.colRef("select")) = "Y";
- }
- }
- }
-
- fWinqtyTotal_2();
-
- pGrid.refresh();
-
- grp_invoice.visible = false;
- grp_main.disabled = false; // addGroup 컨트롤이 나타나면 listGroup 컨트롤을 disabled 시킴
- }
-
- // --------------------------------------------------------------
- // 입고수량 합계 Control
- // --------------------------------------------------------------
- function fWinqtyTotal_2()
- {
- var amt = 0.0;
- var amt2 = 0.0;
- var cnt = 0;
- for (var r = grd_nonwin.fixedRows; r < grd_nonwin.rows; r++) {
-
- ReqFla = parseFloat(grd_nonwin.valueMatrix(r, grd_nonwin.colRef("goodunitcost")))
- * parseFloat(grd_nonwin.valueMatrix(r, grd_nonwin.colRef("reqqty" )));
-
- if (grd_nonwin.valueMatrix(r, grd_nonwin.colRef("select")) == 'Y' ) {
- WinAmt = parseFloat(grd_nonwin.valueMatrix(r, grd_nonwin.colRef("goodunitcost")))
- * parseFloat(grd_nonwin.valueMatrix(r, grd_nonwin.colRef("winqty" )));
-
-
- grd_nonwin.valueMatrix(r, grd_nonwin.colRef("winqtytotal")) = WinAmt;
- grd_nonwin.valueMatrix(r, grd_nonwin.colRef("reqfla" )) = ReqFla;
- amt = ( parseFloat(amt) + WinAmt);
- cnt ++;
- }
-
- amt2 = ( parseFloat(amt2) + ReqFla);
- }
-
- model.setValue(opt_sumreqfla.attribute("ref") , amt2);
-
- model.setValue(opt_winqtycnt.attribute("ref") , cnt);
- model.setValue(opt_winqtytotal.attribute("ref"), amt);
-
- opt_sumreqfla.refresh();
- opt_winqtycnt.refresh();
- opt_winqtytotal.refresh();
- }
-
- /* ------------------------------------------------- */
- /* ------End Of List ------------------------------- */
- /* -------------------------------------------------- */
|