Hi,
i am using Navision 5.0sp1
We have customized Posted Sales Invoice to capture, from Location, to location and the External Doucment No on the lines
In the report 206, I need to add a summary checkbox. On checking the same we require to print a report grouping on Item, From location and To Location.One record for the combination should be shown with the quantity and amount field for all the records summed up. How can I achieve this. I have used the 206 report and trying to customize the same. Have added another sales invoice line2 after the dataitem sales invoice line to do the same. in the gouping field of this new dataitem have given the No., From Location and To location. In the TotalFields have given the Quantity and the Amount field. But the report is not working as desired. Sorting is happening but am unable to show just one record, It is showing so many records and adding the quanityt and amount in all the lines.
Also I have one more requirement. In the summary repoirt, after the record for the combination, I need to show all the external document no. attached with the combinations separated bu comma in a line below the record. How can i handle this. multiline option is not working and the record is getting truncvated. How can I handle this? can i use array, temp tle or integer for the same. If yes then how can this be done?
Kindly reply at the earliest.
regards,
Ratna.
0
Comments
This code is used to get data for the Serial Numbers for containers and 'sources' (Lot No.)
ShowSerialLines := (ShowSerialNo) OR (ShowSourceNo);
CLEAR(recItemLedEntry);
SNLineTmp.DELETEALL;
/// ******************Container Serial No**********************
IF (Type = Type::Item) AND ("No." <> '') THEN
RecItem.GET("No.");
IF (ShowSerialNo) AND (RecItem."Item Tracking Code" = 'CONTAINERS') THEN BEGIN
recItemLedEntry.RESET;
IF ("Shipment No." <> '') OR ("Order No." <> '') THEN BEGIN
IF "Shipment No." <> '' THEN BEGIN
recItemLedEntry.SETCURRENTKEY("Document No.","Item No.");
recItemLedEntry.SETRANGE("Document No.", "Shipment No.");
END ELSE BEGIN
recItemLedEntry.SETCURRENTKEY("Sales Order No.","Item No.");
recItemLedEntry.SETRANGE("Sales Order No.", "Order No.");
END;
END ELSE BEGIN
recItemLedEntry.SETCURRENTKEY("Document No.","Item No.");
recItemLedEntry.SETRANGE("Document No.", "Document No.");
END;
recItemLedEntry.SETRANGE("Item No.", "No.");
IF recItemLedEntry.FIND('-') THEN BEGIN
SNLineTmp.INIT;
SNLineTmp."Document Type" := SNLineTmp."Document Type"::Invoice;
SNLineTmp."No." := "Document No.";
SNLineTmp."Line No." := 1;
SNLineTmp.INSERT;
REPEAT
SNText := STRSUBSTNO('%1',recItemLedEntry."Serial No.");
IF STRLEN(SNLineTmp.Comment) + STRLEN(SNText) + 2 > MAXSTRLEN(SNLineTmp.Comment) THEN BEGIN
SNLineTmp.INIT;
SNLineTmp."Document Type" := SNLineTmp."Document Type"::Invoice;
SNLineTmp."No." := "Document No.";
SNLineTmp."Line No." := SNLineTmp.COUNT + 1;
SNLineTmp.INSERT;
END;
IF SNLineTmp.Comment <> '' THEN
SNLineTmp.Comment += ', ';
SNLineTmp.Comment += SNText;
SNLineTmp.MODIFY;
UNTIL recItemLedEntry.NEXT = 0;
END;
END;
///Source Serial No.
IF (Type = Type::Item) AND ("No." <> '') THEN
RecItem.GET("No.");
IF (ShowSourceNo) AND (RecItem."Item Tracking Code" = 'SOURCES') THEN BEGIN
ItemEntryRelation.RESET;
ItemEntryRelation.SETCURRENTKEY("Order No.","Order Line No.");
ItemEntryRelation.SETRANGE("Order No.", "Order No.");
ItemEntryRelation.SETRANGE("Order Line No.","Order Line No.");
IF ItemEntryRelation.FIND('-') THEN BEGIN
SNLineTmp.INIT;
SNLineTmp."Document Type" := SNLineTmp."Document Type"::Invoice;
SNLineTmp."No." := "Document No.";
SNLineTmp."Line No." := 1000;
SNLineTmp.INSERT;
REPEAT
SNText := STRSUBSTNO('%1',ItemEntryRelation."Lot No.");
IF STRLEN(SNLineTmp.Comment) + STRLEN(SNText) + 2 > MAXSTRLEN(SNLineTmp.Comment) THEN BEGIN
SNLineTmp.INIT;
SNLineTmp."Document Type" := SNLineTmp."Document Type"::Invoice;
SNLineTmp."No." := "Document No.";
SNLineTmp."Line No." := SNLineTmp.COUNT + 1;
SNLineTmp.INSERT;
END;
IF SNLineTmp.Comment <> '' THEN
SNLineTmp.Comment += ', ';
SNLineTmp.Comment += SNText;
SNLineTmp.MODIFY;
UNTIL ItemEntryRelation.NEXT = 0;
END;
END;
*dataitem*SerialEntry - OnPreDataItem()
IF NOT ShowSerialLines THEN
CurrReport.BREAK;
SerialEntry.SETRANGE(Number,1,SNLineTmp.COUNT);
SerialEntry - OnAfterGetRecord()
IF Number = 1 THEN
SNLineTmp.FIND('-')
ELSE
SNLineTmp.NEXT;
//
This code snippit shows the string creation:
IF SNLineTmp.Comment <> '' THEN
SNLineTmp.Comment += ', ';
SNLineTmp.Comment += SNText;
where SNLine.Comment is the max number of characters.
In my case there is a finite number that the client accepted.
The rest is all about showing or hiding the sections.
Hope this helps,
Colin