|
... from this line, i want copy the result of (Data+workingdays), in another tag, for example:
from
<td nowrap height="16" width="72"><font face="Verdana" size="1"><%=objRS("date").Value%></font></td>
to
<td nowrap height="16" width="72"><font face="Verdana" size="1"><%=objRS("newdate+6workingdays").Value%></font></td>
the format date in my mdb is "DATE" dd/mm/yyyy
Tks.
<Added>
ops! My code
<%@ Language=VBScript %>
<!-- METADATA TYPE="typelib" UUID="00000200-0000-0010-8000-00AA006D2EA4" NAME="ADO Type Library"-->
<%
Option Explicit
Response.Buffer = True 'Turn buffering on
Response.Expires = -1 'Page expires immediately
'Constants
Const MIN_PAGESIZE = 5 'Minimum pagesize
Const MAX_PAGESIZE = 30 'Maximum pagesize
Const DEF_PAGESIZE = 10 'Default pagesize
'Variables
Dim objCn 'ADO DB connection object
Dim objRs 'ADO DB recordset object
Dim blnWhere 'True/False for have WHERE in sql already
Dim intRecord 'Current record for paging recordset
Dim intPage 'Requested page
Dim intPageSize 'Requested pagesize
Dim sql 'Dynamic sql query string
'Create objects
Set objCn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")
'Set/initialize variables
intRecord = 1
blnWhere = False
'-Get/set requested page
intPage = MakeLong(Request("page"))
If intPage < 1 Then intPage = 1
'-Get/set requested pagesize
If IsEmpty(Request("pagesize")) Then 'Set to default
intPageSize = DEF_PAGESIZE
Else
intPageSize = MakeLong(Request("pagesize"))
'Make sure it fits our min/max requirements
If intPageSize < MIN_PAGESIZE Then
intPageSize = MIN_PAGESIZE
ElseIf intPageSize > MAX_PAGESIZE Then
intPageSize = MAX_PAGESIZE
End If
End If
'-Build dynamic sql
'--- byluciani
'sql = "SELECT ID, Sku, Title, Price FROM Products "
sql = "SELECT * FROM tabella1 "
'--ID (exact search only)
If Not IsEmpty(Request("id")) Then
If IsNumeric(Request("id")) Then
'Add to query
'First item so we don't have to test for WHERE
blnWhere = True 'Set where to true
sql = sql & "WHERE "
sql = sql & "(ID = " & CStr(CLng(Request("id"))) & ") "
End If
End If
'--Sku (partial and exact search)
If Not IsEmpty(Request("sku")) Then
Dim strSku
strSku = Trim(Request("sku"))
If strSku <> "" Then
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
If (Left(strSku, 1) = "*" And Len(strSku) > 1) Then 'Partial search
'--- byluciani
'sql = sql & "(Sku LIKE '%" & Replace(Mid(strSku, 2), "'", "''") & "') "
sql = sql & "(numcontratto LIKE '%" & Replace(Mid(strSku, 2), "'", "''") & "') "
ElseIf (Right(strSku, 1) = "*" And Len(strSku) > 1) Then 'Partial search
'--- byluciani
'sql = sql & "(Sku LIKE '" & Replace(Mid(strSku, 1, Len(strSku)-1), "'", "''") & "%') "
sql = sql & "(numcontratto LIKE '" & Replace(Mid(strSku, 1, Len(strSku)-1), "'", "''") & "%') "
Else 'Exact match
'--- byluciani
'sql = sql & "(Sku = '" & Replace(strSku, "'", "''") & "') "
sql = sql & "(numcontratto = '" & Replace(strSku, "'", "''") & "') "
End If
End If
End If
'--Title (parital search only)
If Not IsEmpty(Request("title")) Then
Dim strTitle
strTitle = Trim(Request("title"))
If strTitle <> "" Then
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
'--- byluciani
'sql = sql & "(Title LIKE '%" & Replace(strTitle, "'", "''") & "%') "
sql = sql & "(denominazionesociale LIKE '%" & Replace(strTitle, "'", "''") & "%') "
End If
End If
'--Price (minimum)
If Not IsEmpty(Request("minprice")) Then
If IsNumeric(Request("minprice")) Then
Dim dblMinPrice
dblMinPrice = CDbl(Request("minprice"))
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
'--- byluciani
'sql = sql & "(Price >= " & CStr(dblMinPrice) & ") "
sql = sql & "(sportello >= " & CStr(dblMinPrice) & ") "
End If
End If
'--Price (maximum)
If Not IsEmpty(Request("maxprice")) Then
If IsNumeric(Request("maxprice")) Then
Dim dblMaxPrice
dblMaxPrice = CDbl(Request("maxprice"))
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
'--- byluciani
'sql = sql & "(Price <= " & CStr(dblMaxPrice) & ") "
sql = sql & "(sportello <= " & CStr(dblMaxPrice) & ") "
End If
End If
'--Sort By Field
sql = sql & "ORDER BY "
Select Case Trim(LCase(Request("sortby")))
'--- byluciani
'Case "sku": sql = sql & "Sku "
'Case "title": sql = sql & "Title "
'Case "price": sql = sql & "Price "
'Case "sku": sql = sql & "numcontratto "
Case "title": sql = sql & "denominazionesociale "
Case "price": sql = sql & "sportello "
Case "data": sql = sql & "data "
Case Else: sql = sql & "numcontratto "
End Select
'--Sort Order
Select Case Trim(LCase(Request("sortorder")))
Case "desc": sql = sql & "DESC"
Case Else: sql = sql & "ASC"
End Select
'--Dynamic sql finished
'Create and open connection object
With objCn
.CursorLocation = adUseClient
.ConnectionTimeout = 15
.CommandTimeout = 30
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("./tabella1x.mdb") & ";"
.Open
End With
'Create and open recordset object
With objRs
.ActiveConnection = objCn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Source = sql
.PageSize = intPageSize
.Open
Set .ActiveConnection = Nothing 'Disconnect the recordset
End With
'Creates a long value from a variant, invalid always set to zero
Function MakeLong(ByVal varValue)
If IsNumeric(varValue) Then
MakeLong = CLng(varValue)
Else
MakeLong = 0
End If
End Function
'Returns a neatly made paging string, automatically configuring for request
'variables, regardless of in querystring or from form, adjust output to your needs.
Function Paging(ByVal intPage, ByVal intPageCount, ByVal intRecordCount)
Dim strQueryString
Dim strScript
Dim intStart
Dim intEnd
Dim strRet
Dim i
If intPage > intPageCount Then
intPage = intPageCount
ElseIf intPage < 1 Then
intPage = 1
End If
If intRecordCount = 0 Then
strRet = "No Records Found"
ElseIf intPageCount = 1 Then
strRet = "FINE REPORT"
Else
For i = 1 To Request.QueryString.Count
If LCase(Request.QueryString.Key(i)) <> "page" Then
strQueryString = strQueryString & "&"
strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Key(i)) & "="
strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Item(i))
End If
Next
For i = 1 To Request.Form.Count
If LCase(Request.Form.Key(i)) <> "page" Then
strQueryString = strQueryString & "&"
strQueryString = strQueryString & Server.URLEncode(Request.Form.Key(i)) & "="
strQueryString = strQueryString & Server.URLEncode(Request.Form.Item(i))
End If
Next
If Len(strQueryString) <> 0 Then
strQueryString = "?" & Mid(strQueryString, 2) & "&"
Else
strQueryString = "?"
End If
strScript = Request.ServerVariables("SCRIPT_NAME") & strQueryString
If intPage <= 10 Then
intStart = 1
Else
If (intPage Mod 10) = 0 Then
intStart = intPage - 9
Else
intStart = intPage - (intPage Mod 10) + 1
End If
End If
intEnd = intStart + 9
If intEnd > intPageCount Then intEnd = intPageCount
strRet = "Pagine " & intPage & " di " & intPageCount & ": "
If intPage <> 1 Then
strRet = strRet & "<a href=""" & strScript
strRet = strRet & "page=" & intPage - 1
strRet = strRet & """><<Indietro</a> "
End If
For i = intStart To intEnd
If i = intPage Then
strRet = strRet & "<b>" & i & "</b> "
Else
strRet = strRet & "<a href=""" & strScript
strRet = strRet & "page=" & i
strRet = strRet & """>" & i & "</a>"
If i <> intEnd Then strRet = strRet & " "
End If
Next
If intPage <> intPageCount Then
strRet = strRet & " <a href=""" & strScript
strRet = strRet & "page=" & intPage + 1
strRet = strRet & """>Avanti>></a> "
End If
End If
Paging = strRet
End Function
%>
<html>
<head>
<title></title>
<style>body { font-size: 7 pt; color: #000000; font-family: Verdana; text-decoration: none }
table { font-size: 8 pt; color: #000000; font-family: Verdana; text-decoration: none }
a { font-size: 8 pt; color: #0000FF; font-family: Verdana; text-decoration:
underline }
hr { color: #0072BC; font-family: Verdana; font-size: 8 pt }
</style>
<%
'---- modificato
If Request.Form.Count > 0 Then
%>
<script>parent.superiore.location="/forum/search___lt_Request.Form_gt_.html"</script>
<%
End If
'----
%>
</head>
<body topmargin="0" leftmargin="0">
<script language="Javascript" type="text/javascript">
function DoPopUp(URL,Name,X,Y,Center,Resizable,ScrollBars){
if (Center == 'yes'){
var PopUpX = (screen.width/2)-(parseInt(X)/2);
var PopUpY = (screen.height/2)-(parseInt(Y)/2);
var pos = ",left="+PopUpX+",top="+PopUpY;
}else{
var pos = "";
}
PopUpWindow = window.open(URL,Name,'scrollbars='+ScrollBars+',resizable='+Resizable+',width='+X+',height='+Y+pos);
}
</script>
<div align="center">
<center>
<table border="0" width="718" cellpadding="1" cellspacing="1">
<%If objRs.EOF Then%>
<!--No Records Found-->
<tr><td align="center" width="779" height="0"><b><font size="1">NESSUN RECORD TROVATO!</font></b></td></tr>
<%Else%>
<!--Records Found-->
</center>
<tr>
<td width="779" align="center" height="0">
<table border="0" cellpadding="3" cellspacing="3" height="163" width="765">
<tr><td colspan=7 height="15" width="759">
<p align="left"><b>RECORD TROVATI: <font color="#FF0000"><%=objRs.RecordCount%></p>
</b></td></tr>
<center>
<tr><td colspan="7" height="15" width="759">
<p align="center"><%=Paging(intPage, objRs.PageCount, objRs.RecordCount)%>
<hr size="1"></td></tr>
<tr bgcolor="#efefef">
<td nowrap bgcolor="#66CCFF" height="26" width="32"><b><font color="#0000FF" size="1" face="Verdana">CTR</font></b></td>
<td nowrap height="26" bgcolor="#66CCFF" align="left" width="375"><b><font color="#0000FF" size="1" face="Verdana">DENOMINAZIONE</font></b></td>
<td nowrap height="26" bgcolor="#66CCFF" width="41">
<p align="center"><b><font color="#0000FF" size="1" face="Verdana">SPORT</font></b></p>
</td>
<td nowrap height="26" bgcolor="#66CCFF" width="50">
<p align="center"><b><font color="#0000FF" size="1" face="Verdana">TIPO<br>
CTR</font></b></p>
</td>
<td nowrap height="26" bgcolor="#66CCFF" width="38">
<p align="center"><font color="#0000FF" size="1" face="Verdana"><b>NUM<br>
LETT</b></font></p>
</td>
<td nowrap bgcolor="#66CCFF" height="26" width="29">
<p align="center"><b><font color="#0000FF" size="1" face="Verdana">
LAV<br>
KIT</font></b></p>
</td>
</center>
<td nowrap bgcolor="#66CCFF" height="26" width="72" align="center">
<p><b><font color="#0000FF" size="1" face="Verdana">DATA
CENS</font></b></p>
</td>
</tr>
<center>
<%
If objRs.PageCount < intPage Then intPage = objRs.PageCount
objRs.AbsolutePage = intPage
Dim strRowColor
strRowColor = "#ffffff"
Do While Not objRs.EOF And intRecord <= intPageSize
'--- byluciani
%>
</center>
<tr bgcolor="<%=strRowColor%>">
<td nowrap height="16" width="32"><font face="Verdana" size="1">
<p align="right"><a title="Click per visualizzare la scheda completa" a href="javascript:DoPopUp('popup.asp?Contratto=<%=objRs("numcontratto").Value%>','Contratto','600','370','yes','no','no')"><%=objRs("numcontratto").Value%></a></td>
<!-- p align="right"><%=objRs("numcontratto").Value%></font></td-->
<center>
<td nowrap height="16" align="left" width="375"><font face="Verdana" size="1"><%=objRs("denominazionesociale").Value%></font></td>
<td nowrap height="16" width="41">
<p align="center"><font face="Verdana" size="1"><%=Right("00000" & objRs("sportello").Value, 5)%></font></td>
<center>
<td nowrap height="16" width="50"><font face="Verdana" size="1">
<p align="center"><%=objRs("tipocontratto").Value%></font></td>
<td nowrap height="16" width="38"><font face="Verdana" size="1">
<p align="center"><%=objRs("numerolettori").Value%></font></td>
<td nowrap height="16" width="29">
<p align="center"><font face="Verdana" size="1"><%=objRs("STATOLAVORAZIONE").Value%></font></td>
<td nowrap height="16" width="72"><font face="Verdana" size="1"><%=objRS("data").Value%></font></td>
</tr>
<%
If strRowColor = "#ffffff" Then strRowColor = "#90CCFF" Else strRowColor = "#ffffff"
intRecord = intRecord + 1
objRs.MoveNext
Loop
%>
<tr><td colspan="7" height="16" width="759" align="center"><hr size="1"></td></tr>
<tr><td colspan="7" height="15" width="759">
<p align="center"><%=Paging(intPage, objRs.PageCount, objRs.RecordCount)%></td></tr>
</table>
</center>
</td>
</tr>
<%End If%>
</table>
</div>
</body>
</html>
<%
'Object cleanup
If IsObject(objRs) Then
If Not objRs Is Nothing Then
If objRs.State = adStateOpen Then objRs.Close
Set objRs = Nothing
End If
End If
If IsObject(objCn) Then
If Not objCn Is Nothing Then
If objCn.State = adStateOpen Then objCn.Close
Set objCn = Nothing
End If
End If
%>
|
|
|
I'm not clear on how you want to "copy" from one value to the new, calculated value. Is it OK to do this server side in the ASP before sending the page to the user? Or do you need the user to be able to dynamically enter "workingdays" and create the new date using javascript in the client's browser without a round-trip to the server?
Since you posted in the ASP forum, I am assuming that you are looking for a server side solution. (This would be the easiest and eliminates javascript browser issues.)
workingDays = 6
oldDate = objRS.Fields("date")
newDate = DateAdd("D",workingDays,oldDate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|