<!--#include virtual="/appDB/db_connection.asp" -->
<!--#include virtual="/appDB/functions.asp" -->
<!--#include virtual="/admin/scripts/admin_functions.asp" -->
<!--#include virtual="/admin/scripts/enc_function.asp" -->
<!--#include virtual="/admin/scripts/adm_inst.asp" -->
<%
StrError = "None"
IF request("bID")<>"" THEN
	strBID=sanitizeRequest("bID","querystring")
	IF IsNumeric(strBID) THEN
		SET rsB = dbCBK.Execute("SELECT `driverID` from cbk_bookings WHERE `companyID`='"&str_company_id&"' AND `bookingID`='"&strBID&"' AND NOT `driverID`='0' limit 1")
		IF rsB.EOF THEN
			StrError = "Booking not yet assigned"
		END IF
		DO WHILE NOT rsB.EOF
			strDrvID=CInt(rsB("driverID"))
		rsB.MoveNext
		loop
		rsB.Close
		SET rsB = Nothing

		IF StrError = "None" THEN
			'fetch the driver details
		END IF
	ELSE
		StrError = "Booking ID Not Numeric"
	END IF
ELSE
	StrError = "Booking ID"
END IF
%>
<div style="width:100%;max-height:300px;overflow-x:hidden;overflow-y:scroll;box-sizing:border-box;padding:10px;">
<table cellpadding="2" cellspacing="0" style="width:100%;" class="drvDataTable">
		<%IF StrError <> "None" THEN%>
		<tr>
			<td>
				<p>You must assign a driver before despatching jobs.</p>
				<div class="clear s10 sep"></div>
				<div style="width:50%; margin:0 auto; padding-top:20px;"><div class="adminbutton"><a href="#" class="close" style="width:99%;color:#fff;">close</a></div></div>
			</td>
		</tr>
		<%ELSE%>
		<tr style="background-color:#f8f8f8;">
				<td><div class="adminbutton emaildespatch" id="abc"><a href="#" id="xyz" style="width:99%;color:#fff;">Despatch via Email</a></div></td>
		</tr>
		<%END IF%>
</table>
</div>
<script type="text/javascript">
$('.close').click(function() {
	$('.dialogwrap').dialog('close');
return false;
});
</script>
