When you use the copy document functionality can it:
1) Copy the quote description
2) Tell you that there are blocked items (but skip them) but still bring over the rest of the document.
Anyone know where in Report 292 I need to change to make this happen?
Cheers
Jim
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 I believe to be the code that does the copying of sales lines to the new sales quote.
The function call of: CheckItemAvailable(ToSalesHeader,ToSalesLine); I think I need to put in the IF statement just after the repeat so I can check before trying to copy, and if it comes back true then skip that record.
I am not sure how to achieve this. Could someone please advise.
Thanks
After the REPEAT something like this:
If FromSalesLine."Type" = FromSalesLine."Type"::Item then begin
Item.get(FromSalesLine."No.");
IF Item.Blocked THEN
IF confirm('Item %1 is blocked and will not be copied',TRUE,FromSalesLine."No.") THEN;
End;
IF ((FromSalesLine."Type" = FromSalesLine."Type"::Item) AND NOT Item.Blocked) OR (FromSalesLine."Type" <> FromSalesLine."Type"::Item) then
IF FromSalesLine.Quantity > 0 THEN BEGIN
....
The confirm YES / NO buttons can both be used, as this is used only for display purposes here.
In the code there is the following lines:
Now from what I have researched the copy document functionality works thus (ignoring Include header option):
If you 'recalculate lines' any line that is blocked will stop the process. The error gets thrown from the sales line table, in the code posted above.
If you do not 'recalculate lines' then all lines including blocked get copied to the new sales quote.
Now I think I have two options.
a) I modify the sales line table so that it respects the blocked items check but throws a friendly error which would allow the process to continue.
b) I somehow manage to figure out which bit of code is used for not recalculating lines and modify it so that bit of code is fired for recalculating lines but throws a friendly error which would allow the process to continue.
Which option do people think will work best in the grand scheme of things, or is there a much better and simpler way of doing this.
I would not change the salesline table.
You should try to not have the blocked items in your copies salesorder.
Navision does this for G/L accounts that have direct posting.
Have a look in the function CopySalesLine in the Codeunit 6620.
You wil find the following piece of code there:
Notice that the boolean CopyThisLine is set to false is directposting if false.
You need to program a similar thing if the item is blocked.
If you need help with this, just ask.
Yeah I could do with a little extra explaining as to how I can use this to allow quotes to be copied to another quote without copying blocked items but to continue processing if it does find a blocked record
I hope it works, it should, but I have not tested.
If you want realy neat programming you should do a case statement.
When it does come across a line that is 'blocked' it does skip and carry n copying but it shows the following error after the batch copy has finished.
"The document line(s) with a G/L account where direct posting is not allowed have not been copied ot the new document by the copy document batch job."
Do you know where this message is thrown from, I would like to change it to say something more friendly such as "Certain items were not copied because they are blocked".
Thanks for your help, I have really learned some nwe things while trying to do this over the last few days.
It is raised in the Function CopySalesDoc
Better is to create a new message, and leave the Text004 as it is, for future upgrading.
Most excellent.
You and others in this thread have helped a great deal!
Thankyou all.
Jim