SMRSD07100.xjs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Script type="xscript4.0"><![CDATA[/* ---------------------------------------------------------------------
  3. SMRSD07100_처방성물품사용현황조회.xrw (SMRSD07100.xfm - JScript )
  4. - Version :
  5. 1) : Ver.1.00.01
  6. : Create By Chungpd.
  7. : 2010.12.08
  8. ---------------------------------------------------------------------- */
  9. var vProgramCls = "SMRSD07100";
  10. var vGoodReqPath = "ds_main_list_goodreq_goodreqlist";
  11. var xAuth = frmf_checkAuth("X");
  12. var pAuth = frmf_checkAuth("P");
  13. var DataPath = "ds_main_RscmggbnEmpData";
  14. var MainPath = "ds_main_RscmggbnLists_rscmggbnlist";
  15. var ListsPath = "ds_main_RscmggbnEmpLists";
  16. var ListPath = "ds_main_RscmggbnEmpLists_rscmggbnemplist";
  17. var HidePath = "ds_WorkData_HideData";
  18. var TreePath = "ds_main_RscmgubnLists_TreeList";
  19. var WorkPath = "ds_init_WorkInit";
  20. var CompPath = "ds_init_CompareInit";
  21. var TreeSendPath = "ds_send_SearchTree";
  22. var trv_setcode_index = -1;
  23. /****************************************************************************************
  24. * Argument : N/A
  25. * Description : Tree정보 가져오기
  26. ****************************************************************************************/
  27. function fInit() {
  28. // 화면 Control을 초기화한다
  29. fInitialize();
  30. return;
  31. }
  32. /****************************************************************************************
  33. * Argument : N/A
  34. * Description : 화면 open시와 초기화 버튼 클릭시 화면 초기화 기능을 수행한다.
  35. ****************************************************************************************/
  36. function fInitialize() {
  37. // 처방내역 그리드 초기화
  38. misfGridInit(group5.switch1.cse_prcppatcase.grd_prcppatcaselist);
  39. group5.grp_key.opt_instcd.value = sysf_getUserInfo("dutplceinstcd"); // 기관코드
  40. group5.grp_key.opt_instcdnm.value = sysf_getUserInfo("dutplceinstnm"); // 기관코드명
  41. if(!fCheckDeptAuth(sysf_getUserInfo("dutplcecd"), sysf_getUserInfo("dutplceinstcd"))) { // 부서권한 확인
  42. group5.grp_key.ipt_prcpdeptcd.value = sysf_getUserInfo("dutplcecd");
  43. group5.grp_key.ipt_prcpdeptnm.value = sysf_getUserInfo("dutplcenm");
  44. group5.grp_key.ipt_prcpdeptcd.enable = false;
  45. group5.grp_key.btn_prcpdeptcd.enable = false;
  46. group5.switch1.cse_prcpgoodcase.btn_deliveqtysave.visible = false;
  47. group5.switch1.cse_prcpgoodcase.btn_excel.visible = false;
  48. group5.switch1.cse_prcpgoodcase.btn_wardprint.visible = false;
  49. grp_tabbtn.btn_deptstoc.visible = false;
  50. group5.grp_detail.rdo_viewcls.enable = false;
  51. }
  52. var curdate = utlf_getCurrentDate();
  53. var cvtdate = curdate.toDate("YYYYMMDD");
  54. group5.grp_key.ipt_acptdd.value = curdate;
  55. group5.grp_key.rdo_sumflag.value = "Y";
  56. group5.grp_key.rdo_ioflag.value = "";
  57. group5.grp_key.rdo_prntmthd.value = "G";
  58. ds_main_list_prcpgoodcase_prcpgoodcaselist.clearData();
  59. ds_main_list_prcppatcase_prcppatcaselist.clearData();
  60. misfComboComCdListMulti("030R0034,R0450","group5.grp_key.rdo_erprcpflag,group5.grp_key.chk_wareflag");
  61. // 접속기관 스타일 변경
  62. fInitInstStyle();
  63. group5.grp_key.rdo_erprcpflag.index = 0;
  64. frmf_inputEnterKey("group5.grp_key.ipt_acptdd", "onchanged", new ChangeEventInfo);
  65. }
  66. /****************************************************************************************
  67. * Argument : N/A
  68. * Description : 접속기관 스타일 변경
  69. ****************************************************************************************/
  70. function fInitInstStyle() {
  71. if(frmf_getScreenID() == "SMRSD07100") {
  72. // 경북대학교병원 적용
  73. if(sysf_getUserInfo("dutplceinstcd") == "031") {
  74. // 본원에서 접근시 '일반+응급' 항목 추가표시
  75. frmf_addComboItem("group5.grp_key.rdo_erprcpflag", "정규+응급", "A", "above");
  76. misfColHidden(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "safestocqty,delivecnfmqty", true);
  77. group5.switch1.cse_prcpgoodcase.btn_deliveqtysave.visible = false;
  78. }
  79. // 칠곡경북대학교병원 적용
  80. if(sysf_getUserInfo("dutplceinstcd") == "032") {
  81. for(var i = 0 ; i < group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist.getCellCount("Head") ; i++) {
  82. var hText = group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist.getCellText(-1,i);
  83. if(hText == "총수량") {
  84. group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist.setCellProperty("Head",i,"text","처방집계수량");
  85. break;
  86. }
  87. }
  88. misfColHidden(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "deliveqty", true);
  89. var userid = sysf_getUserInfo("userid");
  90. if(userid == "10012" || userid == "12008" || userid == "06157" || userid == "MIS") {
  91. group5.switch1.cse_deptstoc.btn_enddelive.visible = true;
  92. group5.switch1.cse_deptstoc.btn_enddelivedept.visible = true;
  93. group5.switch1.cse_deptstoc.btn_canceldelivedept.visible = true;
  94. group5.switch1.cse_deptstoc.btn_save.visible = true;
  95. } else {
  96. group5.switch1.cse_deptstoc.btn_enddelive.visible = false;
  97. group5.switch1.cse_deptstoc.btn_enddelivedept.visible = false;
  98. group5.switch1.cse_deptstoc.btn_canceldelivedept.visible = false;
  99. group5.switch1.cse_deptstoc.btn_save.visible = false;
  100. misfColHidden(group5.switch1.cse_deptstoc.grd_deptstoc, "appyn,deliveyn", true); // 불출여부 컬럼 숨김
  101. }
  102. group5.grp_key.chk_prcpinptflag.value = "ignore";
  103. group5.grp_key.rdo_erprcpflag.enable = false;
  104. }
  105. }
  106. }
  107. /****************************************************************************************
  108. * Argument : N/A
  109. * Description : 조회
  110. ****************************************************************************************/
  111. function fDataSearchTree() {
  112. misfGridInit(group5.switch1.cse_prcppatcase.grd_prcppatcaselist);
  113. var oParam = {};
  114. oParam.id = "TRRSD07103";
  115. oParam.service = "reqapp.ReqMngt";
  116. oParam.method = "reqGetSearchGoodTree2";
  117. oParam.inds = "req=ds_send_SearchTree";
  118. oParam.outds = "ds_main_PrcpGoodTrees_TreeList=TreeList";
  119. oParam.async = false;
  120. oParam.callback = "cf_TRRSD07103";
  121. tranf_submit(oParam);
  122. if(arErrorCode.pop("TRRSD07103") > -1) {
  123. var nCnt1 = 0;
  124. var nCnt2 = 0;
  125. ds_main_PrcpGoodTrees_TreeList.enableevent = false;
  126. ds_main_PrcpGoodTrees_TreeList.updatecontrol = false;
  127. ds_main_PrcpGoodTrees_TreeList.filter("depth=='2'");
  128. nCnt1 = ds_main_PrcpGoodTrees_TreeList.rowcount;
  129. ds_main_PrcpGoodTrees_TreeList.filter("depth=='1'");
  130. nCnt2 = ds_main_PrcpGoodTrees_TreeList.rowcount;
  131. ds_main_PrcpGoodTrees_TreeList.filter("");
  132. ds_main_PrcpGoodTrees_TreeList.updatecontrol = true;
  133. ds_main_PrcpGoodTrees_TreeList.enableevent = true;
  134. ds_main_PrcpGoodTrees_TreeList.rowposition = -1;
  135. if( group5.grp_detail.rdo_viewcls.value == "0" ){
  136. ds_main_PrcpGoodTrees_TreeList.rowposition = 0;//ds_main_PrcpGoodTrees_TreeList.findRow("depth", "2");
  137. //trv_setcode.value = instance1.selectSingleNode("/root/main/PrcpGoodTrees/TreeList[depth='2']/pcode").value;
  138. // 트러스트폼 트리뷰 focusIndex 값 오류로 전역변수에 인덱스 저장
  139. trv_setcode_index = 1;
  140. group5_grp_detail_trv_setcode_oncellclick();
  141. }else if( group5.grp_detail.rdo_viewcls.value != "0" ){
  142. ds_main_PrcpGoodTrees_TreeList.rowposition = ds_main_PrcpGoodTrees_TreeList.findRow("depth", "1");
  143. //trv_setcode.value = instance1.selectSingleNode("/root/main/PrcpGoodTrees/TreeList[depth='1']/pcode").value;
  144. // 트러스트폼 트리뷰 focusIndex 값 오류로 전역변수에 인덱스 저장
  145. trv_setcode_index = 0;
  146. group5_grp_detail_trv_setcode_oncellclick();
  147. }
  148. }
  149. }
  150. function cf_TRRSD07103(sSvcId, nErrorCode, sErrorMsg) {
  151. arErrorCode.push(sSvcId, nErrorCode);
  152. }
  153. /****************************************************************************************
  154. * Argument : N/A
  155. * Description : 처방전달물품내역조회
  156. ****************************************************************************************/
  157. function fDataSearchDetail(pIdx)
  158. {
  159. var rPath = "ds_send_SearchTree";
  160. var dPath = "ds_send_prcppatcaseinfo";
  161. var tPath = "ds_main_PrcpGoodTrees_TreeList";
  162. var vCaption = " 처방전달물품";
  163. if(pIdx == -1) pIdx = trv_setcode_index;
  164. else trv_setcode_index = pIdx;
  165. var Idx = pIdx;
  166. var sDepth = eval(tPath).getColumn(Idx, "depth" );
  167. var vCodeCd = eval(tPath).getColumn(Idx, "codecd" );
  168. var vCodeNm = eval(tPath).getColumn(Idx, "codenm" );
  169. var vBaseCd = eval(tPath).getColumn(Idx, "basecode");
  170. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  171. // var Tree2 = trv_setcode.item(pIdx); //어떻게 사용하는지 보고 맞게 수정
  172. var Tree2PDI = eval(tPath).findRowExpr("depth > '"+pIdx+"'",2);
  173. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  174. var ioflag = group5.grp_key.rdo_ioflag.value;
  175. misfGridInit(group5.switch1.cse_prcppatcase.grd_prcppatcaselist);
  176. misfGridInit(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist);
  177. misfGridInit(group5.switch1.cse_deptstoc.grd_deptstoc);
  178. if (vCodeCd == "") return;
  179. eval(dPath).setColumn(0, "instcd" , eval(rPath).getColumn(0, "instcd" )); // 01 기관코드
  180. eval(dPath).setColumn(0, "acptdd" , eval(rPath).getColumn(0, "acptdd" )); // 02 처방일자
  181. eval(dPath).setColumn(0, "sumflag" , eval(rPath).getColumn(0, "sumflag" )); // 04 집계여부
  182. eval(dPath).setColumn(0, "reqflag" , eval(rPath).getColumn(0, "reqflag" )); // 05 청구구분
  183. eval(dPath).setColumn(0, "reqdeptcd" , "" ); // 06 처방부서
  184. eval(dPath).setColumn(0, "reqprid" , eval(rPath).getColumn(0, "reqprid" )); // 07 청구주기
  185. eval(dPath).setColumn(0, "prcpdeptcd" , "" ); // 08 시행부서
  186. eval(dPath).setColumn(0, "goodcd" , eval(rPath).getColumn(0, "goodcd" )); // 09 물품코드
  187. eval(dPath).setColumn(0, "ioflag" , eval(rPath).getColumn(0, "ioflag" )); // 10 입외구분
  188. eval(dPath).setColumn(0, "deptgr" , "" ); // 11 부서그룹
  189. eval(dPath).setColumn(0, "pid" , eval(rPath).getColumn(0, "pid" )); // 12 환자번호
  190. eval(dPath).setColumn(0, "patnm" , eval(rPath).getColumn(0, "patnm" )); // 13 환자명
  191. eval(dPath).setColumn(0, "purcflag" , eval(rPath).getColumn(0, "purcflag" )); // 14 구매구분
  192. eval(dPath).setColumn(0, "prodcmpynm" , eval(rPath).getColumn(0, "prodcmpynm" )); // 15 제조회사명
  193. eval(dPath).setColumn(0, "suplplcecdnm", eval(rPath).getColumn(0, "suplplcecdnm" )); // 16 주거래처명
  194. eval(dPath).setColumn(0, "suppcustnm" , eval(rPath).getColumn(0, "suppcustnm" )); // 17 보조거래처명
  195. eval(dPath).setColumn(0, "prntmthd" , eval(rPath).getColumn(0, "prntmthd" )); // 18 출력형식
  196. eval(dPath).setColumn(0, "sumcnt" , eval(rPath).getColumn(0, "sumcnt" )); // 19 집계횟수
  197. eval(dPath).setColumn(0, "scrnid" , eval(rPath).getColumn(0, "scrnid" )); // 20 화면ID
  198. eval(dPath).setColumn(0, "erprcpflag" , eval(rPath).getColumn(0, "erprcpflag" )); // 21 응급여부
  199. eval(dPath).setColumn(0, "prcpinptflag", eval(rPath).getColumn(0, "prcpinptflag" )); // 22 처방입력구분
  200. // 선불출 조회조건 추가 이창록
  201. dsf_makeValue(eval(dPath), "querycls", "string", ds_send_SearchTree.getColumn(0,"querycls")); // 19 라디오박스 선불출코드
  202. // 물류창고 조회조건 추가
  203. eval(dPath).setColumn(0, "wareflag", eval(rPath).getColumn(0, "wareflag" )); // 창고구분(물류창고)
  204. if(frmf_getScreenID() == "SMRSD07100"){ // 처방집계 출력화면일 경우
  205. eval(dPath).setColumn(0, "wareflagarr" , eval(rPath).getColumn(0, "wareflagarr" )); // 창고구분배열 조건
  206. eval(dPath).setColumn(0, "acntcd" , eval(rPath).getColumn(0, "acntcd" )); // 계정과목
  207. eval(dPath).setColumn(0, "acpttodd" , eval(rPath).getColumn(0, "acpttodd" )); // 집계종료일자
  208. eval(dPath).setColumn(0, "querycls" , eval(rPath).getColumn(0, "querycls" )); // 부서조회여부
  209. }
  210. var vCls = parseInt(group5.grp_detail.rdo_viewcls.value+sDepth);
  211. switch(vCls) {
  212. case 01 :
  213. vCaption = " :: 전체" ;
  214. break;
  215. case 02 :
  216. eval(dPath).setColumn(0, "prcpdeptcd" , vCodeCd );
  217. vCaption = "시행부서 : "+vCodeCd + " - " + vCodeNm;
  218. break;
  219. case 11 :
  220. eval(dPath).setColumn(0, "reqdeptcd" , vCodeCd);
  221. vCaption = "처방부서 : "+ vCodeCd + " - " + vCodeNm;
  222. break;
  223. case 12 :
  224. eval(dPath).setColumn(0, "prcpdeptcd" , vCodeCd );
  225. vCode = eval(tPath).getColumn(Tree2PDI,"codecd" ); //체크
  226. vName = eval(tPath).getColumn(Tree2PDI,"codenm" ); //체크
  227. eval(dPath).setColumn(0, "reqdeptcd" , vCode );
  228. vCaption = "처방부서 : "+vCode + " - " + vName + " >> 시행부서 : "+vCodeCd+ " - "+vCodeNm;
  229. break;
  230. case 21 :
  231. eval(dPath).setColumn(0, "prcpdeptcd" , vCodeCd );
  232. vCaption = "시행부서 : "+vCodeCd + " - " + vCodeNm;
  233. break;
  234. case 22 :
  235. eval(dPath).setColumn(0, "reqdeptcd" , vCodeCd);
  236. vCode = eval(tPath).getColumn(Tree2PDI,"codecd" ); //체크
  237. vName = eval(tPath).getColumn(Tree2PDI,"codenm" ); //체크
  238. eval(dPath).setColumn(0, "prcpdeptcd" , vCode );
  239. vCaption = "시행부서 : "+vCode + " - " + vName + " >> 처방부서 : "+vCodeCd+ " - "+vCodeNm ;
  240. break;
  241. case 31 :
  242. eval(dPath).setColumn(0, "prcpdeptcd" , vCodeCd );
  243. vCaption = "시행부서 : "+vCodeCd + " - " + vCodeNm;
  244. break;
  245. case 32 :
  246. eval(dPath).setColumn(0, "goodcd" , vCodeCd);
  247. vCode = eval(tPath).getColumn(Tree2PDI,"codecd" ); //체크
  248. vName = eval(tPath).getColumn(Tree2PDI,"codenm" ); //체크
  249. eval(dPath).setColumn(0, "prcpdeptcd" , vCode );
  250. vCaption = "시행부서 : "+vCode + " - " + vName + " >> 물품코드 : "+vCodeCd+ " - "+vCodeNm ;
  251. }
  252. group5.switch1.cse_prcpgoodcase.cap_prcpgoodcasetitle.tooltiptext = "";
  253. if (eval(dPath).getColumn(0,"prntmthd") == "P") {
  254. //환자별 집계내역
  255. var oParam = {};
  256. oParam.id = "TRRSD07101";
  257. oParam.service = "reqapp.ReqMngt";
  258. oParam.method = "reqGetPrcpPatCaseList";
  259. oParam.inds = "req="+dPath;
  260. oParam.outds = "ds_main_list_prcppatcase_prcppatcaselist=prcppatcaselist";
  261. oParam.async = false;
  262. oParam.callback = "cf_TRRSD07101";
  263. tranf_submit(oParam);
  264. grp_tabbtn.btn_prcpgoodcase.visible = false;
  265. grp_tabbtn.btn_prcppatcase.visible = true;
  266. if( grp_tabbtn.btn_prcppatcase.getSelectStatus() == true ){
  267. grp_tabbtn.btn_prcppatcase.click();
  268. }
  269. }else{
  270. //물품별 집계내역
  271. var oParam = {};
  272. oParam.id = "TRRSD07102";
  273. oParam.service = "reqapp.ReqMngt";
  274. oParam.method = "reqGetPrcpGoodCaseList";
  275. oParam.inds = "req="+dPath;
  276. oParam.outds = "ds_main_list_prcpgoodcase_prcpgoodcaselist=prcpgoodcaselist ds_main_list_prcpgoodcase_deptstoccaselist=deptstoccaselist ds_main_list_prcpgoodcase_prcpsuminfo=prcpsuminfo";
  277. oParam.async = false;
  278. oParam.callback = "cf_TRRSD07102";
  279. tranf_submit(oParam);
  280. grp_tabbtn.btn_prcppatcase.visible = false;
  281. grp_tabbtn.btn_prcpgoodcase.visible = true;
  282. if( grp_tabbtn.btn_prcpgoodcase.getSelectStatus() == true ){
  283. grp_tabbtn.btn_prcpgoodcase.click();
  284. }
  285. var tooltip = "";
  286. tooltip = ds_main_list_prcpgoodcase_prcpsuminfo.getColumn(0,"sumcmt");
  287. group5.switch1.cse_prcpgoodcase.cap_prcpgoodcasetitle.tooltiptext = tooltip;
  288. }
  289. fGrdiDataValid();
  290. if(ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0,"prnyn") == "N") {
  291. group5.switch1.cse_deptstoc.btn_enddelive.enable = true;
  292. } else {
  293. group5.switch1.cse_deptstoc.btn_enddelive.enable = false;
  294. }
  295. var chkSave = ds_main_list_prcpgoodcase_deptstoccaselist.lookup("edityn","Y","edityn");
  296. if(!utlf_isNull(chkSave)) {
  297. group5.switch1.cse_deptstoc.btn_save.enable = true;
  298. } else {
  299. group5.switch1.cse_deptstoc.btn_save.enable = false;
  300. }
  301. var deptcd = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0,"prcpdeptcd");
  302. var others = ds_main_list_prcpgoodcase_deptstoccaselist.getCaseCount("prcpdeptcd != '" + deptcd + "'");
  303. var sameDeptcd = false;
  304. var flag1 = true;
  305. var flag2 = true;
  306. if(!utlf_isNull(deptcd) && others == 0) sameDeptcd = true;
  307. if(sameDeptcd) {
  308. var deliveCnt1 = ds_main_list_prcpgoodcase_deptstoccaselist.getCaseCount("deliveendflag=='N'");
  309. var deliveCnt2 = ds_main_list_prcpgoodcase_deptstoccaselist.getCaseCount("deliveendflag=='Y' && execyn!='Y'");
  310. if(deliveCnt1 > 0) flag1 = false;
  311. if(deliveCnt2 > 0) flag2 = false;
  312. }
  313. group5.switch1.cse_deptstoc.btn_enddelivedept.enable = !flag1;
  314. group5.switch1.cse_deptstoc.btn_canceldelivedept.enable = !flag2;
  315. }
  316. function cf_TRRSD07101(sSvcId, nErrorCode, sErrorMsg) {
  317. if(nErrorCode < 0) return;
  318. ds_main_list_prcppatcase_prcppatcaselist.addColumn("allsizeyn","string");
  319. ds_main_list_prcppatcase_prcppatcaselist.addColumn("sumflag","string");
  320. }
  321. function cf_TRRSD07102(sSvcId, nErrorCode, sErrorMsg) {
  322. if(nErrorCode < 0) return;
  323. ds_main_list_prcpgoodcase_prcpgoodcaselist.addColumn("bfdelivecnfmqty","string");
  324. ds_main_list_prcpgoodcase_prcpgoodcaselist.updatecontrol = false;
  325. for(var i = 0 ; i < ds_main_list_prcpgoodcase_prcpgoodcaselist.rowcount ; i++) {
  326. ds_main_list_prcpgoodcase_prcpgoodcaselist.setColumn(i,"bfdelivecnfmqty",ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i,"delivecnfmqty"));
  327. }
  328. ds_main_list_prcpgoodcase_prcpgoodcaselist.updatecontrol = true;
  329. }
  330. // 처방전달물품내역
  331. function fDataPartToggle(pCls) {
  332. // if (pCls =="0") { // Key 조회
  333. // // 메인 Grup
  334. // grp_main.attribute("left" ) = "350px";
  335. // // grp_main.attribute("top" ) = "8px" ;
  336. // grp_main.attribute("width" ) = "835px";
  337. // // grp_main.attribute("height" ) = "747px";
  338. //
  339. // btn_excel2.attribute("left" ) = "778px";
  340. // lin_main.attribute("x2" ) = "835px";
  341. // grd_prcppatcaselist.attribute("width") = "835px";
  342. //
  343. // if (vProgramCls == "SMRSD02203") {
  344. // btn_save.attribute("left" ) = "715px";
  345. // }
  346. // } else { //
  347. // // 메인 Grup
  348. // grp_main.attribute("left" ) = "0px" ;
  349. // //grp_main.attribute("top" ) = "8px" ;
  350. // grp_main.attribute("width" ) = "1192px";
  351. // //grp_main.attribute("height" ) = "747px" ;
  352. //
  353. // btn_excel2.attribute("left" ) = "1135px";
  354. // lin_main.attribute("x2" ) = "1192px";
  355. // grd_prcppatcaselist.attribute("width") = "1192px";
  356. //
  357. // if (vProgramCls == "SMRSD02203") {
  358. // btn_save.attribute("left" ) = "1072px";
  359. // }
  360. // }
  361. //
  362. // grp_main.refresh();
  363. }
  364. // 조회 결과 Count Setting
  365. function fAfterRetrieve() {
  366. // // case 1 count
  367. // model.setValue(opt_goodreqcnt.attribute("ref"),(grd_goodreq.rows-grd_goodreq.fixedRows));
  368. //
  369. // // case 2 count
  370. // // model.setValue(opt_searchgoodcnt.attribute("ref"),(grd_prcppatcaselist.rows-grd_prcppatcaselist.fixedRows));
  371. // model.refresh();
  372. }
  373. /****************************************************************************************
  374. * Argument : N/A
  375. * Description : Grid의 데이터를 확인하여 오류 데이터시 색상 변경
  376. * : 물품Master의 All size && 집계 여부시 색상변경
  377. ****************************************************************************************/
  378. function fGrdiDataValid() {
  379. var deptstocList = group5.switch1.cse_deptstoc.grd_deptstoc.binddataset;
  380. group5.switch1.cse_deptstoc.grd_deptstoc.setCellProperty("body",2,"background","pink");
  381. group5.switch1.cse_deptstoc.grd_deptstoc.setCellProperty("body",2,"background2","pink");
  382. if(!utlf_isNull(deptstocList) && eval(deptstocList).rowcount > 0) {
  383. ds_main_list_prcpgoodcase_deptstoccaselist.updatecontrol = false;
  384. for(var i = 0 ; i < eval(deptstocList).rowcount ; i++) {
  385. if(eval(deptstocList).getColumn(i,"edityn") == "N") {
  386. misfSetReadOnlyCol(group5.switch1.cse_deptstoc.grd_deptstoc, "appyn", true, i);
  387. ds_main_list_prcpgoodcase_deptstoccaselist.updatecontrol = false;
  388. if(eval(deptstocList).getColumn(i,"appyn") == "Y") {
  389. dsf_makeValue(eval(deptstocList),"deliveyn","string","√",i);
  390. misfSetGridColor(group5.switch1.cse_deptstoc.grd_deptstoc, "deliveyn", "green", "B", i);
  391. ds_main_list_prcpgoodcase_deptstoccaselist.updatecontrol = false;
  392. }else{
  393. misfSetGridColor(group5.switch1.cse_deptstoc.grd_deptstoc, "deliveyn", "pink", "B", i);
  394. ds_main_list_prcpgoodcase_deptstoccaselist.updatecontrol = false;
  395. }
  396. }else{
  397. misfSetReadOnlyCol(group5.switch1.cse_deptstoc.grd_deptstoc, "appyn", false, i);
  398. ds_main_list_prcpgoodcase_deptstoccaselist.updatecontrol = false;
  399. }
  400. }
  401. ds_main_list_prcpgoodcase_deptstoccaselist.updatecontrol = true;
  402. }
  403. var delivecnfmqtyCol = group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist.getBindCellIndex("body","delivecnfmqty");
  404. var deptAuth = fCheckDeptAuth(sysf_getUserInfo("dutplcecd"), sysf_getUserInfo("dutplceinstcd"));
  405. group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist.setCellProperty("body",delivecnfmqtyCol,"tooltiptext","expr:utlf_isNull(cmt2) ? '' : 'bind:cmt2'");
  406. for(var i = 0 ; i < ds_main_list_prcpgoodcase_prcpgoodcaselist.rowcount ; i++) {
  407. var comment = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "cmt2");
  408. var edityn = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "edityn");
  409. var cmt_view = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "cmt_view");
  410. var safestocqty = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "safestocqty");
  411. var totqty = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "totqty");
  412. var delivecnfmqty = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "delivecnfmqty");
  413. var deliveqty = ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i, "deliveqty");
  414. var equalFlag = (parseInt(deliveqty) == parseInt(delivecnfmqty));
  415. if(!utlf_isNull(comment)) {
  416. if(!equalFlag) {
  417. misfSetGridColor(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "delivecnfmqty", "blue", "B", i);
  418. }
  419. // grd_prcpgoodcaselist.tooltipText(i, delivecnfmqtyCol) = comment;
  420. } else {
  421. // grd_prcpgoodcaselist.tooltipText(i, delivecnfmqtyCol) = "";
  422. }
  423. // 부서 불출마감이 입력 되거나 부서재고가 입고 처리 된 경우 수정불가 처리(edityn)
  424. // 내시경검사실의 사용부서가 물류파트 인 일부 물품은 불출확정수량 수정불가 처리(cmt_view)
  425. if(deptAuth && (edityn == "N" || cmt_view == "N")) {
  426. misfSetReadOnlyCol(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "delivecnfmqty", false, i);
  427. } else {
  428. misfSetReadOnlyCol(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "delivecnfmqty", true, i);
  429. }
  430. // 안전재고 수량이 비어 있는 경우 붉은 글씨로 표시
  431. if(equalFlag && utlf_isNull(safestocqty)) {
  432. misfSetGridColor(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "delivecnfmqty", "red", "C", i);
  433. }
  434. // 처방집계수량이 안전재고 수량보다 많을 경우 붉은 글씨로 표시
  435. if(!isNaN(safestocqty) && parseInt(safestocqty) < parseInt(delivecnfmqty)) {
  436. misfSetGridColor(group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist, "delivecnfmqty", "red", "C", i);
  437. }
  438. }
  439. if (ds_main_list_prcppatcase_prcppatcaselist.rowcount <= 0 ) return;
  440. for(var cnt = 0 ; cnt < ds_main_list_prcppatcase_prcppatcaselist.rowcount ; cnt++) {
  441. // All SIze 물품이면서 Size 지정이 되지 않고 내려온 처방
  442. if (ds_main_list_prcppatcase_prcppatcaselist.getColumn( cnt, "allsizeyn" ) == "Y" &&
  443. ds_main_list_prcppatcase_prcppatcaselist.getColumn( cnt, "allsizespecid") == "-" ) {
  444. // grd_prcppatcaselist.cellstyle("background-color", cnt, grd_prcppatcaselist.colRef("rgstdd"), cnt, grd_prcppatcaselist.colRef("totqty")) = "yellow";
  445. // grd_prcppatcaselist.cellstyle("color" , cnt, grd_prcppatcaselist.colRef("rgstdd"), cnt, grd_prcppatcaselist.colRef("totqty")) = "red";
  446. misfSetGridColor(group5.switch1.cse_prcppatcase.grd_prcppatcaselist, "totqty", "yellow", "B", cnt);
  447. misfSetGridColor(group5.switch1.cse_prcppatcase.grd_prcppatcaselist, "totqty", "red", "C", cnt);
  448. // grd_prcppatcaselist.valueMatrix( cnt, grd_prcppatcaselist.colRef("goodspec") ) = "All Size 미지정";
  449. }
  450. // 처방 집계 여부
  451. if (ds_main_list_prcppatcase_prcppatcaselist.getColumn( cnt, "sumflag")=="Y" ) {
  452. misfSetGridColor(group5.switch1.cse_prcppatcase.grd_prcppatcaselist, "sumflagnm", "green", "B", cnt);
  453. } else {
  454. misfSetGridColor(group5.switch1.cse_prcppatcase.grd_prcppatcaselist, "sumflagnm", "pink", "B", cnt);
  455. }
  456. if (ds_main_list_prcppatcase_prcppatcaselist.getColumn(cnt, "allsizeyn") == "Y" ) {
  457. misfSetGridColor(group5.switch1.cse_prcppatcase.grd_prcppatcaselist, "patnm", "#FFFF00", "B", cnt);
  458. }
  459. }
  460. }
  461. /***********************************************************
  462. * 물품 처방 집계에서 사용한 Script
  463. ************************************************************/
  464. // 부서코드 읽어오기...
  465. function fDeptValidationCheck(pData1, pData2, pCodeName) {
  466. // if (pData1.value.length == 0) {
  467. // pData2.value = "";
  468. // } else {
  469. // rszfValidationCheck("TRRPZ00201", "deptcodelist", "refcond,deptnm","deptnm," + pData1.value,"", pCodeName, pData1, "SPRPZ00200", "","");
  470. // }
  471. //
  472. // model.refresh();
  473. }
  474. /****************************************************************************************
  475. * Argument : N/A
  476. * Description : 부서재고 집계저장
  477. ****************************************************************************************/
  478. function fSaveDeptStocList() {
  479. var dsUpdate = grdf_getGridUpdateData(group5.switch1.cse_deptstoc.grd_deptstoc, "all");
  480. grdf_setStatusColumn(dsUpdate, "status");
  481. if(dsUpdate.rowcount == 0){
  482. sysf_messageBox("저장할 데이타가 ","E014");
  483. return false;
  484. }
  485. dsf_createDs("ds_send_save_deptstoclist");
  486. ds_send_save_deptstoclist.copyData(dsUpdate, true);
  487. var oParam = {};
  488. oParam.id = "TXRSD07101";
  489. oParam.service = "reqapp.ReqMngt";
  490. oParam.method = "reqSaveDeptStocAppn";
  491. oParam.inds = "req=ds_send_save_deptstoclist";
  492. oParam.outds = "";
  493. oParam.async = false;
  494. oParam.callback = "cf_TXRSD07101";
  495. tranf_submit(oParam);
  496. if (arErrorCode.pop("TXRSD07101") > -1){
  497. sysf_messageBox("저장이","I002");
  498. fDataSearchDetail(group5.grp_detail.trv_setcode.currentrow);
  499. } else {
  500. sysf_messageBox("저장","E009");
  501. return;
  502. }
  503. }
  504. function cf_TXRSD07101(sSvcId, nErrorCode, sErrorMsg) {
  505. arErrorCode.push(sSvcId, nErrorCode);
  506. }
  507. /****************************************************************************************
  508. * Argument : deptcd - 부서
  509. * Description : 출고마감 저장
  510. ****************************************************************************************/
  511. function fSaveDeptStocEnd(deptcd) {
  512. var dsUpdate = grdf_getGridUpdateData(group5.switch1.cse_deptstoc.grd_deptstoc, "all");
  513. if(dsUpdate.rowcount > 0) {
  514. sysf_messageBox("변경사항이 저장 되지 않았습니다.","E");
  515. return;
  516. }
  517. if(ds_main_list_prcpgoodcase_deptstoccaselist.rowcount > 0) {
  518. var instcd = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0, "instcd");
  519. var acptdd = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0, "acptdd");
  520. var sumcnt = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0, "sumcnt");
  521. dsf_createDsRow("ds_send_save_delivestocend", [
  522. {col:"instcd", type:"STRING", size:256, val:instcd}
  523. , {col:"acptdd", type:"STRING", size:256, val:acptdd}
  524. , {col:"sumcnt", type:"STRING", size:256, val:sumcnt}
  525. , {col:"deptcd", type:"STRING", size:256, val:deptcd}
  526. ]);
  527. var oParam = {};
  528. oParam.id = "TXRSD07102";
  529. oParam.service = "reqapp.ReqMngt";
  530. oParam.method = "reqSaveDeptStocEnd";
  531. oParam.inds = "req=ds_send_save_delivestocend";
  532. oParam.outds = "";
  533. oParam.async = false;
  534. oParam.callback = "cf_TXRSD07102";
  535. tranf_submit(oParam);
  536. if (arErrorCode.pop("TXRSD07102") > -1){
  537. sysf_messageBox("저장이","I002");
  538. fDataSearchDetail(group5.grp_detail.trv_setcode.currentrow);
  539. } else {
  540. sysf_messageBox("저장","E009");
  541. return;
  542. }
  543. }
  544. }
  545. function cf_TXRSD07102(sSvcId, nErrorCode, sErrorMsg) {
  546. arErrorCode.push(sSvcId, nErrorCode);
  547. }
  548. /****************************************************************************************
  549. * Argument : deptcd - 부서코드
  550. * Description : 출고마감 취소
  551. ****************************************************************************************/
  552. function fSaveDeptStocEndCancel(deptcd) {
  553. if(ds_main_list_prcpgoodcase_deptstoccaselist.rowcount > 0) {
  554. var instcd = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0,"instcd");
  555. var acptdd = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0,"acptdd");
  556. var sumcnt = ds_main_list_prcpgoodcase_deptstoccaselist.getColumn(0,"sumcnt");
  557. dsf_createDsRow("ds_send_save_delivestocend", [
  558. {col:"instcd", type:"STRING", size:256, val:instcd}
  559. , {col:"acptdd", type:"STRING", size:256, val:acptdd}
  560. , {col:"sumcnt", type:"STRING", size:256, val:sumcnt}
  561. , {col:"deptcd", type:"STRING", size:256, val:deptcd}
  562. ]);
  563. var oParam = {};
  564. oParam.id = "TXRSD07103";
  565. oParam.service = "reqapp.ReqMngt";
  566. oParam.method = "reqSaveDeptStocEndCancel";
  567. oParam.inds = "req=ds_send_save_delivestocend";
  568. oParam.outds = "";
  569. oParam.async = false;
  570. oParam.callback = "cf_TXRSD07103";
  571. tranf_submit(oParam);
  572. if (arErrorCode.pop("TXRSD07103") > -1){
  573. sysf_messageBox("저장이","I002");
  574. fDataSearchDetail(group5.grp_detail.trv_setcode.currentrow);
  575. } else {
  576. sysf_messageBox("저장","E009");
  577. return;
  578. }
  579. }
  580. }
  581. function cf_TXRSD07103(sSvcId, nErrorCode, sErrorMsg) {
  582. arErrorCode.push(sSvcId, nErrorCode);
  583. }
  584. /******************************************************************
  585. * Argument : N/A
  586. * Description : (칠곡) 불출확정수량 저장
  587. ******************************************************************/
  588. function fSaveDeliveCnfmQtyList() {
  589. var tarGrid = group5.switch1.cse_prcpgoodcase.grd_prcpgoodcaselist;
  590. for(var i = 0; i < ds_main_list_prcpgoodcase_prcpgoodcaselist.rowcount ; i++) {
  591. var bfdelivecnfmqty = parseFloat(ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i,"bfdelivecnfmqty"));
  592. var delivecnfmqty = parseFloat(ds_main_list_prcpgoodcase_prcpgoodcaselist.getColumn(i,"delivecnfmqty"));
  593. if(bfdelivecnfmqty != delivecnfmqty) {
  594. grdf_setStatus(tarGrid, "U", [i]);
  595. } else {
  596. grdf_setStatus(tarGrid, "", [i]);
  597. }
  598. }
  599. var dsUpdate = grdf_getGridUpdateData(tarGrid, "all");
  600. if(dsUpdate.rowcount == 0){
  601. sysf_messageBox("저장할 데이타가 ","E014");
  602. return false;
  603. }
  604. grdf_setStatusColumn(dsUpdate, "status");
  605. dsf_createDs("ds_send_save_delivecnfmqtylist");
  606. ds_send_save_delivecnfmqtylist.copyData(dsUpdate,true);
  607. var oParam = {};
  608. oParam.id = "TXRSD07104";
  609. oParam.service = "reqapp.ReqMngt";
  610. oParam.method = "reqSaveDeliveCnfmQtyList";
  611. oParam.inds = "req=ds_send_save_delivecnfmqtylist";
  612. oParam.outds = "";
  613. oParam.async = false;
  614. oParam.callback = "cf_TXRSD07104";
  615. tranf_submit(oParam);
  616. if(arErrorCode.pop("TXRSD07104") > -1) {
  617. sysf_messageBox("저장이","I002");
  618. fDataSearchDetail(group5.grp_detail.trv_setcode.currentrow);
  619. } else {
  620. sysf_messageBox("저장","E009");
  621. return;
  622. }
  623. }
  624. function cf_TXRSD07104(sSvcId, nErrorCode, sErrorMsg) {
  625. arErrorCode.push(sSvcId, nErrorCode);
  626. }
  627. /****************************************************************************************
  628. * Argument : pDeptcd - 부서코드
  629. * : pInstcd - 기관코드
  630. * Description : 부서권한 확인
  631. ****************************************************************************************/
  632. function fCheckDeptAuth(pDeptcd, pInstcd) {
  633. if( (pInstcd == "031" && pDeptcd == "3080000000") // 본원 진료재료파트
  634. || (pInstcd == "031" && pDeptcd == "4020334000") // 본원 물류파트
  635. || (pInstcd == "032" && pDeptcd == "4020334000") // 칠곡 물류파트
  636. || (pInstcd == "032" && pDeptcd == "3360000000")) { // 칠곡 중앙공급실
  637. return true;
  638. } else {
  639. return false;
  640. }
  641. }
  642. /* ------------------------------------------------- */
  643. /* ------End Of List ------------------------------- */
  644. /* -------------------------------------------------- */
  645. ]]></Script>