IF "Payment Terms Code" = 'NET+30F' THEN BEGIN RemitText1 := 'xxxxxxxxxxxx:'; RemitText3 := 'xxx xxxxxxxxxxx'; RemitText4 := 'xx xxxxxxx'; RemitText5 := 'xxxxxx xxxxxxx'; RemitText6 := 'xxxxxxxx, xx xxxxx'; RemitText7 := 'THIS ACCOUNT AND ALL THE MERCHANDISE CONSTITUTING THE SAME HAVE BEEN ASSIGNED AND ARE'; RemitText8 := 'OWNED BY, AND PAYABLE EXCLUSIVELY TO xxxxxxxxxxxxxxxxxxxx. IF INCORRECT, IN'; RemitText9 := 'ANY PARTICULAR, COMMUNICATE DIRECTLY TO xxxxxxxxxxxxxxxxxxx.'; RepMarker := COPYSTR("Sell-to Customer Name",1,1);//Gets the first character IF RepMarker IN ['0','1'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['2','3'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['4','5'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['6','7'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['8','9'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['A','B','C'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['D','E','F','G','H'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['I','J','K','L','M'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['N','O','P','Q','R'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker IN ['T','U','V','W','X','Y','Z'] THEN RemitText10 := 'CONTACT xxxxxxxxxxxxxxxx AT: (###)-###-####.'; IF RepMarker = 'S' then begin Repmarker := COPYSTR("Sell-to Customer name",2,1); //gets second char IF Repmarker in ['A','B','C','D','E','F','G','H','I','J','K'] then REMITTEXT10 := '(###)-###-####'; IF Repmarker in ['L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] then REMITTEXT10 := '(###)-###-####'; END;
Comments
END;
END;
I also tried putting it in the middle somewhere.
I can get your code to compile, by putting the END-statement at some place. If your code is working is a different story, I can't resolve that.
Maybe you have some additional code which you don't show, or have the variables declared wrong.
You can also use // to comment out some lines to see if it complies and remove one at a time until you find the offending line. You could be missing a quote or misspelled a variable.
Note: I see you are not using the View->Globals->Text Constants.
It might help you clean that code up.
http://www.BiloBeauty.com
http://www.autismspeaks.org
That got me laughing (sorry).
IF Repmarker in then REMITTEXT10 := '(###)-###-####';
IF Repmarker in then REMITTEXT10 := '(###)-###-####';
how about since if it's not a thru k then it has to be the other choice of phone#'s
IF Repmarker in
then REMITTEXT10 := '(###)-###-####' //one thing
else REMITTEXT10 := '(###)-###-####'; //other thing
http://www.BiloBeauty.com
http://www.autismspeaks.org
Create a new table, Code and Contact No.
Link this to a field in the Customer card Collections Contact
create a batch to update the records on the customer card as appropriate, either manually enter filters and run multiple times, or add from customer and to customer into the Collection Contact table.
Sometimes you can go so far down the wrong path that you can no longer see the light. At that point turn around and start again.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Isn't that what the salesperson code is for?
If reps & salespeople are different in your company and you need an easy way to assign them to a customer - you can add you reps in the salesperson table and add a new field to the customer table calles Sales Rep or whatever. And use Salesperson/Purchaser as TableRelation for your new field so you can pull up the rep values also in a seperate field.
Then all that text would be saved in the Salesperson/Purchaser and you can just call upon it depending on the rep code per customer and any new rep won't cause you such headaches changing code & text & phone numbers based on a character. It would just work. and perhaps if you ever change how reps work in your biz all you have to do is update the customer "Sales Rep" field.
http://www.BiloBeauty.com
http://www.autismspeaks.org
:thumbsup:
See now that is a proper solution, even if they don't have access to a spare table. Basically take my idea and merge it with yours and they don't need this horrible if then in else nonsense.
You can add new fields to that table like
Address
Address 2
City
State
Zip
Country
Fax#
Mobile#
Extention
Makes it very easy to store all the info you need on certain people in your company if New tabels are in tight supply.
you can add the "Sales Rep" field to the sale order (for 1 Get) or Call back on it in your report (with 2 gets) like
Customer.Get(SalesHeader."Sell-to Customer No.") //get access to customer table info
"Salesperson-Purchaser".Get(Customer."Rep Code") //get access to salesperson/purchaser info.
With if's n'such to battle off crashes.
then all that text would simply be fields from the sales/purch table that can be easily managed and changed if needed. You can do it in steps. Keep your old way until you are ready to change.
Add all the necessary fields to hold your rep info.
Add Your rep info.
add your new customer table field.
assign a rep code to each customer. //easy with find & replace or processing report
once all that's done you can work on the report.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Then I was asked to add some data to a Posted Sales Invoice.. so based on the Terms it will print where they should send their payment.
For example, Credit Card would say "Your order has already been paid by credit card. Thanks!"
But for people who are on credit terms, like Net 30 (where they have to pay within 30 days), or Net 60 (pay within 60 days) through an outside company, I needed to write where they need to make the payments and the contact phone numbers. The phones numbers changed every so often.
Probably based on what access I have I probably had to do it this way.
So companies who begin with A-C call one number, D-H call 212 another, I-M call another, N-SK call another, and SL-Z call another.
No that is absolutely NOT true. ](*,) You were given a solution but for some reason chose to ignore it. :thumbsdown:
Ok so let's not call it sales reps. Perhaps "Payment Contact" is a better name.
I was just suggesting that you can use the same table as "salesperson/purchaser" to store your (current) five different Payment Contacts if you didn't have a table available. Just by making a new field on the customer Table "Payment Contact" or "Sales Rep" (whatever makes sence to you) and using "Salesperson/Purchaser" as the table relation, you will be able to assign values to this field with a lookup.
Then based upon the customer name & payment terms you assign one of these contacts on their customer card. Should be easy by filtering the name and using find & replace to fill the values in the field. When you print an invoice it can check the customer card to see which contact info it should print.
*As a bonus you now have a field you can use for reporting
This will allow you to easily update any contact info in one place and add/remove any contacts if you need to. If done this way there will be need for future code changes.
So instead of entering all that TEXT & IF's in the report, it would pull the name, address, phone, etc info right from the table.
Since you need this in a report - no special developer license needed as long as you can add some custom fields. which from other posts I gathered isn't an issue for you.
PS: did you ever figure out the cause of your syntax error (missing end;)?
http://www.BiloBeauty.com
http://www.autismspeaks.org