The ccur function in vbscript rounds to 4 past the decimal point. If you need to round further, you should use the round function and set the number of positions based the decimal that are allowed prior to rounding (default is 0). So, for the line that you modified, I'd likely do this:
tmpnum = Round(ccur(tmpnum*.575) + ccur(1.45), 2)
This should give you the desired behavior.
--tr
-----Original Message-----
From: MarcEdit support in technical and instructional matters [mailto:[log in to unmask]] On Behalf Of Andrew Wright
Sent: Friday, October 05, 2012 10:32 AM
To: [log in to unmask]
Subject: [MARCEDIT-L] Problem With Script.
Hi Terry
We have this script that was passed onto us by one of our vendors that you wrote that has proved very useful to us. However, a couple of months ago we modified the processing Marc edit script to use for getting the discount + processing for a different vendor. It worked, but we have now discovered it is creating a problem when the POs go into our financial system
We download these records at retail price from the vendor . We then want to take a 42.5% discount and add $1.45 for processing. So, we edited this part of the original script:
tmpnum = ccur(tmpnum) + ccur(2.59)
to do this:
tmpnum = ccur(tmpnum*.575) + ccur(1.45)
It works, but it carries the price out to 4 decimal spaces in the 970 field we
we generate teh order in our ILS (Polaris)
For example see Bib ctrl #1775484 and PO RF1-13 line 20:
970 ‡lBLW‡p16.9692‡q1
(Retail $19.99)
We would like it to either round, round up, or truncate at 2 decimal spaces.
970 ‡lBLW‡p16.97‡q1
When I load the records onto a purchase order Polaris rounds the price and
shows it as $16.97 in the unit price on the POLI, but it calculates the extended
price using $16.9692. In this case the extended price for 10 copies was
$169.69, not $169.70. And that discrepancy is what is throwing our financial
system off.
We have tried a number of things with no luck can you help us fix the script to
round or truncate the price to 2 decimal spaces?
Thanks,
Andrew Wright
Andrew Wright
Catalog Division Manager
City of Dallas
Public Library
Catalog Division
1515 Young St.
Dallas, Texas 75201
Tel: 214-671-9269
Fax: 214-670-7906
e-mail: [log in to unmask]
________________________________________________________________________
This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
________________________________________________________________________
This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
|