Picking up on Pointy's idea of a table the following jsfiddle first of all sets up a table which is then used to lookup costs. (Code at bottom)
The given price ranges are split into groups of 10, with repeated values to give the group ranges, ie the costs for groups (11-20),(21-30),(31-40) and (41-50) are all set to the price range for (11-50)
Taking 1 from the number of documents, dividing by 10 and taking the integer part put you into the correct part of the table for that number of documents.
The table is done for company sizes of 1-100 and 101-200
provided that company sizes go up in 100s it would be straight forward to add further companies. To get to the company part of the table take 1 from size divide by 100 and take integer part. If the ranges of company sizes varied in size then the set up table code would need to be amended into equal grouping as for the number of documents.
Hopefully the data for costs can easily be maintained.
var DOC; //number of documents;
var COMP; //size of company;
numComps=2; //Number of companies in table
/*price range for each company falls into four bands
for company size
priceRange[size][0] is for 1-10 docs
priceRange[size][1] is for 11-50 docs
priceRange[size][2] is for 51-200 docs
price range[size][4] is for 200+ docs
priceRange */
priceRange=[]
//company size 1-100
priceRange[0]=[260.39,433.99,694.38,1041.57];
//company size 101-200
priceRange[1]=[382.12,546.86,874.98,1312.47];
//expand through different company sizes as needed
/*split price ranges into groups of ten and equate to form groups for document sizes and form table for companies and document sizes*/
//set up table
companies=[];
for(var size=0; size<numComps; size++) {
companies[size]=[];
companies[size][0]=priceRange[size][0]; //docs 1-10
for(var docms=1; docms<5; docms++) { //docs 11-50
companies[size][docms]=priceRange[size][1];
}
for(var docms=5; docms<20; docms++) { //docs 51-200
companies[size][docms]=priceRange[size][2];
}
companies[size][20]=priceRange[size][3];//docs 200+
}
function getCost(docs,comps) {
docs=Math.floor((docs-1)/10);
if (docs>20) {docs=20};
comps=Math.floor((comps-1)/100);
return(companies[comps][docs]);
}
//example
DOC=8;
COMP=43;
console.log(DOC,COMP,getCost(DOC,COMP));