IF Status = Status::Released THEN EXIT; IF "Document Type" = "Document Type"::Quote THEN IF CheckCustomerCreated(TRUE) THEN GET("Document Type"::Quote,"No.") ELSE EXIT; TESTFIELD("Sell-to Customer No."); SalesLine.SETRANGE("Document Type","Document Type"); SalesLine.SETRANGE("Document No.","No."); SalesLine.SETFILTER(Type,'>0'); SalesLine.SETFILTER(Quantity,'<>0'); IF SalesLine.ISEMPTY THEN ERROR(Text001,"Document Type","No."); InvtSetup.GET; IF InvtSetup."Location Mandatory" THEN BEGIN SalesLine.SETRANGE(Type,SalesLine.Type::Item); IF SalesLine.FINDSET THEN REPEAT SalesLine.TESTFIELD("Location Code"); UNTIL SalesLine.NEXT = 0; SalesLine.SETFILTER(Type,'>0'); END; SalesLine.SETRANGE("Drop Shipment",FALSE); NotOnlyDropShipment := SalesLine.FINDFIRST; //if there are only drop shpmt, no records are found SalesLine.RESET; SalesSetup.GET; IF SalesSetup."Calc. Inv. Discount" THEN BEGIN //Note that this happens only with this flag active MODIFY; CODEUNIT.RUN(CODEUNIT::"Sales-Calc. Discount",SalesLine); //uninitialized SalesLine will be passed to the codeunit below GET("Document Type","No."); END; IF TestPrepayment(Rec) AND ("Document Type" = "Document Type"::Order) THEN Status := Status::"Pending Prepayment" ELSE Status := Status::Released; SalesLine.SetSalesHeader(Rec); SalesLine.CalcVATAmountLines(0,Rec,SalesLine,TempVATAmountLine0); SalesLine.CalcVATAmountLines(1,Rec,SalesLine,TempVATAmountLine1); SalesLine.UpdateVATOnLines(0,Rec,SalesLine,TempVATAmountLine0); SalesLine.UpdateVATOnLines(1,Rec,SalesLine,TempVATAmountLine1); MODIFY(TRUE); IF NotOnlyDropShipment THEN IF "Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"] THEN WhseSalesRelease.Release(Rec);
SalesLine.COPY(Rec); TempSalesHeader.GET("Document Type","Document No."); //Error: The Sales Header does not exist. Identification fields and values: Document Type='Quote',No.='' TemporaryHeader := FALSE; CalculateInvoiceDiscount(TempSalesHeader,TempSalesLine); Rec := SalesLine;
Answers
they substituted this line whit this line and with solution we are all very happy! =D>
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog