-
Notifications
You must be signed in to change notification settings - Fork 1
/
panal.pas
199 lines (181 loc) · 4.89 KB
/
panal.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
{
p01y - e$$egin amIna su kacirma modulu...
}
unit PAnal;
interface
uses
XOld,XInput,XDev,Dos,XGfx,XTypes,PTaks,PCek,PTypes,PProcs,XStr,Debris,
XPrn,Drivers,Tools,Objects;
type
PAnalRec = ^TAnalRec;
TAnalRec = record
Description : string[39];
Gelir,Gider : comp;
end;
PAnalColl = ^TAnalColl;
TAnalColl = object(TCollection)
procedure FreeItem(item:pointer);virtual;
end;
PAnalLister = ^TAnalLister;
TAnalLister = object(TFormattedLister)
function GetText(item:longint):string;virtual;
end;
PAnalWindow = ^TAnalWindow;
TAnalWindow = object(TDialog)
Lister : PAnalLister;
Getot,Gitot,Toto : PInputNum;
constructor Init;
procedure HandleEvent(var Event:TEvent);virtual;
end;
procedure AnalizBoku;
implementation
constructor TAnalWindow.Init;
var
R:TRect;
function putinput(x,y:integer; s:String):PInputNum;
var
P:PInputNUm;
begin
New(P,Init(x,y,20,s,Stf_Comp,20,0,Idc_NumDefault));
P^.SetState(scf_Disabled,True);
P^.GetBounds(R);
Insert(P);
putinput := P;
end;
begin
R.Assign(0,0,0,0);
inherited Init(R,'Gelir gider analizi');
Options := Options or Ocf_Centered;
New(Lister,Init(5,5,ViewFont,10,
NewColumn('A‡klama',244,cofNormal,
NewColumn('Gelir',124,cofRJust,
NEwColumn('Gider',124,cofRJust,
NIL)))));
Lister^.GetBounds(R);
Insert(Lister);
getot := putinput(5,r.b.y+5,'Gelir toplam ');
gitot := putinput(5,r.b.y+5,'Gider toplam ');
toto := putinput(5,r.b.y+5,'Gelir fazlas ');
InsertBlock(GetBlock(5,r.b.y+5,mnfHorizontal+mnfNoSelect,
NewButton('~Yazdr',cmPrint,
NewButton('~Kapat',cmClose,
NIL))));
FitBounds;
end;
procedure TAnalWindow.HandleEvent;
procedure pRint;
type
TBokScr = record
tgelir : comp;
tgider : comp;
t : comp;
end;
var
scr:TBokScr;
n:integer;
P:PAnalRec;
begin
if Lister^.ItemList^.Count = 0 then exit;
EventWait;
BeginPrint;
GetData(scr);
WritePrn(keycode+' GELiR GiDER ANALiZi');
WritePrn('');
for n:=0 to Lister^.ItemList^.Count-1 do begin
P := Lister^.ItemList^.At(n);
WritePrn(Fix(P^.Description,30)+' '+RFix(cn2b(c2s(P^.Gelir)),15)+' '+RFix(cn2b(c2s(P^.Gider)),15));
end;
WritePrn('');
WritePrn(Fix('Gelir toplam',46)+' '+RFix(cn2b(c2s(scr.tgelir)),15));
WritePrn(Fix('Gider toplam',46)+' '+RFix(cn2b(c2s(scr.tgider)),15));
WritePrn(Fix('Gelir fark',46)+' '+RFix(cn2b(c2s(scr.t)),15));
EndPrint;
end;
begin
inherited HandleEvent(Event);
if Event.What = evCommand then if Event.Command = cmPrint then pRint;
end;
function TAnalLister.GetText;
var
P:PAnalRec;
begin
P := ItemList^.At(item);
GetText := P^.Description+'|'+cn2b(c2s(P^.Gelir))+'|'+cn2b(c2s(P^.Gider));
end;
procedure TAnalColl.FreeItem;
begin
Dispose(PAnalRec(item));
end;
procedure AnalizBoku;
var
T:TDosStream;
takrec:TTakrec;
cekrec: TCekRec;
dt:DateTime;
Pd:PAnalWindow;
Pc:PAnalColl;
takGelir : comp;
cekGider,cekGelir : comp;
day,month,year,code:word;
b:byte;
procedure AddInfo(s:string; ge,gi:comp);
var
P:PAnalRec;
begin
New(P);
P^.Description := s;
P^.Gelir := ge;
P^.Gider := gi;
Pc^.Insert(P);
end;
begin
EventWait;
StartPerc('Taksit kaytlar inceleniyor');
GetDate(year,month,day,code);
New(Pc,Init(10,10));
takgelir := 0;
cekGelir := 0;
cekGider := 0;
T.Init(wkdir+takFile,stOpenRead);
if T.Status = stOK then while T.GetPos < T.GetSize do begin
UpdatePerc(T.GetPos,T.GetSize);
T.Read(takrec,SizeOf(takrec));
for b:=1 to takrec.Ays do if (takrec.Ay[b].Year = Year) and
(takrec.Ay[b].Month = Month) then begin
takGelir := takGelir + takrec.ay[b].Cost;
end;
end;
T.Done;
AddInfo('Taksitler',takGelir,0);
UpdatePercText('™denecek ‡ek kaytlar inceleniyor');
T.Init(wkdir+vcekFile,stOpenRead);
if T.Status = stOK then while T.getPos < T.getSize do begin
UpdatePerc(T.GetPos,T.GetSize);
T.Read(cekrec,SizeOf(cekrec));
UnpackTime(cekrec.Date,dt);
if (dt.year = year) and (dt.month = month) then cekGider := cekGider + cekrec.Amount;
end;
T.Done;
AddInfo('™denecek ‡ekler',0,cekGider);
UpdatePercText('Tahsil edilecek ‡ekler');
T.Init(wkdir+acekFile,stOpenRead);
if T.Status = stOK then while T.GetPos < T.GetSize do begin
UpdatePerc(T.GetPos,T.GetSize);
T.Read(cekrec,SizeOf(cekrec));
UnpackTime(cekrec.Date,dt);
if (dt.year = year) and (dt.month = month) then cekGelir := cekGelir + cekrec.Amount;
end;
T.Done;
AddInfo('Tahsil edilecek ‡ekler',0,cekGelir);
New(Pd,init);
cekGelir := cekGelir + takGelir;
Pd^.Getot^.SetData(cekGelir);
Pd^.GiTot^.SetData(cekGider);
cekGider := cekGelir-cekGider;
Pd^.Toto^.SetData(cekGider);
DonePerc;
Pd^.Lister^.NEwList(Pc);
GSystem^.ExecView(Pd);
Dispose(Pd,Done);
end;
end.