<%
If (CStr(Request("MM_insert")) = "form2") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_tynans_mysql_STRING
MM_editCmd.CommandText = "INSERT INTO tynansdb.tynan_jobs (job_number, job_date, customer_name, customer_ref, site, contact_name, contact_number, job_details, engineer_name, created_by, job_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, MM_IIF(Request.Form("job_number"), Request.Form("job_number"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 135, 1, -1, MM_IIF(Request.Form("job_date"), Request.Form("job_date"), null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 255, Request.Form("customer_name")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, 255, Request.Form("customer_ref")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 255, Request.Form("site")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, 255, Request.Form("contact_name")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 5, 1, -1, MM_IIF(Request.Form("contact_number"), Request.Form("contact_number"), null)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 201, 1, 255, Request.Form("job_details")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 201, 1, 255, Request.Form("engineer_name")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 201, 1, 255, Request.Form("created_by")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 201, 1, 255, Request.Form("job_status")) ' adLongVarChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "create_a_new_job.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td width="1000" height="707" valign="top"><table width="1000" height="25" border="0" cellpadding="0" cellspacing="0" class="header">
<tr>
<td height="25" valign="top"><table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80" height="25"> </td>
<td width="606"> </td>
<td width="142" class="site_text style3">Tel : 00 44 1942 322950</td>
<td width="172" class="site_text style3">E-mail : Info@tynans.co.uk</td>
</tr>
<tr>
<td height="25"> </td>
<td> </td>
<td colspan="2" rowspan="2" class="site_text style3"><label>
<input type="text" name="Search" id="Search" />
</label>
<label>
<input name="Search2" type="submit" class="site_text" id="Search2" value="Search" />
</label></td>
</tr>
<tr>
<td height="25"> </td>
<td> </td>
</tr>
<tr>
<td height="25"> </td>
<td colspan="2" valign="top"><span class="site_text">
</span>
<form id="form1" name="form1" method="link" action="[URL unfurl="true"]http://www.tynans.jglobal.co.uk/create_a_new_job.asp">[/URL]
<span class="site_text"><a href="create_a_new_job.asp">New Job</a> | <a href="view_all_jobs.asp">View all Jobs</a> </span> <span class="site_text">| <a href="edit_jobs.asp">Edit Jobs</a></span> <span class="site_text">| <a href="delete_a_job.asp">Delete a Job</a></span> <span class="site_text">|</span> <span class="site_text"><a href="my_jobs.asp">View My Jobs</a></span> | <span class="site_text"><a href="open_jobs.asp">View Open Jobs</a> | <a href="closed_jobs.asp">View Closed Jobs</a> </span>
</form> </td>
<td valign="top" class="site_text style3"><a href="<%= MM_Logout %>">Log Out</a></td>
</tr>
</table></td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1000" height="534" valign="top" class="main_image_1"><table width="1000" height="628" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" colspan="3" valign="top"><img src="file:///S|/B&Q/Projects/websites/tynans.co.uk/spacer.gif" width="1" height="1" /></td>
</tr>
<tr>
<td width="15" height="518" valign="top" bgcolor="#2D333F"> </td>
<td width="900" height="518" valign="top" class="black_menu1"><p><span class="black_menu_header">Create a new Job.</span><br />
</p>
<table width="928" height="421" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="30" height="421" valign="top"> </td>
<td class="solutions_border"><form ACTION="<%=MM_editAction%>" METHOD="POST" id="form2" name="form2">
<table width="601" height="340" border="1" align="center" bordercolor="#464646">
<tr>
<td width="135" height="28">Job Number</td>
<td width="404"><label>
<input name="job_number" type="text" disabled="disabled" id="job_number" value="<%=(Recordset2.Fields.Item("ID").Value)%>" />
</label></td>
<td width="40"> </td>
</tr>
<tr>
<td>Date :</td>
<td><label>
<input name="job_date" type="text" id="job_date" />
eg 21/03/2008</label></td>
<td> </td>
</tr>
<tr>
<td>Customer : </td>
<td><label>
<select name="customer_name" id="customer_name">
<option value="B&Q" <%If (Not isNull((Recordset1.Fields.Item("customer_name").Value))) Then If ("B&Q" = CStr((Recordset1.Fields.Item("customer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>B&Q</option>
<option value="Screw-Fix" <%If (Not isNull((Recordset1.Fields.Item("customer_name").Value))) Then If ("Screw-Fix" = CStr((Recordset1.Fields.Item("customer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Screw-Fix</option>
</select>
</label></td>
<td> </td>
</tr>
<tr>
<td height="26">Customer Reference : </td>
<td><label>
<input name="customer_ref" type="text" id="customer_ref" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Site : </td>
<td><label>
<input name="site" type="text" id="site" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Contact Name :</td>
<td><label>
<input name="contact_name" type="text" id="contact_name" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Contact Number : </td>
<td><label>
<input name="contact_number" type="text" id="contact_number" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Job Details : </td>
<td><label>
<textarea name="job_details" id="job_details" cols="45" rows="5"></textarea>
</label></td>
<td> </td>
</tr>
<tr>
<td>Assign to : </td>
<td><label>
<select name="engineer_name" id="engineer_name">
<option value="Un-assigned" <%If (Not isNull((Recordset1.Fields.Item("engineer_name").Value))) Then If ("Un-assigned" = CStr((Recordset1.Fields.Item("engineer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Un-assigned</option>
<option value="Neil Kenny" <%If (Not isNull((Recordset1.Fields.Item("engineer_name").Value))) Then If ("Neil Kenny" = CStr((Recordset1.Fields.Item("engineer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Neil Kenny</option>
<option value="Brad Beckett" <%If (Not isNull((Recordset1.Fields.Item("engineer_name").Value))) Then If ("Brad Beckett" = CStr((Recordset1.Fields.Item("engineer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Brad Beckett</option>
<option value="Wayne Johnson" <%If (Not isNull((Recordset1.Fields.Item("engineer_name").Value))) Then If ("Wayne Johnson" = CStr((Recordset1.Fields.Item("engineer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Wayne Johnson</option>
<option value="Paul Kirton" <%If (Not isNull((Recordset1.Fields.Item("engineer_name").Value))) Then If ("Paul Kirton" = CStr((Recordset1.Fields.Item("engineer_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Paul Kirton</option>
</select>
</label></td>
<td> </td>
</tr>
<tr>
<td>Created by</td>
<td><label>
<input type="text" disabled="disabled" name="created_by" id="created_by" value= <%= session("varuser")%> />
</label></td>
<td> </td>
</tr>
<tr>
<td>Job Status</td>
<td><label>
<select name="job_status" id="job_status">
<option value="Open" <%If (Not isNull((Recordset1.Fields.Item("job_status").Value))) Then If ("Open" = CStr((Recordset1.Fields.Item("job_status").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Open</option>
<option value="Closed" <%If (Not isNull((Recordset1.Fields.Item("job_status").Value))) Then If ("Closed" = CStr((Recordset1.Fields.Item("job_status").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>Closed</option>
</select>
</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Save" id="Save" value="Submit" /></td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2" />
</form> </td>
</tr>
</table></td>
<td width="15" height="518" valign="bottom" bgcolor="#0D0D0D"> </td>
</tr>
<tr>
<td height="23" colspan="3" background="file:///S|/B&Q/Projects/websites/tynans.co.uk/images/gradient_solutions_page.gif"> </td>
</tr>
<tr>
<td height="23" colspan="3" background="file:///S|/B&Q/Projects/websites/tynans.co.uk/images/gradient_solutions_page.gif"> </td>
</tr>
<tr>
<td height="19" colspan="3" valign="middle" background="file:///S|/B&Q/Projects/websites/tynans.co.uk/images/gradient_solutions_page.gif"><div align="center"><span class="site_text style4">Home | Company | Services | Case Studies | Contact Us | Site Map | Online Privacy Policy | Terms of Use | Accessibility | Send Feedback<img src="file:///S|/B&Q/Projects/websites/tynans.co.uk/spacer.gif" alt="" width="1" height="1" /></span></div></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="site_text"><div align="center">Copyright © 2008 Tynan Elecrical Limited. All rights reserved</div></td>
</tr>
</table>
</body>