|
@@ -0,0 +1,697 @@
|
|
1
|
+/********************************************************
|
|
2
|
+ --------------------------------------------------------
|
|
3
|
+ - Object 목록 -
|
|
4
|
+ --------------------------------------------------------
|
|
5
|
+ * const gridColModel = {} : 화면 Grid Object *
|
|
6
|
+ * let pageObj = {} : 화면공통 Object *
|
|
7
|
+ * let listObj = {} : 목록화면 Object *
|
|
8
|
+ * let modifyObj = {} : 상세화면 Object *
|
|
9
|
+ *******************************************************/
|
|
10
|
+
|
|
11
|
+/*화면 변수*/
|
|
12
|
+const VSETTMNG01010_GRID_ID = '#ITP_VSETTMNG01010_jqGrid';
|
|
13
|
+const VSETTMNG01010_GRID_LIST = '#ITP_VSETTMNG01010_jqGrid_list';
|
|
14
|
+const VSETTMNG01010_GRID_PAGER = '#ITP_VSETTMNG01010_jqGridPager';
|
|
15
|
+const VSETTMNG01010_GRID_EMPTY = '#ITP_VSETTMNG01010_jqGridEmpty';
|
|
16
|
+
|
|
17
|
+const VSETTMNG01010_DETAIL_GRID_ID = '#ITP_VSETTMNG01010_DETAIL_jqGrid';
|
|
18
|
+const VSETTMNG01010_DETAIL_GRID_LIST = '#ITP_VSETTMNG01010_DETAIL_jqGrid_list';
|
|
19
|
+const VSETTMNG01010_DETAIL_GRID_PAGER = '#ITP_VSETTMNG01010_DETAIL_jqGridPager';
|
|
20
|
+const VSETTMNG01010_DETAIL_GRID_EMPTY = '#ITP_VSETTMNG01010_DETAIL_jqGridEmpty';
|
|
21
|
+
|
|
22
|
+let ITP_FORM_VSETTMNG01010_DETAIL_IS_DUPLICATE = false;
|
|
23
|
+let ITP_FORM_VSETTMNG01010_DETAIL_IS_WRITING = false;
|
|
24
|
+let VSETTMNG01010_DETAIL_GRID_LAST_ROW_ID;
|
|
25
|
+
|
|
26
|
+/*API URL*/
|
|
27
|
+let STTL_REQ_DETAIL_GRID_LIST = '/api/sttl/req/detail-grid-list';
|
|
28
|
+let STTL_REQ_REQUEST_STTL = '/api/sttl/req/request-sttl';
|
|
29
|
+let STTL_REQ_REQUEST_STTL_PROC = '/api/sttl/req/request-sttl-proc';
|
|
30
|
+let STTL_REQ_INFO_STTL = '/api/sttl/req/info-sttl';
|
|
31
|
+let STTL_REQ_STL_GRID_LIST = '/api/sttl/req/stl-grid-list';
|
|
32
|
+
|
|
33
|
+let LOGIN_AUTH_TYPE_CD;
|
|
34
|
+
|
|
35
|
+/*화면 Grid ColModel*/
|
|
36
|
+const gridColModel = {
|
|
37
|
+ list: [
|
|
38
|
+ {
|
|
39
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
40
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
41
|
+ width: '10', fixed: false, align: 'center',
|
|
42
|
+ sortable: false, hidden: true
|
|
43
|
+ },
|
|
44
|
+ {
|
|
45
|
+ index: 'STTL_MGNT_UNQ_NO', name: 'sttlMgntUnqNo',
|
|
46
|
+ label: "정산관리고유번호",
|
|
47
|
+ width: '0', fixed: false, align: 'center',
|
|
48
|
+ sortable: false, hidden: true
|
|
49
|
+ },
|
|
50
|
+ {
|
|
51
|
+ index: 'STTL_MGNT_DTL_NO', name: 'sttlMgntDtlNo',
|
|
52
|
+ label: '정산관리상세번호',
|
|
53
|
+ width: '10', fixed: false, align: 'center',
|
|
54
|
+ sortable: false, hidden: true
|
|
55
|
+ },
|
|
56
|
+ {
|
|
57
|
+ index: 'MGNT_UNQ_NO', name: 'mgntUnqNo',
|
|
58
|
+ label: '관리고유번호',
|
|
59
|
+ width: '10', fixed: false, align: 'center',
|
|
60
|
+ sortable: false, hidden: true
|
|
61
|
+ },
|
|
62
|
+ {
|
|
63
|
+ index: 'BRAND_NM', name: 'brandNm',
|
|
64
|
+ label: "브랜드",
|
|
65
|
+ width: '10', fixed: false, align: 'center',
|
|
66
|
+ sortable: false, hidden: false
|
|
67
|
+ },
|
|
68
|
+ {
|
|
69
|
+ index: 'STORE_NM', name: 'storeNm',
|
|
70
|
+ label: "매장명",
|
|
71
|
+ width: '10', fixed: false, align: 'center',
|
|
72
|
+ sortable: false, hidden: true
|
|
73
|
+ },
|
|
74
|
+ {
|
|
75
|
+ index: 'LOAN_DVSN', name: 'loanDvsn',
|
|
76
|
+ label: "정산타입",
|
|
77
|
+ width: '8', fixed: false, align: 'center',
|
|
78
|
+ sortable: false, hidden: true
|
|
79
|
+ },
|
|
80
|
+ {
|
|
81
|
+ index: 'LOAN_DVSN_NM', name: 'loanDvsnNm',
|
|
82
|
+ label: "정산타입",
|
|
83
|
+ width: '8', fixed: false, align: 'center',
|
|
84
|
+ sortable: false, hidden: true
|
|
85
|
+ },
|
|
86
|
+ {
|
|
87
|
+ index: 'STTL_ST_CD', name: 'sttlStCd',
|
|
88
|
+ label: "정산상태코드",
|
|
89
|
+ width: '8', fixed: false, align: 'center',
|
|
90
|
+ sortable: false, hidden: true
|
|
91
|
+ },
|
|
92
|
+ {
|
|
93
|
+ index: 'STTL_ST_NM', name: 'sttlStNm',
|
|
94
|
+ label: "정산상태",
|
|
95
|
+ width: '8', fixed: false, align: 'center',
|
|
96
|
+ sortable: false, hidden: false
|
|
97
|
+ },
|
|
98
|
+ {
|
|
99
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
100
|
+ label: "품목코드",
|
|
101
|
+ width: '10', fixed: false, align: 'center',
|
|
102
|
+ sortable: false, editable: false, edittype: 'text'
|
|
103
|
+ },
|
|
104
|
+ {
|
|
105
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
106
|
+ label: "품목명",
|
|
107
|
+ width: '10', fixed: false, align: 'center',
|
|
108
|
+ sortable: false, editable: false, edittype: 'text'
|
|
109
|
+ },
|
|
110
|
+ {
|
|
111
|
+ index: 'UNIT', name: 'unit',
|
|
112
|
+ label: "단위",
|
|
113
|
+ width: '6', fixed: false, align: 'center',
|
|
114
|
+ sortable: false, editable: false, edittype: 'text'
|
|
115
|
+ },
|
|
116
|
+ {
|
|
117
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
118
|
+ label: "단가",
|
|
119
|
+ width: '7', fixed: false, align: 'center',
|
|
120
|
+ sortable: false, editable: false, edittype: 'text',
|
|
121
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
122
|
+ },
|
|
123
|
+ {
|
|
124
|
+ index: 'PODR_QTY', name: 'podrQty',
|
|
125
|
+ label: "발주수량",
|
|
126
|
+ width: '7', fixed: false, align: 'center',
|
|
127
|
+ sortable: false, editable: false, edittype: 'text',
|
|
128
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
129
|
+ },
|
|
130
|
+ {
|
|
131
|
+ index: 'DLV_QTY', name: 'dlvQty',
|
|
132
|
+ label: "납품수량",
|
|
133
|
+ width: '7', fixed: false, align: 'center',
|
|
134
|
+ sortable: false, editable: false, edittype: 'text',
|
|
135
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
136
|
+ },
|
|
137
|
+ {
|
|
138
|
+ index: 'WHS_COL_QTY', name: 'whsColQty',
|
|
139
|
+ label: "입고/수거수량",
|
|
140
|
+ width: '10', fixed: false, align: 'center',
|
|
141
|
+ sortable: false, editable: false, edittype: 'text',
|
|
142
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
143
|
+ },
|
|
144
|
+ {
|
|
145
|
+ index: 'WHS_COL_DT', name: 'whsColDt',
|
|
146
|
+ label: "입고/수거일자",
|
|
147
|
+ width: '10', fixed: false, align: 'center',
|
|
148
|
+ sortable: false, editable: false, edittype: 'text'
|
|
149
|
+ },
|
|
150
|
+ {
|
|
151
|
+ index: 'WHS_COL_AMT', name: 'whsColAmt',
|
|
152
|
+ label: "입고/수거금액",
|
|
153
|
+ width: '10', fixed: false, align: 'center',
|
|
154
|
+ sortable: false, editable: false, edittype: 'text',
|
|
155
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
156
|
+ },
|
|
157
|
+ {
|
|
158
|
+ index: 'STTL_DVSN', name: 'sttlDvsn',
|
|
159
|
+ label: "정산구분",
|
|
160
|
+ width: '8', fixed: false, align: 'center',
|
|
161
|
+ sortable: false, hidden: true
|
|
162
|
+ },
|
|
163
|
+ {
|
|
164
|
+ index: 'STTL_DVSN_NM', name: 'sttlDvsnNm',
|
|
165
|
+ label: "정산구분",
|
|
166
|
+ width: '8', fixed: false, align: 'center',
|
|
167
|
+ sortable: false, editable: false, edittype: 'text'
|
|
168
|
+ },
|
|
169
|
+ {
|
|
170
|
+ index: 'PODR_UNQ_NO', name: 'podrUnqNo',
|
|
171
|
+ label: "발주번호",
|
|
172
|
+ width: '8', fixed: false, align: 'center',
|
|
173
|
+ sortable: false, editable: false, edittype: 'text'
|
|
174
|
+ },
|
|
175
|
+ {
|
|
176
|
+ index: 'PODR_DTL_NO', name: 'podrDtlNo',
|
|
177
|
+ label: "발주항번",
|
|
178
|
+ width: '7', fixed: false, align: 'center',
|
|
179
|
+ sortable: false, editable: false, edittype: 'text'
|
|
180
|
+ }
|
|
181
|
+ ],
|
|
182
|
+ view: [
|
|
183
|
+ {
|
|
184
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
185
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
186
|
+ width: '10', fixed: false, align: 'center',
|
|
187
|
+ sortable: false, hidden: true
|
|
188
|
+ },
|
|
189
|
+ {
|
|
190
|
+ index: 'STTL_MGNT_DTL_NO', name: 'sttlMgntDtlNo',
|
|
191
|
+ label: '정산관리상세번호',
|
|
192
|
+ width: '10', fixed: false, align: 'center',
|
|
193
|
+ sortable: false, hidden: true
|
|
194
|
+ },
|
|
195
|
+ {
|
|
196
|
+ index: 'BRAND_NM', name: 'brandNm',
|
|
197
|
+ label: "브랜드",
|
|
198
|
+ width: '10', fixed: false, align: 'center',
|
|
199
|
+ sortable: false, hidden: true
|
|
200
|
+ },
|
|
201
|
+ {
|
|
202
|
+ index: 'STORE_NM', name: 'storeNm',
|
|
203
|
+ label: "매장명",
|
|
204
|
+ width: '10', fixed: false, align: 'center',
|
|
205
|
+ sortable: false, hidden: true
|
|
206
|
+ },
|
|
207
|
+ {
|
|
208
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
209
|
+ label: "품목코드",
|
|
210
|
+ width: '10', fixed: false, align: 'center',
|
|
211
|
+ sortable: false, editable: false, edittype: 'text'
|
|
212
|
+ },
|
|
213
|
+ {
|
|
214
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
215
|
+ label: "품목명",
|
|
216
|
+ width: '10', fixed: false, align: 'center',
|
|
217
|
+ sortable: false, editable: false, edittype: 'text'
|
|
218
|
+ },
|
|
219
|
+ {
|
|
220
|
+ index: 'UNIT', name: 'unit',
|
|
221
|
+ label: "단위",
|
|
222
|
+ width: '8', fixed: false, align: 'center',
|
|
223
|
+ sortable: false, editable: false, edittype: 'text'
|
|
224
|
+ },
|
|
225
|
+ {
|
|
226
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
227
|
+ label: "단가",
|
|
228
|
+ width: '8', fixed: false, align: 'center',
|
|
229
|
+ sortable: false, editable: false, edittype: 'text',
|
|
230
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
231
|
+ },
|
|
232
|
+ {
|
|
233
|
+ index: 'PODR_QTY', name: 'podrQty',
|
|
234
|
+ label: "발주수량",
|
|
235
|
+ width: '8', fixed: false, align: 'center',
|
|
236
|
+ sortable: false, editable: false, edittype: 'text',
|
|
237
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
238
|
+ },
|
|
239
|
+ {
|
|
240
|
+ index: 'DLV_QTY', name: 'dlvQty',
|
|
241
|
+ label: "납품수량",
|
|
242
|
+ width: '8', fixed: false, align: 'center',
|
|
243
|
+ sortable: false, editable: false, edittype: 'text',
|
|
244
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
245
|
+ },
|
|
246
|
+ {
|
|
247
|
+ index: 'WHS_COL_QTY', name: 'whsColQty',
|
|
248
|
+ label: "입고/수거수량",
|
|
249
|
+ width: '8', fixed: false, align: 'center',
|
|
250
|
+ sortable: false, editable: false, edittype: 'text',
|
|
251
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
252
|
+ },
|
|
253
|
+ {
|
|
254
|
+ index: 'WHS_COL_DT', name: 'whsColDt',
|
|
255
|
+ label: "입고/수거일자",
|
|
256
|
+ width: '8', fixed: false, align: 'center',
|
|
257
|
+ sortable: false, editable: false, edittype: 'text'
|
|
258
|
+ },
|
|
259
|
+ {
|
|
260
|
+ index: 'WHS_COL_AMT', name: 'whsColAmt',
|
|
261
|
+ label: "입고/수거금액",
|
|
262
|
+ width: '8', fixed: false, align: 'center',
|
|
263
|
+ sortable: false, editable: false, edittype: 'text',
|
|
264
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
265
|
+ },
|
|
266
|
+ {
|
|
267
|
+ index: 'STTL_DVSN_NM', name: 'sttlDvsnNm',
|
|
268
|
+ label: "정산구분",
|
|
269
|
+ width: '8', fixed: false, align: 'center',
|
|
270
|
+ sortable: false, editable: false, edittype: 'text'
|
|
271
|
+ },
|
|
272
|
+ {
|
|
273
|
+ index: 'PODR_UNQ_NO', name: 'podrUnqNo',
|
|
274
|
+ label: "발주번호",
|
|
275
|
+ width: '8', fixed: false, align: 'center',
|
|
276
|
+ sortable: false, editable: false, edittype: 'text'
|
|
277
|
+ },
|
|
278
|
+ {
|
|
279
|
+ index: 'PODR_DTL_NO', name: 'podrDtlNo',
|
|
280
|
+ label: "발주항번",
|
|
281
|
+ width: '8', fixed: false, align: 'center',
|
|
282
|
+ sortable: false, editable: false, edittype: 'text'
|
|
283
|
+ }
|
|
284
|
+ ]
|
|
285
|
+};
|
|
286
|
+
|
|
287
|
+require(['config'], function() {
|
|
288
|
+ require([
|
|
289
|
+ 'kakao.map.util'
|
|
290
|
+ ], function($) {
|
|
291
|
+ pageObj.init();
|
|
292
|
+ });
|
|
293
|
+});
|
|
294
|
+
|
|
295
|
+/*화면공통 Object*/
|
|
296
|
+let pageObj = {
|
|
297
|
+ init: function () {
|
|
298
|
+ this.ui.init();
|
|
299
|
+ this.event.init();
|
|
300
|
+ },
|
|
301
|
+ ui: {
|
|
302
|
+ init: function () {
|
|
303
|
+ this.view();
|
|
304
|
+ this.grid();
|
|
305
|
+ this.ready();
|
|
306
|
+ },
|
|
307
|
+ view: function() {
|
|
308
|
+ // 버튼 권한설정
|
|
309
|
+ fn_proc_btn_auth('VSETTMNG01010');
|
|
310
|
+
|
|
311
|
+ // 공통코드 표시
|
|
312
|
+ $('select').each(function() {
|
|
313
|
+ if($(this).data('select-code')) {
|
|
314
|
+ fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
|
|
315
|
+ }
|
|
316
|
+ });
|
|
317
|
+
|
|
318
|
+ // 조회일자 지정
|
|
319
|
+ var now = new Date();
|
|
320
|
+ $('#ITP_TAB_VSETTMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
321
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
|
|
322
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_TO_DT').datepicker('setDate', new Date());
|
|
323
|
+
|
|
324
|
+ // 권한에 따라 매장값 설정
|
|
325
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
326
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_SPPLY_ID').val(fn_make_user_info.get('spplyId'));
|
|
327
|
+ LOGIN_AUTH_TYPE_CD = fn_make_user_info.get('authTpCd'); // 권한타입
|
|
328
|
+ if(LOGIN_AUTH_TYPE_CD == '50') {
|
|
329
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
330
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_NM').val(fn_make_user_info.get('storeNm'));
|
|
331
|
+ }
|
|
332
|
+
|
|
333
|
+ },
|
|
334
|
+ grid: function() {
|
|
335
|
+ itp_fn_jqgrid_resize(VSETTMNG01010_GRID_ID, VSETTMNG01010_GRID_LIST, 'lg');
|
|
336
|
+ listObj.empty.init();
|
|
337
|
+ itp_fn_fire_window_resize();
|
|
338
|
+ },
|
|
339
|
+ ready: function() {
|
|
340
|
+ listObj.init();
|
|
341
|
+ }
|
|
342
|
+ },
|
|
343
|
+ event: {
|
|
344
|
+ init: function () {
|
|
345
|
+ this.button();
|
|
346
|
+ },
|
|
347
|
+ button: function () {
|
|
348
|
+ // 버튼 클릭 이벤트
|
|
349
|
+ $('button').each(function() {
|
|
350
|
+ var id = $(this).attr('id');
|
|
351
|
+ $(this).on('click', function() {
|
|
352
|
+ switch (id) {
|
|
353
|
+ case 'ITP_BTN_VSETTMNG01010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
|
|
354
|
+ case 'ITP_BTN_VSETTMNG01010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
|
|
355
|
+ case 'ITP_BTN_VSETTMNG01010_NEWREG' : listObj.button.reqSttl(); break; // 정산요청 버튼
|
|
356
|
+ case 'ITP_BTN_VSETTMNG01010_REQUEST' : modifyObj.button.request(); break; // 요청 버튼
|
|
357
|
+ case 'ITP_BTN_VSETTMNG01010_STORE_SEARCH' : listObj.button.storePop(); break; // 매장검색 팝업
|
|
358
|
+ case 'ITP_BTN_VSETTMNG01010_STORE_ERASE' : listObj.button.storeErase(); break; // 매장 지움
|
|
359
|
+ }
|
|
360
|
+ });
|
|
361
|
+ });
|
|
362
|
+
|
|
363
|
+ $('body').on('click', function(e) {
|
|
364
|
+ var gridId = VSETTMNG01010_DETAIL_GRID_ID.replace('#', '');
|
|
365
|
+ var rids = $(VSETTMNG01010_DETAIL_GRID_ID).jqGrid('getDataIDs');
|
|
366
|
+ var last_row_id = rids[rids.length - 1];
|
|
367
|
+ itp_fn_grid_reset_selection(e, last_row_id, gridId, 'VSETTMNG01010_DETAIL');
|
|
368
|
+ });
|
|
369
|
+
|
|
370
|
+ }
|
|
371
|
+ },
|
|
372
|
+ switchScreen: function(mode) {
|
|
373
|
+ if(mode == 'LIST') { // 목록
|
|
374
|
+ $('#ITP_BTN_VSETTMNG01010_MODIFY').hide();
|
|
375
|
+ $('#ITP_BTN_VSETTMNG01010_CANCELLIST').hide();
|
|
376
|
+ $('#ITP_BTN_VSETTMNG01010_DELETE').hide();
|
|
377
|
+ $('#ITP_BTN_VSETTMNG01010_REQUEST').hide();
|
|
378
|
+
|
|
379
|
+ if(LOGIN_AUTH_TYPE_CD == '50') { // 매장관리자
|
|
380
|
+ $('#ITP_BTN_VSETTMNG01010_STORE_SEARCH').hide();
|
|
381
|
+ $('#ITP_BTN_VSETTMNG01010_STORE_ERASE').hide();
|
|
382
|
+ } else {
|
|
383
|
+ $('#ITP_BTN_VSETTMNG01010_STORE_SEARCH').show();
|
|
384
|
+ $('#ITP_BTN_VSETTMNG01010_STORE_ERASE').show();
|
|
385
|
+ }
|
|
386
|
+
|
|
387
|
+ fn_show_btn_auth('#ITP_BTN_VSETTMNG01010_SRH');
|
|
388
|
+ fn_show_btn_auth('#ITP_BTN_VSETTMNG01010_NEWREG');
|
|
389
|
+
|
|
390
|
+ $('#ITP_AJAX_VSETTMNG01010_LIST_CONTAINER').show();
|
|
391
|
+ $('#ITP_AJAX_VSETTMNG01010_DETAIL_CONTAINER').hide();
|
|
392
|
+
|
|
393
|
+ } else if(mode == 'DETAIL') { // 보기
|
|
394
|
+ $('#ITP_BTN_VSETTMNG01010_SRH').hide();
|
|
395
|
+ $('#ITP_BTN_VSETTMNG01010_NEWREG').hide();
|
|
396
|
+ $('#ITP_BTN_VSETTMNG01010_DELETE').hide();
|
|
397
|
+
|
|
398
|
+ fn_show_btn_auth('#ITP_BTN_VSETTMNG01010_REQUEST');
|
|
399
|
+ fn_show_btn_auth('#ITP_BTN_VSETTMNG01010_CANCELLIST');
|
|
400
|
+
|
|
401
|
+ $('#ITP_AJAX_VSETTMNG01010_LIST_CONTAINER').hide();
|
|
402
|
+ $('#ITP_AJAX_VSETTMNG01010_DETAIL_CONTAINER').show();
|
|
403
|
+ }
|
|
404
|
+ }
|
|
405
|
+};
|
|
406
|
+
|
|
407
|
+/*목록화면 Object*/
|
|
408
|
+let listObj = {
|
|
409
|
+ init: function () {
|
|
410
|
+ this.grid.init();
|
|
411
|
+ },
|
|
412
|
+ itp_VSETTMNG01010_search: false,
|
|
413
|
+ button: {
|
|
414
|
+ search: function() {
|
|
415
|
+ listObj.itp_VSETTMNG01010_search = true;
|
|
416
|
+ let param = $('#ITP_FORM_VSETTMNG01010_SEARCH').serializeObject();
|
|
417
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
418
|
+ param.gridPage = $.jgrid.defaults.page;
|
|
419
|
+ $(VSETTMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
|
|
420
|
+ },
|
|
421
|
+ reqSttl: function() { // 정산요청
|
|
422
|
+ // 매장선택 체크
|
|
423
|
+ // if($('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_ID').val() == '') {
|
|
424
|
+ // itp_fn_modal_alert_ajax('정산요청을 위한 매장을 선택하세요.');
|
|
425
|
+ // return;
|
|
426
|
+ // }
|
|
427
|
+
|
|
428
|
+ // 그리드에서 최소1개는 선택해야 함
|
|
429
|
+ const rowKey = $(VSETTMNG01010_GRID_ID).getGridParam('selrow');
|
|
430
|
+ if (!rowKey) {
|
|
431
|
+ itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.noData);
|
|
432
|
+ return;
|
|
433
|
+ }
|
|
434
|
+
|
|
435
|
+ var selectedIds = $(VSETTMNG01010_GRID_ID).getGridParam('selarrrow');
|
|
436
|
+ let sttlReqDataList = [];
|
|
437
|
+ var check = true;
|
|
438
|
+ $.each(selectedIds, function(key, value) {
|
|
439
|
+ var sttlMgntUnqNo = $(VSETTMNG01010_GRID_ID).jqGrid('getRowData', value).sttlMgntUnqNo;
|
|
440
|
+ var sttlMgntDtlNo = $(VSETTMNG01010_GRID_ID).jqGrid('getRowData', value).sttlMgntDtlNo;
|
|
441
|
+ var loanDvsn = $(VSETTMNG01010_GRID_ID).jqGrid('getRowData', value).loanDvsn; // 여신구분
|
|
442
|
+ var sttlStCd = $(VSETTMNG01010_GRID_ID).jqGrid('getRowData', value).sttlStCd; // 정산상태코드
|
|
443
|
+ var sttlDvsn = $(VSETTMNG01010_GRID_ID).jqGrid('getRowData', value).sttlDvsn; // 정산구분
|
|
444
|
+ var mgntUnqNo = $(VSETTMNG01010_GRID_ID).jqGrid('getRowData', value).mgntUnqNo;
|
|
445
|
+
|
|
446
|
+ if(sttlStCd == 'ST10' || sttlStCd == 'ST20') { // 정산요청 및 정산확정 건은 정산요청이 불가능
|
|
447
|
+ check = false;
|
|
448
|
+ }
|
|
449
|
+ let data = {}
|
|
450
|
+ data.sttlMgntUnqNo = sttlMgntUnqNo;
|
|
451
|
+ data.sttlMgntDtlNo = sttlMgntDtlNo;
|
|
452
|
+ data.loanDvsn = loanDvsn;
|
|
453
|
+ data.sttlDvsn = sttlDvsn;
|
|
454
|
+ data.mgntUnqNo = mgntUnqNo;
|
|
455
|
+ sttlReqDataList.push(data);
|
|
456
|
+ });
|
|
457
|
+ if(!check) {
|
|
458
|
+ itp_fn_modal_alert_ajax('정산요청 및 확정된 건은 정산 요청이 불가능합니다.');
|
|
459
|
+ return;
|
|
460
|
+ }
|
|
461
|
+
|
|
462
|
+ let param = {};
|
|
463
|
+ param.brandId = $('#ITP_FORM_VSETTMNG01010_SEARCH_BRAND_ID').val();
|
|
464
|
+ // param.storeId = $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_ID').val();
|
|
465
|
+ param.spplyId = $('#ITP_FORM_VSETTMNG01010_SEARCH_SPPLY_ID').val();
|
|
466
|
+ param.sttlReqDataList = sttlReqDataList;
|
|
467
|
+ fn_ajax_call(STTL_REQ_REQUEST_STTL, JSON.stringify(param), function(result) {
|
|
468
|
+
|
|
469
|
+ // alert(JSON.stringify(result));
|
|
470
|
+ // $('#ITP_FORM_VSETTMNG01010_DETAIL_STTL_MGNT_UNQ_NO').val(result.sttlMgntUnqNo);
|
|
471
|
+
|
|
472
|
+ const sttlMgntUnqNoVal = result.sttlMgntUnqNo;
|
|
473
|
+ const key = {sttlMgntUnqNo: sttlMgntUnqNoVal, viewCd: 'R'};
|
|
474
|
+ var param = $.param(key);
|
|
475
|
+ modifyObj.init(param);
|
|
476
|
+
|
|
477
|
+ }, 'POST');
|
|
478
|
+ },
|
|
479
|
+ storePop: function() {
|
|
480
|
+ fn_call_popup('biz', 'BIZPOP_BRAND_STORE', '#ITP_ASIDE', function(result) {
|
|
481
|
+ // alert(JSON.stringify(result));
|
|
482
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_ID').val(result[0].storeId);
|
|
483
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_NM').val(result[0].storeNm);
|
|
484
|
+ listObj.button.search();
|
|
485
|
+ }, null, 'S');
|
|
486
|
+ },
|
|
487
|
+ storeErase: function() {
|
|
488
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_ID').val('');
|
|
489
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_NM').val('');
|
|
490
|
+ listObj.button.search();
|
|
491
|
+ }
|
|
492
|
+ },
|
|
493
|
+ empty: {
|
|
494
|
+ init: function() {
|
|
495
|
+ var _this = this;
|
|
496
|
+ this.push();
|
|
497
|
+ $(VSETTMNG01010_GRID_EMPTY).on('click', function() {
|
|
498
|
+ _this.back();
|
|
499
|
+ _this.itp_VSETTMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
500
|
+ $(VSETTMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_VSETTMNG01010_param)}).trigger('reloadGrid');
|
|
501
|
+ });
|
|
502
|
+ },
|
|
503
|
+ itp_VSETTMNG01010_param: {},
|
|
504
|
+ push: function() {
|
|
505
|
+ let param = $('#ITP_FORM_VSETTMNG01010_SEARCH').serializeObject();
|
|
506
|
+ listObj.itp_VSETTMNG01010_param = param;
|
|
507
|
+ },
|
|
508
|
+ back: function() {
|
|
509
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_ID').val(listObj.itp_VSETTMNG01010_param.sstoreId);
|
|
510
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_STORE_NM').val(listObj.itp_VSETTMNG01010_param.sstoreNm);
|
|
511
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_FROM_DT').val(listObj.itp_VSETTMNG01010_param.fromDt);
|
|
512
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_TO_DT').val(listObj.itp_VSETTMNG01010_param.toDt);
|
|
513
|
+ $('#ITP_FORM_VSETTMNG01010_SEARCH_ITEM_NM').val(listObj.itp_VSETTMNG01010_param.sitemNm);
|
|
514
|
+ }
|
|
515
|
+ },
|
|
516
|
+ grid: {
|
|
517
|
+ init: function () {
|
|
518
|
+ // 데이터 없을때
|
|
519
|
+ listObj.empty.push();
|
|
520
|
+ this.search();
|
|
521
|
+ },
|
|
522
|
+ colModel: gridColModel.list,
|
|
523
|
+ search: function() {
|
|
524
|
+ pageObj.switchScreen('LIST');
|
|
525
|
+ this.unload();
|
|
526
|
+ this.load();
|
|
527
|
+ },
|
|
528
|
+ load: function() {
|
|
529
|
+ let param = $('#ITP_FORM_VSETTMNG01010_SEARCH').serializeObject();
|
|
530
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
531
|
+
|
|
532
|
+ var option = {
|
|
533
|
+ gridId: VSETTMNG01010_GRID_ID,
|
|
534
|
+ colModel: gridColModel.list,
|
|
535
|
+ param: param,
|
|
536
|
+ url: DOMAIN + STTL_REQ_DETAIL_GRID_LIST,
|
|
537
|
+ pager: VSETTMNG01010_GRID_PAGER,
|
|
538
|
+ multiselect: true,
|
|
539
|
+ onCellSelect: function(rowId, cellIdx, cellValue) {
|
|
540
|
+ var cm = $(this).jqGrid('getGridParam', 'colModel');
|
|
541
|
+ var colNm = cm[cellIdx].name;
|
|
542
|
+ if (colNm == 'sttlReqDt') {
|
|
543
|
+ const sttlMgntUnqNoVal = $(this).jqGrid('getCell', rowId, 'sttlMgntUnqNo');
|
|
544
|
+
|
|
545
|
+ const key = {sttlMgntUnqNo: sttlMgntUnqNoVal, viewCd: 'R'};
|
|
546
|
+ var param = $.param(key);
|
|
547
|
+ modifyObj.init(param);
|
|
548
|
+ }
|
|
549
|
+ },
|
|
550
|
+ loadComplete: function(data) {
|
|
551
|
+ console.log(data);
|
|
552
|
+ itp_fn_grid_load_complete(data, VSETTMNG01010_GRID_ID, true, 'number', 'VSETTMNG01010', listObj.itp_VSETTMNG01010_search, listObj.empty, true, data.gridRecords, true);
|
|
553
|
+ var ids = $(VSETTMNG01010_GRID_ID).getDataIDs();
|
|
554
|
+ $.each(ids, function(idx, rowId) {
|
|
555
|
+ // $(VSETTMNG01010_GRID_ID).jqGrid('setCell', rowId, 'sttlReqDt', '', ITP_GRID_COL_STYLE.link);
|
|
556
|
+ });
|
|
557
|
+ },
|
|
558
|
+ onPaging: function(action) {
|
|
559
|
+ itp_fn_grid_paging(VSETTMNG01010_GRID_ID, action, param);
|
|
560
|
+ }
|
|
561
|
+ };
|
|
562
|
+ itp_fn_grid_make_remote(option);
|
|
563
|
+ },
|
|
564
|
+ clearData : function() {
|
|
565
|
+ $(VSETTMNG01010_GRID_ID).jqGrid('clearGridData', true);
|
|
566
|
+ $(VSETTMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
567
|
+ $(VSETTMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
568
|
+ $(VSETTMNG01010_GRID_EMPTY).show();
|
|
569
|
+ },
|
|
570
|
+ unload : function() {
|
|
571
|
+ $.jgrid.gridUnload(VSETTMNG01010_GRID_ID);
|
|
572
|
+ }
|
|
573
|
+ }
|
|
574
|
+};
|
|
575
|
+
|
|
576
|
+/*상세화면 Object*/
|
|
577
|
+let modifyObj = {
|
|
578
|
+ init: function (param) {
|
|
579
|
+ this.load(param);
|
|
580
|
+ },
|
|
581
|
+ button: {
|
|
582
|
+ cancel: function() {
|
|
583
|
+ listObj.grid.search();
|
|
584
|
+ },
|
|
585
|
+ request: function() {
|
|
586
|
+
|
|
587
|
+ const formId = '#ITP_FORM_VSETTMNG01010_DETAIL';
|
|
588
|
+ itp_fn_form_clear_validate(null, formId);
|
|
589
|
+
|
|
590
|
+ var vali_sttlReqDt = itp_fn_form_validate(formId, formId + '_STTL_REQ_DT', ['empty'], undefined); // 정산요청일자
|
|
591
|
+
|
|
592
|
+ if (vali_sttlReqDt) {
|
|
593
|
+ let sttlReqDataList = [];
|
|
594
|
+ const rowData = $(VSETTMNG01010_DETAIL_GRID_ID).getRowData();
|
|
595
|
+ // const keyValue = $(formId + '_WHS_ID').val();
|
|
596
|
+ $.each(rowData, function(key, value) {
|
|
597
|
+ sttlReqDataList.push(value);
|
|
598
|
+ });
|
|
599
|
+ let param = $(formId).serializeObject();
|
|
600
|
+ param.sttlReqDataList = sttlReqDataList;
|
|
601
|
+
|
|
602
|
+ // console.log(JSON.stringify(param));
|
|
603
|
+ var confirmFn= {
|
|
604
|
+ callBack: function() {
|
|
605
|
+ //
|
|
606
|
+ var searhFn = function() {
|
|
607
|
+ ITP_FORM_VSETTMNG01010_DETAIL_IS_WRITING = false;
|
|
608
|
+ listObj.grid.search();
|
|
609
|
+ };
|
|
610
|
+ fn_ajax_call(STTL_REQ_REQUEST_STTL_PROC, JSON.stringify(param), searhFn, 'POST');
|
|
611
|
+ }
|
|
612
|
+ };
|
|
613
|
+ itp_fn_modal_confirm(ITP_MSG_LOCALE.message.form.procData, confirmFn, null);
|
|
614
|
+ }
|
|
615
|
+ }
|
|
616
|
+ },
|
|
617
|
+ load: function(param) {
|
|
618
|
+ fn_ajax_call(STTL_REQ_INFO_STTL, param, this.callback, 'GET');
|
|
619
|
+ },
|
|
620
|
+ callback: function (result) {
|
|
621
|
+ // console.log(result);
|
|
622
|
+ pageObj.switchScreen('DETAIL');
|
|
623
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL_BRAND_ID').val(result.brandId);
|
|
624
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL_STORE_ID').val(result.storeId);
|
|
625
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL_STTL_MGNT_UNQ_NO').val(result.sttlMgntUnqNo);
|
|
626
|
+
|
|
627
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnBrandNm').text(result.brandNm);
|
|
628
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnStoreNm').text(result.storeNm);
|
|
629
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL_STTL_REQ_DT').val(result.sttlReqDt);
|
|
630
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnSttlStNm').text(result.sttlStNm);
|
|
631
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnSttlReqAmt').text(itp_fn_number_comma(result.sttlReqAmt));
|
|
632
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnAcctBal').text(itp_fn_number_comma(result.acctBal));
|
|
633
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnSysRegDttm').text(result.sysRegDttm);
|
|
634
|
+ $('#ITP_FORM_VSETTMNG01010_DETAIL .fnSysRegNm').text(result.sysRegNm);
|
|
635
|
+
|
|
636
|
+ // 리스트 조회
|
|
637
|
+ modifyObj.grid.init();
|
|
638
|
+ },
|
|
639
|
+ grid: {
|
|
640
|
+ init: function() {
|
|
641
|
+ this.unload();
|
|
642
|
+ this.load();
|
|
643
|
+ },
|
|
644
|
+ load : function() {
|
|
645
|
+ let param = $('#ITP_FORM_VSETTMNG01010_DETAIL').serializeObject();
|
|
646
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
647
|
+ param.pagingYn = false; // 페이징안함
|
|
648
|
+
|
|
649
|
+ var option = {
|
|
650
|
+ gridId: VSETTMNG01010_DETAIL_GRID_ID,
|
|
651
|
+ colModel: gridColModel.view,
|
|
652
|
+ param: param,
|
|
653
|
+ url: DOMAIN + STTL_REQ_STL_GRID_LIST,
|
|
654
|
+ pager: VSETTMNG01010_DETAIL_GRID_PAGER,
|
|
655
|
+ loadComplete: function(data) {
|
|
656
|
+ itp_fn_grid_load_complete(data, VSETTMNG01010_DETAIL_GRID_ID, true, undefined, 'VSETTMNG01010_DETAIL');
|
|
657
|
+ },
|
|
658
|
+ onPaging: function(action) {
|
|
659
|
+ var pagingFn = {
|
|
660
|
+ callBack: function(args) {
|
|
661
|
+ $(args).trigger('reloadGrid');
|
|
662
|
+ }
|
|
663
|
+ };
|
|
664
|
+ if (itp_fn_check_grid_is_writing(VSETTMNG01010_DETAIL_GRID_ID)) {
|
|
665
|
+ itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, VSETTMNG01010_DETAIL_GRID_ID);
|
|
666
|
+ return 'stop';
|
|
667
|
+ } else {
|
|
668
|
+ itp_fn_grid_paging(VSETTMNG01010_DETAIL_GRID_ID, action, param);
|
|
669
|
+ }
|
|
670
|
+ },
|
|
671
|
+ onSortCol: function(index, columnIndex, sortOrder) {
|
|
672
|
+ var sortingFn = {
|
|
673
|
+ callBack: function(args) {
|
|
674
|
+ $(args).trigger('reloadGrid');
|
|
675
|
+ }
|
|
676
|
+ };
|
|
677
|
+ if (itp_fn_check_grid_is_writing(VSETTMNG01010_DETAIL_GRID_ID)) {
|
|
678
|
+ itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, VSETTMNG01010_DETAIL_GRID_ID);
|
|
679
|
+ return 'stop';
|
|
680
|
+ } else {
|
|
681
|
+ itp_fn_grid_sorting(VSETTMNG01010_DETAIL_GRID_ID, index, sortOrder);
|
|
682
|
+ }
|
|
683
|
+ }
|
|
684
|
+ };
|
|
685
|
+ itp_fn_grid_make_remote(option);
|
|
686
|
+ },
|
|
687
|
+ clearData : function() {
|
|
688
|
+ $(VSETTMNG01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
|
|
689
|
+ $(VSETTMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
690
|
+ $(VSETTMNG01010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
691
|
+ $(VSETTMNG01010_DETAIL_GRID_EMPTY).show();
|
|
692
|
+ },
|
|
693
|
+ unload : function() {
|
|
694
|
+ $.jgrid.gridUnload(VSETTMNG01010_DETAIL_GRID_ID);
|
|
695
|
+ }
|
|
696
|
+ }
|
|
697
|
+};
|