payment.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * admin/payment
  3. */
  4. var mcare_admin_payment = function(){
  5. //상속
  6. mcare_admin.call(this);
  7. var self = this;
  8. //변수설정
  9. var $grid = $("#grid"),
  10. $crudServiceBaseUrl = contextPath + "/admin/payment";
  11. /**
  12. * 초기화
  13. */
  14. this.init = function(){
  15. initGrid();
  16. addEvent();
  17. };
  18. /**
  19. * 이벤트 등록
  20. */
  21. var addEvent = function(){
  22. };
  23. /**
  24. * 데이터 소스 설정
  25. */
  26. var setDataSource = function(){
  27. var dataSource = new kendo.data.DataSource({
  28. transport: {
  29. read: {
  30. url: $crudServiceBaseUrl + "/getList.json",
  31. method: "post",
  32. dataType: "json",
  33. contentType: "application/json"
  34. },
  35. parameterMap: function( options, operation ){
  36. return self.util.stringifyJson( options );
  37. }
  38. },
  39. schema: {
  40. total : "totalCount",
  41. data : function(result){
  42. return result.data;
  43. },
  44. model: {
  45. id: "transValue",
  46. fields: {
  47. transValue: { type: "string", editable: false},
  48. hospitalValue: { type: "string", editable: false},
  49. msgType: { type: "string", editable: false},
  50. userId: { type: "string", editable: false},
  51. amountValue : { type:"number",editable:false},
  52. transDt : {type:"string",editable:false},
  53. exameDt : {type:"string",editable:false}
  54. }
  55. }
  56. },
  57. change: function(e) {
  58. // update chart
  59. },
  60. pageSize: 15,
  61. serverPaging : true
  62. });
  63. return dataSource;
  64. };
  65. var dataSource = setDataSource();
  66. /**
  67. * 그리드 초기화
  68. */
  69. var initGrid = function(){
  70. // 그리드 옵션
  71. var option = {
  72. dataSource: dataSource,
  73. pageable: true,
  74. resizable: true,
  75. sortable: true,
  76. selectable: true,
  77. editable: false,
  78. height : 520,
  79. columns : [
  80. { field: "hospitalValue", title: "병원", width: 50, attributes: {style: "text-align: center;"},template:hospitalTemplate}
  81. ,{ field: "msgType", title: "승인/취소", width: 60, attributes: {style: "text-align: center;"},template:msgTypeTemplate}
  82. ,{ field: "userId", title: "환자번호", width: 80, attributes: {style: "text-align: center;"}}
  83. ,{ field: "amountValue", title: "금액", width: 50, attributes: {style: "text-align: center;"},template:amountValueTemplate}
  84. ,{ field: "transDt", title: "결제일",width: 80, attributes: {style: "text-align: center;"}}
  85. ,{ field: "transValue",title:"승인번호",sortable:false, filterable:false, width: 50, attributes: {style: "text-align: center;"}}
  86. ,{ field: "examDt", title: "진료일",width: 80, attributes: {style: "text-align: center;"},template:examDtTemplate}
  87. ]
  88. // ,filterable: {
  89. // extra : false,
  90. // operators : {
  91. // string : {
  92. // contains : " 포함 "
  93. // }
  94. // }
  95. // }
  96. };
  97. function hospitalTemplate(data){
  98. return data.hospitalValue === "031" ? "본원" : "칠곡";
  99. };
  100. function msgTypeTemplate(data){
  101. return data.msgType === "02" ? "승인" : "취소";
  102. };
  103. function examDtTemplate(data){
  104. return data.examDt !== null ? data.examDt.split(" ")[0] :"";
  105. };
  106. function amountValueTemplate(data){
  107. return data.amountValue !== null ? $.number( data.amountValue,0,'.',',' ) : "";
  108. };
  109. // 그리드 초기화
  110. self.grid( $grid, option );
  111. };
  112. };