Navision 3.10.
Awhile ago you guys helped me add special text to print on an invoice based on what the payment terms are.
Example:
IF "Payment Terms Code" = 'CC' THEN BEGIN
RemitText1 := 'YOUR ORDER HAS ALREADY BEEN PAID FOR.';
RemitText3 := '';
RemitText4 := '';
RemitText5 := '';
RemitText6 := '';
RemitText7 := '';
RemitText8 := '';
RemitText9 := '';
END;
Etc.. the above dictates that the customer has already paid by CC. There's a bunch of them for all our different Payment Terms. Those RemitText get filled in with more information for other Payment Terms.. for example if there was an address a payment should be mailed to, it will show that on the invoice.
Now I'm wondering if there's a way to further add something to this.
We have problems where some customers are factored (meaning an outside company gives them credit and handles payments for us). In my instructions that print on the invoice it only has information on who to make checks to and where to mail. If the customer has a payment problem (such as they're going to be late, or want to see if they accept credit card, etc), they should be calling them and not us.
I want to add RemitText10 and how can I get Navision to do this:
If Sell-to Customer name starts with the letters A through C then RemitText10 will print one phone number.
If Sell-to Customer name starts with the letters D through H then RemitText10 will print one phone number.
etc.
There's different reps at the company they should contact.
Comments
RepMarker := COPYSTR("Sell-to Customer name",1,1);//Gets the first character
IF RepMarker IN THEN REMITTEXT10 := '123-456-7890';
IF RepMarker IN THEN REMITTEXT10 := '123-456-7891';
IF RepMarker IN THEN REMITTEXT10 := '123-456-7892';
IF RepMarker IN THEN REMITTEXT10 := '123-456-7893';
Does anyone start with a number? you'll have to handle that too.
http://www.BiloBeauty.com
http://www.autismspeaks.org
It's
A - C
D - H
I - M
N - SK
SL - Z
.. your code only checks the first character.
is there another field on the customer card that distinguishes the rep differences instead of the characters in the name? perhaps salesperson code? or a custom field? location code?
http://www.BiloBeauty.com
http://www.autismspeaks.org
You could check for the second char in the same way (its not really performant but as it is one record each time it shouldnt be that much of a problem)
RepMarker := COPYSTR("Sell-to Customer name",1,1);//Gets the first character
IF RepMarker IN THEN REMITTEXT10 := '123-456-7890';
IF RepMarker IN THEN REMITTEXT10 := '123-456-7891';
IF RepMarker IN THEN REMITTEXT10 := '123-456-7892';
IF RepMarker IN THEN REMITTEXT10 := '123-456-7893';
if RepMarker = 'S' then begin
Repmarker := COPYSTR("Sell-to Customer name",2,1); //gets second char
if repmarker in then REMITTEXT10 := '123-456-7890';
if repmarker in then remittext10 := '213-456-7890';
end;
In that code above, I'm assuming it means any letter L through Z. In the line of code above it, why is B there? Shouldn't:
Shouldn't that not need the B? Any letter A through K.
Oh and you could leave the 'S' out of the line above. (IKF RepMarker IN THEN REMITTEXT10 := '123-456-7893';)
It doesnt really do any harm as it gets filled in later on but just in case there is a combination with S that isn't expected in the code.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Just a small trick
Normal filters does work as long as you remember the '' to indicate that it's a text.
I could create a custom field maybe if you think that's a better way of going about things, but that will add one more step to whoever enters the customer card and if they do that step wrong then it'll print wrong.
1 -
I am in the C/AL CODE. In there I can see code I previously entered. There is RemitText1 through RemitText9 that can print currently. For some of the Payment Terms Code I do not use 7-9.. do I need to specify them?
Here's an example of one I've entered:
As you can see 7-9 are blank. Do I even need those three lines? Other times it's used, not in this case.
2 -
Where am I to enter this new code? For example I have the following code:
.. there's more of them following that one for other Payment Terms Code. We're going to add RemitText10 to say 'For assistance call ###-###-####'.
The other two questions - there's 12 of those.. is there a way to add all of them into one? like
I know you probably cannot have more than one OR, but maybe there's another way to do it. Then I can at least shorten my C/AL CODE.
Also, where I am going to add in the code for RemitText10.. will I need to add that every time after RemitText9?
Instead of using multiple IF statements, you should be using a CASE statement. The difference is that with IF statements, it has to evaluate the same value in every IF statement. With a CASE statement it only needs to evaluate the value once, so it is more efficient.
If you're dead set on using multiple IF statements, go like this:
You can have as many OR statements as you want.
Yes you will have to add the Remit10 value to all of them, unless the value is the same for all of them.
RIS Plus, LLC
or use
sometimes it's easier to do it the other way around