SMMNP03900.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. /* ---------------------------------------------------------------------
  2. 방재고실사입력(SMMNP03900.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. : Create By 김진명
  6. : 2007.12.18
  7. ---------------------------------------------------------------------- */
  8. /* --------------------------------------------------*/
  9. /* type : function */
  10. /* access : public */
  11. /* desc : 초기화 */
  12. /* param : */
  13. /* return : */
  14. /* --------------------------------------------------*/
  15. function fInit() {
  16. model.removeNodeset("/root/main/stoclist");
  17. submit("TRMNP04604");
  18. //2009.04.08 하드코딩 소스 변경
  19. model.makeValue("/root/send/cdgrupid", "038");
  20. submit("TRMNP00323", false);
  21. model.setValue("/root/main/cond/refdeptflag", model.getValue("/root/viewctrl/viewctrllist/viewctrlinfo/cdnm"));//CCR Main
  22. if(model.getValue("/root/main/cond/refdeptflag") == "A") {
  23. cmb_oproomcd.value = "1111";
  24. }
  25. var level = model.getValue("/root/temp/logginlevel/usrlevel");
  26. var stocflag = model.getValue("/root/main/cond/stocflag");
  27. if( level == "C"||level == "M" ) {//관리자 합산컬럼 보기
  28. grd_stoclist.colHidden(15) = false;
  29. grd_stoclist.colHidden(14) = false;
  30. }else {
  31. grd_stoclist.colHidden(15) = true;
  32. grd_stoclist.colHidden(14) = true;
  33. }
  34. grd_stoclist.explorerbar = "sort";
  35. grd_stoclist.fixedcellcheckbox(0,20) = true;
  36. submit("TRMNP03905");
  37. addComboItem("cmb_oproomcd", "전 체", "", "above" );
  38. submit("TRMNP03004") // 수술실(Rosette) 가져오기
  39. addComboItem("cmb_rosette","전체","","above");
  40. model.removenode("/root/send");
  41. //------------(20101011) 경북대)
  42. //model.setValue("/root/main/cond/goodflag", "Y");
  43. addComboItem("cmb_goodflag","전체","","above");
  44. //------------(20101011) 경북대)
  45. model.removeNodeset("/root/init/lrglist");
  46. model.removeNodeset("/root/init/mdllist");
  47. model.removeNodeset("/root/init/smllist");
  48. model.setValue("/root/main/cond/lrgcd", "");
  49. model.setValue("/root/main/cond/mdlcd", "");
  50. model.setValue("/root/main/cond/smlcd", "");
  51. model.makeNode("/root/send/reqdata");
  52. model.copyNode("/root/send/reqdata", "/root/main/cond");
  53. submit("TRMNP04463");
  54. addComboItem("cmb_lrg", "전 체", "", "above" );
  55. //2009-06-22 K.J.M 병원별 Display 여부
  56. model.removenode("/root/send");
  57. model.makeValue("/root/send/reqdata/cdgrupid", "106");//병원별 Display 여부
  58. model.makeValue("/root/send/reqdata/supcdid", "");//서브구분
  59. model.makeValue("/root/send/reqdata/cdid", "");//서브구분
  60. submit("TRMNP04903", false);
  61. if( model.getValue("/root/init/hardcodeinfo/cdid").substr(4, 1) == "Y" ) {//삭제 버튼
  62. btn_delete.visible = "true";
  63. chk_delehist.visible = "true";
  64. model.setValue("/root/main/cond/delflag", "Y");
  65. }else {
  66. btn_delete.visible = "false";
  67. chk_delehist.visible = "false";
  68. model.setValue("/root/main/cond/delflag", "");
  69. }
  70. model.refresh();
  71. }
  72. /* --------------------------------------------------*/
  73. /* type : function */
  74. /* access : public */
  75. /* desc : 방재고실사입력 조회(관리자) */
  76. /* param : */
  77. /* return : */
  78. /* --------------------------------------------------*/
  79. function fSearch(flag) {
  80. var oproomcd = model.getValue("/root/main/cond/oproomcd");
  81. var stocflag = model.getValue("/root/main/cond/stocflag");
  82. var goodcd = model.getValue("/root/main/cond/goodcd");
  83. if(flag=="1") {
  84. } else {
  85. if(model.getValue("/root/main/cond/refcnfmyn") == "N" || model.getValue("/root/main/cond/refcnfmyn") == "Y") {
  86. } else {
  87. if( oproomcd == "" && goodcd == "") {
  88. messageBox("수술방을 선택하지 ", "E007");
  89. model.setFocus("cmb_oproomcd");
  90. return;
  91. }
  92. }
  93. }
  94. model.removeNodeset("/root/main/stoclist");
  95. model.removenode("/root/send");
  96. model.makeNode("/root/send/reqdata");
  97. model.copyNode("/root/send/reqdata", "/root/main/cond");
  98. submit("TRMNP03904");
  99. if( stocflag == "R" || stocflag == "U" ) {
  100. grd_stoclist.colStyle(17, "data", "background-color") = "#ccffcc";
  101. grd_stoclist.colDisabled(17) = "false"
  102. grd_stoclist.colDisabled(19) = "true";
  103. }else {
  104. grd_stoclist.colStyle(19, "data", "background-color") = "#ccffcc";
  105. grd_stoclist.colDisabled(17) = "true"
  106. grd_stoclist.colDisabled(19) = "false";
  107. }
  108. }
  109. /* --------------------------------------------------*/
  110. /* type : function */
  111. /* access : public */
  112. /* desc : 방재고실사입력 버튼 이력조회 */
  113. /* param : */
  114. /* return : */
  115. /* --------------------------------------------------*/
  116. function fHistSearch() {
  117. var oproomcd = model.getValue("/root/main/cond/oproomcd");
  118. var stocflag = model.getValue("/root/main/cond/stocflag");
  119. if( oproomcd == "" ) {
  120. messageBox("수술방을 선택하지 ", "E007");
  121. model.setFocus("cmb_oproomcd");
  122. return;
  123. }
  124. grd_stoclist.colDisabled(19) = "true";
  125. grd_stoclist.colDisabled(17) = "true";
  126. grd_stoclist.colDisabled(23) = "true";
  127. grd_stoclist.colDisabled(24) = "true";
  128. grd_stoclist.colDisabled(25) = "true";
  129. model.removeNodeset("/root/main/stoclist");
  130. model.removenode("/root/send");
  131. model.makeNode("/root/send/reqdata");
  132. model.copyNode("/root/send/reqdata", "/root/main/cond");
  133. model.makeValue("/root/send/reqdata/searflag", "H");
  134. submit("TRMNP03904");
  135. if( stocflag == "R" || stocflag == "U" ) {
  136. grd_stoclist.colStyle(15, "data", "background-color") = "#ccffcc";
  137. }else if( stocflag == "I" ){
  138. grd_stoclist.colStyle(17, "data", "background-color") = "#ccffcc";
  139. }else {
  140. grd_stoclist.colStyle(15, "data", "background-color") = "transparent";
  141. grd_stoclist.colStyle(17, "data", "background-color") = "transparent";
  142. }
  143. }
  144. /* --------------------------------------------------*/
  145. /* type : function */
  146. /* access : public */
  147. /* desc : 물품 조회 팝업 후 처리 */
  148. /* param : */
  149. /* return : */
  150. /* --------------------------------------------------*/
  151. function fSetGoodCd(paramData) {
  152. //var getData = model.getValue("/root/properties/parameters/SendData/SendDatavalue");
  153. var variable = "'";
  154. var goodcd = "";
  155. var goodnm = "";
  156. var oldgoodcd, oldgoodnm, oldvariable;
  157. oldgoodcd = model.getValue("/root/main/cond/goodcd");
  158. oldgoodnm = model.getValue("/root/main/cond/goodnm");
  159. oldvariable = model.getValue("/root/main/cond/variable");
  160. var getData = paramData;
  161. if( getData != "") {
  162. if( model.getValue("/root/temp/chkcncl") != "C" ) {
  163. var getDataTemp1 = getData.split("▩");
  164. for( var i = 0; i < getDataTemp1.length-1; i++) {
  165. var getDataTemp2 = getDataTemp1[i].split("|");
  166. variable = variable + getDataTemp2[0] + getDataTemp2[2] + "'";
  167. goodcd = goodcd + getDataTemp2[0];
  168. goodnm = goodnm + getDataTemp2[1];
  169. if(( i+1) != (getDataTemp1.length-1) ) {
  170. variable = variable + ", '";
  171. goodcd = goodcd + ", ";
  172. goodnm = goodnm + ", ";
  173. }
  174. //if( getDataTemp1.length - 1 = 1 ) {
  175. //model.setValue("/root/main/cond/allsizespecid", goodnm);
  176. //}
  177. }
  178. if( oldgoodcd != "" ) {
  179. goodcd = oldgoodcd + ", " + goodcd
  180. }
  181. if( oldgoodnm != "" ) {
  182. goodnm = oldgoodnm + ", " + goodnm
  183. }
  184. if( oldvariable != "" ) {
  185. variable = oldvariable + ", " + variable
  186. }
  187. model.setValue("/root/main/cond/goodcd", goodcd);
  188. model.setValue("/root/main/cond/goodnm", goodnm);
  189. model.setValue("/root/main/cond/variable", variable);
  190. model.refresh();
  191. fSearch();
  192. }
  193. }
  194. }
  195. /* --------------------------------------------------*/
  196. /* type : function */
  197. /* access : public */
  198. /* desc : 방재고실사입력 실사량입력 */
  199. /* param : */
  200. /* return : */
  201. /* --------------------------------------------------*/
  202. function fSave( ) {
  203. var iRows = -1;
  204. var chkflag, oproomcd, goodcd, allsizespecid, bfsafestocqty, safestocqty, reqcnfmyn;
  205. var stocqty, refdeptflag, stocflag, undeliveqty, deliveqty, stat, cnfmyn, reqdd, inspqty, reqqty;
  206. var cnt = 0, chkcnt = 0;
  207. iRows = grd_stoclist.rows;
  208. var stoclist = "m▦oproomcd▦goodcd▦allsizespecid▦bfsafestocqty▦inspqty▦refdeptflag▦safestocqty▦stocflag▦reqqty▦deliveqty▦undeliveqty▦cnfmyn▦reqdd";
  209. if( model.getValue("/root/main/cond/searflag") == "A" ) {
  210. messageBox("전체조회시는 저장을 ", "E001");
  211. return;
  212. }
  213. for( var i = 1; i <= iRows; i++ ) {
  214. chkflag = model.getValue("/root/main/stoclist[" + i + "]/chkflag");
  215. oproomcd = model.getValue("/root/main/stoclist[" + i + "]/oproomcd");
  216. goodcd = model.getValue("/root/main/stoclist[" + i + "]/goodcd");
  217. allsizespecid = model.getValue("/root/main/stoclist[" + i + "]/allsizespecid");
  218. bfsafestocqty = model.getValue("/root/main/stoclist[" + i + "]/bfsafestocqty");
  219. safestocqty = model.getValue("/root/main/stoclist[" + i + "]/safestocqty");
  220. stocqty = model.getValue("/root/main/stoclist[" + i + "]/stocqty");
  221. inspqty = model.getValue("/root/main/stoclist[" + i + "]/inspqty");
  222. deliveqty = model.getValue("/root/main/stoclist[" + i + "]/deliveqty");
  223. rtnqty = model.getValue("/root/main/stoclist[" + i + "]/rtnqty");
  224. undeliveqty = model.getValue("/root/main/stoclist[" + i + "]/undeliveqty");
  225. stat = model.getValue("/root/main/stoclist[" + i + "]/stat");
  226. reqdd = model.getValue("/root/main/stoclist[" + i + "]/reqdd");
  227. reqcnfmyn = model.getValue("/root/main/stoclist[" + i + "]/reqcnfmyn");
  228. refdeptflag = model.getValue("/root/main/cond/refdeptflag");
  229. stocflag = model.getValue("/root/main/cond/stocflag");
  230. if( (reqcnfmyn == "Y")&&(reqdd == getCurrentDate().substr(0, 8)) ) {
  231. messageBox("확정된 당일의뢰는 CCR에서 확정취소를 해야만 수정가능합니다.", "E000");
  232. return;
  233. }else if( (reqcnfmyn == "Y")&&(reqdd != getCurrentDate().substr(0, 8)) ) {
  234. reqdd = getCurrentDate().substr(0, 8);
  235. }
  236. if( stocflag == "R"||stocflag == "U" ) {//재고등록, 변경일때는 실사량 0
  237. inspqty = "0";
  238. cnfmyn = "N";
  239. reqqty = (parseInt(safestocqty) - parseInt(bfsafestocqty));
  240. }else {
  241. cnfmyn = "N";//재고실사일경우 자동 승인 ==> CSR 승인으로 변경 2009.04.13
  242. reqqty = "0";
  243. }
  244. if( chkflag == "true" ) {
  245. //if( stocflag == "R" ) {
  246. // if( parseInt(bfsafestocqty) > 1 ) {//안전재고가 있으면 변경으로 해야함
  247. // messageBox("안전재고가 있는경우 안전재고 변경으로 변경 가능합니다.", "E000");
  248. // return;
  249. // }
  250. //}
  251. if( stocflag == "R"||stocflag == "U" ) {//재고등록, 변경
  252. if( parseInt(reqqty) == 0 ) {
  253. chkcnt += 1;
  254. continue;
  255. }
  256. if( parseInt(bfsafestocqty) < 1 ) {//이전 재고가 있으면 0입력가능
  257. if( safestocqty == "0"||safestocqty == "" ) {
  258. messageBox("수량을 입력하지 않았습니다.!", "E000");
  259. return;
  260. }
  261. }
  262. }else {
  263. if( inspqty == "0"||inspqty == "" ) {//실사량을 입력하지 않으면 리턴
  264. messageBox("수량을 입력하지 않았습니다.!", "E000");
  265. return;
  266. }
  267. if( reqcnfmyn == "Y" ) {//실사, 확정이면 I
  268. stat = "I";
  269. }
  270. }
  271. //2009.05.13 안전재고등록, 변경 확정된 조회리스트에서 수량변경시 재고변경 및 입력으로 플래그 셋팅
  272. if( (reqqty != 0)&&(parseInt(inspqty) == 0)&&(stocflag == "R"||stocflag == "U")&&(reqcnfmyn == "Y") ) {
  273. if( parseInt(bfsafestocqty) != 0 ) {//안전재고가 있다가 다시 0으로 되는경우 변경으로 셋팅되는 문제가 있어 수정 2009.12.21 K. J. M
  274. stocflag = "U";
  275. }else {
  276. stocflag = "R";
  277. }
  278. stat = "I";
  279. }
  280. cnt += 1;
  281. stoclist = stoclist + "▩" + stat + "▦" + oproomcd + "▦" + goodcd + "▦" + allsizespecid + "▦" + bfsafestocqty + "▦" + inspqty
  282. + "▦" + refdeptflag + "▦" + safestocqty + "▦" + stocflag + "▦" + reqqty
  283. + "▦" + "0" + "▦" + "0" + "▦" + cnfmyn + "▦" + reqdd;
  284. }
  285. }
  286. if( cnt > 0 ) {
  287. model.removenode("/root/send");
  288. model.makeNode("/root/send/reqdata");
  289. model.makeNode("/root/send/savedata");
  290. model.copyNode("/root/send/reqdata", "/root/main/cond");
  291. model.setValue("/root/send/savedata", stoclist);
  292. submit("TXMNP03901");
  293. }else {
  294. if( chkcnt > 0 ) {
  295. messageBox("변경된 수량이 없습니다.", "E000");
  296. }else {
  297. messageBox("선택한것이", "I004");
  298. }
  299. }
  300. }
  301. /* --------------------------------------------------*/
  302. /* type : function */
  303. /* access : public */
  304. /* desc : 방재고 등록 이력 삭제 */
  305. /* param : */
  306. /* return : */
  307. /* --------------------------------------------------*/
  308. function fDelHist() {
  309. var chkflag, goodcd, allsizespecid, oproomcd, refdeptflag, pFlag, reqdd;
  310. var cnt = 0;
  311. var dellist = "m▦goodcd▦allsizespecid▦oproomcd▦refdeptflag▦reqdd";
  312. for( var i = 1; i <= grd_stoclist.rows; i++ ) {
  313. chkflag = model.getValue("/root/main/stoclist[" + i + "]/chkflag");
  314. goodcd = model.getValue("/root/main/stoclist[" + i + "]/goodcd");
  315. allsizespecid = model.getValue("/root/main/stoclist[" + i + "]/allsizespecid");
  316. oproomcd = model.getValue("/root/main/stoclist[" + i + "]/oproomcd");
  317. reqdd = model.getValue("/root/main/stoclist[" + i + "]/reqdd");
  318. refdeptflag = model.getValue("/root/main/cond/refdeptflag");
  319. if( chkflag == "true" ) {
  320. dellist = dellist + "▩" + "C" + "▦" + goodcd + "▦" + allsizespecid + "▦" + oproomcd + "▦" + refdeptflag + "▦" + reqdd;
  321. cnt++;
  322. }
  323. }
  324. if( cnt > 0 ) {
  325. model.removenode("/root/send");
  326. model.makeNode("/root/send/reqdata");
  327. model.makeNode("/root/send/savedata");
  328. model.copyNode("/root/send/reqdata", "/root/main/cond");
  329. model.setValue("/root/send/savedata", dellist);
  330. submit("TXMNP03903");
  331. fHistSearch();
  332. }else {
  333. messageBox("선택하신 물품이 없습니다.!", "E000");
  334. return;
  335. }
  336. }
  337. /* --------------------------------------------------*/
  338. /* type : function */
  339. /* access : public */
  340. /* desc : 다음 행으로 자동 이동 이벤트 */
  341. /* param : */
  342. /* return : */
  343. /* --------------------------------------------------*/
  344. function fNextRow() {
  345. var row = -1;
  346. var rows = -1;
  347. var col = -1;
  348. var stocflag = model.getValue("/root/main/cond/stocflag");
  349. row = grd_stoclist.row;
  350. rows = grd_stoclist.rows;
  351. col = grd_stoclist.col;
  352. if( (row == (rows-1))||(row < 1)||(col == 1) ) {
  353. return;
  354. }else {
  355. if( stocflag == "R" || stocflag == "U" ) {//안전재고등록, 변경
  356. if( col == 17 ) {
  357. grd_stoclist.row = row + 1;
  358. grd_stoclist.editCell();
  359. }
  360. }else {
  361. if( col == 19 ) {
  362. grd_stoclist.row = row + 1;
  363. grd_stoclist.editCell();
  364. }
  365. }
  366. }
  367. }