<% ' ' Filename: portessale.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' portessale CustomIncludes begin %> <% ' portessale CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "portessale.asp" '=============================== '=============================== ' portessale PageSecurity begin CheckSecurity(1) ' portessale PageSecurity end '=============================== '=============================== ' portessale Open Event start ' portessale Open Event end '=============================== '=============================== ' portessale OpenAnyPage Event start ' portessale OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' portessale Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- srelcliinstallsale1Err = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "relcliinstallsale1" relcliinstallsale1Action(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Customers 1.09
<% MenuGeneral2_Show %>
<% MenuGeneral_Show %>
<% relcliinstallsale_Show %>
<% relcliinstallsale1_Show %>
<% ' portessale Show end ' portessale Close Event start ' portessale Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Display Grid Form '------------------------------- Sub relcliinstallsale_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "Portes de sale" Dim HasParam : HasParam = false Dim iSort : iSort = "" Dim iSorted : iSorted = "" Dim sDirection : sDirection = "" Dim form_sorting : form_sorting = "" Dim sSortParams : sSortParams = "" Dim form_action : form_action = "" Dim iRecordsPerPage : iRecordsPerPage = 200 Dim iCounter : iCounter = 0 Dim iPage : iPage = 0 Dim bEof : bEof = False Dim sActionFileName : sActionFileName = "portessale.asp" Dim transit_params : transit_params = "" Dim form_params : form_params = "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by r.idCli Asc" iSort = GetParam("Formrelcliinstallsale_Sorting") iSorted = GetParam("Formrelcliinstallsale_Sorted") sDirection = "" if IsEmpty(iSort) then form_sorting = "" else if iSort = iSorted then form_sorting = "" sDirection = " DESC" sSortParams = "Formrelcliinstallsale_Sorting=" & iSort & "&Formrelcliinstallsale_Sorted=" & iSort & "&" else form_sorting = iSort sDirection = " ASC" sSortParams = "Formrelcliinstallsale_Sorting=" & iSort & "&Formrelcliinstallsale_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by e.FriendName" & sDirection if iSort = 2 then sOrder = " order by r1.Description" & sDirection if iSort = 3 then sOrder = " order by t.Name" & sDirection if iSort = 4 then sOrder = " order by r.numB2K" & sDirection if iSort = 5 then sOrder = " order by t1.Name" & sDirection if iSort = 6 then sOrder = " order by r.disjoncteurValeur" & sDirection if iSort = 7 then sOrder = " order by r.disjoncteurNum" & sDirection if iSort = 8 then sOrder = " order by r.disjoncteurSituation" & sDirection if iSort = 9 then sOrder = " order by r2.Name" & sDirection if iSort = 10 then sOrder = " order by r3.Name" & sDirection if iSort = 11 then sOrder = " order by r.note" & sDirection if iSort = 12 then sOrder = " order by r.options" & sDirection end if '------------------------------- ' HTML column headers '------------------------------- %> <% '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select r.disjoncteurNum as r_disjoncteurNum, " & _ "r.disjoncteurSituation as r_disjoncteurSituation, " & _ "r.disjoncteurValeur as r_disjoncteurValeur, " & _ "r.dymo as r_dymo, " & _ "r.id as r_id, " & _ "r.idCli as r_idCli, " & _ "r.idInst as r_idInst, " & _ "r.idTypeSale as r_idTypeSale, " & _ "r.idVoltage as r_idVoltage, " & _ "r.note as r_note, " & _ "r.numB2K as r_numB2K, " & _ "r.options as r_options, " & _ "r.tuning as r_tuning, " & _ "e.id as e_id, " & _ "e.FriendName as e_FriendName, " & _ "r1.id as r1_id, " & _ "r1.Description as r1_Description, " & _ "t.id as t_id, " & _ "t.Name as t_Name, " & _ "t1.id as t1_id, " & _ "t1.Name as t1_Name, " & _ "r2.id as r2_id, " & _ "r2.Name as r2_Name, " & _ "r3.id as r3_id, " & _ "r3.Name as r3_Name " & _ " from relcliinstallsale r, eb_clients e, relcliinstall r1, typeportesale t, typevoltage t1, reponsequestion r2, reponsequestion r3" & _ " where e.id=r.idCli and r1.id=r.idInst and t.id=r.idTypeSale and t1.id=r.idVoltage and r2.id=r.dymo and r3.id=r.tuning " '------------------------------- '------------------------------- ' relcliinstallsale Open Event start ' relcliinstallsale Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- '------------------------------- ' Process the link to the record page '------------------------------- form_action = sActionFileName '------------------------------- '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then %> <% end if '------------------------------- '------------------------------- 'Initialize page counter and records per page '------------------------------- iRecordsPerPage = 200 iCounter = 0 '------------------------------- ' Process page scroller '------------------------------- iPage = GetParam("Formrelcliinstallsale_Page") if IsEmpty(iPage) then iPage = 1 else iPage = CLng(iPage) while not rs.eof and iCounter < (iPage-1)*iRecordsPerPage rs.movenext iCounter = iCounter + 1 wend iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- flddisjoncteurNum = GetValue(rs, "r_disjoncteurNum") flddisjoncteurSituation = GetValue(rs, "r_disjoncteurSituation") flddisjoncteurValeur = GetValue(rs, "r_disjoncteurValeur") flddymo = GetValue(rs, "r2_Name") fldid = GetValue(rs, "r_id") fldidCli_URLLink = "portessale.asp" fldidCli_id = GetValue(rs, "r_id") fldidCli = GetValue(rs, "e_FriendName") fldidInst = GetValue(rs, "r1_Description") fldidTypeSale = GetValue(rs, "t_Name") fldidVoltage = GetValue(rs, "t1_Name") fldnote = GetValue(rs, "r_note") fldnumB2K = GetValue(rs, "r_numB2K") fldoptions = GetValue(rs, "r_options") fldtuning = GetValue(rs, "r3_Name") '------------------------------- ' relcliinstallsale Show begin '------------------------------- '------------------------------- ' relcliinstallsale Show Event start ' relcliinstallsale Show Event end '------------------------------- '------------------------------- ' Process the HTML controls '------------------------------- %> <% '------------------------------- ' relcliinstallsale Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Process the bottom on the Grid. The insert link and record navigator. '------------------------------- %>
<%=sFormTitle%>
idCli idInst idTypeSale numB2K idVoltage disjoncteurValeur disjoncteurNum disjoncteurSituation dymo tuning note options
No records
<%=fldidCli%>  <%=ToHTML(fldidInst)%>  <%=ToHTML(fldidTypeSale)%>  <%=ToHTML(fldnumB2K)%>  <%=ToHTML(fldidVoltage)%>  <%=ToHTML(flddisjoncteurValeur)%>  <%=ToHTML(flddisjoncteurNum)%>  <%=ToHTML(flddisjoncteurSituation)%>  <%=ToHTML(flddymo)%>  <%=ToHTML(fldtuning)%>  <%=ToHTML(fldnote)%>  <%=ToHTML(fldoptions)%> 
Insert       <% '------------------------------- ' relcliinstallsale Navigation begin '------------------------------- bEof = rs.eof if not(rs.EOF and iPage=1) then if iPage = 1 then %> Previous <% else %> Previous <% end if response.write " [ " & iPage & " ] " if bEof then %> Next <% else %> Next <% end if end if '------------------------------- ' relcliinstallsale Navigation end '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing %>
<% '------------------------------- ' relcliinstallsale Close Event start ' relcliinstallsale Close Event end '------------------------------- end sub '=============================== '=============================== ' Action of the Record Form '------------------------------- Sub relcliinstallsale1Action(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKid : pPKid = "" Dim fldidTypeSale : fldidTypeSale = "" Dim fldnumB2K : fldnumB2K = "" Dim fldidVoltage : fldidVoltage = "" Dim flddisjoncteurValeur : flddisjoncteurValeur = "" Dim flddisjoncteurNum : flddisjoncteurNum = "" Dim flddisjoncteurSituation : flddisjoncteurSituation = "" Dim flddymo : flddymo = "" Dim fldtuning : fldtuning = "" Dim fldnote : fldnote = "" Dim fldoptions : fldoptions = "" '------------------------------- '------------------------------- ' relcliinstallsale1 Action begin '------------------------------- sActionFileName = "portessale.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' relcliinstallsale1 BeforeCancel Event start ' relcliinstallsale1 BeforeCancel Event end '------------------------------- cn.Close Set cn = Nothing response.redirect sActionFileName end if '------------------------------- '------------------------------- ' Build WHERE statement '------------------------------- if sAction = "update" or sAction = "delete" then pPKid = GetParam("PK_id") if IsEmpty(pPKid) then exit sub sWhere = "id=" & ToSQL(pPKid, "Number") end if '------------------------------- '------------------------------- ' Load all form fields into variables '------------------------------- fldidTypeSale = GetParam("idTypeSale") fldnumB2K = GetParam("numB2K") fldidVoltage = GetParam("idVoltage") flddisjoncteurValeur = GetParam("disjoncteurValeur") flddisjoncteurNum = GetParam("disjoncteurNum") flddisjoncteurSituation = GetParam("disjoncteurSituation") flddymo = GetParam("dymo") fldtuning = GetParam("tuning") fldnote = GetParam("note") fldoptions = GetParam("options") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldidVoltage) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field idVoltage is required.
" end if if IsEmpty(flddymo) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field dymo is required.
" end if if IsEmpty(fldtuning) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field tuning is required.
" end if if not isNumeric(fldidTypeSale) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field idTypeSale is incorrect.
" end if if not isNumeric(fldidVoltage) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field idVoltage is incorrect.
" end if if not isNumeric(flddymo) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field dymo is incorrect.
" end if if not isNumeric(fldtuning) then srelcliinstallsale1Err = srelcliinstallsale1Err & "The value in field tuning is incorrect.
" end if '------------------------------- ' relcliinstallsale1 Check Event start ' relcliinstallsale1 Check Event end '------------------------------- If len(srelcliinstallsale1Err) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "update" '------------------------------- ' relcliinstallsale1 Update Event start ' relcliinstallsale1 Update Event end '------------------------------- sSQL = "update relcliinstallsale set " & _ "idTypeSale=" & ToSQL(fldidTypeSale, "Number") & _ ",numB2K=" & ToSQL(fldnumB2K, "Text") & _ ",idVoltage=" & ToSQL(fldidVoltage, "Number") & _ ",disjoncteurValeur=" & ToSQL(flddisjoncteurValeur, "Text") & _ ",disjoncteurNum=" & ToSQL(flddisjoncteurNum, "Text") & _ ",disjoncteurSituation=" & ToSQL(flddisjoncteurSituation, "Text") & _ ",dymo=" & ToSQL(flddymo, "Number") & _ ",tuning=" & ToSQL(fldtuning, "Number") & _ ",note=" & ToSQL(fldnote, "Text") & _ ",options=" & ToSQL(fldoptions, "Text") sSQL = sSQL & " where " & sWhere end select '------------------------------- '------------------------------- ' relcliinstallsale1 BeforeExecute Event start ' relcliinstallsale1 BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(srelcliinstallsale1Err) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if srelcliinstallsale1Err = ProcessError on error goto 0 if len(srelcliinstallsale1Err) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' relcliinstallsale1 Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub relcliinstallsale1_Show() '------------------------------- ' relcliinstallsale1 Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "relcliinstallsale" bPK = true %> <% if not (srelcliinstallsale1Err = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if srelcliinstallsale1Err = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldidTypeSale = GetParam("idTypeSale") fldnumB2K = GetParam("numB2K") fldidVoltage = GetParam("idVoltage") flddisjoncteurValeur = GetParam("disjoncteurValeur") flddisjoncteurNum = GetParam("disjoncteurNum") flddisjoncteurSituation = GetParam("disjoncteurSituation") flddymo = GetParam("dymo") fldtuning = GetParam("tuning") fldnote = GetParam("note") fldoptions = GetParam("options") pid = GetParam("PK_id") end if '------------------------------- ' Load all form fields '------------------------------- '------------------------------- ' Build WHERE statement if IsEmpty(pid) then bPK = False sWhere = sWhere & "id=" & ToSQL(pid, "Number") PK_id = pid '------------------------------- '------------------------------- ' relcliinstallsale1 Open Event start ' relcliinstallsale1 Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from relcliinstallsale where " & sWhere openrs rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "relcliinstallsale1") and not rs.eof) '------------------------------- '------------------------------- ' Load all fields into variables from recordset or input parameters '------------------------------- if bIsUpdateMode then fldid = GetValue(rs, "id") fldidCli = GetValue(rs, "idCli") fldidInst = GetValue(rs, "idInst") '------------------------------- ' Load data from recordset when form displayed first time '------------------------------- if srelcliinstallsale1Err = "" then fldidTypeSale = GetValue(rs, "idTypeSale") fldnumB2K = GetValue(rs, "numB2K") fldidVoltage = GetValue(rs, "idVoltage") flddisjoncteurValeur = GetValue(rs, "disjoncteurValeur") flddisjoncteurNum = GetValue(rs, "disjoncteurNum") flddisjoncteurSituation = GetValue(rs, "disjoncteurSituation") flddymo = GetValue(rs, "dymo") fldtuning = GetValue(rs, "tuning") fldnote = GetValue(rs, "note") fldoptions = GetValue(rs, "options") end if '------------------------------- ' relcliinstallsale1 ShowEdit Event start ' relcliinstallsale1 ShowEdit Event end '------------------------------- else if srelcliinstallsale1Err = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' relcliinstallsale1 ShowInsert Event start ' relcliinstallsale1 ShowInsert Event end '------------------------------- end if '------------------------------- ' Set lookup fields '------------------------------- fldidCli = DLookUp("eb_clients", "FriendName", "id=" & ToSQL(fldidCli, "Number")) fldidInst = DLookUp("relcliinstall", "Description", "id=" & ToSQL(fldidInst, "Number")) '------------------------------- ' relcliinstallsale1 Show Event start ' relcliinstallsale1 Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= srelcliinstallsale1Err %>
idCli <%=ToHTML(fldidCli)%> 
idInst <%=ToHTML(fldidInst)%> 
idTypeSale
numB2K
idVoltage
disjoncteurValeur
disjoncteurNum
disjoncteurSituation
dymo
tuning
note
options
<% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' relcliinstallsale1 Close Event start ' relcliinstallsale1 Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' relcliinstallsale1 Show end '------------------------------- End Sub '=============================== %>