<%@ Language=VBScript %> <% '************************************************************************* ' DO NOT MODIFY THIS SCRIPT IF YOU WANT UPDATES TO WORK! ' Function : Location Maintenance ' Product : CandyPress Store Administration ' Version : 2.5 ' Modified : February 2004 ' Copyright: Copyright (C) 2004 CandyPress.Com ' See "license.txt" for this product for details regarding ' licensing, usage, disclaimers, distribution and general ' copyright requirements. If you don't have a copy of this ' file, you may request one at webmaster@candypress.com '************************************************************************* Option explicit Response.Buffer = true const adminLevel = 1 %> <% 'Database dim mySQL, cn, rs 'Locations dim idLocation dim locName dim locCountry dim locState dim locTax dim locShipZone dim locStatus 'Work Fields dim action '************************************************************************* 'Open Database Connection call openDB() 'Store Configuration if loadConfig() = false then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Could not load Store Configuration settings.") end if %>

Location & Tax Maintenance

<% 'Get action action = trim(Request.QueryString("action")) if len(action) = 0 then action = trim(Request.Form("action")) end if action = lCase(action) if action <> "edit" _ and action <> "del" _ and action <> "add" _ and action <> "editstate" then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Action Indicator.") end if 'Get idLocation if action = "edit" or action = "del" or action = "editstate" then idLocation = trim(Request.QueryString("recId")) if len(idLocation) = 0 then idLocation = trim(Request.Form("recId")) end if if idLocation = "" or not isNumeric(idLocation) then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Record ID.") end if end if 'Get Location Record if action = "edit" or action = "del" or action = "editstate" then mySQL="SELECT locName,locCountry,locState,locTax," _ & " locShipZone,locStatus " _ & "FROM Locations " _ & "WHERE idLocation = " & idLocation set rs = openRSexecute(mySQL) if rs.eof then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Record ID.") else locName = rs("locName") locCountry = rs("locCountry") locState = rs("locState") locTax = rs("locTax") locShipZone = rs("locShipZone") locStatus = rs("locStatus") end if call closeRS(rs) end if 'Check for valid Country record if action = "edit" or action = "del" then if not(IsNull(locState) or locState = "") then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid Country Record ID.") end if end if 'Check for valid State record if action = "editstate" then if IsNull(locState) or locState = "" then response.redirect "sysMsg.asp?errMsg=" & server.URLEncode("Invalid State/Province Record ID.") end if end if 'Edit if action = "edit" then if len(trim(Request.QueryString("msg"))) > 0 then %> <%=Request.QueryString("msg")%>

<% end if %> Edit Country  <%call maintNavLinks()%>

<% mySQL="SELECT idLocation,locName,locCountry,locState," _ & " locTax,locShipZone,locStatus " _ & "FROM Locations " _ & "WHERE locCountry = '" & locCountry & "' " _ & "AND NOT(locState IS NULL OR locState = '') " _ & "ORDER BY locName " set rs = openRSexecute(mySQL) if rs.EOF then %> <% else %> <% end if do while not rs.EOF idLocation = rs("idLocation") locName = rs("locName") locState = rs("locState") locTax = rs("locTax") locShipZone = rs("locShipZone") locStatus = rs("locStatus") %> <% rs.MoveNext loop call closeRS(rs) %>
Code Country Name Tax % Zone Status  
 
Add State or Province for <%=locName%>
Code State/Province Name Tax % Zone Status  
 
Edit State or Province for <%=locName%>
No States or Provinces.
Code State/Province Name Tax % Zone Status  
<%=locState%> <%=locName%> <%=formatNumber(locTax,2)%> <%=locShipZone%> <%=locStatus%> [ edit | delete ]
<% end if 'Edit State if action = "editstate" then %> Edit State or Province

Code State/Province Name Tax % Zone Status  
<% end if 'Add if action = "add" then %> Add Country  <%call maintNavLinks()%>

Code Country Name Tax % Zone Status  
<% end if 'Delete if action = "del" then %> Delete Country  <%call maintNavLinks()%>

Code Country Name Tax % Zone Status  
<%=locCountry%> <%=locName%> <%=formatNumber(locTax,2)%> <%=locShipZone%> <%=locStatus%>
Note : All State and/or Province records associated with this Country will also be deleted.
<% end if if action = "edit" or action = "editstate" or action = "add" then %>
Help and Instructions :
Code - Mandatory. This may be any combination of AlphaNumeric characters (maximum 2). Applies to both Country and States/Provinces records. When assigning Codes to a Country, bear in mind that the Country Code must always be unique between Countries. When assigning Codes to a State or Province, the Code must always be unique between States/Provinces within a Country. In other words, it is possible to re-use a State/Province Code as long as it's for another Country (even though the State/Province "Name" will most likely be different). Either way, the application validates the Codes to ensure there are no errors. A good tip is to use the standard Codes for Countries and States where they are available (e.g. "US" for the USA, and "NY" for the state of New York, etc.).

Name - Mandatory. In the case of a Country, it will be the name of that particular Country. Similarly, in the case of a State/Province, this will be the name of the State/Province. This is also the name that will be displayed on the checkout forms and orders.

Tax % - Mandatory. The value in this field indicates a percentage which must be added to the order total for Sales Tax purposes. If no Tax is to be added, this field must have a value of "0.00". In the event that a Country has State/Province records, the Tax Rate of the State/Province record is always used. If a Country has no State/Province records, then the Country's Tax Rate is applied.

Shipping Zone - Mandatory. This must be a numeric value. This field is used to logically group together Countries and/or States/Provinces for the purpose of calculating Shipping. If a Country has States/Provinces, the Shipping Zone of the State/Province will be used, otherwise the Country's Shipping Zone will be used. You may assign a Shipping Zone without creating associated Shipping Rate records for that Shipping Zone. This will however suppress the display of the Country and/or State/Province record(s) when the Customer is checking out. This is to protect you from inadvertantly accepting orders to locations for which you have not defined Shipping Rates.

Status - Mandatory. Indicates if a Country or State will be available for selection in your store.

<% end if call closedb() %> <% '********************************************************************* 'Create Navigation Links '********************************************************************* sub maintNavLinks() %> [ List Countries | Edit | Delete ] <% end sub %>