OBJECT Table 50005 Purchase QC Header { OBJECT-PROPERTIES { Date=17-02-16; Time=11:51:55; Modified=Yes; Version List= } PROPERTIES { OnInsert=BEGIN IF "QC Test Certificate No." = '' THEN BEGIN InventorySetup.GET; InventorySetup.TESTFIELD(InventorySetup."QC Test Certificate No."); //NoSeriesMgt.GetNextNo(InventorySetup."QC Test Certificate No.",TODAY,TRUE); NoSeriesMgt.InitSeries(InventorySetup."QC Test Certificate No.",xRec."No. Series",0D,"QC Test Certificate No.","No. Series"); END; END; LookupFormID=Form50012; } FIELDS { { 1 ; ;GRN No. ;Code20 ;TableRelation="Purch. Rcpt. Line"; OnValidate=BEGIN TESTFIELD("QC Tested Lines",0); PurchRecptHeader.GET("GRN No."); varGRNNo:=PurchRecptHeader."No."; "Vendor No." := PurchRecptHeader."Buy-from Vendor No."; "Vendor Name" := PurchRecptHeader."Buy-from Vendor Name"; "Location Code" := PurchRecptHeader."Location Code"; "Posting Date" := PurchRecptHeader."Posting Date"; "Vendor Shipment No":=PurchRecptHeader."Vendor Shipment No."; "QC Creation Date" := WORKDATE; PurchRecptLine.RESET; //PurchRecptLine.SETRANGE(PurchRecptLine."Document No.","GRN No."); PurchRecptLine.SETRANGE(PurchRecptLine."Document No.",varGRNNo); PurchRecptLine.SETRANGE(PurchRecptLine.Type,PurchRecptLine.Type::Item); PurchRecptLine.SETFILTER(PurchRecptLine.Quantity,'>0',0); PurchRecptLine.SETRANGE(PurchRecptLine."QC Needed",TRUE); PurchRecptLine.SETRANGE(PurchRecptLine."QC Tested",FALSE); IF PurchRecptLine.FINDSET THEN BEGIN REPEAT PurchaseQCLine.INIT; PurchaseQCLine."QC Test Certificate No." := "QC Test Certificate No."; PurchaseQCLine."GRN No." := "GRN No."; PurchaseQCLine."Line No." := PurchRecptLine."Line No."; PurchaseQCLine."Item No." := PurchRecptLine."No."; PurchaseQCLine.Description := PurchRecptLine.Description; PurchaseQCLine.Quantity := PurchRecptLine.Quantity; PurchaseQCLine."QC Accepted Qty":=PurchRecptLine.Quantity; PurchaseQCLine."Location Code" := PurchRecptLine."Location Code"; PurchaseQCLine.INSERT; UNTIL PurchRecptLine.NEXT = 0; END ELSE ERROR('There are no QC result to be tested'); END; }
Answers