<% ' ' Filename: ArticoliGrid.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0 & Templates.ccp build 11/30/2001 ' '------------------------------- ' ArticoliGrid CustomIncludes begin %> <% ' ArticoliGrid CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "ArticoliGrid.asp" sTemplateFileName = "ArticoliGrid.html" '=============================== '=============================== ' ArticoliGrid PageSecurity begin ' ArticoliGrid PageSecurity end '=============================== '=============================== ' ArticoliGrid Open Event begin ' ArticoliGrid Open Event end '=============================== '=============================== ' ArticoliGrid OpenAnyPage Event begin ' ArticoliGrid OpenAnyPage Event end '=============================== '=============================== 'Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' ArticoliGrid Show begin '=============================== ' Display page '------------------------------- ' Load HTML template for this page '------------------------------- LoadTemplate sAppPath & sTemplateFileName, "main" '------------------------------- ' Load HTML template of Header and Footer '------------------------------- '------------------------------- SetVar "FileName", sFileName '------------------------------- ' Step through each form '------------------------------- Articoli_Show '------------------------------- ' Process page templates '------------------------------- Parse "main", False '------------------------------- ' Output the page to the browser '------------------------------- Response.write PrintVar("main") ' ArticoliGrid Show end '------------------------------- ' Destroy all object variables '------------------------------- ' ArticoliGrid Close Event begin ' ArticoliGrid Close Event end cn.Close Set cn = Nothing UnloadTemplate '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Articoli_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "Articoli" Dim HasParam : HasParam = false Dim iSort : iSort = "" Dim iSorted : iSorted = "" Dim sDirection : sDirection = "" Dim sSortParams : sSortParams = "" Dim iRecordsPerPage : iRecordsPerPage = 200 Dim iCounter : iCounter = 0 Dim iPage : iPage = 0 Dim bEof : bEof = False SetVar "TransitParams", "" SetVar "FormParams", "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by A.ArtDscMonitor Asc" iSort = GetParam("FormArticoli_Sorting") iSorted = GetParam("FormArticoli_Sorted") sDirection = "" if IsEmpty(iSort) then SetVar "Form_Sorting", "" else if iSort = iSorted then SetVar "Form_Sorting", "" sDirection = " DESC" sSortParams = "FormArticoli_Sorting=" & iSort & "&FormArticoli_Sorted=" & iSort & "&" else SetVar "Form_Sorting", iSort sDirection = " ASC" sSortParams = "FormArticoli_Sorting=" & iSort & "&FormArticoli_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by A.ArtDscMonitor" & sDirection if iSort = 2 then sOrder = " order by A.ArtDscPrinter" & sDirection if iSort = 3 then sOrder = " order by A.ArtDscTerminal" & sDirection if iSort = 4 then sOrder = " order by A.ArtDscDropOff" & sDirection if iSort = 5 then sOrder = " order by A.ArtDscCode" & sDirection if iSort = 6 then sOrder = " order by A.ArtCodebar" & sDirection if iSort = 7 then sOrder = " order by A.ArtOccupaz" & sDirection if iSort = 8 then sOrder = " order by A.ArtLnkPosFN" & sDirection if iSort = 9 then sOrder = " order by A.ArtImbalSng" & sDirection if iSort = 10 then sOrder = " order by A.ArtLnkUniMis" & sDirection if iSort = 11 then sOrder = " order by A.ArtTabTickColor" & sDirection if iSort = 12 then sOrder = " order by A.ArtTabTipo" & sDirection if iSort = 13 then sOrder = " order by A.ArtPrezzo" & sDirection if iSort = 14 then sOrder = " order by A.ArtOreLavoraz" & sDirection if iSort = 15 then sOrder = " order by A.ArtRestVisData" & sDirection if iSort = 16 then sOrder = " order by A.ArtRestDelta" & sDirection if iSort = 17 then sOrder = " order by A.ArtVisIcona" & sDirection if iSort = 18 then sOrder = " order by A.ArtVisTextColor" & sDirection if iSort = 19 then sOrder = " order by A.ArtVisBackColor" & sDirection if iSort = 20 then sOrder = " order by A.ArtTax1" & sDirection if iSort = 21 then sOrder = " order by A.ArtTax2" & sDirection if iSort = 22 then sOrder = " order by A.ArtTax3" & sDirection if iSort = 23 then sOrder = " order by A.ArtTax4" & sDirection if iSort = 24 then sOrder = " order by A.ArtBarCode" & sDirection if iSort = 25 then sOrder = " order by A.ArtPrezTipo" & sDirection if iSort = 26 then sOrder = " order by A.ArtDescReq" & sDirection if iSort = 27 then sOrder = " order by A.ArtPrintTick" & sDirection if iSort = 28 then sOrder = " order by A.ArtPrintTickGrmt" & sDirection if iSort = 29 then sOrder = " order by A.ArtLavorExt" & sDirection if iSort = 30 then sOrder = " order by A.ArtLnkCodTerz" & sDirection if iSort = 31 then sOrder = " order by A.ArtPrintLayTick" & sDirection if iSort = 32 then sOrder = " order by A.ArtGestDomic" & sDirection if iSort = 33 then sOrder = " order by A.ArtAbbo" & sDirection if iSort = 34 then sOrder = " order by A.Deleted" & sDirection end if '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select A.ArtAbbo as A_ArtAbbo, " & _ "A.ArtBarCode as A_ArtBarCode, " & _ "A.ArtCodebar as A_ArtCodebar, " & _ "A.ArtDescReq as A_ArtDescReq, " & _ "A.ArtDscCode as A_ArtDscCode, " & _ "A.ArtDscDropOff as A_ArtDscDropOff, " & _ "A.ArtDscMonitor as A_ArtDscMonitor, " & _ "A.ArtDscPrinter as A_ArtDscPrinter, " & _ "A.ArtDscTerminal as A_ArtDscTerminal, " & _ "A.ArtGestDomic as A_ArtGestDomic, " & _ "A.ArtImbalSng as A_ArtImbalSng, " & _ "A.ArtLavorExt as A_ArtLavorExt, " & _ "A.ArtLnkCodTerz as A_ArtLnkCodTerz, " & _ "A.ArtLnkPosFN as A_ArtLnkPosFN, " & _ "A.ArtLnkUniMis as A_ArtLnkUniMis, " & _ "A.ArtOccupaz as A_ArtOccupaz, " & _ "A.ArtOreLavoraz as A_ArtOreLavoraz, " & _ "A.ArtPrezTipo as A_ArtPrezTipo, " & _ "A.ArtPrezzo as A_ArtPrezzo, " & _ "A.ArtPrintLayTick as A_ArtPrintLayTick, " & _ "A.ArtPrintTick as A_ArtPrintTick, " & _ "A.ArtPrintTickGrmt as A_ArtPrintTickGrmt, " & _ "A.ArtRestDelta as A_ArtRestDelta, " & _ "A.ArtRestVisData as A_ArtRestVisData, " & _ "A.ArtTabTickColor as A_ArtTabTickColor, " & _ "A.ArtTabTipo as A_ArtTabTipo, " & _ "A.ArtTax1 as A_ArtTax1, " & _ "A.ArtTax2 as A_ArtTax2, " & _ "A.ArtTax3 as A_ArtTax3, " & _ "A.ArtTax4 as A_ArtTax4, " & _ "A.ArtVisBackColor as A_ArtVisBackColor, " & _ "A.ArtVisIcona as A_ArtVisIcona, " & _ "A.ArtVisTextColor as A_ArtVisTextColor, " & _ "A.Deleted as A_Deleted, " & _ "A.IdArt as A_IdArt " & _ " from Articoli A " '------------------------------- '------------------------------- ' Articoli Open Event begin ' Articoli Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Process the parameters for sorting '------------------------------- SetVar "SortParams", sSortParams '------------------------------- '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then set rs = nothing SetVar "DListArticoli", "" Parse "ArticoliNoRecords", False SetVar "ArticoliNavigator", "" Parse "FormArticoli", False exit sub end if '------------------------------- '------------------------------- ' Initialize page counter and records per page '------------------------------- iRecordsPerPage = 200 iCounter = 0 '------------------------------- '------------------------------- ' Process page scroller '------------------------------- iPage = GetParam("FormArticoli_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 '------------------------------- fldArtAbbo = GetValue(rs, "A_ArtAbbo") fldArtBarCode = GetValue(rs, "A_ArtBarCode") fldArtCodebar = GetValue(rs, "A_ArtCodebar") fldArtDescReq = GetValue(rs, "A_ArtDescReq") fldArtDscCode = GetValue(rs, "A_ArtDscCode") fldArtDscDropOff = GetValue(rs, "A_ArtDscDropOff") fldArtDscMonitor = GetValue(rs, "A_ArtDscMonitor") fldArtDscPrinter = GetValue(rs, "A_ArtDscPrinter") fldArtDscTerminal = GetValue(rs, "A_ArtDscTerminal") fldArtGestDomic = GetValue(rs, "A_ArtGestDomic") fldArtImbalSng = GetValue(rs, "A_ArtImbalSng") fldArtLavorExt = GetValue(rs, "A_ArtLavorExt") fldArtLnkCodTerz = GetValue(rs, "A_ArtLnkCodTerz") fldArtLnkPosFN = GetValue(rs, "A_ArtLnkPosFN") fldArtLnkUniMis = GetValue(rs, "A_ArtLnkUniMis") fldArtOccupaz = GetValue(rs, "A_ArtOccupaz") fldArtOreLavoraz = GetValue(rs, "A_ArtOreLavoraz") fldArtPrezTipo = GetValue(rs, "A_ArtPrezTipo") fldArtPrezzo = GetValue(rs, "A_ArtPrezzo") fldArtPrintLayTick = GetValue(rs, "A_ArtPrintLayTick") fldArtPrintTick = GetValue(rs, "A_ArtPrintTick") fldArtPrintTickGrmt = GetValue(rs, "A_ArtPrintTickGrmt") fldArtRestDelta = GetValue(rs, "A_ArtRestDelta") fldArtRestVisData = GetValue(rs, "A_ArtRestVisData") fldArtTabTickColor = GetValue(rs, "A_ArtTabTickColor") fldArtTabTipo = GetValue(rs, "A_ArtTabTipo") fldArtTax1 = GetValue(rs, "A_ArtTax1") fldArtTax2 = GetValue(rs, "A_ArtTax2") fldArtTax3 = GetValue(rs, "A_ArtTax3") fldArtTax4 = GetValue(rs, "A_ArtTax4") fldArtVisBackColor = GetValue(rs, "A_ArtVisBackColor") fldArtVisIcona = GetValue(rs, "A_ArtVisIcona") fldArtVisTextColor = GetValue(rs, "A_ArtVisTextColor") fldDeleted = GetValue(rs, "A_Deleted") fldIdArt = GetValue(rs, "A_IdArt") '------------------------------- ' Articoli Show begin '------------------------------- '------------------------------- ' Articoli Show Event begin ' Articoli Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "IdArt", ToHTML(fldIdArt) SetVar "ArtDscMonitor", ToHTML(fldArtDscMonitor) SetVar "ArtDscPrinter", ToHTML(fldArtDscPrinter) SetVar "ArtDscTerminal", ToHTML(fldArtDscTerminal) SetVar "ArtDscDropOff", ToHTML(fldArtDscDropOff) SetVar "ArtDscCode", ToHTML(fldArtDscCode) SetVar "ArtCodebar", ToHTML(fldArtCodebar) SetVar "ArtOccupaz", ToHTML(fldArtOccupaz) SetVar "ArtLnkPosFN", ToHTML(fldArtLnkPosFN) SetVar "ArtImbalSng", ToHTML(fldArtImbalSng) SetVar "ArtLnkUniMis", ToHTML(fldArtLnkUniMis) SetVar "ArtTabTickColor", ToHTML(fldArtTabTickColor) SetVar "ArtTabTipo", ToHTML(fldArtTabTipo) SetVar "ArtPrezzo", ToHTML(fldArtPrezzo) SetVar "ArtOreLavoraz", ToHTML(fldArtOreLavoraz) SetVar "ArtRestVisData", ToHTML(fldArtRestVisData) SetVar "ArtRestDelta", ToHTML(fldArtRestDelta) SetVar "ArtVisIcona", ToHTML(fldArtVisIcona) SetVar "ArtVisTextColor", ToHTML(fldArtVisTextColor) SetVar "ArtVisBackColor", ToHTML(fldArtVisBackColor) SetVar "ArtTax1", ToHTML(fldArtTax1) SetVar "ArtTax2", ToHTML(fldArtTax2) SetVar "ArtTax3", ToHTML(fldArtTax3) SetVar "ArtTax4", ToHTML(fldArtTax4) SetVar "ArtBarCode", ToHTML(fldArtBarCode) SetVar "ArtPrezTipo", ToHTML(fldArtPrezTipo) SetVar "ArtDescReq", ToHTML(fldArtDescReq) SetVar "ArtPrintTick", ToHTML(fldArtPrintTick) SetVar "ArtPrintTickGrmt", ToHTML(fldArtPrintTickGrmt) SetVar "ArtLavorExt", ToHTML(fldArtLavorExt) SetVar "ArtLnkCodTerz", ToHTML(fldArtLnkCodTerz) SetVar "ArtPrintLayTick", ToHTML(fldArtPrintLayTick) SetVar "ArtGestDomic", ToHTML(fldArtGestDomic) SetVar "ArtAbbo", ToHTML(fldArtAbbo) SetVar "Deleted", ToHTML(fldDeleted) Parse "DListArticoli", True '------------------------------- ' Articoli Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Articoli Navigation begin '------------------------------- bEof = rs.eof if rs.eof and iPage = 1 then SetVar "ArticoliNavigator", "" else if bEof then SetVar "ArticoliNavigatorLastPage", "_" else SetVar "NextPage", (iPage + 1) end if if iPage = 1 then SetVar "ArticoliNavigatorFirstPage", "_" else SetVar "PrevPage", (iPage - 1) end if SetVar "ArticoliCurrentPage", iPage Parse "ArticoliNavigator", False end if '------------------------------- ' Articoli Navigation end '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "ArticoliNoRecords", "" Parse "FormArticoli", False '------------------------------- ' Articoli Close Event begin ' Articoli Close Event end '------------------------------- End Sub '=============================== %>