...
IntrastatJnlLine2.SETRANGE("Source Entry No.","Entry No.");
IF IntrastatJnlLine2.FINDFIRST THEN
CurrReport.SKIP;
// Delete the following lines.
IF "Drop Shipment" THEN BEGIN
IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR
("Country/Region Code" = '')
THEN
CurrReport.SKIP;
IF "Applies-to Entry" = 0 THEN BEGIN
ItemLedgEntry.SETCURRENTKEY("Item No.","Posting Date");
ItemLedgEntry.SETRANGE("Item No.","Item No.");
ItemLedgEntry.SETRANGE("Posting Date","Posting Date");
ItemLedgEntry.SETRANGE("Applies-to Entry","Entry No.");
ItemLedgEntry.FINDFIRST;
END ELSE
ItemLedgEntry.GET("Applies-to Entry");
IF (ItemLedgEntry."Country/Region Code" <> CompanyInfo."Country/Region Code") AND
(ItemLedgEntry."Country/Region Code" <> '')
THEN
CurrReport.SKIP;
END ELSE IF "Entry Type" = "Entry Type"::Transfer THEN BEGIN
IF ("Country/Region Code" = CompanyInfo."Country/Region Code") OR
("Country/Region Code" = '')
THEN
CurrReport.SKIP;
IF "Transfer Order No." = '' THEN BEGIN
Location.GET("Location Code");
IF (Location."Country/Region Code" <> '') AND
(Location."Country/Region Code" <> CompanyInfo."Country/Region Code")
THEN
CurrReport.SKIP;
END ELSE BEGIN
ItemLedgEntry.SETRANGE("Transfer Order No.","Transfer Order No.");
ItemLedgEntry.SETFILTER("Country/Region Code",'%1 | %2','',CompanyInfo."Country/Region Code");
IF ItemLedgEntry.FINDSET THEN
REPEAT
Location.GET(ItemLedgEntry."Location Code");
IF Location."Use As In-Transit" THEN
Include:= TRUE;
UNTIL Include OR (ItemLedgEntry.NEXT = 0);
IF NOT Include THEN
CurrReport.SKIP;
END;
END ELSE IF "Location Code" <> '' THEN BEGIN
Location.GET("Location Code");
CheckILE(Location."Country/Region Code");
END ELSE BEGIN
IF "Entry Type" = "Entry Type"::Purchase THEN
CheckILE(CompanyInfo."Ship-to Country/Region Code");
IF "Entry Type" = "Entry Type"::Sale THEN
CheckILE(CompanyInfo."Country/Region Code");
END;
// End of the lines.
TotalInvoicedQty := 0;
...
...
IntrastatJnlLine2.SETRANGE("Source Entry No.","Entry No.");
IF IntrastatJnlLine2.FINDFIRST THEN
CurrReport.SKIP;
TotalInvoicedQty := 0;
....
Create a new DataItem as follow:
DataItem Name
Value Entry <Value Entry>
Click Propriety and set:
DataItemTableView = SORTING(Entry No.)
In the Value Entry - OnPreDataItem() add the following code lines:
SETRANGE("Posting Date",StartDate,EndDate);
SETFILTER("Item Charge No.",'<> %1','');
"Item Ledger Entry".SETRANGE("Posting Date");
IntrastatJnlLine2.SETRANGE(IntrastatJnlLine2."Journal Batch Name",IntrastatJnlBatch.Name);
IntrastatJnlLine2.SETCURRENTKEY("Source Type","Source Entry No.");
IntrastatJnlLine2.SETRANGE("Source Type",IntrastatJnlLine2."Source Type"::"Item entry");
In the Value Entry - OnAfterGetRecord() trigger add the following code lines:
IntrastatJnlLine2.SETRANGE("Source Entry No.","Item Ledger Entry No.");
IF IntrastatJnlLine2.FINDFIRST THEN
CurrReport.SKIP;
IF "Item Ledger Entry".GET("Item Ledger Entry No.")
THEN BEGIN
IF ("Item Ledger Entry"."Posting Date" > StartDate) AND ("Item Ledger Entry"."Posting Date" < EndDate) THEN
CurrReport.SKIP;
IF "Country/Region".GET("Item Ledger Entry"."Country/Region Code") THEN
IF "Country/Region"."EU Country/Region Code" = '' THEN
CurrReport.SKIP;
TestILE("Item Ledger Entry");
InsertValueEntryLine;
END;
...