-
Notifications
You must be signed in to change notification settings - Fork 0
/
f01_AnaForm.~pas
365 lines (331 loc) · 11.6 KB
/
f01_AnaForm.~pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
unit f01_AnaForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, ComCtrls, Menus, ImgList, StdCtrls, DBCtrls,
rvNavigator, ToolWin, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner,
FR_Class,ShellAPI, dxDBEdtr, dxDBELib, dxEditor, dxEdLib, dxDBTLCl,
dxGrClms, dxGrClEx, dxLayout, DB, IBCustomDataSet, IBQuery, Buttons;
type
Tf01_MainForm = class(TForm)
Panel1: TPanel;
GridSaveDialog: TSaveDialog;
GridPopupMenu: TPopupMenu;
SaveGridToXLS1: TMenuItem;
mTabloyuHtmlKaydet1: TMenuItem;
mTabloyuXMLXMLkaydet1: TMenuItem;
SeilikaytlarExcelXLSkaydet1: TMenuItem;
ExpandAll1: TMenuItem;
CollapseAll1: TMenuItem;
StatusBar: TStatusBar;
Timer1: TTimer;
AnaNavImgList: TImageList;
MainMenu1: TMainMenu;
H_ARI: TMenuItem;
MI_Tanimlamalar: TMenuItem;
MI_Avans: TMenuItem;
N1: TMenuItem;
Programdank1: TMenuItem;
Yardm1: TMenuItem;
Yardm2: TMenuItem;
Hakknda1: TMenuItem;
frReport: TfrReport;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
AnaNav: TrvNavigator;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
Panel2: TPanel;
Label4: TLabel;
Label3: TLabel;
Label2: TLabel;
DBText1: TDBText;
Label8: TLabel;
EditUYESOYAD: TdxDBEdit;
dxDBDateEdit1: TdxDBDateEdit;
EkipKodLE: TdxDBLookupEdit;
Splitter1: TSplitter;
Panel3: TPanel;
Panel4: TPanel;
HARCAMA_DBGrid: TdxDBGrid;
HARCAMA_DBGridHARCAMALAR_KOD: TdxDBGridMaskColumn;
HARCAMA_DBGridHARCAMALAR_FISKOD: TdxDBGridMaskColumn;
HARCAMA_DBGridHARCAMALAR_MIKTAR: TdxDBGridMaskColumn;
HARCAMA_DBGridHARCAMALAR_TARIH: TdxDBGridDateColumn;
HARCAMA_DBGridHARCAMALAR_ACIKLAMA: TdxDBGridMaskColumn;
ToolBar2: TToolBar;
rvNavigator1: TrvNavigator;
Panel5: TPanel;
Panel6: TPanel;
ToolBar3: TToolBar;
rvNavigator2: TrvNavigator;
HARCIRAH_DBGrid: TdxDBGrid;
dxDBGridLayoutList1: TdxDBGridLayoutList;
dxDBGridLayoutList1Item_MASRAFKODU: TdxDBGridLayout;
HARCAMA_DBGridHARCAMALAR_MASRAFKODU: TdxDBGridExtLookupColumn;
HARCIRAH_DBGridHARCIRAH_BASLANGICDATE: TdxDBGridDateColumn;
HARCIRAH_DBGridHARCIRAH_BITISDATE: TdxDBGridDateColumn;
HARCIRAH_DBGridHARCIRAH_FISKOD: TdxDBGridMaskColumn;
HARCIRAH_DBGridHARCIRAH_GUNLUKBEDEL: TdxDBGridColumn;
HARCIRAH_DBGridHARCIRAH_KOD: TdxDBGridMaskColumn;
dxDBGridLayoutList1Item_PERSONEL: TdxDBGridLayout;
HARCIRAH_DBGridHARCIRAH_PERSONELKODU: TdxDBGridExtLookupColumn;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
EKIPADD_IBQuery: TIBQuery;
EKIPADD_IBQueryPERSONELKOD: TIntegerField;
EKIPADD_IBQueryPERSONELADSOYAD: TIBStringField;
ToolButton9: TToolButton;
ToolButton11: TToolButton;
HARCIRAH_DBGridPERSONELADSOYAD: TdxDBGridMaskColumn;
HARCIRAH_DBGridGUNSAYISI: TdxDBGridMaskColumn;
HARCIRAH_DBGridTOPLAM: TdxDBGridColumn;
HARCAMA_DBGridMASRAFAD: TdxDBGridMaskColumn;
Panel7: TPanel;
ToolButton12: TToolButton;
ToolButton13: TToolButton;
Panel8: TPanel;
FisButton: TBitBtn;
H_Raporlar: TMenuItem;
N2: TMenuItem;
MI_MasraflarTablosu: TMenuItem;
ToolButton14: TToolButton;
ToolButton15: TToolButton;
Label1: TLabel;
EkipKod_LE: TdxDBLookupEdit;
MI_DinamikRaporlar: TMenuItem;
ToolButton16: TToolButton;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure GridPopUpClick(Sender: TObject);
procedure GridSave(Sender:TObject; DefExtStr : string);
procedure CollapseAll1Click(Sender: TObject);
procedure ExpandAll1Click(Sender: TObject);
procedure MI_TanimlamalarClick(Sender: TObject);
procedure MI_AvansClick(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure FisButtonClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Programdank1Click(Sender: TObject);
procedure MI_MasraflarTablosuClick(Sender: TObject);
procedure EkipKod_LEDropDown(Sender: TObject);
procedure MI_DinamikRaporlarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
WPath: String;
procedure MyIdleHandler(Sender: TObject; var Done: Boolean);
procedure DisplayHint(Sender: TObject);
procedure dxDBGridBackgroundDrawEvent(Sender: TObject; ACanvas: TCanvas; ARect: TRect);
procedure AddEkipToListe (EkipKodP : string; BAS,BIT : TDateTime; Gunluk : string);
end;
var
f01_MainForm: Tf01_MainForm;
implementation
uses MainDef, ARI_DataModule, f04_secenekler, f12_InfoDialog, f05_Avanslar,
f07_EkipSec, f08_MasrafTablo, f06_DinamikRaporlar;
{$R *.dfm}
procedure Tf01_MainForm.DisplayHint(Sender: TObject);
begin
StatusBar.Panels[1].Text := GetLongHint(Application.Hint);
end;
procedure Tf01_MainForm.MyIdleHandler(Sender: TObject; var Done: Boolean);
begin
// KomutState := Pasif;
end;
procedure Tf01_MainForm.FormCreate(Sender: TObject);
begin
Application.OnHint := DisplayHint;
Application.OnIdle:= MyIdleHandler;
Caption := ProgramBilgi;
if FileExists('FR_tur_tanz.dll') then
frLocale.LoadDll('FR_tur_tanz.dll')
else ShowMessage('EKSIK DLL UYARISI = Yazilimin rapor Turkce destegini kullanamiyorsunuz (h1098)');
end;
procedure Tf01_MainForm.Timer1Timer(Sender: TObject);
begin
if StatusBar <> nil then
if StatusBar.Visible then
StatusBar.Panels[0].Text := DateTimeToStr(Now);
end;
procedure Tf01_MainForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if Application.MessageBox('Programdan çýkmak istiyormusunuz?',
'Programdan CIKIS',mb_OKCancel) = idOK then
begin
end else Action := caNone;
end;
procedure Tf01_MainForm.ExpandAll1Click(Sender: TObject);
begin
with GridPopupMenu do
begin
if (PopUpComponent is TdxDBGrid) then
begin
TDxDBGrid(PopUpComponent).FullExpand;
end;
end;
end;
procedure Tf01_MainForm.CollapseAll1Click(Sender: TObject);
begin
with GridPopupMenu do
begin
if (PopUpComponent is TdxDBGrid) then
begin
TDxDBGrid(PopUpComponent).FullCollapse;
end;
end;
end;
procedure Tf01_MainForm.GridSave(Sender:TObject; DefExtStr : string);
begin
with GridPopupMenu do
begin
if (PopUpComponent is TdxDBGrid) then
begin
GridSaveDialog.DefaultExt := DefExtStr;
if DefExtStr = 'XLS' then GridSaveDialog.FilterIndex := 2 else
if DefExtStr = 'HTM' then GridSaveDialog.FilterIndex := 3 else
if DefExtStr = 'XML' then GridSaveDialog.FilterIndex := 4 else
GridSaveDialog.FilterIndex := 1;
end;
if GridSaveDialog.Execute then
begin
if DefExtStr = 'XLS' then
begin
TdxDBGrid(PopUpComponent).SaveToXLS(GridSaveDialog.FileName,true);
ShellExecute(Handle, 'open', PChar('excel'), PChar('"'+GridSaveDialog.FileName+'"'), nil, SW_SHOW);
end else
if DefExtStr = 'HTM' then
begin
TdxDBGrid(PopUpComponent).SaveToHTML(GridSaveDialog.FileName,true);
ShellExecute(Handle, 'open', PChar('iexplore'), PChar(GridSaveDialog.FileName), nil, SW_SHOW);
end else
if DefExtStr = 'XML' then
begin
TdxDBGrid(PopUpComponent).SaveToXML(GridSaveDialog.FileName,true);
ShellExecute(Handle, 'open', PChar('iexplore'), PChar(GridSaveDialog.FileName), nil, SW_SHOW);
end else ShowMessage('Kayýt hatasý Hata Kodu=12234K');
// ShowMessage(Format('Seçilen Tablo %s dosyasýna kayýt edildi',[GridSaveDialog.FileName]));
end;
end;
end;
procedure Tf01_MainForm.GridPopUpClick(Sender: TObject);
begin
case (Sender as TMenuItem).Tag of
1: GridSave(Sender, 'XLS');
2: GridSave(Sender, 'HTM');
3: GridSave(Sender, 'XML');
end;
end;
procedure Tf01_MainForm.dxDBGridBackgroundDrawEvent(Sender: TObject;
ACanvas: TCanvas; ARect: TRect);
var
Text : String;
begin
with ACanvas do
begin
Brush.Color := clBtnShadow;
FillRect(ARect);
if (Sender as TdxDBGrid).GroupColumnCount = 0 then
begin
Font.Color := clBtnFace;
Text := 'Gruplandýrmak istediðiniz kolonu buraya sürükleyiniz.'{sdxPanelText};
TextOut(ARect.Left+5, ARect.Top+5, Text);
end;
end;
end;
procedure Tf01_MainForm.MI_TanimlamalarClick(Sender: TObject);
begin
InformationDialog.Show;
if f04_SeceneklerForm = nil then f04_SeceneklerForm := Tf04_SeceneklerForm.Create(self);
f04_SeceneklerForm.Show;
InformationDialog.Hide;
end;
procedure Tf01_MainForm.MI_AvansClick(Sender: TObject);
begin
InformationDialog.Show;
if f05_AvanslarForm = nil then f05_AvanslarForm := Tf05_AvanslarForm.Create(self);
f05_AvanslarForm.Show;
InformationDialog.Hide;
end;
procedure Tf01_MainForm.AddEkipToListe (EkipKodP : string; BAS,BIT : TDateTime; Gunluk : string);
var I : Integer;
begin
if ARI_DM.HARCIRAHLAR_IBDataSet.State in [dsBrowse] then
begin
EKIPADD_IBQuery.Close;
EKIPADD_IBQuery.ParamByName('KOD').AsString := EkipKodP;
EKIPADD_IBQuery.Open;
EKIPADD_IBQuery.First;
while not EKIPADD_IBQuery.Eof do
begin
Application.ProcessMessages;
ARI_DM.HARCIRAHLAR_IBDataSet.Insert;
ARI_DM.HARCIRAHLAR_IBDataSetHARCIRAH_BASLANGICDATE.AsDateTime := BAS;
ARI_DM.HARCIRAHLAR_IBDataSetHARCIRAH_BITISDATE.AsDateTime := BIT;
ARI_DM.HARCIRAHLAR_IBDataSetHARCIRAH_GUNLUKBEDEL.AsString := Gunluk;
ARI_DM.HARCIRAHLAR_IBDataSetHARCIRAH_PERSONELKODU.AsInteger := EKIPADD_IBQueryPERSONELKOD.AsInteger;
ARI_DM.HARCIRAHLAR_IBDataSet.Post;
EKIPADD_IBQuery.Next;
end;
end else ShowMessage('Gerceklestirmekte olduðunuz yeni kayit/ duzeltme islemini tamamlayiniz');
end;
procedure Tf01_MainForm.ToolButton7Click(Sender: TObject);
begin
if not (ARI_DM.FIS_IBDataSet.State in [dsInsert]) then
begin
if f07_EkipSecForm= nil then f07_EkipSecForm.Create(self);
f07_EkipSecForm.ShowModal;
InformationDialog.Show;
AddEkipToListe(f07_EkipSecForm.SecilenEkip,
f07_EkipSecForm.BASLA,
f07_EkipSecForm.BITIS,
f07_EkipSecForm.GunlukBedel);
InformationDialog.Hide;
end else ShowMessage('Oncelikle Fis kaydini tamamlayiniz...');
end;
procedure Tf01_MainForm.FisButtonClick(Sender: TObject);
var RapName : string;
begin
RapName := '001_FIS_RAPORU.frf';
with frReport do
begin
if LoadFromFile(WPath + RapName) then
begin
Dictionary.Variables['FISNO'] := ARI_DM.FIS_IBDataSetFIS_KOD.AsString;
ShowReport;
end
else ShowMessage(RapName + ' adlý rapor dosyasý bulunamadi...');
end;
end;
procedure Tf01_MainForm.FormShow(Sender: TObject);
begin
WPath := ExtractFilePath(ParamStr(0));
end;
procedure Tf01_MainForm.Programdank1Click(Sender: TObject);
begin
Close;
end;
procedure Tf01_MainForm.MI_MasraflarTablosuClick(Sender: TObject);
begin
InformationDialog.Show;
if f08_MasrafTabloForm = nil then f08_MasrafTabloForm.Create(self);
f08_MasrafTabloForm.Show;
InformationDialog.Hide;
end;
procedure Tf01_MainForm.EkipKod_LEDropDown(Sender: TObject);
begin
ARI_DM.EKIPLIST_IBQuery.Close;
ARI_DM.EKIPLIST_IBQuery.Open;
end;
procedure Tf01_MainForm.MI_DinamikRaporlarClick(Sender: TObject);
begin
if f06_DinamikRaporlarForm = nil then f06_DinamikRaporlarForm := Tf06_DinamikRaporlarForm.Create(self);
f06_DinamikRaporlarForm.Show;
end;
end.