Printing Credit Memo Problem

Mauddib
Member Posts: 269
3.70.B
In sales and receivables there is an option of "Posted Invoices" and in here there is a PRINT button. This print button printed the invoice you were on.
I have added menu items inside this button so we can now print out the invoice in one of two formats. An EU format and a US format.
However since I made this change something odd has happened. When you go to sales and receivables and into "Credit Memos". You set up a Credit Memo here and hit the "Post and Print" option.
When the user does this now, it prints out Every credit memo on the system! Not just the one you set up.
I am not sure even where to START looking for the problem and would appreciate suggestions. If you need to see any code from any tables or codeunits then please mail me and ask for them gavin.mcbride@gmail.com
GaMBe
In sales and receivables there is an option of "Posted Invoices" and in here there is a PRINT button. This print button printed the invoice you were on.
I have added menu items inside this button so we can now print out the invoice in one of two formats. An EU format and a US format.
However since I made this change something odd has happened. When you go to sales and receivables and into "Credit Memos". You set up a Credit Memo here and hit the "Post and Print" option.
When the user does this now, it prints out Every credit memo on the system! Not just the one you set up.
I am not sure even where to START looking for the problem and would appreciate suggestions. If you need to see any code from any tables or codeunits then please mail me and ask for them gavin.mcbride@gmail.com
GaMBe
0
Comments
-
Have you already tried the debugger?
Check Codeunit 82 from where the printing starts and see what Navision does.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
You should have a codeblock like this one in the GetReport function in CU 82.
This sets the filter on the Credit memo to print after the Credit Memo has been posted. If that does not work then probably the
"Last Posting No." in the sales header is not filled correctly.
"Document Type"::"Credit Memo":
BEGIN
IF "Last Posting No." = '' THEN
SalesCrMemoHeader."No." := "No."
ELSE
SalesCrMemoHeader."No." := "Last Posting No.";
SalesCrMemoHeader.SETRECFILTER;
PrintReport(ReportSelection.Usage::"S.Cr.Memo");
END;Kai Kowalewski0 -
Thanks, the line in code unit 82 had changed from...
S.cr.memo
to......
S.invoice
Has anyone experienced this? All I did was...
1) Edit the form you get when you go into "posted credit memos"
2) Added a new report for the new invoice
3) Edited the sales credit memo header table slightly
4) added the option s.invoice2 to the report selections table.
So why would codeunit 82 change itself???
GaMBe0 -
When you insert an option in the middle of the option string, the integers represented by the options don't change, they just shift over one step.
So let's say you start with this option string:
one,two,three
Internally, Navision stores that as 1,2,3. In the code editor a value of 2 will show up as MyField::two, but when you close it, internally it reverts back to the value 2.
Now, when you change the option string, by inserting an option in the middle, like so:
one,oneB,two,three
Internally, Navision stores this as 1,2,3,4. The tricky part however, is that when you now open your codeunit with the value 2, it will now display MyField::oneB, which is what the value 2 now means, when in fact you intended it to say MyField::two.
So, when you need to add an option, add it to the end of the option string, and even give yourself some room if you need to add one to a standard Navision field, so you don't get into upgrade trouble when Navision adds an option themselves.
Let's say you want to add a document type to the sales order. Instead of inserting the new one in between one of the existing ones:
,G/L Account,Item,NewType,Resource,Fixed Asset,Charge (Item)
you do this:
,G/L Account,Item,Resource,Fixed Asset,Charge (Item),,,,,,,,,,,,,NewType
The first one will completely screw up your sales posting, because all option values after the Item value will shift one over. By adding it at the end, Navision assigns it the higher, additional, value and you can just add the code to the system. By the way, as long as you don't put any spaces between the empty option values, the NewType should just appear at the end of the list.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