<% '-------------------------------------------------------- ' Configurations for this page '-------------------------------------------------------- myPageName = "editJob.asp" myPageTable = "job" job_id = request("id") if job_id = "" then job_id = request("job_id") end if if job_id <> "" then set jobRS = objConn.Execute("Select * from job where id="&job_id) end if '-------------------------------------------------------- displayHeader() If not checkSecurity(20) then Response.Write("You must be a Company Administrator to access this page.") security_getLogonInfo(myPageName) else select case request("action") case "list" list() case "new" if (checkSecurity(30) or checkSecurity(CONST_securityToEditJobPrice))then edit() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case "edit" if checkSecurity(30) or checkSecurity(CONST_securityToEditJobs) or (checkSecurity(20) and db_getData(jobRS, "company_id") = Session("User_Company") and CONST_adminEditJobs) then edit() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case "deleteConfirm" if checkSecurity(30) or checkSecurity(CONST_securityToEditJobPrice) then edit() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case "archive" if checkSecurity(30) or checkSecurity(CONST_securityToEditJobs) or (checkSecurity(20) and db_getData(jobRS, "company_id") = Session("User_Company") and CONST_adminEditJobs) then archiveOrder() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case "update" if checkSecurity(30) or checkSecurity(CONST_securityToEditJobs) or (checkSecurity(20) and db_getData(jobRS, "company_id") = Session("User_Company") and CONST_adminEditJobs) then updateData() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case "insert" if (checkSecurity(30) or checkSecurity(CONST_securityToEditJobPrice))then updateData() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case "delete" if (checkSecurity(30) or checkSecurity(CONST_securityToEditJobPrice))then updateData() else Response.Write("You do not have access here!") security_getLogonInfo(myPageName) end if case else list() end select end if displayFooter() function archiveOrder() sqlString = "update job set group_id="&CONST_archiveGroupId&" where id="&job_id objConn.Execute(sqlString) list() end function '-------------------------------------------------------------------------- ' This function shows the list of default disciplines. '-------------------------------------------------------------------------- function showInitDisciplineList() sqlString = "Select * from lkdiscipline order by disciplinename" set objRS = objConn.Execute(sqlString) %> <% discCount = 1 do while not objRS.EOF %> <% discCount = discCount + 1 objRS.MoveNext loop %>
Include Name Description Cost List Order
checked <% end if %>> " required="true">* "> $* *
<% end function '-------------------------------------------------------------------------- ' This function inserts the values that the user initially entered for ' disciplines '-------------------------------------------------------------------------- function insertInitialDisciplines(job_id) discCount = 1 do while request("disc_name" & discCount) <> "" if request("disc_include" & discCount) = CONST_myCheckboxTrueValue then sqlString = "Insert into job_discipline set " sqlString = sqlString & "job_id = " & job_id & ", " sqlString = sqlString & "name = '" & db_addSlashes(request("disc_name" & discCount)) & "', " sqlString = sqlString & "description = '" & db_addSlashes(request("disc_desc" & discCount)) & "', " sqlString = sqlString & "cost = '" & request("disc_cost" & discCount) & "', " sqlString = sqlString & "line_number = '" & request("disc_order" & discCount) & "';" objConn.Execute(sqlString) end if discCount = discCount + 1 loop end function '-------------------------------------------------------------------------- '-------------------------------------------------------------------------- function updateData() select case request("action") case "update" sqlString = "Update " case "insert" sqlString = "Insert into " case "delete" if job_id <> "" then db_deleteJob(job_id) end if end select sqlString = sqlString & myPageTable & " " if request("action") = "update" or request("action") = "insert" then sqlString = sqlString & "set " sqlString = sqlString & "job = '" & db_addSlashes(request("job")) & "', " sqlString = sqlString & "description = '" & db_addSlashes(request("description")) & "', " sqlString = sqlString & "company_id = " & request("company_id") & ", " sqlString = sqlString & "contact_id = " & request("contact_id") & ", " sqlString = sqlString & "group_id = " & request("group_id") & ", " sqlString = sqlString & "hide_all_bidders = " & db_getCheckBox(request("hide_all_bidders")) & ", " sqlString = sqlString & "require_contractor_approval = " & db_getCheckBox(request("require_contractor_approval")) & ", " sqlString = sqlString & "shipping_required = " & db_getCheckBox(request("shipping_required")) & ", " sqlString = sqlString & "require_shipping_inst = " & db_getCheckBox(request("require_shipping_inst")) & ", " sqlString = sqlString & "display_only = " & db_getCheckBox(request("display_only")) & ", " sqlString = sqlString & "No_CC_Deposit = " & db_getCheckBox(request("no_cc_deposit")) & ", " sqlString = sqlString & "Notify_Owner = " & db_getCheckBox(request("notify_owner")) & ", " sqlString = sqlString & "security_to_view_images = " & request("security_to_view_images") & ", " sqlString = sqlString & "security_to_view_details = " & request("security_to_view_details") & ", " sqlString = sqlString & "prebid_date = '" & db_mysqlDate(request("prebid_date")) & "', " sqlString = sqlString & "prebid_time = '" & request("prebid_time") & "', " sqlString = sqlString & "prebid_info = '" & db_addSlashes(request("prebid_info")) & "', " sqlString = sqlString & "bid_date = '" & db_mysqlDate(request("bid_date")) & "', " sqlString = sqlString & "bid_time = '" & request("bid_time") & "', " sqlString = sqlString & "bid_info = '" & request("bid_info") & "', " sqlString = sqlString & "po_number = '" & request("po_number") & "', " sqlString = sqlString & "aia_forms = '" & request("aia_forms") & "', " sqlString = sqlString & "plans = " & db_getCheckBox(request("plans")) & ", " sqlString = sqlString & "plan_type = '" & request("plan_type") & "', " sqlString = sqlString & "plan_instructions = '" & request("plan_instructions") & "', " sqlString = sqlString & "specs = " & db_getCheckBox(request("specs")) & ", " sqlString = sqlString & "spec_type = '" & request("spec_type") & "', " sqlString = sqlString & "spec_cover = '" & request("spec_cover") & "', " sqlString = sqlString & "spec_instructions = '" & request("spec_instructions") & "', " sqlString = sqlString & "bid_invitation_number = '" & request("bid_invitation_number") & "', " sqlString = sqlString & "project_location = '" & request("project_location") & "', " sqlString = sqlString & "job_contact = '" & request("job_contact") & "', " if request("class_id") = "" then sqlString = sqlString & "class_id = NULL, " else sqlString = sqlString & "class_id = " & request("class_id") & ", " end if if request("sets") = "" then sqlString = sqlString & "sets = Null, " else sqlString = sqlString & "sets = '" & request("sets") & "', " end if sqlString = sqlString & "sets_issued = '" & request("sets_issued") & "', " sqlString = sqlString & "view_password = '" & request("view_password") & "', " if (request("permission_pushgroup") = "") then permission_pushgroup = 0 else permission_pushgroup = request("permission_pushgroup") end if sqlString = sqlString & "permission_pushgroup = '" & permission_pushgroup & "', " sqlString = sqlString & "date_created = '" & db_mysqlDate(request("date_created")) & "', " sqlString = sqlString & "public_notes = '" & db_addSlashes(request("public_notes")) & "', " sqlString = sqlString & "private_notes = '" & db_addSlashes(request("private_notes")) & "', " sqlString = sqlString & "taxable = " & db_getCheckBox(request("taxable")) & ", " sqlString = sqlString & "allow_single_sheet = " & db_getCheckBox(request("allow_single_sheet")) & ", " sqlString = sqlString & "freight = '" & request("freight") & "', " sqlString = sqlString & "bid_categories = '" & db_addSlashes(request("bid_categories")) & "', " sqlString = sqlString & "flat_cost = " & request("flat_cost") & ", " sqlString = sqlString & "job_purchase_information = '" & db_addSlashes(request("job_purchase_information")) & "' " end if if request("action") = "update" then sqlString = sqlString & " where id = " & job_id end if ' response.Write(sqlString) if request("action") <> "delete" then objConn.Execute(sqlString) end if if request("action") = "insert" then sqlString = "select id from job order by id desc" set objRS = objConn.Execute(sqlString) job_id = objRS("id") insertInitialDisciplines(job_id) end if sqlQuery = "select lkdeliverymethod.id, lkdeliverymethod.deliverymethod, countries.country from lkdeliverymethod left outer join countries on (lkdeliverymethod.country_id = countries.id)" set delivRS = objConn.Execute(sqlQuery) do while not delivRS.EOF if not(cdbl("0"&request("delivCost_"&delivRS("id")))= 0 or request("delivCost_"&delivRS("id")) = "") then cost = cdbl(request("delivCost_"&delivRS("id"))) else cost = 0 end if sqlQuery = "select * from job_delivery_cost where job_id="&job_id&" and delivery_id="&delivRS("id") set tempRS = objConn.Execute(sqlQuery) if (tempRS.EOF) then sqlQuery = "insert into job_delivery_cost set " sqlQuery = sqlQuery & " job_id="&job_id&", " sqlQuery = sqlQuery & " delivery_id="&delivRS("id")&", " sqlQuery = sqlQuery & " cost="&cost&", " sqlQuery = sqlQuery & " disabled="&db_getCheckboxRev(request("delivDisable_"&delivRS("id"))) objConn.Execute(sqlQuery) else sqlQuery = "update job_delivery_cost set " sqlQuery = sqlQuery & " cost="&cdbl(request("delivCost_"&delivRS("id")))&", " sqlQuery = sqlQuery & " disabled="&db_getCheckboxRev(request("delivDisable_"&delivRS("id"))) sqlQuery = sqlQuery & " where id="&tempRS("id") objConn.Execute(sqlQuery) end if delivRS.MoveNext loop generic_redirect(myPageName) end function '-------------------------------------------------------------------------- ' This function displays the edit form with data from submitted variable ' ID if we are not creating a new entry '-------------------------------------------------------------------------- function edit() select case request("action") case "new" current_ID = "null" action = "insert" case "edit" current_ID = job_id action = "update" case "deleteConfirm" current_ID = job_id action = "delete" case "archiveConfirm" current_ID = job_id action = "update" end select sqlString = "select count(*) as total from company" Set objRS = objConn.Execute(sqlString) if not objRS.EOF then if (cint("0"&objRS("total")) > 100) then limitResults = true else limitResults = false end if else limitResults = false end if sqlString = "select * from " & myPageTable & " where id = " & current_ID Set objRS = objConn.Execute(sqlString) 'response.write objRS("company_id") generic_displayValidator() %> <%=generic_firstToUpper(action)%> Job

* denotes required fields
<% if request("action") <> "new" then %> <% end if %> <% if checkSecurity(30) then %> <% else %> <% end if %> <% if CONST_bidCategoriesEnabled then %> <% else %> <% end if %>
Bid Invitation Number: ">
Job Name: " required="true">*
Description: " required="true">*
Thumbnail: <% if db_getData(objRS, "logo_url") <> "" then %>
" border="0"> <% end if %> ">
Company Search: Enter a partial company name to retrieve a list of companies, limit of <%=CONST_queryLimit%> companies in result.
Company: <% if objRS.EOF then %><% else generic_displaySelectAdvanced "company_id", "select id, name from company where id=" & db_getData(objRS, "company_id") & " order by name limit " & CONST_queryLimit, "id", "name", db_getData(objRS, "company_id"), "onChange='getContactList();' required='true' " end if %>* Select a company name to retrieve a list of contacts for that company.
Company <%=db_qdSelect("select name from company where id="&Session("User_Company"), "name")%>">
Contact: <% if checkSecurity(30) then if objRS.EOF then %><% else generic_displaySelectAdvanced "contact_id", "select id, name from contacts where company_id = " & db_getData(objRS, "company_id") & " order by name", "id", "name", db_getData(objRS, "contact_id"), "onChange='getPGList();' required='true' " end if else if objRS.EOF then generic_displaySelectAdvanced "contact_id", "select id, name from contacts where company_id = " & Session("User_Company") & " order by name", "id", "name", Session("User_Id"), "onChange='getPGList();' required='true' " else generic_displaySelectAdvanced "contact_id", "select id, name from contacts where company_id = " & db_getData(objRS, "company_id") & " order by name", "id", "name", db_getData(objRS, "contact_id"), "onChange='getPGList();' required='true' " end if end if %>*
Group: <% if request("action") = "archiveConfirm" then group_id = CONST_myArchiveGroup else group_id = db_getData(objRS, "group_id") end if generic_displaySelect "group_id", "select id, name from groups", "id", "name", group_id %>*
Class: <% generic_displaySelect "class_id", "select id, name from lkjobclass order by name", "id", "name", db_getData(objRS, "class_id") %>
Project Location: ">
Require Contractor Approval:
checked <% end if %>> Hide All Bidders: checked <% end if %>>
Required Third Party Shipping:
checked <% end if %>> View Plans Only (no orders): checked <% end if %>>
Require Instructions for 3rd Party Shipping
checked<%end if%>> Allow Single Sheets to be Ordered: checked<%end if%>>
Do Not Allow CCs for Deposit
checked<%end if%>> Notify Contact: checked<%end if%>>
Job Contact ">
Security Level to View Images <% if db_getData(objRS, "security_to_view_images") = "" then tempValue = CONST_editJobSecurityToViewImagesDefault else tempValue = db_getData(objRS, "security_to_view_images") end if generic_displaySelectAdvanced "security_to_view_images", "select id, name from security_levels", "id", "name", tempValue, " required='true' " %>*
Security Level to View Details <% if db_getData(objRS, "security_to_view_details") = "" then tempValue = CONST_editJobSecurityToViewDetailsDefault else tempValue = db_getData(objRS, "security_to_view_details") end if generic_displaySelectAdvanced "security_to_view_details", "select id, name from security_levels", "id", "name", tempValue, " required='true' " %>*
PreBid Date: "> mm/dd/yyyy
PreBid Time: ">
PreBid Info:
Bid Date: "> mm/dd/yyyy
Bid Time: ">
Bid Info: ">
PO Number: ">
AIA Forms: <% generic_displaySelect "aia_forms", "select description from lkaiaforms", "description", "description", db_getData(objRS, "aia_forms") %>
Plans: checked <% end if %>>
Plan Type: <% generic_displaySelect "plan_type", "select description from lkplantypes", "description", "description", db_getData(objRS, "plan_type") %>
Plan Instructions: ">
Specs: checked <% end if %>>
Spec Type: <% generic_displaySelect "spec_type", "select description from lkspectypes", "description", "description", db_getData(objRS, "spec_type") %>
Spec Cover: <% generic_displaySelect "spec_cover", "select description from lkspeccover", "description", "description", db_getData(objRS, "spec_cover") %>
Spec Instructions: ">
Sets: ">
Sets Issued: ">
View/Order Password: "> If this job is private, please provide a password here:
It is your responsibility to distribute this password to potential bidders.
Permission Push Group: <% if objRS.EOF then sqlString = "select * from pushgroup_header where contacts_id="&Session("User_Id")&" order by pushgroup_name;" else sqlString = "select * from pushgroup_header where contacts_id="&db_getData(objRS, "contact_id")&" order by pushgroup_name;" end if 'myName, sqlStr, valueField, textField, currValue, FirstText, FirstValue, ExtraOptions generic_displaySelectCustomFirst "permission_pushgroup", sqlString, "id", "pushgroup_name", db_getData(objRS, "permission_pushgroup"), "None", "0", "" %>
Date Created: "> mm/dd/yyyy
Private Notes:
Public Notes:
Taxable: "0" then %> checked <% end if %>>
Flat Shipping Cost: ">
Shipping Per Delivery: <% sqlQuery = "select lkdeliverymethod.*, countries.country from lkdeliverymethod left outer join countries on (lkdeliverymethod.country_id = countries.id);" set delivRS = objConn.Execute(sqlQuery) do while not delivRS.EOF set jdRS = objConn.Execute("select * from job_delivery_cost where job_id="¤t_ID&" and delivery_id="&delivRS("id")) %> <% delivRS.MoveNext loop %>
<%=delivRS("deliverymethod")%>(<%=delivRS("country")%>):  " id="delivCost_<%=delivRS("id")%>" value="<% if delivRS("chargefreight") <> "0" then if jdRS.EOF then response.Write("0") else response.Write(jdRS("cost")) end if else response.Write("0"" readonly=""true") end if %>"> " id="delivDisable_<%=delivRS("id")%>" <% if (not jdRS.EOF) then if (jdRS("disabled") = "-1") then response.Write("") else response.Write("checked") end if else response.Write("checked") end if %>>
Bid Categories: (separate categories with a semi-colon)
Job Purchase Information:
Cost $0.0<%else%><%=db_getData(objRS,"flat_cost")%><%end if%>" required="true" <% if not (checkSecurity(CONST_securityToEditJobPrice) or checkSecurity(30)) then %>readonly<%end if%>> Only used if there are no Disciplines for this job.

<% select case action case "update" %>Job Addenda
<% listAddendums() %>
<% if CONST_specsUpload then %> Specs: <% set specRS = objConn.Execute("select * from files_specs where job_id="&job_id) if specRS.EOF then response.Write("No currently uploaded") else response.Write(specRS("filename")) end if %>

<% end if %> <% if CONST_disciplinesEnabled then %> Job Disciplines  
<% listDisciplines() end if case "insert" if CONST_disciplinesEnabled then showInitDisciplineList() end if end select %>
<% if request("action") <> "new" then %> <% end if %>
<% end function '-------------------------------------------------------------------------- ' This function lists out the current variables in the system '-------------------------------------------------------------------------- function list() %> To search, please enter a partial job name. Enter an asterisk, percent, or leave empty to return all records.
"" then response.Write("&group_id="&request("group_id")) %>" method="post"> ">
Create New Job <% sqlString = "Select company.name as companyName, job.* from " & myPageTable & ", company where company.id = job.company_id" if not checkSecurity(30) then sqlString = sqlString & " and company_id=" & Session("User_Company") end if select case request("name") case "*" sqlString = sqlString case "%" sqlString = sqlString case "" sqlString = sqlString case else sqlString = sqlString & " and job like '%" & request("name") & "%'" end select select case request("group_id") case "" sqlString = sqlString & " and (" groupList = split(CONST_publicUseAllGroupList, ",") for i = 0 to ubound(groupList) sqlString = sqlString & " group_id=" & groupList(i) if i < ubound(groupList) then sqlString = sqlString & " or" end if next if CONST_privateUseAllGroupList <> "" then sqlString = sqlString & " or" end if groupList = split(CONST_privateUseAllGroupList, ",") for i = 0 to ubound(groupList) sqlString = sqlString & " group_id=" & groupList(i) if i < ubound(groupList) then sqlString = sqlString & " or" end if next sqlString = sqlString & ") " case else sqlString = sqlString & " and group_id = " & request("group_id") & " " end select sqlString = sqlString & " order by job" ' response.Write(sqlString) showList sqlString end function '-------------------------------------------------------------------------- ' This function shows the list of companies. '-------------------------------------------------------------------------- function showList(sqlString) dim headerArray(5) dim jsRowArray(2) dim displayArray(5,11,1) set objRS = objConn.Execute(sqlString) headerArray(0) = " " headerArray(1) = "Job Name" headerArray(2) = "Description" headerArray(3) = "Company" headerArray(4) = "Pre Bid Date
Date Created" headerArray(5) = "Bid Date" displayArray(0,0,0) = "Edit" displayArray(0,2,1) = "text" if checkSecurity(20) then displayArray(0,3,0) = " | Order" displayArray(0,5,1) = "text" else displayArray(0,3,0) = "" displayArray(0,3,1) = "text" displayArray(0,4,0) = "" displayArray(0,4,1) = "text" displayArray(0,5,0) = "" displayArray(0,5,1) = "text" end if if checkSecurity(30) then displayArray(0,6,0) = "
Delete" displayArray(0,8,1) = "text" displayArray(0,9,0) = " | Archive" displayArray(0,11,1) = "text" else displayArray(0,6,0) = "" displayArray(0,6,1) = "text" displayArray(0,7,0) = "" displayArray(0,7,1) = "text" displayArray(0,8,0) = "" displayArray(0,8,1) = "text" displayArray(0,9,0) = "" displayArray(0,9,1) = "text" displayArray(0,10,0) = "" displayArray(0,10,1) = "text" displayArray(0,11,0) = "" displayArray(0,11,1) = "text" end if displayArray(1,0,0) = "job" displayArray(1,0,1) = "field" displayArray(2,0,0) = "description" displayArray(2,0,1) = "field" displayArray(3,0,0) = "companyName" displayArray(3,0,1) = "field" displayArray(4,0,0) = "prebid_date" displayArray(4,0,1) = "field_br" displayArray(4,1,0) = "date_created" displayArray(4,1,1) = "field" displayArray(5,0,0) = "bid_date" displayArray(5,0,1) = "field" generic_selectionList objRS, displayArray, headerArray, jsRowArray %>Create New Job<% end function %>