-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUMasterForm.pas
1328 lines (1197 loc) · 38.4 KB
/
UMasterForm.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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit UMasterForm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, rxdbgrid, Forms, Controls, Graphics, Dialogs,
ComCtrls, Menus, windows, ExtCtrls, StdCtrls, ActnList, rxdbutils, Grids, db,
spkt_Tab, spkt_Pane, spkt_Buttons, Types, Clipbrd, dateutils, LCLType,
LazUTF8, UAlerter, IdComponent, IdStack, BGRALabel, BCImageButton, datamodule;
type
{ TMasterForm }
TMasterForm = class(TForm)
ActionSprzetRTVWydruk: TAction;
ActionSprzetRTV: TAction;
ActionPlanWyjazdow: TAction;
ActionAlerterOpcje: TAction;
ActionPaczkiRejestr: TAction;
ActionPaczkiDodaj: TAction;
ActionKopiujWszystko: TAction;
ActionKopiujIDO: TAction;
ActionNoeNetTest: TAction;
ActionKnowHow: TAction;
ActionKreatorWPZ: TAction;
ActionZdjeciaBraki: TAction;
ActionSalaWidzen: TAction;
ActionKomunikatNowy: TAction;
ActionKartaOchronna: TAction;
ActionDodajOsobeBliska: TAction;
ActionPaczkiZwroty: TAction;
ActionNowyKoszyk: TAction;
ActionDodajDoKoszyka: TAction;
ActionKoszyk: TAction;
ActionAktualizacjaPodkultury: TAction;
ActionAddWidzenie: TAction;
ActionAddWykaz: TAction;
ActionRejestrWykazow: TAction;
ActionDrukujWykazOs: TAction;
ActionNieZatrudnieni: TAction;
ActionWydarzenia: TAction;
ActionStatystyka: TAction;
ActionKomunikatDo: TAction;
ActionZatrudnieni: TAction;
ActionKomunikator: TAction;
ActionRejestrWidzen: TAction;
ActionSkype: TAction;
ActionBezdozorowe: TAction;
Action_AdresyJednostek: TAction;
ActionKartaOsadzonego: TAction;
ActionZatrudnienieOs: TAction;
ActionStanowiska: TAction;
ActionTerminarz: TAction;
ActionProsbyOsadzonych: TAction;
ActionProsbyOsadzonego: TAction;
ActionRozmieszczenie: TAction;
BtnLogoAlarm: TBCImageButton;
BGRALabel1: TBGRALabel;
IdleTimerAntiFreeze: TIdleTimer;
Label2: TLabel;
MenuItem10: TMenuItem;
MenuItem19: TMenuItem;
MenuItem23: TMenuItem;
MenuItem26: TMenuItem;
MenuItem28: TMenuItem;
MenuItem29: TMenuItem;
MenuItem30: TMenuItem;
MenuItem31: TMenuItem;
MenuItem32: TMenuItem;
MenuItem33: TMenuItem;
MenuItem34: TMenuItem;
MenuItem35: TMenuItem;
MenuItem36: TMenuItem;
MenuItem37: TMenuItem;
MenuItem38: TMenuItem;
MenuItem39: TMenuItem;
MenuItem40: TMenuItem;
MenuItem41: TMenuItem;
MenuItem42: TMenuItem;
MenuItem43: TMenuItem;
MenuItem44: TMenuItem;
MenuItem45: TMenuItem;
MenuItem46: TMenuItem;
MenuItem47: TMenuItem;
MenuItem48: TMenuItem;
MenuItem49: TMenuItem;
MenuItem50: TMenuItem;
MenuItem51: TMenuItem;
MenuItem52: TMenuItem;
MenuItem53: TMenuItem;
MenuItem55: TMenuItem;
MenuItem59: TMenuItem;
MenuItem60: TMenuItem;
MenuItem61: TMenuItem;
MenuItem62: TMenuItem;
MenuItem63: TMenuItem;
MenuItem64: TMenuItem;
MenuItem65: TMenuItem;
MenuItem66: TMenuItem;
MenuItem67: TMenuItem;
MenuItem68: TMenuItem;
MenuItem69: TMenuItem;
MenuItem70: TMenuItem;
MenuItem71: TMenuItem;
MenuItem72: TMenuItem;
MenuItem73: TMenuItem;
MenuItem74: TMenuItem;
MenuItem75: TMenuItem;
MenuItem76: TMenuItem;
MenuItem77: TMenuItem;
MenuItem78: TMenuItem;
MenuItem79: TMenuItem;
MenuItem80: TMenuItem;
MenuItem81: TMenuItem;
MenuItemTestAlarm: TMenuItem;
MenuItemKoszykShow: TMenuItem;
MenuItem54: TMenuItem;
MenuItemDoKoszyka: TMenuItem;
MenuItem56: TMenuItem;
MenuItem57: TMenuItem;
MenuItem58: TMenuItem;
MenuItem9: TMenuItem;
Panel2: TPanel;
Panel3: TPanel;
PopupMenuAlarm: TPopupMenu;
SpkPane1: TSpkPane;
SpkPane2: TSpkPane;
SpkSmallButton1: TSpkSmallButton;
SpkSmallButton2: TSpkSmallButton;
SpkSmallButton3: TSpkSmallButton;
SpkTab1: TSpkTab;
SpkTab2: TSpkTab;
Timer2Komunikaty: TTimer;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolButton12: TToolButton;
ToolButton13: TToolButton;
ToolButton14: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
ToolButton9: TToolButton;
ZatrudnienieAdd: TAction;
ActionList1: TActionList;
Edit1: TEdit;
Image1: TImage;
Image2: TImage;
Label1: TLabel;
MainMenu1: TMainMenu;
MenuItem1: TMenuItem;
MenuItem11: TMenuItem;
MenuItem12: TMenuItem;
MenuItem13: TMenuItem;
MenuItem14: TMenuItem;
MenuItem15: TMenuItem;
MenuItem16: TMenuItem;
MenuItem17: TMenuItem;
MenuItem18: TMenuItem;
MenuItem2: TMenuItem;
MenuItem20: TMenuItem;
MenuItem21: TMenuItem;
MenuItem22: TMenuItem;
MenuItem24: TMenuItem;
MenuItem25: TMenuItem;
MenuItem27: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
MenuItem6: TMenuItem;
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
Panel1: TPanel;
PopupMenu1: TPopupMenu;
RxDBGrid1: TRxDBGrid;
StatusBar1: TStatusBar;
Timer1Wyszukaj: TTimer;
procedure ActionAddWidzenieExecute(Sender: TObject);
procedure ActionAddWykazExecute(Sender: TObject);
procedure ActionAktualizacjaPodkulturyExecute(Sender: TObject);
procedure ActionAlerterOpcjeExecute(Sender: TObject);
procedure ActionBezdozoroweExecute(Sender: TObject);
procedure ActionDodajDoKoszykaExecute(Sender: TObject);
procedure ActionDodajOsobeBliskaExecute(Sender: TObject);
procedure ActionDrukujWykazOsExecute(Sender: TObject);
procedure ActionKartaOchronnaExecute(Sender: TObject);
procedure ActionKartaOsadzonegoExecute(Sender: TObject);
procedure ActionKnowHowExecute(Sender: TObject);
procedure ActionKomunikatDoExecute(Sender: TObject);
procedure ActionKomunikatNowyExecute(Sender: TObject);
procedure ActionKomunikatorExecute(Sender: TObject);
procedure ActionKopiujIDOExecute(Sender: TObject);
procedure ActionKopiujWszystkoExecute(Sender: TObject);
procedure ActionKoszykExecute(Sender: TObject);
procedure ActionKreatorWPZExecute(Sender: TObject);
procedure ActionNieZatrudnieniExecute(Sender: TObject);
procedure ActionNoeNetTestExecute(Sender: TObject);
procedure ActionNowyKoszykExecute(Sender: TObject);
procedure ActionPaczkiDodajExecute(Sender: TObject);
procedure ActionPaczkiRejestrExecute(Sender: TObject);
procedure ActionPlanWyjazdowExecute(Sender: TObject);
procedure ActionProsbyOsadzonegoExecute(Sender: TObject);
procedure ActionProsbyOsadzonychExecute(Sender: TObject);
procedure ActionRejestrWidzenExecute(Sender: TObject);
procedure ActionRejestrWykazowExecute(Sender: TObject);
procedure ActionRozmieszczenieExecute(Sender: TObject);
procedure ActionSalaWidzenExecute(Sender: TObject);
procedure ActionSkypeExecute(Sender: TObject);
procedure ActionSprzetRTVExecute(Sender: TObject);
procedure ActionSprzetRTVWydrukExecute(Sender: TObject);
procedure ActionStanowiskaExecute(Sender: TObject);
procedure ActionStatystykaExecute(Sender: TObject);
procedure ActionTerminarzExecute(Sender: TObject);
procedure ActionWydarzeniaExecute(Sender: TObject);
procedure ActionZatrudnienieOsExecute(Sender: TObject);
procedure ActionZatrudnieniExecute(Sender: TObject);
procedure ActionZdjeciaBrakiExecute(Sender: TObject);
procedure ActionPaczkiZwrotyExecute(Sender: TObject);
procedure Action_AdresyJednostekExecute(Sender: TObject);
procedure BtnLogoAlarmClick(Sender: TObject);
procedure Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure IdleTimerAntiFreezeTimer(Sender: TObject);
procedure Image1DblClick(Sender: TObject);
procedure MenuItem26Click(Sender: TObject);
procedure MenuItem37Click(Sender: TObject);
procedure MenuItem4Click(Sender: TObject);
procedure MenuItemTestAlarmClick(Sender: TObject);
procedure PopupMenu1Popup(Sender: TObject);
procedure RxDBGrid1DataHintShow(Sender: TObject; CursorPos: TPoint;
Cell: TGridCoord; Column: TRxColumn; var HintStr: string;
var Processed: boolean);
procedure RxDBGrid1DblClick(Sender: TObject);
procedure StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
procedure Timer2KomunikatyTimer(Sender: TObject);
procedure ZatrudnienieAddExecute(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: char);
procedure FormCreate(Sender: TObject);
procedure MenuItem25Click(Sender: TObject);
procedure MenuItem3Click(Sender: TObject);
procedure MenuItem5Click(Sender: TObject);
procedure RxDBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Timer1WyszukajTimer(Sender: TObject);
private
{ private declarations }
fRecCount: integer;
hotkey_ctrl_n: ATOM; // hotkey na cały system
hotkey_ctrl_p: ATOM;
hotkey_alert : ATOM; // pause/break
ALARM: TAlerter;
AlarmPos: TPoint; // pozycja okna alarmu
procedure StatusBarRefresh(Sender: TObject; Field: TField);
procedure wm_HOTKEY(var Msg:TMessage);message WM_HOTKEY; // funkcja skrótu globalnego
procedure CreateAlarm;
procedure WczytajUstawieniaAlarmu;
procedure ShowAlert(Status: TMyRecord);
procedure ShowStatus(Status: TMyRecord);
procedure PopupMenuAlarmAddItems;
procedure PopupMenuAlarmClick(Sender: TObject);
public
{ public declarations }
isExecuteSQL: boolean;
Procedure WyborDomyslny;
Procedure RefreshUprawnienia; // odswieża aktywność kontrolek względem uprawnień
Procedure SendToKeyboard(value_Send: string; const controlKey: word = 0);
end;
var
MasterForm: TMasterForm;
const
SQLAllOsadzeni = 'SELECT * FROM osadzeni';
SQLSelectedOsadzeni = 'SELECT * FROM osadzeni WHERE (NAZWISKO LIKE :nazwisko)';
implementation
uses UZatStanowiska, UZatrudnieni, UZatAddZatrudnienie, UUprawnienia, UUpr_ZmianaHasla, URozmieszczenie,
UOchUpdPodkultury, UPenitForm, UPenitTerminarz, UAdresyJednostek, UAktualizacjaOs, UAktualizacjaRejestr,
URejestrProsbOs, URejestrProsbAll, UOknoKomunikatu, UKomunikator, UKomunikatorNowaWiad, UZatStatystyka,
UPenitWydarzenia, USaper, UZatNiezatrudnieni, UDrukWykazOsadz, UOchRejestrWykazow, UOchAddWykaz,
UOchRejestrWidzen, UOchAddWidzenie, UKoszykNowy, UKoszyk, UOchForm, UOchAddOsobeWidzenie, UZdjAktualizacjaZdjec,
UOchSalaWidzen, UPenitWPZ, UKnowHow, UPenitNoeNetTest, UOchRezerwacjaWidzen, UOchRezerwacjaSkype,
UPaczkiZwroty, UPaczkiAdd, UPaczkiRejestr, UAlerterConfig, UKwatPlanWyjazdow, UKwatSprzetRTV, UKwatSprzetRTVWydruk;
{$R *.frm}
{ TMasterForm }
procedure TMasterForm.FormCreate(Sender: TObject);
begin
fRecCount:=0;
DM.DSOsadzeni.OnDataChange:= @StatusBarRefresh;
Timer1WyszukajTimer(Sender); // inicjujemy widok osadzonych.
isExecuteSQL := true;
RefreshUprawnienia;
AlarmPos.Create(20,20);
// -------------------- dodajemy globalny skrót dla NOE :)
if (DM.isShortKeyCtrlN)and(GlobalFindAtom('OTIS_ctrl_n') = 0) then begin
hotkey_ctrl_n:= GlobalAddAtom('OTIS_ctrl_n');
RegisterHotKey(Handle, hotkey_ctrl_n, MOD_CONTROL, VK_N); // wstawia nazwisko
end;
if (DM.isShortKeyCtrlP)and(DM.Podpis<>'')and(GlobalFindAtom('OTIS_ctrl_p') = 0) then begin
hotkey_ctrl_p:= GlobalAddAtom('OTIS_ctrl_p');
RegisterHotKey(Handle, hotkey_ctrl_p, MOD_CONTROL, VK_P); // wstawia podpis jeśli jest
end;
CreateAlarm;
if (ALARM.isClientActive)and(GlobalFindAtom('OTIS_alert') = 0) then // tylko jedna instacja programu
begin
hotkey_alert:= GlobalAddAtom('OTIS_alert');
RegisterHotKey(Handle, hotkey_alert, 0, VK_PAUSE); // wywołuje alarm
end;
BtnLogoAlarm.LoadFromBitmapFile;
BtnLogoAlarm.Enabled:= ALARM.isClientActive;
if BtnLogoAlarm.Enabled then PopupMenuAlarmAddItems;
end;
procedure TMasterForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
//------------ zwalniam globalny skrót
if GlobalFindAtom('OTIS_ctrl_n') <> 0 then begin
UnregisterHotKey(Handle, hotkey_ctrl_n);
GlobalDeleteAtom(hotkey_ctrl_n);
end;
if GlobalFindAtom('OTIS_ctrl_p') <> 0 then begin
UnregisterHotKey(Handle, hotkey_ctrl_p);
GlobalDeleteAtom(hotkey_ctrl_p);
end;
if GlobalFindAtom('OTIS_alert') <> 0 then
begin
UnregisterHotKey(Handle, hotkey_alert);
GlobalDeleteAtom(hotkey_alert);
end;
FreeAndNil(ALARM);
end;
procedure TMasterForm.RefreshUprawnienia;
begin
StatusBar1.Panels[1].Text:= DM.PelnaNazwa;
StatusBar1.Panels[2].Text:= 'ver. '+wersja;
MenuItem4.Enabled := DM.uprawnienia[1]; // aktualizacja
ActionZdjeciaBraki.Enabled := DM.uprawnienia[1]; // aktualizacja zdjęć
ActionAktualizacjaPodkultury.Enabled:= DM.uprawnienia[1]; // aktualizacja podkultury;
MenuItem5.Enabled := DM.uprawnienia[8]; // admin, uprawnienia
ActionAlerterOpcje.Enabled := DM.uprawnienia[8]; // admin, uprawnienia
ZatrudnienieAdd.Enabled := DM.uprawnienia[15]; // dodaj zatrudnienie
ActionTerminarz.Enabled := (DM.Wychowawca<>'')and(DM.Dzial='Penit'); // tylko wychowawca
ActionKartaOsadzonego.Enabled:= (DM.Wychowawca<>'')and(DM.Dzial='Penit'); // tylko wychowawca
ActionWydarzenia.Enabled := (DM.Wychowawca<>'')and(DM.Dzial='Penit'); // tylko wychowawca
//ActionKartaOchronna.Enabled:= (DM.Dzial='Ochrona')or(DM.Dzial='Penit');
ActionAddWykaz.Enabled := DM.uprawnienia[4]; // dodawanie do wykazów ochronnych
ActionAddWidzenie.Enabled := DM.uprawnienia[6]; // widzenia
ActionDodajOsobeBliska.Enabled:= DM.uprawnienia[11]; // osoby bliskie
ActionSalaWidzen.Enabled := DM.uprawnienia[6]; // widzenia
ActionKreatorWPZ.Enabled := true;
ActionKnowHow.Enabled := DM.uprawnienia[8];
ActionNoeNetTest.Enabled := DM.uprawnienia[17];
ActionPlanWyjazdow.Enabled := DM.uprawnienia[20];
Timer2Komunikaty.Interval:= 1000; // możliwie szybko sprawdz pierwsze komunikaty potem ustaw nowy interwał.
end;
procedure TMasterForm.Image1DblClick(Sender: TObject);
begin
if not Assigned(SaperForm) then
begin
SaperForm:= TSaperForm.Create(Self);
SaperForm.Show;
end else
begin
SaperForm.Show;
if SaperForm.WindowState = wsMinimized then SaperForm.WindowState:= wsNormal;
end;
end;
// Rejstr Aktualizacji
procedure TMasterForm.MenuItem26Click(Sender: TObject);
begin
with TAktualizacjaRejestr.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.MenuItem37Click(Sender: TObject);
begin
with TUpr_ZmianaHasla.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.MenuItem4Click(Sender: TObject);
begin
with TAktualizacjaOs.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.MenuItemTestAlarmClick(Sender: TObject);
var myRecord: TMyRecord;
begin
myRecord.Head := MYHEADKEY;
myRecord.Kod := 0; // send
myRecord.RemoteIP := '0.0.0.0';
myRecord.RemoteUserLokalizacja:= 'Self Test';
myRecord.LocalUserName := DM.PelnaNazwa;
myRecord.LocalUserLokalizacja := 'Self Test';
myRecord.LocalUserTel := '...';
myRecord.SendTime:= Now();
ShowAlert(myRecord);
end;
//======================================================================================================================
//-------------------------------- KOSZYK ------------------------------------------------------------------------------
procedure TMasterForm.PopupMenu1Popup(Sender: TObject);
var koszyk_name: string;
begin
koszyk_name:='';
if not DM.ZQKoszyk_sl.IsEmpty then koszyk_name:= DM.ZQKoszyk_sl.FieldByName('nazwa').AsString;
if Length(koszyk_name) > 30 then
begin
koszyk_name:= copy(koszyk_name,1,30);
koszyk_name:= koszyk_name + '...';
end;
if koszyk_name='' then koszyk_name:='(nowy koszyk)';
ActionDodajDoKoszyka.Caption:= 'Dodaj do: '+koszyk_name;
end;
procedure TMasterForm.ActionDodajDoKoszykaExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
if DM.DodajDoKoszyka(DM.ZQOsadzeni.FieldByName('IDO').AsInteger) then
DM.KomunikatPopUp(Sender,'Koszyk', 'Dodano osadzonego do koszyka.', nots_Info);
end;
procedure TMasterForm.ActionDodajOsobeBliskaExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TOchAddOsobeWidzenie.Create(Self) do
begin
DodajOsobe(DM.ZQOsadzeni.FieldByName('IDO').AsInteger);
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionNowyKoszykExecute(Sender: TObject);
begin
with TKoszykNowy.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionPaczkiDodajExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TPaczkiAdd.Create(Self) do
begin
SetIDO( DM.ZQOsadzeni.FieldByName('IDO').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionPaczkiRejestrExecute(Sender: TObject);
begin
with TPaczkiRejestr.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionPlanWyjazdowExecute(Sender: TObject);
begin
with TKwatPlanWyjazdow.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKoszykExecute(Sender: TObject);
begin
with TKoszyk.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKreatorWPZExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TPenitWPZ.Create(Self) do
begin
SetIDO(DM.ZQOsadzeni.FieldByName('IDO').AsInteger);
ShowModal;
Free;
end;
end;
//======================================================================================================================
//--------------------------------END KOSZYK ---------------------------------------------------------------------------
procedure TMasterForm.MenuItem3Click(Sender: TObject);
begin
Close;
end;
procedure TMasterForm.MenuItem5Click(Sender: TObject);
begin
with TUprawnienia.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.RxDBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Char(Key) =#13 then // ENTER
begin
Key:=0;
Edit1.SetFocus;
if not isExecuteSQL then Timer1WyszukajTimer(Sender); // wymuszam reakcje timera po wcisnieciu Entera
WyborDomyslny;
end;
end;
procedure TMasterForm.Timer1WyszukajTimer(Sender: TObject);
begin
Timer1Wyszukaj.Enabled:= false;
try
with DM.ZQOsadzeni do
begin
Close;
if Edit1.Text<>'' then
begin
if Pos('-', Edit1.Text)>0 then
begin
SQL.Text:= SQLAllOsadzeni + ' WHERE (POC LIKE :poc)';
ParamByName('poc').AsString:= Edit1.Text +'%';
end else
if Pos('/', Edit1.Text)>0 then
begin
SQL.Text:= SQLAllOsadzeni + ' WHERE (POC LIKE :poc)';
ParamByName('poc').AsString:= '%'+ Edit1.Text +'%';
end else
if StrToIntDef(Edit1.Text, 0)>0 then
begin
SQL.Text:= SQLAllOsadzeni + ' WHERE (IDO LIKE :ido)';
ParamByName('ido').AsString:= Edit1.Text +'%';
end else
begin
SQL.Text:= SQLSelectedOsadzeni;
ParamByName('nazwisko').AsString:= Edit1.Text +'%';
end;
end
else
SQL.Text:= SQLAllOsadzeni;
Open;
end;
isExecuteSQL := true;
except
ShowMessage('Połączenie zostało zerwane. Zaloguj się ponownie.');
DM.Zaloguj;
end;
end;
procedure TMasterForm.WyborDomyslny;
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
//wybieramy akcję po wybraniu osadzonego
// tylko wychowawcy, Penit
if ActionKartaOsadzonego.Enabled then ActionKartaOsadzonegoExecute(Self)
else ActionKartaOchronnaExecute(Self);
end;
procedure TMasterForm.Edit1Change(Sender: TObject);
begin
Timer1Wyszukaj.Interval:= 500;
Timer1Wyszukaj.Enabled := true;
isExecuteSQL := false;
end;
// DODAJ OSADZONEGO DO ZATRUDNIENIA
procedure TMasterForm.ZatrudnienieAddExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TZatAddZatrudnienie.Create(Self) do
begin
NoweZatrudnienie(DM.ZQOsadzeni.FieldByName('ido').AsInteger);
ShowModal;
Free;
end;
end;
procedure TMasterForm.RxDBGrid1DataHintShow(Sender: TObject; CursorPos: TPoint;
Cell: TGridCoord; Column: TRxColumn; var HintStr: string;
var Processed: boolean);
var i: integer;
ZQPom: TZQueryPom;
dataUrodz: TDateTime;
begin
i:=0;
// co to za status
if Column.FieldName = 'STATUS' then
while (i <= DM.fStatusList.Count-1) do
begin
if Pos(HintStr, DM.fStatusList.Strings[i])=1 then
begin
Processed:= true;
HintStr:= DM.fStatusList.Strings[i];
Break;
end;
inc(i);
end;
// jaki wychowawca
if Column.FieldName = 'POC' then
begin
try
ZQPom:= TZQueryPom.Create(Self);
ZQPom.SQL.Text:='SELECT poc, Wychowawca FROM typ_cel WHERE poc=:poc;';
ZQPom.ParamByName('poc').AsString:= HintStr;
ZQPom.Open;
if not ZQPom.IsEmpty then
begin
Processed:= true;
HintStr:= HintStr + ' - wych. ' + ZQPom.FieldByName('Wychowawca').AsString;
end;
ZQPom.Free;
except
end;
end;
// jaki wiek
if Column.FieldName = 'URODZ' then
begin
if TryStrToDate(HintStr, dataUrodz) then
begin
HintStr:= Format('%s - lat %d',[HintStr, YearsBetween(Date, dataUrodz)]);
Processed:= true;
end;
end;
end;
procedure TMasterForm.RxDBGrid1DblClick(Sender: TObject);
begin
WyborDomyslny;
end;
procedure TMasterForm.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
var rLeft: integer;
begin
if Panel.Index=3 then
begin
rLeft:= Rect.Left + 3;
if Assigned(ALARM) then
begin
if ALARM.isSerwerActive then
begin
DM.ImageList1.Draw(StatusBar.Canvas, rLeft, Rect.Top, 49);
inc(rLeft, 20);
end;
if ALARM.isClientActive then
DM.ImageList1.Draw(StatusBar.Canvas, rLeft, Rect.Top, 50);
end;
end;
end;
procedure TMasterForm.Timer2KomunikatyTimer(Sender: TObject);
begin
Timer2Komunikaty.Enabled:=false;
if Timer2Komunikaty.Interval = 1000 then Timer2Komunikaty.Interval:= DM.TimerInterval;
OknoKomunikatu:= TOknoKomunikatu.Create(Self);
if not (OknoKomunikatu.ZQKomunikat.IsEmpty) or
not (OknoKomunikatu.ZQKomOdebrane.IsEmpty)
then OknoKomunikatu.ShowModal;
FreeAndNil(OknoKomunikatu);
Timer2Komunikaty.Enabled:=true;
end;
// Rozmieszczenie
procedure TMasterForm.ActionRozmieszczenieExecute(Sender: TObject);
begin
Rozmieszczenie:= TRozmieszczenie.Create(Self);
Rozmieszczenie.ShowModal;
FreeAndNil(Rozmieszczenie);
end;
procedure TMasterForm.ActionSalaWidzenExecute(Sender: TObject);
begin
OchSalaWidzen:= TOchSalaWidzen.Create(Self);
OchSalaWidzen.ShowModal;
FreeAndNil(OchSalaWidzen);
end;
procedure TMasterForm.ActionSkypeExecute(Sender: TObject);
begin
with TOchRezerwacjaSkype.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionSprzetRTVExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TKwatSprzetRTV.Create(Self, DM.ZQOsadzeni.FieldByName('ido').AsInteger) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionSprzetRTVWydrukExecute(Sender: TObject);
begin
with TKwatSprzetRTVWydruk.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKartaOsadzonegoExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TPenitForm.Create(Self) do
begin
SetIDO( DM.ZQOsadzeni.FieldByName('ido').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKnowHowExecute(Sender: TObject);
begin
with TKnowHow.Create(Self) do
begin
Show;
end;
end;
procedure TMasterForm.ActionDrukujWykazOsExecute(Sender: TObject);
begin
with TDrukWykazOsadz.Create(Self) do
begin
Show;
end;
end;
procedure TMasterForm.ActionKartaOchronnaExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TOchForm.Create(Self) do
begin
SetIDO( DM.ZQOsadzeni.FieldByName('ido').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionAddWykazExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TOchAddWykaz.Create(Self) do
begin
DodajOsadzonego( DM.ZQOsadzeni.FieldByName('ido').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionAktualizacjaPodkulturyExecute(Sender: TObject);
begin
with TOchUpdPodkultury.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionAlerterOpcjeExecute(Sender: TObject);
begin
with TAlerterConfig.Create(Self) do
begin
ShowModal;
Free;
WczytajUstawieniaAlarmu;
end;
end;
procedure TMasterForm.ActionBezdozoroweExecute(Sender: TObject);
begin
with TOchRezerwacjaWidzen.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionAddWidzenieExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TOchAddWidzenie.Create(Self) do
begin
DodajOsadzonegoDoPoczekalni( DM.ZQOsadzeni.FieldByName('ido').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKomunikatDoExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TKomunikatorNowaWiad.Create(Self) do
begin
OdpiszDoUserByIDO( DM.ZQOsadzeni.FieldByName('ido').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKomunikatNowyExecute(Sender: TObject);
begin
with TKomunikatorNowaWiad.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKomunikatorExecute(Sender: TObject);
begin
with TKomunikator.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionKopiujIDOExecute(Sender: TObject);
begin
Clipboard.AsText:= DM.ZQOsadzeni.FieldByName('IDO').AsString;
end;
procedure TMasterForm.ActionKopiujWszystkoExecute(Sender: TObject);
begin
RxDBGrid1.CopyToClipboard;
end;
procedure TMasterForm.ActionNieZatrudnieniExecute(Sender: TObject);
begin
with TZatNieZatrudnieni.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionNoeNetTestExecute(Sender: TObject);
begin
with TPenitNoeNetTest.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionProsbyOsadzonegoExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TRejestrProsbOs.Create(Self) do
begin
SetIDO( DM.ZQOsadzeni.FieldByName('ido').AsInteger );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionProsbyOsadzonychExecute(Sender: TObject);
begin
with TRejestrProsbAll.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionRejestrWidzenExecute(Sender: TObject);
begin
with TOchRejestrWidzen.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionRejestrWykazowExecute(Sender: TObject);
begin
with TOchRejestrWykazow.Create(Self) do
begin
ShowModal;
Free;
end;
end;
// Stanowiska / Grupy...
procedure TMasterForm.ActionStanowiskaExecute(Sender: TObject);
begin
with TZatStanowiska.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionStatystykaExecute(Sender: TObject);
begin
with TZatStatystyka.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionTerminarzExecute(Sender: TObject);
begin
PenitTerminarz:= TPenitTerminarz.Create(Self);
PenitTerminarz.ShowModal;
FreeAndNil(PenitTerminarz);
end;
procedure TMasterForm.ActionWydarzeniaExecute(Sender: TObject);
begin
with TPenitWydarzenia.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionZatrudnienieOsExecute(Sender: TObject);
begin
if IsDataSetEmpty(DM.ZQOsadzeni) then exit;
with TZatrudnieni.Create(Self) do
begin
ShowZatrudnienieOsadzonego( DM.ZQOsadzeni.FieldByName('ido').AsInteger, DM.ZQOsadzeni.FieldByName('nazwisko').AsString );
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionZatrudnieniExecute(Sender: TObject);
begin
with TZatrudnieni.Create(Self) do
begin
ShowModal;
Free;
end;
end;
procedure TMasterForm.ActionZdjeciaBrakiExecute(Sender: TObject);
begin