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