1
|
Ext.define('MinovaES.view.logistic.documentlogistic', {
|
2
|
extend: 'Ext.panel.Panel',
|
3
|
alias: 'widget.documentlogistic',
|
4
|
requires: [
|
5
|
'MinovaES.controller.logistic.documentlogistic',
|
6
|
'Ext.grid.*',
|
7
|
'Ext.data.*',
|
8
|
'Ext.util.*'
|
9
|
],
|
10
|
controller: 'documentlogistic',
|
11
|
renderTo: 'panel-extjs',
|
12
|
anchor: '100%',
|
13
|
bodyPadding: 0,
|
14
|
margin: '0 3 15 0',
|
15
|
name: 'FiloDocMain',
|
16
|
initComponent: function () {
|
17
|
var me = this;
|
18
|
var nowDate = MinovaUtil.GetNowDate();
|
19
|
var menuid = MinovaUtil.GetMenuID();
|
20
|
var langid = MinovaUtil.GetLangID();
|
21
|
var title = undefined;
|
22
|
var table = undefined;
|
23
|
var tableItem = undefined;
|
24
|
var module = undefined;
|
25
|
var doctype = undefined;
|
26
|
var tableSelect = undefined;
|
27
|
Ext.Ajax.request({
|
28
|
async: false,
|
29
|
method: 'POST',
|
30
|
url: '/UserControl/GetStore',
|
31
|
params: {
|
32
|
tableName: 'SMENU',
|
33
|
param: 'MenuID[=]' + menuid
|
34
|
},
|
35
|
success: function (response) {
|
36
|
var results = Ext.decode(response.responseText);
|
37
|
if (results.data.length > 0) {
|
38
|
tableSelect = results.data[0].TableName;
|
39
|
}
|
40
|
}
|
41
|
});
|
42
|
Ext.Ajax.request({
|
43
|
async: false,
|
44
|
method: 'POST',
|
45
|
url: '/UserControl/GetStore',
|
46
|
params: {
|
47
|
tableName: 'PCMEPMODULETYPE',
|
48
|
param: 'MenuID[=]' + menuid
|
49
|
},
|
50
|
success: function (response) {
|
51
|
var results = Ext.decode(response.responseText);
|
52
|
if (results.data.length > 0) {
|
53
|
module = results.data[0].ModuleType;
|
54
|
doctype = results.data[0].ModuleItem;
|
55
|
}
|
56
|
}
|
57
|
});
|
58
|
Ext.Ajax.request({
|
59
|
async: false,
|
60
|
method: 'POST',
|
61
|
url: '/UserControl/GetStore',
|
62
|
params: {
|
63
|
tableName: 'PCMBSTRANSHEADER',
|
64
|
param: 'TransType[=]' + module
|
65
|
},
|
66
|
success: function (response) {
|
67
|
var results = Ext.decode(response.responseText);
|
68
|
if (results.data.length > 0) {
|
69
|
table = results.data[0].TableName;
|
70
|
}
|
71
|
}
|
72
|
});
|
73
|
Ext.Ajax.request({
|
74
|
async: false,
|
75
|
method: 'POST',
|
76
|
url: '/UserControl/GetStore',
|
77
|
params: {
|
78
|
tableName: 'PCMBSTRANSLIST',
|
79
|
param: "TransType[=]" + module + ",Sequence[=]1"
|
80
|
},
|
81
|
success: function (response) {
|
82
|
var results = Ext.decode(response.responseText);
|
83
|
if (results.data.length > 0) {
|
84
|
tableItem = results.data[0].TableName;
|
85
|
}
|
86
|
}
|
87
|
});
|
88
|
|
89
|
var paramitem_ = undefined; // add GICU draft
|
90
|
if(menuid == 'GICU2')
|
91
|
{
|
92
|
paramitem_ = "DocType[=]" + doctype + ",DocStatus[=]1" ;
|
93
|
}
|
94
|
else if(menuid == 'PURCHDEMANDFORGOODS') // Permintaan Barang
|
95
|
{
|
96
|
paramitem_ = "DocType[=]" + doctype + ",DocStatus[=]2" ;
|
97
|
}
|
98
|
else if(menuid == 'PURCHREQUISITIONDRAFT') // pr draft
|
99
|
{
|
100
|
paramitem_ = "DocType[=]" + doctype + ",DocStatus[=]1" ;
|
101
|
}
|
102
|
else if(menuid == 'SALESINQDRAFT') // sinq draft
|
103
|
{
|
104
|
paramitem_ = "DocType[=]" + doctype + ",DocStatus[<>]8" ;
|
105
|
}
|
106
|
else if(menuid == 'SALESORDERDRAFT') // sord draft
|
107
|
{
|
108
|
paramitem_ = "DocType[=]" + doctype + ",DocStatus[<>]8" ;
|
109
|
}
|
110
|
else if(menuid == 'SALESQUOTADRAFT') // squo draft
|
111
|
{
|
112
|
paramitem_ = "DocType[=]" + doctype + ",DocStatus[<>]5" ;
|
113
|
}
|
114
|
else
|
115
|
{
|
116
|
paramitem_ = "DocType[=]" + doctype;
|
117
|
}
|
118
|
|
119
|
var hidebutton = false; // add action menu Tri nwh
|
120
|
if(MinovaUtil.GetActionMenu() == "0")
|
121
|
{
|
122
|
hidebutton = true ;
|
123
|
}
|
124
|
|
125
|
Ext.applyIf(me, {
|
126
|
items: [{
|
127
|
xtype: 'panel',
|
128
|
name: 'DocSelectionJoil',
|
129
|
items: [{
|
130
|
xtype: 'minovaform',
|
131
|
name: 'searchFilter',
|
132
|
tableName: tableSelect,
|
133
|
param: "DocType[=]" + doctype,
|
134
|
title: 'Filter',
|
135
|
bodyPadding:20,
|
136
|
collapsible: true,
|
137
|
isLookup: true,
|
138
|
buttons: [{
|
139
|
text: 'Search',
|
140
|
//filterParam: "DocType[=]" + doctype,
|
141
|
listeners: {
|
142
|
click: function () {
|
143
|
var store = Ext.data.StoreManager.lookup('storeadvance');
|
144
|
var form = Ext.ComponentQuery.query('[name=searchFilter]')[0].getForm();
|
145
|
grid = Ext.ComponentQuery.query('[name=searchResult]')[0];
|
146
|
var values_ = form.getValues();
|
147
|
var fields_ = form.getFields().items;
|
148
|
var param_ = '';
|
149
|
for (var i = 0; i < fields_.length; i++) {
|
150
|
var val_ = form.getFields().items[i].getValue();
|
151
|
var xtype_ = form.getFields().items[i].xtype;
|
152
|
var oprator_ = '[like]';
|
153
|
if (xtype_ == 'combobox' || xtype_ == 'combo' || xtype_ == 'minovacombo' || xtype_ == 'minovacombobox' || (xtype_ == 'datefield')) {
|
154
|
oprator_ = '[Equal]';
|
155
|
}
|
156
|
// if (xtype_ == 'datefield') {
|
157
|
// if (form.getFields().items[i].name == 'StartDate' || form.getFields().items[i].name == 'ValidForm') {
|
158
|
// oprator_ = '[LessThanEqual]';
|
159
|
// } else {
|
160
|
// oprator_ = '[GreaterThanEqual]';
|
161
|
// }
|
162
|
// }
|
163
|
if(form.getFields().items[i].name == "DocStatus" && menuid == "GICU2") // add GICU draft
|
164
|
{
|
165
|
val_ = 1;
|
166
|
}
|
167
|
if (val_ != 'undefined' && val_ != "" && val_ != null) {
|
168
|
param_ = param_ + ',' + form.getFields().items[i].name + oprator_ + val_;
|
169
|
}
|
170
|
}
|
171
|
if (this.filterParam) {
|
172
|
param_ = param_ + ',' + this.filterParam
|
173
|
}
|
174
|
store.proxy.extraParams = {
|
175
|
tableName: grid.tableName,
|
176
|
param: param_,
|
177
|
menuId: MinovaUtil.GetMenuID()
|
178
|
};
|
179
|
store.removeAll();
|
180
|
store.reload();
|
181
|
store.sort("ChangeDate", "DESC");
|
182
|
store.loadPage(1);
|
183
|
}
|
184
|
}
|
185
|
}, {
|
186
|
xtype: 'button',
|
187
|
iconCls: 'fa-plus-circle',
|
188
|
style: 'font-family: FontAwesome',
|
189
|
text: 'Create',
|
190
|
action: 'CRUDaddNewRecord',
|
191
|
name: 'CreateDoc',
|
192
|
hidden: hidebutton
|
193
|
}, {
|
194
|
xtype: 'button',
|
195
|
text: 'Create Ref',
|
196
|
name: 'CreateDocRef',
|
197
|
iconCls: 'fa-copy',
|
198
|
style: 'font-family: FontAwesome',
|
199
|
hidden: hidebutton
|
200
|
},{
|
201
|
xtype: 'button',
|
202
|
text: 'Copy',
|
203
|
name: 'CopyDocRef',
|
204
|
iconCls: 'fa-plus-circle',
|
205
|
style: 'font-family: FontAwesome',
|
206
|
hidden: hidebutton
|
207
|
}
|
208
|
]
|
209
|
}, {
|
210
|
xtype: 'minovagrid1',
|
211
|
name: 'searchResult',
|
212
|
//minHeight: 312,
|
213
|
//height: 290,
|
214
|
title: 'Result',
|
215
|
bodyPadding:20,
|
216
|
tableName: tableSelect,
|
217
|
param: paramitem_, // "DocType[=]" + doctype, // edit GICU draft
|
218
|
isLookup: true,
|
219
|
storename: 'storeadvance',
|
220
|
pagesize: 25,
|
221
|
targetField: "DocNo",
|
222
|
valueField: "",
|
223
|
hidebutton: 0,
|
224
|
isGrid: true,
|
225
|
border: 2,
|
226
|
listeners: {
|
227
|
beforeedit: function () {
|
228
|
return false;
|
229
|
}
|
230
|
},
|
231
|
dockedItems: [{
|
232
|
xtype: 'pagingtoolbar',
|
233
|
store: 'storeadvance',
|
234
|
dock: 'bottom',
|
235
|
displayInfo: true
|
236
|
}
|
237
|
]
|
238
|
}, {
|
239
|
xtype: 'minovagrid1',
|
240
|
name: 'searchResultInfo',
|
241
|
hidden: true,
|
242
|
minHeight: 312,
|
243
|
height: 290,
|
244
|
tableName: 'PTRPURCHITEM',
|
245
|
param: "",
|
246
|
storename: 'storeadvance2',
|
247
|
pagesize: 99999999,
|
248
|
targetField: "DocNo",
|
249
|
valueField: "",
|
250
|
hidebutton: 0,
|
251
|
isGrid: true,
|
252
|
margin: '0 0 20 0'
|
253
|
}
|
254
|
]
|
255
|
}, {
|
256
|
xtype: 'panel',
|
257
|
name: 'DocTransaction',
|
258
|
hidden: true,
|
259
|
items: [{
|
260
|
xtype: 'panel',
|
261
|
title: 'Document Header',
|
262
|
collapsible: true,
|
263
|
//height: 250,
|
264
|
bodyPadding:20,
|
265
|
items: [{
|
266
|
xtype: 'minovadocform',
|
267
|
name: 'MainHeaderDocument',
|
268
|
tableName: table,
|
269
|
docType: doctype,
|
270
|
transType: module,
|
271
|
//height: 200,
|
272
|
autoScroll: true
|
273
|
}, {
|
274
|
xtype: 'minovadocform',
|
275
|
name: 'DisplayMainHeaderDocument',
|
276
|
tableName: table,
|
277
|
docType: doctype,
|
278
|
transType: module,
|
279
|
// isDisplay: true,
|
280
|
// hidden: true,
|
281
|
//height: 200,
|
282
|
autoScroll: true
|
283
|
}
|
284
|
]
|
285
|
}, {
|
286
|
xtype: 'panel',
|
287
|
title: 'Document Detail',
|
288
|
bodyPadding:10,
|
289
|
name: 'MainItemDocument',
|
290
|
buttons: [{
|
291
|
xtype: 'button',
|
292
|
text: 'Save & Create New',
|
293
|
name: 'SaveCreateDoc',
|
294
|
iconCls: 'fa-save',
|
295
|
style: 'font-family: FontAwesome',
|
296
|
hidden:true
|
297
|
}, {
|
298
|
xtype: 'button',
|
299
|
text: 'Create',
|
300
|
name: 'Create1Doc',
|
301
|
iconCls: 'fa-plus-circle',
|
302
|
style: 'font-family: FontAwesome',
|
303
|
hidden:true
|
304
|
}, {
|
305
|
xtype: 'button',
|
306
|
text: 'Save & Create Ref',
|
307
|
name: 'SaveCreateDocRef',
|
308
|
iconCls: 'fa-save',
|
309
|
style: 'font-family: FontAwesome',
|
310
|
hidden:true
|
311
|
}, {
|
312
|
xtype: 'button',
|
313
|
text: 'Create Ref',
|
314
|
name: 'Create1DocRef',
|
315
|
iconCls: 'fa-copy',
|
316
|
style: 'font-family: FontAwesome',
|
317
|
hidden:true
|
318
|
}, {
|
319
|
xtype: 'button',
|
320
|
text: 'Save',
|
321
|
name: 'SaveDoc',
|
322
|
iconCls: 'fa-save',
|
323
|
style: 'font-family: FontAwesome'
|
324
|
}, {
|
325
|
xtype: 'button',
|
326
|
text: 'Save Copy',
|
327
|
name: 'SaveCopyDoc',
|
328
|
iconCls: 'fa-save',
|
329
|
hidden: true,
|
330
|
style: 'font-family: FontAwesome'
|
331
|
},
|
332
|
{
|
333
|
xtype: 'button',
|
334
|
text: 'Post',
|
335
|
name: 'PostDoc',
|
336
|
hidden: true,
|
337
|
iconCls: 'fa-eye',
|
338
|
style: 'font-family: FontAwesome',
|
339
|
hidden:true
|
340
|
}, {
|
341
|
xtype: 'button',
|
342
|
text: 'Edit',
|
343
|
name: 'EditDoc',
|
344
|
iconCls: 'fa-edit',
|
345
|
style: 'font-family: FontAwesome'
|
346
|
}, {
|
347
|
xtype: 'button',
|
348
|
text: 'Delete',
|
349
|
name: 'DeleteDoc',
|
350
|
hidden: true,
|
351
|
iconCls: 'fa-trash-o',
|
352
|
style: 'font-family: FontAwesome'
|
353
|
}, {
|
354
|
xtype: 'button',
|
355
|
text: 'Cancel',
|
356
|
name: 'CancelDoc',
|
357
|
iconCls: 'fa-reply',
|
358
|
style: 'font-family: FontAwesome'
|
359
|
}
|
360
|
],
|
361
|
items: [{
|
362
|
xtype: 'doctablist',
|
363
|
transType: module,
|
364
|
docType: doctype,
|
365
|
langId: langid
|
366
|
},{
|
367
|
xtype:'displayfield',
|
368
|
//value:'1',
|
369
|
name:'totalitem',
|
370
|
id:'totalitem',
|
371
|
margin:'0 0 0 8',
|
372
|
//value:'2',
|
373
|
//readOnly:true,
|
374
|
fieldLabel:'Total Item',
|
375
|
}
|
376
|
]
|
377
|
}
|
378
|
]
|
379
|
}
|
380
|
]
|
381
|
});
|
382
|
me.callParent(arguments);
|
383
|
}
|
384
|
});
|
385
|
|
386
|
//# sourceURL=https://remote.minovais.com:31133/app/view/filo/document.js
|