27. Januar 2011 10:00
l_inv_setup.GET;
l_file.SETRANGE(l_file.Path,l_inv_setup."Path Invoice ShipEDI");
l_file.SETFILTER(l_file.Name,'*.TXT|*.CSV|*.txt|*.csv|*.Txt|*.Csv');
l_file.SETRANGE("Is a file",TRUE);
IF l_file.FINDFIRST THEN BEGIN
REPEAT
check :=FALSE;
Dateiname:=l_file.Path+l_file.Name;
Datei.TEXTMODE(TRUE);
Datei.OPEN(Dateiname);
WHILE (Datei.READ(inTEXT) <> 0) DO BEGIN
check := Lese_Invoice(inTEXT); //Hier aufruf der Lesen Funktion
END;
IF Setup.GET(COPYSTR(Datastring,1,10),Setup.Type::"Import Rechung") THEN BEGIN // muss von allen Sped gleich lang sein.
WITH Setup DO BEGIN
IF NOT l_head.GET((COPYSTR(Datastring,Agent_von,Agent_len)),(COPYSTR(Datastring,Referenzno_von,Referenzno_len))) THEN BEGIN
l_head.INIT;
EVALUATE(l_head."Shipping Agent",(COPYSTR(Datastring,Agent_von,Agent_len)));
EVALUATE(l_head."Invoice number",(COPYSTR(Datastring,Referenzno_von,Referenzno_len)));
l_head."read Date":=TODAY;
l_head.INSERT(TRUE);
END;
IF Line_last.FINDLAST THEN BEGIN //Hier sollte der letzte gefunden werden!!! Tut er aber nicht.
l_lineno:=Line_last."Line No"+100;
END ELSE l_lineno:=100;
IF NOT l_line.GET(COPYSTR(Datastring,Agent_von,Agent_len),(COPYSTR(Datastring,Referenzno_von,Referenzno_len)),l_lineno) THEN
BEGIN
l_line.INIT;
EVALUATE(l_line."Shipping Agent",(COPYSTR(Datastring,Agent_von,Agent_len)));
EVALUATE(l_line."Invoice number",(COPYSTR(Datastring,Referenzno_von,Referenzno_len)));
l_line."Line No":=l_lineno;
l_line."Sending No.":=(COPYSTR(Datastring,SendingNo_von,Setup.SendingNo_len));
l_line."Delivery Date":=get_date((COPYSTR(Datastring,"Delivery Date_von","Delivery Date_len")));
l_line."Order No.":=(COPYSTR(Datastring,Order_von,Order_len));
EVALUATE(l_line."Distance ( km )",(COPYSTR(Datastring,"Distance(km)_von","Distance(km)_len")));
EVALUATE(l_line."Weight calculated",(COPYSTR(Datastring,Weightcalculated_von,Weightcalculated_len)));
EVALUATE(l_line."Cargo net",(COPYSTR(Datastring,Cargonet_von,Cargonet_von)));
EVALUATE(l_line."sum without cargo",(COPYSTR(Datastring,sumwithoutcargo_von,sumwithoutcargo_len)));
EVALUATE(l_line.Maut,(COPYSTR(Datastring,Maut_von,Maut_len)));
EVALUATE(l_line."Sending Amount",(COPYSTR(Datastring,Sending_Amount_von,Sending_Amount_len)));
EVALUATE(l_line.Plots,(COPYSTR(Datastring,pallets_von,pallets_len)));
EVALUATE(l_line.Receiver,(COPYSTR(Datastring,Receiver_von,Receiver_len)));
EVALUATE(l_line.PLZ,(COPYSTR(Datastring,PLZ_von,PLZ_len)));
EVALUATE(l_line.City,(COPYSTR(Datastring,City_von,City_len)));
EVALUATE(l_line."Country code",(COPYSTR(Datastring,Countrycode_von,Countrycode_len)));
EVALUATE(l_line.DD,(COPYSTR(Datastring,DD_von,DD_len)));
EVALUATE(l_line.EUR,(COPYSTR(Datastring,EUR_von,EUR_len)));
EVALUATE(l_line.CHEP,(COPYSTR(Datastring,CHEP_von,CHEP_len)));
EVALUATE(l_line.KUBI,(COPYSTR(Datastring,KUBI_von,KUBI_len)));
EVALUATE(l_line.IPAL,(COPYSTR(Datastring,IPAL_von,IPAL_len)));
EVALUATE(l_line.KAR,(COPYSTR(Datastring,KAR_von,KAR_len)));
IF l_line.INSERT(TRUE) THEN
Line_last:=l_line;
EXIT(TRUE);
END;
END;
END ELSE BEGIN
ERROR('Konnte nicht gefunden werden : '+ ((COPYSTR(Datastring,1,10)))+' '+FORMAT(Setup.Type::"Import Rechung"));
END;
27. Januar 2011 10:29
Line_Last.RESET; // DIese Zeile würde ich zum Test ergänzen
IF Line_last.FINDLAST THEN BEGIN //Hier sollte der letzte gefunden werden!!! Tut er aber nicht.
27. Januar 2011 10:35
27. Januar 2011 10:43
27. Januar 2011 10:45
Line_last.RESET;
Line_last.SETCURRENTKEY(Line_last."Line No");
IF Line_last.FINDLAST THEN BEGIN
l_lineno:=Line_last."Line No"+100;
END ELSE l_lineno:=100;