لینکش اینه لطفا یه نگاه بندازید
<%@ CodePage = 65001 %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.addHeader "cache-control", "no-cache"
Response.addHeader "cache-control", "no-store"
Response.CacheControl = "no-cache"
%>
<%
ewCurSec = 0 ' Initialise
' User levels
Const ewAllowAdd = 1
Const ewAllowDelete = 2
Const ewAllowEdit = 4
Const ewAllowView = 8
Const ewAllowList = 8
Const ewAllowReport = 8
Const ewAllowSearch = 8
Const ewAllowAdmin = 16
%>
<%
' Initialize common variables
x_ID = Null: ox_ID = Null
x_type2Dcard = Null: ox_type2Dcard = Null
x_serials = Null: ox_serials = Null
x_tedad = Null: ox_tedad = Null
x_tarikh_tahvil = Null: ox_tarikh_tahvil = Null
x_tarikh_tasvie = Null: ox_tarikh_tasvie = Null
x_ghimat_kol = Null: ox_ghimat_kol = Null
x_gimat_ba_5025 = Null: ox_gimat_ba_5025 = Null
x_gimat_be_moshtari = Null: ox_gimat_be_moshtari = Null
x_tasvie_moshtari = Null: ox_tasvie_moshtari = Null
x_percent = Null: ox_percent = Null
x_faktor2Dno = Null: ox_faktor2Dno = Null
%>
<!--#include file="db.asp"-->
<!--#include file="../aspmkrfn.asp"-->
<%
nStartRec = 0
nStopRec = 0
nTotalRecs = 0
nRecCount = 0
nRecActual = 0
sDbWhereMaster = ""
sDbWhereDetail = ""
sSrchAdvanced = ""
sSrchBasic = ""
sSrchWhere = ""
sDbWhere = ""
sDefaultOrderBy = ""
sDefaultFilter = ""
sWhere = ""
sGroupBy = ""
sHaving = ""
sOrderBy = ""
sSqlMasterBase = ""
sSqlMaster = ""
nDisplayRecs = 20
nRecRange = 10
' Open connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
' Handle Reset Command
ResetCmd()
' Get Search Criteria for Basic Search
SetUpBasicSearch()
' Build Search Criteria
If sSrchAdvanced <> "" Then
sSrchWhere = sSrchAdvanced ' Advanced Search
ElseIf sSrchBasic <> "" Then
sSrchWhere = sSrchBasic ' Basic Search
End If
' Save Search Criteria
If sSrchWhere <> "" Then
Session("1-aranid_searchwhere") = sSrchWhere
' Reset start record counter (new search)
nStartRec = 1
Session("1-aranid_REC") = nStartRec
Else
sSrchWhere = Session("1-aranid_searchwhere")
End If
' Build SQL
sSql = "SELECT * FROM [1-aranid]"
' Load Default Filter
sDefaultFilter = ""
sGroupBy = ""
sHaving = ""
' Load Default Order
sDefaultOrderBy = ""
' Build WHERE condition
sDbWhere = ""
If sDbWhereDetail <> "" Then
sDbWhere = sDbWhere & "(" & sDbWhereDetail & ") AND "
End If
If sSrchWhere <> "" Then
sDbWhere = sDbWhere & "(" & sSrchWhere & ") AND "
End If
If Len(sDbWhere) > 5 Then
sDbWhere = Mid(sDbWhere, 1, Len(sDbWhere)-5) ' Trim rightmost AND
End If
sWhere = ""
If sDefaultFilter <> "" Then
sWhere = sWhere & "(" & sDefaultFilter & ") AND "
End If
If sDbWhere <> "" Then
sWhere = sWhere & "(" & sDbWhere & ") AND "
End If
If Right(sWhere, 5) = " AND " Then sWhere = Left(sWhere, Len(sWhere)-5)
If sWhere <> "" Then
sSql = sSql & " WHERE " & sWhere
End If
If sGroupBy <> "" Then
sSql = sSql & " GROUP BY " & sGroupBy
End If
If sHaving <> "" Then
sSql = sSql & " HAVING " & sHaving
End If
' Set Up Sorting Order
sOrderBy = ""
SetUpSortOrder()
If sOrderBy <> "" Then
sSql = sSql & " ORDER BY " & sOrderBy
End If
'Response.Write sSql ' Uncomment to show SQL for debugging
%>
<!--#include file="../header.asp"-->
<script type="text/javascript" src="../ew.js"></script>
<script type="text/javascript">
<!--
EW_dateSep = "/"; // set date separator
//-->
</script>
<script type="text/javascript">
<!--
var firstrowoffset = 1; // first data row start at
var tablename = 'ewlistmain'; // table name
var usecss = false; // use css
var rowclass = 'ewTableRow'; // row class
var rowaltclass = 'ewTableAltRow'; // row alternate class
var rowmoverclass = 'ewTableHighlightRow'; // row mouse over class
var rowselectedclass = 'ewTableSelectRow'; // row selected class
var roweditclass = 'ewTableEditRow'; // row edit class
var rowcolor = '#FFFFFF'; // row color
var rowaltcolor = '#F5F5F5'; // row alternate color
var rowmovercolor = '#FFCCFF'; // row mouse over color
var rowselectedcolor = '#CCFFFF'; // row selected color
var roweditcolor = '#FFFF99'; // row edit color
//-->
</script>
<script type="text/javascript">
<!--
var EW_HTMLArea;
//-->
</script>
<%
' Set up Record Set
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, conn, 1, 2
nTotalRecs = rs.RecordCount
If nDisplayRecs <= 0 Then ' Display All Records
nDisplayRecs = nTotalRecs
End If
nStartRec = 1
SetUpStartRec() ' Set Up Start Record Position
%>
<p><span class="aspmaker">TABLE: <span style="font-size: 14pt"><b>آرانيد</b></span></span></p>
<form action="1-aranidlist.asp">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="aspmaker">
<input type="text" name="psearch" size="20">
<input type="Submit" name="Submit" value="Search (*)">
<a href="1-aranidlist.asp?cmd=reset">Show all</a>
</span></td>
</tr>
<tr><td><span class="aspmaker"><input type="radio" name="psearchtype" value="" checked>Exact phrase <input type="radio" name="psearchtype" value="AND">All words <input type="radio" name="psearchtype" value="OR">Any word</span></td></tr>
</table>
</form>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="aspmaker"><a href="1-aranidadd.asp">Add</a></span></td>
</tr>
</table>
<p>
<%
If Session("ewmsg") <> "" Then
%>
<p><span class="aspmaker" style="color: red;"><%= Session("ewmsg") %></span></p>
<%
Session("ewmsg") = "" ' Clear message
End If
%>
<% If nTotalRecs > 0 Then %>
<form method="post">
<table id="ewlistmain" border="0" cellspacing="1" cellpadding="4" bgcolor="#CCCCCC">
<!-- Table header -->
<tr bgcolor="#3366CC">
<td valign="top"><span class="aspmaker" style="color: #FFFFFF;">
<a href="1-aranidlist.asp?order=<%= Server.URLEncode("ID") %>" class="aspmaker" style="color: #FFFFFF;">ID<% If Session("1-aranid_x_ID_Sort") = "ASC" Then %><img src="../images/sortup.gif" width="10" height="9" border="0"><% ElseIf Session("1-aranid_x_ID_Sort") = "DESC" Then %><img src="../images/sortdown.gif" width="10" height="9" border="0"><% End If %></a>
</span></td>
<td valign="top" width="62"><span class="aspmaker">
<span style="color: #FFFFFF">نوع</span></span><span class="aspmaker" style="color: #FFFFFF;"><a href="1-aranidlist.asp?order=<%= Server.URLEncode("type-card") %>" class="aspmaker" style="color: #FFFFFF;"> </a>
</span><span class="aspmaker">
<span style="color: #FFFFFF"> کارت</span></span></td>
<td valign="top" width="77"><span class="aspmaker">
<span style="color: #FFFFFF">شماره سريال</span></span></td>
<td valign="top" width="70"><span class="aspmaker">
<span style="color: #FFFFFF">تعداد کارت</span></span></td>
<td valign="top" width="68"><span class="aspmaker">
<span style="color: #FFFFFF">تاريخ تحويل</span></span></td>
<td valign="top" width="66"><span class="aspmaker">
<span style="color: #FFFFFF">تاریخ تسویه</span></span></td>
<td valign="top" width="55"><span class="aspmaker">
<span style="color: #FFFFFF">قيمت کل</span></span></td>
<td valign="top" width="78"><span class="aspmaker" style="color: #FFFFFF;">
قيمت با %50</span></td>
<td valign="top" width="74"><span class="aspmaker">
<span style="color: #FFFFFF">قيمت به مغازه دار</span></span></td>
<td valign="top" width="63"><span class="aspmaker">
<span style="color: #FFFFFF">تسويه با مغاره دار</span></span></td>
<td valign="top" width="36"><span class="aspmaker">
<span style="color: #FFFFFF">درصد</span></span></td>
<td valign="top" width="66"><span class="aspmaker">
<span style="color: #FFFFFF">شماره فاکتور</span></span></td>
<td width="24"> </td>
</tr>
<%
' Avoid starting record > total records
If CLng(nStartRec) > CLng(nTotalRecs) Then
nStartRec = nTotalRecs
End If
' Set the last record to display
nStopRec = nStartRec + nDisplayRecs - 1
' Move to first record directly for performance reason
nRecCount = nStartRec - 1
If Not rs.Eof Then
rs.MoveFirst
rs.Move nStartRec - 1
End If
nRecActual = 0
Do While (Not rs.Eof) And (nRecCount < nStopRec)
nRecCount = nRecCount + 1
If CLng(nRecCount) >= CLng(nStartRec) Then
nRecActual = nRecActual + 1
' Set row color
sItemRowClass = " bgcolor=""#FFFFFF"""
sListTrJs = " onmouseover='ew_mouseover(this);' onmouseout='ew_mouseout(this);' onclick='ew_click(this);'"
' Display alternate color for rows
If nRecCount Mod 2 <> 1 Then
sItemRowClass = " bgcolor=""#F5F5F5"""
End If
x_ID = rs("ID")
x_type2Dcard = rs("type-card")
x_serials = rs("serials")
x_tedad = rs("tedad")
x_tarikh_tahvil = rs("tarikh tahvil")
x_tarikh_tasvie = rs("tarikh tasvie")
x_ghimat_kol = rs("ghimat kol")
x_gimat_ba_5025 = rs("gimat ba 50%")
x_gimat_be_moshtari = rs("gimat be moshtari")
x_tasvie_moshtari = rs("tasvie moshtari")
x_percent = rs("percent")
x_faktor2Dno = rs("faktor-no")
%>
<!-- Table body -->
<tr<%=sItemRowClass%><%=sListTrJs%>>
<!-- ID -->
<td><span class="aspmaker">
<% Response.Write x_ID %>
</span></td>
<!-- type-card -->
<td width="62"><span class="aspmaker">
<% Response.Write x_type2Dcard %>
</span></td>
<!-- serials -->
<td width="77"><span class="aspmaker">
<% Response.Write x_serials %>
</span></td>
<!-- tedad -->
<td width="70"><span class="aspmaker">
<% Response.Write x_tedad %>
</span></td>
<!-- tarikh tahvil -->
<td width="68"><span class="aspmaker">
<% Response.Write x_tarikh_tahvil %>
</span></td>
<!-- tarikh tasvie -->
<td width="66"><span class="aspmaker">
<% Response.Write x_tarikh_tasvie %>
</span></td>
<!-- ghimat kol -->
<td width="55"><span class="aspmaker">
<% Response.Write x_ghimat_kol %>
</span></td>
<!-- gimat ba 50% -->
<td width="78"><span class="aspmaker">
<% Response.Write x_gimat_ba_5025 %>
</span></td>
<!-- gimat be moshtari -->
<td width="74"><span class="aspmaker">
<% Response.Write x_gimat_be_moshtari %>
</span></td>
<!-- tasvie moshtari -->
<td width="63"><span class="aspmaker">
<% Response.Write x_tasvie_moshtari %>
</span></td>
<!-- percent -->
<td width="36"><span class="aspmaker">
<% Response.Write x_percent %>
</span></td>
<!-- faktor-no -->
<td width="66"><span class="aspmaker">
<% Response.Write x_faktor2Dno %>
</span></td>
<td width="24"><span class="aspmaker"><a href="<% If Not IsNull(x_ID) Then Response.Write "1-aranidedit.asp?ID=" & Server.URLEncode(x_ID) Else Response.Write "javascript:alert('Invalid Record! Key is null');" End If %>">Edit</a></span></td>
</tr>
<%
End If
rs.MoveNext
Loop
%>
</table>
</form>
<% End If %>
<%
SELECT SUM(gimat ba 50%) as total FROM `1-aranid`
' Close recordset and connection
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>
<form action="1-aranidlist.asp" name="ewpagerform" id="ewpagerform">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap>
<%
If nTotalRecs > 0 Then
rsEof = (nTotalRecs < (nStartRec + nDisplayRecs))
PrevStart = nStartRec - nDisplayRecs
If PrevStart < 1 Then PrevStart = 1
NextStart = nStartRec + nDisplayRecs
If NextStart > nTotalRecs Then NextStart = nStartRec
LastStart = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1
%>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker">Page </span></td>
<!--first page button-->
<% If CLng(nStartRec)=1 Then %>
<td><img src="../images/firstdisab.gif" alt="First" width="16" height="16" border="0"></td>
<% Else %>
<td><a href="1-aranidlist.asp?start=1"><img src="../images/first.gif" alt="First" width="16" height="16" border="0"></a></td>
<% End If %>
<!--previous page button-->
<% If CLng(PrevStart) = CLng(nStartRec) Then %>
<td><img src="../images/prevdisab.gif" alt="Previous" width="16" height="16" border="0"></td>
<% Else %>
<td><a href="1-aranidlist.asp?start=<%=PrevStart%>"><img src="../images/prev.gif" alt="Previous" width="16" height="16" border="0"></a></td>
<% End If %>
<!--current page number-->
<td><input type="text" name="pageno" value="<%=(nStartRec-1)\nDisplayRecs+1%>" size="4"></td>
<!--next page button-->
<% If CLng(NextStart) = CLng(nStartRec) Then %>
<td><img src="../images/nextdisab.gif" alt="Next" width="16" height="16" border="0"></td>
<% Else %>
<td><a href="1-aranidlist.asp?start=<%=NextStart%>"><img src="../images/next.gif" alt="Next" width="16" height="16" border="0"></a></td>
<% End If %>
<!--last page button-->
<% If CLng(LastStart) = CLng(nStartRec) Then %>
<td><img src="../images/lastdisab.gif" alt="Last" width="16" height="16" border="0"></td>
<% Else %>
<td><a href="1-aranidlist.asp?start=<%=LastStart%>"><img src="../images/last.gif" alt="Last" width="16" height="16" border="0"></a></td>
<% End If %>
<td><span class="aspmaker"> of <%=(nTotalRecs-1)\nDisplayRecs+1%></span></td>
</tr></table>
<% If CLng(nStartRec) > CLng(nTotalRecs) Then nStartRec = nTotalRecs
nStopRec = nStartRec + nDisplayRecs - 1
nRecCount = nTotalRecs - 1
If rsEOF Then nRecCount = nTotalRecs
If nStopRec > nRecCount Then nStopRec = nRecCount %>
<span class="aspmaker">Records <%= nStartRec %> to <%= nStopRec %> of <%= nTotalRecs %></span>
<% Else %>
<span class="aspmaker">No records found</span>
<% End If %>
</td>
</tr>
</table>
</form>
<!--#include file="../footer.asp"-->
<%
'-------------------------------------------------------------------------------
' Function BasicSearchSQL
' - Build WHERE clause for a keyword
Function BasicSearchSQL(Keyword)
Dim sKeyword
sKeyword = AdjustSql(Keyword)
BasicSearchSQL = ""
BasicSearchSQL = BasicSearchSQL & "[type-card] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[serials] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[tedad] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[tarikh tahvil] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[tarikh tasvie] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[ghimat kol] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[gimat ba 50%] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[gimat be moshtari] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[tasvie moshtari] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[percent] LIKE '%" & sKeyword & "%' OR "
BasicSearchSQL = BasicSearchSQL & "[faktor-no] LIKE '%" & sKeyword & "%' OR "
If Right(BasicSearchSQL, 4) = " OR " Then BasicSearchSQL = Left(BasicSearchSQL, Len(BasicSearchSQL)-4)
End Function
'-------------------------------------------------------------------------------
' Function SetUpBasicSearch
' - Set up Basic Search parameter based on form elements pSearch & pSearchType
' - Variables setup: sSrchBasic
Sub SetUpBasicSearch()
Dim sSearch, sSearchType, arKeyword, sKeyword
sSearch = Request.QueryString("psearch")
sSearchType = Request.QueryString("psearchType")
If sSearch <> "" Then
If sSearchType <> "" Then
While InStr(sSearch, " ") > 0
sSearch = Replace(sSearch, " ", " ")
Wend
arKeyword = Split(Trim(sSearch), " ")
For Each sKeyword In arKeyword
sSrchBasic = sSrchBasic & "(" & BasicSearchSQL(sKeyword) & ") " & sSearchType & " "
Next
Else
sSrchBasic = BasicSearchSQL(sSearch)
End If
End If
If Right(sSrchBasic, 4) = " OR " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-4)
If Right(sSrchBasic, 5) = " AND " Then sSrchBasic = Left(sSrchBasic, Len(sSrchBasic)-5)
End Sub
'-------------------------------------------------------------------------------
' Function SetUpSortOrder
' - Set up Sort parameters based on Sort Links clicked
' - Variables setup: sOrderBy, Session("Table_OrderBy"), Session("Table_Field_Sort")
Sub SetUpSortOrder()
Dim sOrder, sSortField, sLastSort, sThisSort
Dim bCtrl
' Check for an Order parameter
If Request.QueryString("order").Count > 0 Then
sOrder = Request.QueryString("order")
' Field ID
If sOrder = "ID" Then
sSortField = "[ID]"
sLastSort = Session("1-aranid_x_ID_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_ID_Sort") = sThisSort
Else
If Session("1-aranid_x_ID_Sort") <> "" Then Session("1-aranid_x_ID_Sort") = ""
End If
' Field type-card
If sOrder = "type-card" Then
sSortField = "[type-card]"
sLastSort = Session("1-aranid_x_type2Dcard_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_type2Dcard_Sort") = sThisSort
Else
If Session("1-aranid_x_type2Dcard_Sort") <> "" Then Session("1-aranid_x_type2Dcard_Sort") = ""
End If
' Field serials
If sOrder = "serials" Then
sSortField = "[serials]"
sLastSort = Session("1-aranid_x_serials_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_serials_Sort") = sThisSort
Else
If Session("1-aranid_x_serials_Sort") <> "" Then Session("1-aranid_x_serials_Sort") = ""
End If
' Field tedad
If sOrder = "tedad" Then
sSortField = "[tedad]"
sLastSort = Session("1-aranid_x_tedad_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_tedad_Sort") = sThisSort
Else
If Session("1-aranid_x_tedad_Sort") <> "" Then Session("1-aranid_x_tedad_Sort") = ""
End If
' Field tarikh tahvil
If sOrder = "tarikh tahvil" Then
sSortField = "[tarikh tahvil]"
sLastSort = Session("1-aranid_x_tarikh_tahvil_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_tarikh_tahvil_Sort") = sThisSort
Else
If Session("1-aranid_x_tarikh_tahvil_Sort") <> "" Then Session("1-aranid_x_tarikh_tahvil_Sort") = ""
End If
' Field tarikh tasvie
If sOrder = "tarikh tasvie" Then
sSortField = "[tarikh tasvie]"
sLastSort = Session("1-aranid_x_tarikh_tasvie_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_tarikh_tasvie_Sort") = sThisSort
Else
If Session("1-aranid_x_tarikh_tasvie_Sort") <> "" Then Session("1-aranid_x_tarikh_tasvie_Sort") = ""
End If
' Field ghimat kol
If sOrder = "ghimat kol" Then
sSortField = "[ghimat kol]"
sLastSort = Session("1-aranid_x_ghimat_kol_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_ghimat_kol_Sort") = sThisSort
Else
If Session("1-aranid_x_ghimat_kol_Sort") <> "" Then Session("1-aranid_x_ghimat_kol_Sort") = ""
End If
' Field gimat ba 50%
If sOrder = "gimat ba 50%" Then
sSortField = "[gimat ba 50%]"
sLastSort = Session("1-aranid_x_gimat_ba_5025_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_gimat_ba_5025_Sort") = sThisSort
Else
If Session("1-aranid_x_gimat_ba_5025_Sort") <> "" Then Session("1-aranid_x_gimat_ba_5025_Sort") = ""
End If
' Field gimat be moshtari
If sOrder = "gimat be moshtari" Then
sSortField = "[gimat be moshtari]"
sLastSort = Session("1-aranid_x_gimat_be_moshtari_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_gimat_be_moshtari_Sort") = sThisSort
Else
If Session("1-aranid_x_gimat_be_moshtari_Sort") <> "" Then Session("1-aranid_x_gimat_be_moshtari_Sort") = ""
End If
' Field tasvie moshtari
If sOrder = "tasvie moshtari" Then
sSortField = "[tasvie moshtari]"
sLastSort = Session("1-aranid_x_tasvie_moshtari_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_tasvie_moshtari_Sort") = sThisSort
Else
If Session("1-aranid_x_tasvie_moshtari_Sort") <> "" Then Session("1-aranid_x_tasvie_moshtari_Sort") = ""
End If
' Field percent
If sOrder = "percent" Then
sSortField = "[percent]"
sLastSort = Session("1-aranid_x_percent_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_percent_Sort") = sThisSort
Else
If Session("1-aranid_x_percent_Sort") <> "" Then Session("1-aranid_x_percent_Sort") = ""
End If
' Field faktor-no
If sOrder = "faktor-no" Then
sSortField = "[faktor-no]"
sLastSort = Session("1-aranid_x_faktor2Dno_Sort")
If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
Session("1-aranid_x_faktor2Dno_Sort") = sThisSort
Else
If Session("1-aranid_x_faktor2Dno_Sort") <> "" Then Session("1-aranid_x_faktor2Dno_Sort") = ""
End If
Session("1-aranid_OrderBy") = sSortField & " " & sThisSort
Session("1-aranid_REC") = 1
End If
sOrderBy = Session("1-aranid_OrderBy")
If sOrderBy = "" Then
sOrderBy = sDefaultOrderBy
Session("1-aranid_OrderBy") = sOrderBy
End If
End Sub
'-------------------------------------------------------------------------------
' Function SetUpStartRec
' - Set up Starting Record parameters based on Pager Navigation
' - Variables setup: nStartRec
Sub SetUpStartRec()
Dim nPageNo
' Check for a START parameter
If Request.QueryString("start").Count > 0 Then
nStartRec = Request.QueryString("start")
Session("1-aranid_REC") = nStartRec
ElseIf Request.QueryString("pageno").Count > 0 Then
nPageNo = Request.QueryString("pageno")
If IsNumeric(nPageNo) Then
nStartRec = (nPageNo-1)*nDisplayRecs+1
If nStartRec <= 0 Then
nStartRec = 1
ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then
nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1
End If
Session("1-aranid_REC") = nStartRec
Else
nStartRec = Session("1-aranid_REC")
If Not IsNumeric(nStartRec) Or nStartRec = "" Then
nStartRec = 1 ' Reset start record counter
Session("1-aranid_REC") = nStartRec
End If
End If
Else
nStartRec = Session("1-aranid_REC")
If Not IsNumeric(nStartRec) Or nStartRec = "" Then
nStartRec = 1 'Reset start record counter
Session("1-aranid_REC") = nStartRec
End If
End If
End Sub
'-------------------------------------------------------------------------------
' Function ResetCmd
' - Clear list page parameters
' - RESET: reset search parameters
' - RESETALL: reset search & master/detail parameters
' - RESETSORT: reset sort parameters
Sub ResetCmd()
Dim sCmd
' Get Reset Cmd
If Request.QueryString("cmd").Count > 0 Then
sCmd = Request.QueryString("cmd")
' Reset Search Criteria
If UCase(sCmd) = "RESET" Then
sSrchWhere = ""
Session("1-aranid_searchwhere") = sSrchWhere
' Reset Search Criteria & Session Keys
ElseIf UCase(sCmd) = "RESETALL" Then
sSrchWhere = ""
Session("1-aranid_searchwhere") = sSrchWhere
' Reset Sort Criteria
ElseIf UCase(sCmd) = "RESETSORT" Then
sOrderBy = ""
Session("1-aranid_OrderBy") = sOrderBy
If Session("1-aranid_x_ID_Sort") <> "" Then Session("1-aranid_x_ID_Sort") = ""
If Session("1-aranid_x_type2Dcard_Sort") <> "" Then Session("1-aranid_x_type2Dcard_Sort") = ""
If Session("1-aranid_x_serials_Sort") <> "" Then Session("1-aranid_x_serials_Sort") = ""
If Session("1-aranid_x_tedad_Sort") <> "" Then Session("1-aranid_x_tedad_Sort") = ""
If Session("1-aranid_x_tarikh_tahvil_Sort") <> "" Then Session("1-aranid_x_tarikh_tahvil_Sort") = ""
If Session("1-aranid_x_tarikh_tasvie_Sort") <> "" Then Session("1-aranid_x_tarikh_tasvie_Sort") = ""
If Session("1-aranid_x_ghimat_kol_Sort") <> "" Then Session("1-aranid_x_ghimat_kol_Sort") = ""
If Session("1-aranid_x_gimat_ba_5025_Sort") <> "" Then Session("1-aranid_x_gimat_ba_5025_Sort") = ""
If Session("1-aranid_x_gimat_be_moshtari_Sort") <> "" Then Session("1-aranid_x_gimat_be_moshtari_Sort") = ""
If Session("1-aranid_x_tasvie_moshtari_Sort") <> "" Then Session("1-aranid_x_tasvie_moshtari_Sort") = ""
If Session("1-aranid_x_percent_Sort") <> "" Then Session("1-aranid_x_percent_Sort") = ""
If Session("1-aranid_x_faktor2Dno_Sort") <> "" Then Session("1-aranid_x_faktor2Dno_Sort") = ""
End If
' Reset Start Position (Reset Command)
nStartRec = 1
Session("1-aranid_REC") = nStartRec
End If
End Sub
%>