<!--#include file="../../owFunctions/I_GeneralFunctions.asp"-->
<!--#include file="../header.asp"-->
<%
	'************************************************************************************
	'*																					*
	'*	MODIFICATION TO THIS SCRIPT OR ANY FILES INCLUDED WITH 							*
	'*		ONEWORLDSTORE IS DONE AT YOUR OWN RISK!										*
	'*	Product  : OneWorldStore														*
	'*	Version  : 9.0000																*
	'*	Modified : June 2004															*
	'*	Copyright:	Copyright (C) 2004 OneWorldStore.Com								*
	'*				Registration Number: 1024507										*
	'*				http://strategis.ic.gc.ca/											*
	'*																					*
	'************************************************************************************
	
	Dim iBeginPagination, sURL, iTtlNumItems, iDBLoc, sQuerystring
	Dim sTarget, iPaginationCount, sTempSearch, sPaymentDesc
	
	sAction			= Trim(Request("sAction"))
	sSort			= Trim(Request("sSort"))
	sSearchText		= Trim(Request("sSearchText"))
	bResetDBLoc		= False
	sURL			= "owListShipments.asp"
	sQuerystring	= "sAction=" & sAction & "&sPaymentDesc=" & sPaymentDesc & "&sSort=" & sSort
	sTarget			= "owMain"

	If ( sAction = "Delete" ) Then
		For Each sCheckbox In Request.Form
			If ( InStr(sCheckbox, "sDelete") > 0 ) Then
				sTemp		= Replace(sCheckbox, "sDelete", "")
				sSuccess	= DeleteShipping(sTemp)
			End If
		Next
		bResetDBLoc = True
	ElseIf ( sAction = "Search" ) Then
		If ( sSearchText <> "" ) Then
			sTempSearch = " WHERE shipmentDesc LIKE '%" & sSearchText & "%'"
		Else
			sTempSearch = ""
		End If
	End If
	
	sSQLText	= "SELECT * FROM shipments" & sTempSearch
	sSQLCount	= "SELECT Count(*) FROM shipments"

	iBeginPagination = SetupPagination( sSQLCount, bResetTtlNumItems, bResetDBLoc )
	Call PaginationQuery( sSQLText, rsStoreData, iBeginPagination )
	
	If ( sSort <> "" ) Then
		sSQLText = sSQLText & " ORDER BY " & sSort
	End If
	
	sQueryString = "sSearchText=" & Server.URLEncode(sSearchText) & "&sSearch=" & Server.URLEncode(Trim(sSearch)) & "&sSort="
	
	%>
	<script language = "javascript">
		parent.owBodyFooter.location="owBodyFooter.asp?<%=sQuerystring%><%=sSort%>&iOWNumPerPage=<%=iOWNumPerPage%>&iTtlNumItems=<%=iTtlNumItems%>&iDBLoc=<%=iDBLoc%>"
	</script>
	<%
	
	If ( sSuccess <> "" ) Or ( rsStoreData.EOF ) Then
		If ( sSuccess <> "" ) Then
			%>
			<script language = "javascript">
				parent.owBodyTopNav.location="owBodyTopNav.asp?sMessage=<%=Server.URLEncode(sSuccess)%>"
			</script>
			<%
		End If
		If ( rsStoreData.EOF ) Then
			%>
			<script language = "javascript">
				parent.owBodyTopNav.location="owBodyTopNav.asp?sMessage=<%=Server.URLEncode("** No Payment Types found **")%>"
			</script>
			<%
		End If
	Else
		' just refresh the top bar to remove any "Save" buttons or old messages
		%>
		<script language = "javascript">
			parent.owBodyTopNav.location="owBodyTopNav.asp?sMessage="
		</script>
		<%
	End If
	%>
	<script language = "javascript">
		
		function ColumnOn(sStyle)
		{
			sStyle.background	= "#F5C058";
		}
		function ColumnOff(sStyle)
		{
			sStyle.background	= "#C3DAF9";
		}
		
		function ColumnDataOn(sStyle)
		{
			sStyle.background	= "#EAF1F9";
		}
		function ColumnDataOff(sStyle)
		{
			sStyle.background	= "#FFFFFF";
		}
		
	</script>

	<body style="font-family: Arial; font-size: 11px" topmargin="0" leftmargin="0" bgcolor=C3DAF9>
	<div id="tablediv" style="position: absolute; top: 0px; height: 100%; width:100%">
		<table width=100% border="0" cellpadding="2" cellspacing="0" style="font-size: 11px" bgcolor=FFFFFF>
		<form action='owListShipments.asp' method='post' name='ShippingTypes'>
			<input type='hidden' name='sAction' value='Delete'>
			<tr>
				<td class="ColumnHead" align="center">Select</td>
				<td onclick="location.href='owListShipments.asp?sSort=shipmentDesc'" onMouseOver="ColumnOn(this.style);" onMouseOut="ColumnOff(this.style);" class="ColumnHead" bgcolor="#C3DAF9" align="center">Shipping Type</td>
				
				<td onclick="location.href='owListShipments.asp?sSort=StateCode'" onMouseOver="ColumnOn(this.style);" onMouseOut="ColumnOff(this.style);" class="ColumnHead" bgcolor="#C3DAF9" align="center">State/Provence</td>
				<td onclick="location.href='owListShipments.asp?sSort=countrycode'" onMouseOver="ColumnOn(this.style);" onMouseOut="ColumnOff(this.style);" class="ColumnHead" bgcolor="#C3DAF9" align="center">Country</td>
				
				<td onclick="location.href='owListShipments.asp?sSort=priceToAdd'" onMouseOver="ColumnOn(this.style);" onMouseOut="ColumnOff(this.style);" class="ColumnHead" bgcolor="#C3DAF9" align="center">Price to Add</td>
				<td onclick="location.href='owListShipments.asp?sSort=percentageToAdd'" onMouseOver="ColumnOn(this.style);" onMouseOut="ColumnOff(this.style);" class="ColumnHead" bgcolor="#C3DAF9" align="center">Percentage to Add</td>
				<td onclick="location.href='owListShipments.asp?sSort=shipmentTime'" onMouseOver="ColumnOn(this.style);" onMouseOut="ColumnOff(this.style);" class="ColumnHead" bgcolor="#C3DAF9" align="center">Shipment time</td>
			</tr>
			<%
			If ( NOT rsStoreData.EOF ) Then
				iPaginationCount = 0
				While ( ( NOT rsStoreData.EOF ) And ( iPaginationCount < iOWNumPerPage ) )
					pIdshipment			= rsStoreData("idshipment")
					pShipmentDesc		= rsStoreData("shipmentDesc")
					pPriceToAdd			= rsStoreData("priceToAdd")
					pPercentageToAdd	= rsStoreData("percentageToAdd")
					pShipmentTime		= rsStoreData("shipmentTime")
					sCountryCode		= rsStoreData("countrycode")
					sStateCode			= rsStoreData("statecode")
					
					sQueryString2	= "sSort=" & sSort & "&idshipment=" & pIdshipment
					%>
					<tr onMouseOver="ColumnDataOn(this.style);" onMouseOut="ColumnDataOff(this.style);">
						<td width=5% class='ColumnData' align="center"><input size="1" type="checkbox" style="font-size: 6px;" name="sDelete<%=pIdshipment%>" value="46"></td>
						<td onClick="location.href='owShipmentModifyForm.asp?<%=sQueryString2%>'" class='ColumnData' align="center"><%=pShipmentDesc%>&nbsp;</td>
						
						<td onClick="location.href='owShipmentModifyForm.asp?<%=sQueryString2%>'" class='ColumnData' align="center"><%=sStateCode%>&nbsp;</td>
						<td onClick="location.href='owShipmentModifyForm.asp?<%=sQueryString2%>'" class='ColumnData' align="center"><%=sCountryCode%>&nbsp;</td>
						
						<td onClick="location.href='owShipmentModifyForm.asp?<%=sQueryString2%>'" class='ColumnData' align="center"><%=pPriceToAdd%>&nbsp;</td>
						<td onClick="location.href='owShipmentModifyForm.asp?<%=sQueryString2%>'" class='ColumnData' align="center"><%=pPercentageToAdd%>&nbsp;</td>
						<td onClick="location.href='owShipmentModifyForm.asp?<%=sQueryString2%>'" class='ColumnData' align="center"><%=pShipmentTime%>&nbsp;</td>
					</tr>
					<%
					rsStoreData.movenext
					iPaginationCount = iPaginationCount + 1
				Wend
			End If
			
			%>
		</form>
	</table>
	<%%>
	<!--#include file="../footer.asp"-->
	
<%
	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Function DeleteShipping(pidshipment)
	
		if bOWBackOfficeDemoMode then
			DeleteShipping = "Function disabled in demo mode."
		Else
			if trim(pidshipment)="" then
				DeleteShipping = "Please specify shipping type to delete."
			Else
				sSQLText = "DELETE FROM shipments WHERE idshipment=" & pidshipment
				Call DB_updateDatabase(sSQLText)
			end if
		end if

	End Function
	'************************************************************************************
%>