Hello all,
in Sales , Purchases we have serial number and warranty dates are there in item tracking lines. but it is not available in Sales lines. how we can bring these 2 details in the report extension.
eg, how can we bring/modify those 2 fields into Posted Purchase receipt (Grn) and posted sales shipment.
reportextension 60002 "Sales - Shipment EMP Ext" extends "Sales - Shipment EMP" { RDLCLayout = './ReportLayouts/SalesShipmentDeliveryNotes.rdl'; dataset { // Add changes to dataitems and columns here add("Sales Shipment Header") { column(ShowUnitPrice; ShowUnitPrice) { } column(PostingDate_SalesShipmentHeader; "Posting Date") { } column(DocumentDate_SalesShipmentHeader; "Document Date") { } } } requestpage { // Add changes to the requestpage here /* layout { modify(ShowValue) { Visible = false; } }*/ } trigger OnPreReport() var WarehouseEmployee: Record "Warehouse Employee"; begin WarehouseEmployee.Init(); WarehouseEmployee.SetRange("User ID", UserId); If WarehouseEmployee.FindFirst() then ShowUnitPrice := false else ShowUnitPrice := true; end; var ShowUnitPrice: Boolean; }
Thankyou all
Hi,
you need check where you have written logic and why it’s printing twice may be you can debug
Now, is there any issue in this code. while printing if the number of line item is 4 it takes 8 records are coming. means same 4 lines are also coming. and it should take only one warranty date from each of the item (if warranty date exists)
Thanks for update.
Thanks You Nitin Verma : it is working as expected
Use Last() function in your report layout for the warranty variable like: in the expression place holder =Last(WarrantyDate)
Thanks for reply Nitin Verma
Right now am getting the warranty date, but the issue is each item has different warranty date, then also it is taking same warranty date for all items. if the item has no warranty date then also its taking one value
Hi,
Can you try this? If it not works still, you need to debug and check your filters again. Also you need to declared your warranty date as a global varlable in that report.
modify("Sales Shipment Line") { trigger OnAfterAfterGetRecord() var ItemLedEntries: Record "Item Ledger Entry"; begin Clear(WarrantyDate); ItemLedEntries.Reset(); ItemLedEntries.SetCurrentKey("Document Type", "Document No.", "Document Line No."); ItemLedEntries.SetRange("Document Type", ItemLedEntries."Document Type"::"Purchase Receipt"); ItemLedEntries.SetRange("Document No.", "Sales Shipment Line"."Document No."); ItemLedEntries.SetRange("Document Line No.", "Sales Shipment Line"."Line No."); ItemLedEntries.SetLoadFields("Document Type", "Document No.", "Document Line No.", "Serial No.", "Warranty Date", "Expiration Date"); // if ItemLedEntries.FindSet() then // repeat // if WarrantyDate = 0D THEN // WarrantyDate := ItemLedEntries."Warranty Date"; // until ItemLedEntries.Next() = 0; ItemLedEntries.setfilter("Warranty Date", '<>%1', 0D); if ItemLedEntries.findlast then WarrantyDate := ItemLedEntries."Warranty Date"; End; } var WarrantyDate: Date; }
Hello Nitin Verma
thanks for the reply, but still the warranty date is not getting from the ledger entries. if we have 10qty with warranty date we have to pick only one warranty date for each item (if warranty date exits)
modify("Sales Shipment Line") { trigger OnAfterAfterGetRecord() var ItemLedEntries: Record "Item Ledger Entry"; begin Clear(WarrantyDate); ItemLedEntries.Reset(); ItemLedEntries.SetCurrentKey("Document Type", "Document No.", "Document Line No."); ItemLedEntries.SetLoadFields("Document Type", "Document No.", "Document Line No.", "Serial No.", "Warranty Date", "Expiration Date"); ItemLedEntries.SetRange("Document Type", ItemLedEntries."Document Type"::"Purchase Receipt"); ItemLedEntries.SetRange("Document No.", "Sales Shipment Line"."Document No."); ItemLedEntries.SetRange("Document Line No.", "Sales Shipment Line"."Line No."); // if ItemLedEntries.FindSet() then // repeat // if WarrantyDate = 0D THEN // WarrantyDate := ItemLedEntries."Warranty Date"; // until ItemLedEntries.Next() = 0; ItemLedEntries.setfilter("Warranty Date", '<>%1', 0D); if ItemLedEntries.findlast then WarrantyDate := ItemLedEntries."Warranty Date"; End; } var WarrantyDate: Date; }
If I understood it correctly the requirement then see my code
modify("Sales Shipment Line") { trigger OnAfterAfterGetRecord() var ItemLedEntries: Record "Item Ledger Entry"; begin Clear(WarrantyDate); ItemLedEntries.Reset(); ItemLedEntries.SetCurrentKey("Document Type", "Document No.", "Document Line No."); ItemLedEntries.SetLoadFields("Document Type", "Document No.", "Document Line No.", "Serial No.", "Warranty Date", "Expiration Date"); ItemLedEntries.SetRange("Document Type", ItemLedEntries."Document Type"::"Purchase Receipt"); ItemLedEntries.SetRange("Document No.", "Sales Shipment Line"."Document No."); ItemLedEntries.SetRange("Document Line No.", "Sales Shipment Line"."Line No."); ItemLedEntries.setfilter("Warranty Date",'<>%1',0D); if ItemLedEntries.findlast then WarrantyDate := ItemLedEntries."Warranty Date"; End;
here pls correct me here what is the issue.- ON posted Sales Shipment Print
i want to get only one warranty date & Expiration date for each item (if qty is 50 then also one want to pick 1 date) - if warranty date exits for that items
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156