<% @LANGUAGE="JavaScript" %> <% // 031509 JAO // The following line will create a shoppingcart session if it does not exist. if (Session("CartItem")==undefined){ Session("Referrer") = "index.asp"; // This will have to be changed to the name on each product page. Response.Redirect("CreateSession.asp"); } //Set the default global variables var DEBUG; DEBUG = 0; var psize; var ptype; var pink; var qty_levels = new Array(24); var qty_minimum = new Array(24); var base_prices = new Array(24); var total_price; for (var i = 0; i < 2; i++) { if (i==0) { psize = "8.5x11"; } else if (i==1) { psize = "11x17"; } for (var k = 0; k < 3; k++) { if (k==0) { pink = "4/4"; } else if (k==1) { pink = "4/1"; } else if (k==2) { pink = "4/0"; } var params = psize+","+pink qty_levels[params]="100,250,500,1000,1500,2000,2500,3000,3500,4000,4500,5000,5500,6000,6500,7000,7500,8000,8500,9000,9500,10000"; qty_minimum[params]="100"; var level_array = qty_levels[params].split(","); for (var m = 0; m < level_array.length; m++) { base_prices[level_array[m]+","+params]="150.00"; } } } %> <% function SetSessionVariables(){ if(Request.Form("rbPaperStock") == "60#LT"){ Session("IndPaperStock") = 0; } else if(Request.Form("rbPaperStock") == "70#LT"){ Session("IndPaperStock") = 1; } else if(Request.Form("rbPaperStock") == "80#GT"){ Session("IndPaperStock") = 2; } else if(Request.Form("rbPaperStock") == "80#ST"){ Session("IndPaperStock") = 3; } else if(Request.Form("rbPaperStock") == "100#GT"){ Session("IndPaperStock") = 4; } else if(Request.Form("rbPaperStock") == "100#ST"){ Session("IndPaperStock") = 5; } else if(Request.Form("rbPaperStock") == "80#GC"){ Session("IndPaperStock") = 6; } else if(Request.Form("rbPaperStock") == "80#SC"){ Session("IndPaperStock") = 7; } else{ // (Session("IndPaperStock") == undefined) Session("IndPaperStock") = 0; } if (Request.Form("rbBackInk") == "rbBackInk1" ){ Session("IndrbBackInk") = 1; } else if (Request.Form("rbBackInk") == "rbBackInk2" ){ Session("IndrbBackInk") = 2; } else if (Request.Form("rbBackInk") == "rbBackInk3" ){ Session("IndrbBackInk") = 3; } else { //(Session("IndrbBackInk")== undefined) Session("IndrbBackInk") = 1; } if (Request.Form("rbSize") == "rbSize1" ){ Session("IndrbSize") = 1; } else if (Request.Form("rbSize") == "rbSize2" ){ Session("IndrbSize") = 2; } else{ //if(Session("IndrbSize")== undefined) Session("IndrbSize") = 1; } if (Request.Form("rbFolding") == "rbFoldingNoFold" ){ Session("IndrbFolding") = 0; } else if (Request.Form("rbFolding") == "rbFoldingHalfFold" ){ Session("IndrbFolding") = 1; } else if (Request.Form("rbFolding") == "rbFoldingTriFold" ){ Session("IndrbFolding") = 2; } else if (Request.Form("rbFolding") == "rbFoldingZFold" ){ Session("IndrbFolding") = 3; } else { // if(Session("IndrbFolding")== undefined) Session("IndrbFolding") = 0; } Session("ValidInput") = 1; } SetSessionVariables(); function CalculatePrice(){ var params = GetParams(); var paper_price = GetPaperPrice(); var min_quantity; var max_quantity; var min_price; var max_price; var base_price; var x_value; var y_value; var folding_price; var offset; var default_price = base_prices["8.5x11,80#GT"]; var q = Request.Form("tbxQuantity"); if (isNaN(q) == true){ Response.Write(""); Session("ValidInput") = 0; return; } if ((1*Request.Form("tbxQuantity")).toString() == "NaN") { Response.Write(""); Session("ValidInput") = 0; return; //document.Form1.tbxQuantity.value = qty_minimum[params]; } if ((1*Request.Form("tbxQuantity")) < qty_minimum[params]) { Response.Write(""); Session("ValidInput") = 0; return; //document.Form1.tbxQuantity.value = qty_minimum[params]; } min_quantity = GetQtyLevel(params); max_quantity = GetNextQtyLevel(params); if (Request.Form("rbSize") == 'rbSize2' ){ default_price = base_prices["11x17,80#GT"]; } min_price = eval(base_prices[min_quantity+","+params]+"/"+min_quantity); max_price = eval(base_prices[max_quantity+","+params]+"/"+max_quantity); if (max_quantity == min_quantity) { max_quantity += 1 }; x_value = (max_price - min_price) / (max_quantity - min_quantity); y_value = min_price - min_quantity * x_value; base_price = Request.Form("tbxQuantity") * x_value + y_value; offset = (paper_price-default_price)*.01*Request.Form("tbxQuantity"); base_price = base_price*Request.Form("tbxQuantity")+offset; folding_price = GetFoldingPrice(); total_price = base_price + folding_price; Session("TotalPrice") = total_price.Item; } function GetParams() { var params; var psize; var pink; //Get the paper size if (Request.Form("rbSize") == 'rbSize1' ) { psize = "8.5x11"; } else if (Request.Form("rbSize") == 'rbSize2' ) { psize = "11x17"; } else { document.Form1.rbSize_0.checked = true; psize = "8.5x11"; // Default if no paper size selected. } //Get the ink type if (Request.Form("rbBackInk") == "rbBackInk1" ) { pink = "4/4"; } else if (Request.Form("rbBackInk") == "rbBackInk2" ) { pink = "4/1"; } else if (Request.Form("rbBackInk") == "rbBackInk3" ){ pink = "4/0"; } else { document.Form1.rbBackInk_2.checked = true; pink = "4/0"; } params = psize+","+pink; return params; } function GetPaperPrice() { var paper_price; var psize; //Get the paper size if (Request.Form("rbSize") == 'rbSize1' ) { psize = "8.5x11"; } else if (Request.Form("rbSize") == 'rbSize2' ) { psize = "11x17"; } else { document.Form1.rbSize_0.checked = true; psize = "8.5x11"; // Default if no paper size selected. } //Get the paper type if (Request.Form("rbPaperStock") == "60#LT") { paper_price = eval(base_prices[psize+",60#LT"]); } else if(Request.Form("rbPaperStock") == "70#LT"){ paper_price = eval(base_prices[psize+",70#LT"]); } else if(Request.Form("rbPaperStock") == "80#GT"){ paper_price = eval(base_prices[psize+",80#GT"]); } else if(Request.Form("rbPaperStock") == "80#ST"){ paper_price = eval(base_prices[psize+",80#ST"]); } else if(Request.Form("rbPaperStock") == "100#GT"){ paper_price = eval(base_prices[psize+",100#GT"]); } else if(Request.Form("rbPaperStock") == "100#ST"){ paper_price = eval(base_prices[psize+",100#ST"]); } else if(Request.Form("rbPaperStock") == "80#GC"){ paper_price = eval(base_prices[psize+",80#GC"]); } else if(Request.Form("rbPaperStock") == "80#SC"){ paper_price = eval(base_prices[psize+",80#SC"]); } else { document.Form1.rbPaperStock_2.checked = true; paper_price = eval(base_prices[psize+",80#GT"]); } return paper_price; } function GetQtyLevel(params) { var level_array = qty_levels[params].split(","); var rtn_level = 0; var qty_level = 0; for (var i = 0; i < level_array.length; i++) { qty_level = level_array[i]; if (( Request.Form("tbxQuantity") *1) >= (qty_level*1)) { rtn_level = qty_level; } } return rtn_level; } function GetNextQtyLevel(params) { var level_array = qty_levels[params].split(","); var rtn_level = 0; var qty_level = 0; for (var i = 0; i < level_array.length-1; i++) { qty_level = level_array[i]; if ((Request.Form("tbxQuantity") *1) >= (qty_level*1)) { rtn_level = level_array[i+1]; } } if (rtn_level == 0) { rtn_level = level_array[level_array.length-1]; } return rtn_level; } function GetFoldingPrice() { var folding_price; if (Request.Form("rbFolding") == "rbFoldingNoFold" ) { folding_price = 0; } else { folding_price = Request.Form("tbxQuantity")*.01; if (folding_price < 10) { folding_price = 10; } } return folding_price; } function FormatCents(value) { var result=(Math.round(value*100)/100).toString(); var dec_pos = result.indexOf("."); var zeros = 0; if (dec_pos < 0) { result += "."; zeros = 2; } else { zeros = 2 - (result.length - dec_pos - 1); } for (var i = 0; i < zeros; i++) { result += "0"; } result = "$" + result; return result; } //Here is how I do pricing using basic algebra // //Assume a Quantity of 100 = $247.00 // a Quantity of 300 = $450.00 //What is the price for a quantity of 220 // //A linear equation will take the form of 'Quantity * x + y = Price' //So our first two equations can be written as follows //100x + y = 247 //300x + y = 450 // //Using the substitution technique for solving simultaneous equations //we solve for both x and y // //y = 247 - 100x <-- from our first equation we rewrite it terms of y // //300x + 247 - 100x = 450 <-- substitute 247 - 100x for y in the 2nd equation, then solve for x //200x = 450 - 247 //200x = 203 //x = 203/200 //x = 1.015 <-- this is the value of x //(300)(1.015) + y = 450 <-- substitute 1.015 for x in the 2nd equation, then solve for y //y = 450 - (300)(1.015) //y = 145.5 <-- this is the value of y // //(100)(1.015) + 145.5 = 247 <-- check our answer //(300)(1.015) + 145.5 = 450 <-- check our answer // //220x + y = ? //(220)(1.015) + 145.5 = 368.80 <-- this is our price for a quantity of 220 // //So here is what I do //1) Get the current price of item and next higher price of item //2) I should have the following variables // MinQuantity, MinPrice // MaxQuantity, MaxPrice // xVal = (MaxPrice-MinPrice)/(MaxQuantity-MinQuantity) // yVal = MinPrice - MinQuantity * xVal //3) My current price is (Quantity)(xVal) + (yVal) %> PasskeyPrint - Passkey Systems Inc - Print Online On Demand since 1975 <% if(DEBUG == 1){ Response.Write("DEBUG IS ON. Details:
"); Response.Write("Output:
"); Response.Write("Product1:rbProduct: " + Request.Form("Product1:rbProduct") + "
"); Response.Write("tbxQuantity: " + Request.Form("tbxQuantity") + "
"); Response.Write("rbBackInk: " + Request.Form("rbBackInk") & "
1 = Full Color, 2 = black and white, 3 = blank
"); Response.Write("rbSize: " + Request.Form("rbSize") + "
rbSize1 = 8x11, rbSize2 = 11x17
"); Response.Write("rbPaperStock: " + Request.Form("rbPaperStock") + "
"); Response.Write("rbFolding: " + Request.Form("rbFolding") + "
"); Response.Write("btnUpdate: " + Request.Form("btnUpdate") + "
"); Response.Write("btnAddToCart: " + Request.Form("btnAddToCart") + "
"); } %>
 
 
<% Response.Write("
"); var boolUpdate; boolUpdate=String(Request.Form("btnUpdate")); var boolAddToCart; boolAddToCart = String(Request.Form("btnAddToCart")); if(boolUpdate=="undefined" && boolAddToCart=="undefined"){ ; // Do nothing because neither button was clicked. // Response.Write("boolAddToCart is undefined
"); }else{ Response.Write(""); Response.Write(""); if(boolAddToCart!="undefined" && Session("ValidInput") == 1){ //redirect to Add to Cart Page Response.Redirect("http://www.PasskeyPrint.com/shopaddpasskeyitem.asp"); } } %>
Product
Brochures
(flyers, sales sheets, handouts, etc)
Booklets
(reports, newsletters, catalogs, etc)
Postcards
CD Inserts
Business Cards

Quantity <% if (DEBUG == 1) Response.Write( "tbxQuantity" + Request.Form("tbxQuantity")); %> 0) Response.Write(Request.Form("tbxQuantity")); else Response.Write(250); %>" id="tbxQuantity" name="tbxQuantity";" style="width:50px;" / size="20">

Ink
Front
  Back
/>Full Color
/>Black & White
/>Blank
 

Paper Size
onClick="GoTo('brochure');" /> />
 

Paper Stock
/>24/60# Laser Text />80# Silk Text />80# Gloss Cover
/>28/70# Laser Text />100# Gloss Text />80# Silk Cover
/>80# Gloss Text />100# Silk Text

Folding
/>No Fold
/>Half-Fold
/>Tri-Fold
/>Z-Fold

Turnaround
NO RUSH CHARGES!
1 to 2 Day Standard Production on Most Jobs!
Many jobs are even shipped the same day we get them.

"); //Display Product Information Response.Write("
Product Details:
"); //Build the product description string var strProductDescription strProductDescription = "(" + Request.Form("tbxQuantity") + ") "; if(Request.Form("rbBackInk")=="rbBackInk1"){ strProductDescription = strProductDescription + "Full Color Brochures "; } else if (Request.Form("rbBackInk")=="rbBackInk2") { strProductDescription = strProductDescription + "Color Front and BW Back Brochures "; } else { // nothing on back strProductDescription = strProductDescription + "Color Front and Blank Back Brochures "; } if(Request.Form("rbSize") == "rbSize1"){ // 8.5x11 strProductDescription = strProductDescription + "on 8.5x11 paper "; } else { // 11x17 strProductDescription = strProductDescription + "on 11x17 paper "; } strProductDescription = strProductDescription + "with paper sytle " + Request.Form("rbPaperStock") + " "; if(Request.Form("rbFolding")=="rbFoldingNoFold") { strProductDescription = strProductDescription + "and No Fold folding style
"; } else if (Request.Form("rbFolding")=="rbFoldingHalfFold"){ strProductDescription = strProductDescription + "and Half-Fold folding style
"; } else if (Request.Form("rbFolding")=="rbFoldingTriFold"){ strProductDescription = strProductDescription + "and Tri-Fold folding style
"; } else { // Z fold strProductDescription = strProductDescription + "and Z-Fold folding style
"; } // Output Product Description Response.Write(strProductDescription); Session("sessProdDesc")=strProductDescription; Session("sessQuantity")=1; //Response.Write("sessProdDesc: "+Session("sessProdDesc")+"
"); // Calculate and output price CalculatePrice(); if(DEBUG==1) Response.Write("Product Cost: "+total_price+"
"); Response.Write("Product Cost: "+FormatCents(total_price)+"
"); Session("sessTotalPrice")=total_price; //Response.Write("SessTotalPrice: "+Session("sessTotalPrice")+"
"); Response.Write("

               
 

 Contact:
Passkey Systems
Nevada's Largest Direct Marketing Company
4395 Polaris Avenue, Las Vegas, NV 89103-4152
Ph: (702) 798-7999   Fax: (702) 798-5502
PasskeyPrint@PasskeySys.com