define "retval" text.

define temp "ART" Text 2 .

define temp "RN" Numeric String 5.

case ( data-entry Field3 )

value ( "AK" ) :

assign temp ART := "KO" .

case ( data-entry Field4 )

value ( "AK"or "SO" ) :

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

retval:=setvalue("Belegart",temp ART)+setvalue("Druck_KZ",temp ART)+recordsave()+Wait(0,1).

retval:=FormOpenRelated("AUFTRAG,AUFTRAG_RE").

end

value ( "KO" ) :

assign temp ART := "LS" .

case ( data-entry Field4 )

value ( "KO" or "SO" ) :

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

retval:=setvalue("Belegart",temp ART)+setvalue("Druck_KZ",temp ART).

retval:=setvalue("Datum_LS",Current date).

retval:=recordsave()+Wait(0,1).

retval:=FormOpenRelated("AUFTRAG,AUFTRAG_RE").

end

value ( "PK" ) :

assign temp ART := "LS" .

case ( data-entry Field4)

value ( "PK" or "SO" ) :

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

run procedure "LS_PK" .

end

value ( "PL" ) :

assign temp ART := "ZP" .

case ( data-entry Field4)

value ( "PL" or "SO" ) :

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

run procedure "ZP" .

end

value ( "BE" ) :

assign temp ART := "ZH" .

case ( data-entry Field4)

value ( "BE" or "SO" ) :

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

run procedure "ZH" .

end

value ( "LS" ) :

assign temp ART := "RE" .

case (data-entry Field4)

value ( "LS" ) :

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

retval := setvalue("Belegart",temp ART)+setvalue("Druck_KZ",temp ART).

retval := setvalue("Datum_FA",Current date)+Wait(0,1).

retval := if(getvalue("Rechnungsnr") = blank,

setvalue("Rechnungsnr",getvalue("Rechnungsnr2")),

setvalue("Rechnungsnr",getvalue("Rechnungsnr"))).

retval := recordsave()+Wait(0,1).

assign temp RN := getvalue("Rechnungsnr").

retval := FormOpenRelated("AUFTRAG,AUFTRAG_RE").

retval := ExecDQL("for NUMMER with Nr_KZ = 2 ;

if data-entry Field4 > Rechnungsnr then

modify records

Rechnungsnr := data-entry Field4. end end","","","",temp RN,"").

retval:=wait(0,1).

retval := ExecDQL("for AUFTRAG with Belegnr=data-entry Field1 and

Belegnr2=data-entry Field2 ; enter a record in ARCHIV

copy all from AUFTRAG.",data-entry Field1,data-entry Field2,"","","").

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr=data-entry Field1 and

Belegnr2=data-entry Field2 ; enter a record in ARCHIV_POSITION

copy all from AUFTRAG_POSITION;Belegart := data-entry Field3 ;

Rechnungsnr := data-entry Field4 .",data-entry Field1,data-entry Field2,temp ART,temp RN,"").

retval:=wait(0,1).

retval := MemoExecDQL(any DQL with DQLnr=0006 DQL,data-entry Field1,data-entry Field2,"","",""). does not work

--retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and

--Belegnr2 = data-entry Field2 ; modify records in ARTIKEL Bestand := Bestand –

--AUFTRAG_POSITION Anzahl ; Letzter_Abgang := current date .",data-entry

--Field1,data-entry Field2,"","","").

does work properly

end

value ( "GS" ) :

assign temp ART := "RE" .

retval := ExecDQL("for AUFTRAG_POSITION with Belegnr = data-entry Field1 and Belegnr2 = data-entry Field2; modify records Belegart := data-entry Field3 ;

Druck_KZ:= data-entry Field3.",data-entry Field1,data-entry Field2,temp ART,"","").

retval:=setvalue("Belegart",temp ART).

retval:=setvalue("Druck_KZ","GS").

retval:=setvalue("Datum_FA",Current date).

retval:=recordsave()+Wait(0,1).

retval:=FormOpenRelated("AUFTRAG,AUFTRAG_RE").

end

DQLnr 0006

for AUFTRAG_POSITION with

Belegnr := data-entry Field1 and

Belegnr2 := data-entry Field2 ;

modify records in ARTIKEL

Bestand := Bestand - AUFTRAG_POSITION Anzahl ;

Letzter_Abgang := current date .