SMMNP04800.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /* ---------------------------------------------------------------------
  2. 분할_재사용품_구매전송(SMMNP04800.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. : Create By 김진명
  6. : 2007.09.27
  7. ---------------------------------------------------------------------- */
  8. /* --------------------------------------------------*/
  9. /* type : function */
  10. /* access : public */
  11. /* desc : 분할_재사용품_구매전송 초기화 */
  12. /* param : */
  13. /* return : */
  14. /* --------------------------------------------------*/
  15. function fInit() {
  16. var curtDate = getCurrentDate();
  17. curtDate = curtDate.substr(0, 8);
  18. model.setValue("/root/main/cond/refopfromdd", getDateAddc(getCurrentDate(), -7));
  19. model.setValue("/root/main/cond/refoptodd", curtDate);
  20. submit("TRMNP03004") // 수술실(Rosette) 가져오기
  21. addComboItem("cmb_rosette","전체","","above");
  22. model.removenode("/root/send");
  23. model.makeNode("/root/send");
  24. model.makeValue("/root/send/reqdata/opcnfmdd" ,model.getValue("/root/main/cond/refopfromdd") );
  25. model.makeValue("/root/send/reqdata/rosette" ,model.getValue("/root/main/cond/oprosette"));
  26. submit("TRMNP03002"); // 수술실코드 가져오기
  27. addComboItem("cmb_oproomlist","전체","","above");
  28. //submit("TRMNP04603", false);
  29. //addComboItem("cmb_oproomlist", "전 체", "ALL", "above" );
  30. grd_reqgoodlist.fixedcellcheckbox(0,15) = true;
  31. btn_cncl.visible = false;
  32. btn_send.visible = true;
  33. grd_reqgoodlist.explorerbar = "sort";
  34. grd_reqgoodlist.colHidden(grd_reqgoodlist.colRef("senddd")) = true;//전송일자
  35. grd_reqgoodlist.colHidden(grd_reqgoodlist.colRef("sendyn")) = true;//전송여부
  36. grd_reqgoodlist.colWidth(grd_reqgoodlist.colRef("goodnm")) = "250";//물품명
  37. grd_reqgoodlist.colWidth(grd_reqgoodlist.colRef("goodspec")) = "105";//규격
  38. grd_reqgoodlist.colWidth(grd_reqgoodlist.colRef("goodmodel")) = "95"; //모델
  39. grd_reqgoodlist.colWidth(grd_reqgoodlist.colRef("prodcmpynm")) = "95"; //제조원
  40. model.removenode("/root/main/reqgoodlist");
  41. model.refresh();
  42. //fSearch();
  43. }
  44. /* --------------------------------------------------*/
  45. /* type : function */
  46. /* access : public */
  47. /* desc : 콤보아이템 제거 */
  48. /* param : */
  49. /* return : */
  50. /* --------------------------------------------------*/
  51. function removeComboItem( comboID ) {
  52. var comboObj = document.all.item(comboID);
  53. var comboItemNodeSet = comboObj.choices.itemset.attribute("nodeset");
  54. model.removenode(comboItemNodeSet + "[1]");//CCR
  55. model.removenode(comboItemNodeSet + "[1]");//C-C(Clean-Zone)
  56. model.removenode(comboItemNodeSet + "[1]");//C-O(OR창고)
  57. model.refresh();
  58. }
  59. /* --------------------------------------------------*/
  60. /* type : function */
  61. /* access : public */
  62. /* desc : 분할_재사용품_구매전송 조회 */
  63. /* param : */
  64. /* return : */
  65. /* --------------------------------------------------*/
  66. function fSearch() {
  67. model.removenode("/root/send");
  68. model.makeNode("/root/send/reqdata");
  69. model.copyNode("/root/send/reqdata", "/root/main/cond");
  70. submit("TRMNP04801");
  71. }
  72. /* --------------------------------------------------*/
  73. /* type : function */
  74. /* access : public */
  75. /* desc : 분할_재사용품_구매전송 저장(구매청구) */
  76. /* param : */
  77. /* return : */
  78. /* --------------------------------------------------*/
  79. function fSaveSend() {
  80. var iRows = -1;
  81. var chkflag, goodcd, allsizespecid, sendqty = 0, oprsrvno, deptcd, deliveunit, ddavguseqty = 0, basevol = 0, oproomcd, oldgoodcd, oldallsizespecid, totsendqty = 0;
  82. var oldoprsrvno, olddeliveunit, oldddavguseqty = 0, oldbasevol = 0, reqdeptcd, cartgubn, acmlbaseqty, studydeptcd;
  83. var cnt = 0, sendexchqty = 0;
  84. var rowCnt = 1, rowCnt2 = 1;
  85. iRows = grd_reqgoodlist.rows;
  86. var reqgoodlist = "m▦rownum▦goodcd▦allsizespecid▦sendqty▦oproomcd▦cartgubn▦sendexchqty";
  87. var sendgoodlist = "m▦rownum▦goodcd▦allsizespecid▦totsendqty▦deptcd▦ddavguseqty▦deliveunit▦basevol▦reqdeptcd▦studydeptcd";
  88. var iNode = "/root/main/reqgoodlist";
  89. for( var i = 1; i <= iRows; i++ ) {
  90. chkflag = model.getValue( iNode + "[" + i +"]/" + "chkflag" );
  91. goodcd = model.getValue( iNode + "[" + i +"]/" + "goodcd" );
  92. allsizespecid = model.getValue( iNode + "[" + i +"]/" + "allsizespecid" );
  93. sendqty = model.getValue( iNode + "[" + i +"]/" + "sendqty" );
  94. deptcd = model.getValue( iNode + "[" + i +"]/" + "deptcd" );
  95. deliveunit = model.getValue( iNode + "[" + i +"]/" + "deliveunit" );
  96. ddavguseqty = model.getValue( iNode + "[" + i +"]/" + "ddavguseqty" );
  97. basevol = model.getValue( iNode + "[" + i +"]/" + "basevol" );
  98. reqdeptcd = model.getValue( iNode + "[" + i +"]/" + "reqdeptcd" );
  99. acmlbaseqty = model.getValue( iNode + "[" + i +"]/" + "acmlbaseqty" );
  100. studydeptcd = model.getValue( iNode + "[" + i +"]/" + "studydeptcd" );
  101. oproomcd = model.getValue( "/root/main/cond/oproomcd");
  102. cartgubn = model.getValue( "/root/main/cond/refdeptflag");
  103. sendexchqty = ( parseInt(acmlbaseqty) * parseInt(sendqty) );
  104. //sendexchqty = parseInt(sendqty);
  105. if( chkflag == "true" ) {
  106. if( parseInt(sendqty) < 1 ) {
  107. messageBox("전송 수량을 입력하십시요!", "E000");
  108. return;
  109. }
  110. if( cnt == 0 ) {
  111. oldgoodcd = goodcd;
  112. oldallsizespecid = allsizespecid;
  113. }
  114. reqgoodlist = reqgoodlist + "▩" + "i" + "▦" + rowCnt + "▦" + goodcd + "▦" + allsizespecid
  115. + "▦" + sendqty + "▦" + oproomcd + "▦" + cartgubn + "▦" + sendexchqty;
  116. rowCnt += 1;
  117. cnt += 1;
  118. if( ( goodcd == oldgoodcd )&&( allsizespecid == oldallsizespecid ) ) {
  119. totsendqty = totsendqty + parseInt(sendqty);
  120. oldgoodcd = goodcd;
  121. oldallsizespecid = allsizespecid;
  122. olddeliveunit = deliveunit;
  123. oldddavguseqty = ddavguseqty;
  124. oldbasevol = basevol;
  125. }else {
  126. sendgoodlist = sendgoodlist + "▩" + "i" + "▦" + rowCnt2 + "▦" + oldgoodcd + "▦" + oldallsizespecid
  127. + "▦" + totsendqty + "▦" + deptcd + "▦" + ddavguseqty + "▦" + deliveunit
  128. + "▦" + basevol + "▦" + reqdeptcd + "▦" + studydeptcd;
  129. totsendqty = parseInt(sendqty);
  130. oldgoodcd = goodcd;
  131. oldallsizespecid = allsizespecid;
  132. rowCnt2 += 1;
  133. }
  134. }
  135. if( i == ( iRows - 1 ) ) {
  136. sendgoodlist = sendgoodlist + "▩" + "i" + "▦" + rowCnt2 + "▦" + oldgoodcd + "▦" + oldallsizespecid
  137. + "▦" + totsendqty + "▦" + deptcd + "▦" + oldddavguseqty + "▦" + olddeliveunit
  138. + "▦" + oldbasevol + "▦" + reqdeptcd + "▦" + studydeptcd;
  139. }
  140. }
  141. if( cnt > 0 ) {
  142. model.removenode("/root/send");
  143. model.makeNode("/root/send/reqdata");
  144. model.makeNode("/root/send/savedata");
  145. model.makeNode("/root/send/senddata");
  146. model.copyNode("/root/send/reqdata", "/root/main/cond");
  147. model.setValue("/root/send/savedata", reqgoodlist);
  148. model.setValue("/root/send/senddata", sendgoodlist);
  149. submit("TXMNP04801");
  150. }else {
  151. messageBox("선택한것이", "I004");
  152. }
  153. }
  154. /* --------------------------------------------------*/
  155. /* type : function */
  156. /* access : public */
  157. /* desc : 분할_재사용품_구매전송 취소(구매청구취소)*/
  158. /* param : */
  159. /* return : */
  160. /* --------------------------------------------------*/
  161. function fCnclSend() {
  162. var iRows = -1;
  163. var chkflag, goodcd, allsizespecid, sendqty = 0, oprsrvno, deptcd, deliveunit, ddavguseqty = 0, basevol = 0, oproomcd, oldgoodcd, oldallsizespecid, totsendqty = 0;
  164. var oldoprsrvno, olddeliveunit, oldddavguseqty = 0, oldbasevol = 0, reqdeptcd, cartgubn, acmlbaseqty, studydeptcd;
  165. var cnt = 0, sendexchqty = 0;
  166. var rowCnt = 1, rowCnt2 = 1;
  167. iRows = grd_reqgoodlist.rows;
  168. var reqgoodlist = "m▦rownum▦goodcd▦allsizespecid▦sendqty▦oproomcd▦cartgubn▦sendexchqty";
  169. var sendgoodlist = "m▦rownum▦goodcd▦allsizespecid▦totsendqty▦deptcd▦ddavguseqty▦deliveunit▦basevol▦reqdeptcd▦studydeptcd";
  170. var iNode = "/root/main/reqgoodlist";
  171. for( var i = 1; i <= iRows; i++ ) {
  172. chkflag = model.getValue( iNode + "[" + i +"]/" + "chkflag" );
  173. goodcd = model.getValue( iNode + "[" + i +"]/" + "goodcd" );
  174. allsizespecid = model.getValue( iNode + "[" + i +"]/" + "allsizespecid" );
  175. sendqty = model.getValue( iNode + "[" + i +"]/" + "sendqty" );
  176. deptcd = model.getValue( iNode + "[" + i +"]/" + "deptcd" );
  177. deliveunit = model.getValue( iNode + "[" + i +"]/" + "deliveunit" );
  178. ddavguseqty = model.getValue( iNode + "[" + i +"]/" + "ddavguseqty" );
  179. basevol = model.getValue( iNode + "[" + i +"]/" + "basevol" );
  180. reqdeptcd = model.getValue( iNode + "[" + i +"]/" + "reqdeptcd" );
  181. acmlbaseqty = model.getValue( iNode + "[" + i +"]/" + "acmlbaseqty" );
  182. studydeptcd = model.getValue( iNode + "[" + i +"]/" + "studydeptcd" );
  183. oproomcd = model.getValue( "/root/main/cond/oproomcd");
  184. cartgubn = model.getValue( "/root/main/cond/refdeptflag");
  185. sendexchqty = ( parseInt(acmlbaseqty) * parseInt(sendqty) );
  186. if( chkflag == "true" ) {
  187. if( cnt == 0 ) {
  188. oldgoodcd = goodcd;
  189. oldallsizespecid = allsizespecid;
  190. }
  191. reqgoodlist = reqgoodlist + "▩" + "u" + "▦" + rowCnt + "▦" + goodcd + "▦" + allsizespecid
  192. + "▦" + (-1*parseInt(sendqty)) + "▦" + oproomcd + "▦" + cartgubn + "▦" + sendexchqty;
  193. rowCnt += 1;
  194. cnt += 1;
  195. if( ( goodcd == oldgoodcd )&&( allsizespecid == oldallsizespecid ) ) {
  196. totsendqty = totsendqty + parseInt(sendqty);
  197. oldgoodcd = goodcd;
  198. oldallsizespecid = allsizespecid;
  199. olddeliveunit = deliveunit;
  200. oldddavguseqty = ddavguseqty;
  201. oldbasevol = basevol;
  202. }else {
  203. sendgoodlist = sendgoodlist + "▩" + "u" + "▦" + rowCnt2 + "▦" + oldgoodcd + "▦" + oldallsizespecid
  204. + "▦" + (-1*totsendqty)+ "▦" + deptcd + "▦" + ddavguseqty + "▦" + deliveunit
  205. + "▦" + basevol + "▦" + reqdeptcd + "▦" + studydeptcd;
  206. totsendqty = parseInt(sendqty);
  207. oldgoodcd = goodcd;
  208. oldallsizespecid = allsizespecid;
  209. rowCnt2 += 1;
  210. }
  211. }
  212. if( i == ( iRows - 1 ) ) {
  213. sendgoodlist = sendgoodlist + "▩" + "u" + "▦" + rowCnt2 + "▦" + oldgoodcd + "▦" + oldallsizespecid
  214. + "▦" + (-1*totsendqty)+ "▦" + deptcd + "▦" + oldddavguseqty + "▦" + olddeliveunit
  215. + "▦" + oldbasevol + "▦" + reqdeptcd + "▦" + studydeptcd;
  216. }
  217. }
  218. if( cnt > 0 ) {
  219. model.removenode("/root/send");
  220. model.makeNode("/root/send/reqdata");
  221. model.makeNode("/root/send/savedata");
  222. model.makeNode("/root/send/senddata");
  223. model.copyNode("/root/send/reqdata", "/root/main/cond");
  224. model.setValue("/root/send/savedata", reqgoodlist);
  225. model.setValue("/root/send/senddata", sendgoodlist);
  226. submit("TXMNP04801");
  227. }else {
  228. messageBox("선택한것이", "I004");
  229. }
  230. }