SMRSD07100.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. /* ---------------------------------------------------------------------
  2. SMRSD07100_처방성물품사용현황조회.xrw (SMRSD07100.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. : Create By Chungpd.
  6. : 2010.12.08
  7. ---------------------------------------------------------------------- */
  8. var vProgramCls = "SMRSD07100";
  9. //
  10. var vGoodReqPath = "/root/main/list/goodreq/goodreqlist";
  11. var xAuth = !(checkAuth("X"));
  12. var pAuth = !(checkAuth("P"));
  13. var DataPath = "/root/main/RscmggbnEmpData";
  14. var MainPath = "/root/main/RscmggbnLists/rscmggbnlist";
  15. var ListsPath = "/root/main/RscmggbnEmpLists";
  16. var ListPath = "/root/main/RscmggbnEmpLists/rscmggbnemplist";
  17. var HidePath = "/root/WorkData/HideData";
  18. var TreePath = "/root/main/RscmgubnLists/TreeList";
  19. var WorkPath = "/root/init/WorkInit";
  20. var CompPath = "/root/init/CompareInit";
  21. var TreeSendPath = "/root/send/SearchTree";
  22. var trv_setcode_index = -1;
  23. // --------------------------------------------------
  24. // Tree정보 가져오기
  25. // --------------------------------------------------
  26. function fInit() {
  27. // 화면 Control을 초기화한다
  28. fInitialize();
  29. return;
  30. }
  31. // --------------------------------------------------------------
  32. // 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
  33. // --------------------------------------------------------------
  34. function fInitialize() {
  35. // 처방내역 그리드 초기화
  36. misfGridInit(grd_prcppatcaselist);
  37. model.setValue(opt_instcd.attribute("ref") , getUserInfo("dutplceinstcd")); // 기관코드
  38. model.setValue(opt_instcdnm.attribute("ref") , getUserInfo("dutplceinstnm")); // 기관코드명
  39. if(!fCheckDeptAuth(getUserInfo("dutplcecd"), getUserInfo("dutplceinstcd"))) { // 부서권한 확인
  40. ipt_prcpdeptcd.value = getUserInfo("dutplcecd");
  41. ipt_prcpdeptnm.value = getUserInfo("dutplcenm");
  42. ipt_prcpdeptcd.disabled = true;
  43. btn_prcpdeptcd.disabled = true;
  44. btn_deliveqtysave.visible = false;
  45. btn_excel.visible = false;
  46. btn_wardprint.visible = false;
  47. btn_deptstoc.visible = false;
  48. rdo_viewcls.disabled = true;
  49. }
  50. var curdate = getCurrentDate();
  51. var cvtdate = curdate.toDate("YYYYMMDD");
  52. model.setValue(ipt_acptdd.attribute("ref") , curdate);
  53. model.setValue(rdo_sumflag.attribute("ref") , "Y");
  54. model.setValue(rdo_ioflag.attribute("ref") , "");
  55. model.setValue(rdo_prntmthd.attribute("ref") , "G");
  56. model.removeNodeset("/root/main/list/prcpgoodcase/prcpgoodcaselist");
  57. model.removeNodeset("/root/main/list/prcppatcase/prcppatcaselist");
  58. misfComboComCdListMulti("030R0034,R0450","rdo_erprcpflag,chk_wareflag");
  59. // 접속기관 스타일 변경
  60. fInitInstStyle();
  61. rdo_erprcpflag.select(0);
  62. ipt_acptdd.dispatch("xforms-value-changed");
  63. model.refresh();
  64. }
  65. // 접속기관 스타일 변경
  66. function fInitInstStyle() {
  67. if(getScreenID() == "SMRSD07100") {
  68. // 경북대학교병원 적용
  69. if(getUserInfo("dutplceinstcd") == "031") {
  70. // 본원에서 접근시 '일반+응급' 항목 추가표시
  71. addComboItem("rdo_erprcpflag", "정규+응급", "A", "above");
  72. rdo_erprcpflag.refresh();
  73. grd_prcpgoodcaselist.colWidth(grd_prcpgoodcaselist.colRef("safestocqty")) = 0;
  74. grd_prcpgoodcaselist.colWidth(grd_prcpgoodcaselist.colRef("delivecnfmqty")) = 0;
  75. grd_prcpgoodcaselist.colHidden(grd_prcpgoodcaselist.colRef("safestocqty")) = true;
  76. grd_prcpgoodcaselist.colHidden(grd_prcpgoodcaselist.colRef("delivecnfmqty")) = true;
  77. btn_deliveqtysave.visible = false;
  78. }
  79. // 칠곡경북대학교병원 적용
  80. if(getUserInfo("dutplceinstcd") == "032") {
  81. var gridCaption = grd_prcpgoodcaselist.caption;
  82. gridCaption = gridCaption.replace("^총수량", "^처방집계수량");
  83. grd_prcpgoodcaselist.caption = gridCaption;
  84. grd_prcpgoodcaselist.colWidth(grd_prcpgoodcaselist.colRef("deliveqty")) = 0;
  85. grd_prcpgoodcaselist.colHidden(grd_prcpgoodcaselist.colRef("deliveqty")) = true;
  86. var userid = getUserInfo("userid");
  87. if(userid == "10012" || userid == "12008" || userid == "06157" || userid == "MIS") {
  88. //if(getUserInfo("dutplcenm") == "4020334000") {
  89. btn_enddelive.visible = true;
  90. btn_enddelivedept.visible = true;
  91. btn_canceldelivedept.visible = true;
  92. btn_save. visible = true;
  93. } else {
  94. btn_enddelive.visible = false;
  95. btn_enddelivedept.visible = false;
  96. btn_canceldelivedept.visible = false;
  97. btn_save. visible = false;
  98. grd_deptstoc.colWidth(grd_deptstoc.colRef("appyn")) = 0;
  99. grd_deptstoc.colHidden(grd_deptstoc.colRef("appyn")) = true;
  100. grd_deptstoc.colHidden(grd_deptstoc.colRef("deliveyn")) = true; // 불출여부 컬럼 숨김
  101. }
  102. model.setValue(chk_prcpinptflag.attribute("ref"),"ignore");
  103. chk_prcpinptflag.refresh();
  104. rdo_erprcpflag.disabled = true;
  105. }
  106. }
  107. }
  108. function fDataSearchTree() {
  109. // if (fCheckRetrieveData(false) == false) return;
  110. misfGridInit(grd_prcppatcaselist);
  111. if(submit("TRRSD07103")) {
  112. trv_setcode.rebuild();
  113. if(rdo_viewcls.value == "0" && instance1.selectNodes("/root/main/PrcpGoodTrees/TreeList[depth='2']").length == 1) {
  114. trv_setcode.value = instance1.selectSingleNode("/root/main/PrcpGoodTrees/TreeList[depth='2']/pcode").value;
  115. // 트러스트폼 트리뷰 focusIndex 값 오류로 전역변수에 인덱스 저장
  116. trv_setcode_index = 1;
  117. trv_setcode.dispatch("xforms-value-changed");
  118. }else if(rdo_viewcls.value != "0" && instance1.selectNodes("/root/main/PrcpGoodTrees/TreeList[depth='1']").length == 1) {
  119. trv_setcode.value = instance1.selectSingleNode("/root/main/PrcpGoodTrees/TreeList[depth='1']/pcode").value;
  120. // 트러스트폼 트리뷰 focusIndex 값 오류로 전역변수에 인덱스 저장
  121. trv_setcode_index = 0;
  122. trv_setcode.dispatch("xforms-value-changed");
  123. }
  124. trv_setcode.refresh();
  125. }
  126. }
  127. // 처방전달물품내역조회
  128. function fDataSearchDetail(pIdx)
  129. {
  130. var rPath = "/root/send/SearchTree";
  131. var dPath = "/root/send/prcppatcaseinfo";
  132. var tPath = "/root/main/PrcpGoodTrees/TreeList";
  133. var vCaption = " 처방전달물품";
  134. // if (fCheckRetrieveData(false) == false)return; // 입력항목 Check
  135. if(pIdx == -1) pIdx = trv_setcode_index;
  136. else trv_setcode_index = pIdx;
  137. var Idx = pIdx + 1;
  138. var sDepth = model.getValue(tPath +"["+Idx+"]/depth" );
  139. var vCodeCd = model.getValue(tPath +"["+Idx+"]/codecd" );
  140. var vCodeNm = model.getValue(tPath +"["+Idx+"]/codenm" );
  141. var vBaseCd = model.getValue(tPath +"["+Idx+"]/basecode");
  142. var Tree2 = trv_setcode.item(pIdx);
  143. var ioflag = model.getValue(rdo_ioflag.attribute("ref"));
  144. misfGridInit(grd_prcppatcaselist);
  145. misfGridInit(grd_prcpgoodcaselist);
  146. misfGridInit(grd_deptstoc);
  147. if (vCodeCd == "") return;
  148. model.setValue(dPath + "/instcd" , model.getValue(rPath + "/instcd" )); // 01 기관코드
  149. model.setValue(dPath + "/acptdd" , model.getValue(rPath + "/acptdd" )); // 02 처방일자
  150. model.setValue(dPath + "/sumflag" , model.getValue(rPath + "/sumflag" )); // 04 집계여부
  151. model.setValue(dPath + "/reqflag" , model.getValue(rPath + "/reqflag" )); // 05 청구구분
  152. model.setValue(dPath + "/reqdeptcd" , "" ); // 06 처방부서
  153. model.setValue(dPath + "/reqprid" , model.getValue(rPath + "/reqprid" )); // 07 청구주기
  154. model.setValue(dPath + "/prcpdeptcd" , "" ); // 08 시행부서
  155. model.setValue(dPath + "/goodcd" , model.getValue(rPath + "/goodcd" )); // 09 물품코드
  156. model.setValue(dPath + "/ioflag" , model.getValue(rPath + "/ioflag" )); // 10 입외구분
  157. model.setValue(dPath + "/deptgr" , "" ); // 11 부서그룹
  158. model.setValue(dPath + "/pid" , model.getValue(rPath + "/pid" )); // 12 환자번호
  159. model.setValue(dPath + "/patnm" , model.getValue(rPath + "/patnm" )); // 13 환자명
  160. model.setValue(dPath + "/purcflag" , model.getValue(rPath + "/purcflag" )); // 14 구매구분
  161. model.setValue(dPath + "/prodcmpynm" , model.getValue(rPath + "/prodcmpynm" )); // 15 제조회사명
  162. model.setValue(dPath + "/suplplcecdnm", model.getValue(rPath + "/suplplcecdnm" )); // 16 주거래처명
  163. model.setValue(dPath + "/suppcustnm" , model.getValue(rPath + "/suppcustnm" )); // 17 보조거래처명
  164. model.setValue(dPath + "/prntmthd" , model.getValue(rPath + "/prntmthd" )); // 18 출력형식
  165. model.setValue(dPath + "/sumcnt" , model.getValue(rPath + "/sumcnt" )); // 19 집계횟수
  166. model.setValue(dPath + "/scrnid" , model.getValue(rPath + "/scrnid" )); // 20 화면ID
  167. model.setValue(dPath + "/erprcpflag" , model.getValue(rPath + "/erprcpflag" )); // 21 응급여부
  168. model.setValue(dPath + "/prcpinptflag", model.getValue(rPath + "/prcpinptflag" )); // 22 처방입력구분
  169. // 선불출 조회조건 추가 이창록
  170. model.makeValue(dPath + "/querycls" , model.getValue("/root/send/SearchTree/querycls")); // 19 라디오박스 선불출코드
  171. // 물류창고 조회조건 추가
  172. model.setValue(dPath + "/wareflag" , model.getValue(rPath + "/wareflag" )); // 창고구분(물류창고)
  173. if(getScreenID() == "SMRSD07100"){ // 처방집계 출력화면일 경우
  174. model.setValue(dPath + "/wareflagarr" , model.getValue(rPath + "/wareflagarr" )); // 창고구분배열 조건
  175. model.setValue(dPath + "/acntcd" , model.getValue(rPath + "/acntcd" )); // 계정과목
  176. model.setValue(dPath + "/acpttodd" , model.getValue(rPath + "/acpttodd" )); // 집계종료일자
  177. model.setValue(dPath + "/querycls" , model.getValue(rPath + "/querycls" )); // 부서조회여부
  178. }
  179. var vCls = parseInt(rdo_viewcls.value+sDepth);
  180. switch(vCls) {
  181. case 01 :
  182. vCaption = " :: 전체" ;
  183. break;
  184. case 02 :
  185. model.setValue(dPath + "/prcpdeptcd" , vCodeCd );
  186. vCaption = "시행부서 : "+vCodeCd + " - " + vCodeNm;
  187. break;
  188. case 11 :
  189. model.setValue(dPath + "/reqdeptcd" , vCodeCd);
  190. vCaption = "처방부서 : "+ vCodeCd + " - " + vCodeNm;
  191. break;
  192. case 12 :
  193. model.setValue(dPath + "/prcpdeptcd" , vCodeCd );
  194. vCode = model.getValue(tPath +"["+(Tree2.parentindex + 1)+"]/codecd" );
  195. vName = model.getValue(tPath +"["+(Tree2.parentindex + 1)+"]/codenm" );
  196. model.setValue(dPath + "/reqdeptcd" , vCode );
  197. vCaption = "처방부서 : "+vCode + " - " + vName + " >> 시행부서 : "+vCodeCd+ " - "+vCodeNm;
  198. break;
  199. case 21 :
  200. model.setValue(dPath + "/prcpdeptcd" , vCodeCd );
  201. vCaption = "시행부서 : "+vCodeCd + " - " + vCodeNm;
  202. break;
  203. case 22 :
  204. model.setValue(dPath + "/reqdeptcd" , vCodeCd);
  205. vCode = model.getValue(tPath +"["+(Tree2.parentindex + 1)+"]/codecd" );
  206. vName = model.getValue(tPath +"["+(Tree2.parentindex + 1)+"]/codenm" );
  207. model.setValue(dPath + "/prcpdeptcd" , vCode );
  208. vCaption = "시행부서 : "+vCode + " - " + vName + " >> 처방부서 : "+vCodeCd+ " - "+vCodeNm ;
  209. break;
  210. case 31 :
  211. model.setValue(dPath + "/prcpdeptcd" , vCodeCd );
  212. vCaption = "시행부서 : "+vCodeCd + " - " + vCodeNm;
  213. break;
  214. case 32 :
  215. model.setValue(dPath + "/goodcd" , vCodeCd);
  216. vCode = model.getValue(tPath +"["+(Tree2.parentindex + 1)+"]/codecd" );
  217. vName = model.getValue(tPath +"["+(Tree2.parentindex + 1)+"]/codenm" );
  218. model.setValue(dPath + "/prcpdeptcd" , vCode );
  219. vCaption = "시행부서 : "+vCode + " - " + vName + " >> 물품코드 : "+vCodeCd+ " - "+vCodeNm ;
  220. }
  221. cap_prcpgoodcasetitle.hint = "";
  222. if (model.getValue(dPath + "/prntmthd") == "P"){
  223. submit("TRRSD07101",false); //환자별 집계내역
  224. btn_prcpgoodcase.visible = false;
  225. btn_prcppatcase.visible = true;
  226. if(btn_prcppatcase.selected == true) {
  227. model.toggle("cse_prcppatcase");
  228. btn_prcppatcase.selected = true;
  229. }
  230. }else{
  231. submit("TRRSD07102",false); //물품별 집계내역
  232. btn_prcppatcase.visible = false;
  233. btn_prcpgoodcase.visible = true;
  234. if(btn_prcpgoodcase.selected == true) {
  235. model.toggle("cse_prcpgoodcase");
  236. btn_prcpgoodcase.selected = true;
  237. }
  238. var tooltip = "";
  239. tooltip = model.getValue("/root/main/list/prcpgoodcase/prcpsuminfo/sumcmt");
  240. cap_prcpgoodcasetitle.hint = tooltip;
  241. }
  242. model.refresh();
  243. fGrdiDataValid();
  244. if(model.getValue("/root/main/list/prcpgoodcase/deptstoccaselist/prnyn") == "N") {
  245. btn_enddelive.disabled = false;
  246. } else {
  247. btn_enddelive.disabled = true;
  248. }
  249. var chkSave = instance1.selectNodes("/root/main/list/prcpgoodcase/deptstoccaselist[edityn='Y']/edityn");
  250. if(chkSave != null && chkSave.length > 0) {
  251. btn_save.disabled = false;
  252. } else {
  253. btn_save.disabled = true;
  254. }
  255. var deptcd = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("prcpdeptcd"));
  256. var others = instance1.selectNodes(grd_deptstoc.nodeset + "[prcpdeptcd != '" + deptcd + "']");
  257. var sameDeptcd = false;
  258. var flag1 = true;
  259. var flag2 = true;
  260. if(deptcd != null && others.length == 0) sameDeptcd = true;
  261. if(sameDeptcd) {
  262. var deliveCnt1 = instance1.selectNodes("/root/main/list/prcpgoodcase/deptstoccaselist[deliveendflag='N']").length;
  263. var deliveCnt2 = instance1.selectNodes("/root/main/list/prcpgoodcase/deptstoccaselist[deliveendflag='Y' and execyn!='Y']").length;
  264. if(deliveCnt1 > 0) flag1 = false;
  265. if(deliveCnt2 > 0) flag2 = false;
  266. }
  267. btn_enddelivedept.disabled = flag1;
  268. btn_canceldelivedept.disabled = flag2;
  269. }
  270. // 처방전달물품내역
  271. function fDataPartToggle(pCls) {
  272. if (pCls =="0") { // Key 조회
  273. // 메인 Grup
  274. grp_main.attribute("left" ) = "350px";
  275. // grp_main.attribute("top" ) = "8px" ;
  276. grp_main.attribute("width" ) = "835px";
  277. // grp_main.attribute("height" ) = "747px";
  278. btn_excel2.attribute("left" ) = "778px";
  279. lin_main.attribute("x2" ) = "835px";
  280. grd_prcppatcaselist.attribute("width") = "835px";
  281. if (vProgramCls == "SMRSD02203") {
  282. btn_save.attribute("left" ) = "715px";
  283. }
  284. } else { //
  285. // 메인 Grup
  286. grp_main.attribute("left" ) = "0px" ;
  287. //grp_main.attribute("top" ) = "8px" ;
  288. grp_main.attribute("width" ) = "1192px";
  289. //grp_main.attribute("height" ) = "747px" ;
  290. btn_excel2.attribute("left" ) = "1135px";
  291. lin_main.attribute("x2" ) = "1192px";
  292. grd_prcppatcaselist.attribute("width") = "1192px";
  293. if (vProgramCls == "SMRSD02203") {
  294. btn_save.attribute("left" ) = "1072px";
  295. }
  296. }
  297. grp_main.refresh();
  298. }
  299. // 조회 결과 Count Setting
  300. function fAfterRetrieve() {
  301. // case 1 count
  302. model.setValue(opt_goodreqcnt.attribute("ref"),(grd_goodreq.rows-grd_goodreq.fixedRows));
  303. // case 2 count
  304. // model.setValue(opt_searchgoodcnt.attribute("ref"),(grd_prcppatcaselist.rows-grd_prcppatcaselist.fixedRows));
  305. model.refresh();
  306. }
  307. // Grid의 데이터를 확인하여 오류 데이터시 색상 변경
  308. // 물품Master의 All size && 집계 여부시 색상변경
  309. function fGrdiDataValid() {
  310. grd_deptstoc.rebuildStyle();
  311. var deptstocList = instance1.selectNodes(grd_deptstoc.nodeset);
  312. grd_deptstoc.colStyle(2, "data", "background-color") = "pink";
  313. if(deptstocList != null && deptstocList.length > 0) {
  314. for(var i=0; i<deptstocList.length; i++) {
  315. var selectNode = deptstocList.item(i);
  316. if(selectNode.selectSingleNode("edityn").value == "N") {
  317. selectNode.selectSingleNode("appyn").readOnly = "1";
  318. if(selectNode.selectSingleNode("appyn").value == "Y") {
  319. grd_deptstoc.cellstyle("background-color", grd_deptstoc.fixedRows + i, grd_deptstoc.colRef("deliveyn"), grd_deptstoc.fixedRows + i, grd_deptstoc.colRef("deliveyn")) = "green";
  320. selectNode.selectSingleNode("deliveyn").value = "√";
  321. }
  322. }
  323. }
  324. grd_deptstoc.refresh();
  325. }
  326. grd_prcpgoodcaselist.rebuildStyle();
  327. var delivecnfmqtyCol = grd_prcpgoodcaselist.colRef("delivecnfmqty");
  328. var deptAuth = fCheckDeptAuth(getUserInfo("dutplcecd"), getUserInfo("dutplceinstcd"));
  329. for(var i=grd_prcpgoodcaselist.fixedRows; i<grd_prcpgoodcaselist.rows; i++) {
  330. var comment = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("cmt2"));
  331. var edityn = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("edityn"));
  332. var cmt_view = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("cmt_view"));
  333. var safestocqty = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("safestocqty"));
  334. var totqty = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("totqty"));
  335. var delivecnfmqty = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("delivecnfmqty"));
  336. var deliveqty = grd_prcpgoodcaselist.valueMatrix(i, grd_prcpgoodcaselist.colRef("deliveqty"));
  337. var equalFlag = (parseInt(deliveqty) == parseInt(delivecnfmqty));
  338. if(comment != null && comment.length > 0) {
  339. if(!equalFlag) {
  340. grd_prcpgoodcaselist.cellstyle("color", i, delivecnfmqtyCol, i, delivecnfmqtyCol) = "blue";
  341. }
  342. grd_prcpgoodcaselist.tooltipText(i, delivecnfmqtyCol) = comment;
  343. } else {
  344. grd_prcpgoodcaselist.tooltipText(i, delivecnfmqtyCol) = "";
  345. }
  346. // 부서 불출마감이 입력 되거나 부서재고가 입고 처리 된 경우 수정불가 처리(edityn)
  347. // 내시경검사실의 사용부서가 물류파트 인 일부 물품은 불출확정수량 수정불가 처리(cmt_view)
  348. if(deptAuth && (edityn == "N" || cmt_view == "N")) {
  349. grd_prcpgoodcaselist.isReadOnly(i, delivecnfmqtyCol, i, delivecnfmqtyCol) = false;
  350. } else {
  351. grd_prcpgoodcaselist.isReadOnly(i, delivecnfmqtyCol, i, delivecnfmqtyCol) = true;
  352. }
  353. // 안전재고 수량이 비어 있는 경우 붉은 글씨로 표시
  354. if(equalFlag && safestocqty == "") {
  355. grd_prcpgoodcaselist.cellstyle("color", i, delivecnfmqtyCol, i, delivecnfmqtyCol) = "red";
  356. }
  357. // 처방집계수량이 안전재고 수량보다 많을 경우 붉은 글씨로 표시
  358. if(!isNaN(safestocqty) && parseInt(safestocqty) < parseInt(delivecnfmqty)) {
  359. grd_prcpgoodcaselist.cellstyle("color", i, delivecnfmqtyCol, i, delivecnfmqtyCol) = "red";
  360. }
  361. }
  362. grd_prcpgoodcaselist.refresh();
  363. if (grd_prcppatcaselist.rows - grd_prcppatcaselist.fixedRows <= 0 ) return;
  364. grd_prcppatcaselist.rebuildStyle();
  365. for(var cnt = grd_prcppatcaselist.fixedRows; cnt< grd_prcppatcaselist.rows; cnt++) {
  366. // All SIze 물품이면서 Size 지정이 되지 않고 내려온 처방
  367. if (grd_prcppatcaselist.valueMatrix( cnt, grd_prcppatcaselist.colRef("allsizeyn" )) == "Y" &&
  368. grd_prcppatcaselist.valueMatrix( cnt, grd_prcppatcaselist.colRef("allsizespecid")) == "-" ) {
  369. grd_prcppatcaselist.cellstyle("background-color", cnt, grd_prcppatcaselist.colRef("rgstdd"), cnt, grd_prcppatcaselist.colRef("totqty")) = "yellow";
  370. grd_prcppatcaselist.cellstyle("color" , cnt, grd_prcppatcaselist.colRef("rgstdd"), cnt, grd_prcppatcaselist.colRef("totqty")) = "red";
  371. // grd_prcppatcaselist.valueMatrix( cnt, grd_prcppatcaselist.colRef("goodspec") ) = "All Size 미지정";
  372. }
  373. // 처방 집계 여부
  374. if (grd_prcppatcaselist.valueMatrix( cnt, grd_prcppatcaselist.colRef("sumflag"))=="Y" ) {
  375. grd_prcppatcaselist.cellstyle("background-color", cnt, grd_prcppatcaselist.colRef("sumflagnm"), cnt, grd_prcppatcaselist.colRef("sumflagnm") ) = "green";
  376. } else{
  377. grd_prcppatcaselist.cellstyle("background-color", cnt, grd_prcppatcaselist.colRef("sumflagnm"), cnt, grd_prcppatcaselist.colRef("sumflagnm") ) = "pink";
  378. }
  379. if (model.getValue(grd_prcppatcaselist.nodeset + "[" + cnt + "]/allsizeyn") == "Y" ) {
  380. grd_prcppatcaselist.cellstyle("background-color", cnt, 4) = "#FFFF00";
  381. //if (model.getValue(grd_prcppatcaselist.nodeset + "[" + cnt + "]/allsizespecid") == "-" ) {
  382. // grd_prcppatcaselist.colAttribute ( 1, "disabled" ) = true;
  383. // grd_prcppatcaselist.coldisabled(grd_prcppatcaselist.colRef("beforqty")) = true;
  384. //}
  385. //} else {
  386. // grd_reqsetlist.cellstyle("background-color", j, 5) = "transparent";
  387. }
  388. }
  389. grd_prcppatcaselist.refresh();
  390. }
  391. /***********************************************************
  392. * 물품 처방 집계에서 사용한 Script
  393. ************************************************************/
  394. // 부서코드 읽어오기...
  395. function fDeptValidationCheck(pData1, pData2, pCodeName) {
  396. if (pData1.value.length == 0) {
  397. pData2.value = "";
  398. } else {
  399. rszfValidationCheck("TRRPZ00201", "deptcodelist", "refcond,deptnm","deptnm," + pData1.value,"", pCodeName, pData1, "SPRPZ00200", "","");
  400. }
  401. model.refresh();
  402. }
  403. function fSaveDeptStocList() {
  404. var updtdata = "";
  405. updtdata = getGridUpdateData(grd_deptstoc);
  406. if(updtdata == ""){
  407. messageBox("저장할 데이타가 ","E014");
  408. return false;
  409. }
  410. model.makeValue("/root/send/save/deptstoclist", updtdata);
  411. if (submit("TXRSD07101")){
  412. messageBox("저장이","I002");
  413. fDataSearchDetail(trv_setcode.focusIndex);
  414. //btn_search.dispatch("DOMActivate");
  415. } else {
  416. messageBox("저장","E009");
  417. return;
  418. }
  419. }
  420. // 출고마감 저장
  421. function fSaveDeptStocEnd(deptcd) {
  422. var updtdata = "";
  423. updtdata = getGridUpdateData(grd_deptstoc);
  424. if(updtdata != ""){
  425. messageBox("변경사항이 저장 되지 않았습니다.","E");
  426. return;
  427. }
  428. if(grd_deptstoc.rows - grd_deptstoc.fixedRows > 0) {
  429. var instcd = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("instcd"));
  430. var acptdd = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("acptdd"));
  431. var sumcnt = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("sumcnt"));
  432. model.removeNodeSet("/root/send/save/delivestocend")
  433. model.makeNode("/root/send/save/delivestocend");
  434. model.makeValue("/root/send/save/delivestocend/instcd",instcd);
  435. model.makeValue("/root/send/save/delivestocend/acptdd",acptdd);
  436. model.makeValue("/root/send/save/delivestocend/sumcnt",sumcnt);
  437. model.makeValue("/root/send/save/delivestocend/deptcd",deptcd);
  438. if (submit("TXRSD07102")){
  439. messageBox("저장이","I002");
  440. fDataSearchDetail(trv_setcode.focusIndex);
  441. //btn_search.dispatch("DOMActivate");
  442. } else {
  443. messageBox("저장","E009");
  444. return;
  445. }
  446. }
  447. }
  448. // 출고마감 취소
  449. function fSaveDeptStocEndCancel(deptcd) {
  450. if(grd_deptstoc.rows - grd_deptstoc.fixedRows > 0) {
  451. var instcd = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("instcd"));
  452. var acptdd = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("acptdd"));
  453. var sumcnt = grd_deptstoc.valueMatrix(1,grd_deptstoc.colRef("sumcnt"));
  454. model.removeNodeSet("/root/send/save/delivestocend")
  455. model.makeNode("/root/send/save/delivestocend");
  456. model.makeValue("/root/send/save/delivestocend/instcd",instcd);
  457. model.makeValue("/root/send/save/delivestocend/acptdd",acptdd);
  458. model.makeValue("/root/send/save/delivestocend/sumcnt",sumcnt);
  459. model.makeValue("/root/send/save/delivestocend/deptcd",deptcd);
  460. if (submit("TXRSD07103")){
  461. messageBox("저장이","I002");
  462. fDataSearchDetail(trv_setcode.focusIndex);
  463. //btn_search.dispatch("DOMActivate");
  464. } else {
  465. messageBox("저장","E009");
  466. return;
  467. }
  468. }
  469. }
  470. // (칠곡) 불출확정수량 저장
  471. function fSaveDeliveCnfmQtyList() {
  472. var updtdata = "";
  473. var tarGrid = grd_prcpgoodcaselist;
  474. for(var i=tarGrid.fixedRows; i<tarGrid.rows; i++) {
  475. var bfdelivecnfmqty = parseFloat(tarGrid.valueMatrix(i,tarGrid.colRef("bfdelivecnfmqty")));
  476. var delivecnfmqty = parseFloat(tarGrid.valueMatrix(i,tarGrid.colRef("delivecnfmqty")));
  477. if(bfdelivecnfmqty != delivecnfmqty) {
  478. tarGrid.rowStatus(i) = "2";
  479. } else {
  480. tarGrid.rowStatus(i) = "0";
  481. }
  482. }
  483. tarGrid.refresh();
  484. updtdata = getGridUpdateData(tarGrid);
  485. if(updtdata == ""){
  486. messageBox("저장할 데이타가 ","E014");
  487. return false;
  488. }
  489. //alert(updtdata);
  490. model.makeValue("/root/send/save/delivecnfmqtylist", updtdata);
  491. if (submit("TXRSD07104")){
  492. messageBox("저장이","I002");
  493. fDataSearchDetail(trv_setcode.focusIndex);
  494. //btn_search.dispatch("DOMActivate");
  495. } else {
  496. messageBox("저장","E009");
  497. return;
  498. }
  499. }
  500. // 부서권한 확인
  501. function fCheckDeptAuth(pDeptcd, pInstcd) {
  502. if( (pInstcd == "031" && pDeptcd == "3080000000") // 본원 진료재료파트
  503. || (pInstcd == "031" && pDeptcd == "4020334000") // 본원 물류파트
  504. || (pInstcd == "032" && pDeptcd == "4020334000") // 칠곡 물류파트
  505. || (pInstcd == "032" && pDeptcd == "3360000000")) { // 칠곡 중앙공급실
  506. return true;
  507. } else {
  508. return false;
  509. }
  510. }
  511. /* ------------------------------------------------- */
  512. /* ------End Of List ------------------------------- */
  513. /* -------------------------------------------------- */