Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Pricing custom calculation script
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Pricing custom calculation script

 Post Reply Post Reply
Author
chmielcio View Drop Down
New Member
New Member


Joined: 13 Apr 2016
Points: 2
Post Options Post Options   Quote chmielcio Quote  Post ReplyReply Direct Link To This Post Topic: Pricing custom calculation script
    Posted: 13 Apr 2016 at 7:16pm
Hallo
Please help me do custom calculation script for use a linear pricing model that starts at $0.65 per sq inch and goes down as low as $0.35 per sq inch. These prices are based on total order size. If order multiple stencils at once, dimensions are combined for a total discounted price.

Ex1: You have one stencil that is 9sq inches. 9 x $0.65 = $5.85
Ex2: You have 2 stencils, and together they total 21 sqin. 21 x $0.60 = $12.60
Ex3: You have 3 stencils, and together they total 71 sqin. 71 x $0.35 = $24.85
1-12 sq inches - $0.65 (65 cents USD) per sq inch.

Each additional 2sq inches reduces the price by $0.01, with a cap at $0.35

14 sq inches - $0.64 (64 cents USD) per sq inch.
16 sq inches - $0.63 (63 cents USD) per sq inch.
18 sq inches - $0.62 (62 cents USD) per sq inch.
...
...
71+ sq inches - $0.35 (35 cents USD) per sq inch.

Back to Top
Sponsored Links


Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4106
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 13 Apr 2016 at 9:01pm
Have you been able to calculate the area of all of the stencils ordered?

As you stated this is a custom calculation so there is no picking of fields from a list. We need to know the exact name of the fields involved in the calculation or do want us to make a wild guess at the field names.

Your attachment does not provide any of that information.
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4106
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 13 Apr 2016 at 11:40pm
So your pricing is
 0 - 12 square inches is $0.65.
13 - 14 square inches is $0.64.
15 - 66 square inches is $0.63.
and so on
71 - on square inches $0.35.

I would use a custom calculation for the rate field based on the value of the total square inches field.

Something like for the rate field:


function UnitPrice(nTotalSqIn)
{
 /*
 1-12 sq inches - $0.65 (65 cents USD) per sq inch.
 Each additional 2sq inches reduces the price by $0.01, with a cap at $0.35
 Max discount = 0.30
 */
 var nRate = 0.65; // default rate;
 var nAdj = 0;
 if(nTotalSqIn > 12)
 {  // compute only if total square footag greater than 12 sqft;

 nAdj = nTotalSqIn - 12; // sq in for discount
 nAdj = Math.ceil(nAdj / 2); // round up to nearest 2 in;
 nAdj = nAdj * 0.01 ; // adjsutment price per each 2 sq in;
 nAdj = Math.min(nAdj, 0.30); // limit adjustment to a max of 0.30;
 }
 return nRate - nAdj;
} // end UnitPrice function;

event.value = UnitPrice(this.getField("TotalSqIn").value);

One can then use the rate field in the calculation for the total price.

Back to Top
chmielcio View Drop Down
New Member
New Member


Joined: 13 Apr 2016
Points: 2
Post Options Post Options   Quote chmielcio Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2016 at 4:44pm
It works perfect.
You are great.
Thank you!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.063 seconds.