Copy records from one quote to another

hairyjim
Member Posts: 99
I have been working on additional functionality to the 'copy document' functionality within 3.6 in the below thread.
http://www.mibuso.com/forum/viewtopic.php?t=7661
I have got this sorted with some good help.
My questions kind of follows on from that above.
Each quote within my system has footer comments that can be can be printed at the bottom of the quote. This works well.
I created a new table for this with the following fields:
Language, Document No., Type, Line No. and description
When I use the copy quote functionality I would like to copy the footer comments over to the new quote. I am relativly new to Navision and I am not sure what I need to look at within Navision to get me started on doing this. Could someone point me in the right direction please.
http://www.mibuso.com/forum/viewtopic.php?t=7661
I have got this sorted with some good help.
My questions kind of follows on from that above.
Each quote within my system has footer comments that can be can be printed at the bottom of the quote. This works well.
I created a new table for this with the following fields:
Language, Document No., Type, Line No. and description
When I use the copy quote functionality I would like to copy the footer comments over to the new quote. I am relativly new to Navision and I am not sure what I need to look at within Navision to get me started on doing this. Could someone point me in the right direction please.
Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.
0
Answers
-
This will not be a suprise I hope, but I will point you in the same direction as last time.
Codeunit 6620
Look for this section of codeEND; END; NEWFUNCTIONHERE END; IF MoveNegLines THEN DeleteSalesLinesWithNegQty(FromSalesHeader,FALSE); IF LinesNotCopied > 0 THEN MESSAGE(Text004);
Put a new function to copy your table at NEWFUNCTIONHERE.0 -
So am I thinking along the right lines I can use the TRANSFERFIELDS functionality?
Having no development documentation and just the help within navision for cside is a little limiting.Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
You can use TRANSFERFIELDS if both tables have the same field structure.
In this case I think you can.0 -
Yeah sorry the data is in the same table. Basically just duplicating lines associated with one quote but attaching them to another quote.
It would be like the copysaleslines function within this code unit I guessGive a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
Yes, the function should look like the copysaleslines function.
Just keep it as basic as possible if it is just customisation.0 -
OK. I have got somewhere with this.
I created two local record variables to the CopySalesDoc function; ToFooter & FromFooter
There is a case statement, which at the very top defines several conditionsCASE FromDocType OF //SalesDocType::Quote, SalesDocType::"Blanket Order", SalesDocType::Order, SalesDocType::Invoice, SalesDocType::"Return Order", SalesDocType::"Credit Memo":
As you can see I commented out the Quote one and I created a new statement at the end solely for Quote:SalesDocType::"QUOTE": BEGIN ItemChargeAssgntNextLineNo := 0; FromSalesLine.RESET; FromSalesLine.SETRANGE("Document Type",FromSalesHeader."Document Type"); FromSalesLine.SETRANGE("Document No.",FromSalesHeader."No."); IF MoveNegLines THEN FromSalesLine.SETFILTER(Quantity,'<=0'); IF FromSalesLine.FIND('-') THEN REPEAT CopySalesLine(ToSalesHeader,ToSalesLine,FromSalesHeader,FromSalesLine,NextLineNo,LinesNotCopied,0); CopyFromSalesDocDimToLine(ToSalesLine,FromSalesLine); IF FromSalesLine.Type = FromSalesLine.Type::"Charge (Item)" THEN CopyFromSalesDocAssgntToLine(ToSalesLine,FromSalesLine,ItemChargeAssgntNextLineNo); UNTIL FromSalesLine.NEXT = 0; // Copy footer comments FromFooter.RESET; FromFooter.SETRANGE("Document No.",FromSalesHeader."No."); IF FromFooter.FIND('-') THEN REPEAT ToFooter."Document No." := FromSalesHeader."No."; ToFooter."Type" := 1; ToFooter."Line No." := FromFooter."Line No."; ToFooter."Description" := FromFooter."Description"; UNTIL FromFooter.NEXT = 0; // End Copy footer comments END;
The main thing I tried to do is at the bottom of the quote case statement. This is where I attempted to create the copying of the comment lines, it does not seem to work. Nothing seems to happen at all.
Could you point out what I have attempted to do wrong please. To be honest I thought I had done it right.Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
-
Ahh great - yes obvious now you told me :oops:
But I now get the following error:
The Header / Footer already exists
Identification and values:
Table='Quote',Language Code='',Document No.='SQ06898',Type='Footer Notes',Line No.='1000'
I added the insert at the end of the statements for this seem to be the only way it seem to try and work:ToFooter."Table" := FromFooter."Table"; ToFooter."Document No." := ToSalesHeader."No."; ToFooter."Type" := 1; ToFooter."Line No." := FromFooter."Line No."; ToFooter."Description" := FromFooter."Description"; ToFooter.insert(TRUE);
Any thoughts?Give a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
It would help if I specified the lannguage code! All fixed - thanks for helping me get there Mark!
JimGive a man a fish and he will eat for a day, teach a man to fish and he will drink beer allday.0 -
OK, congratulations and on to the next chalenge0
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