home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 April
/
Chip_1997-04_cd.bin
/
tema
/
602propc
/
disk5
/
data.5
/
WINTIME
/
APPS
/
I_KONTAK.PGM
< prev
next >
Wrap
Text File
|
1996-12-03
|
5KB
|
167 lines
include
procedure VlozeniSch(id2 : window_id);
{*******************************************}
{vlo₧enφ novΘho zßpisu o kontaktu - tlaΦφtko OK v pohledu SchNew }
begin
if Commit_view(id2,false,true) then begin
Close_view(id2);
if not Set_ext_pos(idsch,cislof-1,-1) then Set_ext_pos(idsch,cislof+1,-1);
Set_ext_pos(idsch,cislof,-1);
end;
end;
procedure EditSch(id2 : window_id);
{*******************************************}
{tlaΦφtko v pohledu SchSuper}
var
idsubs : window_id;
ct,ic,ec : integer;
cx : cursor;
vlozname : CSIstring[10];
pocetx : integer;
begin
idsubs := GetDlgItem(id2,10);
Get_view_pos(idsubs,ic,ec);
if ec <> -1 then begin
Get_fcursor(idsubs,cx,nil);
Translate(cx,ec,0,ct);
vlozname := Tschuzky[ct].vlozil;
if (myName=vlozname) or (myName='DB_ADMIN') or (vlozname='') then
Open_view('*Schedit',no_redir,modal_view,-ct,0,nil)
else
Open_view('*Schedit',no_redir,modal_view+no_edit,-ct,0,nil);
end;
end;
procedure VlozitOpravu(id2 : window_id);
{*******************************************}
{tlaΦφtko OK v pohledu SchEdit}
begin
if Commit_view(id2,false,true) then begin
Close_view(id2);
if not Set_ext_pos(idsch,cislof-1,-1) then Set_ext_pos(idsch,cislof+1,-1);
Set_ext_pos(idsch,cislof,-1);
end;
end;
procedure SmazatSCh(id2 : window_id);
{*******************************************}
{tlaΦφtko Smazat v pohledu SchEdit}
var
i : integer;
begin
i := Send_message(id2,1603,0,0);
Close_view(id2);
if not Set_ext_pos(idsch,cislof-1,-1) then Set_ext_pos(idsch,cislof+1,-1);
Set_ext_pos(idsch,cislof,-1);
end;
procedure NovyZapis(cis : short);
{*******************************************}
{vytvo°enφ novΘho zßpisu o kontaktu - tlaΦ. Vlo₧it nov² v pohledu SchSuper}
var
idns : window_id;
begin
pomocglob := cis; // impl.hodnota pohledu Schnew
Open_view('*Schnew',no_redir,modal_view,0,0,idns);
end;
function TestVlozeni(idv : window_id) : boolean;
{*******************************************}
var
cxv : cursor;
vlozname : CSIstring[10];
i,pocetc : integer;
begin
if myName = 'DB_ADMIN' then TestVlozeni := true
else begin
if not Get_fcursor(idv,cxv,nil) then Info_box('','');
if Rec_cnt(cxv,pocetc) then begin
Signalize;
TestVlozeni := false;
end
else begin
TestVlozeni := true;
for i := 0 to pocetc-1 do begin
vlozname := cxv[i].vlozil;
if (myName <> vlozname) and (vlozname <> '') then TestVlozeni := false;
end;
end;
end;
end;
procedure SmazatVse(fir : string[50]; cis : short);
{*******************************************}
var
sstr : string[120];
sqldel : string[50];
idsubs : window_id;
ic,ec : integer;
begin
idsubs := GetDlgItem(idsch,10);
Get_view_pos(idsubs,ic,ec);
if ec <> -1 then begin // jsou tam n∞jakΘ zßpisy
sstr := ' Opravdu chcete smazat vÜechny zßpisy'#10' o kontaktech s firmou '+fir+'?';
if YesNo_box('Varovßnφ',sstr) then begin
if TestVlozeni(idsubs) then begin
sqldel := 'DELETE from Tschuzky WHERE cislo='+Int2str(cis);
if SQL_execute(sqldel) then Signalize;
if not Set_ext_pos(idsch,cislof-1,-1) then Set_ext_pos(idsch,cislof+1,-1);
Set_ext_pos(idsch,cislof,-1);
end else begin
Info_box('Nelze','N∞kterΘ zßpisy nemßte prßvo smazat.');
end;
end;
end;
end;
procedure Schuzky(idf : window_id; rec : integer);
{*******************************************}
{tlaΦφtko v pohledu Pfirma - otev°enφ pohledu na stejn² zßznam}
var
cx : cursor;
begin
// pomrec := rec; // uschovßnφ pro pozd∞jÜφ p°ekreslenφ Pfirma
if Get_fcursor(idf,cx,nil) then
if not Translate(cx,rec,0,cislof) then
Open_view('*Schsuper',no_redir,0,-cislof,0,idsch);
end;
procedure Detail(idf : window_id; rec : integer);
{*******************************************}
{tlaΦφtko v pohledu PrehledSch - otev°enφ pohledu na stejn² zßznam}
var
cx : cursor;
begin
if Get_fcursor(idf,cx,nil) then
if not Translate(cx,rec,1,cislof) then begin
if id=0 then Open_view('*Pfirma',no_redir,0,-cislof,0,idsch)
else begin
Set_ext_pos(id, cislof, -1);
Pick_window(id);
end;
end;
end;
procedure PrehledKontaktu;
{*******************************************}
var
strpom : string[200];
begin
if id_prsch = 0 then begin
strpom := 'SELECT * FROM Tschuzky, Tfirma WHERE (Tfirma.SKUPINA='+Int2str(skup)+') AND (Tfirma.CISLO=Tschuzky.CISLO) ORDER BY Tschuzky.dat1';
if Open_sql_cursor(ckontakty,strpom) then Signalize
else begin
Open_view('*PrehledSup',ckontakty,0,0,0,id_prsch);
end;
end else Pick_window(id_prsch);
end;
procedure ZavritKurzorKont;
{*******************************************}
begin
Close_cursor(ckontakty);
end;