home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 August
/
Chip_1999-08_cd.bin
/
tema
/
Ozogan
/
RUNTIME
/
APLIKACE.EXE
/
BANKOMAT
/
BANKOMAT.KL3
< prev
next >
Wrap
Text File
|
1999-06-15
|
11KB
|
382 lines
Program Bankomat;
Var
Obdobi,
Filtr1,
DefDir :String;
zaloz :Real;
Procedure NovyConfig;
Begin
End;
//***Prepocitani polozek status baru
Procedure Prepocitat;
Var
recs,
r,z,z1,z2:LongInt;
Begin
r:=DataTable1.Recno;
DataGrid1.Visible:=False;
DataTable1.GoTop;
Edit2.Text:=Trim(RealToStr(DataTable1.ReadNum("P1"),15,2));
z:=DataTable1.ReadNum("P1");
z1:=0;z2:=0;recs:=0;
While not DataTable1.Eof do {dokud nenφ konec databßze}
begin
z:=z+DataTable1.ReadNum("P3");
if DataTable1.ReadNum("P3")<0 Then z1:=z1+Abs(DataTable1.ReadNum("P3"));
if DataTable1.ReadNum("P3")>0 Then z2:=z2+Abs(DataTable1.ReadNum("P3"));
DataTable1.Skip(1);
Inc(recs);
end;
StatusBar1.Panels.Text[0]:="Z∙statek: "+Trim(RealToStr(z,10,2));
StatusBar1.Panels.Text[1]:="Celkem vlo₧eno: "+Trim(RealToStr(z2,10,2));
StatusBar1.Panels.Text[2]:="Celkem vybrßno: "+Trim(RealToStr(z1,10,2));
DataTable1.Go(r);
DataGrid1.Visible:=True;
If recs=0 Then Begin
Button2.Enabled:=False;
Button3.Enabled:=False;
End
Else Begin
Button2.Enabled:=True;
Button3.Enabled:=True;
End;
End;
//***Prepnuti interface
procedure Zmenzaloz;
Var
i:Byte;
begin
If zaloz=1 Then Begin
For i:= 0 To 11 Do Begin
TabControl1.Tabs[i]:=i+1;
zaloz:=2;
End;
Inter.Caption:="Interface 1";
TabControl1.TabWidth:=35;
End
Else Begin
For i:= 0 To 11 Do Begin
TabControl1.Tabs[i]:=Trim(Month(i+1));
zaloz:=2;
End;
TabControl1.TabWidth:=0;
Inter.Caption:="Interface 2";
zaloz:=1
End;
End;
procedure TForm.FormCreate(Sender: TObject);
var
aaa,
x1,y1,x2,y2,i :Integer;
x,z,z1,z2 :integer;
s :string;
begin
DefDir:=GetAdr(0);
Form.Visible:=False;
Application.HelpFile := DefDir+"\Help\Bank01.hlp";
DBFSelect(1);
If Not(DBFUse(DefDir+"\Data\SConfig.DBF")) Then Begin
s:= 'Nebyl nalezen configuraΦnφ soubor. Bez tohoto souboru'+CHR(13);
s:=s+'program nem∙₧e pracovat. P°ejete si vytvo°it nov²'+CHR(13);
s:=s+'konfiguraΦnφ soubor se zßkladnφm nastavenφm?';
If MessageDlg(s, mtError, [mbYes,mbNo], 0)=6 Then Begin
// NovyConfig;
End Else Begin
ShowMessage("Konec programu");
Form.Close;
End;
End;
x1 :=DbfReadNum("FLEFT");
y1 :=DbfReadNum("FTOP");
x2 :=DbfReadNum("FWIDTH");
y2 :=DbfReadNum("FHEIGHT");
i :=DbfReadNum("MESIC");
zaloz :=Round(DbfReadNum("INTER"));
Obdobi:=RealToStr(DbfReadNum("OBDOBI"),4,0);
DbfUse("");
If (i>0) AND (i<13) Then i:=i Else i:=0;
TabControl1.TabIndex:=i;
If i<12 Then
Filtr1:="Year(P2)="+Obdobi+" .AND. Month(P2)="+RealToStr(i+1,2,0)
Else
Filtr1:="Year(P2)="+Obdobi;
DataTable1.TableName:=DefDir+"\Data\DataB.DBF";
DataTable1.IndexName:="dat";
DataTable1.Filter :=Filtr1;
DataTable1.Active :=True;
x:=DataTable1.EvalNum('Year(P2)');
s:=RealToStr(x,2,2);
Form.Left :=x1; Form.Top :=y1;
Form.Width :=x2; Form.Height:=y2;
Form.Caption:="Bankomat - "+obdobi;
TabControl1.Width:=Form.Width-8;
DataGrid1.Left :=4;
DataGrid1.Width :=Form.Width-16;
Prepocitat;
If zaloz=2 Then Begin
For i:= 0 To 11 Do Begin
TabControl1.Tabs[i]:=i+1;
Inter.Caption:="Interface 2";
End;
TabControl1.TabWidth:=35;
End;
Form.ActiveControl:=DataGrid1;
Form.Visible :=True;
end;
//**P°epnutφ zßlo₧ky
procedure TForm.TabControl1Change(Sender: TObject);
Var
x,z,z1,z2 :Integer;
s :String;
begin
x:=TabControl1.TabIndex+1;
DataTable1.Filter:="";
if x<>13 Then Begin
s:=RealToStr(x,2,0);
Filtr1:="Year(P2)="+Obdobi+".AND. Month(P2)="+s;
DataTable1.Filter:=Filtr1;
DataTable1.GoTop;
End;
If x=13 Then Begin
Filtr1:="Year(P2)="+Obdobi;
DataTable1.Filter:=Filtr1;
End;
Prepocitat;
Form.ActiveControl:=DataGrid1;
end;
//***Vlozeni zustatku za minuly mesic
procedure TForm.Edit2KeyPress(Sender: TObject; var Key: Char);
Var
x:Byte;
r:LongInt;
begin
x:=Ord(Key);
If x=13 Then Begin
r:=DataTable1.RecNo;
DataTable1.GoTop;
DataTable1.WriteNum("P1",StrToReal(Edit2.Text));
DataTable1.Go(r);
Prepocitat;
Form.ActiveControl:=DataGrid1;
End;
End;
//***Vlo₧enφ novΘho zßznamu
procedure TForm.Button1Click(Sender: TObject);
Var
r:LongInt;
x:Real;
begin
SysVarSet('titul' ,"Vlo₧enφ novΘho zßznamu");
SysVarSet('fleft' , Form.Left);
SysVarSet('ftop' , Form.Top);
SysVarSet('fwidth' , Form.Width);
SysVarSet('fheight' , Form.Height);
SysVarSet('op' , 1);
SysVarSet('rest' , 0);
SysVarSet('datu' , 0);
SysVarSet('cena' , 0);
SysVarSet('pozn' , 0);
SysVarSet('oper' , 1);
RunForm(DefDir+"\Program\code01.prg");
If SysVarGet("rest")=1 Then Begin
DataTable1.Filter:="";
DataTable1.AppendBlank;
r:=DataTable1.Recno;
x:=SysVarGet("oper")*Abs(SysVarGet("cena"));
DataTable1.WriteDat("P2",SysVarGet("datu"));
DataTable1.WriteNum("P3",x);
DataTable1.WriteStr("P4",SysVarGet("pozn"));
DataTable1.Filter:=Filtr1;
DataTable1.Go(r);
Prepocitat;
End;
SysVarClear;
Form.ActiveControl:=DataGrid1;
end;
//***Vy°azenφ zßznamu
procedure TForm.Button2Click(Sender: TObject);
Var
r:LongInt;
s:String;
begin
s:= 'Prosφm, potvr∩te v>l c'tDe v>l c'tDeT=H.
:=stlg(OK mtErrmrOKf SysVarGet("rest Then Begin
// e1.AppendBlank;
r:=DaAppendBlankD\Bate r:=DaAppendBlankPackTable1.Filter:=Filtr1;
DataTable1.Go(r);
Pr;
SysVarClear;
Form.ActiveControl:=DataOs:=vanels.Te;
//***Vlo₧enφ novΘho Os:=vZa/***lick(Sendetab1,r: TObject);
V,x1ar
r:LongInt;
x:Real;
begin
SOs:=vanels.Te;
//***Vlo₧enφ novΘho zßznamu");
SysVarSet('fleft' , Form.Left);
SysVarSet('ftop' , Form.Top);
SysVarSet('fwidth' , Form.Width);
SysVarSet('fheight' , Form.Height);
S2sVarSet('op' , 1);
SysVararSet('rest' , 0);
S")>0 Then z2:=z
Dat"P4",Syxum("P1"),15,2));
z:=3lo₧enφ novΘho zßzn , 0);
SxsVarSet('cena' , 0);
S("P1"),15,2));
Dat"P4",Syable1le:=Trut('pozn' , 0), -1) AND (t('pozn' , 0), ysVarSet('oper' , 1);
RunForm(DefDir+"\Program\code01.prg");
If SysVarGet("resttab1 :String;
begin
x:=TabConDataTable1.Recno;
x:=SysVarGet("oper")*Abs(SysVx1a13 Then Begin
r:=Daabltab11.Filter:="";
if xsVarGet("pozn"));
'zßkladnφ1.Filter:=Filtr1x
Data="InterfacarGet("cena"));
DataTable1.WriteDat("P2",SysVarGet("datu"));
DataTable1.WriteNum("P3",x);
DataTable1.WriteStr("P4",SysVabltab11.Filter:="";
if xsVarGet("pozn"));
DataTable1.1.Filter:=Filtr1x
Data="InterfactaTable1.Go(r);
Prepocitat;
End;
SysVarClear;
Form.ActiveControl:*Vy°azenφ zßznamu
p3ocedure TForm.Button2ClicLongInt;Os:=vZa/***licControl:*Vy°azenφ zßznam Form.ActDblocedure TForm.Button2ClicLongInt;Os:=vZa/***licControl:ue;
opupc'tn
//***Vy°azenφ zßznamu
p4ocedure TForm.Button2ClicLongInt; opup'tn
nkPopup(ysVarSet(+u
p4rSet(+4,ysVarSet+u
p4rSet-77) End;
SysVarClear;
Form.ActiveControl:ue;
Nsouboit ption://***Vy°azenφ zßznamNsouborocedure TForm.Button1Click(Sendes1,
DefDirx;
Var
x elp\Bank01.hlp";
DBFSelect(1);
If Not(DBFUse(DefDir+"\Data\SConfig.DB'tDe v>l c'Then Begin
s:= 'Nebyl nalezen'
If MessaOK mtEr(r);
(r);ovyConfig;
eadNum("INTER"));
Obdobi:=RealToStr(DbfReadNu;
x:Real;
begin
SNsoubor s ptionφ"ReadNu;
x:Real;amu");
SysVarSet('fleftft' , Form.Left);
SysVarSet('ftopop' , Form.Top);
SysVarSet('fwidthth' , Form.Width);
SysVarSet('fheightth' , Form.WeadNum1
SeadNumheightth' , Form.Wight);
SysVarSeSet('op' , 1);
SysVarSeSet('oper' , 1);
RunFCrm(D2.KFM"ReadNu;ram\code01.prg");
If SysVarGet("restNum(""));
ealToStaTable1.Wri\code01.prgeadNum1ir+sage("KoneeadNum("\code01.prgeadNum1irage("Kone Form.Height:=y2;
Form.Ca Filtr1:="Yea :String;
begin
x:=TabConSysVablx<Filter:="";
if xsV x<>13 Then Begin
s:=ReKone lToStr(x,2,0);
Filtr1:="Year(P2)="+Obdobi+".AND.ta="Interfacgin
x:=Ord(Key);
If Kone lToStr(x,2,0);
Filtr+".AND.ta="Interfacgi<>13 Then Begin
s:=ReKoarGet("pozn"));
DataTable1.1.F("OBDOBI"),4,0rfactaTable1.Go(r); Form.Close; Prepocitat;
Form.ActiveCoF("OBDOBI"),4Control:*Vy°azenφ zßznamT.Acitrocedure TForm.Button1Clic Then Begini x: Pred Else BeginZ//***y n By set°φd∞nyI"),4Control:*Vy°azenφ zßznam Form.ActKeyUpe TForm.Edit2KeyPress(SendeWord;redift.EdediftlToSehange(Senderr Key: C
Var
r:LongInt;
:String;
begin
x:=TabClp";
Int;=39) And (x);
If (arGet("rest")=1 Then Begin
DataTabTablTable1.Wr<>13 Then Begin
s:=RealToStr(x,2,0);
Filtr1:="Year(P2)="+Obdobi+".AND. Month(P2)="+s;
DataTable1.Filter:=Filtr1;
hen i:=i Else i:=0;
Tx-aTable1.taTable1.Go(r);
Pr
Int;=37) And (x>1
If (arGet("rest")=1 Then Begin
DataTabDeblTable1.Wr<>13 Then Begin
s:=RealToStr(x,2,0);
Filtr1:="Year(P2)="+Obdobi+".AND. Month(P2)="+s;
DataTable1.Filter:=Filtr1;
hen i:=i Else i:=0;
Tx-aTable1.taTable1.Go(r);
Pr;
SysVarClear;
Form.ActiveControl:*Vy°azenφ zßznam :=utrocedure TForm.Button1Clic novΘho zßznamu");
SysVarSet('fleft' , Form.Left);
SysVarSet('ftop' , Form.Top);
SysVarSet('fwidth' , Form.Width);
SysVarSet('fheightt('oper' , 1);
RunForm(D3fDir+"\PrControl:*Vy°azenφ zßznam ocedure TForm.Button1ClicarGet("reterface
pControl:*Vy°azenφ zßznamßznaResizForm.TabControl1Changoz;
Var
ysVarSet('<51le:=TruysVarSet(':=51l;Var
ysVarSet('f<10le:=TruysVarrm.Width10l;Varkomat - "+obdobi;
TabControl1.Widkomat - "+obrm.WidthysVarrm.Wid-8 :=x2;Grid1.Leftrm.WidthysVarrm.Wid-11 :=x2;Grid1.Leftdobi;
TabContro.Width u
prrSetthysVarrm.Wid-72idth u
p2rSetthysVarrm.Wid-72idth u
p3rSetthysVarrm.Wid-72idth u
p4rSetthysVarrm.Wid-72idth u
p5rSetthysVarrm.Wid-72idth u
p5rSet(
TabContro7Width teNum(Set(
TabContro15Width teNum(SetthysVarrm.Wid-72idth Labelm(Set(
TabContro244idth Labelm(SetthysVarrm.Wid-68
pControl:*Vy°azenφ zßznamßznagramue TForm.Edit2KeyPress(SysVht: TgramuSysVhtClic bfp\Bank01.hlp";Select(1);
If Not(DBFUse(DefDiriveCoF(""));
x1
ysVarSet('fleftF(""));
y1
ysVarSet('ftopF(""));
x2 ysVarSet('fwidthF(""));
y2 :,ysVarSet('fheightF(""));
i
n i:=i Else i:=0;
heightF(""));
:=Rou
ace
ReadNum("OBDOBI"),4,0efDir:=GetAdr(0);
FControl:*Vy°azenφ zßznamNapovedarocedure TForm.Button1Clic m.Visible:=False:=i exk01.hlpControl:Con.