RSP001.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /* ---------------------------------------------------------------------
  2. 구매계약관리 공통
  3. - Version :
  4. 1) : Ver.1.00.01
  5. : Create By Chungpd
  6. : 2010.10.06
  7. ---------------------------------------------------------------------- */
  8. // 초기화하기
  9. function fInitialize(teamflag)
  10. {
  11. // 금일 날자 설정
  12. var curdate = getCurrentDate();
  13. var cvtdate = curdate.toDate("YYYYMMDD");
  14. misfComboComCdList("030M0005",cmb_teamflag);
  15. misfComboComCdList("030M0013",cmb_conflag);
  16. misfComboComCdList("030M0001",cmb_wareflag_search);
  17. misfComboComCdList("030M0008",cmb_deftconratecd);
  18. addComboItem( "cmb_wareflag_search", "전체", "", "above");
  19. //misfComboCopyItemSet(cmb_wareflag ,"" , cmb_wareflag_search, ""); //창고구분
  20. misfComboComCdListMulti("Z0007","cmb_instcd");
  21. model.setValue("/root/send/search/instcd", getUserInfo("dutplceinstcd")); // 기관 설정
  22. // 병원정보를 가져오기
  23. rszfRscsysinftLists(getUserInfo("dutplceinstcd"));
  24. //model.setValue(ipt_windtfrom.attribute("ref") ,cvtdate.getAddDate(-10,"D").getDateFormat("YYYYMMDD"));
  25. model.setValue(cal_purccondd_search.attribute("ref") , curdate);
  26. model.setValue("/root/send/nosearch/instcd" , model.getValue(cmb_instcd.attribute("ref")));
  27. model.setValue("/root/send/nosearch/purccondd" , model.getValue(cal_purccondd_search.attribute("ref")));
  28. if (submit("TRRSP00102")){
  29. var purcconno = model.getValue("/root/main/list/purcconnoinfo/maxpurcconno/purcconno");
  30. model.setValue(ipt_purcconno_search.attribute("ref"), purcconno);
  31. }
  32. model.setValue("/root/send/nosearch/instcd" , "");
  33. model.setValue("/root/send/nosearch/purccondd" , "");
  34. model.setValue(ipt_teamflag.attribute("ref"), teamflag);
  35. btn_search.dispatch("DOMActivate");
  36. model.refresh();
  37. }
  38. // 조회하기
  39. function fSearch()
  40. {
  41. var spath = "/root/main/list/purcconinfo"
  42. model.removeNodeset(spath);
  43. if (submit("TRRSP00101")){
  44. model.removeNodeset("/root/submain/list/purcconinfo");
  45. model.makeNode("/root/submain/list/purcconinfo");
  46. model.copyNode("/root/submain/list/purcconinfo", "/root/main/list/purcconinfo");
  47. }
  48. var vInstance = document.models(0).instances(0);
  49. var cnt = vInstance.selectNodes("/root/main/list/purcconinfo/purcconmainlist").length;
  50. if (cnt == 0){
  51. var spath = "/root/main/list/purcconinfo/purcconmainlist";
  52. model.makeNode(spath+"/purccondd" );
  53. model.makeNode(spath+"/purcconno" );
  54. model.makeNode(spath+"/goodkindcnt" );
  55. model.makeNode(spath+"/teamflag" );
  56. model.makeNode(spath+"/acntcd" );
  57. model.makeNode(spath+"/acntnm" );
  58. model.makeNode(spath+"/notino" );
  59. model.makeNode(spath+"/suplplcecd" );
  60. model.makeNode(spath+"/suplplcenm" );
  61. model.makeNode(spath+"/supdd" );
  62. model.makeNode(spath+"/chrgid" );
  63. model.makeNode(spath+"/chrgnm" );
  64. model.makeNode(spath+"/flwrpirtermyy");
  65. model.makeNode(spath+"/flwrpirper" );
  66. model.makeNode(spath+"/suppos" );
  67. model.makeNode(spath+"/conflag" );
  68. model.makeNode(spath+"/totconamt" );
  69. model.makeNode(spath+"/goodcntnm" );
  70. model.makeNode(spath+"/congrntamt" );
  71. model.makeNode(spath+"/grntexchrate" );
  72. model.makeNode(spath+"/expsschedate" );
  73. model.makeNode(spath+"/deftconratecd");
  74. model.makeNode(spath+"/cmt" );
  75. model.makeNode(spath+"/contermfromdd");
  76. model.makeNode(spath+"/contermtodd" );
  77. model.makeNode(spath+"/newyn" );
  78. model.makeNode(spath+"/updtgoodcntyn");
  79. model.makeNode(spath+"/titlecd");
  80. }
  81. if (model.getValue(cal_purccondd.attribute("ref")).getTrim() == ""){
  82. fConDisabledControl(true);
  83. }else{
  84. fConDisabledControl(false);
  85. }
  86. fDisabledControl(true);
  87. ipt_goodcntnm.disabled = true;
  88. fCalcAmt();
  89. fDispSumAmt();
  90. model.refresh();
  91. }
  92. // 행별 삭제
  93. function fRowDel(){
  94. var prestatus = grd_purccon.valueMatrix(grd_purccon.row,grd_purccon.colRef("prestatus"));
  95. if (prestatus == "U"){
  96. if (grd_purccon.valueMatrix(grd_purccon.row, grd_purccon.colRef("lastwindd")) != ""){
  97. messageBox(grd_purccon.row+"번째는 입고 처리된", "I009");
  98. }else{
  99. grd_purccon.rowStatus(grd_purccon.row) = "4";
  100. }
  101. }else{
  102. grd_purccon.deleteRow(grd_purccon.row);
  103. }
  104. fGetGoodcntnm();
  105. }
  106. // (신규 계약건) 입력하기
  107. function fInpt(teamflag) {
  108. // 금일 날자 설정
  109. var curdate = getCurrentDate();
  110. var cvtdate = curdate.toDate("YYYYMMDD");
  111. ipt_acntcd.disabled = false;
  112. btn_acntcd.disabled = false;
  113. fConDisabledControl(false);
  114. fDisabledControl(false);
  115. model.resetInstanceNode("/root/main/list/purcconinfo/purcconmainlist");
  116. model.makeValue(ipt_newyn.attribute("ref"), "Y");
  117. model.removeNodeset("/root/main/list/purcconinfo/purcconsublist");
  118. model.setValue(cmb_teamflag.attribute("ref") , teamflag);
  119. model.refresh();
  120. model.setValue(cal_purccondd.attribute("ref") , curdate);
  121. model.setValue(ipt_chrgid.attribute("ref") , getUserInfo("userid"));
  122. model.setValue(ipt_chrgnm.attribute("ref") , getUserInfo("usernm"));
  123. model.setValue(cmb_deftconratecd.attribute("ref") , "2");
  124. model.setValue(cal_supdd.attribute("ref") , curdate);
  125. model.setValue(cal_contermfromdd.attribute("ref") , curdate);
  126. model.setValue(cal_contermtodd.attribute("ref") , cvtdate.getAddDate(1,"M").getDateFormat("YYYYMMDD"));
  127. cal_purccondd.dispatch("xforms-value-changed");
  128. }
  129. // 계약 세부 내역에서 특정 계약금 혹은 계약수량 변경시 해당 계약금이 자동으로 연산 되는 기능
  130. function fCalcAmt()
  131. {
  132. if( grd_purccon.col == grd_purccon.colRef("conqty")
  133. || grd_purccon.col == grd_purccon.colRef("congoodunitcost")){
  134. var conamt;
  135. var congoodunitcost = grd_purccon.valueMatrix(grd_purccon.row, grd_purccon.colRef("congoodunitcost"));
  136. var conqty = grd_purccon.valueMatrix(grd_purccon.row, grd_purccon.colRef("conqty"));
  137. conamt = parseFloat(congoodunitcost) * parseFloat(conqty);
  138. grd_purccon.valueMatrix(grd_purccon.row, grd_purccon.colRef("conamt")) = parseFloat(conamt);
  139. }
  140. model.refresh();
  141. }
  142. // 공통에 변경된 사항이 있는지를 인지하기 위한 함수 (불필요한 transaction을 줄이고자하는 의도로 작성했음)
  143. function fCmprChngVal()
  144. {
  145. var bfpath = "/root/submain/list/purcconinfo/purcconmainlist";
  146. var prestpath = "/root/main/list/purcconinfo/purcconmainlist";
  147. var chngflag = false;
  148. if ( model.getValue(bfpath+"/purccondd" ) != model.getValue(prestpath+"/purccondd" ) // 계약년월일
  149. || model.getValue(bfpath+"/purcconno" ) != model.getValue(prestpath+"/purcconno" ) // 계약번호
  150. || model.getValue(bfpath+"/goodkindcnt" ) != model.getValue(prestpath+"/goodkindcnt" ) // 제종
  151. || model.getValue(bfpath+"/teamflag" ) != model.getValue(prestpath+"/teamflag" ) // 팀구분
  152. || model.getValue(bfpath+"/acntcd" ) != model.getValue(prestpath+"/acntcd" ) // 계정코드
  153. || model.getValue(bfpath+"/acntnm" ) != model.getValue(prestpath+"/acntnm" ) // 계정코드명
  154. || model.getValue(bfpath+"/notino" ) != model.getValue(prestpath+"/notino" ) // 공고번호
  155. || model.getValue(bfpath+"/suplplcecd" ) != model.getValue(prestpath+"/suplplcecd" ) // 납품처코드
  156. || model.getValue(bfpath+"/suplplcenm" ) != model.getValue(prestpath+"/suplplcenm" ) // 납품처명
  157. || model.getValue(bfpath+"/supdd" ) != model.getValue(prestpath+"/supdd" ) // 납품일
  158. || model.getValue(bfpath+"/chrgid" ) != model.getValue(prestpath+"/chrgid" ) // 담당자id
  159. || model.getValue(bfpath+"/chrgnm" ) != model.getValue(prestpath+"/chrgnm" ) // 담당자
  160. || model.getValue(bfpath+"/flwrpirtermyy") != model.getValue(prestpath+"/flwrpirtermyy") // 하자보수년수
  161. || model.getValue(bfpath+"/flwrpirper" ) != model.getValue(prestpath+"/flwrpirper" ) // 하자보수퍼센트
  162. || model.getValue(bfpath+"/suppos" ) != model.getValue(prestpath+"/suppos" ) // 납품장소
  163. || model.getValue(bfpath+"/conflag" ) != model.getValue(prestpath+"/conflag" ) // 계약구분
  164. || model.getValue(bfpath+"/totconamt" ) != model.getValue(prestpath+"/totconamt" ) // 총계약금액
  165. || model.getValue(bfpath+"/goodcntnm" ) != model.getValue(prestpath+"/goodcntnm" ) // 품건명
  166. || model.getValue(bfpath+"/congrntamt" ) != model.getValue(prestpath+"/congrntamt" ) // 보증금
  167. || model.getValue(bfpath+"/grntexchrate" ) != model.getValue(prestpath+"/grntexchrate" ) // 보증금환율
  168. || model.getValue(bfpath+"/expsschedate" ) != model.getValue(prestpath+"/expsschedate" ) // 지출예정일
  169. || model.getValue(bfpath+"/deftconratecd") != model.getValue(prestpath+"/deftconratecd") // 지체상금코드
  170. || model.getValue(bfpath+"/cmt" ) != model.getValue(prestpath+"/cmt" ) // 기타조건
  171. || model.getValue(bfpath+"/contermfromdd") != model.getValue(prestpath+"/contermfromdd") // 계약기간(from)
  172. || model.getValue(bfpath+"/contermtodd" ) != model.getValue(prestpath+"/contermtodd" )){ // 계약기간(to)
  173. chngflag = true;
  174. }
  175. return chngflag;
  176. }
  177. // 저장 - 공통항목으로 Grouping된 것을 하위단에 풀어주며 풀린 데이타를 서버 PGM으로 넘기는 기능이 함수에 녹아있음.
  178. function fSave(){
  179. var updtdata = "", rowno = "";
  180. if (fSaveValiChk() == false) return;
  181. for(i=1;i<grd_purccon.rows;i++){
  182. if (fCmprChngVal() == true){
  183. if (grd_purccon.rowStatus(i) == "0"){
  184. grd_purccon.rowStatus(i) = "2";
  185. }
  186. grd_purccon.valueMatrix(i, grd_purccon.colRef("purccondd" )) = model.getValue(cal_purccondd.attribute("ref"));
  187. grd_purccon.valueMatrix(i, grd_purccon.colRef("purcconno" )) = model.getValue(ipt_purcconno.attribute("ref"));
  188. grd_purccon.valueMatrix(i, grd_purccon.colRef("goodkindcnt" )) = model.getValue(ipt_goodkindcnt.attribute("ref"));
  189. grd_purccon.valueMatrix(i, grd_purccon.colRef("teamflag" )) = model.getValue(cmb_teamflag.attribute("ref"));
  190. grd_purccon.valueMatrix(i, grd_purccon.colRef("notino" )) = model.getValue(ipt_notino.attribute("ref"));
  191. grd_purccon.valueMatrix(i, grd_purccon.colRef("suplplcecd" )) = model.getValue(ipt_suplplcecd.attribute("ref"));
  192. grd_purccon.valueMatrix(i, grd_purccon.colRef("supdd" )) = model.getValue(cal_supdd.attribute("ref"));
  193. grd_purccon.valueMatrix(i, grd_purccon.colRef("chrgid" )) = model.getValue(ipt_chrgid.attribute("ref"));
  194. grd_purccon.valueMatrix(i, grd_purccon.colRef("flwrpirtermyy")) = model.getValue(ipt_flwrpirtermyy.attribute("ref"));
  195. grd_purccon.valueMatrix(i, grd_purccon.colRef("flwrpirper" )) = model.getValue(ipt_flwrpirper.attribute("ref"));
  196. grd_purccon.valueMatrix(i, grd_purccon.colRef("suppos" )) = model.getValue(ipt_suppos.attribute("ref"));
  197. grd_purccon.valueMatrix(i, grd_purccon.colRef("conflag" )) = model.getValue(cmb_conflag.attribute("ref"));
  198. grd_purccon.valueMatrix(i, grd_purccon.colRef("totconamt" )) = model.getValue(ipt_totconamt.attribute("ref"));
  199. grd_purccon.valueMatrix(i, grd_purccon.colRef("goodcntnm" )) = model.getValue(ipt_goodcntnm.attribute("ref"));
  200. grd_purccon.valueMatrix(i, grd_purccon.colRef("congrntamt" )) = model.getValue(ipt_congrntamt.attribute("ref"));
  201. grd_purccon.valueMatrix(i, grd_purccon.colRef("grntexchrate" )) = model.getValue(ipt_grntexchrate.attribute("ref"));
  202. grd_purccon.valueMatrix(i, grd_purccon.colRef("expsschedate" )) = model.getValue(cal_expsschedate.attribute("ref"));
  203. grd_purccon.valueMatrix(i, grd_purccon.colRef("deftconratecd")) = model.getValue(cmb_deftconratecd.attribute("ref"));
  204. grd_purccon.valueMatrix(i, grd_purccon.colRef("cmt" )) = model.getValue(ipt_cmt.attribute("ref"));
  205. grd_purccon.valueMatrix(i, grd_purccon.colRef("contermfromdd")) = model.getValue(cal_contermfromdd.attribute("ref"));
  206. grd_purccon.valueMatrix(i, grd_purccon.colRef("contermtodd" )) = model.getValue(cal_contermtodd.attribute("ref"));
  207. grd_purccon.valueMatrix(i, grd_purccon.colRef("newyn" )) = model.getValue(ipt_newyn.attribute("ref"));
  208. }
  209. }
  210. updtdata = getGridUpdateData(grd_purccon);
  211. if(updtdata == ""){
  212. messageBox("저장할 데이타가 ","E014");
  213. return false;
  214. }
  215. if (rowno != ""){
  216. messageBox(rowno.substr(1, rowno.length-1)+"번째건의 수량이 입력되지 ", "I011");
  217. return false;
  218. }
  219. model.setValue("/root/send/save/purcconlist", updtdata);
  220. if (submit("TXRSP00101")){
  221. messageBox("저장이","I002");
  222. }else{
  223. messageBox("저장","E009");
  224. return;
  225. }
  226. model.setValue(cal_purccondd_search.attribute("ref") , model.getValue(cal_purccondd.attribute("ref")));
  227. model.setValue(ipt_purcconno_search.attribute("ref") , model.getValue(ipt_purcconno.attribute("ref")));
  228. btn_search.dispatch("DOMActivate");
  229. }
  230. // 품의 내역조회에 있는 데이타를 끌고 온다.(데이타의 유효성도 체크한다.)
  231. function fDataSet(pnode, nodename)
  232. {
  233. var flag = "Y", rowno = "", wflag = "Y", wrowno = "";
  234. var codynode = instance1.selectNodes(pnode + "/*");
  235. var vInstance = document.models(0).instances(0);
  236. var cnt = vInstance.selectNodes("/root/main/list/purcconinfo/purcconsublist").length;
  237. for (var j = 1; j <= codynode.length ; j++) {
  238. for (var i=1 ; i<= cnt;i++){
  239. var srcgoodcd = model.getValue(pnode +"/" + nodename + "[" + j + "]/goodcd");
  240. var goodcd = model.getValue(grd_purccon.nodeset + "[" + i + "]/goodcd");
  241. var srcallsizespecid = model.getValue(pnode +"/" + nodename + "[" + j + "]/allsizespecid");
  242. var allsizespecid = model.getValue(grd_purccon.nodeset + "[" + i + "]/allsizespecid");
  243. if (srcgoodcd == goodcd && srcallsizespecid == allsizespecid){
  244. flag = "N";
  245. rowno = rowno + ","+i; // 이미 존재하는 코드 check
  246. //messageBox("물품조회 "+i+"번째에 동일 물품이 존재합니다.", "I");
  247. }
  248. }
  249. wflag = "Y";
  250. var srcacntcd = model.getValue(pnode +"/" + nodename + "[" + j + "]/acntcd" );
  251. var acntcd = grd_purccon.valueMatrix(grd_purccon.rows-1,grd_purccon.colRef("acntcd"));
  252. if (flag == "Y"){
  253. if (srcacntcd != acntcd && grd_purccon.rows - grd_purccon.fixedRows != 0 ){
  254. wflag = "N";
  255. wrowno = wrowno + ","+i; // 다른 입고계정 존재
  256. }else{
  257. grd_purccon.addRow(false);
  258. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/prestatus" , "I");
  259. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purccnsttndd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purccnsttndd" )); // 품의일자
  260. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purccnsttnno" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purccnsttnno" )); // 품의번호
  261. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purccnsttnseq" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purccnsttnseq" )); // 품의순번
  262. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/goodcd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodcd" )); // 물품코드
  263. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/allsizespecid" , model.getValue(pnode +"/" + nodename + "[" + j + "]/allsizespecid" )); // 규격코드
  264. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/goodnm" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodnm" )); // 물품명
  265. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/goodspec" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodspec" )); // 규격
  266. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/conunit" , model.getValue(pnode +"/" + nodename + "[" + j + "]/cnsttnunit" )); // 품의단위
  267. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/cnsttnqty" , model.getValue(pnode +"/" + nodename + "[" + j + "]/cnsttnqty" )); // 품의수량
  268. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/conqty" , model.getValue(pnode +"/" + nodename + "[" + j + "]/conqty" )); // 계약량
  269. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/cnsttngoodunitcost" , model.getValue(pnode +"/" + nodename + "[" + j + "]/cnsttngoodunitcost")); // 품의단가
  270. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/congoodunitcost" , model.getValue(pnode +"/" + nodename + "[" + j + "]/congoodunitcost" )); // 계약단가
  271. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/conamt" , model.getValue(pnode +"/" + nodename + "[" + j + "]/conamt" )); // 계약금액
  272. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/acntcd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/acntcd" )); // 계정과목
  273. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/acntnm" , model.getValue(pnode +"/" + nodename + "[" + j + "]/acntnm" )); // 계정과목명
  274. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purcconfullno" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purcconfullno" )); // 계약번호(Full)
  275. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purccondd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purccondd" )); // 계약일
  276. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purcconno" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purcconno" )); // 계약번호
  277. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/purcconseq" , model.getValue(pnode +"/" + nodename + "[" + j + "]/purcconseq" )); // 계약일련번호
  278. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/reqpackcntperunit" , model.getValue(pnode +"/" + nodename + "[" + j + "]/reqpackcntperunit" )); // 요구포장단위당갯수
  279. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/fullpurcunit" , model.getValue(pnode +"/" + nodename + "[" + j + "]/fullpurcunit" )); // 구매단위(FULL)
  280. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/instcd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/instcd" )); // 기관코드
  281. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/goodflag" , model.getValue(pnode +"/" + nodename + "[" + j + "]/goodflag" )); // 물품구분
  282. model.makeValue(grd_purccon.nodeset + "[" + (grd_purccon.row) + "]/reqdeptcd" , model.getValue(pnode +"/" + nodename + "[" + j + "]/reqdeptcd" )); // 구매요구부서
  283. model.setValue(ipt_suplplcecd.attribute("ref") , model.getValue(pnode +"/" + nodename + "[" + j + "]/suplplcecd"));
  284. model.setValue(opt_suplplcenm.attribute("ref") , model.getValue(pnode +"/" + nodename + "[" + j + "]/suplplcenm"));
  285. grd_purccon.cellAttribute("disabled", grd_purccon.row , grd_purccon.colRef("chkyn")) = "true";
  286. }
  287. }
  288. flag = "Y";
  289. }
  290. if (rowno != ""){
  291. messageBox("품의요구 내역 "+rowno.substr(1, rowno.length-1)+"번째에 동일 물품이 존재합니다.", "I");
  292. }
  293. if (wrowno != ""){
  294. messageBox("이미 입력된 건의 입고계정과 "+wrowno.substr(1, wrowno.length-1)+"번째의 물품코드의 입고계정이 일치하지 않습니다.", "I");
  295. }
  296. grd_purccon.refresh();
  297. }
  298. // 품의 내역 조회 전에 필수 입력 항목 check (계정과목은 품의 내역과 계약 내역의 동기화를 위해 꼭 필요함)
  299. function fDataValiChk()
  300. {
  301. var smsg = "";
  302. if(cal_purccondd.value.getTrim() == "") smsg += "계약일자, ";
  303. if(ipt_purcconno.value.getTrim() == "") smsg += "계약번호, ";
  304. if(ipt_acntcd.value.getTrim() == "") smsg += "계정과목, ";
  305. if (smsg == ""){
  306. return true;
  307. }else{
  308. messageBox(smsg.substr(0, smsg.length-2) + "은(는)","I003");
  309. return false;
  310. }
  311. }
  312. // 저장하기전에 필수항목 점검
  313. function fSaveValiChk()
  314. {
  315. var smsg = "";
  316. if(cal_purccondd.value.getTrim() == "") smsg += "계약일자, ";
  317. if(ipt_purcconno.value.getTrim() == "") smsg += "계약번호, ";
  318. if(cmb_teamflag.value.getTrim() == "") smsg += "팀구분, ";
  319. if(ipt_acntcd.value.getTrim() == "") smsg += "계정과목, ";
  320. if(ipt_suplplcecd.value.getTrim() == "") smsg += "납품처, ";
  321. if(cmb_conflag.value.getTrim() == "") smsg += "계약방법, ";
  322. if(ipt_goodcntnm.value.getTrim() == "") smsg += "품건명, ";
  323. //if(cal_contermfromdd.value.getTrim() == "") smsg += "계약기간(시작일), ";
  324. //if(cal_contermtodd.value.getTrim() == "") smsg += "계약기간(마감일), ";
  325. if (smsg == ""){
  326. return true;
  327. }else{
  328. messageBox(smsg.substr(0, smsg.length-2) + "은(는)","I003");
  329. return false;
  330. }
  331. }
  332. // 다중 선택해서 삭제 가능하도록 처리(현재는 사용하지 않음)
  333. function fDelSetting(pGrid)
  334. {
  335. var rowIdx, rowInval="";
  336. if (pGrid.selectedRows > 0) {
  337. var selectedRows = Array(pGrid.selectedRows);
  338. for(i=0;i< pGrid.selectedRows;i++) {
  339. selectedRows[i] = pGrid.selectedRow(i);
  340. }
  341. }else{
  342. messageBox("삭제할 데이타가 ","E014");
  343. return;
  344. }
  345. for ( var i= 0; i < selectedRows.length; i++){
  346. rowIdx = selectedRows[i];
  347. if (pGrid.valueMatrix(rowIdx, pGrid.colRef("purcconno")) == ""){
  348. pGrid.rowStatus(rowIdx) = "4";
  349. }else{
  350. rowInval += rowIdx + ","
  351. }
  352. }
  353. if (rowInval != ""){
  354. messageBox(rowInval.substr(0, rowInval.length-1)+"번째는 계약처리된", "I009");
  355. }
  356. model.refresh();
  357. }
  358. // 데이타의 무결성을 위해 수정시 기본키로 잡혀 있는 계약일자와 번호는 절대 수정 불가능 상태로 만드는 기능
  359. function fDisabledControl(state)
  360. {
  361. cal_purccondd.disabled = state;
  362. ipt_purcconno.disabled = state;
  363. }
  364. // 데이타가 없으면 입력과 관련된 버튼들을 불능 상태로 만드는 기능
  365. function fConDisabledControl(state)
  366. {
  367. btn_purccon.disabled = state;
  368. btn_choidel.disabled = state;
  369. btn_save.disabled = state;
  370. }
  371. // 계약에 대한 출력화면일 경우, 조회버튼을 제외한 나머지 입력,저장,품의요구,행삭제 버튼 컨트롤을 불능상태로 만드는 기능
  372. function fPrtConDisabledControl(state)
  373. {
  374. btn_save.disabled = state;
  375. btn_insert.disabled = state;
  376. btn_purccon.disabled = state;
  377. btn_choidel.disabled = state;
  378. btn_save.disabled = state;
  379. }
  380. // 계약 세부 내역에서 계약금 혹은 계약수량 변경시 공통에 있는 전체계약금에 합산되는 기능
  381. function fDispSumAmt()
  382. {
  383. var totconamt = 0, bfconamt = 0, totbfconamt = 0;
  384. for(var currow = grd_purccon.fixedRows ; currow < grd_purccon.rows ; currow++)
  385. {
  386. totconamt += parseFloat(grd_purccon.valueMatrix(currow , grd_purccon.colRef("conamt")));
  387. totbfconamt += bfconamt;
  388. }
  389. //총금액
  390. model.setValue(ipt_totconamt.attribute("ref"),totconamt);
  391. model.refresh();
  392. }
  393. // 물품명 변경시 품건명도 연계되어 변경하는 기능
  394. function fGetGoodcntnm()
  395. {
  396. var goodnm = "", fstflag = "N", cnt = 0;
  397. for(var i=grd_purccon.fixedRows; i < grd_purccon.rows;i++){
  398. if (grd_purccon.rowStatus(i) != "4"){
  399. if (fstflag == "N"){
  400. var goodnm = grd_purccon.valueMatrix(i, grd_purccon.colRef("goodnm"));
  401. var fstflag = "Y";
  402. }
  403. cnt++
  404. }
  405. }
  406. if (cnt == 1){
  407. model.setValue(ipt_goodcntnm.attribute("ref"), goodnm);
  408. }else{
  409. model.setValue(ipt_goodcntnm.attribute("ref"), goodnm+"외 "+ (cnt-1)+"건");
  410. }
  411. model.refresh();
  412. }
  413. // 출력물 생성시 임시 노드에 지정 노드값 복사는 가능 (미사용 향후 개발의 편의성을 위해 추가한 기능)
  414. function freqlistprint() {
  415. var Path = "/root/send/winregstprnt/winregstprntlist";
  416. model.removenode(Path);
  417. model.makeNode(Path);
  418. copyNodesetType(Path, grd_winregst.nodeset+ "[chk='Y']");
  419. exeReportPreview("RPRSP00100","XMLSTR");
  420. }