Delivery Note, Sum previous send quantity based on DN, Job No, and Job Task No. from Job Ledger Entr

JoaoPereira55
Member Posts: 2
in Dynamics CRM
Hi All,
I am new here, recommended by a friend.
My work place are preparing to launch Dynamics NAV 365 Client side manufacturing next week and they have asked me to write a few reports, I am a full C# Developer.
I am stuck on a particular report and I am not sure what I am doing wrong!
Basically I was asked to create a Delivery Note report,
These are the tables
Job Ledger Entry, Job Planning Line, Job Task, Job, and Job Site Address
Filters
Job Ledger Entry
Job No. = "2010"
Document No. = "DN000029"
Job Site Address
Code = "Main"
What I need is the report to sum any previous Delivery Notes based on the filter the user enters.
Example
Imagine that the Quantity is 10 and last week we raised a delivery note saying that we were sending 2 items this should leave us 8 Remaining Qty, means that there will be 8 more items left to be shipped.
Now let`s say that I send another 2 more today I want the report to sum any previous sent items, so I can report back to the user how many is left,
My thoughts from the beginning was I will just report the Remaining Qty from Job Planning Lane but that`s not the case, here is why if they already shipped a few of these items I would like the code only to report anything before the current Filter Document No.
here is my code when I use it, it breaks my dataset, so I am not getting all the rows I was suppose to have
GlobalQTYToFollow is just a integer global I did
Job Ledger Entry - OnAfterGetRecord()
"Job Ledger Entry".RESET;
"Job Ledger Entry".SETCURRENTKEY("Job No.");
"Job Ledger Entry".SETRANGE("Job No.","Job No.");
"Job Ledger Entry".SETFILTER("Document No.",'<=%1',"Document No.");
IF "Job Ledger Entry".FINDSET(TRUE,FALSE) THEN REPEAT
GlobalQTYToFollow := GlobalQTYToFollow + "Job Ledger Entry".Quantity;
UNTIL "Job Ledger Entry".NEXT =0;
if any of you could please tell me what I am doing wrong
Many Thanks
I am new here, recommended by a friend.
My work place are preparing to launch Dynamics NAV 365 Client side manufacturing next week and they have asked me to write a few reports, I am a full C# Developer.
I am stuck on a particular report and I am not sure what I am doing wrong!
Basically I was asked to create a Delivery Note report,
These are the tables
Job Ledger Entry, Job Planning Line, Job Task, Job, and Job Site Address
Filters
Job Ledger Entry
Job No. = "2010"
Document No. = "DN000029"
Job Site Address
Code = "Main"
What I need is the report to sum any previous Delivery Notes based on the filter the user enters.
Example
Imagine that the Quantity is 10 and last week we raised a delivery note saying that we were sending 2 items this should leave us 8 Remaining Qty, means that there will be 8 more items left to be shipped.
Now let`s say that I send another 2 more today I want the report to sum any previous sent items, so I can report back to the user how many is left,
My thoughts from the beginning was I will just report the Remaining Qty from Job Planning Lane but that`s not the case, here is why if they already shipped a few of these items I would like the code only to report anything before the current Filter Document No.
here is my code when I use it, it breaks my dataset, so I am not getting all the rows I was suppose to have
GlobalQTYToFollow is just a integer global I did
Job Ledger Entry - OnAfterGetRecord()
"Job Ledger Entry".RESET;
"Job Ledger Entry".SETCURRENTKEY("Job No.");
"Job Ledger Entry".SETRANGE("Job No.","Job No.");
"Job Ledger Entry".SETFILTER("Document No.",'<=%1',"Document No.");
IF "Job Ledger Entry".FINDSET(TRUE,FALSE) THEN REPEAT
GlobalQTYToFollow := GlobalQTYToFollow + "Job Ledger Entry".Quantity;
UNTIL "Job Ledger Entry".NEXT =0;
if any of you could please tell me what I am doing wrong
Many Thanks
0
Answers
-
Hi again, for any of you out there, here is the code I came up with, not sure if its correct but the good thing is its working perfectly. and my boss is happy
Job Ledger Entry - OnAfterGetRecord()
JobLedgerEntry.RESET;
JobLedgerEntry := "Job Ledger Entry";
JobLedgerEntry.SETCURRENTKEY("Job No.");
JobLedgerEntry.SETRANGE("Job No.","Job No.");
JobLedgerEntry.SETFILTER("Document No.",'<=%1',"Document No.");
IF JobLedgerEntry.FINDSET THEN REPEAT
GlobalQTYToFollow :=0;
JobLedgerEntry.SETFILTER("No.","No.");
IF JobLedgerEntry.FINDSET THEN REPEAT
GlobalQTYToFollow:= GlobalQTYToFollow + "Job Ledger Entry".Quantity;
UNTIL JobLedgerEntry.NEXT =0;
JobLedgerEntry.Quantity := GlobalQTYToFollow;
UNTIL JobLedgerEntry.NEXT =0;
Job Ledger Entry - OnPostDataItem()
Job Planning Line - OnPreDataItem()
Job Planning Line - OnAfterGetRecord()
JobPlanningLine.RESET;
JobPlanningLine := "Job Planning Line";
JobPlanningLine.SETCURRENTKEY("Job No.","Job Task No.","No.");
JobPlanningLine.SETRANGE("Job No.","Job Ledger Entry"."No.");
JobPlanningLine.SETRANGE("Job Task No.","Job Ledger Entry"."Job Task No.");
JobPlanningLine.SETRANGE("No.","Job Ledger Entry"."No.");
Job Planning Line - OnPostDataItem()0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions