<%@ language="javascript" %> Calculate Postage

<% var PaymentMethod = String(Request("PaymentMethod")); function GetPaypalState(State) { if (State == "VIC") State = "Victoria"; else if (State == "TAS") State = "Tasmania"; else if (State == "NSW") State = "New South Wales"; else if (State == "QLD") State = "Queensland"; else if (State == "SA") State = "South Australia"; else if (State == "NT") State = "Northern Territory"; else if (State == "WA") State = "Western Australia"; else if (State == "ACT") State = "Australian Capital Territory"; return State; } function WritePaypalPostageItemHiddenField(Index, Postage) { Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); } function WritePaypalItemHiddenFields(Index, Code, Name, Size, Price, Quantity) { //Response.Write("###################################################################################
"); //Response.Write("Index = " + Index + "
"); //Response.Write("Code = " + Code + "
"); //Response.Write("Name = " + Name + "
"); //Response.Write("Size = " + Size + "
"); //Response.Write("Price = " + Price + "
"); //Response.Write("Quantity = " + Quantity + "
"); //Response.Write("###################################################################################
"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); } function GetPaymateGetParameters() { //**************************************************************************************************************** //* //* amt The payment amount //* amt_editable (1) Indicate if payment amount is editable or not //* currency (2) The currency code of the payment amount. //* ref A seller reference number for a transaction //* pmt_sender_email The buyer's email address //* pmt_contact_firstname The buyer's first name //* pmt_contact_surname The buyer's surname //* pmt_contact_phone (3) The buyer's phone number //* pmt_country The buyer's country. //* regindi_state The buyer's state. //* regindi_address1 The first address line of the buyer's address //* regindi_address2 The second address line of the buyer's address //* regindi_sub The suburb of the buyer's address //* regindi_pcode The postcode of the buyer's address //* return (4) A fully-qualified (eg: http://www.yoursite.com/paymentreceived.asp) URL to which //* Paymate will redirect the buyer. This redirect will occur when they click the continue //* button on the receipt page of the Express Payment wizard. //* popup (5) Indicate if your website has opened Paymate Express in a new window. Must be either //* true or false, default is true. If this value is true, the Paymate Express window will //* close before displaying the 'return' URL in the browser window which opened Paymate //* Express. If this value is false, the 'return' URL will be displayed in the same window //* as Paymate Express. //* rpdate For a recurring paymment, defines the last day after which no payments are to be made. //* This has to be passed in the Date Format: “dd MMM yyyy”. For example, if the last date //* for a recurring payment is 10th June, 2009, you need to enter 10 JUN 2009. //* rpfrequency (6) For a recurring payment, defines the frequency with which payments are to be made. This //* property can take one of the following values: //* weekly - the recurring amount will be charged on a seven (7) days basis. //* fortnightly - the recurring amount will be charged on a fourteen (14) days basis. //* monthly - the recurring amount will be charged on a monthly (30) days basis. //* //* (1) Acceptable values for amount editable are: Y - editable N - not editable . //* //* (2) Existing websites which previously specified the currency as 'curr' will continue to function, but are //* encouraged to update their links to pass this parameter with a name of 'currency' as the 'curr' parameter may //* not be supported in the future. //* //* (3) Acceptable characters for phone numbers are: digits 0 through 9 ( ) - + and space. Any phone numbers which //* contain invalid characters will not be prepopulated. //* //* (4) This URL must be able to handle POST requests. Depending on your website host, redirecting to static pages //* (eg URLs ending with '.htm' or '.html') may not work. Please consult your website host for acceptable pages you //* can specify for this value. //* //* (5) If you are specifying false for this parameter, please ensure that the target of your link/form is "_top" so //* that the security padlock is displayed in the browser's status bar. This is particularly relevant to websites //* using framesets, as the security padlock may not be displayed when a secure page is displayed within a //* non-secured frameset. //* //* (6) To set up a recurring payment for a 6 month subscription beginning on 15th January, 2009, the parameter values //* would be: //* rpdate = 15 JUL 2009 //* rpfrequency = monthly //* //* Notes: //* //* Acceptable values to specify for the currency parameter are "AUD" , "USD" "EUR" "GBP" and "NZD". If this parameter //* is not specified, or is invalid, the default currency code is AUD. Please check acceptable values to specify for //* the country parameters list . If this parameter is not specified, or is invalid, please select the country. //* Please ensure that the return URL (if specified) is a complete URL, otherwise your website will not receive the //* payment response information. The seller reference number supplied to Paymate Express should be unique. This will //* sssist: //* you in identifying individual payments //* your shopping cart or website to function correctly when processing more than one payment at a time //* //* Example //* //* To create a link for a USD 100.00 Paymate Express payment to a seller with a username of 'demonstration', you would //* change the url variable from: //* //* [link image] //* to: //* //* [link image] //* Protected Fields //* //* When posting information from your shopping cart or website to the Paymate Express payment page, certain fields //* are "locked", making them uneditable by the person making the payment. These fields are as follows: //* //* Payment Amount //* Currency //* By protecting these fields, you can be assured that the payment information being processed by Paymate is //* consistent with your shopping cart or website ordering process. //* //* Output Parameters //* //* If you have nominated a return URL in your post of information to the Paymate Express page, the following values //* are returned to your shopping cart / website once the payment is complete: //* //* Parameter Name Parameter Description //* -------------- --------------------- //* transactionID The unique, 11 digit, Paymate identifier associated with each payment processed //* responseCode An identifier of the state of each transaction - see Response Codes below //* paymentAmount The payment amount authorised by the buyer //* currency The currency code of the payment ('AUD', 'USD','EUR','GBP','NZD') //* paymentDate The payment date. Format: dd-MMM-yyyy (eg: 01-JAN-2005) //* ref The seller reference number either provided to Paymate from a seller's website, or entered //* during the payment process. //* buyerEmail The email address of the buyer //* billingAddress1 The first street address line of the billing address //* billingAddress2 The second street address line of the billing address //* billingCity The city of the billing address //* billingState The state of the billing address //* billingCountry The country of the billing address //* billingPostcode The postcode of the billing address //* billingFirstName The buyer's first name //* billingSurname The buyer's surname //* //* Notes: //* //* If a buyer makes a payment using the registered Paymate member facility, any address information posted to the //* Paymate website will be overwritten with address information gathered from the Paymate system //* Response Codes //* //* Once the payment process is complete, a response code will be returned with the output parameters listed above. //* Detailed below is the response code and the meaning. //* //* Response Code Definition Recommended Action //* PP Payment processing Await email notification from Paymate prior to organising delivery of purchased items or //* service //* PA Payment approved Proceed with organising delivery of items or provision of service immediately //* PD Payment declined Contact buyer to organise another means of payment or discontinue order //* //* Notes: //* //* This response code will only be returned to your shopping cart or website if you have supplied a URL when //* initiating the payment //* //**************************************************************************************************************** // How Paymate returns to my website. var GetCommandParameters = "&return=http://www.gregsindigenouslandscapes.com.au/thankyou.asp&popup=false"; // Buyer's name GetCommandParameters +="&pmt_contact_firstname=" + String(Request.Form("given_names")) + "&pmt_contact_surname=" + String(Request.Form("surname")); // Buyers contact details. GetCommandParameters += "&pmt_sender_email=" + String(Request.Form("email")) + "&pmt_contact_phone=(H)" + String(Request.Form("phone")) + ", (M)" + String(Request.Form("mobile")); // Buyer's address details. GetCommandParameters += "®indi_address1=" + String(Request.Form("address1")) + "®indi_address2=" + String(Request.Form("address2")); GetCommandParameters += "®indi_sub=" + String(Request.Form("city")) + "®indi_state=" + String(Request.Form("state")); GetCommandParameters += "&pmt_country=Australia®indi_pcode=" + String(Request.Form("postcode")); return GetCommandParameters; } function WritePaypalHiddenFields() { var NumberItemsOrdered = Number(Request("number_items")); //**************************************************************************************************************** //* //* HTML for passing the aggregate shopping cart amount to PayPal //* //*
//* //* //* //* //* //* //* //*
//* //* //* HTML for passing individual item detail to PayPal //* //*
//* //* //* //* //* //* //* //* //*
//* //**************************************************************************************************************** Response.Write("\n"); Response.Write("\n"); // Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); // Prepopulate PayPal with delivery contact details. Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); } function GetFormAction() { var FormAction = ""; if (PaymentMethod == PaypalPaymentType) { FormAction = "https://www.sandbox.paypal.com/au/cgi-bin/webscr"; // FormAction = "https://www.paypal.com/cgi-bin/webscr"; } else if (PaymentMethod == PaymatePaymentType) { FormAction = "https://www.paymate.com/PayMate/ExpressPayment?mid=boylesg" + GetPaymateGetParameters() + GetPaymateItemGetParameters(PaymentMethod, Request.Form("delivery_postcode"), Request.Form("delivery_state")); } else if ((PaymentMethod == DepositPaymentType) || (PaymentMethod == CashPaymentType) || (PaymentMethod == ChequePaymentType)) { FormAction = "Thankyou.asp"; } return FormAction; } function IsNT1(NumPostcode) { var Result = ((NumPostcode >= 800) && (NumPostcode <= 999)); return Result; } function IsT1(NumPostcode) { var Result = ((NumPostcode >= 7000) && (NumPostcode <= 7999)); return Result; } function IsW1(NumPostcode) { var Result = ((NumPostcode >= 6000) && (NumPostcode <= 6214)) || ((NumPostcode >= 6800) && (NumPostcode <= 6999)); return Result; } function IsW2(NumPostcode) { var Result = ((NumPostcode >= 6215) && (NumPostcode <= 6699)); return Result; } function IsW3(NumPostcode) { var Result = ((NumPostcode >= 6700) && (NumPostcode <= 6799)); return Result; } function IsS1(NumPostcode) { var Result = ((NumPostcode >= 5000) && (NumPostcode <= 5199)) || ((NumPostcode >= 5800) && (NumPostcode <= 5999)); return Result; } function IsS2(NumPostcode) { var Result = ((NumPostcode >= 5200) && (NumPostcode <= 5749)); return Result; } function IsQ1(NumPostcode) { var Result = ((NumPostcode >= 4000) && (NumPostcode <= 4224)) || (NumPostcode == 4225) || ((NumPostcode >= 4225) && (NumPostcode <= 4299)) || ((NumPostcode >= 4500) && (NumPostcode <= 4549)) || ((NumPostcode >= 9000) && (NumPostcode <= 9299)) || ((NumPostcode >= 9400) && (NumPostcode <= 9596)) || ((NumPostcode >= 9700) && (NumPostcode <= 9799)); return Result; } function IsQ2(NumPostcode) { var Result = ((NumPostcode >= 4300) && (NumPostcode <= 4449)) || ((NumPostcode >= 4550) && (NumPostcode <= 4699)) || ((NumPostcode >= 9597) && (NumPostcode <= 9599)) || ((NumPostcode >= 9880) && (NumPostcode <= 9919)); return Result; } function IsQ3(NumPostcode) { var Result = ((NumPostcode >= 4450) && (NumPostcode <= 4499)) || ((NumPostcode >= 4700) && (NumPostcode <= 4805)) || ((NumPostcode >= 9920) && (NumPostcode <= 9959)); return Result; } function IsQ4(NumPostcode) { var Result = ((NumPostcode >= 4806) && (NumPostcode <= 4899)) || ((NumPostcode >= 9960) && (NumPostcode <= 9999)); return Result; } function IsN1(NumPostcode) { var Result = ((NumPostcode >= 1000) && (NumPostcode <= 2263)) || ((NumPostcode >= 2500) && (NumPostcode <= 2530)) || ((NumPostcode >= 2555) && (NumPostcode <= 2574)) || ((NumPostcode >= 2740) && (NumPostcode <= 2786)) || (NumPostcode == 2890) || ((NumPostcode >= 2891) && (NumPostcode <= 2898)); return Result; } function IsN2(NumPostcode) { var Result = ((NumPostcode >= 200) && (NumPostcode <= 299)) || ((NumPostcode >= 2264) && (NumPostcode <= 2484)) || ((NumPostcode >= 2485) && (NumPostcode <= 2486)) || ((NumPostcode >= 2487) && (NumPostcode <= 2499)) || ((NumPostcode >= 2531) && (NumPostcode <= 2554)) || ((NumPostcode >= 2575) && (NumPostcode <= 2639)) || ((NumPostcode >= 2640) && (NumPostcode <= 2641)) || (NumPostcode == 2648) || ((NumPostcode >= 2649) && (NumPostcode <= 2714)) || (NumPostcode == 2716) || ((NumPostcode >= 2720) && (NumPostcode <= 2730)) || ((NumPostcode >= 2787) && (NumPostcode <= 2879)) || ((NumPostcode >= 2881) && (NumPostcode <= 2889)) || ((NumPostcode >= 2891) && (NumPostcode <= 2898)) || ((NumPostcode >= 2900) && (NumPostcode <= 2999)); return Result; } function IsNF(NumPostcode) { var Result = (NumPostcode == 2899); return Result; } function IsV1(NumPostcode) { var Result = ((NumPostcode >= 3000) && (NumPostcode <= 3220)) || ((NumPostcode >= 3335) && (NumPostcode <= 3341)) || ((NumPostcode >= 3425) && (NumPostcode <= 3443)) || ((NumPostcode >= 3750) && (NumPostcode <= 3811)) || ((NumPostcode >= 3910) && (NumPostcode <= 3920)) || ((NumPostcode >= 3926) && (NumPostcode <= 3944)) || ((NumPostcode >= 3972) && (NumPostcode <= 3978)) || ((NumPostcode >= 3980) && (NumPostcode <= 3983)) || ((NumPostcode >= 8000) && (NumPostcode <= 8999)); return Result; } function IsV2(NumPostcode) { var Result = ((NumPostcode >= 3221) && (NumPostcode <= 3334)) || ((NumPostcode >= 3342) && (NumPostcode <= 3424)) || ((NumPostcode >= 3444) && (NumPostcode <= 3688)) || ((NumPostcode >= 3689) && (NumPostcode <= 3690)) || ((NumPostcode >= 3691) && (NumPostcode <= 3749)) || ((NumPostcode >= 3812) && (NumPostcode <= 3909)) || ((NumPostcode >= 3921) && (NumPostcode <= 3925)) || ((NumPostcode >= 3945) && (NumPostcode <= 3971)) || (NumPostcode == 3979); return Result; } function GetBasicPostageCharge(State) { var BasicCost = 0; // Basic postal charges if (State == "VIC") BasicCost = 7.7; else BasicCost = 9.4; return BasicCost; } function GetPostageDistanceCharge(Postcode) { var DistanceCharge = 0; // Distance charge per kg if (IsV1(Postcode)) DistanceCharge = 0; else if (IsV2(Postcode)) DistanceCharge = 0.55; else if (IsN1(Postcode)) DistanceCharge = 0.75; else if (IsN2(Postcode)) DistanceCharge = 0.85; else if (IsQ1(Postcode)) DistanceCharge = 1.05; else if (IsQ2(Postcode)) DistanceCharge = 1.65; else if (IsQ3(Postcode)) DistanceCharge = 1.95; else if (IsQ4(Postcode)) DistanceCharge = 2.05; else if (IsW1(Postcode)) DistanceCharge = 2.50; else if (IsW2(Postcode)) DistanceCharge = 2.65; else if (IsW3(Postcode)) DistanceCharge = 3.0; else if (IsS1(Postcode)) DistanceCharge = 0.75; else if (IsS2(Postcode)) DistanceCharge = 1.1; else if (IsNT1(Postcode)) DistanceCharge = 2.95; else if (IsT1(Postcode)) DistanceCharge = 1.1; else if (IsNF(Postcode)) DistanceCharge = 2.75; DistanceCharge *= 1.1; return DistanceCharge; } function GetPaymentMethodHandlingSurcharge(PaymentMethod) { var Surcharge = 0; if (PaymentMethod == PaypalPaymentType) Surcharge = 4; else if (PaymentMethod == PaymatePaymentType) Surcharge = 3; else Surcharge = 2; return Surcharge; } function CalculatePostageNestBox(PaymentMethod, NestBoxDesc, Postcode, State) { var PostageCost = 0; var DistanceCharge = GetPostageDistanceCharge(Postcode); var NumPostCode = Number(Postcode); var DeemedWeightNestBox = 0; var VolumeNestBox = 0; /* Ringtail Possum Nest Box Large Parrot Nest Box Brushtail Possum Nest Box Duck Nest Box Kookaburra Nest Box Owl Nest Box Sugar Glider/Phascogale/Antichinus Nest Box Pardalote/Small Parrot Nest Box Feather Tail Glider Nest Box Micro Bat Nest Box */ // Basic postal charges PostageCost = GetBasicPostageCharge(State) NestBoxDesc = NestBoxDesc.toLowerCase(); if (NestBoxDesc.indexOf("ringtail possum") > -1) { VolumeNestBox = (54 / 100) * (28 / 100) * (28 / 100); } else if (NestBoxDesc.indexOf("brushtail possum") > -1) { VolumeNestBox = (54 / 100) * (38 / 100) * (34 / 100); } else if ((NestBoxDesc.indexOf("large parrot") > -1) || (NestBoxDesc.indexOf("vertical parrot") > -1)) { VolumeNestBox = (54 / 100) * (32 / 100) * (22 / 100); } else if (NestBoxDesc.indexOf("duck") > -1) { VolumeNestBox = (54 / 100) * (57 / 100) * (34 / 100); } else if (NestBoxDesc.indexOf("kookaburra") > -1) { VolumeNestBox = (54 / 100) * (57 / 100) * (34 / 100); } else if (NestBoxDesc.indexOf("owl") > -1) { VolumeNestBox = (54 / 100) * (57 / 100) * (34 / 100); } else if ((NestBoxDesc.indexOf("sugar glider glider") > -1) || (NestBoxDesc.indexOf("phascogale") > -1) || (NestBoxDesc.indexOf("antichinus") > -1)) { VolumeNestBox = (54 / 100) * (28 / 100) * (28 / 100); } else if ((NestBoxDesc.indexOf("small parrot") > -1) || (NestBoxDesc.indexOf("horizontal parrot") > -1) || (NestBoxDesc.indexOf("pardalote") > -1)) { VolumeNestBox = (28 / 100) * (38 / 100) * (22 / 100); } else if (NestBoxDesc.indexOf("feather tail glider") > -1) { VolumeNestBox = (54 / 100) * (28 / 100) * (28 / 100); } else if (NestBoxDesc.indexOf("microbat") > -1) { VolumeNestBox = (54 / 100) * (34 / 100) * (14 / 100); } DeemedWeightNestBox = VolumeNestBox * 250; PostageCost += DeemedWeightNestBox * DistanceCharge; //Response.Write("#################################################
"); //Response.Write("CostToMe = " + CostToMe + "
"); //Response.Write("PostageCost = " + PostageCost + "
"); //Response.Write("DistanceCharge = " + DistanceCharge + "
"); //Response.Write("VolumeNestBox = " + VolumeNestBox + "
"); //Response.Write("DeemedWeightNestBox = " + DeemedWeightNestBox + "
"); //Response.Write("DistanceCharge x DeemedWeightNestBox = " + (DistanceCharge * DeemedWeightNestBox) + "
"); //Response.Write("NestBoxDesc = " + NestBoxDesc + "
"); //Response.Write("#################################################
"); return PostageCost; } function CalculatePostagePlant(PaymentMethod, Size, Quantity, Postcode, State) { var PostageCost = 0; var DistanceCharge = GetPostageDistanceCharge(Postcode); var NumPostCode = Number(Postcode); var DeemedWeight = 0; var Volume = 0; Size = Size.toLowerCase(); // Box volumes required in cubic metres. if (Size.indexOf("tube") > -1) { Volume = (6 / 100) * (6 / 100) * (31 / 100); } else if (Size.indexOf("14cm") > -1) { Volume = (15 / 100) * (15 / 100) * (35 / 100); } else if (Size.indexOf("10cm") > -1) { Volume = (11 / 100) * (11 / 100) * (31 / 100); } // Australia Post deemed weight for this volume. DeemedWeight = Volume * 250; PostageCost += DeemedWeight * DistanceCharge * Quantity; //Response.Write("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"); //Response.Write("DistanceCharge = " + DistanceCharge + "
"); //Response.Write("DeemedWeight = " + DeemedWeight + "
"); //Response.Write("Volume = " + Volume + "
"); //Response.Write("DeemedWeight = " + DeemedWeight + "
"); //Response.Write("PostageCost = " + PostageCost + "
"); //Response.Write("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"); return Number(PostageCost); } function GetPaymateItemGetParameters(PaymentMethod, Postcode, State) { var ItemParams = ""; var NumberItemsOrdered = GetNumberItemsOrdered(); var NumberTubesOrdered = GetNumberUnitsOrdered(TubeSize); var Number14cmPotsOrdered = GetNumberUnitsOrdered(PotSize); var Number10cmPotsOrdered = GetNumberUnitsOrdered(GiantTubeSize); var Index = 0; var GrandTotal = 0; var Postage = 0; var SubTotal = 0; var Quantity = 0; var ItemDetails = ""; var ItemDesc = ""; var ItemSize = ""; var Index = 0; if (NumberItemsOrdered > 0) { for (Index = 1; Index <= Session.Contents.Count; Index++) { ItemDetails = String(Session.Contents(Index)); //******************************************************************************************************************** //* Example data //* //* SmallTrees.asp&Acacia implexa&3.50&Tube&ST001&10 //* SmallTrees.asp&Acacia implexa&3.50&Tube&ST001 //******************************************************************************************************************** ItemDetails = Session.Contents(Index); Quantity = Number(ItemDetails.substring(ItemDetails.lastIndexOf("&") + 1, ItemDetails.length)); Index = ItemDetails.indexOf("&"); ItemDesc = ItemDetails.substring(Index + 1, ItemDetails.indexOf("&", Index + 1)); ItemDesc = ItemDesc.toLower(); Index = ItemDetails.indexOf("&"); Index = ItemDetails.indexOf("&", Index + 1); Index = ItemDetails.indexOf("&", Index + 1); ItemSize= ItemDetails.substring(Index + 1, ItemDetails.indexOf("&", Index + 1)); if (Quantity > 0) { // Postage on nest boxes varies with type so postage must calculated fro each nest box individually. if (ItemDesc.indexOf("nest box") > -1) Postage += CalculatePostageNestBox(PaymentMethod, NestBoxDesc, Postcode, State); else Postage += CalculatePostagePlant(PaymentMethod, ItemSize, Quantity, Postcode, State); Price = GetPrice(Size, Price); SubTotal = Quantity * Price; GrandTotal += SubTotal; Count++; } } // Add postage for all tubes and pots. if (Postage > 0) { Postage += GetBasicPostageCharge(Request.Form("delivery_state")); Postage += GetPaymentMethodHandlingSurcharge(PaymentMethod); } GrandTotal += Postage; } //* amt The payment amount //* amt_editable (1) Indicate if payment amount is editable or not //* currency (2) The currency code of the payment amount. //* ref A seller reference number for a transaction ItemParams += "&amt=" + GrandTotal + "&amt_editable=N"; return ItemParams; } var Postage = 0; var MyPostage = 0; function UpdateItemQuantities() { var nNumberItemsOrdered = GetNumberItemsOrdered(); var nIndex = 0; var strItemCode = ""; var strNewItemQuantity = ""; var strSessionItemDetails = ""; for (nIndex = 1; nIndex <= nNumberItemsOrdered; nIndex++) { strItemCode = Request("ItemCode" + String(nIndex)); // In case session item details have been lost if (strItemCode != String(undefined)) { strNewItemQuantity = Request("ItemQuantity" + String(nIndex)); strSessionItemDetails = Session(strItemCode); // If item details does not have an appended quantity... if (!HasSessionItemQuant(strSessionItemDetails)) { strSessionItemDetails += "&" + strNewItemQuantity; } else { // Get rid of the old appended quanity. strSessionItemDetails = strSessionItemDetails.substring(0, strSessionItemDetails.lastIndexOf("&")); // Add the new one. strSessionItemDetails += "&" + strNewItemQuantity; } // Update the session item details. Session(strItemCode) = strSessionItemDetails; } } } function WriteItemTable() { var ItemParams = ""; var NumberItemsOrdered = GetNumberItemsOrdered(); var NumberTubesOrdered = GetNumberUnitsOrdered(TubeSize); var Number14cmPotsOrdered = GetNumberUnitsOrdered(PotSize); var Number10cmPotsOrdered = GetNumberUnitsOrdered(GiantTubeSize); var Index = 0; var Index1 = 0; var Index2 = 0; var Count = 1; var GrandTotal = 0; var SubTotal = 0; var Code = ""; var URL = ""; var Name = ""; var Desc = ""; var Size = ""; var Price = ""; var Quantity = ""; var ItemDetails = ""; //Response.Write("**********************************************************
"); //Response.Write("NumberItemsOrdered = " + NumberItemsOrdered + "
"); //Response.Write("Request.Form = " + Request.Form + "
"); //Response.Write("Session.Timeout = " + Session.Timeout + "
"); //Response.Write("**********************************************************
"); Session.Timeout = 960; // In case the user has changed the quantity of items on order.asp. UpdateItemQuantities(); Response.Write(""); Response.Write(""); if (NumberItemsOrdered > 0) { Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); for (Index = 1; Index <= Session.Contents.Count; Index++) { ItemDetails = String(Session.Contents(Index)); if (ItemDetails.indexOf(".asp") > -1) { //******************************************************************************************************************** //* Example data //* //* SmallTrees.asp&Acacia implexa&3.50&Tube&ST001&10 //* SmallTrees.asp&Acacia implexa&3.50&Tube&ST001 //******************************************************************************************************************** Index1 = 0; Index2 = ItemDetails.indexOf("&"); URL = ItemDetails.substring(Index1, Index2); //Response.Write("**********************************************************
"); //Response.Write("ItemDetails = " + ItemDetails + "
"); //Response.Write("Index1 = " + Index1 + "
"); //Response.Write("Index2 = " + Index2 + "
"); //Response.Write("URL = " + URL + "
"); //Response.Write("**********************************************************
"); Index1 = Index2 + 1; Index2 = ItemDetails.indexOf("&", Index1); Name = ItemDetails.substring(Index1, Index2); Desc = Name.toLowerCase(); //Response.Write("**********************************************************
"); //Response.Write("ItemDetails = " + ItemDetails + "
"); //Response.Write("Index1 = " + Index1 + "
"); //Response.Write("Index2 = " + Index2 + "
"); //Response.Write("Name = " + Name + "
"); //Response.Write("**********************************************************
"); Index1 = Index2 + 1; Index2 = ItemDetails.indexOf("&", Index1); Price = ItemDetails.substring(Index1, Index2); //Response.Write("**********************************************************
"); //Response.Write("ItemDetails = " + ItemDetails + "
"); //Response.Write("Index1 = " + Index1 + "
"); //Response.Write("Index2 = " + Index2 + "
"); //Response.Write("Price = " + Price + "
"); //Response.Write("**********************************************************
"); Index1 = Index2 + 1; Index2 = ItemDetails.indexOf("&", Index1); Size = ItemDetails.substring(Index1, Index2); //Response.Write("**********************************************************
"); //Response.Write("ItemDetails = " + ItemDetails + "
"); //Response.Write("Index1 = " + Index1 + "
"); //Response.Write("Index2 = " + Index2 + "
"); //Response.Write("Size = " + Size + "
"); //Response.Write("**********************************************************
"); //******************************************************************************************************************** //* Example data //* //* SmallTrees.asp&Acacia implexa&3.50&Tube&ST001&10 //* SmallTrees.asp&Acacia implexa&3.50&Tube&ST001 //******************************************************************************************************************** Index1 = Index2 + 1; Index2 = ItemDetails.indexOf("&", Index1); // If the item does not have an appended quantity then Index2 will be -1. if (Index2 > -1) { Code = ItemDetails.substring(Index1, Index2); Quantity = Number(ItemDetails.substring(Index2 + 1, ItemDetails.length)); } else { Code = ItemDetails.substring(Index1, ItemDetails.length); Quantity = 0; } //Response.Write("**********************************************************
"); //Response.Write("ItemDetails = " + ItemDetails + "
"); //Response.Write("Index1 = " + Index1 + "
"); //Response.Write("Index2 = " + Index2 + "
"); //Response.Write("Code = " + Code + "
"); //Response.Write("Quantity = " + Quantity + "
"); //Response.Write("**********************************************************
"); if (Number(Quantity) > 0) { Price = GetPrice(Size, Price); SubTotal = Number(Quantity) * Price; GrandTotal += SubTotal; // Postage for nest boxes varies with the type so it must be calculated individually for each one. if (Desc.indexOf("nest box") > -1) { Postage += CalculatePostageNestBox(PaymentMethod, Desc, Request.Form("delivery_postcode"), Request.Form("delivery_state")) } else { Postage += CalculatePostagePlant(PaymentMethod, Size, Quantity, Request.Form("delivery_postcode"), Request.Form("delivery_state")); } Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); if (PaymentMethod == PaypalPaymentType) WritePaypalItemHiddenFields(Count, Code, Name, Size, Price, Quantity); Count++; } } } // Calculate the postage of all tubes and pots. if ((PaymentMethod == PaypalPaymentType) || (PaymentMethod == PaymatePaymentType) || (PaymentMethod == DepositPaymentType) || (PaymentMethod == ChequePaymentType)) { if (Postage > 0) { Postage += GetBasicPostageCharge(Request.Form("delivery_state")); MyPostage = Postage; Postage = Math.ceil(Postage) + GetPaymentMethodHandlingSurcharge(PaymentMethod); } } else if (PaymentMethod == CashPaymentType) { MyPostage = 0; Postage = 0; } else { MyPostage = -1; Postage = -1; } Response.Write("\n"); GrandTotal += Postage; if (PaymentMethod == PaypalPaymentType) WritePaypalPostageItemHiddenField(Count, Postage); Session("Postage") = Postage; Response.Write("\n"); } else { Response.Write("\n"); } Response.Write("
Your shopping cart contains the following items so far:
LINKITEM CODEITEM NAMESIZEPRICEQUANTITYSUBTOTAL
" + "review:" + "\n"); Response.Write("\n"); Response.Write("
POSTAGE & HANDLING"); Response.Write("
GRAND TOTAL
EMPTY
\n"); } function WriteSubmitButton() { if (PaymentMethod == PaypalPaymentType) { Response.Write("

PLEASE NOTE:

"); Response.Write("

If you do not have a PayPal account you will need to create one when you enter the PayPal website.

"); Response.Write("

Please make sure you click on the link back to my website inside the Paypal website, as this will result in an email being sent to me that will avoid any confusion if you have specified an delivery address that is different from your own.

"); Response.Write("

"); } else if (PaymentMethod == PaymatePaymentType) { Response.Write("

PLEASE NOTE:

"); Response.Write("

If you do not have a Paymate account you will need to create one when you enter the Paymate website.

"); Response.Write("

Please make sure you click on the link back to my website inside the Paymate website, as this will result in an email being sent to me that will avoid any confusion if you have specified an delivery address that is different from your own.

"); Response.Write("

"); //Response.Write("Pay with Paymate Express"); } else if (PaymentMethod == ChequePaymentType) { Response.Write(""); } else if (PaymentMethod == DepositPaymentType) { Response.Write(""); } else if (PaymentMethod == CashPaymentType) { Response.Write(""); } else { Response.Write("

Please return to the 'shopping cart' page and hit the 'calculate postage' button again...

"); } } function StoreCustomerDetails() { Session("number_items") = GetNumberItemsOrdered(); Session("payment") = PaymentMethod; Session("postage") = Postage; Session("comments") = String(Request.Form("comments")); Session("delivery_given_names") = String(Request.Form("delivery_given_names")); Session("delivery_surname") = String(Request.Form("delivery_surname")); Session("delivery_email") = String(Request.Form("delivery_email")); Session("delivery_address1") = String(Request.Form("delivery_address1")); Session("delivery_address2") = String(Request.Form("delivery_address2")); Session("delivery_city") = String(Request.Form("delivery_city")); Session("delivery_state") = String(Request.Form("delivery_state")); Session("delivery_postcode") = String(Request.Form("delivery_postcode")); Session("delivery_phone") = String(Request.Form("delivery_given_names")); Session("delivery_given_names") = String(Request.Form("delivery_phone")); Session("delivery_mobile") = String(Request.Form("delivery_mobile")); Session("given_names") = String(Request.Form("given_names")); Session("surname") = String(Request.Form("surname")); Session("email") = String(Request.Form("email")); Session("address1") = String(Request.Form("address1")); Session("address2") = String(Request.Form("address2")); Session("city") = String(Request.Form("city")); Session("state") = String(Request.Form("state")); Session("postcode") = String(Request.Form("postcode")); Session("phone") = String(Request.Form("given_names")); Session("given_names") = String(Request.Form("phone")); Session("mobile") = String(Request.Form("mobile")); } %>

Greg's Indigenous Plants & Landscapes

Environmentally friendly landscapes.

" The exotic vegetation that replaces indigenous plant communities in urbanising regions, disassociates us from the rhythms and diversity of the native landscape
and a sense of the place; and we are the poorer because of it."

Michael Hough, Professor of Landscape Architecture, York University, Canada

dot

 
In This Site
 

method="post" name="Invoice" id="Invoice"> <% if (PaymentMethod == PaypalPaymentType) WritePaypalHiddenFields(); WriteItemTable(); StoreCustomerDetails(); %>

 

 

Contact Details
Given names  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Last Name  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Email Address  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Address  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
" readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
City  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
State  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Post Code  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Phone  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Mobile  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Delivery Details
Given Names  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Delivery Surname  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Email Address  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Address  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
City  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
State  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Post Code  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Phone  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Mobile  " readonly="readonly" style="background-color:<%Response.Write(TableColour)%>">
Additional instructions:

 

<%WriteSubmitButton()%>

 
In This Section
 

dot

dot

Footer information such as street addresses, email addresses, phone numbers, disclaimers, etc. goes here.