1
|
// frm.getForm().submit({
|
2
|
// url: '/Devt/ExportMasterData',
|
3
|
// method: "POST",
|
4
|
// success: function (param, response) {
|
5
|
// if (response.result.success) {
|
6
|
// var href = '/Devt/DownloadFileExcel?filename=' + TableName.getValue();
|
7
|
// top.location = href;
|
8
|
// MinovaMessage('', 'EXPORTMD', '', 'S');
|
9
|
// frm.setDisabled(false);
|
10
|
// } else {
|
11
|
// MinovaMessage('', '000005', 'Error Export', "E");
|
12
|
// frm.setDisabled(false);
|
13
|
// }
|
14
|
|
15
|
// },
|
16
|
// failure: function (param, response) {
|
17
|
// var result = Ext.decode(response.responseText);
|
18
|
// MinovaMessage('', '000005', result.message.text, "E");
|
19
|
// frm.setDisabled(false);
|
20
|
// }
|
21
|
// });
|
22
|
Ext.define('MinovaES.controller.masterdata.CtrlExportMD', {
|
23
|
extend: 'Ext.app.ViewController',
|
24
|
alias: 'controller.CtrlExportMD',
|
25
|
init: function () {
|
26
|
this.control({
|
27
|
'button[name=DownloadTemplat]': {
|
28
|
click: this.DownloadTemplate
|
29
|
},
|
30
|
'button[name=Export]': {
|
31
|
click: this.ExportExcel
|
32
|
},
|
33
|
'[name=ExportMasterData]': {
|
34
|
afterrender: this.afterrenderMain
|
35
|
},
|
36
|
});
|
37
|
},
|
38
|
afterrenderMain: function(){
|
39
|
Ext.ComponentQuery.query('[name=empStart]')[0].allowBlank = true;
|
40
|
Ext.ComponentQuery.query('[name=empEnd]')[0].allowBlank = true;
|
41
|
|
42
|
},
|
43
|
DownloadTemplate: function () {
|
44
|
var frm = Ext.ComponentQuery.query('form[name=ExportMasterData]')[0];
|
45
|
f = frm.getValues();
|
46
|
var TableName = Ext.ComponentQuery.query('[name=Table]')[0];
|
47
|
var isContent = Ext.ComponentQuery.query('[name=isContent]')[0];
|
48
|
isContent.setValue('0');
|
49
|
frm.setDisabled(true);
|
50
|
// frm.getForm().submit({
|
51
|
// url: '/Devt/ExportMasterData',
|
52
|
// method: "POST",
|
53
|
// success: function (param, response) {
|
54
|
// if (response.result.success) {
|
55
|
// var href = '/Devt/DownloadFileExcel?filename=' + TableName.getValue();
|
56
|
// top.location = href;
|
57
|
// MinovaMessage('', 'EXPORTMD', '', 'S');
|
58
|
// frm.setDisabled(false);
|
59
|
// } else {
|
60
|
// MinovaMessage('', '000005', 'Error Export', "E");
|
61
|
// frm.setDisabled(false);
|
62
|
// }
|
63
|
|
64
|
// },
|
65
|
// failure: function (param, response) {
|
66
|
// var result = Ext.decode(response.responseText);
|
67
|
// MinovaMessage('', '000005', result.message.text, "E");
|
68
|
// frm.setDisabled(false);
|
69
|
// }
|
70
|
// });
|
71
|
|
72
|
if(TableName.getValue() !="PHRPA0001" && TableName.getValue() !="PHRPA0016"){
|
73
|
var results = null;
|
74
|
Ext.Ajax.request({
|
75
|
method : 'POST',
|
76
|
async: false,
|
77
|
url: '/Devt/ExportMasterData',
|
78
|
params: {
|
79
|
Module: f.Module,
|
80
|
Table: f.Table,
|
81
|
ChangeBy: f.ChangeBy,
|
82
|
CreateBy: f.CreateBy,
|
83
|
changeEnd: f.changeEnd,
|
84
|
changeSt: f.changeSt,
|
85
|
createEnd: f.changeEnd,
|
86
|
createSt: f.createSt,
|
87
|
empEnd: f.empEnd,
|
88
|
empStart: f.empStart,
|
89
|
periodEnd: f.periodEnd,
|
90
|
periodSt: f.periodSt,
|
91
|
isContent: '0'
|
92
|
},
|
93
|
|
94
|
success: function (response)
|
95
|
{
|
96
|
results = Ext.decode(response.responseText);
|
97
|
if (results.success) {
|
98
|
var href = '/Devt/DownloadFileExcel?filename=' + TableName.getValue();
|
99
|
top.location = href;
|
100
|
MinovaMessage('', 'EXPORTMD', '', 'S');
|
101
|
frm.setDisabled(false);
|
102
|
} else {
|
103
|
MinovaMessage('', '000005', 'Error Export', "E");
|
104
|
frm.setDisabled(false);
|
105
|
}
|
106
|
|
107
|
},
|
108
|
failure: function (param, response) {
|
109
|
var result = Ext.decode(response.responseText);
|
110
|
MinovaMessage('', '000005', result.message.text, "E");
|
111
|
frm.setDisabled(false);
|
112
|
}
|
113
|
});
|
114
|
} else {
|
115
|
var href = '/Devt/DownloadFileExcel?filename=' + TableName.getValue();
|
116
|
top.location = href;
|
117
|
MinovaMessage('', 'EXPORTMD', '', 'S');
|
118
|
frm.setDisabled(false);
|
119
|
}
|
120
|
|
121
|
|
122
|
},
|
123
|
ExportExcel: function () {
|
124
|
var frm = Ext.ComponentQuery.query('form[name=ExportMasterData]')[0];
|
125
|
var TableName = Ext.ComponentQuery.query('[name=Table]')[0];
|
126
|
var isContent = Ext.ComponentQuery.query('[name=isContent]')[0];
|
127
|
f = frm.getValues();
|
128
|
frm.setDisabled(true);
|
129
|
isContent.setValue('1');
|
130
|
var me = this;
|
131
|
if (frm.getForm().isValid()) {
|
132
|
var params = {
|
133
|
serviceName : 'Element.asmx',
|
134
|
methodName : 'ExportMD',
|
135
|
parameter : 'tableName=' + f.Table
|
136
|
+ '&periodSt=' + f.periodSt
|
137
|
+ '&periodEnd=' + f.periodEnd
|
138
|
+ '&empStart=' + f.empStart
|
139
|
+ '&empEnd=' + f.empEnd
|
140
|
+ '&createBy=' + f.CreateBy
|
141
|
+ '&createSt=' + f.createSt
|
142
|
+ '&createEnd=' + f.changeEnd
|
143
|
+ '&changeBy=' + f.ChangeBy
|
144
|
+ '&changeSt=' + f.changeSt
|
145
|
+ '&changeEnd=' + f.changeEnd
|
146
|
+ '&content=' + true
|
147
|
+ '&OutputType=' + ''
|
148
|
+ '&Token=' + MinovaUtil.SESSIONS.Token
|
149
|
};
|
150
|
MinovaAjaxPost('/InvokeService/Invoke/', params, function (xhr) {
|
151
|
result = Ext.decode(xhr.responseText);
|
152
|
if (result.success) {
|
153
|
var href = '/Devt/DownloadFileExcelNew?Path=' + result.data + '&Tablename=' + f.Table;
|
154
|
top.location = href;
|
155
|
MinovaMessage('', 'EXPORTMD', '', 'S');
|
156
|
frm.setDisabled(false);
|
157
|
MinovaMessage('Not Null', '000006', '', 'S');
|
158
|
me.displayData(a, b, c);
|
159
|
} else {
|
160
|
MinovaMessage('', '000005', result.message.text, 'E');
|
161
|
}
|
162
|
});
|
163
|
}
|
164
|
|
165
|
}
|
166
|
});
|