<% '-------------------------------------------------------- ' Configurations for this page '-------------------------------------------------------- myPageName = "bidders.asp" myPageTable = "orders" '-------------------------------------------------------- if (request("printer_friendly") = "true" or request("printer_friendly") = "-1") then displayPrinterFriendlyHeader() else displayHeader() end if if request("job_id") <> "" then job_id = request("job_id") sqlString = "select * from job where id=" & job_id set jobRS = objConn.Execute(sqlString) if localAccessCheck(jobRS("hide_all_bidders"), jobRS("company_id")) then select case request("action") case "approve" approveOrder() case "deny" denyOrder() case "willbid" willBidOrder() case "list" list() case else list() end select else Response.Write("Either you are not logged in or you are attempting to access a restricted bidder list that you do not have rights to.") security_getLogonInfo(myPageName) end if else Response.Write("n0 h4x 4 j00. g0 6y3 6y3.") end if if (request("printer_friendly") = "true" or request("printer_friendly") = "-1") then displayPrinterFriendlyFooter() else displayFooter() end if function approveOrder() company_id = db_qdSelect("select company_id from job where id="&request("job_id"), "company_id") if checkSecurity(30) or (checkSecurity(25) and CONST_managerCanEditOrders) or (checkSecurity(20) and company_id = Session("User_Company")) then sqlString = "update orders set status='Approved' where id="&request("order_id") objConn.Execute(sqlString) set orderRS = objConn.Execute("select * from orders where id="&request("order_id")) set jobRS = objConn.Execute("select * from job where id="&request("job_id")) emailTxt = "Job: "&jobRS("job")&vbcrlf emailTxt = emailTxt & "Order ID: "&request("order_id")&vbcrlf emailTxt = emailTxt & "Company: "&db_qdSelect("select name from company where id="&request("order_id"), "name")&vbcrlf&vbcrlf emailTxt = emailTxt & "This order has been approved." select case CONST_webServerOS case "Exchange" Set objNewMail = CreateObject("CDO.Message") objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = CONST_exchangeSMTPServer objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' Use Exhange objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = CONST_exchangeUsername objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = CONST_exchangePassword objNewMail.Configuration.Fields.Update objNewMail.From = CONST_emailFromAddress objNewMail.To = CONST_emailApproveDenyNotification objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.Subject = "Order Approved: "&jobRS("job") objNewMail.TextBody = emailTxt objNewMail.Send case "Windows 2003", "Windows 2003 Server" Set objNewMail = CreateObject("CDO.Message") objNewMail.From = CONST_emailFromAddress objNewMail.To = CONST_emailApproveDenyNotification objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.Subject = "Order Approved: "&jobRS("job") objNewMail.TextBody = emailTxt objNewMail.Send case else Set objNewMail = Server.CreateObject("CDONTS.NewMail") objNewMail.From = CONST_emailFromAddress objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.To = CONST_emailApproveDenyNotification objNewMail.Subject = "Order Approved: "&jobRS("job") objNewMail.BodyFormat = 1 objNewMail.MailFormat = 1 objNewMail.Body = emailTxt objNewMail.Send end select sqlQuery = "insert into log_notifications set " sqlQuery = sqlQuery & "email_from='"&CONST_emailFromAddress&"', " sqlQuery = sqlQuery & "email_to='"&CONST_emailApproveDenyNotification&"', " sqlQuery = sqlQuery & "email_bcc='"&CONST_emailCarbonCopyList&"', " sqlQuery = sqlQuery & "subject='"&db_addSlashes("Order Approved: "&jobRS("job"))&"', " sqlQuery = sqlQuery & "email_content='"&db_addSlashes(emailTxt)&"', " sqlQuery = sqlQuery & "attatchment_name='', " sqlQuery = sqlQuery & "contact_id="&Session("User_Id")&", " sqlQuery = sqlQuery & "source='Order Approval'" objConn.Execute(sqlQuery) end if list() end function function denyOrder() company_id = db_qdSelect("select company_id from job where id="&request("job_id"), "company_id") if checkSecurity(30) or (checkSecurity(25) and CONST_managerCanEditOrders) or (checkSecurity(20) and company_id = Session("User_Company")) then sqlString = "update orders set status='Not Approved' where id="&request("order_id") objConn.Execute(sqlString) emailTxt = "Job: "&request("job_id")&vbcrlf emailTxt = emailTxt & "Order ID: "&request("order_id")&vbcrlf emailTxt = emailTxt & "Company: "&db_qdSelect("select name from company where id="&request("order_id"), "name")&vbcrlf&vbcrlf emailTxt = emailTxt & "This order has been denied." select case CONST_webServerOS case "Exchange" Set objNewMail = CreateObject("CDO.Message") objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = CONST_exchangeSMTPServer objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' Use Exhange objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = CONST_exchangeUsername objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = CONST_exchangePassword objNewMail.Configuration.Fields.Update objNewMail.From = CONST_emailFromAddress objNewMail.To = CONST_emailApproveDenyNotification objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.Subject = "Order Denied: "&jobRS("job") objNewMail.TextBody = emailTxt objNewMail.Send case "Windows 2003", "Windows 2003 Server" objNewMail.From = CONST_emailFromAddress objNewMail.To = CONST_emailApproveDenyNotification objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.Subject = "Order Denied: "&jobRS("job") objNewMail.TextBody = emailTxt objNewMail.Send case else Set objNewMail = Server.CreateObject("CDONTS.NewMail") objNewMail.From = CONST_emailFromAddress objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.To = CONST_emailApproveDenyNotification objNewMail.Subject = "Order Denied: "&jobRS("job") objNewMail.BodyFormat = 1 objNewMail.MailFormat = 1 objNewMail.Body = emailTxt objNewMail.Send end select sqlQuery = "insert into log_notifications set " sqlQuery = sqlQuery & "email_from='"&CONST_emailFromAddress&"', " sqlQuery = sqlQuery & "email_to='"&CONST_emailApproveDenyNotification&"', " sqlQuery = sqlQuery & "email_bcc='"&CONST_emailCarbonCopyList&"', " sqlQuery = sqlQuery & "subject='"&db_addSlashes("Order Denied: "&jobRS("job"))&"', " sqlQuery = sqlQuery & "email_content='"&db_addSlashes(emailTxt)&"', " sqlQuery = sqlQuery & "attatchment_name='', " sqlQuery = sqlQuery & "contact_id="&Session("User_Id")&", " sqlQuery = sqlQuery & "source='Order Denial'" objConn.Execute(sqlQuery) end if list() end function function willBidOrder() company_id = db_qdSelect("select company_id from job where id="&request("job_id"), "company_id") if checkSecurity(30) or (checkSecurity(25) and CONST_managerCanEditOrders) or (checkSecurity(20) and company_id = Session("User_Company")) then sqlString = "update orders set status='Will Bid' where id="&request("order_id") objConn.Execute(sqlString) emailTxt = "Job: "&request("job_id")&vbcrlf emailTxt = emailTxt & "Order ID: "&request("order_id")&vbcrlf emailTxt = emailTxt & "Company: "&db_qdSelect("select name from company where id="&request("order_id"), "name")&vbcrlf&vbcrlf emailTxt = emailTxt & "This order has been set to Will Bid." select case CONST_webServerOS case "Exchange" Set objNewMail = CreateObject("CDO.Message") objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = CONST_exchangeSMTPServer objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' Use Exhange objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = CONST_exchangeUsername objNewMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = CONST_exchangePassword objNewMail.Configuration.Fields.Update objNewMail.From = CONST_emailFromAddress objNewMail.To = CONST_emailApproveDenyNotification objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.Subject = "Order Denied: "&jobRS("job") objNewMail.TextBody = emailTxt objNewMail.Send case "Windows 2003", "Windows 2003 Server" objNewMail.From = CONST_emailFromAddress objNewMail.To = CONST_emailApproveDenyNotification objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.Subject = "Order Denied: "&jobRS("job") objNewMail.TextBody = emailTxt objNewMail.Send case else Set objNewMail = Server.CreateObject("CDONTS.NewMail") objNewMail.From = CONST_emailFromAddress objNewMail.BCC = CONST_emailCarbonCopyList objNewMail.To = CONST_emailApproveDenyNotification objNewMail.Subject = "Order Denied: "&jobRS("job") objNewMail.BodyFormat = 1 objNewMail.MailFormat = 1 objNewMail.Body = emailTxt objNewMail.Send end select sqlQuery = "insert into log_notifications set " sqlQuery = sqlQuery & "email_from='"&CONST_emailFromAddress&"', " sqlQuery = sqlQuery & "email_to='"&CONST_emailApproveDenyNotification&"', " sqlQuery = sqlQuery & "email_bcc='"&CONST_emailCarbonCopyList&"', " sqlQuery = sqlQuery & "subject='"&db_addSlashes("Order Will Bid: "&jobRS("job"))&"', " sqlQuery = sqlQuery & "email_content='"&db_addSlashes(emailTxt)&"', " sqlQuery = sqlQuery & "attatchment_name='', " sqlQuery = sqlQuery & "contact_id="&Session("User_Id")&", " sqlQuery = sqlQuery & "source='Order Will Bod'" objConn.Execute(sqlQuery) end if list() end function function localAccessCheck(hideBidders, company_id) select case true case (hideBidders = "0") localAccessCheck = true case (Session("Security_Level") >= 20 and Session("User_Company") = company_id) localAccessCheck = true case (checkSecurity(25) and CONST_managerCanEditOrders) localAccessCheck = true case (Session("Security_Level") >= 30) localAccessCheck = true case else localAccessCheck = false end select end function function list() pf = request("printer_friendly") if (pf = "") then pf = "0" end if orderBy = request("orderBy") select case orderBy case "contactName" orderByTitle = "Contact Name" case "companyTrade" orderBytitle = "Trade" case "bid_category" orderByTitle = "Bid Category" case "sets_issued" orderByTitle = "Sets Issued" case "zip_code" orderBy = "billto_zip" orderByTitle = "Zip Code" case "" orderBy = "company" orderByTitle = "Company" case else orderByTitle = generic_firstToUpper(orderBy) end select sqlString = "select cmp.name as company, con.Name as contactName, cmp.phone as phone, cmp.fax as fax, con.email as email, job.require_contractor_approval, ord.id as order_id, ord.*, dm.deliverymethod, trd.type as companyTrade, ol.job_item_id as disc_id " sqlString = sqlString & "from orders ord left outer join company cmp on (ord.company_id = cmp.id) " sqlString = sqlString & "left outer join contacts con on (ord.contact_id = con.id) " sqlString = sqlString & "left outer join job on (ord.job_id = job.id) " sqlString = sqlString & "left outer join lkdeliverymethod dm on (ord.shipment_method = dm.id) " sqlString = sqlString & "left outer join trades trd on (ord.trade_id = trd.id) " sqlString = sqlString & "left outer join order_lines ol on (ord.id = ol.order_id) " sqlString = sqlString & "where ord.job_id = " & job_id & " " sqlString = sqlString & "group by ord.id " sqlString = sqlString & "order by " & orderBy ' response.Write("sqlString:
" & sqlString) set orderRS = objConn.Execute(sqlString) %>

<%=CONST_linkBidderListName%> for <%=jobRS("job")%>

<% if checkSecurity(30) or (checkSecurity(25) and CONST_managerCanEditOrders) or (Session("User_Company") = jobRS("company_id") and checkSecurity(20)) then %> Bidder Shipping Labels
Bidder Billing Labels
FACSys Export
<% end if %>
Sorted By <%=orderByTitle%>
Click on the following links to sort by a category:
Company | Trade | Contact Name | Zip Code | Sets Issued <% if CONST_bidCategoriesEnabled then %> | Bid Category <% end if %>
&printer_friendly=<%=not pf%>">Printer Friendly Version


<% if checkSecurity(30) or (checkSecurity(25) and CONST_managerCanEditOrders) or (Session("User_Company") = jobRS("company_id") and checkSecurity(20)) then foobar = showFullList(orderRS,jobRS) else foobar = showLimitedList(orderRS,jobRS) end if %>

<%=CONST_linkBidderListName%> for <%=jobRS("job")%>

<% end function function showFullList(objRS,jobRS) %> <% if CONST_displayTradeInBidderList or CONST_bidCategoriesEnabled then %> <% end if %> <% if CONST_biddersListDisplayStatus then %> <% end if %> <% if CONST_biddersListDisplayShipping then %> <% end if %> <% if CONST_biddersListDisplaySets then %> <% end if %> <% if CONST_biddersListDisplayDateOrdered then %> <% end if %> <% stripeFlag = 0 do while not objRS.EOF if (stripeFlag mod 2)=1 then curStripe = "rowMyStripes2" else curStripe = "rowMyStripes1" end if %> <% if CONST_biddersListDisplayStatus then %> <% end if %> <% if CONST_biddersListDisplayShipping then %> <% end if %> <% if CONST_biddersListDisplaySets then %> <% end if %> <% if CONST_biddersListDisplayDateOrdered then %> <% end if %> <% stripeFlag = stripeFlag + 1 objRS.MoveNext() loop %>
  Company Information <% if CONST_displayTradeInBidderList then %> Trade
<% end if %> <% if CONST_bidCategoriesEnabled then %> Bid Cat.
<% end if %>
Contact InformationStatus
Date Filled
Date Returned
Delivery Method
Tracking Number
Sets
Issued
Date <%=CONST_terminologyOrdered%>
<% if (checkSecurity(CONST_securityLevelToEditOrdersForCompanyJob) and Session("User_Company") = jobRS("company_id")) OR checkSecurity(CONST_securityLevelToEditOrdersAll) then %> <% if not (request("printer_friendly") = "true" or request("printer_friendly") = "-1") then %> ">Edit | ">Delete
<% end if %> <% end if %> <%=objRS("order_id")%>
<%=objRS("company")%>
<%=objRS("shipto_address1")%>
<% if objRS("shipto_address2") <> "" then %> <%=objRS("shipto_address2")%>
<% end if %> <%=objRS("shipto_city")%>, <%=objRS("shipto_state")%>  <%=objRS("shipto_zip")%>
<% if CONST_displayTradeInBidderList or CONST_bidCategoriesEnabled then %>
<% if CONST_displayTradeInBidderList then %> Trade: <%=objRS("companyTrade")%>
<% end if %> <% if CONST_bidCategoriesEnabled then %> Bid Cat.: <%=trim(replace(" "&objRS("bid_category"),";",";
"))%>
<% end if %> <% end if %>
<%=objRS("contactName")%>
Phone: <%=objRS("phone")%>
Fax: <%=objRS("fax")%>
<% if checkSecurity(CONST_securityBidderListPlanholderEmailView) or checkSecurity(30) or (checkSecurity(20) and Session("User_Company") = jobRS("company_id")) then %> "><%=objRS("email") %>
<% end if %>
<% if db_getData(objRS,"Require_Contractor_Approval") = "-1" then %> <% if objRS("status") = "Waiting on Approval" then %><% if CONST_biddersListApproveOrderHasWillBidOption then %><% end if %>
<% else response.Write(objRS("status")&"
") end if %> <% else %> <%=objRS("status")%>
<% end if %> <%=objRS("date_filled")%>
<% if db_getData(objRS, "date_returned") <> "" then response.Write("Date Returned:
"&db_getData(objRS, "date_returned")) end if %>
<% shipment_method = objRS("shipment_method") delivery_method = objRS("deliverymethod") if delivery_method <> "" then shipment_method = delivery_method end if contact_id = objRS("contact_id") company_id = objRS("company_id") response.Write(shipment_method) if CONST_displayTrackingNumberToAll or (Session("Security_Level")=10 and Session("User_Id")=contact_id) or (Session("Security_Level")=20 and Session("User_Company")=company_id) or (Session("Security_Level")>=30) then shipment_method = lcase(shipment_method) trackNumArr = split(objRS("tracking_number")&" ", ",") If InStr(shipment_method,"fed") > 0 Then for each tempTrackNum in trackNumArr trackNum = trim(tempTrackNum) if trackNum <> "" then response.Write("
FedEx "&trackNum&" ") end if next elseif InStr(shipment_method,"ups") > 0 Then for each tempTrackNum in trackNumArr trackNum = trim(tempTrackNum) if trackNum <> "" then response.Write("
UPS "&trackNum&" ") end if next elseif InStr(shipment_method,"intelliquick") > 0 Then for each tempTrackNum in trackNumArr trackNum = trim(tempTrackNum) if trackNum <> "" then response.Write("
") end if next end if end if response.Write("
") %>
<%=objRS("sets_issued")%>
<%if CONST_enableDownload then sqlQuery = "select id from disc_to_download where disc_id="&objRS("disc_id") set downloadRS = objConn.Execute(sqlQuery) if not downloadRS.EOF then response.Write("Downloadable") end if end if %>
Specs: <%=objRS("date_ordered")%> <% if CONST_biddersListDisplayAddendumDownloads then sqlQuery = "select c2a.download_date, ad.title " sqlQuery = sqlQuery & "from contact_to_addendum as c2a " sqlQuery = sqlQuery & "left outer join job_addendums ad on (c2a.addendum_id = ad.id) " sqlQuery = sqlQuery & "where c2a.contact_id="&objRS("contact_id")&" and ad.job_id="&objRS("job_id") set c2aRS = objConn.Execute(sqlQuery) do while not c2aRS.EOF response.Write("
"&c2aRS("title")&": "&c2aRS("download_date")) c2aRS.MoveNext loop end if %>
<% end function function showLimitedList(objRS,jobRS) dim headerArray(5) dim jsRowArray(3) dim displayArray(5,11,1) headerArray(0) = "" headerArray(1) = "Company Information" headerArray(2) = "Contact Information" headerArray(3) = "Status
Date Filled
Date Returned" headerArray(4) = "Delivery Method" if CONST_displayTrackingNumberToAll then headerArray(4) = headerArray(4) & "
Tracking Number" end if headerArray(4) = headerArray(4) headerArray(5) = "Sets Issued" displayArray(0,0,0) = "" displayArray(0,0,1) = "text" displayArray(1,0,0) = "company" displayArray(1,0,1) = "field_br" displayArray(1,1,0) = "shipto_address1" displayArray(1,1,1) = "field_br" displayArray(1,2,0) = "shipto_address2" displayArray(1,2,1) = "field_br_ifthere" displayArray(1,3,0) = "shipto_city" displayArray(1,3,1) = "field" displayArray(1,4,0) = ", " displayArray(1,4,1) = "text" displayArray(1,5,0) = "shipto_state" displayArray(1,5,1) = "field" displayArray(1,6,0) = " " displayArray(1,6,1) = "text" displayArray(1,7,0) = "shipto_zip" displayArray(1,7,1) = "field_br" if CONST_displayTradeInBidderList then displayArray(1,8,0) = "Trade: " displayArray(1,8,1) = "text" displayArray(1,9,0) = "companyTrade" displayArray(1,9,1) = "field_br" else displayArray(1,8,0) = "" displayArray(1,8,1) = "text" displayArray(1,9,0) = "" displayArray(1,9,1) = "text" end if if CONST_bidCategoriesEnabled then displayArray(1,10,0) = "Bid Cat.: " displayArray(1,10,1) = "text" displayArray(1,11,0) = "bid_category" displayArray(1,11,1) = "field_sc_subst_br" else displayArray(1,10,0) = "" displayArray(1,10,1) = "text" displayArray(1,11,0) = "" displayArray(1,11,1) = "text" end if displayArray(2,0,0) = "contactName" displayArray(2,0,1) = "field_br" displayArray(2,1,0) = "Phone: " displayArray(2,1,1) = "text" displayArray(2,2,0) = "phone" displayArray(2,2,1) = "field_br" displayArray(2,3,0) = "Fax: " displayArray(2,3,1) = "text" displayArray(2,4,0) = "fax" displayArray(2,4,1) = "field" displayArray(3,0,0) = "status" displayArray(3,0,1) = "field_br" displayArray(3,1,0) = "Date_Filled" displayArray(3,1,1) = "field_br" displayArray(3,2,0) = "date_returned" displayArray(3,2,1) = "date_returned" if CONST_displayTrackingNumberToAll then displayArray(4,0,0) = "tracking" displayArray(4,0,1) = "tracking" else displayArray(4,0,0) = "deliverymethod" displayArray(4,0,1) = "field_br" end if displayArray(5,0,0) = "sets_issued" displayArray(5,0,1) = "field" jsRowArray(0) = "this.className='rowDisplayDataHover'" jsRowArray(1) = "return" jsRowArray(2) = "" jsRowArray(3) = "highlightDownloadOrders" generic_selectionList objRS, displayArray, headerArray, jsRowArray end function %>